Skip to content

fix: centralize known cli command detection - #1055

Closed
thymikee wants to merge 1 commit into
mainfrom
fix/known-cli-commands
Closed

fix: centralize known cli command detection#1055
thymikee wants to merge 1 commit into
mainfrom
fix/known-cli-commands

Conversation

@thymikee

@thymikee thymikee commented Jul 3, 2026

Copy link
Copy Markdown
Member

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.

@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown

Size Report

Metric Base Current Diff
JS raw 1.5 MB 1.5 MB +182 B
JS gzip 483.4 kB 483.5 kB +26 B
npm tarball 585.2 kB 585.2 kB +7 B
npm unpacked 2.1 MB 2.1 MB +182 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 26.3 ms 26.0 ms -0.3 ms
CLI --help 46.5 ms 45.8 ms -0.7 ms

Top changed chunks:

Chunk Raw diff Gzip diff
dist/src/1986.js +138 B +19 B
dist/src/cli.js +44 B +7 B

@thymikee

thymikee commented Jul 3, 2026

Copy link
Copy Markdown
Member Author

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.

thymikee added a commit that referenced this pull request Jul 3, 2026
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.
@thymikee

thymikee commented Jul 3, 2026

Copy link
Copy Markdown
Member Author

Superseding via #1057, which implements the same isKnownCliCommandName single-source predicate plus a distinct user-facing message for registered-but-unhandled commands — and I've folded this PR's cli_known_command_unhandled diagnostic into #1057 (160f418), so nothing from here is lost. Recommend closing this one in favor of #1057.

thymikee added a commit that referenced this pull request Jul 3, 2026
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.
@thymikee thymikee closed this Jul 3, 2026
thymikee added a commit that referenced this pull request Jul 3, 2026
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.
thymikee added a commit that referenced this pull request Jul 3, 2026
* 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Single source of truth for 'is this a known CLI command'

1 participant