Skip to content

fix(cli): make --list work for models and tools commands - #11

Open
svngoku wants to merge 1 commit into
masterfrom
fix/models-list-flag
Open

svngoku wants to merge 1 commit into
masterfrom
fix/models-list-flag

Conversation

@svngoku

@svngoku svngoku commented Dec 5, 2026

Copy link
Copy Markdown
Contributor

agentic-internet models --list and models -l printed nothing and exited 0, even though the README documents that exact command. tools --list had the same bug.

Related: #10 (model alias refresh) also touches the model CLI and documents this bug as a known issue. The two PRs merge cleanly in either order: master + #9 + #10 + this PR together give 271 passed, 1 skipped.

Summary

Both commands declared a boolean option that defaults to on and has a single flag name, so it had no off switch. Typer treats passing the flag as toggling it, which turned listing off:

 # agentic_internet/cli.py: tools() and models()
-    list_tools: bool = typer.Option(True, "--list", "-l", help="List available tools"),
+    list_tools: bool = typer.Option(True, "--list/--no-list", "-l", help="List available tools"),
-    list_all: bool = typer.Option(True, "--list", "-l", help="List all available models"),
+    list_all: bool = typer.Option(True, "--list/--no-list", "-l", help="List all available models"),

Listing stays the default, --list and -l now mean on, and --no-list turns it off. Nothing else about how the commands choose their output changes.

New tests/test_cli_listing.py adds 14 CliRunner cases:

  • models, --list, -l, --no-list, --category, --details, and --live with the fetch mocked.
  • tools, --list, -l, --multi, and --use-cases, with the agent replaced by a stand-in.

They need no network or API keys.

Evidence

No API keys set, no network:

Invocation Before (master) After
models --list / models -l 0 lines 43-line catalog, identical to bare models
models 43 lines unchanged
models --no-list option did not exist 0 lines
tools --list --multi nothing printed lists the SerpAPI tools (18 lines)
  • New tests on master's source: 10 failed, 4 passed (the 4 cover invocations that already worked).
  • This branch: 264 passed, 1 skipped (master: 250 + 1).
  • Ruff, ruff format, mypy (30 files) and golden principles are clean. uv.lock is unchanged.

Merge Danger

Door: two-way

The change is two option strings plus a new test file.

Blast Radius: CLI

`models` and `tools` declared `typer.Option(True, "--list", "-l")`. A
boolean option with a single flag name and default True has no off
switch, so Click treats the flag as `flag_value = not default`: passing
`--list`/`-l` set the value to False and skipped the listing branch,
printing nothing with exit 0.

Declare an explicit `--list/--no-list` pair (keeping `-l`) so the flag
means True while bare `models`/`tools` still list by default.

Add CliRunner tests for models/tools with and without --list/-l plus
--category, --details, --live fallback, --multi and --use-cases.
@svngoku svngoku added the bug Something isn't working label Dec 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant