-
Notifications
You must be signed in to change notification settings - Fork 0
cli refactors #225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cli refactors #225
Conversation
Reorganize the CLI codebase from a single 1118-line file into 13 focused modules: - index.ts: Thin entry point (115 lines) - builder.ts: Command registration with bargs - context.ts: CliContext type and dependency injection - handlers.ts: Signal handlers for graceful shutdown - theme.ts: Synthwave color theme - parsers/: Directory for all bargs parser definitions - global.ts, run.ts, init.ts, analyze.ts, test.ts - history.ts, baseline.ts (subcommand parsers) - index.ts (re-exports) Co-Authored-By: Claude <[email protected]>
Apply bargs' camelCaseValues transform to all parsers with kebab-case options. This enables cleaner property access in command handlers: - values.noColor instead of values['no-color'] - values.outputFile instead of values['output-file'] - values.excludeTag instead of values['exclude-tag'] - etc. Co-Authored-By: Claude <[email protected]>
…dlers process.exit() terminates immediately without letting async operations complete properly. Using process.exitCode allows the event loop to drain naturally. Co-Authored-By: Claude <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR refactors the CLI codebase by splitting a monolithic 1118-line index.ts file into 13 focused modules for better maintainability. The refactoring includes:
- Applying bargs'
camelCaseValuestransform for cleaner property access (e.g.,values.noColorinstead ofvalues['no-color']) - Using
process.exitCodeinstead ofprocess.exit()in async command handlers to allow proper event loop drainage - Organizing code into focused modules: parsers, builders, handlers, context, and theme
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/cli/index.ts | Refactored to thin entry point (115 lines), delegating to new modules |
| src/cli/builder.ts | Command registration logic with bargs, uses process.exitCode for async handlers |
| src/cli/context.ts | CLI context type and dependency injection, correctly uses camelCase properties |
| src/cli/handlers.ts | Signal handlers extracted for graceful shutdown |
| src/cli/theme.ts | Synthwave color theme configuration |
| src/cli/parsers/global.ts | Global options with camelCaseValues transform |
| src/cli/parsers/run.ts | Run command parser with validation (has critical bug with property access order) |
| src/cli/parsers/init.ts | Init command parser with camelCaseValues transform |
| src/cli/parsers/analyze.ts | Analyze command parser with validation |
| src/cli/parsers/test.ts | Test command parser definition |
| src/cli/parsers/history.ts | History subcommand parsers (has critical bug with property access order) |
| src/cli/parsers/baseline.ts | Baseline subcommand parsers with camelCaseValues |
| src/cli/parsers/index.ts | Re-exports all parser modules |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
3f9614e to
755f38f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 13 out of 13 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

chore(cli): split index.ts into focused modules
Reorganize the CLI codebase from a single 1118-line file into 13 focused
modules:
Co-Authored-By: Claude [email protected]
chore(cli): use camelCaseValues transform for cleaner property access
Apply bargs' camelCaseValues transform to all parsers with kebab-case
options. This enables cleaner property access in command handlers:
Co-Authored-By: Claude [email protected]
fix(cli): use process.exitCode instead of process.exit() in async handlers
process.exit() terminates immediately without letting async operations
complete properly. Using process.exitCode allows the event loop to drain
naturally.
Co-Authored-By: Claude [email protected]