cortex-mcp 2.7.0 → 2.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/db/database.js +54 -3
- package/package.json +2 -2
package/dist/db/database.js
CHANGED
|
@@ -44,7 +44,7 @@ exports.CognitiveDatabase = void 0;
|
|
|
44
44
|
const better_sqlite3_1 = __importDefault(require("better-sqlite3"));
|
|
45
45
|
const path = __importStar(require("path"));
|
|
46
46
|
const fs = __importStar(require("fs"));
|
|
47
|
-
const SCHEMA_VERSION =
|
|
47
|
+
const SCHEMA_VERSION = 2;
|
|
48
48
|
const SCHEMA_SQL = `
|
|
49
49
|
-- ═══ SETTINGS ═══
|
|
50
50
|
PRAGMA journal_mode=WAL;
|
|
@@ -219,9 +219,60 @@ class CognitiveDatabase {
|
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
221
|
migrate(fromVersion) {
|
|
222
|
-
|
|
223
|
-
//
|
|
222
|
+
console.log(`[cortex-mcp] Migrating database from schema v${fromVersion} to v${SCHEMA_VERSION}...`);
|
|
223
|
+
// ─── Migration to v2: Add missing columns added after v1.0.4 ─────────────
|
|
224
|
+
if (fromVersion < 2) {
|
|
225
|
+
const existingCols = this.db.pragma('table_info(memory_units)').map((c) => c.name);
|
|
226
|
+
// created_at — required by git-hooks, undo_last, memory ordering
|
|
227
|
+
if (!existingCols.includes('created_at')) {
|
|
228
|
+
this.db.exec('ALTER TABLE memory_units ADD COLUMN created_at INTEGER NOT NULL DEFAULT 0');
|
|
229
|
+
// Back-fill with timestamp value for existing rows
|
|
230
|
+
this.db.exec('UPDATE memory_units SET created_at = timestamp WHERE created_at = 0');
|
|
231
|
+
console.log('[cortex-mcp] Migration: added created_at column');
|
|
232
|
+
}
|
|
233
|
+
// access_count — required by memory ranker
|
|
234
|
+
if (!existingCols.includes('access_count')) {
|
|
235
|
+
this.db.exec('ALTER TABLE memory_units ADD COLUMN access_count INTEGER DEFAULT 0');
|
|
236
|
+
console.log('[cortex-mcp] Migration: added access_count column');
|
|
237
|
+
}
|
|
238
|
+
// last_accessed — required by touch()
|
|
239
|
+
if (!existingCols.includes('last_accessed')) {
|
|
240
|
+
this.db.exec('ALTER TABLE memory_units ADD COLUMN last_accessed INTEGER');
|
|
241
|
+
console.log('[cortex-mcp] Migration: added last_accessed column');
|
|
242
|
+
}
|
|
243
|
+
// confidence — required by confidence decay
|
|
244
|
+
if (!existingCols.includes('confidence')) {
|
|
245
|
+
this.db.exec('ALTER TABLE memory_units ADD COLUMN confidence REAL DEFAULT 0.5');
|
|
246
|
+
console.log('[cortex-mcp] Migration: added confidence column');
|
|
247
|
+
}
|
|
248
|
+
// importance — required by context builder ordering
|
|
249
|
+
if (!existingCols.includes('importance')) {
|
|
250
|
+
this.db.exec('ALTER TABLE memory_units ADD COLUMN importance REAL DEFAULT 0.5');
|
|
251
|
+
console.log('[cortex-mcp] Migration: added importance column');
|
|
252
|
+
}
|
|
253
|
+
// tags — required by pin/unpin
|
|
254
|
+
if (!existingCols.includes('tags')) {
|
|
255
|
+
this.db.exec("ALTER TABLE memory_units ADD COLUMN tags TEXT DEFAULT '[]'");
|
|
256
|
+
console.log('[cortex-mcp] Migration: added tags column');
|
|
257
|
+
}
|
|
258
|
+
// Ensure FTS table exists (may be missing in very old DBs)
|
|
259
|
+
const hasFTS = this.db
|
|
260
|
+
.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='memory_fts'")
|
|
261
|
+
.get();
|
|
262
|
+
if (!hasFTS) {
|
|
263
|
+
this.db.exec(`
|
|
264
|
+
CREATE VIRTUAL TABLE IF NOT EXISTS memory_fts USING fts5(
|
|
265
|
+
id UNINDEXED, intent, action, reason, impact, tags,
|
|
266
|
+
content='memory_units', content_rowid='rowid',
|
|
267
|
+
tokenize='porter unicode61'
|
|
268
|
+
);
|
|
269
|
+
INSERT INTO memory_fts(memory_fts) VALUES('rebuild');
|
|
270
|
+
`);
|
|
271
|
+
console.log('[cortex-mcp] Migration: rebuilt FTS index');
|
|
272
|
+
}
|
|
273
|
+
}
|
|
224
274
|
this.db.prepare('UPDATE schema_version SET version = ?').run(SCHEMA_VERSION);
|
|
275
|
+
console.log(`[cortex-mcp] Database migration complete. Schema is now v${SCHEMA_VERSION}.`);
|
|
225
276
|
}
|
|
226
277
|
/** Get the raw database connection for direct queries */
|
|
227
278
|
get connection() {
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "cortex-mcp",
|
|
3
3
|
"displayName": "Cortex MCP Server",
|
|
4
4
|
"description": "Persistent memory for AI coding assistants. Injects context from past sessions into every LLM request.",
|
|
5
|
-
"version": "2.7.
|
|
5
|
+
"version": "2.7.2",
|
|
6
6
|
"publisher": "cortex",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"engines": {
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"build": "npm run compile",
|
|
60
60
|
"lint": "eslint src/",
|
|
61
61
|
"watch": "tsc -watch -p ./",
|
|
62
|
-
"prepublishOnly": "
|
|
62
|
+
"prepublishOnly": "node -e \"const p=require('./package.json');console.log('Publishing cortex-mcp v'+p.version)\"",
|
|
63
63
|
"build:bin": "node scripts/build-binaries.js"
|
|
64
64
|
},
|
|
65
65
|
"pkg": {
|