Source
Audit report — Section 7: Technical Debt > Architecture
Description
orchestrator.ts, worktree.ts, integration.ts, and other core modules directly import and call gitCommand(), tmux functions, and Bun.spawn(). This makes unit testing difficult — tests must mock module-level imports via spyOn rather than injecting test doubles through constructors.
Current State
orchestrator.ts directly imports from tmux.ts, git.ts, integration.ts, worktree.ts
- Tests use
spyOn(module, 'function') pattern extensively (fragile, order-dependent)
- No interface abstractions for git operations, tmux, or process spawning
Proposed Solution
- Define interfaces:
GitClient, Multiplexer, ProcessRunner
- Accept these via constructor injection in
Orchestrator, MergeTrain, WorktreeProvider
- Provide default implementations wrapping current functions
- Tests inject mocks directly — no more module-level spying
Relationship to Other Issues
Priority
P3 — architectural improvement, not blocking any functionality. Best done alongside #17 decomposition.
Source
Audit report — Section 7: Technical Debt > Architecture
Description
orchestrator.ts,worktree.ts,integration.ts, and other core modules directly import and callgitCommand(), tmux functions, andBun.spawn(). This makes unit testing difficult — tests must mock module-level imports viaspyOnrather than injecting test doubles through constructors.Current State
orchestrator.tsdirectly imports fromtmux.ts,git.ts,integration.ts,worktree.tsspyOn(module, 'function')pattern extensively (fragile, order-dependent)Proposed Solution
GitClient,Multiplexer,ProcessRunnerOrchestrator,MergeTrain,WorktreeProviderRelationship to Other Issues
Priority
P3 — architectural improvement, not blocking any functionality. Best done alongside #17 decomposition.