"""Main CLI entry point for AgentEvalTool."""

import typer
from agenteval.storage.db import init_db

from cli.report import app as report_app
from cli.run import app as run_app
from cli.scenario import app as scenario_app
from cli.server import app as server_app
from cli.target import app as target_app

app = typer.Typer(
    name="agenteval",
    help="智能体质量评估工具集平台",
    no_args_is_help=True,
)

app.add_typer(target_app, name="target", help="评测对象管理")
app.add_typer(scenario_app, name="scenario", help="评测场景管理")
app.add_typer(run_app, name="run", help="评测执行")
app.add_typer(report_app, name="report", help="评测报告")
app.add_typer(server_app, name="server", help="启动 Web 后台服务")


@app.callback()
def main() -> None:
    """Initialize the database before running any command."""
    init_db()


if __name__ == "__main__":
    app()
