From 519d6b850e07a0387511a8f024dc394250b1a241 Mon Sep 17 00:00:00 2001 From: Clawd Date: Sat, 28 Feb 2026 15:26:02 -0800 Subject: 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. --- dist/main/db/index.js | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 dist/main/db/index.js (limited to 'dist/main/db/index.js') 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 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getDb = getDb; +exports.closeDb = closeDb; +const better_sqlite3_1 = __importDefault(require("better-sqlite3")); +const electron_1 = require("electron"); +const node_path_1 = __importDefault(require("node:path")); +const node_fs_1 = __importDefault(require("node:fs")); +const schema_1 = require("./schema"); +let db = null; +function getDb() { + if (db) + return db; + const dbDir = electron_1.app.getPath("userData"); + if (!node_fs_1.default.existsSync(dbDir)) { + node_fs_1.default.mkdirSync(dbDir, { recursive: true }); + } + const dbPath = node_path_1.default.join(dbDir, "claude-flow.db"); + db = new better_sqlite3_1.default(dbPath); + db.pragma("journal_mode = WAL"); + db.pragma("foreign_keys = ON"); + (0, schema_1.initSchema)(db); + return db; +} +function closeDb() { + if (db) { + db.close(); + db = null; + } +} -- cgit v1.2.3