refactor(auto): decompose auto.ts into focused modules (#534)
* refactor(auto): decompose auto.ts into focused sub-modules (#518)
Extract ~730 lines from auto.ts (3,819 -> 3,097 lines) into three
focused modules:
- auto-recovery.ts: artifact resolution/verification, skip artifacts,
completed-unit persistence, merge reconciliation, self-heal, loop
remediation steps
- auto-dashboard.ts: progress widget, elapsed time formatting, unit
description helpers, slice progress cache, footer factory
- auto-supervisor.ts: SIGTERM handling, working-tree activity detection
auto.ts retains all state machine logic (dispatchNextUnit, handleAgentEnd,
startAuto, stopAuto, pauseAuto, recoverTimedOutUnit) and the module-level
globals. Sub-modules are pure functions receiving parameters — no circular
dependencies or AutoContext abstraction.
All existing exports preserved via re-exports. Tests updated to reflect
the source file changes.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* refactor(auto): extract prompt builders + fix require() in recovery
- Extract 11 prompt builder functions, 6 inline helpers, 2 adaptive
replanning checks, and text utilities into auto-prompts.ts (785 lines)
- Replace inline merge reconciliation block with reconcileMergeState()
call (already existed in auto-recovery.ts but was duplicated)
- Fix CommonJS require("node:fs") in auto-recovery.ts → ESM import
- auto.ts: 3,819 → 2,321 lines (39% reduction)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Merge origin/main into refactor/518-decompose-auto-ts
Resolve conflicts in auto.ts:
- Keep PR's refactored imports (extracted to sub-modules)
- Add main's new BudgetEnforcementMode type import
- Add main's new sendDesktopNotification import
- Add main's budget alert functions (getBudgetAlertLevel, etc.)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>