From 6de0ffdf5301b38f9de26f1b56f6cdacaac99962 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Pokorn=C3=BD?= Date: Tue, 6 Jan 2026 15:13:44 +0100 Subject: [PATCH] fix(agentstack-cli): display help on no-args MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jan Pokorný --- .../src/agentstack_cli/__init__.py | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/apps/agentstack-cli/src/agentstack_cli/__init__.py b/apps/agentstack-cli/src/agentstack_cli/__init__.py index 9e114c3f0..a80233769 100644 --- a/apps/agentstack-cli/src/agentstack_cli/__init__.py +++ b/apps/agentstack-cli/src/agentstack_cli/__init__.py @@ -16,16 +16,14 @@ import agentstack_cli.commands.self import agentstack_cli.commands.server import agentstack_cli.commands.user -from agentstack_cli.async_typer import AliasGroup, AsyncTyper +from agentstack_cli.async_typer import AsyncTyper from agentstack_cli.configuration import Configuration logging.basicConfig(level=logging.INFO if Configuration().debug else logging.FATAL) logging.getLogger("httpx").setLevel(logging.WARNING) # not sure why this is necessary -class RootHelpGroup(AliasGroup): - def get_help(self, ctx): - return """\ +HELP_TEXT = """\ Usage: agentstack [OPTIONS] COMMAND [ARGS]... ╭─ Getting Started ──────────────────────────────────────────────────────────╮ @@ -63,7 +61,19 @@ def get_help(self, ctx): """ -app = AsyncTyper(no_args_is_help=True, cls=RootHelpGroup) +app = AsyncTyper() + + +@app.callback(invoke_without_command=True) +def main( + ctx: typer.Context, + help: bool = typer.Option(False, "--help", help="Show this message and exit."), +): + if help or ctx.invoked_subcommand is None: + typer.echo(HELP_TEXT) + raise typer.Exit() + + app.add_typer(agentstack_cli.commands.model.app, name="model", no_args_is_help=True, help="Manage model providers.") app.add_typer(agentstack_cli.commands.agent.app, name="agent", no_args_is_help=True, help="Manage agents.") app.add_typer(