Repository navigation
Require Every CLI Script to Answer Help and Refuse Unknown Arguments - #2832
Conversation
CODESTYLE.md General now states that every command-line script answers --help and -h with its usage and exit 0, and refuses an argument it does not recognize before any read or write. The shell-codestyle Skill carries that section as a generated include. tests/test_cli_usage.py discovers every tracked shell, PowerShell, and Python entry point and runs each with --help and --bogus-flag beside recording stubs for gh, curl, and the other network or host-changing commands, asserting help exits 0 with usage, the flag is refused, no stub is reached, and the tree is unchanged. The scripts the gate found breaking the rule are fixed: spec/validate.py, spec/workflow_reuse.py, spec/fidelity_honesty.py, spec/resolve_description.py, and the python-directories action now parse their arguments with argparse. hub-fetch-run.py answers help and refuses an option before any fetch. install-tools.ps1 and setup-wsl.ps1 refuse a dash-prefixed positional before any read, and setup-wsl.ps1 refuses a distribution name outside -Install. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The gate's proxy is now a local listener recording every connection, so a script that takes an unknown flag as a target and fetches it fails the gate rather than passing on the fetch's own failure. Help is asked with -h as well as --help, and the case skips on Windows, where a stub with no executable extension shadows nothing. python-codestyle carries the Command-Line Arguments section as a generated include beside shell-codestyle, and the rule says help changes nothing rather than writes nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #2832 +/- ##
===========================================
- Coverage 60.31% 60.26% -0.05%
===========================================
Files 16 16
Lines 8479 8489 +10
===========================================
+ Hits 5114 5116 +2
- Misses 3365 3373 +8
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🟡 Changes recommended
The gate skips Windows entirely and cannot discover extensionless command-line scripts.
2 open findings
What changed in this PR
This PR adds a fleet-wide command-line argument rule and a test gate for scripts shipped by ProjectTemplate. It also updates existing entry points to answer help requests and reject unknown arguments.
Changes:
- Define the rule in CODESTYLE.md and distribute it through the Python and shell skills.
- Add a test gate for help and unknown-argument behavior.
- Update Python and PowerShell entry points to parse or reject arguments.
| File | Description |
|---|---|
| tests/test_cli_usage.py | Adds the CLI argument gate. |
| spec/workflow_reuse.py | Parses CLI options. |
| spec/validate.py | Parses CLI arguments. |
| spec/resolve_description.py | Parses required arguments. |
| spec/fidelity_honesty.py | Parses the report option. |
| host-setup/windows/setup-wsl.ps1 | Rejects unknown or misplaced arguments. |
| host-setup/windows/install-tools.ps1 | Rejects unknown options. |
| CODESTYLE.md | Defines the command-line rule. |
| catalog/snippets/hub-fetch-run.py | Adds help and first-argument validation. |
| .github/skills/shell-codestyle/SKILL.md | Distributes the shell rule. |
| .github/skills/python-codestyle/SKILL.md | Distributes the Python rule. |
| .github/actions/python-directories/python_directories.py | Parses CLI arguments. |
| .claude-plugin/fleet-skills/skills/shell-codestyle/SKILL.md | Distributes the shell rule. |
| .claude-plugin/fleet-skills/skills/python-codestyle/SKILL.md | Distributes the Python rule. |
| .claude-plugin/fleet-skills/.source-digests/shell-codestyle | Updates the generated source digest. |
| .claude-plugin/fleet-skills/.source-digests/python-codestyle | Updates the generated source digest. |
| .agents/skills/shell-codestyle/SKILL.md | Adds the rule to the shell skill source. |
| .agents/skills/python-codestyle/SKILL.md | Adds the rule to the Python skill source. |
🧠 Review effort: Lite
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…ilure Reporting Fixes to Main (#2816) ## Summary Promotes these pull requests from develop to main: - #2832 Require Every CLI Script to Answer Help and Refuse Unknown Arguments - #2833 Exempt nopep8 as a Leading Directive in the Prose Gate - #2815 Bind the Workspace-Edit Rule Only to an Agent Running Inside VS Code - #2813 Record HomeAssistant-Config's Incidental Python as a driftNote - #2827 Read nopep8 in Any Letter Case in the Prose Gate - #2825 Spend a Head Refusal a Later Genuine Round on That Head Answers - #2819 Read noqa and CSpell Directives in Any Letter Case - #2814 Judge the Prose in Front of a Trailing noqa or pylint Directive - #2811 Name Why a Windows Tool Install Failed and Print Docker's Status in UTF-8 - #2808 Read a Tool Name as a Prose Gate Directive Only Where It Opens the Comment - #2802 Name a File the Prose Gate Cannot Decode in Its Scope Line - #2800 Read a First-Line Comment After a Byte Order Mark as Leading in Every Language - #2797 Name a Python File the Prose Gate Cannot Parse in Its Scope Line - #2794 Let the Unattended Orchestrator Retry a Transient Dispatch Failure - #2792 Close the Remaining Blocked-Promotion Gaps in the Unattended Worker - #2790 Read a Carried Change Set Past the Compare Endpoint's 300-File Ceiling - #2784 Let a Round on the Head Outrank pr_review.py wait's Repo-Wide Quota Reading - #2782 Say What pr_review.py wait --min-rounds Counts and Name It at the Timeout - #2778 Share the Bounded Step Reader Across the Test Harnesses - #2776 Pin the Prose Gate's Override Wiring by Structure - #2773 Exempt a List Item's Label Separator from the Dash Rule for Every Marker and Bold Spelling - #2771 Strip a List Item's Opening Label for Every Marker and Bold Spelling in the Prose Gate - #2768 Page pr_review.py's Changed-File List Past 100 So a Large Promotion Can State Coverage - #2765 Let an Attested Local Pass Cover a Head Beside a Table-Less Copilot Round Closes #2285 Closes #2820 Closes #2818 Closes #2809 Closes #2807 Closes #1659 Closes #2796 Closes #2798 Closes #2163 Closes #1984 Closes #2614 Closes #2767 Closes #2781 Closes #2741 Closes #2775 Closes #1665 Closes #2770 Closes #2738 Closes #2758 Closes #2739 🤖 Generated with [Claude Code](https://claude.com/claude-code)

Adds the CODESTYLE.md General "Command-Line Arguments" rule (every CLI script answers
--helpand refuses unknown arguments before it reads or writes anything) and thetests/test_cli_usage.pygate that enforces it, and brings the existing scripts into line.Closes on promotion: #2285
Known items, each with its class:
spec/audit.pyrunsgit config --get remote.origin.urlon import, so scripts importing it read before parsing arguments (introduced, tracked in Resolve spec/audit.py's Hub Name Lazily So Importing Scripts Parse Arguments Before Any Read #2829).NOT_COMMAND_LINE(introduced, tracked in Make the Agent-Safety Hooks Run by Name Answer --help and Refuse Unknown Arguments #2786).--check sentence-lengthhits on CODESTYLE.md Shell paragraph sentences (pre-existing).spec/resolve_description.py) (introduced, deferred to Harden the CLI Usage Gate Against False Greens #2831).Local gates run: ruff format and check, mypy, prose gate,
repo_gate.py,spec/validate.py,build_dist.py --check, and the full unittest suite (2550 tests, OK).🤖 Generated with Claude Code