@app.callback()
def app_main(
ctx: typer.Context,
version: Annotated[
bool,
typer.Option(
"--version",
"-V",
callback=version_callback,
is_eager=True,
help="Show version and exit.",
),
] = False,
config: Annotated[
Path | None,
typer.Option(
"--config",
"-c",
help="Path to configuration file (TOML, JSON, or YAML)",
exists=True,
file_okay=True,
dir_okay=False,
readable=True,
),
] = None,
) -> None:
"""CCProxy API Server - Anthropic and OpenAI compatible interface for Claude."""
# Store config path for commands to use
ctx.ensure_object(dict)
ctx.obj["config_path"] = config
# If no command is invoked, run the serve command by default
if ctx.invoked_subcommand is None:
# Import here to avoid circular imports
from .commands.serve import api
# Invoke the serve command
ctx.invoke(api)