fix: deduplicate CLI option definitions to fix missing --email flag (#525)#527
fix: deduplicate CLI option definitions to fix missing --email flag (#525)#527
Conversation
…525) The CLI had three separate copies of option definitions (setupProgram, parseArgs, getHelpText) that drifted out of sync. Extract a single configureOptions() method as the source of truth. This also fixes --whatsapp, --teams, --no-remote-extends, --allowed-remote-patterns, --message, --watch, --task-tracking, and --github-* flags missing from help or parseArgs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
PR OverviewSummaryThis PR fixes issue #525 where the Root Cause AnalysisThe
When new flags were added, developers typically only updated
SolutionThe PR extracts a single Files Changed1.
|
| Flag | Was Missing From |
|---|---|
--email |
parseArgs(), getHelpText() |
--whatsapp |
parseArgs(), getHelpText() |
--teams |
parseArgs(), getHelpText() |
--slack |
getHelpText() |
--telegram |
getHelpText() |
--a2a |
getHelpText() |
--no-remote-extends |
parseArgs(), getHelpText() |
--allowed-remote-patterns |
setupProgram(), getHelpText() |
--message |
getHelpText() |
--watch |
getHelpText() |
--task-tracking |
getHelpText() |
--github-* (4 flags) |
getHelpText() |
Architecture & Impact
Before: Three separate option definitions with drift
setupProgram() ── 30+ options (complete)
parseArgs() ── 28+ options (missing email, whatsapp, teams, no-remote-extends)
getHelpText() ── 20+ options (missing many frontend flags)
After: Single source of truth
configureOptions() ── All 30+ options (single source)
├─ setupProgram() calls configureOptions()
├─ parseArgs() calls configureOptions()
└─ getHelpText() calls configureOptions()
Affected System Components
- CLI parsing layer:
src/cli.ts-CLIclass - Main entry point:
src/cli-main.ts- type casts removed - Test suite:
tests/unit/cli-options-consistency.test.ts- new structural tests
Testing
- New test file:
cli-options-consistency.test.tswith 4 test cases - Structural test: Extracts all
--optionpatterns from help text and verifies each is parseable - All existing tests pass: 134 tests
- Build succeeds: No compilation errors
References
src/cli.ts:26-42- NewconfigureOptions()methodsrc/cli.ts:47-50- ModifiedsetupProgram()callingconfigureOptions()src/cli.ts:154-158- ModifiedparseArgs()callingconfigureOptions()src/cli.ts:228-230- ModifiedgetHelpText()callingconfigureOptions()src/cli-main.ts:1636-1641- Removed(options as any)castssrc/cli-main.ts:2034- Removed(options as any).emailcasttests/unit/cli-options-consistency.test.ts:1-79- New consistency tests
Metadata
- Review Effort: 2 / 5
- Primary Label: bug
Powered by Visor from Probelabs
Last updated: 2026-03-11T16:09:39.017Z | Triggered by: pr_opened | Commit: 2bb8346
💡 TIP: You can chat with Visor using /visor ask <your question>
✅ Security Check PassedNo security issues found – changes LGTM. ✅ Security Check PassedNo security issues found – changes LGTM. \n\n✅ Architecture Check PassedNo architecture issues found – changes LGTM. ✅ Performance Check PassedNo performance issues found – changes LGTM. Powered by Visor from Probelabs Last updated: 2026-03-11T16:08:00.561Z | Triggered by: pr_opened | Commit: 2bb8346 💡 TIP: You can chat with Visor using |
Summary
setupProgram(),parseArgs(),getHelpText()) with no shared source of truth. Each time a new flag was added, onlysetupProgram()was updated while the other two drifted.configureOptions()method that all three methods use, eliminating the entire class of "missing flag" bugsemailto theparseArgs()return value (was missing, forcing(options as any).emailcasts incli-main.ts)as anycasts incli-main.tsfortelegram,email,whatsapp,teams,a2aFlags fixed
--emailparseArgs(),getHelpText()--whatsappparseArgs(),getHelpText()--teamsparseArgs(),getHelpText()--slackgetHelpText()--telegramgetHelpText()--a2agetHelpText()--no-remote-extendsparseArgs(),getHelpText()--allowed-remote-patternssetupProgram(),getHelpText()--messagegetHelpText()--watchgetHelpText()--task-trackinggetHelpText()--github-*(4 flags)getHelpText()Test plan
cli-options-consistency.test.tsvalidates all frontend flags appear in help and parse correctly--optionsfrom help text and verifies each is accepted byparseArgs()— prevents future driftCloses #525
🤖 Generated with Claude Code