Documents BeadBoard architecture, commands, verification gates, data flow, key directories, and Windows considerations for AI assistants working on this codebase.
4.5 KiB
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
What Is BeadBoard
BeadBoard is a Windows-native local dashboard for the Beads issue tracker. It reads .beads/issues.jsonl files directly from repos and renders them as interactive Kanban boards and dependency graphs. It supports multi-project aggregation, real-time file watching with SSE, and agent/swarm coordination.
Commands
npm run dev # Start Next.js dev server (localhost:3000)
npm run build # Production build
npm run typecheck # tsc --noEmit
npm run lint # eslint
npm run test # Runs all tests (explicitly enumerated in package.json)
Run a single test:
node --import tsx --test tests/lib/parser.test.ts
New test files must be added to the test script in package.json — the suite is explicitly enumerated, not auto-discovered.
Verification gates (run before closing any code bead)
npm run typecheck && npm run lint && npm run test
Architecture
Stack: Next.js 15 (App Router) · React 19 · Tailwind CSS · TypeScript (strict) · @xyflow/react (graphs) · Dagre (layout) · Chokidar (file watching) · Remotion (video generation)
Data flow
- Source of truth:
.beads/issues.jsonlfiles on disk, mutated only viabdCLI commands. - Parser (
src/lib/parser.ts): Reads JSONL, normalizes dependencies and fields intoBeadIssueobjects. - Aggregate read (
src/lib/aggregate-read.ts): Merges issues across multiple project roots based on project scope/mode. - Realtime (
src/lib/realtime.ts):IssuesEventBussingleton dispatches change events. SSE endpoint (src/app/api/events/route.ts) streams them to the browser. - Watcher (
src/lib/watcher.ts): Chokidar-basedIssuesWatchManagerwatches JSONL + WAL +.last_touchedfiles, coalesces events viaProjectEventCoalescer, and emits through the event bus. Snapshot diffing detects per-issue changes. - Writeback (
src/lib/writeback.ts): API mutations write back to JSONL throughbd-compatible paths.
Key directories
src/app/— Next.js App Router pages and API routes/— Kanban dashboard (main page)/graph— Dependency graph explorer using @xyflow/react + Dagre/sessions— Agent session management/timeline— Timeline view/api/beads/— CRUD endpoints for beads (create, read, update, close, reopen, comment)/api/events/— SSE endpoint for real-time updates/api/swarm/— Swarm coordination endpoints (create, launch, join, leave, status, templates)/api/mission/— Mission/epic management endpoints/api/agents/— Agent registry endpoints
src/components/— UI components organized by feature (kanban, graph, sessions, swarm, shared, etc.)shared/unified-shell.tsx— Main layout shell wrapping all pages (top bar, left panel, right panel)
src/lib/— Core logic (parser, types, pathing, watcher, realtime, registry, scanner, mutations, graph layout)types.ts— Central type definitions (BeadIssue,BeadStatus,ProjectContext, etc.)pathing.ts— Windows path canonicalization (drive letter normalization, path keys)bd-path.ts— Resolves thebdCLI binary path
src/hooks/— React hooks for subscriptions (use-beads-subscription,use-swarm-list,use-url-state, etc.)components/ui/— shadcn/ui primitivestests/— Node.js native test runner with tsx loader; mirrors src structurescripts/— CLI utilities (bb.ts— BeadBoard CLI, Playwright capture scripts)docs/— RFCs, ADRs, protocols, and feature specs
Path alias
@/* maps to the project root (configured in tsconfig.json).
Windows considerations
- All path handling must canonicalize Windows paths (drive letter casing, backslash normalization). Use
canonicalizeWindowsPathandwindowsPathKeyfromsrc/lib/pathing.ts. - Webpack filesystem cache is disabled in dev mode (
next.config.ts) to avoid Windows ENOENT errors.
ESLint config
@typescript-eslint/no-explicit-any and prefer-const are intentionally turned off. eslint.config.mjs uses flat config with next/core-web-vitals and next/typescript.
Beads workflow
Use bd as the sole interface for mutating beads. Never write to .beads/issues.jsonl directly. See AGENTS.md for the full operating manual including dependency discipline, parallel agent patterns, and session completion protocol.