Skip to content

refactor(#318): split run.ts monolith into focused modules - #347

Merged
admarble merged 1 commit into
mainfrom
feature/318-refactor-run-split
Mar 12, 2026
Merged

admarble merged 1 commit into
mainfrom
feature/318-refactor-run-split

Conversation

@admarble

Copy link
Copy Markdown
Contributor

Summary

  • Extract 3,865-line src/commands/run.ts into 4 focused modules under src/lib/workflow/
  • run.ts reduced to 960 lines (orchestration + re-exports for backwards compatibility)
  • All 1,511 existing tests pass without modification
  • Pure refactor — no behavior changes

New modules

Module Lines Responsibility
worktree-manager.ts 1,428 Worktree lifecycle, freshness, PR creation, rebase
phase-executor.ts 493 Phase execution, retry logic, QA verdict parsing
phase-mapper.ts 209 Label-to-phase detection, workflow parsing
batch-executor.ts 888 Batch execution, dependency sorting, issue logging

Test plan

  • All 1,511 tests pass (npm test)
  • TypeScript build passes (npm run build)
  • run.ts reduced to < 1,000 lines (960)
  • All existing exports re-exported from run.ts for backwards compatibility
  • No behavior changes — pure refactor

Fixes #318

Extract 3,865-line run.ts into 4 focused modules under src/lib/workflow/:

- worktree-manager.ts (1,428 lines): Worktree lifecycle, freshness checks,
  PR creation, rebase operations
- phase-executor.ts (493 lines): Phase execution with retry, QA verdict
  parsing, cold-start handling
- phase-mapper.ts (209 lines): Label-to-phase detection, workflow parsing,
  phase determination
- batch-executor.ts (888 lines): Batch execution, dependency sorting,
  issue logging, RunOptions

run.ts reduced to 960 lines (orchestration + re-exports).

All 1,511 tests pass. No behavior changes.

Fixes #318
@admarble
admarble merged commit a617eb8 into main Mar 12, 2026
3 of 6 checks passed
@admarble
admarble deleted the feature/318-refactor-run-split branch March 12, 2026 03:05
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.

refactor(run): split 3,459-line monolith into focused modules

1 participant