Skip to content

[REFACTOR] agentwatch/cli/main.py is 2,495 lines holding 23 commands #600

Description

@SakethSumanBathini

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.

Metadata

Metadata

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions