Skip to content

refactor(cli): extract parser diagnostics - #276

Merged
kunaldhongade merged 1 commit into
mainfrom
feature/262-cli-parser-diagnostics
Jun 28, 2026
Merged

refactor(cli): extract parser diagnostics#276
kunaldhongade merged 1 commit into
mainfrom
feature/262-cli-parser-diagnostics

Conversation

@kunaldhongade

Copy link
Copy Markdown
Member

Refs #262

Scope

Fourth small CLI modularization slice under the package-by-package refactor roadmap. This moves unknown command/option diagnostics and suggestion matching out of packages/cli/src/index.ts into packages/cli/src/parsers/diagnostics.ts.

What changed

  • Added packages/cli/src/parsers/diagnostics.ts for unknown-command and unknown-option error construction.
  • Moved suggestion token normalization and Levenshtein matching out of index.ts.
  • Kept command routing, argument parsing, handlers, rendering, runtime errors, and output behavior in index.ts.
  • Preserved current user-facing error text and exit code behavior.
  • Reduced packages/cli/src/index.ts from about 7,498 lines to about 7,397 lines.

Safety

  • Behavior-preserving refactor only.
  • No command names, flags, stdout/stderr format, or exit-code changes intended.
  • No telemetry, cloud dependency, API key requirement, hidden LLM/model call, or CodeDecayCloud dependency added.
  • No generated local artifacts or user data committed.

Validation

  • pnpm typecheck
  • pnpm run lint
  • pnpm exec vitest run packages/cli/test/cli.test.ts packages/cli/test/built-cli.test.ts packages/core/test/core.test.ts
  • pnpm test
  • pnpm build
  • pnpm --filter @submuxhq/codedecay pack --dry-run
  • node packages/cli/dist/index.js analze exits 2 and suggests analyze
  • node packages/cli/dist/index.js analyze --formt markdown exits 2 and suggests --format
  • node packages/cli/dist/index.js --help
  • node packages/cli/dist/index.js version

@github-actions github-actions Bot added the area: cli CLI package or command behavior label Jun 28, 2026
@kunaldhongade
kunaldhongade merged commit 04a8fb7 into main Jun 28, 2026
7 checks passed
@kunaldhongade
kunaldhongade deleted the feature/262-cli-parser-diagnostics branch June 28, 2026 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: cli CLI package or command behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant