Skip to content

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

Closed

Description

@thymikee

Context

Command-knowledge now lives in two places: the catalog-derived early check in src/cli/parser/args.ts (isCommandKnown, added by #1038 with a sync-warning comment) and the authoritative dispatch fall-through in cli.ts (~line 408) that throws Unknown command after all runners decline. The duplication was created knowingly to fix error ordering (#1036); today the catalog covers all special-cased commands (verified: auth/connection/mcp/proxy/web are in LOCAL_CLI_COMMANDS), but any future command wired only into cli.ts will be rejected at parse time and the failure will look like a user typo.

Expectation

One exported predicate (catalog module is the natural home) consumed by both the parser early-check and anything else that needs command existence; the cli.ts fall-through remains as a defensive assert, ideally referencing the predicate. Acceptance: isCommandKnown in args.ts deleted or reduced to the shared call; a test enumerating every command cli.ts can dispatch against the predicate so drift fails loudly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions