diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..61151cf --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,76 @@ +# CLAUDE.md + +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. + +## Commands + +```bash +# Development +source ~/.nvm/nvm.sh && npm start # Start Electron app with hot-reload + +# Build & Package +source ~/.nvm/nvm.sh && npm run make # Build distributable packages +source ~/.nvm/nvm.sh && npm run package # Package without making installers + +# Lint +source ~/.nvm/nvm.sh && npm run lint # ESLint over .ts/.tsx files + +# Database migrations (Drizzle) +source ~/.nvm/nvm.sh && npx drizzle-kit generate # Generate migration from schema changes +source ~/.nvm/nvm.sh && npx drizzle-kit push # Push schema directly (dev only) +``` + +There is no test suite currently. + +## Architecture Overview + +Adiuva is a local-first Electron desktop app. The three Electron processes communicate via a custom tRPC↔IPC bridge (the public `electron-trpc` package is incompatible with tRPC v11, so a custom implementation is used). + +### Process Boundaries + +``` +Renderer (React) ──ipcLink──► Preload (contextBridge) ──IPC──► Main (tRPC router + SQLite) +``` + +1. **Main process** (`src/main/`) — Node.js, owns the database and all business logic + - `index.ts` — Window creation, app lifecycle + - `ipc.ts` — Custom handler that bridges `ipcMain` to tRPC procedures + - `router/index.ts` — All tRPC routers (clients, projects, tasks, checkpoints, notes, settings, ai) + - `db/index.ts` — Drizzle + better-sqlite3, WAL mode, singleton `getDb()` + - `db/schema.ts` — All table definitions (clients, projects, tasks, checkpoints, notes) + - `store.ts` — electron-store for persistent UI settings (e.g., `sidebarCollapsed`) + +2. **Preload** (`src/preload/trpc.ts`) — Exposes `window.electronTRPC` with `sendMessage()` / `onMessage()` + +3. **Renderer** (`src/renderer/`) — React 19, never accesses Node APIs directly + - `lib/ipcLink.ts` — Custom TRPCLink that routes calls through `window.electronTRPC` + - `lib/trpc.ts` — `createTRPCReact()` typed client + - `index.tsx` — QueryClient + tRPC + Router providers + - All data access is through `trpc.*.*useQuery()` / `trpc.*.*.useMutation()` + +### Routing + +File-based routing via TanStack Router. Add a file to `src/renderer/routes/` and the route tree (`src/renderer/routeTree.gen.ts`) is auto-regenerated by the Vite plugin on next `npm start`. Routes: +- `__root.tsx` — Root layout wrapping everything in `AppShell` +- `index.tsx`, `tasks.tsx`, `timeline.tsx`, `projects.tsx` + +### Database + +Schema lives in `src/main/db/schema.ts`. Migrations are in `src/main/db/migrations/`. The DB is created in Electron's `userData` directory as `adiuva.db`. On startup, `initDb()` runs non-destructive migrations (CREATE TABLE IF NOT EXISTS). + +To add a new table or column: edit `schema.ts`, run `drizzle-kit generate`, then `drizzle-kit push` (dev) or commit the migration file. + +### Adding a New Feature (end-to-end pattern) + +1. **Schema** — Add table/columns to `src/main/db/schema.ts` +2. **Router** — Add a tRPC sub-router in `src/main/router/index.ts`, merge it into `appRouter` +3. **Types** — `AppRouter` is exported from `src/main/router/index.ts` and imported in `src/renderer/lib/trpc.ts` — types flow automatically +4. **UI** — Create components under `src/renderer/components//`, use `trpc.*.*useQuery()` for data + +### Key Config Notes + +- Vite configs use `.mts` extension (not `.ts`) to avoid ESM/CJS conflicts with electron-forge's externalize-deps plugin +- `@/*` path alias resolves to `src/renderer/*` (TypeScript + Vite + shadcn/ui all share this alias) +- shadcn/ui style: **new-york**, base color: **neutral** +- Icons: **lucide-react** throughout — do not introduce other icon libraries +- Tailwind 4 (not 3) — use CSS variable theming via `globals.css`, not `tailwind.config.js` \ No newline at end of file diff --git a/DEFAULT_PROMPT.md b/DEFAULT_PROMPT.md new file mode 100644 index 0000000..c360431 --- /dev/null +++ b/DEFAULT_PROMPT.md @@ -0,0 +1,42 @@ +## Your Task + +1. Read the full app PRD at `prd-main.md` (in the same directory as this file) +2. Read the PRD at `prd.json` (in the same directory as this file) +3. Read the progress log at `progress.txt` (check Codebase Patterns section first) +4. **DO YOUR JOB** +5. Update the PRD to set `passes: true` for the completed story +6. Append your progress to `progress.txt` + +## Progress Report Format + +APPEND to progress.txt (never replace, always append): +``` +## [Date/Time] - [Story ID] +- What was implemented +- Files changed +- **Learnings for future iterations:** + - Patterns discovered (e.g., "this codebase uses X for Y") + - Gotchas encountered (e.g., "don't forget to update Z when changing W") + - Useful context (e.g., "the evaluation panel is in component X") +--- +``` + +## USER REQUEST +{ + "id": "US-014", + "title": "Kanban board in Project Detail", + "description": "As a user, I want a Kanban board inside the project detail view with drag-and-drop task management between status columns.", + "acceptanceCriteria": [ + "@hello-pangea/dnd installed; DragDropContext wraps 3 Droppable columns: To Do | In Progress | Completed", + "Each task card is a Draggable wrapped in a shadcn/ui Card rendering: title, description (truncated), priority as shadcn/ui Badge, due date chip, assignee string", + "Dragging a card to another column calls tasks.update({ id, status }) via tRPC and the UI updates immediately (optimistic or on success)", + "'+ Add' shadcn/ui Button (variant=ghost, size=sm) in each column header opens the shadcn/ui Dialog new-task modal with the column's status pre-selected", + "Columns show a task count in their header using shadcn/ui Badge (variant=secondary)", + "All card content uses shadcn/ui primitives: Card, Badge, Button (already installed)", + "Typecheck passes", + "Verify in browser using dev-browser skill" + ], + "priority": 14, + "passes": false, + "notes": "" +} \ No newline at end of file diff --git a/scripts/ralph/prd-main.md b/prd-main.md similarity index 100% rename from scripts/ralph/prd-main.md rename to prd-main.md diff --git a/scripts/ralph/prd.json b/prd.json similarity index 100% rename from scripts/ralph/prd.json rename to prd.json diff --git a/scripts/ralph/progress.txt b/progress.txt similarity index 100% rename from scripts/ralph/progress.txt rename to progress.txt