refactor: address technical debt with modularization and type safety#181
Merged
laynepenney merged 2 commits intomainfrom Jan 26, 2026
Merged
refactor: address technical debt with modularization and type safety#181laynepenney merged 2 commits intomainfrom
laynepenney merged 2 commits intomainfrom
Conversation
- Extract ~400 lines from index.ts into src/cli/ modules: - history.ts: command history management - pipeline-input.ts: file/glob resolution - non-interactive.ts: single-prompt mode execution - Improve workflow type safety with discriminated unions: - Add BaseWorkflowStep interface and WorkflowStep union type - Add type guards (isShellStep, isSwitchModelStep, etc.) - Replace `as any` casts with proper type narrowing - Fix symbol-index metadata types: - Add hasExtendsMetadata type guard - Add SymbolMetadataWithExtends interface - Fix flaky E2E test in commands.e2e.test.ts: - Add waitForOutputFlush helper to ProcessHarness - Use generic patterns and clearOutput() for robustness - Create plugin system investigation document: - Security analysis and recommendations - API stability assessment - Phased re-enablement roadmap Reduces `as any` usage from 30+ to 9 instances. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
4 tasks
Collaborator
Author
Self-ReviewVerified
Changes Reviewed
No issues found. Ready to merge. |
This was referenced Jan 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Address technical debt in the Codi codebase with four improvements:
1. CLI Module Extraction (~400 lines from index.ts)
src/cli/history.ts- Command history managementsrc/cli/pipeline-input.ts- File/glob resolution with security validationsrc/cli/non-interactive.ts- Single-prompt mode executionsrc/cli/index.ts- Module re-exports2. Workflow Type Safety
BaseWorkflowStepinterface andWorkflowStepdiscriminated unionisShellStep,isSwitchModelStep,isLoopStep, etc.)as anycasts with proper type narrowing3. Symbol Index Type Safety
hasExtendsMetadatatype guardSymbolMetadataWithExtendsinterface4. E2E Test Stability
waitForOutputFlush()helper toProcessHarnessclearOutput()for robustness5. Plugin System Investigation
docs/PLUGIN-INVESTIGATION.md6. Cleanup
Metrics
as anyusage from 30+ to 10 instancesTest plan
pnpm buildpasses with 0 errorspnpm testpasses (2129 tests)/compacttest now robust)🤖 Generated with Claude Code