-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
Description
Problem
src/commands/run.ts is 2615 lines — the largest file in the codebase by 45%. It contains 8 functions over 80 lines, with runAgent() at 345 lines being the worst offender.
Measurements
| Function | Lines | Start |
|---|---|---|
runAgent |
345 | L1706 |
gatherSquadContext |
198 | L250 |
runSquad |
185 | L1360 |
runCloudDispatch |
163 | L1112 |
runLeadMode |
149 | L1555 |
executeWithClaude |
136 | L2334 |
executeWithProvider |
128 | L2480 |
runCommand |
81 | L1277 |
Location
src/commands/run.ts — all functions listed above.
Suggested Fix
Extract into focused modules under src/lib/execution/:
engine.ts—executeWithClaude,executeWithProvider, shared env/model resolutioncontext.ts—gatherSquadContext, learnings, definitionsmodes.ts—runSquad,runLeadMode,runAgentorchestrationcloud.ts—runCloudDispatchhelpers.ts—generateExecutionId,detectTaskType,formatDuration, etc.
Keep run.ts as a thin command handler (~200 lines) that delegates to these modules.
Reactions are currently unavailable