refactor: split main.ts god module into focused sub-modules #1137
Labels
No labels
area:agents
area:dashboard
area:database
area:design
area:design-review
area:flows
area:infra
area:meta
area:security
area:sessions
area:webhook
area:workdir
security
type:bug
type:chore
type:meta
type:user-story
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
charles/agent-hooks#1137
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
As a developer maintaining the server, I want
main.tsto be a thin bootstrap orchestrator (≤300 lines), so that each concern — HTTP routing, worker registry, task history, SSE broadcast, startup wiring — has a dedicated module that can be read, tested, and changed independently.Decomposition
WorkerRegistry(FIFO queue + concurrency limiter) →infrastructure/worker/worker-registry.tsSSEBroadcaster(per-client streams + fanout) →infrastructure/sse/sse-broadcaster.tsinfrastructure/database/; wire consistentlyhttp/server.tsmain.tsbecomes: parse env, open DB, construct dependencies, callstartServer()Constraints
just dev/just startentrypointsOut of scope
webhook-config.ts(tracked separately)board.ts(tracked separately)References
apps/server/src/main.ts(4924 lines)