diff options
| author | Clawd <ai@clawd.bot> | 2026-02-28 15:26:02 -0800 |
|---|---|---|
| committer | Clawd <ai@clawd.bot> | 2026-02-28 15:26:02 -0800 |
| commit | 519d6b850e07a0387511a8f024dc394250b1a241 (patch) | |
| tree | 5ee0a1bbbd7410f93a770e8129c88e29b5a5e5fb /dist/main/db/projects.js | |
| parent | bebbffa890c38f12f04b6fafad4c5c5e46e051a8 (diff) | |
Clear artifacts when creating new session
Each new session now starts with empty research.md and plan.md files,
preventing stale content from previous sessions appearing.
Diffstat (limited to 'dist/main/db/projects.js')
| -rw-r--r-- | dist/main/db/projects.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/dist/main/db/projects.js b/dist/main/db/projects.js new file mode 100644 index 0000000..af36cc0 --- /dev/null +++ b/dist/main/db/projects.js | |||
| @@ -0,0 +1,28 @@ | |||
| 1 | "use strict"; | ||
| 2 | Object.defineProperty(exports, "__esModule", { value: true }); | ||
| 3 | exports.listProjects = listProjects; | ||
| 4 | exports.getProject = getProject; | ||
| 5 | exports.createProject = createProject; | ||
| 6 | exports.deleteProject = deleteProject; | ||
| 7 | const index_1 = require("./index"); | ||
| 8 | const uuid_1 = require("uuid"); | ||
| 9 | function listProjects() { | ||
| 10 | return (0, index_1.getDb)() | ||
| 11 | .prepare("SELECT * FROM projects ORDER BY updated_at DESC") | ||
| 12 | .all(); | ||
| 13 | } | ||
| 14 | function getProject(id) { | ||
| 15 | return (0, index_1.getDb)() | ||
| 16 | .prepare("SELECT * FROM projects WHERE id = ?") | ||
| 17 | .get(id); | ||
| 18 | } | ||
| 19 | function createProject(name, projectPath) { | ||
| 20 | const db = (0, index_1.getDb)(); | ||
| 21 | const id = (0, uuid_1.v4)(); | ||
| 22 | const now = Math.floor(Date.now() / 1000); | ||
| 23 | db.prepare("INSERT INTO projects (id, name, path, created_at, updated_at) VALUES (?, ?, ?, ?, ?)").run(id, name, projectPath, now, now); | ||
| 24 | return { id, name, path: projectPath, created_at: now, updated_at: now }; | ||
| 25 | } | ||
| 26 | function deleteProject(id) { | ||
| 27 | (0, index_1.getDb)().prepare("DELETE FROM projects WHERE id = ?").run(id); | ||
| 28 | } | ||
