feat: Implement comprehensive database schema and tRPC routers for clients, projects, tasks, checkpoints, and notes
- Established database schema with five tables using better-sqlite3 and drizzle-orm - Developed tRPC routers for clients, projects, tasks, checkpoints, and notes with full CRUD operations - Integrated lazy initialization for electron-store to manage app settings - Enhanced UI components for task management, including NewTaskDialog and GanttChart - Implemented search and filter functionalities across various views - Ensured type safety and strict TypeScript configurations throughout the codebase - Documented learnings and best practices for future iterations in progress.txt
This commit is contained in:
@@ -1,487 +0,0 @@
|
||||
# PRD: Adiuva — MVP Implementation
|
||||
|
||||
> **Status:** APPROVED / READY FOR DEV
|
||||
> **Version:** 1.0 (MVP)
|
||||
> **Date:** 2026-02-19
|
||||
> **Stack:** Electron · React · TypeScript · shadcn/ui · Tailwind · Drizzle ORM · SQLite · LanceDB · GitHub Copilot SDK
|
||||
> **Figma:** [Full File](https://www.figma.com/design/FxyJG9kpou4DfD7jM9WHKP/Desk)
|
||||
|
||||
---
|
||||
|
||||
## Introduction
|
||||
|
||||
Adiuva is a local-first desktop workspace acting as a "Digital Executive Secretary." It centralizes notes, tasks, and project context into a local SQLite database and exposes a multi-agent AI layer (via GitHub Copilot SDK) that proactively surfaces insights and drafts actions. Data never leaves the machine, making it safe for enterprise environments.
|
||||
|
||||
---
|
||||
|
||||
## Goals
|
||||
|
||||
- Ship a working Electron desktop app with five sections: Home, Timeline, Tasks, Projects, Notes.
|
||||
- All data persisted locally in SQLite (zero cloud dependency for data storage).
|
||||
- Hierarchical Client → Sub-Client → Project structure fully navigable from a sidebar tree.
|
||||
- "Fluid Curtain" pull-down gesture that transitions any view into a full-screen AI chat scoped to the current context.
|
||||
- Multi-agent AI system (@Orchestrator, @ProjectAgent, @EmailAgent, @KnowledgeAgent) integrated via GitHub Copilot SDK.
|
||||
- Milestone completion = every section functional at the level described in User Stories below.
|
||||
|
||||
---
|
||||
|
||||
## UI Summary (from Figma)
|
||||
|
||||
### Shared Shell
|
||||
- **Left sidebar:** 240px, `#fafafa` background, border-right `#e5e5e5`.
|
||||
- Top: Adiuva logo/wordmark.
|
||||
- Nav items: Home (house icon), Timeline (chart-gantt icon), Tasks (clipboard-check icon), Projects (folder-kanban icon). Active item gets `#f5f5f5` accent + no extra border.
|
||||
- Bottom: Collapse button (panel-left icon).
|
||||
- **Right edge:** Vertical rotated label "keep scrolling for AI / next section" + chevron-down. This is the visual affordance for the Fluid Curtain pull-down gesture.
|
||||
- **Font:** Geist (Regular 400, Medium 500, Semibold 600). Sizes: sm=14px, base=16px.
|
||||
- **Colors:** bg=`#ffffff`, foreground=`#0a0a0a`, muted=`#737373`, border=`#e5e5e5`, sidebar=`#fafafa`, sidebar-accent=`#f5f5f5`, primary=`#171717`, primary-fg=`#fafafa`.
|
||||
|
||||
### HOME
|
||||
- Top-right corner: stat chip showing "N Task due" count.
|
||||
- Main area (centered, max-w ~1088px): AI greeting `✦ Hello, {name}` (Heading 2, Geist Semibold 30px, -1px tracking).
|
||||
- Below: AI-generated daily brief paragraph with **bold** key phrases inline.
|
||||
- Chat input box: white, border `#d4d4d4`, shadow-lg, 109px tall, placeholder "Ask me anythings...", Send button (black, icon + label) bottom-right of the box.
|
||||
- Below chat: 4 suggestion chips (`Item` component) — icon badge + short prompt text — in a 4-column flex row.
|
||||
|
||||
### TIMELINE
|
||||
- Main content area: placeholder background `#fef2f2` (the Gantt chart is not yet designed in Figma; implementation is free to choose a library).
|
||||
- Same sidebar + right-edge Fluid Curtain affordance.
|
||||
|
||||
### TASKS
|
||||
- Header row: 4 stat cards — "Total task", "To Do", "In Progress", "Completed" — each with an icon and count.
|
||||
- Below: search bar (full-width, placeholder "Search tasks or projects...") + "Order by" dropdown (right) + status filter tabs (All | To Do | In Progress | Completed).
|
||||
- Task list rows (flat, full-width):
|
||||
- Checkbox (left)
|
||||
- Title (bold, 14px) + description subtitle (gray, 14px)
|
||||
- Priority chip: `HIGH` (up-arrow, red-toned) | `MEDIUM` (right-arrow, gray) | `LOW` (down-arrow, green-toned)
|
||||
- Due date chip (calendar icon + "Due Mon DD")
|
||||
- Breadcrumb path (Client > Sub-Client > Project, chevron-separated)
|
||||
- Assignee (person icon + name string)
|
||||
- Completed tasks show row with green-tinted background.
|
||||
|
||||
### PROJECTS
|
||||
- **Left panel (tree):** "Projects" heading + `+` new button + search input. Hierarchical tree: Client (folder, bold) → Sub-Client (folder) → Project (circle/file). Expand/collapse chevrons. Active project highlighted.
|
||||
- **Right panel (project detail):**
|
||||
- Breadcrumb (Client > Sub-Client) at top.
|
||||
- Project name as H1.
|
||||
- 3 stat cards: Notes count | Tasks Complete (x/y fraction) | Checkpoints (x/y fraction).
|
||||
- AI Project Summary card (sparkle icon + generated paragraph).
|
||||
- **Project Timeline:** inline Gantt — months across top (Feb 2026, Mar 2026 …), horizontal bar with dot markers for each checkpoint. Legend: To Do (dark) / Completed (green). "+ Add" button top-right.
|
||||
- **Tasks (Kanban):** 3 columns — To Do / In progress / Completed. Task cards: title, description, priority chip, due date, assignee. "+ Add" per column header.
|
||||
- **Notes list:** flat list of note entries + "+ Add" button.
|
||||
|
||||
### NOTES
|
||||
- Milkdown editor (standalone route) for writing/editing a single note.
|
||||
- Markdown-native, full-screen editor style.
|
||||
|
||||
---
|
||||
|
||||
## Data Schema
|
||||
|
||||
```typescript
|
||||
// clients — hierarchical (self-referencing parentId)
|
||||
export const clients = sqliteTable('clients', {
|
||||
id: text('id').primaryKey(), // UUID
|
||||
parentId: text('parent_id'), // null = top-level client
|
||||
name: text('name').notNull(),
|
||||
industry: text('industry'),
|
||||
createdAt: integer('created_at').notNull(),
|
||||
});
|
||||
|
||||
// projects — attached to a client/sub-client, or orphan
|
||||
export const projects = sqliteTable('projects', {
|
||||
id: text('id').primaryKey(),
|
||||
clientId: text('client_id').references(() => clients.id), // nullable
|
||||
name: text('name').notNull(),
|
||||
status: text('status').default('active'), // active | archived
|
||||
aiSummary: text('ai_summary'), // AI-generated paragraph
|
||||
createdAt: integer('created_at').notNull(),
|
||||
});
|
||||
|
||||
// tasks — belong to a project (or global/orphan if projectId null)
|
||||
export const tasks = sqliteTable('tasks', {
|
||||
id: text('id').primaryKey(),
|
||||
projectId: text('project_id').references(() => projects.id), // nullable
|
||||
title: text('title').notNull(),
|
||||
description: text('description'),
|
||||
status: text('status').default('todo'), // todo | in_progress | done
|
||||
priority: text('priority').default('medium'), // high | medium | low
|
||||
assignee: text('assignee'), // plain string name
|
||||
dueDate: integer('due_date'), // unix timestamp
|
||||
createdAt: integer('created_at').notNull(),
|
||||
});
|
||||
|
||||
// checkpoints — milestones on the per-project timeline
|
||||
export const checkpoints = sqliteTable('checkpoints', {
|
||||
id: text('id').primaryKey(),
|
||||
projectId: text('project_id').references(() => projects.id).notNull(),
|
||||
title: text('title').notNull(),
|
||||
date: integer('date').notNull(), // unix timestamp
|
||||
isAiSuggested: integer('is_ai_suggested').default(0), // 0=manual, 1=AI
|
||||
isApproved: integer('is_approved').default(1), // 0=pending AI approval
|
||||
createdAt: integer('created_at').notNull(),
|
||||
});
|
||||
|
||||
// notes — markdown content attached to a project
|
||||
export const notes = sqliteTable('notes', {
|
||||
id: text('id').primaryKey(),
|
||||
projectId: text('project_id').references(() => projects.id), // nullable
|
||||
title: text('title').notNull(),
|
||||
content: text('content').notNull(), // raw Markdown
|
||||
createdAt: integer('created_at').notNull(),
|
||||
updatedAt: integer('updated_at').notNull(),
|
||||
});
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## User Stories
|
||||
|
||||
### PHASE 1 — Foundation
|
||||
|
||||
---
|
||||
|
||||
#### US-001: Electron + React scaffold
|
||||
**Description:** As a developer, I need a working Electron app with React+TypeScript and a shared main/renderer process setup so that all other features have a platform to run on.
|
||||
|
||||
**Acceptance Criteria:**
|
||||
- [ ] `electron-builder` or `electron-vite` scaffold with hot-reload in dev.
|
||||
- [ ] Main process can open a `BrowserWindow` serving the React app.
|
||||
- [ ] TypeScript strict mode enabled, `tsconfig.json` configured.
|
||||
- [ ] `package.json` scripts: `dev`, `build`, `preview`.
|
||||
- [ ] App opens without errors on Linux, macOS, Windows.
|
||||
|
||||
---
|
||||
|
||||
#### US-002: SQLite database + Drizzle ORM setup
|
||||
**Description:** As a developer, I need the SQLite database initialized with Drizzle ORM so that all CRUD operations use a typed, schema-driven interface.
|
||||
|
||||
**Acceptance Criteria:**
|
||||
- [ ] `better-sqlite3` (or `@electric-sql/pglite` alternative) installed in main process.
|
||||
- [ ] Drizzle schema file defines all 5 tables (clients, projects, tasks, checkpoints, notes).
|
||||
- [ ] Migration runs on app start; DB file created at `~/.adiuva/data.db` (or `app.getPath('userData')`).
|
||||
- [ ] Drizzle Studio accessible in dev mode (`drizzle-kit studio`).
|
||||
- [ ] TypeScript types inferred from schema (no manual type duplication).
|
||||
|
||||
---
|
||||
|
||||
#### US-003: App shell — sidebar navigation
|
||||
**Description:** As a user, I want a persistent left sidebar so that I can navigate between all sections of the app.
|
||||
|
||||
**Acceptance Criteria:**
|
||||
- [ ] Sidebar renders at 240px with `#fafafa` background and right border.
|
||||
- [ ] Nav items: Home (house), Timeline (chart-gantt), Tasks (clipboard-check), Projects (folder-kanban). Each uses Lucide icon + label.
|
||||
- [ ] Active route highlights item with `#f5f5f5` accent background.
|
||||
- [ ] Collapse button at bottom toggles sidebar to icon-only mode (64px).
|
||||
- [ ] Router renders correct view for each nav item (React Router or TanStack Router).
|
||||
- [ ] Verify in browser using dev-browser skill.
|
||||
|
||||
---
|
||||
|
||||
#### US-004: Client CRUD (hierarchical)
|
||||
**Description:** As a user, I want to create, rename, and delete Clients and Sub-Clients so that I can mirror real-world corporate structures.
|
||||
|
||||
**Acceptance Criteria:**
|
||||
- [ ] "New Client" action creates a top-level client (parentId = null).
|
||||
- [ ] "New Sub-Client" action (available on a selected client) creates a child (parentId = selected client's id).
|
||||
- [ ] Client and Sub-Client names are editable via inline rename or modal.
|
||||
- [ ] Deleting a client warns if it has child clients or projects; cascade delete is opt-in.
|
||||
- [ ] Changes are immediately persisted to SQLite.
|
||||
- [ ] TypeScript types pass; no `any`.
|
||||
|
||||
---
|
||||
|
||||
#### US-005: Project CRUD
|
||||
**Description:** As a user, I want to create projects attached to a client/sub-client or as standalone orphans so that I can track both client and internal work.
|
||||
|
||||
**Acceptance Criteria:**
|
||||
- [ ] "New Project" dialog asks for name and optionally a client (dropdown, searchable).
|
||||
- [ ] Projects with no client appear under an "Internal / No Client" group in the tree.
|
||||
- [ ] Project can be re-parented (moved to a different client) via edit dialog.
|
||||
- [ ] Project status toggled between `active` and `archived`.
|
||||
- [ ] Archived projects hidden by default; toggle to show.
|
||||
- [ ] Persisted to SQLite immediately.
|
||||
|
||||
---
|
||||
|
||||
#### US-006: Projects sidebar tree view
|
||||
**Description:** As a user, I want to see all clients, sub-clients, and projects in a collapsible tree in the Projects section so that I can navigate the hierarchy at a glance.
|
||||
|
||||
**Acceptance Criteria:**
|
||||
- [ ] Tree renders: Client (folder icon) → Sub-Client (folder icon) → Project (circle icon).
|
||||
- [ ] Clients and sub-clients expand/collapse independently.
|
||||
- [ ] Search input filters tree in real-time (client name, sub-client name, project name).
|
||||
- [ ] Clicking a project loads the Project Detail panel on the right.
|
||||
- [ ] Active project is highlighted in the tree.
|
||||
- [ ] Verify in browser using dev-browser skill.
|
||||
|
||||
---
|
||||
|
||||
#### US-007: Task CRUD (global Tasks view)
|
||||
**Description:** As a user, I want a global task list where I can create, filter, search, and update tasks so that I can manage all work across projects in one place.
|
||||
|
||||
**Acceptance Criteria:**
|
||||
- [ ] 4 stat cards at top: Total, To Do, In Progress, Completed — update reactively.
|
||||
- [ ] Search filters tasks by title or description, case-insensitive.
|
||||
- [ ] Status filter tabs (All | To Do | In Progress | Completed) filter list.
|
||||
- [ ] "Order by" dropdown supports: Due Date, Priority, Created Date.
|
||||
- [ ] Task rows show: checkbox, title, description, priority chip (HIGH/MEDIUM/LOW with color), due date chip, breadcrumb (Client > Sub-Client > Project), assignee.
|
||||
- [ ] Clicking checkbox toggles status: todo → done (skip in_progress for quick-complete).
|
||||
- [ ] Inline "New Task" button opens a creation modal with fields: title, description, priority, due date, project (optional), assignee (optional).
|
||||
- [ ] All changes persisted to SQLite.
|
||||
- [ ] Verify in browser using dev-browser skill.
|
||||
|
||||
---
|
||||
|
||||
#### US-008: Manual Timeline (global & per-project)
|
||||
**Description:** As a user, I want to view and manually create timeline checkpoints on a Gantt-style view so that I have full control over milestone dates.
|
||||
|
||||
**Acceptance Criteria:**
|
||||
- [ ] Timeline view renders a horizontal time axis (months) with dot markers for each checkpoint.
|
||||
- [ ] Global Timeline shows checkpoints from all projects (color-coded by project or status).
|
||||
- [ ] Per-project timeline (in Project Detail) scoped to that project's checkpoints only.
|
||||
- [ ] "+ Add" button opens a dialog: title, date picker, project (in global view).
|
||||
- [ ] Checkpoint dots distinguish status: To Do (dark/filled) vs Completed (green).
|
||||
- [ ] "Today" marker line displayed on the timeline.
|
||||
- [ ] Clicking a checkpoint dot shows a popover with title, date, and delete action.
|
||||
- [ ] Persisted to SQLite.
|
||||
- [ ] Verify in browser using dev-browser skill.
|
||||
|
||||
---
|
||||
|
||||
#### US-009: Project Detail view
|
||||
**Description:** As a user, I want a rich project detail panel that shows notes count, tasks summary, AI summary, timeline, Kanban, and notes list in one scrollable view.
|
||||
|
||||
**Acceptance Criteria:**
|
||||
- [ ] Breadcrumb (Client > Sub-Client) rendered at top.
|
||||
- [ ] Stat cards: Notes count | Tasks Complete (x/y) | Checkpoints (x/y).
|
||||
- [ ] AI Project Summary card shows sparkle icon + placeholder text ("AI summary will appear here") until agent generates it.
|
||||
- [ ] Inline Project Timeline (same Gantt component as US-008, scoped).
|
||||
- [ ] Kanban board: To Do / In Progress / Completed columns. Task cards show title, description, priority, due date, assignee. Drag between columns updates `status`.
|
||||
- [ ] Notes list: title + creation date for each note. Click opens Milkdown editor. "+ Add" creates new note.
|
||||
- [ ] Verify in browser using dev-browser skill.
|
||||
|
||||
---
|
||||
|
||||
#### US-010: Notes editor (Milkdown)
|
||||
**Description:** As a user, I want a full-screen Markdown editor for each note so that I can write rich content without leaving the app.
|
||||
|
||||
**Acceptance Criteria:**
|
||||
- [ ] Milkdown editor renders in a dedicated route (`/notes/:noteId`).
|
||||
- [ ] Supports: headings, bold, italic, code blocks, bullet lists, ordered lists, blockquotes.
|
||||
- [ ] Auto-saves content to SQLite on change (debounced, 500ms).
|
||||
- [ ] Back navigation returns to the project detail view (or previous location).
|
||||
- [ ] Note title editable at the top (separate from Milkdown content).
|
||||
- [ ] Verify in browser using dev-browser skill.
|
||||
|
||||
---
|
||||
|
||||
### PHASE 2 — The Fluid Curtain & Agents
|
||||
|
||||
---
|
||||
|
||||
#### US-011: Fluid Curtain — pull-down gesture + animation
|
||||
**Description:** As a user, I want to pull down from the top of any view to slide the app off-screen and reveal the AI chat layer beneath.
|
||||
|
||||
**Acceptance Criteria:**
|
||||
- [ ] Scrolling up past the top of content (overscroll) OR pressing a keyboard shortcut (e.g., `Cmd/Ctrl+K` or `⌥↓`) triggers the curtain.
|
||||
- [ ] App panel slides down using Framer Motion spring animation, exiting the bottom of the viewport.
|
||||
- [ ] AI Chat view is fully revealed below (full-screen, no sidebar obstruction).
|
||||
- [ ] Pulling the app back up (swipe/scroll from bottom or shortcut) re-covers the chat.
|
||||
- [ ] Animation is smooth (no jank). Spring config: stiffness 300, damping 30.
|
||||
- [ ] Right-edge "keep scrolling for AI" label and chevron are visible in every section as the affordance.
|
||||
- [ ] Verify in browser using dev-browser skill.
|
||||
|
||||
---
|
||||
|
||||
#### US-012: Context-scoped AI chat
|
||||
**Description:** As a user, I want the AI chat (revealed by the curtain) to know the context I was in so that answers are scoped to the right project or global scope.
|
||||
|
||||
**Acceptance Criteria:**
|
||||
- [ ] When curtain is pulled from a Project Detail view, a context header displays "Chatting about: [Project Name]".
|
||||
- [ ] When pulled from Home, context is global (all data).
|
||||
- [ ] Context is passed as a system message to the GitHub Copilot SDK call (project notes, tasks, checkpoints as structured JSON).
|
||||
- [ ] Agent responses reference only documents within the scoped project.
|
||||
- [ ] Chat history is session-only (not persisted in MVP).
|
||||
|
||||
---
|
||||
|
||||
#### US-013: GitHub Copilot SDK integration + @Orchestrator
|
||||
**Description:** As a developer, I need the GitHub Copilot SDK wired up with an Orchestrator agent that routes user messages to the correct specialist agent.
|
||||
|
||||
**Acceptance Criteria:**
|
||||
- [ ] SDK initialized in main process with enterprise credentials (from env/config).
|
||||
- [ ] `@Orchestrator` reads user intent and calls `route_to_project`, `route_to_general`, or `route_to_email` tool.
|
||||
- [ ] Routing result invokes the correct specialist agent and returns its response.
|
||||
- [ ] Streaming responses supported (tokens shown incrementally in chat UI).
|
||||
- [ ] Errors handled gracefully (SDK timeout, auth failure) with user-facing message.
|
||||
|
||||
---
|
||||
|
||||
#### US-014: @ProjectAgent with project tools
|
||||
**Description:** As a user, I want the AI to answer project-specific questions and take actions (add task, suggest checkpoints) within the scoped project.
|
||||
|
||||
**Acceptance Criteria:**
|
||||
- [ ] `read_project_notes` tool fetches all notes for the project from SQLite.
|
||||
- [ ] `add_task` tool creates a task in the project (writes to SQLite) and confirms in chat.
|
||||
- [ ] `suggest_checkpoints` tool returns a list of proposed checkpoints (title + date) as interactive cards in chat (Approve / Reject each).
|
||||
- [ ] Approved checkpoints are inserted into `checkpoints` table with `is_ai_suggested=1, is_approved=1`.
|
||||
- [ ] `get_summary` tool generates a 2-3 sentence project summary and updates `projects.ai_summary` in SQLite.
|
||||
|
||||
---
|
||||
|
||||
### PHASE 3 — Intelligence & RAG
|
||||
|
||||
---
|
||||
|
||||
#### US-015: LanceDB vector store setup + note embedding
|
||||
**Description:** As a developer, I need notes and project content embedded into LanceDB so that semantic search is possible across all projects.
|
||||
|
||||
**Acceptance Criteria:**
|
||||
- [ ] LanceDB initialized in main process, storing vectors at `~/.adiuva/vectors/`.
|
||||
- [ ] On note save (create or update), content is embedded via GitHub Copilot SDK embeddings endpoint and stored in LanceDB with `{noteId, projectId, content}` metadata.
|
||||
- [ ] Existing notes are indexed on first startup (migration script).
|
||||
- [ ] Embedding errors logged but do not block the save operation.
|
||||
|
||||
---
|
||||
|
||||
#### US-016: @KnowledgeAgent — semantic search across all projects
|
||||
**Description:** As a user, I want to ask "what did we decide about X?" and get answers pulled from across all past project notes, not just the current one.
|
||||
|
||||
**Acceptance Criteria:**
|
||||
- [ ] `vector_search_all` tool accepts a query string, returns top-5 semantically similar note chunks from LanceDB.
|
||||
- [ ] Results include source note title and project name for attribution.
|
||||
- [ ] @Orchestrator routes knowledge queries to @KnowledgeAgent.
|
||||
- [ ] Response in chat includes inline citations ("From: Project A — Meeting Notes, Feb 12").
|
||||
|
||||
---
|
||||
|
||||
#### US-017: AI checkpoint suggestions from notes
|
||||
**Description:** As a user, I want the AI to proactively analyze my meeting notes and suggest timeline checkpoints I may have missed.
|
||||
|
||||
**Acceptance Criteria:**
|
||||
- [ ] Triggered manually ("Suggest checkpoints" button in Project Detail timeline header) or by @ProjectAgent tool call.
|
||||
- [ ] @ProjectAgent reads all notes for the project, extracts date-anchored commitments, returns as suggested checkpoints.
|
||||
- [ ] Suggestions appear as dismissible cards in the Timeline UI with `isAiSuggested=1, isApproved=0`.
|
||||
- [ ] Approve → `isApproved` set to 1, checkpoint appears on timeline.
|
||||
- [ ] Reject → checkpoint deleted.
|
||||
- [ ] Verify in browser using dev-browser skill.
|
||||
|
||||
---
|
||||
|
||||
#### US-018: Home dashboard — AI daily brief
|
||||
**Description:** As a user, I want the Home screen to greet me with an AI-generated daily brief summarizing my tasks and suggesting actions.
|
||||
|
||||
**Acceptance Criteria:**
|
||||
- [ ] On app open, @Orchestrator queries tasks due today/this week and recent project activity.
|
||||
- [ ] AI generates a personalized paragraph with key highlights (tasks due, suggested calls/emails).
|
||||
- [ ] Brief is displayed below the greeting with **bold** key phrases inline (as in Figma).
|
||||
- [ ] 4 suggestion chips below the chat box are pre-populated with context-relevant queries.
|
||||
- [ ] Chat box on Home is scoped globally (no project context).
|
||||
- [ ] Verify in browser using dev-browser skill.
|
||||
|
||||
---
|
||||
|
||||
## Functional Requirements
|
||||
|
||||
- **FR-01:** All data stored locally in SQLite at `app.getPath('userData')/adiuva.db`.
|
||||
- **FR-02:** App functions fully offline; AI features degrade gracefully when network is unavailable.
|
||||
- **FR-03:** Client tree supports unlimited nesting depth but UI only needs to display 3 levels (Client → Sub-Client → Project).
|
||||
- **FR-04:** Tasks table has a nullable `projectId`; global Tasks view shows all tasks regardless.
|
||||
- **FR-05:** The "Fluid Curtain" animation must not lose the underlying view state (app slides but remains mounted).
|
||||
- **FR-06:** GitHub Copilot SDK credentials are stored in OS keychain (not plaintext config).
|
||||
- **FR-07:** Milkdown auto-save uses a 500ms debounce; unsaved indicator shown if pending.
|
||||
- **FR-08:** All IDs are UUIDs (use `crypto.randomUUID()`).
|
||||
- **FR-09:** Drizzle migrations run automatically on startup; never destructive.
|
||||
- **FR-10:** Kanban drag-and-drop updates `tasks.status` and `tasks.updatedAt` immediately in SQLite.
|
||||
|
||||
---
|
||||
|
||||
## Non-Goals (Out of Scope for MVP)
|
||||
|
||||
- Email client / inbox integration (EmailAgent tools are stubs only).
|
||||
- Cloud sync or multi-device support.
|
||||
- Real assignee accounts (assignee is a plain name string, not a user entity).
|
||||
- Notifications or system tray alerts.
|
||||
- Dark mode.
|
||||
- Mobile or web version.
|
||||
- Export to PDF/CSV.
|
||||
- Notes version history.
|
||||
|
||||
---
|
||||
|
||||
## Design Considerations
|
||||
|
||||
- **Font:** Geist via `@fontsource/geist` or CDN. Apply globally via CSS variable.
|
||||
- **Icons:** Lucide React (house, chart-gantt, clipboard-check, folder-kanban, panel-left, send, sparkles, chevron-down).
|
||||
- **Gantt:** ✅ Custom SVG component. Month labels on X axis, `<circle>` dots for checkpoints, `<line>` baseline, `<TodayMarker>`. Use `ResizeObserver` for responsive width.
|
||||
- **Kanban:** ✅ `@hello-pangea/dnd` — `<DragDropContext>` wrapping 3 `<Droppable>` columns, each task a `<Draggable>`.
|
||||
- **Fluid Curtain:** ✅ `framer-motion` `useMotionValue` + `useSpring`. Trigger: `wheel` event at `scrollTop === 0 && deltaY < 0` OR `Cmd/Ctrl+K`. Right-edge "keep scrolling for AI" label is a **visual hint only** (not interactive).
|
||||
- **shadcn/ui components to reuse:** Button, Input, Badge, Card, Dialog, Separator, Tabs, Tooltip, DropdownMenu, Popover.
|
||||
|
||||
---
|
||||
|
||||
## Technical Considerations
|
||||
|
||||
- **IPC:** ✅ `electron-trpc`. Define a single `appRouter` in main process exposing all domains (`tasks`, `projects`, `clients`, `checkpoints`, `notes`, `ai`). Renderer uses `trpc.[domain].[procedure].useQuery/useMutation()`. Zod validates all inputs at the boundary.
|
||||
- GitHub Copilot SDK may require enterprise SSO token; provide a settings screen for token input (US not in MVP scope, but infrastructure must exist).
|
||||
- LanceDB Node.js binding (`vectordb` package) runs in main process only.
|
||||
- Milkdown v7+ with React adapter. Plugin list: `commonmark`, `history`, `clipboard`, `math` (optional).
|
||||
- Use `electron-store` or `conf` for lightweight app settings (user name for greeting, sidebar collapsed state, etc.).
|
||||
|
||||
---
|
||||
|
||||
## Success Metrics
|
||||
|
||||
- All 5 sections navigable and functional with real SQLite-persisted data.
|
||||
- Fluid Curtain animation runs at 60fps with no layout shift on return.
|
||||
- @ProjectAgent correctly scopes a context query (zero responses sourcing from another project).
|
||||
- Note embedding + LanceDB retrieval returns relevant results for a simple semantic query.
|
||||
- App cold-start < 3 seconds on a modern machine.
|
||||
|
||||
---
|
||||
|
||||
## Open Questions
|
||||
|
||||
1. ~~**Gantt library vs. custom SVG?**~~ ✅ Resolved: custom SVG component.
|
||||
2. ~~**GitHub Copilot SDK auth flow:**~~ ✅ Resolved: `keytar` (OS keychain). A minimal "Settings" screen for token input writes to keychain on save.
|
||||
3. ~~**IPC architecture:**~~ ✅ Resolved: `electron-trpc` with Zod validation. All DB/AI operations exposed as tRPC procedures in main process; renderer uses typed React Query hooks.
|
||||
4. **Milkdown vs. simpler editor:** Milkdown is powerful but has a learning curve. Is a simpler `CodeMirror`-based Markdown editor acceptable for MVP?
|
||||
5. **"Fluid Curtain" on Linux:** Overscroll behavior differs across OS/window managers. What's the fallback trigger (keyboard shortcut only)?
|
||||
|
||||
---
|
||||
|
||||
## Implementation Roadmap
|
||||
|
||||
### Phase 1 — Foundation (US-001 → US-010)
|
||||
|
||||
| Step | Story | Key Decision Point |
|
||||
|------|-------|-------------------|
|
||||
| 1.1 | US-001: Electron+React scaffold | ✅ **electron-forge + Vite plugin** (`npm init electron-app@latest -- --template=vite-typescript`) |
|
||||
| 1.2 | US-002: SQLite + Drizzle setup | Schema finalized; migrations strategy |
|
||||
| 1.3 | US-003: App shell + sidebar | ✅ **TanStack Router** (fully type-safe, `$projectId` params typed) |
|
||||
| 1.4 | US-004 + US-005: Client & Project CRUD | Data model confirmed |
|
||||
| 1.5 | US-006: Projects tree view | ✅ **Radix Collapsible + recursive `TreeNode`** (no extra dep, matches Figma) |
|
||||
| 1.6 | US-007: Tasks global view | |
|
||||
| 1.7 | US-008: Manual Timeline / Gantt | ✅ **Custom SVG component** (dot-on-axis, zero deps, matches Figma exactly) |
|
||||
| 1.8 | US-009: Project Detail view | ✅ **@hello-pangea/dnd** for Kanban drag-and-drop |
|
||||
| 1.9 | US-010: Milkdown editor | Plugin scope for MVP |
|
||||
|
||||
### Phase 2 — The Curtain & Agents (US-011 → US-014)
|
||||
|
||||
| Step | Story | Key Decision Point |
|
||||
|------|-------|-------------------|
|
||||
| 2.1 | US-011: Fluid Curtain animation | ✅ Wheel overscroll-up at `scrollTop=0` + `Cmd/Ctrl+K` shortcut. Right-edge label is visual-only (not a button). Framer Motion spring (`y` to viewport height). |
|
||||
| 2.2 | US-012: Context-scoped chat UI | Chat bubble components, streaming UI |
|
||||
| 2.3 | US-013: Copilot SDK + @Orchestrator | ✅ **`keytar`** for OS keychain token storage (main process only, IPC to renderer). |
|
||||
| 2.4 | US-014: @ProjectAgent tools | Tool schema definition + SQLite write-back |
|
||||
|
||||
### Phase 3 — Intelligence & RAG (US-015 → US-018)
|
||||
|
||||
| Step | Story | Key Decision Point |
|
||||
|------|-------|-------------------|
|
||||
| 3.1 | US-015: LanceDB setup + embedding | ✅ **GitHub Copilot SDK embeddings** (`text-embedding-3-small`). Chunk notes by paragraph (~500 tokens). |
|
||||
| 3.2 | US-016: @KnowledgeAgent search | Vector search tuning, k=5 default |
|
||||
| 3.3 | US-017: AI checkpoint suggestions | Prompt engineering for date extraction |
|
||||
| 3.4 | US-018: Home daily brief | Orchestrator routing for daily summary |
|
||||
|
||||
@@ -1,461 +0,0 @@
|
||||
{
|
||||
"project": "Adiuva",
|
||||
"branchName": "ralph/adiuva-mvp",
|
||||
"description": "Adiuva MVP — Local-first desktop workspace with hierarchical project management, Fluid Curtain AI chat overlay, and multi-agent intelligence via GitHub Copilot SDK",
|
||||
"userStories": [
|
||||
{
|
||||
"id": "US-001",
|
||||
"title": "Electron + React scaffold",
|
||||
"description": "As a developer, I need a working Electron app with React+TypeScript and a shared main/renderer process setup so that all other features have a platform to run on.",
|
||||
"acceptanceCriteria": [
|
||||
"electron-forge + Vite plugin scaffold with hot-reload in dev",
|
||||
"Main process opens a BrowserWindow serving the React app",
|
||||
"TypeScript strict mode enabled, tsconfig.json configured",
|
||||
"package.json scripts: dev, build, preview",
|
||||
"App opens without errors",
|
||||
"Typecheck passes"
|
||||
],
|
||||
"priority": 1,
|
||||
"passes": true,
|
||||
"notes": "Completed in initial scaffold commit (f6cc8bb)"
|
||||
},
|
||||
{
|
||||
"id": "US-002",
|
||||
"title": "SQLite + Drizzle ORM schema and migrations",
|
||||
"description": "As a developer, I need the SQLite database initialized with Drizzle ORM so that all CRUD operations use a typed, schema-driven interface.",
|
||||
"acceptanceCriteria": [
|
||||
"better-sqlite3 and drizzle-orm installed as main-process dependencies",
|
||||
"Drizzle schema file defines all 5 tables matching the PRD exactly: clients (id, parentId, name, industry, createdAt), projects (id, clientId, name, status, aiSummary, createdAt), tasks (id, projectId, title, description, status, priority, assignee, dueDate, createdAt), checkpoints (id, projectId, title, date, isAiSuggested, isApproved, createdAt), notes (id, projectId, title, content, createdAt, updatedAt)",
|
||||
"DB file created at app.getPath('userData')/adiuva.db on startup",
|
||||
"Migration runs automatically on app start (drizzle-kit migrate or push); never destructive",
|
||||
"All IDs are UUIDs generated via crypto.randomUUID()",
|
||||
"TypeScript types inferred from schema with no manual type duplication",
|
||||
"Typecheck passes"
|
||||
],
|
||||
"priority": 2,
|
||||
"passes": true,
|
||||
"notes": "Completed: better-sqlite3 + drizzle-orm, 5-table schema, non-destructive push migration via CREATE TABLE IF NOT EXISTS, WAL mode enabled"
|
||||
},
|
||||
{
|
||||
"id": "US-003",
|
||||
"title": "electron-trpc IPC bridge and appRouter scaffold",
|
||||
"description": "As a developer, I need electron-trpc wired up between main and renderer processes so that all DB and AI operations are exposed as type-safe tRPC procedures callable from the renderer.",
|
||||
"acceptanceCriteria": [
|
||||
"electron-trpc installed; IPC bridge configured in main process and preload script",
|
||||
"appRouter defined in main process with stub routers for all domains: clients, projects, tasks, checkpoints, notes, ai",
|
||||
"Renderer-side trpc client created with the correct IPC link and wrapped in TRPCProvider + QueryClientProvider",
|
||||
"A health.ping procedure returns 'pong' and is successfully callable from the renderer (verified via console log or React component)",
|
||||
"Zod imported and used to validate at least one procedure input",
|
||||
"Typecheck passes"
|
||||
],
|
||||
"priority": 3,
|
||||
"passes": true,
|
||||
"notes": "Completed: electron-trpc IPC bridge, appRouter with stub routers for all 7 domains (health, clients, projects, tasks, checkpoints, notes, ai), renderer TRPCProvider+QueryClientProvider, health.ping returns 'pong' displayed in HomePage, Zod validates all procedure inputs"
|
||||
},
|
||||
{
|
||||
"id": "US-004",
|
||||
"title": "App shell layout and sidebar navigation",
|
||||
"description": "As a user, I want a persistent left sidebar so that I can navigate between all sections of the app.",
|
||||
"acceptanceCriteria": [
|
||||
"Sidebar renders at 240px with #fafafa background and 1px right border (#e5e5e5)",
|
||||
"Nav items render with Lucide icons + labels: Home (house), Timeline (chart-gantt), Tasks (clipboard-check), Projects (folder-kanban)",
|
||||
"Active route highlights nav item with #f5f5f5 accent background (no extra border)",
|
||||
"Collapse button at bottom toggles sidebar to icon-only mode (64px wide); state persisted via electron-store",
|
||||
"TanStack Router renders the correct view component for each nav route: /, /timeline, /tasks, /projects",
|
||||
"Right-edge vertical rotated label 'keep scrolling for AI' with chevron-down icon is visible in every section as a non-interactive visual affordance",
|
||||
"Geist font applied globally via @fontsource/geist",
|
||||
"Global CSS variables set: bg=#ffffff, foreground=#0a0a0a, muted=#737373, border=#e5e5e5, sidebar=#fafafa, sidebar-accent=#f5f5f5, primary=#171717, primary-fg=#fafafa",
|
||||
"Typecheck passes",
|
||||
"Verify in browser using dev-browser skill"
|
||||
],
|
||||
"priority": 4,
|
||||
"passes": true,
|
||||
"notes": "Completed: electron-store@8 sidebar collapse persistence via settings tRPC router, @fontsource/geist replacing Google Fonts CDN, right-edge 'keep scrolling for AI' label in all views, ESLint fixed with eslint-import-resolver-typescript"
|
||||
},
|
||||
{
|
||||
"id": "US-005",
|
||||
"title": "Client tRPC procedures (CRUD)",
|
||||
"description": "As a developer, I need tRPC procedures for client and sub-client CRUD so that the UI can create, read, update, and delete hierarchical client records.",
|
||||
"acceptanceCriteria": [
|
||||
"clients.list returns all clients ordered by name",
|
||||
"clients.create accepts { name: string, parentId?: string, industry?: string } and inserts with UUID and createdAt timestamp",
|
||||
"clients.update accepts { id: string, name?: string, industry?: string } and updates the record",
|
||||
"clients.delete accepts { id: string } and returns an error payload if the client has child clients or projects (does not delete)",
|
||||
"clients.deleteWithCascade accepts { id: string } and deletes the client, all descendant clients, and their projects (nulls projectId on orphaned tasks)",
|
||||
"All inputs validated with Zod schemas",
|
||||
"Typecheck passes"
|
||||
],
|
||||
"priority": 5,
|
||||
"passes": true,
|
||||
"notes": "Completed: clients.list (ordered by name), clients.create (UUID + createdAt), clients.update (partial), clients.delete (guard returns error payload if children exist), clients.deleteWithCascade (BFS recursive — nulls orphaned tasks.projectId, deletes projects, then clients). All queries use .all()/.run() for drizzle better-sqlite3 sync driver."
|
||||
},
|
||||
{
|
||||
"id": "US-006",
|
||||
"title": "Project tRPC procedures (CRUD)",
|
||||
"description": "As a developer, I need tRPC procedures for project CRUD so that the UI can create, read, update, and archive projects attached to clients or as standalone.",
|
||||
"acceptanceCriteria": [
|
||||
"projects.list accepts optional { clientId?: string, includeArchived?: boolean } and returns matching projects",
|
||||
"projects.listAll returns all projects (for dropdowns) with id and name only",
|
||||
"projects.get accepts { id: string } and returns the full project record",
|
||||
"projects.create accepts { name: string, clientId?: string } and inserts with UUID, status='active', createdAt",
|
||||
"projects.update accepts { id: string, name?: string, clientId?: string, status?: 'active'|'archived', aiSummary?: string }",
|
||||
"projects.delete accepts { id: string } and deletes the project (nulls projectId on its tasks)",
|
||||
"All inputs validated with Zod",
|
||||
"Typecheck passes"
|
||||
],
|
||||
"priority": 6,
|
||||
"passes": true,
|
||||
"notes": "Completed: projects.list (filters by clientId + includeArchived via drizzle and()), projects.listAll (id+name only), projects.get (returns null if not found), projects.create (UUID + status='active' + createdAt), projects.update (partial set object), projects.delete (nulls tasks.projectId then deletes project)"
|
||||
},
|
||||
{
|
||||
"id": "US-007",
|
||||
"title": "Task tRPC procedures (CRUD + filtering)",
|
||||
"description": "As a developer, I need tRPC procedures for task CRUD with search and filter support so that the global Tasks view can query tasks efficiently.",
|
||||
"acceptanceCriteria": [
|
||||
"tasks.list accepts { projectId?: string, status?: 'todo'|'in_progress'|'done', search?: string, orderBy?: 'dueDate'|'priority'|'createdAt' } and returns matching tasks",
|
||||
"tasks.list joins with projects and clients tables to return breadcrumb fields: projectName, clientName, subClientName",
|
||||
"tasks.create accepts { title: string, description?: string, status?: string, priority?: string, assignee?: string, dueDate?: number, projectId?: string }",
|
||||
"tasks.update accepts { id: string, ...partial task fields }",
|
||||
"tasks.delete accepts { id: string }",
|
||||
"All inputs validated with Zod",
|
||||
"Typecheck passes"
|
||||
],
|
||||
"priority": 7,
|
||||
"passes": true,
|
||||
"notes": "Completed: tasks.list (LEFT JOIN projects+clients+parentClients for breadcrumb fields, and() filters for projectId/status/search via like(), orderBy CASE for priority), tasks.create (UUID + createdAt + defaults), tasks.update (partial set), tasks.delete. alias() from drizzle-orm/sqlite-core for self-join."
|
||||
},
|
||||
{
|
||||
"id": "US-008",
|
||||
"title": "Checkpoint and Note tRPC procedures (CRUD)",
|
||||
"description": "As a developer, I need tRPC procedures for checkpoints and notes so that the timeline and notes features have a typed backend.",
|
||||
"acceptanceCriteria": [
|
||||
"checkpoints.list accepts { projectId?: string } and returns matching checkpoints ordered by date",
|
||||
"checkpoints.create accepts { projectId: string, title: string, date: number, isAiSuggested?: number, isApproved?: number }",
|
||||
"checkpoints.update accepts { id: string, title?: string, date?: number, isApproved?: number }",
|
||||
"checkpoints.delete accepts { id: string }",
|
||||
"notes.list accepts { projectId?: string } and returns notes with id, title, createdAt, updatedAt — not content (for performance)",
|
||||
"notes.get accepts { id: string } and returns the full note including content",
|
||||
"notes.create accepts { title: string, content: string, projectId?: string }",
|
||||
"notes.update accepts { id: string, title?: string, content?: string } and always updates updatedAt",
|
||||
"notes.delete accepts { id: string }",
|
||||
"All inputs validated with Zod",
|
||||
"Typecheck passes"
|
||||
],
|
||||
"priority": 8,
|
||||
"passes": true,
|
||||
"notes": "Completed: checkpoints.list (ordered by date, optional projectId filter), checkpoints.create (UUID + createdAt + defaults for isAiSuggested/isApproved), checkpoints.update (partial set), checkpoints.delete. notes.list (returns id/projectId/title/createdAt/updatedAt — no content), notes.get (full record or null), notes.create (UUID + createdAt + updatedAt), notes.update (partial set, always updates updatedAt), notes.delete."
|
||||
},
|
||||
{
|
||||
"id": "US-009",
|
||||
"title": "Project CRUD UI in Projects sidebar",
|
||||
"description": "As a user, I want to create, rename, and delete Projects from the Projects sidebar, where each project can optionally belong to a Client or Sub-Client.",
|
||||
"acceptanceCriteria": [
|
||||
"'New Project' button at top of Projects sidebar uses shadcn/ui Button component; creates a new project via clients.create tRPC mutation",
|
||||
"Each project item has a context menu using shadcn/ui DropdownMenu (triggered by kebab icon) with items: Rename, Delete",
|
||||
"Rename activates an inline editable field (shadcn/ui Input) replacing the label; pressing Enter or blurring saves via clients.update",
|
||||
"Delete shows a shadcn/ui AlertDialog confirmation; if the project has sub-projects, warns the user and offers cascade-delete option",
|
||||
"Each project can optionally be associated with a Client or Sub-Client",
|
||||
"Tree updates immediately after any mutation without full page reload",
|
||||
"All interactive elements use shadcn/ui primitives: install via 'npx shadcn@latest add button input dropdown-menu alert-dialog' before implementing",
|
||||
"Typecheck passes",
|
||||
"Verify in browser using dev-browser skill"
|
||||
],
|
||||
"priority": 9,
|
||||
"passes": true,
|
||||
"notes": "Completed: ProjectSidebar component with New Project button (clients.create), kebab context menu (DropdownMenu with Rename/Delete/New Sub-Project), inline rename (Input with Enter/Escape/blur), AlertDialog delete with cascade-warn flow, collapsible tree with parent-child hierarchy, empty state. All shadcn/ui primitives: Button, Input, DropdownMenu, AlertDialog, Collapsible. Typecheck passes."
|
||||
},
|
||||
{
|
||||
"id": "US-010",
|
||||
"title": "Projects sidebar tree view and project detail routing",
|
||||
"description": "As a user, I want to see all projects in a collapsible tree in the sidebar, optionally grouped by client, and manage them from the Projects section.",
|
||||
"acceptanceCriteria": [
|
||||
"Tree renders projects as a flat list with folder icons; projects with a client show the client name as a grouping header; use shadcn/ui Collapsible for expand/collapse groups",
|
||||
"Search input at the top of the Projects sidebar uses shadcn/ui Input; filters the tree in real-time by project name",
|
||||
"Projects with no client appear under an 'Internal / No Client' group",
|
||||
"Project context menu uses shadcn/ui DropdownMenu with items: Edit (assign/change client), Archive/Unarchive, Delete",
|
||||
"Archived projects hidden by default; a shadcn/ui Switch or toggle reveals them",
|
||||
"Clicking a project node loads the Project Detail panel in the right pane",
|
||||
"Active project highlighted in tree",
|
||||
"Install shadcn/ui components via 'npx shadcn@latest add collapsible dialog select switch' before implementing",
|
||||
"Typecheck passes",
|
||||
"Verify in browser using dev-browser skill"
|
||||
],
|
||||
"priority": 10,
|
||||
"passes": true,
|
||||
"notes": "Completed: ProjectSidebar reworked to show projects grouped by client (Collapsible groups), 'Internal / No Client' group for orphan projects, real-time search filter, archive toggle (Switch), context menu (Edit Client via Dialog+Select, Archive/Unarchive, Delete with AlertDialog), click selects project via search params, active project highlighted. ProjectDetail placeholder component. projects.update now accepts nullable clientId. shadcn/ui: dialog, select, switch installed."
|
||||
},
|
||||
{
|
||||
"id": "US-011",
|
||||
"title": "Global Tasks view UI",
|
||||
"description": "As a user, I want a global task list where I can create, filter, search, and update tasks across all projects in one place.",
|
||||
"acceptanceCriteria": [
|
||||
"4 stat cards using shadcn/ui Card (Card, CardHeader, CardTitle, CardContent) at top: Total Tasks, To Do, In Progress, Completed — each with a Lucide icon and count, reactively updated via tasks.list queries",
|
||||
"Search uses shadcn/ui Input; filters tasks by title or description (case-insensitive, 300ms debounce)",
|
||||
"Status filter uses shadcn/ui Tabs (Tabs, TabsList, TabsTrigger): All | To Do | In Progress | Completed",
|
||||
"'Order by' uses shadcn/ui DropdownMenu: Due Date | Priority | Created Date",
|
||||
"Task rows display: shadcn/ui Checkbox, title (bold 14px), description (muted 14px), priority chip using shadcn/ui Badge (HIGH=destructive variant, MEDIUM=secondary variant, LOW=outline variant with green), due date chip (calendar icon + 'Due Mon DD'), breadcrumb (Client > Sub-Client > Project, chevron-separated via shadcn/ui Breadcrumb if available), assignee (person icon + name)",
|
||||
"Completed task rows have green-tinted background (#f0fdf4 or similar)",
|
||||
"Clicking the shadcn/ui Checkbox calls tasks.update to set status='done' (or back to 'todo') immediately",
|
||||
"'New Task' shadcn/ui Button opens a shadcn/ui Dialog modal: shadcn/ui Input for title (required), Textarea for description, Select for priority, Popover+Calendar for due date, Select for project (optional searchable), Input for assignee (optional)",
|
||||
"Install shadcn/ui components via 'npx shadcn@latest add card tabs checkbox badge dialog textarea select popover calendar' before implementing",
|
||||
"Typecheck passes",
|
||||
"Verify in browser using dev-browser skill"
|
||||
],
|
||||
"priority": 11,
|
||||
"passes": true,
|
||||
"notes": "Completed: Global Tasks view with 4 stat cards (Card, CardHeader, CardTitle, CardContent), search with 300ms debounce (Input + Search icon), status filter tabs (Tabs/TabsList/TabsTrigger: All/To Do/In Progress/Completed), Order by dropdown (DropdownMenu: Due Date/Priority/Created Date), task rows with Checkbox toggle (todo↔done), priority Badge (destructive/secondary/outline variants), due date chip, breadcrumb (Client > Sub-Client > Project), assignee. Completed rows green-tinted. NewTaskDialog component with title Input, Textarea description, Select priority/status, Popover+Calendar due date, Select project, Input assignee. All shadcn/ui primitives installed: card, tabs, checkbox, badge, textarea, popover, calendar."
|
||||
},
|
||||
{
|
||||
"id": "US-012",
|
||||
"title": "GanttChart SVG component and global Timeline view",
|
||||
"description": "As a user, I want to view and create timeline checkpoints on a Gantt-style view so that I have full control over project milestones.",
|
||||
"acceptanceCriteria": [
|
||||
"Reusable GanttChart component accepts { checkpoints: Checkpoint[], startDate: Date, endDate: Date } props",
|
||||
"Component renders a custom SVG: month labels on the X axis, a horizontal baseline <line>, and <circle> dots for each checkpoint positioned by date",
|
||||
"Dot fill: dark (#171717) = isApproved=1 + status todo, green (#16a34a) = done/approved, dashed outline = isApproved=0 (pending AI suggestion)",
|
||||
"A vertical 'Today' marker line rendered at the current date",
|
||||
"Component uses ResizeObserver for responsive SVG width",
|
||||
"Clicking a checkpoint dot opens a shadcn/ui Popover with: title, formatted date, and a shadcn/ui Button (variant=destructive, size=sm) for Delete (calls checkpoints.delete)",
|
||||
"Global Timeline route (/timeline) renders GanttChart with all checkpoints from all projects, color-coded or grouped by project",
|
||||
"'+ Add' shadcn/ui Button opens a shadcn/ui Dialog: shadcn/ui Input for title (required), Popover+Calendar for date picker (required), Select for project dropdown (required in global view)",
|
||||
"Install shadcn/ui components via 'npx shadcn@latest add popover calendar' before implementing (button, dialog, input, select already installed)",
|
||||
"Typecheck passes",
|
||||
"Verify in browser using dev-browser skill"
|
||||
],
|
||||
"priority": 12,
|
||||
"passes": true,
|
||||
"notes": "Completed: Reusable GanttChart SVG component with month labels, baseline, ResizeObserver responsive width, Today marker (red line), checkpoint dots (dark=#171717 for future/approved, green=#16a34a for past/approved, dashed outline for pending AI suggestions). Popover on dot click shows title, date, project name, delete button. Global Timeline route (/timeline) renders all checkpoints from all projects with project name lookup via Map. AddCheckpointDialog with title Input, Popover+Calendar date, Select project. Legend showing dot types."
|
||||
},
|
||||
{
|
||||
"id": "US-013",
|
||||
"title": "Project Detail view — layout, breadcrumb, stat cards, AI summary",
|
||||
"description": "As a user, I want a project detail panel showing breadcrumb navigation, project name, stat cards, and an AI summary card.",
|
||||
"acceptanceCriteria": [
|
||||
"Right panel renders when a project is selected in the Projects tree",
|
||||
"Breadcrumb at top uses shadcn/ui Breadcrumb (Breadcrumb, BreadcrumbList, BreadcrumbItem, BreadcrumbSeparator) showing Client > Sub-Client path",
|
||||
"Project name renders as H1 below the breadcrumb",
|
||||
"3 stat cards using shadcn/ui Card displayed horizontally: Notes (count from notes.list), Tasks Complete (done/total fraction from tasks.list), Checkpoints (approved/total fraction from checkpoints.list)",
|
||||
"AI Project Summary card uses shadcn/ui Card with sparkle (sparkles) Lucide icon + placeholder text 'AI summary will appear here' when project.aiSummary is null/empty",
|
||||
"When project.aiSummary is populated, the card displays the AI-generated text instead",
|
||||
"Install shadcn/ui components via 'npx shadcn@latest add breadcrumb' before implementing (card already installed)",
|
||||
"Typecheck passes",
|
||||
"Verify in browser using dev-browser skill"
|
||||
],
|
||||
"priority": 13,
|
||||
"passes": true,
|
||||
"notes": "Completed: Project Detail view with Breadcrumb (Client > Sub-Client path from clients list), H1 project name, 3 stat cards (Notes count, Tasks Complete done/total, Checkpoints approved/total), AI Project Summary card with sparkles icon showing aiSummary or placeholder text. All data fetched via tRPC queries scoped to projectId. shadcn/ui breadcrumb installed."
|
||||
},
|
||||
{
|
||||
"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": ""
|
||||
},
|
||||
{
|
||||
"id": "US-015",
|
||||
"title": "Inline project timeline and notes list in Project Detail",
|
||||
"description": "As a user, I want to see the project's Gantt timeline and a list of its notes within the project detail scrollable view.",
|
||||
"acceptanceCriteria": [
|
||||
"Project Detail view includes a 'Project Timeline' section using the GanttChart component (from US-012) scoped to the current project's checkpoints",
|
||||
"'+ Add' shadcn/ui Button (variant=outline, size=sm) in the timeline section header opens the add-checkpoint shadcn/ui Dialog with the project pre-selected",
|
||||
"Notes section below Kanban shows a flat list using shadcn/ui Separator between rows: each row has note title + formatted createdAt date",
|
||||
"'+ Add' shadcn/ui Button in notes header calls notes.create with a default title and navigates to /notes/:noteId",
|
||||
"Clicking a note title navigates to /notes/:noteId",
|
||||
"All buttons/dialogs use shadcn/ui components (already installed)",
|
||||
"Typecheck passes",
|
||||
"Verify in browser using dev-browser skill"
|
||||
],
|
||||
"priority": 15,
|
||||
"passes": false,
|
||||
"notes": ""
|
||||
},
|
||||
{
|
||||
"id": "US-016",
|
||||
"title": "Milkdown note editor",
|
||||
"description": "As a user, I want a full-screen Markdown editor for each note so that I can write rich content without leaving the app.",
|
||||
"acceptanceCriteria": [
|
||||
"@milkdown/react and @milkdown/preset-commonmark installed; Milkdown editor renders at route /notes/:noteId",
|
||||
"Supported Markdown: headings (H1-H6), bold, italic, inline code, code blocks, bullet lists, ordered lists, blockquotes",
|
||||
"Note title editable as a shadcn/ui Input (variant borderless/ghost style) at the top of the page (separate from Milkdown content area)",
|
||||
"Content auto-saves to SQLite via notes.update on Milkdown onChange event, debounced 500ms",
|
||||
"Unsaved indicator shown using shadcn/ui Badge (variant=secondary, text 'Saving...') next to the title while save is pending",
|
||||
"Back button uses shadcn/ui Button (variant=ghost, size=icon) with ArrowLeft Lucide icon; navigates to the previous route",
|
||||
"All UI chrome uses shadcn/ui components (already installed)",
|
||||
"Typecheck passes",
|
||||
"Verify in browser using dev-browser skill"
|
||||
],
|
||||
"priority": 16,
|
||||
"passes": false,
|
||||
"notes": ""
|
||||
},
|
||||
{
|
||||
"id": "US-017",
|
||||
"title": "Fluid Curtain pull-down animation",
|
||||
"description": "As a user, I want to pull down from the top of any view to slide the app panel off-screen and reveal the AI chat layer beneath.",
|
||||
"acceptanceCriteria": [
|
||||
"framer-motion useMotionValue + useSpring (stiffness: 300, damping: 30) controls a 'y' CSS transform on the main app panel wrapper",
|
||||
"Trigger 1: wheel event listener at document level — when the current route's scroll position is at 0 and deltaY < 0 (overscroll up), animate panel y from 0 to viewport height",
|
||||
"Trigger 2: Cmd/Ctrl+K keyboard shortcut toggles curtain open (y = viewport height) and closed (y = 0)",
|
||||
"AI chat view is rendered as a fixed full-screen layer behind the sliding panel and becomes fully visible when panel slides down",
|
||||
"App panel remains mounted during animation (no unmount/remount, no state loss)",
|
||||
"Returning from chat: wheel event with deltaY > 0 at chat-bottom OR Cmd/Ctrl+K slides panel back to y = 0",
|
||||
"Right-edge vertical 'keep scrolling for AI' label with chevron-down is visible in every section (non-interactive, visual hint only)",
|
||||
"Typecheck passes",
|
||||
"Verify in browser using dev-browser skill"
|
||||
],
|
||||
"priority": 17,
|
||||
"passes": false,
|
||||
"notes": ""
|
||||
},
|
||||
{
|
||||
"id": "US-018",
|
||||
"title": "GitHub Copilot SDK setup and keytar token storage",
|
||||
"description": "As a developer, I need the GitHub Copilot SDK initialized in the main process with secure OS keychain token storage so that AI features can authenticate.",
|
||||
"acceptanceCriteria": [
|
||||
"keytar installed and imported in main process only (not renderer)",
|
||||
"ai.setToken tRPC mutation accepts { token: string } and stores it via keytar.setPassword('adiuva', 'copilot-token', token)",
|
||||
"ai.hasToken tRPC query returns a boolean indicating whether a token is stored",
|
||||
"On app start, main process reads the token from keychain and initializes the GitHub Copilot SDK client",
|
||||
"Settings dialog uses shadcn/ui Dialog (DialogTrigger as a SidebarMenuButton with Settings/gear icon in the sidebar footer); dialog content uses shadcn/ui Input for token paste + shadcn/ui Button to save via ai.setToken",
|
||||
"If no token is stored, AI-dependent features display a prompt using shadcn/ui Card with a shadcn/ui Button linking to the Settings dialog instead of throwing an error",
|
||||
"Typecheck passes"
|
||||
],
|
||||
"priority": 18,
|
||||
"passes": false,
|
||||
"notes": ""
|
||||
},
|
||||
{
|
||||
"id": "US-019",
|
||||
"title": "@Orchestrator agent with intent routing",
|
||||
"description": "As a developer, I need an Orchestrator agent that receives user messages, reads intent, and routes to the correct specialist agent.",
|
||||
"acceptanceCriteria": [
|
||||
"ai.chat tRPC procedure accepts { message: string, context: { type: 'global' | 'project', projectId?: string } }",
|
||||
"@Orchestrator system prompt instructs the model to use one of three routing tool calls: route_to_project (when context is a project), route_to_knowledge (for cross-project questions), or route_to_general (for everything else)",
|
||||
"For project-scoped context, Orchestrator invokes @ProjectAgent logic and returns its response",
|
||||
"For global context, Orchestrator answers from task/project summaries directly",
|
||||
"Streaming tokens returned to renderer incrementally (use tRPC subscription or async generator pattern)",
|
||||
"SDK auth errors and timeouts caught; procedure returns { error: string } for user-facing display",
|
||||
"Typecheck passes"
|
||||
],
|
||||
"priority": 19,
|
||||
"passes": false,
|
||||
"notes": ""
|
||||
},
|
||||
{
|
||||
"id": "US-020",
|
||||
"title": "Context-scoped AI chat UI",
|
||||
"description": "As a user, I want the AI chat (revealed by the Fluid Curtain) to display a context header, support message input, and stream AI responses.",
|
||||
"acceptanceCriteria": [
|
||||
"Chat panel shows a context header using shadcn/ui Badge (variant=outline): 'Chatting about: [Project Name]' when opened from a project detail view, or 'Global workspace' when opened from other sections",
|
||||
"Chat input box uses shadcn/ui Textarea: white background, border #d4d4d4, shadow-lg, min-height 109px, placeholder 'Ask me anything...'; Send uses shadcn/ui Button (black bg, Send Lucide icon + 'Send' label) anchored bottom-right",
|
||||
"User messages appear as right-aligned message bubbles using shadcn/ui Card; AI responses as left-aligned Cards",
|
||||
"Streaming: AI response tokens appended to the current AI bubble as they arrive from ai.chat",
|
||||
"A loading spinner or pulsing indicator (shadcn/ui Skeleton) shown while waiting for first token",
|
||||
"If ai.chat returns { error }, display the error message in a shadcn/ui Card with destructive border styling",
|
||||
"Chat history is session-only — cleared when the curtain closes or the app restarts",
|
||||
"Install shadcn/ui components via 'npx shadcn@latest add textarea' before implementing (card, badge, button, skeleton already installed)",
|
||||
"Typecheck passes",
|
||||
"Verify in browser using dev-browser skill"
|
||||
],
|
||||
"priority": 20,
|
||||
"passes": false,
|
||||
"notes": ""
|
||||
},
|
||||
{
|
||||
"id": "US-021",
|
||||
"title": "@ProjectAgent with project action tools",
|
||||
"description": "As a user, I want the AI to answer project-specific questions and take actions like adding tasks, summarizing the project, and suggesting checkpoints.",
|
||||
"acceptanceCriteria": [
|
||||
"read_project_notes tool: fetches all notes for the scoped projectId from SQLite and returns combined content to the model",
|
||||
"add_task tool: creates a task in the project via tasks.create and confirms with 'Task added: [title]' in the chat response",
|
||||
"get_summary tool: calls the SDK to generate a 2-3 sentence summary of the project based on its notes and tasks, then calls projects.update to persist the result in project.aiSummary",
|
||||
"suggest_checkpoints tool: returns a JSON array of { title: string, date: string } proposed checkpoints based on date-anchored commitments found in notes",
|
||||
"@Orchestrator routes project-context messages to @ProjectAgent",
|
||||
"Typecheck passes"
|
||||
],
|
||||
"priority": 21,
|
||||
"passes": false,
|
||||
"notes": ""
|
||||
},
|
||||
{
|
||||
"id": "US-022",
|
||||
"title": "LanceDB vector store setup and note embedding pipeline",
|
||||
"description": "As a developer, I need notes embedded into LanceDB so that semantic search across all project notes is possible.",
|
||||
"acceptanceCriteria": [
|
||||
"vectordb (LanceDB Node.js binding) installed and initialized in main process only; vector DB stored at app.getPath('userData')/vectors/",
|
||||
"After notes.create or notes.update, note content is embedded via the GitHub Copilot SDK embeddings endpoint and upserted in LanceDB with metadata: { noteId, projectId, content }",
|
||||
"On first app startup, a migration routine checks if the 'notes' LanceDB table exists; if not, embeds all existing SQLite notes and populates LanceDB",
|
||||
"Embedding errors are caught and logged to console (console.error) but do not reject the notes.update/create promise",
|
||||
"Typecheck passes"
|
||||
],
|
||||
"priority": 22,
|
||||
"passes": false,
|
||||
"notes": ""
|
||||
},
|
||||
{
|
||||
"id": "US-023",
|
||||
"title": "@KnowledgeAgent semantic search across all projects",
|
||||
"description": "As a user, I want to ask questions that retrieve semantically relevant content from all past project notes regardless of project scope.",
|
||||
"acceptanceCriteria": [
|
||||
"vector_search_all tool accepts a query string and performs a LanceDB similarity search returning the top-5 results",
|
||||
"Each result includes: noteId, note title (joined from SQLite), projectId, project name (joined from SQLite), and matched text excerpt",
|
||||
"@Orchestrator routes cross-project knowledge queries to @KnowledgeAgent",
|
||||
"Chat response includes inline citations in the format: 'From: [Project Name] — [Note Title]'",
|
||||
"Typecheck passes"
|
||||
],
|
||||
"priority": 23,
|
||||
"passes": false,
|
||||
"notes": ""
|
||||
},
|
||||
{
|
||||
"id": "US-024",
|
||||
"title": "AI checkpoint suggestions UI",
|
||||
"description": "As a user, I want the AI to suggest timeline checkpoints from my meeting notes, which I can approve or reject directly in the timeline.",
|
||||
"acceptanceCriteria": [
|
||||
"'Suggest checkpoints' shadcn/ui Button (variant=outline, sparkles Lucide icon) in the Project Detail timeline header calls ai.chat with a suggest_checkpoints intent for the current project",
|
||||
"Suggested checkpoints returned by @ProjectAgent are inserted into the checkpoints table via checkpoints.create with isAiSuggested=1, isApproved=0",
|
||||
"Pending suggestions appear as shadcn/ui Card components (with dashed border via className 'border-dashed') above or below the GanttChart in the Project Detail timeline section",
|
||||
"'Approve' shadcn/ui Button (variant=default, size=sm) on each card calls checkpoints.update({ id, isApproved: 1 }); the checkpoint then appears as a normal dot on the Gantt",
|
||||
"'Reject' shadcn/ui Button (variant=ghost, size=sm) calls checkpoints.delete({ id }) and removes the card",
|
||||
"All UI uses shadcn/ui components (already installed)",
|
||||
"Typecheck passes",
|
||||
"Verify in browser using dev-browser skill"
|
||||
],
|
||||
"priority": 24,
|
||||
"passes": false,
|
||||
"notes": ""
|
||||
},
|
||||
{
|
||||
"id": "US-025",
|
||||
"title": "Home dashboard — AI daily brief and suggestion chips",
|
||||
"description": "As a user, I want the Home screen to greet me with an AI-generated daily brief and pre-populated suggestion chips for quick queries.",
|
||||
"acceptanceCriteria": [
|
||||
"Greeting rendered as '✦ Hello, {name}' in Geist Semibold 30px with -1px letter-spacing; name sourced from electron-store (defaults to 'there' if not set)",
|
||||
"Top-right corner stat chip uses shadcn/ui Badge (variant=secondary) showing 'N Task due' where N = count of tasks with dueDate on or before end of today",
|
||||
"On app open, ai.chat called with global context to generate a daily brief paragraph highlighting tasks due today/this week and recent project activity",
|
||||
"Brief displayed below greeting in a shadcn/ui Card; bold key phrases rendered as <strong> (model wraps them in **markdown bold**)",
|
||||
"4 suggestion chips rendered in a 4-column flex row below the chat box using shadcn/ui Button (variant=outline); each chip has a Lucide icon + short prompt text",
|
||||
"Clicking a suggestion chip populates the chat input with the chip's prompt text",
|
||||
"Chat box uses shadcn/ui Textarea: white bg, border #d4d4d4, shadow-lg, min-height 109px, placeholder 'Ask me anything...'; Send uses shadcn/ui Button (black bg) bottom-right",
|
||||
"All UI uses shadcn/ui components (already installed)",
|
||||
"Typecheck passes",
|
||||
"Verify in browser using dev-browser skill"
|
||||
],
|
||||
"priority": 25,
|
||||
"passes": false,
|
||||
"notes": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,228 +0,0 @@
|
||||
## Codebase Patterns
|
||||
- `alias(table, 'alias_name')` from `drizzle-orm/sqlite-core` enables self-joins (e.g., clients → parentClients for hierarchy)
|
||||
- `sql<T>\`CASE WHEN ... THEN ... ELSE ... END\`` for conditional SELECT fields (e.g., clientName vs subClientName based on parentId)
|
||||
- `or(like(col1, pattern), like(col2, pattern))` for multi-column search; SQLite LIKE on NULL columns safely returns NULL (falsy) so OR is safe
|
||||
- Vite configs use `.mts` extension (not `.ts`) to avoid ESM/CJS conflict with electron-forge's externalize-deps plugin
|
||||
- electron-trpc uses `exposeElectronTRPC()` in preload and `createIPCHandler({ router, windows })` in main; renderer uses `ipcLink()` from `electron-trpc/renderer`
|
||||
- appRouter lives at `src/main/router/index.ts`; renderer client at `src/renderer/lib/trpc.ts`
|
||||
- `@/*` path alias maps to `src/renderer/*` (configured in tsconfig.json paths)
|
||||
- Drizzle ORM with better-sqlite3 (sync driver): SELECT queries MUST end with `.all()` to execute; INSERT/UPDATE/DELETE MUST end with `.run()`
|
||||
- `inArray(column, values)` works with nullable columns when values is `string[]` (TypeScript covariance allows string[] → (string | null)[])
|
||||
- All DB tables use `CREATE TABLE IF NOT EXISTS` for non-destructive migrations
|
||||
- All IDs are UUIDs generated via `crypto.randomUUID()`
|
||||
- TypeScript strict mode + noUncheckedIndexedAccess enabled; always account for possible undefined on array access
|
||||
- electron-store@8 (CJS) used for app settings; use lazy init pattern `getStore()` like `getDb()` to avoid calling before app ready
|
||||
- ESLint uses `eslint-import-resolver-typescript` to resolve `@/*` aliases; configured in `.eslintrc.json` under `settings.import/resolver`
|
||||
- App settings (sidebar state, etc.) exposed via `settings` tRPC sub-router for type-safe renderer access
|
||||
- `z.string().nullable().optional()` in tRPC inputs enables three-state semantics: undefined = don't change, null = clear, string = set value
|
||||
- NewTaskDialog component at `src/renderer/components/tasks/NewTaskDialog.tsx` accepts `defaultProjectId` and `defaultStatus` props for reuse in Kanban column "+ Add" buttons
|
||||
- `date-fns` is available as a transitive dependency of `react-day-picker` (shadcn/ui calendar)
|
||||
- GanttChart component at `src/renderer/components/timeline/GanttChart.tsx` is reusable: accepts `defaultProjectId` to scope to a project (for US-015 inline timeline)
|
||||
- AddCheckpointDialog at `src/renderer/components/timeline/AddCheckpointDialog.tsx` accepts `defaultProjectId` — hides project select when provided
|
||||
- TanStack Router `validateSearch` with Zod schema for passing selected-item IDs via URL search params (e.g., `?projectId=...`)
|
||||
---
|
||||
|
||||
## 2026-02-19 - US-002
|
||||
- Installed `better-sqlite3`, `drizzle-orm` (runtime) and `@types/better-sqlite3`, `drizzle-kit` (dev)
|
||||
- Created `src/main/db/schema.ts`: 5 tables (clients, projects, tasks, checkpoints, notes) with exported InferSelectModel/InferInsertModel types
|
||||
- Created `src/main/db/index.ts`: `initDb()` opens/creates `adiuva.db` at `app.getPath('userData')`, runs CREATE TABLE IF NOT EXISTS (non-destructive), enables WAL mode; `getDb()` singleton accessor
|
||||
- Updated `src/main/index.ts`: call `initDb()` in `app.on('ready')`
|
||||
- Updated `vite.main.config.mts`: externalized `better-sqlite3`
|
||||
- Updated `forge.config.ts`: added `AutoUnpackNativesPlugin`
|
||||
- Added `drizzle.config.ts` for drizzle-kit CLI
|
||||
- Typecheck: passes with zero errors
|
||||
- **Learnings for future iterations:**
|
||||
- better-sqlite3 is CommonJS with native addon; Vite must NOT bundle it — always add to rollupOptions.external
|
||||
- The CREATE TABLE IF NOT EXISTS approach satisfies "never destructive" and works perfectly in electron without needing migration file resolution
|
||||
- electron-forge rebuilds native modules automatically on `electron-forge start`; no manual rebuild step needed
|
||||
- `app.getPath('userData')` is only available after `app.on('ready')` fires — do not call earlier
|
||||
---
|
||||
|
||||
## 2026-02-19 - US-008
|
||||
- What was implemented:
|
||||
- Full `checkpointsRouter` replacing stubs in `src/main/router/index.ts`
|
||||
- Full `notesRouter` replacing stubs in `src/main/router/index.ts`
|
||||
- Added `checkpoints` and `notes` to the schema import
|
||||
- `checkpoints.list`: optional `projectId` filter, ordered by `asc(checkpoints.date)`
|
||||
- `checkpoints.create`: inserts with UUID, createdAt=Date.now(), defaults isAiSuggested/isApproved to 0
|
||||
- `checkpoints.update`: partial set for title/date/isApproved
|
||||
- `checkpoints.delete`: deletes by id, returns `{ success: true }`
|
||||
- `notes.list`: returns `{ id, projectId, title, createdAt, updatedAt }` only — no content (performance)
|
||||
- `notes.get`: returns full record or null via `.all()[0] ?? null` pattern
|
||||
- `notes.create`: inserts with UUID, createdAt=updatedAt=Date.now()
|
||||
- `notes.update`: partial set, always sets updatedAt=Date.now() regardless of which fields changed
|
||||
- `notes.delete`: deletes by id, returns `{ success: true }`
|
||||
- Files changed: `src/main/router/index.ts`, `prd.json`, `progress.txt`
|
||||
- **Learnings for future iterations:**
|
||||
- `notes.update` must always set `updatedAt` — build the set object with updatedAt outside the conditional block
|
||||
- `notes.list` intentionally excludes `content` column for performance; use `notes.get` for full record
|
||||
- `checkpoints.projectId` is `.notNull()` in schema (unlike tasks.projectId which is nullable) — no null coalescing needed
|
||||
---
|
||||
|
||||
## 2026-02-19 - US-003
|
||||
- What was implemented:
|
||||
- Installed: electron-trpc, @trpc/server, @trpc/client, @trpc/react-query, @tanstack/react-query, zod
|
||||
- Created `src/main/router/index.ts` with full appRouter: stub routers for health, clients, projects, tasks, checkpoints, notes, ai
|
||||
- Updated `src/preload/index.ts` to call `exposeElectronTRPC()`
|
||||
- Updated `src/main/index.ts` to call `createIPCHandler({ router: appRouter, windows: [win] })`; `createWindow()` now returns `BrowserWindow`
|
||||
- Created `src/renderer/lib/trpc.ts` with `createTRPCReact<AppRouter>()`
|
||||
- Updated `src/renderer/index.tsx` to wrap app in `TRPCProvider` + `QueryClientProvider`
|
||||
- Updated `src/renderer/routes/index.tsx` to call `trpc.health.ping.useQuery()` and display 'tRPC IPC bridge: pong'
|
||||
- Files changed: package.json, package-lock.json, prd.json, src/main/index.ts, src/main/router/index.ts (new), src/preload/index.ts, src/renderer/index.tsx, src/renderer/lib/trpc.ts (new), src/renderer/routes/index.tsx
|
||||
- **Learnings for future iterations:**
|
||||
- electron-trpc `exposeElectronTRPC` is imported from `electron-trpc/main` (not a separate package)
|
||||
- `ipcLink` is imported from `electron-trpc/renderer` in the renderer process
|
||||
- `createTRPCReact<AppRouter>()` requires importing the AppRouter type from the main process router — this is a type-only import so it doesn't bundle main process code into renderer
|
||||
- The TRPCProvider must wrap QueryClientProvider (or be a sibling); both need the same queryClient instance
|
||||
- Stub routers return empty arrays or null — they will be replaced in US-005 through US-008
|
||||
---
|
||||
|
||||
## 2026-02-19 - US-004
|
||||
- What was implemented:
|
||||
- Installed: electron-store@8 (CJS-compatible, for persistent app settings), @fontsource/geist (self-hosted Geist font), eslint-import-resolver-typescript (ESLint path alias fix)
|
||||
- Created `src/main/store.ts` with lazy `getStore()` pattern using electron-store
|
||||
- Added `settings` tRPC sub-router with `getSidebarCollapsed` query and `setSidebarCollapsed` mutation
|
||||
- Updated `src/renderer/components/layout/AppShell.tsx` to: persist sidebar collapse via tRPC, add right-edge 'keep scrolling for AI' vertical label with ChevronDown icon
|
||||
- Updated `src/renderer/globals.css`: replaced Google Fonts CDN with @fontsource/geist imports (weights 400/500/600)
|
||||
- Updated `index.html`: removed Google Fonts CDN links
|
||||
- Updated `.eslintrc.json`: added eslint-import-resolver-typescript to fix @/* alias resolution (fixed all 7 pre-existing lint errors)
|
||||
- Files changed: .eslintrc.json, index.html, package.json, package-lock.json, src/main/router/index.ts, src/main/store.ts (new), src/renderer/components/layout/AppShell.tsx, src/renderer/globals.css
|
||||
- **Learnings for future iterations:**
|
||||
- Use electron-store@8 (not v9+) — v9+ is ESM-only and breaks with CommonJS main process
|
||||
- electron-store must NOT be initialized at module import time (before app.ready); use lazy `getStore()` like `getDb()` pattern
|
||||
- For sidebar/UI state loaded from IPC: use `localState ?? queryData ?? default` pattern to avoid flash while query resolves
|
||||
- @fontsource packages are the npm equivalent of Google Fonts — import weight-specific CSS files (e.g., `@fontsource/geist/400.css`)
|
||||
- ESLint `import/no-unresolved` requires `eslint-import-resolver-typescript` with `alwaysTryTypes: true` to resolve TypeScript path aliases
|
||||
- The `writingMode: 'vertical-rl'` + `transform: 'rotate(180deg)'` CSS pattern creates bottom-to-top text for vertical affordance labels
|
||||
---
|
||||
|
||||
## 2026-02-19 - US-006
|
||||
- What was implemented:
|
||||
- Full `projectsRouter` replacing stubs in `src/main/router/index.ts`
|
||||
- Added `and` to drizzle-orm imports
|
||||
- `projects.list`: uses `and()` with optional conditions for `clientId` filter and archived filter (defaults to active only)
|
||||
- `projects.listAll`: returns only `{ id, name }` columns for dropdown use
|
||||
- `projects.get`: `.all()` then `result[0] ?? null` pattern for nullable single-record lookup
|
||||
- `projects.create`: inserts with UUID, status='active', createdAt=Date.now()
|
||||
- `projects.update`: partial set object — only sets defined fields
|
||||
- `projects.delete`: nulls `tasks.projectId` for all tasks in the project, then deletes the project
|
||||
- Files changed: `src/main/router/index.ts`, `prd.json`, `progress.txt`
|
||||
- **Learnings for future iterations:**
|
||||
- `and(...conditions)` from drizzle-orm accepts `(SQL | undefined)[]` — pass `undefined` for optional conditions and drizzle filters them out automatically
|
||||
- For nullable single-record queries: use `.all()` and `result[0] ?? null` (strict mode forbids `.get()` direct null return without this pattern)
|
||||
- `and()` returns `SQL<unknown> | undefined` which `.where()` accepts directly (no extra wrapping needed)
|
||||
|
||||
---
|
||||
|
||||
## 2026-02-19 - US-005
|
||||
- What was implemented:
|
||||
- Full clients tRPC router replacing stubs in `src/main/router/index.ts`
|
||||
- Added imports: `eq`, `asc`, `inArray` from `drizzle-orm`; `getDb` from `../db`; `clients`, `projects`, `tasks` from `../db/schema`
|
||||
- `clients.list`: `db.select().from(clients).orderBy(asc(clients.name)).all()`
|
||||
- `clients.create`: inserts with `crypto.randomUUID()` + `Date.now()` via `.run()`
|
||||
- `clients.update`: partial update — only sets fields that are defined in input, skips if no-op
|
||||
- `clients.delete`: checks for child clients and child projects; returns `{ error: string }` payload if any exist; otherwise deletes and returns `{ success: true }`
|
||||
- `clients.deleteWithCascade`: BFS loop collects all descendant client IDs, finds their projects, nulls `projectId` on orphaned tasks, deletes projects, then deletes all clients
|
||||
- Files changed: `src/main/router/index.ts`, `prd.json`, `progress.txt`
|
||||
- **Learnings for future iterations:**
|
||||
- Drizzle ORM with better-sqlite3 sync driver: SELECT must call `.all()` to get an array; INSERT/UPDATE/DELETE must call `.run()` to execute — NOT calling these causes TypeScript errors (query builder ≠ result)
|
||||
- `inArray(nullableColumn, string[])` is TypeScript-safe because `string[]` is assignable to `(string | null)[]` via covariance
|
||||
- Guard against empty arrays before using `inArray` — while `allClientIds` is never empty (starts with input.id), `projectIds` could be empty; guarded with `if (projectIds.length > 0)` block
|
||||
- `@typescript-eslint/no-non-null-assertion` is configured as a warning (not error) in this project — `queue.shift()!` is fine after a `length > 0` check
|
||||
---
|
||||
|
||||
## 2026-02-19 - US-007
|
||||
- What was implemented:
|
||||
- Full `tasksRouter` replacing stubs in `src/main/router/index.ts`
|
||||
- Added imports: `or`, `like`, `sql` from `drizzle-orm`; `alias` from `drizzle-orm/sqlite-core`
|
||||
- `tasks.list`: LEFT JOINs projects → clients → parentClients (alias for self-join); CASE WHEN for clientName/subClientName breadcrumb fields; `and()` with optional conditions for projectId/status/search; `like()` OR search on title+description; CASE expression for priority ordering
|
||||
- `tasks.create`: inserts with UUID, defaults (status='todo', priority='medium'), createdAt=Date.now()
|
||||
- `tasks.update`: partial set object — only sets defined fields
|
||||
- `tasks.delete`: deletes by id, returns `{ success: true }`
|
||||
- Files changed: `src/main/router/index.ts`, `prd.json`, `progress.txt`
|
||||
- **Learnings for future iterations:**
|
||||
- `alias(table, 'alias_name')` is from `drizzle-orm/sqlite-core` (NOT `drizzle-orm`) for SQLite self-joins
|
||||
- `sql<T>\`CASE WHEN ${col} IS NOT NULL THEN ${alias.col} ELSE ${col} END\`` for conditional field selection using drizzle template literals
|
||||
- `or(like(col1, pattern), like(col2, pattern))` composes safely — null columns evaluate to NULL (falsy) in WHERE
|
||||
- For priority ordering: `asc(sql\`CASE ${tasks.priority} WHEN 'high' THEN 1 WHEN 'medium' THEN 2 WHEN 'low' THEN 3 ELSE 4 END\`)` puts high priority first
|
||||
---
|
||||
|
||||
## 2026-02-19 - US-009
|
||||
- What was implemented:
|
||||
- Verified existing `ProjectSidebar` component at `src/renderer/components/projects/ProjectSidebar.tsx` satisfies all US-009 acceptance criteria
|
||||
- New Project button at top using shadcn/ui Button + `clients.create` mutation with auto-rename on success
|
||||
- Kebab context menu (DropdownMenu) with Rename, New Sub-Project, Delete actions
|
||||
- Inline rename: Input replaces label, Enter saves via `clients.update`, Escape cancels, blur saves
|
||||
- Delete: AlertDialog with two stages — initial confirm, then cascade-warn if children exist (uses `clients.delete` first, falls back to `clients.deleteWithCascade`)
|
||||
- Hierarchical tree via `buildTree()` function (parent-child via `clients.parentId`)
|
||||
- Empty state with EmptyMedia + call-to-action button
|
||||
- All mutations invalidate `clients.list` query for immediate tree refresh
|
||||
- Typecheck passes (zero errors), lint passes (1 non-null assertion warning, guarded)
|
||||
- Files changed: `scripts/ralph/prd.json`, `scripts/ralph/progress.txt`
|
||||
- **Learnings for future iterations:**
|
||||
- The ProjectSidebar was built as part of US-004 app shell work but the US-009 story wasn't marked as passing — always check existing code before implementing
|
||||
- `useCallback` ref pattern (`ref={callbackRef}`) is used for auto-focus + select on mount without useEffect
|
||||
- The two-stage delete flow (try simple delete first → if error, show cascade option) maps well to the backend's `clients.delete` (guards) + `clients.deleteWithCascade` (force) pattern
|
||||
---
|
||||
|
||||
## 2026-02-19 - US-010
|
||||
- What was implemented:
|
||||
- Rewrote `ProjectSidebar` from a client-hierarchy tree to a project-centric sidebar grouped by client
|
||||
- Projects grouped by `clientId` using Collapsible headers; projects without a client appear under "Internal / No Client"
|
||||
- Search input filters projects by name in real-time (auto-expands all groups when searching)
|
||||
- Show/hide archived projects via Switch toggle (queries `projects.list` with `includeArchived`)
|
||||
- Context menu per project (DropdownMenu): Edit Client (Dialog + Select to assign/change/remove client), Archive/Unarchive, Delete (AlertDialog)
|
||||
- Clicking a project sets `projectId` in search params → renders ProjectDetail placeholder in right pane
|
||||
- Active project highlighted with `bg-sidebar-accent`
|
||||
- Updated `projects.update` tRPC procedure to accept `clientId: z.string().nullable().optional()` (allows unlinking from client)
|
||||
- Created placeholder `ProjectDetail` component (full implementation deferred to US-013)
|
||||
- Installed shadcn/ui: dialog, select, switch
|
||||
- Files changed: `src/renderer/components/projects/ProjectSidebar.tsx`, `src/renderer/routes/projects.tsx`, `src/renderer/components/projects/ProjectDetail.tsx` (new), `src/main/router/index.ts`, `src/renderer/components/ui/dialog.tsx` (new), `src/renderer/components/ui/select.tsx` (new), `src/renderer/components/ui/switch.tsx` (new), `scripts/ralph/prd.json`, `scripts/ralph/progress.txt`
|
||||
- **Learnings for future iterations:**
|
||||
- TanStack Router `validateSearch` with Zod schema is the cleanest way to pass selected-item IDs via URL search params without creating nested routes
|
||||
- `Route.useNavigate()` returns a typed navigate fn; use `void navigate({ search: { ... } })` to avoid unhandled promise warnings
|
||||
- For project grouping, query both `projects.list` and `clients.list` separately then join in-memory via a Map — avoids complex SQL joins for display-only data
|
||||
- `projects.update` with `clientId: z.string().nullable().optional()` allows three states: undefined (don't change), null (unlink), string (assign)
|
||||
- Auto-expanding all groups during search (`effectiveExpanded` computed from grouped keys) gives a better UX than forcing users to manually expand
|
||||
---
|
||||
|
||||
## 2026-02-20 - US-011
|
||||
- What was implemented:
|
||||
- Full Global Tasks view UI at `/tasks` route
|
||||
- 4 stat cards (Total Tasks, To Do, In Progress, Completed) using shadcn/ui Card components with Lucide icons, reactively updated from unfiltered `tasks.list` query
|
||||
- Search bar with 300ms debounce using shadcn/ui Input + Search icon
|
||||
- Status filter tabs using shadcn/ui Tabs (All | To Do | In Progress | Completed)
|
||||
- "Order by" dropdown using shadcn/ui DropdownMenu (Due Date | Priority | Created Date)
|
||||
- Task rows with: shadcn/ui Checkbox (toggles todo↔done), title (bold 14px), description (muted truncated), priority Badge (HIGH=destructive, MEDIUM=secondary, LOW=outline green), due date chip (calendar icon + formatted date), breadcrumb (Client > Sub-Client > Project with ChevronRight separators), assignee (User icon + name)
|
||||
- Completed task rows have green-tinted background (`bg-green-50 border-green-200`)
|
||||
- NewTaskDialog component with: Input for title (required), Textarea for description, Select for priority/status, Popover+Calendar for due date, Select for project (from `projects.listAll`), Input for assignee
|
||||
- Installed shadcn/ui components: card, tabs, checkbox, badge, textarea, popover, calendar
|
||||
- Files changed: `src/renderer/routes/tasks.tsx`, `src/renderer/components/tasks/NewTaskDialog.tsx` (new), `src/renderer/components/ui/card.tsx` (new), `src/renderer/components/ui/tabs.tsx` (new), `src/renderer/components/ui/checkbox.tsx` (new), `src/renderer/components/ui/badge.tsx` (new), `src/renderer/components/ui/textarea.tsx` (new), `src/renderer/components/ui/popover.tsx` (new), `src/renderer/components/ui/calendar.tsx` (new), `scripts/ralph/prd.json`, `scripts/ralph/progress.txt`
|
||||
- **Learnings for future iterations:**
|
||||
- Use two separate `tasks.list` queries: one unfiltered `{}` for stat card counts, one with filters for the displayed list — ensures stats always reflect total counts
|
||||
- `date-fns` `format(date, 'PPP')` produces "February 20th, 2026" style dates — already installed as a dependency of react-day-picker (shadcn/ui calendar)
|
||||
- shadcn/ui Select with an empty string value (`<SelectItem value="">No project</SelectItem>`) works as a "none" option for optional fields
|
||||
- The Popover+Calendar date picker pattern is standard shadcn/ui: Popover wraps a Button trigger showing the formatted date, PopoverContent contains the Calendar
|
||||
- Electron app runs at `http://localhost:5173` in dev mode but only within the Electron BrowserWindow — Playwright browser testing requires the Electron-specific test harness, not direct URL navigation
|
||||
---
|
||||
|
||||
## 2026-02-20 - US-012
|
||||
- What was implemented:
|
||||
- Reusable `GanttChart` SVG component at `src/renderer/components/timeline/GanttChart.tsx`
|
||||
- Accepts `{ checkpoints: GanttCheckpoint[], startDate: Date, endDate: Date, onDelete? }` props
|
||||
- Custom SVG rendering: month labels on X axis, horizontal baseline `<line>`, `<circle>` dots for checkpoints positioned by date
|
||||
- Dot fill logic: dark (#171717) for future approved checkpoints, green (#16a34a) for past approved, dashed outline (#737373) for pending AI suggestions (isApproved=0)
|
||||
- Vertical red "Today" marker line at current date
|
||||
- ResizeObserver for responsive SVG width
|
||||
- foreignObject + shadcn/ui Popover on each dot click: shows title, formatted date, project name, and destructive Delete button
|
||||
- `AddCheckpointDialog` component at `src/renderer/components/timeline/AddCheckpointDialog.tsx`: title Input (required), Popover+Calendar date (required), Select project dropdown (required in global view, hidden when `defaultProjectId` provided)
|
||||
- Global Timeline route (`/timeline`) renders GanttChart with all checkpoints, project name lookup via Map from `projects.listAll`
|
||||
- Legend showing dot types, empty state message when no checkpoints
|
||||
- Files changed: `src/renderer/components/timeline/GanttChart.tsx` (new), `src/renderer/components/timeline/AddCheckpointDialog.tsx` (new), `src/renderer/routes/timeline.tsx`
|
||||
- **Learnings for future iterations:**
|
||||
- `foreignObject` inside SVG is the cleanest way to embed React components (like Popover) on SVG elements — set `overflow-visible` class to prevent clipping
|
||||
- Checkpoints don't have a `status` field; use `isApproved=1` + `date < now` heuristic for "completed" vs "todo" dot color
|
||||
- Date range for the Gantt is computed dynamically: 1 month before earliest date, 2 months after latest date — ensures comfortable visual padding
|
||||
- GanttChart is designed for reuse: the `defaultProjectId` prop on AddCheckpointDialog pre-selects the project and hides the dropdown (for per-project timeline in US-015)
|
||||
- `trpc.projects.listAll.useQuery(undefined, { enabled: showProjectSelect })` prevents unnecessary queries when project is already known
|
||||
---
|
||||
Reference in New Issue
Block a user