@smallironman/mcp-memory-keeper 0.12.2-fork1
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/CHANGELOG.md +542 -0
- package/LICENSE +21 -0
- package/README.md +1281 -0
- package/bin/mcp-memory-keeper +54 -0
- package/dist/__tests__/e2e/issue33-reproduce.test.js +234 -0
- package/dist/__tests__/e2e/server-e2e.test.js +341 -0
- package/dist/__tests__/helpers/database-test-helper.js +160 -0
- package/dist/__tests__/helpers/test-server.js +92 -0
- package/dist/__tests__/integration/advanced-features.test.js +614 -0
- package/dist/__tests__/integration/backward-compatibility.test.js +245 -0
- package/dist/__tests__/integration/batchOperationsE2E.test.js +396 -0
- package/dist/__tests__/integration/batchOperationsHandler.test.js +1230 -0
- package/dist/__tests__/integration/channelManagementHandler.test.js +1291 -0
- package/dist/__tests__/integration/channels.test.js +376 -0
- package/dist/__tests__/integration/checkpoint.test.js +251 -0
- package/dist/__tests__/integration/concurrent-access.test.js +190 -0
- package/dist/__tests__/integration/context-operations.test.js +243 -0
- package/dist/__tests__/integration/contextDiff.test.js +852 -0
- package/dist/__tests__/integration/contextDiffHandler.test.js +976 -0
- package/dist/__tests__/integration/contextExportHandler.test.js +510 -0
- package/dist/__tests__/integration/contextGetPaginationDefaults.test.js +298 -0
- package/dist/__tests__/integration/contextReassignChannelHandler.test.js +908 -0
- package/dist/__tests__/integration/contextRelationshipsHandler.test.js +1151 -0
- package/dist/__tests__/integration/contextSearch.test.js +1054 -0
- package/dist/__tests__/integration/contextSearchHandler.test.js +552 -0
- package/dist/__tests__/integration/contextWatchActual.test.js +165 -0
- package/dist/__tests__/integration/contextWatchHandler.test.js +1500 -0
- package/dist/__tests__/integration/database-initialization.test.js +134 -0
- package/dist/__tests__/integration/enhanced-context-operations.test.js +1082 -0
- package/dist/__tests__/integration/enhancedContextGetHandler.test.js +915 -0
- package/dist/__tests__/integration/enhancedContextTimelineHandler.test.js +716 -0
- package/dist/__tests__/integration/error-cases.test.js +411 -0
- package/dist/__tests__/integration/export-import.test.js +367 -0
- package/dist/__tests__/integration/feature-flags.test.js +542 -0
- package/dist/__tests__/integration/file-operations.test.js +264 -0
- package/dist/__tests__/integration/filterBySessionId.test.js +251 -0
- package/dist/__tests__/integration/git-integration.test.js +241 -0
- package/dist/__tests__/integration/index-tools.test.js +496 -0
- package/dist/__tests__/integration/issue11-actual-bug-demo.test.js +304 -0
- package/dist/__tests__/integration/issue11-search-filters-bug.test.js +561 -0
- package/dist/__tests__/integration/issue12-checkpoint-restore-behavior.test.js +621 -0
- package/dist/__tests__/integration/issue13-key-validation.test.js +433 -0
- package/dist/__tests__/integration/issue24-final-fix.test.js +241 -0
- package/dist/__tests__/integration/issue24-fix-validation.test.js +158 -0
- package/dist/__tests__/integration/issue24-reproduce.test.js +225 -0
- package/dist/__tests__/integration/issue24-token-limit.test.js +199 -0
- package/dist/__tests__/integration/issue33-array-items-schema.test.js +165 -0
- package/dist/__tests__/integration/knowledge-graph.test.js +338 -0
- package/dist/__tests__/integration/migrations.test.js +528 -0
- package/dist/__tests__/integration/multi-agent.test.js +546 -0
- package/dist/__tests__/integration/pagination-critical-fix.test.js +296 -0
- package/dist/__tests__/integration/paginationDefaultsHandler.test.js +600 -0
- package/dist/__tests__/integration/project-directory.test.js +291 -0
- package/dist/__tests__/integration/resource-cleanup.test.js +149 -0
- package/dist/__tests__/integration/retention.test.js +513 -0
- package/dist/__tests__/integration/search.test.js +333 -0
- package/dist/__tests__/integration/semantic-search.test.js +266 -0
- package/dist/__tests__/integration/server-initialization.test.js +305 -0
- package/dist/__tests__/integration/session-management.test.js +219 -0
- package/dist/__tests__/integration/simplified-sharing.test.js +346 -0
- package/dist/__tests__/integration/smart-compaction.test.js +230 -0
- package/dist/__tests__/integration/summarization.test.js +308 -0
- package/dist/__tests__/integration/tokenLimitEnforcement.test.js +134 -0
- package/dist/__tests__/integration/tool-profiles-integration.test.js +150 -0
- package/dist/__tests__/integration/watcher-migration-validation.test.js +544 -0
- package/dist/__tests__/security/input-validation.test.js +115 -0
- package/dist/__tests__/utils/agents.test.js +473 -0
- package/dist/__tests__/utils/database.test.js +177 -0
- package/dist/__tests__/utils/git.test.js +122 -0
- package/dist/__tests__/utils/knowledge-graph.test.js +297 -0
- package/dist/__tests__/utils/migrationHealthCheck.test.js +302 -0
- package/dist/__tests__/utils/project-directory-messages.test.js +192 -0
- package/dist/__tests__/utils/timezone-safe-dates.js +119 -0
- package/dist/__tests__/utils/token-limits.test.js +225 -0
- package/dist/__tests__/utils/tool-profiles.test.js +374 -0
- package/dist/__tests__/utils/validation.test.js +200 -0
- package/dist/__tests__/utils/vector-store.test.js +231 -0
- package/dist/handlers/contextWatchHandlers.js +206 -0
- package/dist/index.js +4425 -0
- package/dist/migrations/003_add_channels.js +174 -0
- package/dist/migrations/004_add_context_watch.js +151 -0
- package/dist/migrations/005_add_context_watch.js +98 -0
- package/dist/migrations/simplify-sharing.js +117 -0
- package/dist/repositories/BaseRepository.js +30 -0
- package/dist/repositories/CheckpointRepository.js +140 -0
- package/dist/repositories/ContextRepository.js +2017 -0
- package/dist/repositories/FileRepository.js +104 -0
- package/dist/repositories/RepositoryManager.js +62 -0
- package/dist/repositories/SessionRepository.js +66 -0
- package/dist/repositories/WatcherRepository.js +252 -0
- package/dist/repositories/index.js +15 -0
- package/dist/test-helpers/database-helper.js +128 -0
- package/dist/types/entities.js +3 -0
- package/dist/utils/agents.js +791 -0
- package/dist/utils/channels.js +150 -0
- package/dist/utils/database.js +780 -0
- package/dist/utils/feature-flags.js +476 -0
- package/dist/utils/git.js +145 -0
- package/dist/utils/knowledge-graph.js +264 -0
- package/dist/utils/migrationHealthCheck.js +373 -0
- package/dist/utils/migrations.js +452 -0
- package/dist/utils/retention.js +460 -0
- package/dist/utils/timestamps.js +112 -0
- package/dist/utils/token-limits.js +350 -0
- package/dist/utils/tool-profiles.js +242 -0
- package/dist/utils/validation.js +296 -0
- package/dist/utils/vector-store.js +247 -0
- package/examples/config.json +31 -0
- package/examples/project-directory-setup.md +114 -0
- package/package.json +85 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
const globals_1 = require("@jest/globals");
|
|
40
|
+
const fs = __importStar(require("fs"));
|
|
41
|
+
const path = __importStar(require("path"));
|
|
42
|
+
const os = __importStar(require("os"));
|
|
43
|
+
const better_sqlite3_1 = __importDefault(require("better-sqlite3"));
|
|
44
|
+
const database_1 = require("../../utils/database");
|
|
45
|
+
(0, globals_1.describe)('Database Initialization Tests', () => {
|
|
46
|
+
let tempDir;
|
|
47
|
+
let tempDbPath;
|
|
48
|
+
(0, globals_1.beforeEach)(() => {
|
|
49
|
+
tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'mcp-test-'));
|
|
50
|
+
tempDbPath = path.join(tempDir, 'test.db');
|
|
51
|
+
});
|
|
52
|
+
(0, globals_1.afterEach)(() => {
|
|
53
|
+
fs.rmSync(tempDir, { recursive: true, force: true });
|
|
54
|
+
});
|
|
55
|
+
(0, globals_1.it)('should create sessions table with working_directory column on fresh database', () => {
|
|
56
|
+
const dbManager = new database_1.DatabaseManager({ filename: tempDbPath });
|
|
57
|
+
const db = dbManager.getDatabase();
|
|
58
|
+
// Check that sessions table has working_directory column
|
|
59
|
+
const columns = db.prepare('PRAGMA table_info(sessions)').all();
|
|
60
|
+
const columnNames = columns.map((col) => col.name);
|
|
61
|
+
(0, globals_1.expect)(columnNames).toContain('working_directory');
|
|
62
|
+
dbManager.close();
|
|
63
|
+
});
|
|
64
|
+
(0, globals_1.it)('should add working_directory column to existing database without it', () => {
|
|
65
|
+
// Create database with old schema
|
|
66
|
+
const db = new better_sqlite3_1.default(tempDbPath);
|
|
67
|
+
db.exec(`
|
|
68
|
+
CREATE TABLE sessions (
|
|
69
|
+
id TEXT PRIMARY KEY,
|
|
70
|
+
name TEXT,
|
|
71
|
+
description TEXT,
|
|
72
|
+
branch TEXT,
|
|
73
|
+
parent_id TEXT,
|
|
74
|
+
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
75
|
+
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
|
76
|
+
);
|
|
77
|
+
`);
|
|
78
|
+
db.close();
|
|
79
|
+
// Now open with DatabaseManager which should run migrations
|
|
80
|
+
const dbManager = new database_1.DatabaseManager({ filename: tempDbPath });
|
|
81
|
+
const migratedDb = dbManager.getDatabase();
|
|
82
|
+
// Check that working_directory column was added
|
|
83
|
+
const columns = migratedDb.prepare('PRAGMA table_info(sessions)').all();
|
|
84
|
+
const columnNames = columns.map((col) => col.name);
|
|
85
|
+
(0, globals_1.expect)(columnNames).toContain('working_directory');
|
|
86
|
+
dbManager.close();
|
|
87
|
+
});
|
|
88
|
+
(0, globals_1.it)('should handle duplicate table creation gracefully', () => {
|
|
89
|
+
const dbManager = new database_1.DatabaseManager({ filename: tempDbPath });
|
|
90
|
+
const db = dbManager.getDatabase();
|
|
91
|
+
// Try to create sessions table again (like the bug in index.ts)
|
|
92
|
+
(0, globals_1.expect)(() => {
|
|
93
|
+
db.exec(`
|
|
94
|
+
CREATE TABLE sessions (
|
|
95
|
+
id TEXT PRIMARY KEY,
|
|
96
|
+
name TEXT,
|
|
97
|
+
description TEXT,
|
|
98
|
+
branch TEXT
|
|
99
|
+
);
|
|
100
|
+
`);
|
|
101
|
+
}).toThrow(); // Should throw because table already exists
|
|
102
|
+
// But CREATE TABLE IF NOT EXISTS should work
|
|
103
|
+
(0, globals_1.expect)(() => {
|
|
104
|
+
db.exec(`
|
|
105
|
+
CREATE TABLE IF NOT EXISTS sessions (
|
|
106
|
+
id TEXT PRIMARY KEY,
|
|
107
|
+
name TEXT,
|
|
108
|
+
description TEXT,
|
|
109
|
+
branch TEXT
|
|
110
|
+
);
|
|
111
|
+
`);
|
|
112
|
+
}).not.toThrow();
|
|
113
|
+
// And the column should still be there
|
|
114
|
+
const columns = db.prepare('PRAGMA table_info(sessions)').all();
|
|
115
|
+
const columnNames = columns.map((col) => col.name);
|
|
116
|
+
(0, globals_1.expect)(columnNames).toContain('working_directory');
|
|
117
|
+
dbManager.close();
|
|
118
|
+
});
|
|
119
|
+
(0, globals_1.it)('should allow INSERT with working_directory column', () => {
|
|
120
|
+
const dbManager = new database_1.DatabaseManager({ filename: tempDbPath });
|
|
121
|
+
const db = dbManager.getDatabase();
|
|
122
|
+
// This should work
|
|
123
|
+
(0, globals_1.expect)(() => {
|
|
124
|
+
db.prepare(`
|
|
125
|
+
INSERT INTO sessions (id, name, description, branch, working_directory)
|
|
126
|
+
VALUES (?, ?, ?, ?, ?)
|
|
127
|
+
`).run('test-id', 'Test Session', 'Test Description', 'main', '/path/to/project');
|
|
128
|
+
}).not.toThrow();
|
|
129
|
+
// Verify the data
|
|
130
|
+
const session = db.prepare('SELECT * FROM sessions WHERE id = ?').get('test-id');
|
|
131
|
+
(0, globals_1.expect)(session.working_directory).toBe('/path/to/project');
|
|
132
|
+
dbManager.close();
|
|
133
|
+
});
|
|
134
|
+
});
|