Skip to content

Commit 3c01c39

Browse files
lanmowerclaude
andcommitted
docs: update CLAUDE.md architecture map for server.js extraction
Add entries for ws-setup, ws-legacy-handlers, http-handler, server-startup, server-startup2, routes-registry. Update server.js description to reflect that it is now a thin bootstrap/wiring module (200L). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent faf46a6 commit 3c01c39

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

CLAUDE.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Server starts on `http://localhost:3000`, redirects to `/gm/`.
1414
## Architecture
1515

1616
```
17-
server.js HTTP server + WebSocket + all API routes (raw http.createServer)
17+
server.js Bootstrap: imports, constants, wiring of all factories; delegates to lib/ modules for HTTP handler, WS setup, routes, startup
1818
database.js SQLite connection, schema DDL, migrations (queries extracted to lib/db-queries.js)
1919
acp-queries.js ACP query helpers (UUID, timestamp, JSON utilities)
2020
bin/gmgui.cjs CLI entry point (npx agentgui / bun x agentgui)
@@ -62,8 +62,14 @@ lib/routes-agent-actions.js Agent auth and update HTTP route handlers (POST /ap
6262
lib/routes-auth-config.js Auth config HTTP route handlers (GET /api/auth/configs, POST /api/auth/save-config)
6363
lib/routes-upload.js Express sub-app: POST /api/upload/:conversationId (Busboy file upload) + GET /files/:conversationId fsbrowse router; createExpressApp(deps) factory
6464
lib/http-utils.js HTTP utility functions (parseBody, acceptsEncoding, compressAndSend, sendJSON)
65+
lib/http-handler.js Main HTTP request handler factory: createHttpHandler(deps) => async (req,res); rate limiting, auth, CORS, route dispatch, static file serving
6566
lib/provider-config.js Provider config helpers (buildSystemPrompt, maskKey, getProviderConfigs, saveProviderConfig, PROVIDER_CONFIGS)
6667
lib/server-utils.js Server utility functions (logError, errLogPath, makeCleanupExecution, makeGetModelsForAgent)
68+
lib/routes-registry.js Route + WS handler registration: createRegistry(wsRouter, deps) => _routes; wires all HTTP route _match objects and all WS handler registrations
69+
lib/ws-setup.js WebSocket server setup: createWsSetup(server, deps) => { wss, hotReloadClients }; connection auth, client tracking, watch file reload, heartbeat
70+
lib/ws-legacy-handlers.js Legacy WS message handler: subscribe/unsubscribe/terminal PTY/pm2 commands; called from ws-setup.js onLegacy
71+
lib/server-startup.js Server startup: createOnServerReady(deps) => { onServerReady, getJsonlWatcher }; tools, ACP, speech, PM2 monitoring init
72+
lib/server-startup2.js Startup helpers: createAutoImport (hasIndexFilesChanged + performAutoImport), createDbRecovery (orphaned session cleanup), createPluginLoader (plugin extension loading)
6773
lib/routes-debug.js Debug/backup/restore/ws-stats HTTP route handlers
6874
lib/routes-threads.js Thread CRUD HTTP route handlers (ACP v0.2.3 thread API)
6975
lib/ws-protocol.js WebSocket RPC router (WsRouter class)

0 commit comments

Comments
 (0)