From 332e5cec2992fefb302251962a3ceca38437a110 Mon Sep 17 00:00:00 2001 From: Clawd Date: Sat, 28 Feb 2026 07:26:43 -0800 Subject: Phase 2: Claude integration layer - Add @anthropic-ai/claude-agent-sdk dependency - Implement src/main/claude/phases.ts with phase configs (research/plan/implement) - Implement src/main/claude/index.ts with SDK wrapper - query() integration with session management - Session resume support - Artifact read/write utilities - Phase advancement logic --- src/main/db/projects.ts | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/main/db/projects.ts (limited to 'src/main/db/projects.ts') diff --git a/src/main/db/projects.ts b/src/main/db/projects.ts new file mode 100644 index 0000000..88ef2f6 --- /dev/null +++ b/src/main/db/projects.ts @@ -0,0 +1,38 @@ +import { getDb } from "./index"; +import { v4 as uuid } from "uuid"; + +export interface Project { + id: string; + name: string; + path: string; + created_at: number; + updated_at: number; +} + +export function listProjects(): Project[] { + return getDb() + .prepare("SELECT * FROM projects ORDER BY updated_at DESC") + .all() as Project[]; +} + +export function getProject(id: string): Project | undefined { + return getDb() + .prepare("SELECT * FROM projects WHERE id = ?") + .get(id) as Project | undefined; +} + +export function createProject(name: string, projectPath: string): Project { + const db = getDb(); + const id = uuid(); + const now = Math.floor(Date.now() / 1000); + + db.prepare( + "INSERT INTO projects (id, name, path, created_at, updated_at) VALUES (?, ?, ?, ?, ?)" + ).run(id, name, projectPath, now, now); + + return { id, name, path: projectPath, created_at: now, updated_at: now }; +} + +export function deleteProject(id: string): void { + getDb().prepare("DELETE FROM projects WHERE id = ?").run(id); +} -- cgit v1.2.3