Commit 5d34a9c
refactor: Extract api-server.ts routes into 6 modular route files
api-server.ts reduced from 3089 → 449 lines (85% reduction).
All 71 route handlers extracted into focused modules:
- routes/governance.ts: 8 governance endpoints
- routes/commands.ts: command execution + EXECUTABLE_COMMANDS
- routes/workers.ts: 11 worker pool endpoints
- routes/runspaces.ts: 10 runspace CRUD/lifecycle endpoints
- routes/features.ts: vision, MCP, state, agents, architecture, YOLO, auth
- routes/forge.ts: init, feedback, compliance, errors, diffs, health
Shared infrastructure:
- route-context.ts: RouteContext interface for dependency injection
- middleware.ts: rate limiting, validation schemas
Also removes 2 remaining as-any casts in App.tsx and dashboard-live.tsx.
Verified: tsc clean, 64 test files pass (1953 tests), real server
tested with curl against all major endpoints (Rule 0).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent bef430d commit 5d34a9c
11 files changed
Lines changed: 3118 additions & 2825 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
829 | 829 | | |
830 | 830 | | |
831 | 831 | | |
832 | | - | |
833 | | - | |
834 | | - | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
835 | 835 | | |
836 | 836 | | |
837 | 837 | | |
| 838 | + | |
838 | 839 | | |
839 | 840 | | |
840 | 841 | | |
| 842 | + | |
841 | 843 | | |
842 | 844 | | |
843 | 845 | | |
844 | 846 | | |
845 | | - | |
| 847 | + | |
846 | 848 | | |
847 | 849 | | |
848 | 850 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
454 | 454 | | |
455 | 455 | | |
456 | 456 | | |
457 | | - | |
| 457 | + | |
458 | 458 | | |
459 | 459 | | |
460 | 460 | | |
| |||
0 commit comments