Skip to content

refactor(cli): split entrypoint commands into modular registration files#196

Merged
im10furry merged 1 commit into
mainfrom
refactor/cli-command-registration
Jun 9, 2026
Merged

refactor(cli): split entrypoint commands into modular registration files#196
im10furry merged 1 commit into
mainfrom
refactor/cli-command-registration

Conversation

@im10furry

Copy link
Copy Markdown
Collaborator

Summary

Extract CLI command registration from monolithic cli.tsx into modular per-feature files.

New Files

src/entrypoints/cli/commandContext.ts

  • CliCommandRegistrationContext type for shared render/stdin context
  • omitKeys utility

src/entrypoints/cli/mainCommand.tsx (541 lines)

  • registerMainCommand() - main program command from cli.tsx
  • All flags, options, and action handler preserved

src/entrypoints/cli/commands/ (10 files)

  • index.ts, config.ts, models.ts, agents.ts, pluginSkills.ts
  • approvedTools.ts, mcp.tsx, doctorUpdate.tsx, session.tsx, context.ts

src/types/untyped-deps.d.ts

  • Type declarations for shell-quote, turndown, semver, debug

Tests

  • tests/unit/anthropic-helpers.test.ts - 6 test cases
  • tests/unit/cli-command-registration.test.ts - 4 test cases

Bug Fix

  • session.tsx: fix legacy number regex /^-?\d+$/ (was double-escaped)

- Extract mainCommand.tsx (541 lines) from cli.tsx for the main program command
- Add commands/ directory with per-feature registration files:
  config, models, agents, pluginSkills, approvedTools, mcp, doctorUpdate, session, context
- Add commandContext.ts with shared registration context type and omitKeys utility
- Add untyped-deps.d.ts for shell-quote, turndown, semver, and debug module types
- Fix regex in session.tsx: \\\\d → \\d for legacy number detection
- Add tests: anthropic-helpers (6 cases) and cli-command-registration (4 cases)
@im10furry im10furry merged commit 3077c58 into main Jun 9, 2026
3 checks passed
@im10furry im10furry deleted the refactor/cli-command-registration branch June 9, 2026 07:19
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.

1 participant