"""CLI entrypoint for the Textual TUI."""

from __future__ import annotations

from typing import Annotated

import typer

app = typer.Typer(help="Launch the Textual TUI.")


@app.callback(invoke_without_command=True)
def tui_callback(
    headless: Annotated[
        bool,
        typer.Option(
            "--headless",
            help="Run a one-shot headless startup check instead of full UI loop.",
        ),
    ] = False,
) -> None:
    """Launch the CleverAgents TUI."""
    # Import lazily so non-TUI commands avoid Textual startup cost.
    from cleveragents.tui.commands import run_tui

    raise typer.Exit(run_tui(headless=headless))
