aboutsummaryrefslogtreecommitdiffstats
path: root/dist/main/db/index.js
diff options
context:
space:
mode:
authorClawd <ai@clawd.bot>2026-02-28 15:26:02 -0800
committerClawd <ai@clawd.bot>2026-02-28 15:26:02 -0800
commit519d6b850e07a0387511a8f024dc394250b1a241 (patch)
tree5ee0a1bbbd7410f93a770e8129c88e29b5a5e5fb /dist/main/db/index.js
parentbebbffa890c38f12f04b6fafad4c5c5e46e051a8 (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/index.js')
-rw-r--r--dist/main/db/index.js33
1 files changed, 33 insertions, 0 deletions
diff --git a/dist/main/db/index.js b/dist/main/db/index.js
new file mode 100644
index 0000000..652d189
--- /dev/null
+++ b/dist/main/db/index.js
@@ -0,0 +1,33 @@
1"use strict";
2var __importDefault = (this && this.__importDefault) || function (mod) {
3 return (mod && mod.__esModule) ? mod : { "default": mod };
4};
5Object.defineProperty(exports, "__esModule", { value: true });
6exports.getDb = getDb;
7exports.closeDb = closeDb;
8const better_sqlite3_1 = __importDefault(require("better-sqlite3"));
9const electron_1 = require("electron");
10const node_path_1 = __importDefault(require("node:path"));
11const node_fs_1 = __importDefault(require("node:fs"));
12const schema_1 = require("./schema");
13let db = null;
14function getDb() {
15 if (db)
16 return db;
17 const dbDir = electron_1.app.getPath("userData");
18 if (!node_fs_1.default.existsSync(dbDir)) {
19 node_fs_1.default.mkdirSync(dbDir, { recursive: true });
20 }
21 const dbPath = node_path_1.default.join(dbDir, "claude-flow.db");
22 db = new better_sqlite3_1.default(dbPath);
23 db.pragma("journal_mode = WAL");
24 db.pragma("foreign_keys = ON");
25 (0, schema_1.initSchema)(db);
26 return db;
27}
28function closeDb() {
29 if (db) {
30 db.close();
31 db = null;
32 }
33}