Web GUI for steveyegge/gastown multi-agent orchestrator.
- Read
CODEBASE_DOCUMENTATION.mdNOW — Complete file inventory. Do NOT grep blindly for files. Read this first so you know where everything lives. - Read
CLI-COMPATIBILITY.md— Which gt/bd commands work, which are broken/remapped. Critical if touching any CLI calls.
Update before PR: If you added/deleted/moved files, update CODEBASE_DOCUMENTATION.md.
Browser SPA (vanilla JS, no framework) backed by an Express server that wraps gt/bd CLI commands as HTTP endpoints. WebSocket streams real-time events from gt feed. Published to npm as gastown-gui.
- Entry:
server.js— monolith Express server, partially refactored intoserver/modules - Refactored path: Gateway → Service → Route (see
server/gateways/,server/services/,server/routes/) - Legacy endpoints: Mail, agents, nudge, polecat control, service controls still inline in
server.js - CLI safety: All commands use
execFile(no shell) +SafeSegmentinput validation - Frontend: Vanilla JS in
js/, components render via innerHTML, global state injs/state.js - Real-time: WebSocket client in
js/api.js, server pipesgt feed --jsonoutput - CLI entry:
bin/cli.js— supportsstart,doctor,version,help
- No god files/classes: Do not keep adding logic to large files (especially
server.js). - Extract by responsibility: New backend logic should be placed in focused modules under
server/(services/gateways/routes/infrastructure) and imported intoserver.js. - Refactor when touching: If a change makes a file larger or more complex, extract helpers into dedicated files in the same PR.
npm start # Start server (port 7667)
npm run dev # Dev mode with auto-reload
npm test # All tests (unit + integration + e2e)
npm run test:unit # Unit tests only
npm run test:e2e # E2E tests only (needs Puppeteer)
npm run test:watch # Watch mode
npm run test:ui # Vitest UI- Vitest for unit + integration, Puppeteer for E2E
- Unit tests use dependency injection (mock gateways/services)
- Route tests use real Express app with mocked services
- Integration tests hit
test/mock-server.js(mimics gt CLI responses) - E2E tests start real server + Chromium browser
npm testruns everything viaprepublishOnlybefore npm publish
- Witness/refinery need rig: Service start/stop/restart for
witnessandrefineryrequire arigparameter in the request body. Mayor/deacon do not. Server returns 400 if missing. - CLI renames: Several gt/bd commands were renamed upstream. See
CLI-COMPATIBILITY.mdfor the full mapping. Key ones:formula use→formula run --rig,bd done→bd close,bd park→bd defer. - Port 7667: Default port via
GASTOWN_PORTenv var. The CLI (bin/cli.js) also accepts--port. - No build step: Frontend is vanilla JS served as static files. No bundler, no transpiler.
- server.js is partially refactored: Some endpoints moved to
server/routes/, others still inline (~1700 lines). Don't duplicate — check both before adding endpoints. - SafeSegment rejects metacharacters: Any rig/agent name with shell-special chars will be rejected. This is intentional security.
- Mock server must match real server: When adding/changing endpoints, update both
server.js(or routes) ANDtest/mock-server.js.