File size: 2,170 Bytes
a7d7463
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
"""Main CLI Entry Point"""

import sys
import click
from rich.console import Console

from .commands import run_command, train_command, eval_command
from .interactive import InteractiveMode

console = Console()


@click.group()
@click.version_option(version="1.0.0")
def main():
    """🧑‍💻 Burme-Coder-Max - Myanmar AI Coding Agent"""
    pass


@main.command()
@click.argument("instruction")
@click.option("--model", default="gpt-4", help="AI model to use")
@click.option("--verbose", is_flag=True, help="Verbose output")
def ask(instruction: str, model: str, verbose: bool):
    """Ask a coding question in Burmese or English"""
    from src.core import CoderAgent
    from src.animations import Spinner
    from src.ui.thanking import ThankYou

    agent = CoderAgent(model=model)

    with Spinner("Thinking..."):
        response = agent.generate_response(instruction)

    console.print(response["response"])

    if verbose:
        console.print(f"\n[dim]Session: {response['session_id']}[/dim]")
        console.print(f"[dim]Model: {response['model']}[/dim]")

    ThankYou.show()


@main.command()
@click.option("--host", default="0.0.0.0", help="Host to bind")
@click.option("--port", default=5000, help="Port to bind")
def serve(host: str, port: int):
    """Start API server"""
    console.print(f"[green]Starting server on {host}:{port}...[/green]")
    console.print("[yellow]API server not yet implemented[/yellow]")


@main.command()
def interactive():
    """Start interactive mode"""
    mode = InteractiveMode()
    mode.start()


@main.command()
@click.option("--data", default="./data/trajectories", help="Training data directory")
@click.option("--epochs", default=10, help="Number of epochs")
def train(data: str, epochs: int):
    """Train the agent on trajectories"""
    train_command(data, epochs)


@main.command()
@click.option("--data", default="./data/trajectories", help="Evaluation data")
def eval(data: str):
    """Evaluate agent performance"""
    eval_command(data)


# Register subcommands
main.add_command(run_command)
main.add_command(train_command)
main.add_command(eval_command)


if __name__ == "__main__":
    main()