"""ekb-cli:快报命令行工具 入口:注册所有命令组,统一捕获 EkbError 异常。 """ import typer from ekb_cli.commands import auth from ekb_cli.commands.agent import app as agent_app from ekb_cli.commands.help import cmd_commands from ekb_cli.commands.serve import cmd_serve app = typer.Typer( name="ekb", help="快报(ekuaibao)命令行工具", no_args_is_help=True, ) app.add_typer(auth.app, name="auth") app.add_typer(agent_app, name="agent") app.command("commands")(cmd_commands) app.command("serve")(cmd_serve) def main(): """CLI 入口:统一捕获 EkbError,输出友好错误信息""" from ekb_cli.errors import EkbError from rich import print as rprint try: app() except EkbError as e: rprint(f"[red]{e.message}[/red]") raise SystemExit(1)