You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
refactor(devtools): make command metadata single-source #617
45 devtools/*.py modules construct their own argparse.ArgumentParser.
Generated docs and devtools --list-commands --json are catalog-derived, while command help and option parsing are parser-derived.
The product CLI already uses Click, but devtools reimplements grouping/listing/help routing separately.
Impact
Every devtools command has at least two sources of truth: catalog metadata and local parser metadata. That adds boilerplate to every new command and makes drift easy: descriptions, examples, JSON support, and option-level documentation can disagree across docs, inventory, and actual command help.
This also limits verifiability. devtools --list-commands --json cannot expose option-level metadata without inspecting or duplicating each local parser.
Acceptance criteria
Pick one source of truth for devtools command metadata.
Either migrate devtools to a Click/Typer-style command tree, or define a small first-party command-spec DSL that generates argparse parsers, docs, and JSON inventory from one declaration.
Preserve existing command names and common invocations.
Make generated docs/devtools.md and devtools --list-commands --json derive from the same metadata as command help.
Add a regression check that every registered command has synchronized docs/help/inventory metadata.
Run focused devtools command tests and devtools verify --quick.
Additional compactness note: the desired direction is specifically to keep CommandSpec as the docs/control-plane registry, but use Click as the executor for the top-level devtools command group.
Current evidence:
devtools/__main__.py hand-rolls top-level dispatch with argparse, an unknown-command check, and --json argv splicing.
devtools/command_catalog.py separately maintains command metadata and imports entrypoints by module string.
Individual devtools modules mostly still own their own argparse parsers.
A good first PR does not need to convert every subcommand to Click. It can build a generated Click group over COMMAND_SPECS, preserve current subcommand argv forwarding, and remove top-level custom dispatch/error/listing behavior. Later PRs can migrate subcommands opportunistically.
Superseded by #625. I consolidated this finding into the composite issue so the work can be handled as one coherent slice instead of as a tiny standalone ticket. The original evidence remains available in this issue history.
Activity
Sinity commentedon May 1, 2026
Additional compactness note: the desired direction is specifically to keep
CommandSpecas the docs/control-plane registry, but use Click as the executor for the top-leveldevtoolscommand group.Current evidence:
devtools/__main__.pyhand-rolls top-level dispatch with argparse, an unknown-command check, and--jsonargv splicing.devtools/command_catalog.pyseparately maintains command metadata and imports entrypoints by module string.A good first PR does not need to convert every subcommand to Click. It can build a generated Click group over
COMMAND_SPECS, preserve current subcommand argv forwarding, and remove top-level custom dispatch/error/listing behavior. Later PRs can migrate subcommands opportunistically.Ref #578
Sinity commentedon May 1, 2026
Superseded by #625. I consolidated this finding into the composite issue so the work can be handled as one coherent slice instead of as a tiny standalone ticket. The original evidence remains available in this issue history.