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
|
@@ -1,97 +1,98 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* mindlore-fts5-sync — FileChanged hook (incremental re-index)
|
|
6
|
-
*
|
|
7
|
-
* Handles bulk file changes by checking all .mindlore/ .md files
|
|
8
|
-
* against their content hashes and re-indexing only changed ones.
|
|
9
|
-
*
|
|
10
|
-
* Lightweight complement to mindlore-index.cjs which handles single files.
|
|
11
|
-
* This hook catches cases where multiple files change at once (e.g., git pull).
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
const fs = require('fs');
|
|
15
|
-
const path = require('path');
|
|
16
|
-
const { DB_NAME, sha256, openDatabase, getAllMdFiles, parseFrontmatter, extractFtsMetadata, insertFtsRow, readHookStdin, getActiveMindloreDir, getProjectName, resolveProject, hookLog, withTelemetry, SQL_FTS_SESSIONS_INSERT, isSessionCategory, isInsideMindloreDir } = require('./lib/mindlore-common.cjs');
|
|
17
|
-
|
|
18
|
-
function main() {
|
|
19
|
-
const filePath = readHookStdin(['path', 'file_path']);
|
|
20
|
-
|
|
21
|
-
if (!filePath) return;
|
|
22
|
-
const resolved = path.resolve(filePath);
|
|
23
|
-
if (!isInsideMindloreDir(resolved)) return;
|
|
24
|
-
|
|
25
|
-
// Skip if this is a single .md file change — mindlore-index.cjs handles those.
|
|
26
|
-
// This hook is for bulk changes (git pull, manual batch edits).
|
|
27
|
-
if (filePath.endsWith('.md')) return;
|
|
28
|
-
|
|
29
|
-
const baseDir = getActiveMindloreDir();
|
|
30
|
-
if (!fs.existsSync(baseDir)) return;
|
|
31
|
-
|
|
32
|
-
const dbPath = path.join(baseDir, DB_NAME);
|
|
33
|
-
if (!fs.existsSync(dbPath)) return;
|
|
34
|
-
|
|
35
|
-
const db = openDatabase(dbPath);
|
|
36
|
-
if (!db) return;
|
|
37
|
-
|
|
38
|
-
const mdFiles = getAllMdFiles(baseDir);
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
const {
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* mindlore-fts5-sync — FileChanged hook (incremental re-index)
|
|
6
|
+
*
|
|
7
|
+
* Handles bulk file changes by checking all .mindlore/ .md files
|
|
8
|
+
* against their content hashes and re-indexing only changed ones.
|
|
9
|
+
*
|
|
10
|
+
* Lightweight complement to mindlore-index.cjs which handles single files.
|
|
11
|
+
* This hook catches cases where multiple files change at once (e.g., git pull).
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
const fs = require('fs');
|
|
15
|
+
const path = require('path');
|
|
16
|
+
const { DB_NAME, sha256, openDatabase, getAllMdFiles, parseFrontmatter, extractFtsMetadata, insertFtsRow, readHookStdin, getActiveMindloreDir, getProjectName, resolveProject, hookLog, withTelemetry, SQL_FTS_SESSIONS_INSERT, isSessionCategory, isInsideMindloreDir } = require('./lib/mindlore-common.cjs');
|
|
17
|
+
|
|
18
|
+
function main() {
|
|
19
|
+
const filePath = readHookStdin(['path', 'file_path']);
|
|
20
|
+
|
|
21
|
+
if (!filePath) return;
|
|
22
|
+
const resolved = path.resolve(filePath);
|
|
23
|
+
if (!isInsideMindloreDir(resolved)) return;
|
|
24
|
+
|
|
25
|
+
// Skip if this is a single .md file change — mindlore-index.cjs handles those.
|
|
26
|
+
// This hook is for bulk changes (git pull, manual batch edits).
|
|
27
|
+
if (filePath.endsWith('.md')) return;
|
|
28
|
+
|
|
29
|
+
const baseDir = getActiveMindloreDir();
|
|
30
|
+
if (!fs.existsSync(baseDir)) return;
|
|
31
|
+
|
|
32
|
+
const dbPath = path.join(baseDir, DB_NAME);
|
|
33
|
+
if (!fs.existsSync(dbPath)) return;
|
|
34
|
+
|
|
35
|
+
const db = openDatabase(dbPath);
|
|
36
|
+
if (!db) return;
|
|
37
|
+
|
|
38
|
+
const mdFiles = getAllMdFiles(baseDir);
|
|
39
|
+
|
|
40
|
+
const allHashes = new Map();
|
|
41
|
+
for (const row of db.prepare('SELECT path, content_hash FROM file_hashes').all()) {
|
|
42
|
+
allHashes.set(row.path, row.content_hash);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const deleteFts = db.prepare('DELETE FROM mindlore_fts WHERE path = ?');
|
|
46
|
+
const deleteFtsSessions = db.prepare('DELETE FROM mindlore_fts_sessions WHERE path = ?');
|
|
47
|
+
const insertFtsSessions = db.prepare(SQL_FTS_SESSIONS_INSERT);
|
|
48
|
+
const upsertHash = db.prepare(`
|
|
49
|
+
INSERT INTO file_hashes (path, content_hash, last_indexed)
|
|
50
|
+
VALUES (?, ?, ?)
|
|
51
|
+
ON CONFLICT(path) DO UPDATE SET
|
|
52
|
+
content_hash = excluded.content_hash,
|
|
53
|
+
last_indexed = excluded.last_indexed
|
|
54
|
+
`);
|
|
55
|
+
|
|
56
|
+
const now = new Date().toISOString();
|
|
57
|
+
|
|
58
|
+
try {
|
|
59
|
+
const project = getProjectName();
|
|
60
|
+
|
|
61
|
+
const changedFiles = [];
|
|
62
|
+
for (const file of mdFiles) {
|
|
63
|
+
const content = fs.readFileSync(file, 'utf8').replace(/\r\n/g, '\n');
|
|
64
|
+
const hash = sha256(content);
|
|
65
|
+
|
|
66
|
+
const existingHash = allHashes.get(file);
|
|
67
|
+
if (existingHash === hash) continue;
|
|
68
|
+
|
|
69
|
+
const { meta, body } = parseFrontmatter(content);
|
|
70
|
+
const { slug, description, type, category, title, tags, quality, dateCaptured, project: ftsProject } = extractFtsMetadata(meta, body, file, baseDir);
|
|
71
|
+
const resolvedProject = resolveProject(ftsProject, file, project);
|
|
72
|
+
changedFiles.push({ file, hash, slug, description, type, category, title, tags, quality, dateCaptured, resolvedProject, body });
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// No file I/O inside — minimize lock hold time
|
|
76
|
+
const transaction = db.transaction(() => {
|
|
77
|
+
for (const item of changedFiles) {
|
|
78
|
+
deleteFts.run(item.file);
|
|
79
|
+
deleteFtsSessions.run(item.file);
|
|
80
|
+
if (isSessionCategory(item.category)) {
|
|
81
|
+
insertFtsSessions.run(item.file, item.slug, item.description, item.type, item.category, item.title, item.body, item.tags, item.quality ?? null, item.dateCaptured ?? null, item.resolvedProject);
|
|
82
|
+
} else {
|
|
83
|
+
insertFtsRow(db, { path: item.file, slug: item.slug, description: item.description, type: item.type, category: item.category, title: item.title, content: item.body, tags: item.tags, quality: item.quality, dateCaptured: item.dateCaptured, project: item.resolvedProject });
|
|
84
|
+
}
|
|
85
|
+
upsertHash.run(item.file, item.hash, now);
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
transaction();
|
|
89
|
+
} finally {
|
|
90
|
+
db.close();
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
withTelemetry('mindlore-fts5-sync', main).catch(err => {
|
|
96
|
+
hookLog('mindlore-fts5-sync', 'error', err?.message ?? String(err));
|
|
97
|
+
process.exit(0);
|
|
98
|
+
});
|