Repository navigation
Command surface audit: eight parser fixes #272
grisuno
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I audited the full command surface and fixed eight broken commands.
I built scripts/devtools/command_audit.py. It boots the shell once, calls
help for every registered command, and probes every @with_argparser command
with an invalid flag so cmd2 exercises the parser without running the body.
The result: 837 commands registered, 8 failing.
The eight failures shared one mechanism: they built their parser with plain
argparse.ArgumentParser while cmd2 requires Cmd2ArgumentParser. cmd2 validates
the parser when the command is dispatched, so help and execution raised for
auto_populate, facts_show, rag_query, parquet_query, threat_model,
playbook_run, status_bar and orchestrate. This predates the security work
(commit 6e62749). I switched the builders to Cmd2ArgumentParser.
I also re-ran the shell-syntax scan over every subprocess call. The flagged
sites are all argv lists, not command strings, so the earlier fix covers them.
I verified the shared runners live: LazyOwnShell.cmd and core.process.run_command
interpret chaining and tilde, and a gum command routed through cmd keeps its
ANSI color.
The lesson: a parser class is architecture, not style. cmd2 owns the dispatch
contract, and a plain ArgumentParser violates it silently until dispatch.
Validation: pytest 3620 passed, BDD 530 passed, mutation 12 of 12 runners,
command audit 0 errors, ruff green.
All reactions