aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/db/projects.ts
diff options
context:
space:
mode:
authorClawd <ai@clawd.bot>2026-02-28 07:26:43 -0800
committerClawd <ai@clawd.bot>2026-02-28 07:26:43 -0800
commit332e5cec2992fefb302251962a3ceca38437a110 (patch)
tree7802469abb929e741ccbecd989828f1baf37145f /src/main/db/projects.ts
parentd2d6fd48d97b876c9a9a424c9d2cc1de5352b144 (diff)
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
Diffstat (limited to 'src/main/db/projects.ts')
-rw-r--r--src/main/db/projects.ts38
1 files changed, 38 insertions, 0 deletions
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 @@
1import { getDb } from "./index";
2import { v4 as uuid } from "uuid";
3
4export interface Project {
5 id: string;
6 name: string;
7 path: string;
8 created_at: number;
9 updated_at: number;
10}
11
12export function listProjects(): Project[] {
13 return getDb()
14 .prepare("SELECT * FROM projects ORDER BY updated_at DESC")
15 .all() as Project[];
16}
17
18export function getProject(id: string): Project | undefined {
19 return getDb()
20 .prepare("SELECT * FROM projects WHERE id = ?")
21 .get(id) as Project | undefined;
22}
23
24export function createProject(name: string, projectPath: string): Project {
25 const db = getDb();
26 const id = uuid();
27 const now = Math.floor(Date.now() / 1000);
28
29 db.prepare(
30 "INSERT INTO projects (id, name, path, created_at, updated_at) VALUES (?, ?, ?, ?, ?)"
31 ).run(id, name, projectPath, now, now);
32
33 return { id, name, path: projectPath, created_at: now, updated_at: now };
34}
35
36export function deleteProject(id: string): void {
37 getDb().prepare("DELETE FROM projects WHERE id = ?").run(id);
38}