fix: centralize known cli command detection - #1055
Conversation
Size Report
Startup median (7 runs, lower is better):
Top changed chunks:
|
|
Sequencing note: this overlaps #1057 and both close #1043. I recommend not merging both. #1057 has broader drift coverage because it parses cli.ts with TypeScript and catches property-access command comparisons such as options.command, while this PR regexes only bare command === literal branches. Please close this one or retarget it only if there is unique coverage to preserve. |
Folds #1055's telemetry into this branch: known-command fall-through now emits cli_known_command_unhandled at error level alongside the distinct user-facing message, so catalog/dispatch drift is visible in diagnostics as well as to the user who hits it.
|
Superseding via #1057, which implements the same |
Folds #1055's telemetry into this branch: known-command fall-through now emits cli_known_command_unhandled at error level alongside the distinct user-facing message, so catalog/dispatch drift is visible in diagnostics as well as to the user who hits it.
Folds #1055's telemetry into this branch: known-command fall-through now emits cli_known_command_unhandled at error level alongside the distinct user-facing message, so catalog/dispatch drift is visible in diagnostics as well as to the user who hits it.
* refactor: centralize known cli command checks * feat: emit drift diagnostic for registered-but-unhandled commands Folds #1055's telemetry into this branch: known-command fall-through now emits cli_known_command_unhandled at error level alongside the distinct user-facing message, so catalog/dispatch drift is visible in diagnostics as well as to the user who hits it.
Summary
Centralizes known CLI command detection in src/command-catalog.ts and has the parser consume that shared predicate before flag-support validation, preserving the #1038 unknown-command precedence.
Adds focused drift coverage for public, local, internal, help, and literal cli.ts command branches so parser-level unknown-command handling stays aligned with CLI dispatch.
Closes #1043
Validation
Focused parser/CLI-help tests passed: pnpm exec vitest run src/utils/tests/args.test.ts src/tests/cli-help.test.ts.
Formatting passed: pnpm format.
Quick checks passed: pnpm check:quick.