Summary
The CLI uses normal argparse global options, so --repository and --config must appear before the subcommand. This is documented in the reference, but it is an easy mistake during manual or agent operation:
deploybot doctor --repository Forward-Future/DeployBot --json
fails with:
deploybot: error: unrecognized arguments: --repository Forward-Future/DeployBot
The correct form is:
deploybot --repository Forward-Future/DeployBot doctor --json
This is not a correctness bug, but it is a usability papercut for an agent-facing tool.
Evidence
The reference documents global options before the command:
deploybot [--config PATH] [--repository OWNER/REPO] COMMAND ...
The parser defines --repository and --config on the top-level parser, not on each subcommand.
When global options are placed after a subcommand, argparse reports them as unrecognized.
Impact
DeployBot is explicitly intended for coding agents and fast operator workflows. Agents frequently synthesize CLI commands in the form:
tool subcommand --global-option value --subcommand-option
The current error is technically correct but does not tell the operator the fix. During setup or incident response, this creates unnecessary friction.
Proposed fix
Either:
- Accept global
--repository and --config after subcommands, or
- Keep strict top-level parsing but improve the error message/hint when
--repository or --config appears after a subcommand.
For example:
deploybot: --repository is a global option; put it before the command:
deploybot --repository OWNER/REPO doctor --json
The lower-risk fix is to add the same optional global flags to subparsers and normalize them into the top-level values, or intercept common parse failures and print a targeted hint.
Acceptance criteria
Verification
- Add parser tests in
tests/test_cli.py or tests/test_docs.py.
- Run
python -m unittest discover -s tests.
- Run
ruff check ..
Summary
The CLI uses normal
argparseglobal options, so--repositoryand--configmust appear before the subcommand. This is documented in the reference, but it is an easy mistake during manual or agent operation:fails with:
The correct form is:
This is not a correctness bug, but it is a usability papercut for an agent-facing tool.
Evidence
The reference documents global options before the command:
The parser defines
--repositoryand--configon the top-level parser, not on each subcommand.When global options are placed after a subcommand,
argparsereports them as unrecognized.Impact
DeployBot is explicitly intended for coding agents and fast operator workflows. Agents frequently synthesize CLI commands in the form:
The current error is technically correct but does not tell the operator the fix. During setup or incident response, this creates unnecessary friction.
Proposed fix
Either:
--repositoryand--configafter subcommands, or--repositoryor--configappears after a subcommand.For example:
The lower-risk fix is to add the same optional global flags to subparsers and normalize them into the top-level values, or intercept common parse failures and print a targeted hint.
Acceptance criteria
deploybot doctor --repository owner/repo --jsoneither works or prints a targeted hint explaining the correct argument order.--config.Verification
tests/test_cli.pyortests/test_docs.py.python -m unittest discover -s tests.ruff check ..