agentwatch/cli/main.py is 2,495 lines, with 23 Typer commands and 43 top-level functions —
routing, rendering, API calls, upgrade/checkout logic, policy display, server startup, export,
compare and live watch, all in one module.
What that costs today:
- a one-line change to any command drags in the whole module's import graph in tests
- commands are hard to test in isolation, so CLI behaviour is under-covered relative to the core
package
- two people touching the CLI in the same week will conflict
Suggested fix
Split by command family into agentwatch/cli/commands/*.py, each registering onto the existing
Typer app. The CLI surface does not change — same commands, same flags, same output, same help
text.
That "no behaviour change" property is what makes it reviewable: the acceptance test is that the
existing CLI tests pass untouched, and agentwatch --help produces byte-identical output before
and after.
Worth doing in one pass rather than incrementally, since a half-split CLI is worse than either end
state. Happy to take it, but I'd want to agree the module boundaries in this issue first rather than
discovering them in review.
agentwatch/cli/main.pyis 2,495 lines, with 23 Typer commands and 43 top-level functions —routing, rendering, API calls, upgrade/checkout logic, policy display, server startup, export,
compare and live watch, all in one module.
What that costs today:
package
Suggested fix
Split by command family into
agentwatch/cli/commands/*.py, each registering onto the existingTyper app. The CLI surface does not change — same commands, same flags, same output, same help
text.
That "no behaviour change" property is what makes it reviewable: the acceptance test is that the
existing CLI tests pass untouched, and
agentwatch --helpproduces byte-identical output beforeand after.
Worth doing in one pass rather than incrementally, since a half-split CLI is worse than either end
state. Happy to take it, but I'd want to agree the module boundaries in this issue first rather than
discovering them in review.