mindlore 0.6.8 → 0.6.9
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/README.md +259 -259
- package/SCHEMA.md +292 -292
- package/dist/scripts/cc-memory-bulk-sync.d.ts.map +1 -1
- package/dist/scripts/cc-memory-bulk-sync.js +2 -1
- package/dist/scripts/cc-memory-bulk-sync.js.map +1 -1
- package/dist/scripts/cc-session-sync.d.ts.map +1 -1
- package/dist/scripts/cc-session-sync.js +6 -5
- package/dist/scripts/cc-session-sync.js.map +1 -1
- package/dist/scripts/fetch-raw.js +5 -4
- package/dist/scripts/fetch-raw.js.map +1 -1
- package/dist/scripts/init.js +12 -11
- package/dist/scripts/init.js.map +1 -1
- package/dist/scripts/lib/consolidation.js +10 -10
- package/dist/scripts/lib/constants.d.ts +2 -0
- package/dist/scripts/lib/constants.d.ts.map +1 -1
- package/dist/scripts/lib/constants.js +10 -1
- package/dist/scripts/lib/constants.js.map +1 -1
- package/dist/scripts/lib/decay.js +9 -9
- package/dist/scripts/lib/episodes.js +23 -23
- package/dist/scripts/lib/migrations-v061.js +21 -21
- package/dist/scripts/lib/migrations-v062.js +11 -11
- package/dist/scripts/lib/migrations-v063.js +14 -14
- package/dist/scripts/lib/migrations-v067.js +11 -11
- package/dist/scripts/lib/schema-version.js +6 -6
- package/dist/scripts/lib/search-cache.js +11 -11
- package/dist/scripts/lib/secure-io.d.ts +11 -0
- package/dist/scripts/lib/secure-io.d.ts.map +1 -0
- package/dist/scripts/lib/secure-io.js +26 -0
- package/dist/scripts/lib/secure-io.js.map +1 -0
- package/dist/scripts/lib/session-payload.js +7 -7
- package/dist/scripts/lib/triage.js +3 -3
- package/dist/scripts/lib/validate-manifest.d.ts +8 -0
- package/dist/scripts/lib/validate-manifest.d.ts.map +1 -0
- package/dist/scripts/lib/validate-manifest.js +80 -0
- package/dist/scripts/lib/validate-manifest.js.map +1 -0
- package/dist/scripts/mindlore-backup.js +9 -9
- package/dist/scripts/mindlore-fts5-index.js +10 -10
- package/dist/scripts/validate-manifest-cli.d.ts +2 -0
- package/dist/scripts/validate-manifest-cli.d.ts.map +1 -0
- package/dist/scripts/validate-manifest-cli.js +38 -0
- package/dist/scripts/validate-manifest-cli.js.map +1 -0
- package/dist/tests/cc-memory-sync.test.js +3 -3
- package/dist/tests/chunks-migration.test.js +1 -1
- package/dist/tests/compaction-snapshot.test.js +2 -2
- package/dist/tests/consolidation.test.js +3 -3
- package/dist/tests/decay.test.js +9 -9
- package/dist/tests/diary.test.js +4 -4
- package/dist/tests/episode-file.test.js +2 -1
- package/dist/tests/episode-file.test.js.map +1 -1
- package/dist/tests/episodes-inject.test.js +9 -9
- package/dist/tests/fetch-raw.test.js +1 -2
- package/dist/tests/fetch-raw.test.js.map +1 -1
- package/dist/tests/fts5.test.js +75 -75
- package/dist/tests/fuzzy.test.js +1 -1
- package/dist/tests/git-snapshot.test.js +3 -5
- package/dist/tests/git-snapshot.test.js.map +1 -1
- package/dist/tests/helpers/db.d.ts +1 -2
- package/dist/tests/helpers/db.d.ts.map +1 -1
- package/dist/tests/helpers/db.js +18 -26
- package/dist/tests/helpers/db.js.map +1 -1
- package/dist/tests/manifest-v2.test.d.ts +2 -0
- package/dist/tests/manifest-v2.test.d.ts.map +1 -0
- package/dist/tests/manifest-v2.test.js +74 -0
- package/dist/tests/manifest-v2.test.js.map +1 -0
- package/dist/tests/migrations-v053.test.js +16 -16
- package/dist/tests/migrations-v061.test.js +10 -10
- package/dist/tests/migrations-v063.test.js +4 -4
- package/dist/tests/migrations-v068.test.js +6 -3
- package/dist/tests/migrations-v068.test.js.map +1 -1
- package/dist/tests/nomination-counts.test.js +6 -6
- package/dist/tests/nomination-counts.test.js.map +1 -1
- package/dist/tests/pre-compact.test.js +2 -1
- package/dist/tests/pre-compact.test.js.map +1 -1
- package/dist/tests/recall-telemetry.test.js +12 -11
- package/dist/tests/recall-telemetry.test.js.map +1 -1
- package/dist/tests/rrf.test.js +3 -3
- package/dist/tests/search-engine.test.js +1 -1
- package/dist/tests/search-hook.test.js +2 -2
- package/dist/tests/search-offload.test.js +1 -1
- package/dist/tests/search-offload.test.js.map +1 -1
- package/dist/tests/secure-io.test.d.ts +2 -0
- package/dist/tests/secure-io.test.d.ts.map +1 -0
- package/dist/tests/secure-io.test.js +65 -0
- package/dist/tests/secure-io.test.js.map +1 -0
- package/dist/tests/session-payload.test.js +1 -1
- package/dist/tests/session-summary.test.js +1 -1
- package/dist/tests/similarity.test.js +1 -1
- package/dist/tests/skill-path-resolution.test.js +22 -3
- package/dist/tests/skill-path-resolution.test.js.map +1 -1
- package/dist/tests/triage.test.js +1 -1
- package/hooks/lib/constants.cjs +15 -15
- package/hooks/lib/mindlore-common.cjs +975 -974
- package/hooks/mindlore-cwd-changed.cjs +57 -57
- package/hooks/mindlore-decision-detector.cjs +54 -54
- package/hooks/mindlore-dont-repeat.cjs +222 -222
- package/hooks/mindlore-fts5-sync.cjs +98 -97
- package/hooks/mindlore-index.cjs +230 -229
- package/hooks/mindlore-model-router.cjs +54 -54
- package/hooks/mindlore-post-compact.cjs +69 -69
- package/hooks/mindlore-post-read.cjs +106 -106
- package/hooks/mindlore-pre-compact.cjs +154 -154
- package/hooks/mindlore-read-guard.cjs +105 -105
- package/hooks/mindlore-research-guard.cjs +176 -176
- package/hooks/mindlore-search.cjs +200 -200
- package/hooks/mindlore-session-end.cjs +510 -509
- package/hooks/mindlore-session-focus.cjs +256 -256
- package/package.json +76 -75
- package/plugin.json +2 -1
- package/skills/mindlore-diary/SKILL.md +85 -85
- package/skills/mindlore-evolve/SKILL.md +126 -126
- package/skills/mindlore-explore/SKILL.md +109 -109
- package/skills/mindlore-ingest/SKILL.md +195 -195
- package/skills/mindlore-maintain/SKILL.md +125 -125
- package/skills/mindlore-query/SKILL.md +151 -151
- package/skills/mindlore-reflect/SKILL.md +141 -141
- package/skills/mindlore-stats/SKILL.md +106 -106
- package/templates/INDEX.md +14 -14
- package/templates/SCHEMA.md +292 -292
- package/templates/config.json +1 -1
- package/templates/extraction/article.md +15 -15
- package/templates/extraction/changelog.md +15 -15
- package/templates/extraction/default.md +15 -15
- package/templates/extraction/docs.md +15 -15
- package/templates/extraction/github-repo.md +17 -17
package/dist/tests/decay.test.js
CHANGED
|
@@ -95,7 +95,7 @@ describe('recall shield', () => {
|
|
|
95
95
|
});
|
|
96
96
|
describe('archiveDocument / restoreDocument', () => {
|
|
97
97
|
test('archiveDocument sets archived_at, restoreDocument clears it', () => {
|
|
98
|
-
db.prepare(`INSERT INTO file_hashes (path, content_hash, last_indexed, recall_count, last_recalled_at, importance)
|
|
98
|
+
db.prepare(`INSERT INTO file_hashes (path, content_hash, last_indexed, recall_count, last_recalled_at, importance)
|
|
99
99
|
VALUES (?, ?, ?, ?, ?, ?)`).run('/test/doc.md', 'abc123', new Date().toISOString(), 0, null, 1.0);
|
|
100
100
|
(0, decay_js_1.archiveDocument)(db, '/test/doc.md');
|
|
101
101
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- better-sqlite3 .get() returns unknown, narrowing to expected row shape
|
|
@@ -112,10 +112,10 @@ describe('listStaleDocuments', () => {
|
|
|
112
112
|
const ninetyDaysAgo = new Date(Date.now() - 90 * 24 * 60 * 60 * 1000).toISOString();
|
|
113
113
|
const now = new Date().toISOString();
|
|
114
114
|
// Stale: old, never recalled
|
|
115
|
-
db.prepare(`INSERT INTO file_hashes (path, content_hash, last_indexed, recall_count, last_recalled_at, importance)
|
|
115
|
+
db.prepare(`INSERT INTO file_hashes (path, content_hash, last_indexed, recall_count, last_recalled_at, importance)
|
|
116
116
|
VALUES (?, ?, ?, ?, ?, ?)`).run('/test/stale.md', 'hash1', ninetyDaysAgo, 0, null, 1.0);
|
|
117
117
|
// Active: recently recalled with high recall_count
|
|
118
|
-
db.prepare(`INSERT INTO file_hashes (path, content_hash, last_indexed, recall_count, last_recalled_at, importance)
|
|
118
|
+
db.prepare(`INSERT INTO file_hashes (path, content_hash, last_indexed, recall_count, last_recalled_at, importance)
|
|
119
119
|
VALUES (?, ?, ?, ?, ?, ?)`).run('/test/active.md', 'hash2', now, 20, now, 1.0);
|
|
120
120
|
const stale = (0, decay_js_1.listStaleDocuments)(db, 0.3);
|
|
121
121
|
const paths = stale.map(d => d.path);
|
|
@@ -129,7 +129,7 @@ describe('listStaleDocuments', () => {
|
|
|
129
129
|
});
|
|
130
130
|
describe('persistDecayScores', () => {
|
|
131
131
|
test('should write decay_score and last_decay_calc to episodes', () => {
|
|
132
|
-
db.prepare(`INSERT INTO episodes (id, kind, scope, summary, created_at)
|
|
132
|
+
db.prepare(`INSERT INTO episodes (id, kind, scope, summary, created_at)
|
|
133
133
|
VALUES ('test-decay-1', 'learning', 'project', 'test', datetime('now'))`).run();
|
|
134
134
|
(0, decay_js_1.persistDecayScores)(db);
|
|
135
135
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- better-sqlite3 .get() returns unknown
|
|
@@ -139,15 +139,15 @@ describe('persistDecayScores', () => {
|
|
|
139
139
|
expect(row.last_decay_calc).toBeTruthy();
|
|
140
140
|
});
|
|
141
141
|
test('should return count of updated episodes', () => {
|
|
142
|
-
db.prepare(`INSERT INTO episodes (id, kind, scope, summary, created_at)
|
|
142
|
+
db.prepare(`INSERT INTO episodes (id, kind, scope, summary, created_at)
|
|
143
143
|
VALUES ('test-decay-2', 'decision', 'project', 'decision test', datetime('now'))`).run();
|
|
144
|
-
db.prepare(`INSERT INTO episodes (id, kind, scope, summary, created_at)
|
|
144
|
+
db.prepare(`INSERT INTO episodes (id, kind, scope, summary, created_at)
|
|
145
145
|
VALUES ('test-decay-3', 'observation', 'project', 'obs test', datetime('now'))`).run();
|
|
146
146
|
const count = (0, decay_js_1.persistDecayScores)(db);
|
|
147
147
|
expect(count).toBe(2);
|
|
148
148
|
});
|
|
149
149
|
test('should skip non-active episodes', () => {
|
|
150
|
-
db.prepare(`INSERT INTO episodes (id, kind, scope, summary, status, created_at)
|
|
150
|
+
db.prepare(`INSERT INTO episodes (id, kind, scope, summary, status, created_at)
|
|
151
151
|
VALUES ('test-decay-4', 'learning', 'project', 'archived', 'archived', datetime('now'))`).run();
|
|
152
152
|
const count = (0, decay_js_1.persistDecayScores)(db);
|
|
153
153
|
expect(count).toBe(0);
|
|
@@ -157,9 +157,9 @@ describe('persistDecayScores', () => {
|
|
|
157
157
|
});
|
|
158
158
|
test('should assign higher importance to learning and decision kinds', () => {
|
|
159
159
|
const oldDate = new Date(Date.now() - 30 * 24 * 60 * 60 * 1000).toISOString();
|
|
160
|
-
db.prepare(`INSERT INTO episodes (id, kind, scope, summary, created_at)
|
|
160
|
+
db.prepare(`INSERT INTO episodes (id, kind, scope, summary, created_at)
|
|
161
161
|
VALUES ('decay-learn', 'learning', 'project', 'learn', ?)`).run(oldDate);
|
|
162
|
-
db.prepare(`INSERT INTO episodes (id, kind, scope, summary, created_at)
|
|
162
|
+
db.prepare(`INSERT INTO episodes (id, kind, scope, summary, created_at)
|
|
163
163
|
VALUES ('decay-obs', 'observation', 'project', 'obs', ?)`).run(oldDate);
|
|
164
164
|
(0, decay_js_1.persistDecayScores)(db);
|
|
165
165
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- better-sqlite3 .get() returns unknown
|
package/dist/tests/diary.test.js
CHANGED
|
@@ -100,9 +100,9 @@ describe('diary workflow: bare session → enriched episodes', () => {
|
|
|
100
100
|
});
|
|
101
101
|
test('finding latest bare session for diary analysis', () => {
|
|
102
102
|
// Simulate multiple sessions
|
|
103
|
-
db.prepare(`INSERT INTO episodes (id, kind, scope, project, summary, status, source, created_at)
|
|
103
|
+
db.prepare(`INSERT INTO episodes (id, kind, scope, project, summary, status, source, created_at)
|
|
104
104
|
VALUES ('ep-old', 'session', 'project', 'mindlore', 'Old session', 'active', 'hook', '2026-04-12T10:00:00.000Z')`).run();
|
|
105
|
-
db.prepare(`INSERT INTO episodes (id, kind, scope, project, summary, status, source, created_at)
|
|
105
|
+
db.prepare(`INSERT INTO episodes (id, kind, scope, project, summary, status, source, created_at)
|
|
106
106
|
VALUES ('ep-new', 'session', 'project', 'mindlore', 'Latest session', 'active', 'hook', '2026-04-13T15:00:00.000Z')`).run();
|
|
107
107
|
// Query like diary would: find latest session episode
|
|
108
108
|
const sessions = queryRecentEpisodes(db, { project: 'mindlore', limit: 1 });
|
|
@@ -154,9 +154,9 @@ describe('reflect input: episodes query', () => {
|
|
|
154
154
|
expect(reflectInput.some(e => e.source === 'reflect')).toBe(false);
|
|
155
155
|
});
|
|
156
156
|
test('reflect filters by date range', () => {
|
|
157
|
-
db.prepare(`INSERT INTO episodes (id, kind, scope, project, summary, status, source, created_at)
|
|
157
|
+
db.prepare(`INSERT INTO episodes (id, kind, scope, project, summary, status, source, created_at)
|
|
158
158
|
VALUES ('ep-old', 'friction', 'project', 'mindlore', 'Old friction', 'active', 'diary', '2026-04-01T10:00:00.000Z')`).run();
|
|
159
|
-
db.prepare(`INSERT INTO episodes (id, kind, scope, project, summary, status, source, created_at)
|
|
159
|
+
db.prepare(`INSERT INTO episodes (id, kind, scope, project, summary, status, source, created_at)
|
|
160
160
|
VALUES ('ep-recent', 'friction', 'project', 'mindlore', 'Recent friction', 'active', 'diary', '2026-04-13T10:00:00.000Z')`).run();
|
|
161
161
|
const lastWeek = (0, episodes_js_1.queryEpisodes)(db, {
|
|
162
162
|
project: 'mindlore',
|
|
@@ -23,7 +23,8 @@ function runWriteEpisodeFile(baseDir, project, commits, changedFiles, reads, epi
|
|
|
23
23
|
// Since writeEpisodeFile is not exported, test via the hook's worker mode
|
|
24
24
|
// by calling the hook with a crafted payload
|
|
25
25
|
const payload = JSON.stringify({ baseDir, project, commits, changedFiles, reads });
|
|
26
|
-
const
|
|
26
|
+
const tmpFileDir = fs_1.default.mkdtempSync(path_1.default.join(os_1.default.tmpdir(), 'mindlore-test-epfile-'));
|
|
27
|
+
const tmpFile = path_1.default.join(tmpFileDir, 'payload.json');
|
|
27
28
|
fs_1.default.writeFileSync(tmpFile, payload, 'utf8');
|
|
28
29
|
const hookFile = path_1.default.join(__dirname, '..', 'hooks', 'mindlore-session-end.cjs');
|
|
29
30
|
const env = { ...process.env, MINDLORE_HOME: tmpDir };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"episode-file.test.js","sourceRoot":"","sources":["../../tests/episode-file.test.ts"],"names":[],"mappings":";;;;;AAAA,4CAAoB;AACpB,gDAAwB;AACxB,4CAAoB;AACpB,iDAAyC;AAEzC,IAAI,MAAc,CAAC;AAEnB,UAAU,CAAC,GAAG,EAAE;IACd,MAAM,GAAG,YAAE,CAAC,WAAW,CAAC,cAAI,CAAC,IAAI,CAAC,YAAE,CAAC,MAAM,EAAE,EAAE,kBAAkB,CAAC,CAAC,CAAC;IACpE,YAAE,CAAC,SAAS,CAAC,cAAI,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;AAChE,CAAC,CAAC,CAAC;AAEH,SAAS,CAAC,GAAG,EAAE;IACb,YAAE,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AACtD,CAAC,CAAC,CAAC;AAEH;;;GAGG;AACH,SAAS,mBAAmB,CAAC,OAAe,EAAE,OAAe,EAAE,OAAiB,EAAE,YAAsB,EAAE,KAAgD,EAAE,SAAkB;IAC5K,0EAA0E;IAC1E,6CAA6C;IAC7C,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC,CAAC;IACnF,MAAM,
|
|
1
|
+
{"version":3,"file":"episode-file.test.js","sourceRoot":"","sources":["../../tests/episode-file.test.ts"],"names":[],"mappings":";;;;;AAAA,4CAAoB;AACpB,gDAAwB;AACxB,4CAAoB;AACpB,iDAAyC;AAEzC,IAAI,MAAc,CAAC;AAEnB,UAAU,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E,aAAa,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAChF,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -25,11 +25,11 @@ afterEach(() => {
|
|
|
25
25
|
describe('session-focus episode injection', () => {
|
|
26
26
|
test('queryRecentEpisodes returns episodes ordered by created_at DESC', () => {
|
|
27
27
|
// Insert with explicit timestamps to guarantee order
|
|
28
|
-
db.prepare(`INSERT INTO episodes (id, kind, scope, project, summary, status, source, created_at)
|
|
28
|
+
db.prepare(`INSERT INTO episodes (id, kind, scope, project, summary, status, source, created_at)
|
|
29
29
|
VALUES ('ep-1', 'session', 'project', 'mindlore', 'First session', 'active', 'hook', '2026-04-13T10:00:00.000Z')`).run();
|
|
30
|
-
db.prepare(`INSERT INTO episodes (id, kind, scope, project, summary, status, source, created_at)
|
|
30
|
+
db.prepare(`INSERT INTO episodes (id, kind, scope, project, summary, status, source, created_at)
|
|
31
31
|
VALUES ('ep-2', 'decision', 'project', 'mindlore', 'Chose SQLite', 'active', 'diary', '2026-04-13T11:00:00.000Z')`).run();
|
|
32
|
-
db.prepare(`INSERT INTO episodes (id, kind, scope, project, summary, status, source, created_at)
|
|
32
|
+
db.prepare(`INSERT INTO episodes (id, kind, scope, project, summary, status, source, created_at)
|
|
33
33
|
VALUES ('ep-3', 'learning', 'project', 'mindlore', 'Use ctx_execute_file', 'active', 'reflect', '2026-04-13T12:00:00.000Z')`).run();
|
|
34
34
|
const episodes = queryRecentEpisodes(db, { project: 'mindlore', limit: 3 });
|
|
35
35
|
expect(episodes).toHaveLength(3);
|
|
@@ -147,9 +147,9 @@ describe('episode stale filter', () => {
|
|
|
147
147
|
test('excludes episodes older than 7 days', () => {
|
|
148
148
|
const oldDate = new Date(Date.now() - 8 * 24 * 60 * 60 * 1000).toISOString();
|
|
149
149
|
const recentDate = new Date(Date.now() - 1 * 24 * 60 * 60 * 1000).toISOString();
|
|
150
|
-
migEnv.db.prepare(`INSERT INTO episodes (id, kind, scope, project, summary, status, source, created_at)
|
|
150
|
+
migEnv.db.prepare(`INSERT INTO episodes (id, kind, scope, project, summary, status, source, created_at)
|
|
151
151
|
VALUES ('ep-old', 'decision', 'project', 'mindlore', 'Old decision', 'active', 'diary', ?)`).run(oldDate);
|
|
152
|
-
migEnv.db.prepare(`INSERT INTO episodes (id, kind, scope, project, summary, status, source, created_at)
|
|
152
|
+
migEnv.db.prepare(`INSERT INTO episodes (id, kind, scope, project, summary, status, source, created_at)
|
|
153
153
|
VALUES ('ep-new', 'decision', 'project', 'mindlore', 'Recent decision', 'active', 'diary', ?)`).run(recentDate);
|
|
154
154
|
const payload = (0, session_payload_js_1.buildSessionPayload)({ db: migEnv.db, baseDir: migEnv.tmpDir, project: 'mindlore' });
|
|
155
155
|
const decisionsSection = payload.sections.find(s => s.label === 'Decisions');
|
|
@@ -159,7 +159,7 @@ describe('episode stale filter', () => {
|
|
|
159
159
|
});
|
|
160
160
|
test('includes episodes within 7 days', () => {
|
|
161
161
|
const recentDate = new Date(Date.now() - 3 * 24 * 60 * 60 * 1000).toISOString();
|
|
162
|
-
migEnv.db.prepare(`INSERT INTO episodes (id, kind, scope, project, summary, status, source, created_at)
|
|
162
|
+
migEnv.db.prepare(`INSERT INTO episodes (id, kind, scope, project, summary, status, source, created_at)
|
|
163
163
|
VALUES ('ep-r', 'learning', 'project', 'mindlore', 'Recent learning', 'active', 'reflect', ?)`).run(recentDate);
|
|
164
164
|
const payload = (0, session_payload_js_1.buildSessionPayload)({ db: migEnv.db, baseDir: migEnv.tmpDir, project: 'mindlore' });
|
|
165
165
|
const learningsSection = payload.sections.find(s => s.label === 'Learnings');
|
|
@@ -177,7 +177,7 @@ describe('episode inject dedup', () => {
|
|
|
177
177
|
});
|
|
178
178
|
test('excludes episodes already injected in this session', () => {
|
|
179
179
|
const recentDate = new Date(Date.now() - 1 * 24 * 60 * 60 * 1000).toISOString();
|
|
180
|
-
migEnv.db.prepare(`INSERT INTO episodes (id, kind, scope, project, summary, status, source, created_at)
|
|
180
|
+
migEnv.db.prepare(`INSERT INTO episodes (id, kind, scope, project, summary, status, source, created_at)
|
|
181
181
|
VALUES ('ep-d1', 'decision', 'project', 'mindlore', 'Already injected decision', 'active', 'diary', ?)`).run(recentDate);
|
|
182
182
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- better-sqlite3 .get() returns unknown
|
|
183
183
|
const rowid = migEnv.db.prepare(`SELECT rowid FROM episodes WHERE id = 'ep-d1'`).get().rowid;
|
|
@@ -189,7 +189,7 @@ describe('episode inject dedup', () => {
|
|
|
189
189
|
});
|
|
190
190
|
test('logs newly injected episodes to episode_inject_log', () => {
|
|
191
191
|
const recentDate = new Date(Date.now() - 1 * 24 * 60 * 60 * 1000).toISOString();
|
|
192
|
-
migEnv.db.prepare(`INSERT INTO episodes (id, kind, scope, project, summary, status, source, created_at)
|
|
192
|
+
migEnv.db.prepare(`INSERT INTO episodes (id, kind, scope, project, summary, status, source, created_at)
|
|
193
193
|
VALUES ('ep-d2', 'learning', 'project', 'mindlore', 'New learning to log', 'active', 'reflect', ?)`).run(recentDate);
|
|
194
194
|
(0, session_payload_js_1.buildSessionPayload)({ db: migEnv.db, baseDir: migEnv.tmpDir, project: 'mindlore', tokenBudget: 2000, sessionId: 'session-xyz' });
|
|
195
195
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- better-sqlite3 .all() returns unknown[]
|
|
@@ -198,7 +198,7 @@ describe('episode inject dedup', () => {
|
|
|
198
198
|
});
|
|
199
199
|
test('does not log when sessionId is not provided', () => {
|
|
200
200
|
const recentDate = new Date(Date.now() - 1 * 24 * 60 * 60 * 1000).toISOString();
|
|
201
|
-
migEnv.db.prepare(`INSERT INTO episodes (id, kind, scope, project, summary, status, source, created_at)
|
|
201
|
+
migEnv.db.prepare(`INSERT INTO episodes (id, kind, scope, project, summary, status, source, created_at)
|
|
202
202
|
VALUES ('ep-d3', 'friction', 'project', 'mindlore', 'Friction point', 'active', 'diary', ?)`).run(recentDate);
|
|
203
203
|
(0, session_payload_js_1.buildSessionPayload)({ db: migEnv.db, baseDir: migEnv.tmpDir, project: 'mindlore' });
|
|
204
204
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- better-sqlite3 .all() returns unknown[]
|
|
@@ -8,8 +8,7 @@ const fs_1 = __importDefault(require("fs"));
|
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const os_1 = __importDefault(require("os"));
|
|
10
10
|
describe('fetch-raw script', () => {
|
|
11
|
-
const tmpDir = path_1.default.join(os_1.default.tmpdir(), 'mindlore-fetch-test-'
|
|
12
|
-
beforeAll(() => { fs_1.default.mkdirSync(tmpDir, { recursive: true }); });
|
|
11
|
+
const tmpDir = fs_1.default.mkdtempSync(path_1.default.join(os_1.default.tmpdir(), 'mindlore-fetch-test-'));
|
|
13
12
|
afterAll(() => { fs_1.default.rmSync(tmpDir, { recursive: true, force: true }); });
|
|
14
13
|
it('fetches a URL and saves to output dir', () => {
|
|
15
14
|
const result = (0, child_process_1.execSync)(`node dist/scripts/fetch-raw.js https://raw.githubusercontent.com/anthropics/claude-code/main/README.md --out-dir "${tmpDir}"`, { encoding: 'utf8', timeout: 30000, env: { ...process.env, MINDLORE_HOME: tmpDir } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-raw.test.js","sourceRoot":"","sources":["../../tests/fetch-raw.test.ts"],"names":[],"mappings":";;;;;AAAA,iDAAyC;AACzC,4CAAoB;AACpB,gDAAwB;AACxB,4CAAoB;AAEpB,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,MAAM,MAAM,GAAG,
|
|
1
|
+
{"version":3,"file":"fetch-raw.test.js","sourceRoot":"","sources":["../../tests/fetch-raw.test.ts"],"names":[],"mappings":";;;;;AAAA,iDAAyC;AACzC,4CAAoB;AACpB,gDAAwB;AACxB,4CAAoB;AAEpB,QAAQ,CAAC,kBAAkB,EAAE,GAAG,E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CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,uCAAuC,EAAE,GAAG,EAAE;QAC/C,MAAM,CAAC,GAAG,EAAE;YACV,IAAA,wBAAQ,EACN,6CAA6C,MAAM,GAAG,EACtD,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,aAAa,EAAE,MAAM,EAAE,EAAE,CACpF,CAAC;QACJ,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;IACf,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/tests/fts5.test.js
CHANGED
|
@@ -34,9 +34,9 @@ describe('FTS5 Database', () => {
|
|
|
34
34
|
const testPath = path_1.default.join(TEST_DIR, 'sources', 'typescript-guide.md');
|
|
35
35
|
const content = '# TypeScript Guide\n\nTypeScript provides static typing for JavaScript applications.';
|
|
36
36
|
(0, db_js_1.insertFts)(db, { path: testPath, slug: 'typescript-guide', description: 'TypeScript static typing for JavaScript', type: 'source', category: 'sources', title: 'TypeScript Guide', content, tags: '', quality: null, dateCaptured: null });
|
|
37
|
-
const results = (0, db_helpers_js_1.dbAll)(db, `SELECT path, rank FROM mindlore_fts
|
|
38
|
-
WHERE mindlore_fts MATCH ?
|
|
39
|
-
ORDER BY rank
|
|
37
|
+
const results = (0, db_helpers_js_1.dbAll)(db, `SELECT path, rank FROM mindlore_fts
|
|
38
|
+
WHERE mindlore_fts MATCH ?
|
|
39
|
+
ORDER BY rank
|
|
40
40
|
LIMIT 3`, 'TypeScript');
|
|
41
41
|
expect(results).toHaveLength(1);
|
|
42
42
|
expect(results[0].path).toBe(testPath);
|
|
@@ -46,9 +46,9 @@ describe('FTS5 Database', () => {
|
|
|
46
46
|
const db = new better_sqlite3_1.default(DB_PATH);
|
|
47
47
|
const testPath = path_1.default.join(TEST_DIR, 'sources', 'python-guide.md');
|
|
48
48
|
(0, db_js_1.insertFts)(db, { path: testPath, slug: 'python-guide', description: 'Python for data science', type: 'source', category: 'sources', title: 'Python Guide', content: '# Python Guide\n\nPython is great for data science.', tags: '', quality: null, dateCaptured: null });
|
|
49
|
-
const results = (0, db_helpers_js_1.dbAll)(db, `SELECT path FROM mindlore_fts
|
|
50
|
-
WHERE mindlore_fts MATCH ?
|
|
51
|
-
ORDER BY rank
|
|
49
|
+
const results = (0, db_helpers_js_1.dbAll)(db, `SELECT path FROM mindlore_fts
|
|
50
|
+
WHERE mindlore_fts MATCH ?
|
|
51
|
+
ORDER BY rank
|
|
52
52
|
LIMIT 3`, 'Kubernetes');
|
|
53
53
|
expect(results).toHaveLength(0);
|
|
54
54
|
db.close();
|
|
@@ -57,9 +57,9 @@ describe('FTS5 Database', () => {
|
|
|
57
57
|
const db = new better_sqlite3_1.default(DB_PATH);
|
|
58
58
|
(0, db_js_1.insertFts)(db, { path: path_1.default.join(TEST_DIR, 'sources', 'hooks-overview.md'), slug: 'hooks-overview', description: 'Hooks lifecycle callbacks overview', type: 'source', category: 'sources', title: 'Hooks Overview', content: '# Hooks Overview\n\nHooks are lifecycle callbacks.', tags: '', quality: null, dateCaptured: null });
|
|
59
59
|
(0, db_js_1.insertFts)(db, { path: path_1.default.join(TEST_DIR, 'sources', 'hooks-deep-dive.md'), slug: 'hooks-deep-dive', description: 'Deep dive into hooks patterns', type: 'source', category: 'sources', title: 'Hooks Deep Dive', content: '# Hooks Deep Dive\n\nHooks hooks hooks. PreToolUse hooks, PostToolUse hooks, SessionStart hooks.', tags: '', quality: null, dateCaptured: null });
|
|
60
|
-
const results = (0, db_helpers_js_1.dbAll)(db, `SELECT path, rank FROM mindlore_fts
|
|
61
|
-
WHERE mindlore_fts MATCH ?
|
|
62
|
-
ORDER BY rank
|
|
60
|
+
const results = (0, db_helpers_js_1.dbAll)(db, `SELECT path, rank FROM mindlore_fts
|
|
61
|
+
WHERE mindlore_fts MATCH ?
|
|
62
|
+
ORDER BY rank
|
|
63
63
|
LIMIT 3`, 'hooks');
|
|
64
64
|
expect(results).toHaveLength(2);
|
|
65
65
|
const deepDive = results.find((r) => r.path.includes('deep-dive'));
|
|
@@ -71,9 +71,9 @@ describe('FTS5 Database', () => {
|
|
|
71
71
|
test('should index and search by tags column', () => {
|
|
72
72
|
const db = new better_sqlite3_1.default(DB_PATH);
|
|
73
73
|
(0, db_js_1.insertFts)(db, { path: path_1.default.join(TEST_DIR, 'sources', 'tagged-doc.md'), slug: 'tagged-doc', description: 'A doc with tags', type: 'source', category: 'sources', title: 'Tagged Doc', content: '# Tagged\n\nContent here.', tags: 'security, hooks, fts5', quality: null, dateCaptured: null });
|
|
74
|
-
const results = (0, db_helpers_js_1.dbAll)(db, `SELECT path, tags FROM mindlore_fts
|
|
75
|
-
WHERE tags MATCH ?
|
|
76
|
-
ORDER BY rank
|
|
74
|
+
const results = (0, db_helpers_js_1.dbAll)(db, `SELECT path, tags FROM mindlore_fts
|
|
75
|
+
WHERE tags MATCH ?
|
|
76
|
+
ORDER BY rank
|
|
77
77
|
LIMIT 3`, 'security');
|
|
78
78
|
expect(results).toHaveLength(1);
|
|
79
79
|
expect(results[0].tags).toBe('security, hooks, fts5');
|
|
@@ -136,20 +136,20 @@ describe('openDatabase CJS', () => {
|
|
|
136
136
|
});
|
|
137
137
|
describe('Timestamp columns', () => {
|
|
138
138
|
test('should write created_at on first index, updated_at on re-index', () => {
|
|
139
|
-
const {
|
|
139
|
+
const { createTestDbWithFullSchema } = require('./helpers/db.js');
|
|
140
140
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- test helper returns Database
|
|
141
|
-
const db =
|
|
141
|
+
const db = createTestDbWithFullSchema(DB_PATH);
|
|
142
142
|
const testPath = path_1.default.join(TEST_DIR, 'sources', 'test-timestamps.md');
|
|
143
143
|
const hash1 = 'aaa111';
|
|
144
144
|
const now1 = '2026-04-19T10:00:00.000Z';
|
|
145
145
|
// Simulate first index: INSERT with created_at, no updated_at
|
|
146
|
-
const upsertHash = db.prepare(`
|
|
147
|
-
INSERT INTO file_hashes (path, content_hash, last_indexed, created_at)
|
|
148
|
-
VALUES (?, ?, ?, datetime('now'))
|
|
149
|
-
ON CONFLICT(path) DO UPDATE SET
|
|
150
|
-
content_hash = excluded.content_hash,
|
|
151
|
-
last_indexed = excluded.last_indexed,
|
|
152
|
-
updated_at = datetime('now')
|
|
146
|
+
const upsertHash = db.prepare(`
|
|
147
|
+
INSERT INTO file_hashes (path, content_hash, last_indexed, created_at)
|
|
148
|
+
VALUES (?, ?, ?, datetime('now'))
|
|
149
|
+
ON CONFLICT(path) DO UPDATE SET
|
|
150
|
+
content_hash = excluded.content_hash,
|
|
151
|
+
last_indexed = excluded.last_indexed,
|
|
152
|
+
updated_at = datetime('now')
|
|
153
153
|
`);
|
|
154
154
|
upsertHash.run(testPath, hash1, now1);
|
|
155
155
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- better-sqlite3 .get() returns unknown
|
|
@@ -169,21 +169,21 @@ describe('Timestamp columns', () => {
|
|
|
169
169
|
});
|
|
170
170
|
describe('Project scope on index', () => {
|
|
171
171
|
test('should write project_scope on index', () => {
|
|
172
|
-
const {
|
|
172
|
+
const { createTestDbWithFullSchema } = require('./helpers/db.js');
|
|
173
173
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- test helper returns Database
|
|
174
|
-
const db =
|
|
174
|
+
const db = createTestDbWithFullSchema(DB_PATH);
|
|
175
175
|
const testPath = path_1.default.join(TEST_DIR, 'sources', 'test-scope.md');
|
|
176
176
|
const hash = 'abc123';
|
|
177
177
|
const now = '2026-04-19T12:00:00.000Z';
|
|
178
178
|
const projectName = 'test-project';
|
|
179
|
-
const upsertHash = db.prepare(`
|
|
180
|
-
INSERT INTO file_hashes (path, content_hash, last_indexed, created_at, project_scope)
|
|
181
|
-
VALUES (?, ?, ?, datetime('now'), ?)
|
|
182
|
-
ON CONFLICT(path) DO UPDATE SET
|
|
183
|
-
content_hash = excluded.content_hash,
|
|
184
|
-
last_indexed = excluded.last_indexed,
|
|
185
|
-
updated_at = datetime('now'),
|
|
186
|
-
project_scope = excluded.project_scope
|
|
179
|
+
const upsertHash = db.prepare(`
|
|
180
|
+
INSERT INTO file_hashes (path, content_hash, last_indexed, created_at, project_scope)
|
|
181
|
+
VALUES (?, ?, ?, datetime('now'), ?)
|
|
182
|
+
ON CONFLICT(path) DO UPDATE SET
|
|
183
|
+
content_hash = excluded.content_hash,
|
|
184
|
+
last_indexed = excluded.last_indexed,
|
|
185
|
+
updated_at = datetime('now'),
|
|
186
|
+
project_scope = excluded.project_scope
|
|
187
187
|
`);
|
|
188
188
|
upsertHash.run(testPath, hash, now, projectName);
|
|
189
189
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- better-sqlite3 .get() returns unknown
|
|
@@ -196,19 +196,19 @@ describe('Project scope on index', () => {
|
|
|
196
196
|
});
|
|
197
197
|
describe('Quality to importance mapping', () => {
|
|
198
198
|
test('should map quality high to importance 1.0', () => {
|
|
199
|
-
const {
|
|
199
|
+
const { createTestDbWithFullSchema } = require('./helpers/db.js');
|
|
200
200
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- test helper returns Database
|
|
201
|
-
const db =
|
|
201
|
+
const db = createTestDbWithFullSchema(DB_PATH);
|
|
202
202
|
const testPath = path_1.default.join(TEST_DIR, 'sources', 'test-importance-high.md');
|
|
203
|
-
const upsertHash = db.prepare(`
|
|
204
|
-
INSERT INTO file_hashes (path, content_hash, last_indexed, created_at, project_scope, importance)
|
|
205
|
-
VALUES (?, ?, ?, datetime('now'), ?, ?)
|
|
206
|
-
ON CONFLICT(path) DO UPDATE SET
|
|
207
|
-
content_hash = excluded.content_hash,
|
|
208
|
-
last_indexed = excluded.last_indexed,
|
|
209
|
-
updated_at = datetime('now'),
|
|
210
|
-
project_scope = excluded.project_scope,
|
|
211
|
-
importance = excluded.importance
|
|
203
|
+
const upsertHash = db.prepare(`
|
|
204
|
+
INSERT INTO file_hashes (path, content_hash, last_indexed, created_at, project_scope, importance)
|
|
205
|
+
VALUES (?, ?, ?, datetime('now'), ?, ?)
|
|
206
|
+
ON CONFLICT(path) DO UPDATE SET
|
|
207
|
+
content_hash = excluded.content_hash,
|
|
208
|
+
last_indexed = excluded.last_indexed,
|
|
209
|
+
updated_at = datetime('now'),
|
|
210
|
+
project_scope = excluded.project_scope,
|
|
211
|
+
importance = excluded.importance
|
|
212
212
|
`);
|
|
213
213
|
// Simulate indexer: quality 'high' -> importance 1.0
|
|
214
214
|
upsertHash.run(testPath, 'aaa', '2026-04-19T10:00:00.000Z', 'test', 1.0);
|
|
@@ -218,19 +218,19 @@ describe('Quality to importance mapping', () => {
|
|
|
218
218
|
db.close();
|
|
219
219
|
});
|
|
220
220
|
test('should map quality medium to importance 0.6', () => {
|
|
221
|
-
const {
|
|
221
|
+
const { createTestDbWithFullSchema } = require('./helpers/db.js');
|
|
222
222
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- test helper returns Database
|
|
223
|
-
const db =
|
|
223
|
+
const db = createTestDbWithFullSchema(DB_PATH);
|
|
224
224
|
const testPath = path_1.default.join(TEST_DIR, 'sources', 'test-importance-medium.md');
|
|
225
|
-
const upsertHash = db.prepare(`
|
|
226
|
-
INSERT INTO file_hashes (path, content_hash, last_indexed, created_at, project_scope, importance)
|
|
227
|
-
VALUES (?, ?, ?, datetime('now'), ?, ?)
|
|
228
|
-
ON CONFLICT(path) DO UPDATE SET
|
|
229
|
-
content_hash = excluded.content_hash,
|
|
230
|
-
last_indexed = excluded.last_indexed,
|
|
231
|
-
updated_at = datetime('now'),
|
|
232
|
-
project_scope = excluded.project_scope,
|
|
233
|
-
importance = excluded.importance
|
|
225
|
+
const upsertHash = db.prepare(`
|
|
226
|
+
INSERT INTO file_hashes (path, content_hash, last_indexed, created_at, project_scope, importance)
|
|
227
|
+
VALUES (?, ?, ?, datetime('now'), ?, ?)
|
|
228
|
+
ON CONFLICT(path) DO UPDATE SET
|
|
229
|
+
content_hash = excluded.content_hash,
|
|
230
|
+
last_indexed = excluded.last_indexed,
|
|
231
|
+
updated_at = datetime('now'),
|
|
232
|
+
project_scope = excluded.project_scope,
|
|
233
|
+
importance = excluded.importance
|
|
234
234
|
`);
|
|
235
235
|
upsertHash.run(testPath, 'bbb', '2026-04-19T10:00:00.000Z', 'test', 0.6);
|
|
236
236
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- better-sqlite3 .get() returns unknown
|
|
@@ -239,19 +239,19 @@ describe('Quality to importance mapping', () => {
|
|
|
239
239
|
db.close();
|
|
240
240
|
});
|
|
241
241
|
test('should map quality low to importance 0.3', () => {
|
|
242
|
-
const {
|
|
242
|
+
const { createTestDbWithFullSchema } = require('./helpers/db.js');
|
|
243
243
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- test helper returns Database
|
|
244
|
-
const db =
|
|
244
|
+
const db = createTestDbWithFullSchema(DB_PATH);
|
|
245
245
|
const testPath = path_1.default.join(TEST_DIR, 'sources', 'test-importance-low.md');
|
|
246
|
-
const upsertHash = db.prepare(`
|
|
247
|
-
INSERT INTO file_hashes (path, content_hash, last_indexed, created_at, project_scope, importance)
|
|
248
|
-
VALUES (?, ?, ?, datetime('now'), ?, ?)
|
|
249
|
-
ON CONFLICT(path) DO UPDATE SET
|
|
250
|
-
content_hash = excluded.content_hash,
|
|
251
|
-
last_indexed = excluded.last_indexed,
|
|
252
|
-
updated_at = datetime('now'),
|
|
253
|
-
project_scope = excluded.project_scope,
|
|
254
|
-
importance = excluded.importance
|
|
246
|
+
const upsertHash = db.prepare(`
|
|
247
|
+
INSERT INTO file_hashes (path, content_hash, last_indexed, created_at, project_scope, importance)
|
|
248
|
+
VALUES (?, ?, ?, datetime('now'), ?, ?)
|
|
249
|
+
ON CONFLICT(path) DO UPDATE SET
|
|
250
|
+
content_hash = excluded.content_hash,
|
|
251
|
+
last_indexed = excluded.last_indexed,
|
|
252
|
+
updated_at = datetime('now'),
|
|
253
|
+
project_scope = excluded.project_scope,
|
|
254
|
+
importance = excluded.importance
|
|
255
255
|
`);
|
|
256
256
|
upsertHash.run(testPath, 'ccc', '2026-04-19T10:00:00.000Z', 'test', 0.3);
|
|
257
257
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- better-sqlite3 .get() returns unknown
|
|
@@ -260,19 +260,19 @@ describe('Quality to importance mapping', () => {
|
|
|
260
260
|
db.close();
|
|
261
261
|
});
|
|
262
262
|
test('should default importance to 0.5 when quality is missing', () => {
|
|
263
|
-
const {
|
|
263
|
+
const { createTestDbWithFullSchema } = require('./helpers/db.js');
|
|
264
264
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- test helper returns Database
|
|
265
|
-
const db =
|
|
265
|
+
const db = createTestDbWithFullSchema(DB_PATH);
|
|
266
266
|
const testPath = path_1.default.join(TEST_DIR, 'sources', 'test-no-quality.md');
|
|
267
|
-
const upsertHash = db.prepare(`
|
|
268
|
-
INSERT INTO file_hashes (path, content_hash, last_indexed, created_at, project_scope, importance)
|
|
269
|
-
VALUES (?, ?, ?, datetime('now'), ?, ?)
|
|
270
|
-
ON CONFLICT(path) DO UPDATE SET
|
|
271
|
-
content_hash = excluded.content_hash,
|
|
272
|
-
last_indexed = excluded.last_indexed,
|
|
273
|
-
updated_at = datetime('now'),
|
|
274
|
-
project_scope = excluded.project_scope,
|
|
275
|
-
importance = excluded.importance
|
|
267
|
+
const upsertHash = db.prepare(`
|
|
268
|
+
INSERT INTO file_hashes (path, content_hash, last_indexed, created_at, project_scope, importance)
|
|
269
|
+
VALUES (?, ?, ?, datetime('now'), ?, ?)
|
|
270
|
+
ON CONFLICT(path) DO UPDATE SET
|
|
271
|
+
content_hash = excluded.content_hash,
|
|
272
|
+
last_indexed = excluded.last_indexed,
|
|
273
|
+
updated_at = datetime('now'),
|
|
274
|
+
project_scope = excluded.project_scope,
|
|
275
|
+
importance = excluded.importance
|
|
276
276
|
`);
|
|
277
277
|
// quality undefined -> default 0.5
|
|
278
278
|
upsertHash.run(testPath, 'ddd', '2026-04-19T10:00:00.000Z', 'test', 0.5);
|
package/dist/tests/fuzzy.test.js
CHANGED
|
@@ -33,7 +33,7 @@ describe('DB integration', () => {
|
|
|
33
33
|
let tmpDir;
|
|
34
34
|
beforeEach(() => {
|
|
35
35
|
tmpDir = fs_1.default.mkdtempSync(path_1.default.join(os_1.default.tmpdir(), 'mindlore-fuzzy-'));
|
|
36
|
-
db = (0, db_js_1.
|
|
36
|
+
db = (0, db_js_1.createTestDbWithFullSchema)(path_1.default.join(tmpDir, 'test.db'));
|
|
37
37
|
});
|
|
38
38
|
afterEach(() => {
|
|
39
39
|
db.close();
|
|
@@ -8,7 +8,7 @@ const path_1 = __importDefault(require("path"));
|
|
|
8
8
|
const os_1 = __importDefault(require("os"));
|
|
9
9
|
const child_process_1 = require("child_process");
|
|
10
10
|
describe('Git Snapshot (Pre-Eviction)', () => {
|
|
11
|
-
const tmpDir = path_1.default.join(os_1.default.tmpdir(),
|
|
11
|
+
const tmpDir = fs_1.default.mkdtempSync(path_1.default.join(os_1.default.tmpdir(), 'mindlore-snapshot-'));
|
|
12
12
|
const mindloreDir = path_1.default.join(tmpDir, '.mindlore');
|
|
13
13
|
beforeEach(() => {
|
|
14
14
|
fs_1.default.mkdirSync(mindloreDir, { recursive: true });
|
|
@@ -54,8 +54,7 @@ describe('Git Snapshot (Pre-Eviction)', () => {
|
|
|
54
54
|
});
|
|
55
55
|
test('createPreEvictionTag returns null for non-git directory', async () => {
|
|
56
56
|
const { createPreEvictionTag } = await import('../scripts/lib/git-snapshot.js');
|
|
57
|
-
const nonGit = path_1.default.join(os_1.default.tmpdir(),
|
|
58
|
-
fs_1.default.mkdirSync(nonGit, { recursive: true });
|
|
57
|
+
const nonGit = fs_1.default.mkdtempSync(path_1.default.join(os_1.default.tmpdir(), 'mindlore-no-git-'));
|
|
59
58
|
try {
|
|
60
59
|
const tag = createPreEvictionTag(nonGit, 'test.md');
|
|
61
60
|
expect(tag).toBeNull();
|
|
@@ -66,8 +65,7 @@ describe('Git Snapshot (Pre-Eviction)', () => {
|
|
|
66
65
|
});
|
|
67
66
|
test('listPreEvictionTags returns empty for non-git directory', async () => {
|
|
68
67
|
const { listPreEvictionTags } = await import('../scripts/lib/git-snapshot.js');
|
|
69
|
-
const nonGit = path_1.default.join(os_1.default.tmpdir(),
|
|
70
|
-
fs_1.default.mkdirSync(nonGit, { recursive: true });
|
|
68
|
+
const nonGit = fs_1.default.mkdtempSync(path_1.default.join(os_1.default.tmpdir(), 'mindlore-no-git-'));
|
|
71
69
|
try {
|
|
72
70
|
const tags = listPreEvictionTags(nonGit);
|
|
73
71
|
expect(tags).toEqual([]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git-snapshot.test.js","sourceRoot":"","sources":["../../tests/git-snapshot.test.ts"],"names":[],"mappings":";;;;;AAAA,4CAAoB;AACpB,gDAAwB;AACxB,4CAAoB;AACpB,iDAAyC;AAEzC,QAAQ,CAAC,6BAA6B,EAAE,GAAG,EAAE;IAC3C,MAAM,MAAM,GAAG,cAAI,CAAC,IAAI,CAAC,YAAE,CAAC,MAAM,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"git-snapshot.test.js","sourceRoot":"","sources":["../../tests/git-snapshot.test.ts"],"names":[],"mappings":";;;;;AAAA,4CAAoB;AACpB,gDAAwB;AACxB,4CAAoB;AACpB,iDAAyC;AAEzC,QAAQ,CAAC,6BAA6B,EAAE,GAAG,EAAE;IAC3C,MAAM,MAAM,GAAG,YAAE,CAAC,WAAW,CAAC,cAAI,CAAC,IAAI,CAAC,YAAE,CAAC,MAAM,EAAE,EAAE,oBAAoB,CAAC,CAAC,CAAC;IAC5E,MAAM,WAAW,GAAG,cAAI,CAAC,IAAI,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAEnD,UAAU,CAAC,GAAG,EAAE;QACd,YAAE,CAAC,SAAS,CAAC,WAAW,EAAE,EAAE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AI,CAAC;YACH,MAAM,IAAI,GAAG,mBAAmB,CAAC,MAAM,CAAC,CAAC;YACzC,MAAM,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QAC3B,CAAC;gBAAS,CAAC;YACT,YAAE,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACtD,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import Database from 'better-sqlite3';
|
|
2
2
|
export declare function sha256(content: string): string;
|
|
3
3
|
export declare function createTestDb(dbPath: string): Database.Database;
|
|
4
|
-
export declare function createTestDbWithFullSchema(dbPath: string): Database.Database;
|
|
5
4
|
export declare function createTestDbAtVersion(dbPath: string, maxVersion: number): Database.Database;
|
|
6
|
-
export declare function
|
|
5
|
+
export declare function createTestDbWithFullSchema(dbPath: string): Database.Database;
|
|
7
6
|
export interface FtsEntry {
|
|
8
7
|
[key: string]: string | null | undefined;
|
|
9
8
|
path: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../../../tests/helpers/db.ts"],"names":[],"mappings":"AAIA,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAuBtC,wBAAgB,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE9C;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,CAAC,QAAQ,CAoB9D;AASD,wBAAgB,
|
|
1
|
+
{"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../../../tests/helpers/db.ts"],"names":[],"mappings":"AAIA,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAuBtC,wBAAgB,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE9C;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GA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