codex-plugin-cc
codex-plugin-cc copied to clipboard
fix: treat task --help and unknown flags as CLI errors (#539)
Summary
parseArgsgainsrejectUnknownOptionsso unrecognized--flagsthrow instead of becoming prompt text.- Subcommand parsers enable that mode, accept
--help/-h, and print usage without starting a Codex thread. - Fixes #539 (Windows-reproable; defect is in JS arg handling).
AI assistance
Assisted by Cursor/Grok. I reviewed the diff, ran the tests below, and checked open PRs for overlap (#128/#535 are test-only coverage; #378 is adversarial focus parsing).
Evidence
node --test tests/args.test.mjs tests/commands.test.mjs tests/render.test.mjs
# 14 pass (includes task --help + unknown --flag with fake-codex: no threads)
node --test --test-name-pattern "task runs when the active provider" tests/runtime.test.mjs
# 1 pass
Test plan
- [x]
task --help --cwd <tmp> --jsonprints Usage and exits 0 - [x]
task --not-a-real-flagerrors withUnknown optionand does not create a thread - [x] Normal
taskprompt still runs under fake-codex