Skip to content

Generate CLI docs from argparse and add CI verification#61

Merged
MicheleBonus merged 1 commit intomainfrom
codex/create-command-flag-source-of-truth
Mar 7, 2026
Merged

Generate CLI docs from argparse and add CI verification#61
MicheleBonus merged 1 commit intomainfrom
codex/create-command-flag-source-of-truth

Conversation

@MicheleBonus
Copy link
Copy Markdown
Owner

Motivation

  • Prevent divergence between the CLI implementation and the docs by deriving help text directly from the parser.
  • Make ambermeta/cli.py::build_parser() the single source of truth for global and per-command options.
  • Remove or correct hand-maintained/unsupported TUI option docs by reflecting the real parser output.

Description

  • Added scripts/export_cli_help.py, which imports build_parser(), renders format_help() for the root parser and subcommands, and injects those help blocks into docs/cli.md between markers like <!-- BEGIN_CLI_HELP:plan -->/<!-- END_CLI_HELP:plan -->.
  • Reworked docs/cli.md to embed generated help blocks for root, plan, init, validate, info, tui, and gui, replacing several hand-maintained tables and correcting the documented TUI options to match the parser.
  • Added a CI workflow .github/workflows/cli-docs-sync.yml that runs python scripts/export_cli_help.py --check and fails the job when the generated help differs from the committed docs.
  • The script supports a --check mode that exits non-zero when docs/cli.md is out of date and a normal mode that updates the file in-place.

Testing

  • Ran python scripts/export_cli_help.py to generate/update docs/cli.md, which completed successfully and updated the docs as expected.
  • Ran python scripts/export_cli_help.py --check which reported the docs are up to date and exited 0.
  • Ran pytest -q tests/test_cli_init.py tests/test_cli_protocol_output.py and observed all tests passed (7 passed).

Codex Task

@MicheleBonus MicheleBonus merged commit 4f17540 into main Mar 7, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant