mindlore 0.3.3 → 0.3.4

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.
Files changed (37) hide show
  1. package/README.md +6 -3
  2. package/SCHEMA.md +3 -1
  3. package/dist/scripts/init.js +4 -0
  4. package/dist/scripts/init.js.map +1 -1
  5. package/dist/scripts/lib/obsidian-helpers.d.ts +25 -0
  6. package/dist/scripts/lib/obsidian-helpers.d.ts.map +1 -0
  7. package/dist/scripts/lib/obsidian-helpers.js +88 -0
  8. package/dist/scripts/lib/obsidian-helpers.js.map +1 -0
  9. package/dist/scripts/mindlore-backup.d.ts +12 -0
  10. package/dist/scripts/mindlore-backup.d.ts.map +1 -0
  11. package/dist/scripts/mindlore-backup.js +218 -0
  12. package/dist/scripts/mindlore-backup.js.map +1 -0
  13. package/dist/scripts/mindlore-obsidian.d.ts +11 -0
  14. package/dist/scripts/mindlore-obsidian.d.ts.map +1 -0
  15. package/dist/scripts/mindlore-obsidian.js +182 -0
  16. package/dist/scripts/mindlore-obsidian.js.map +1 -0
  17. package/dist/tests/backup.test.d.ts +2 -0
  18. package/dist/tests/backup.test.d.ts.map +1 -0
  19. package/dist/tests/backup.test.js +105 -0
  20. package/dist/tests/backup.test.js.map +1 -0
  21. package/dist/tests/obsidian.test.d.ts +2 -0
  22. package/dist/tests/obsidian.test.d.ts.map +1 -0
  23. package/dist/tests/obsidian.test.js +138 -0
  24. package/dist/tests/obsidian.test.js.map +1 -0
  25. package/dist/tests/post-read.test.js +2 -1
  26. package/dist/tests/post-read.test.js.map +1 -1
  27. package/dist/tests/read-guard.test.js +4 -3
  28. package/dist/tests/read-guard.test.js.map +1 -1
  29. package/dist/tests/session-focus.test.js +45 -0
  30. package/dist/tests/session-focus.test.js.map +1 -1
  31. package/hooks/mindlore-dont-repeat.cjs +2 -2
  32. package/hooks/mindlore-post-read.cjs +2 -2
  33. package/hooks/mindlore-read-guard.cjs +2 -2
  34. package/hooks/mindlore-session-end.cjs +2 -3
  35. package/hooks/mindlore-session-focus.cjs +22 -7
  36. package/package.json +1 -1
  37. package/templates/config.json +4 -1
@@ -18,7 +18,7 @@
18
18
  const fs = require('fs');
19
19
  const path = require('path');
20
20
  const os = require('os');
21
- const { findMindloreDir } = require('./lib/mindlore-common.cjs');
21
+ const { findMindloreDir, getProjectName } = require('./lib/mindlore-common.cjs');
22
22
 
23
23
  /**
24
24
  * File-persisted pattern cache — survives across process invocations.
@@ -167,7 +167,7 @@ function main() {
167
167
 
168
168
  // Load patterns from all sources (file-persisted mtime cache)
169
169
  const mindloreDir = findMindloreDir();
170
- const cachePath = mindloreDir ? path.join(mindloreDir, 'diary', '_pattern-cache.json') : null;
170
+ const cachePath = mindloreDir ? path.join(mindloreDir, 'diary', `_pattern-cache-${getProjectName()}.json`) : null;
171
171
  const cache = readCache(cachePath);
172
172
  const allPatterns = [];
173
173
  const cwd = process.cwd();
@@ -13,7 +13,7 @@
13
13
 
14
14
  const fs = require('fs');
15
15
  const path = require('path');
16
- const { findMindloreDir } = require('./lib/mindlore-common.cjs');
16
+ const { findMindloreDir, getProjectName } = require('./lib/mindlore-common.cjs');
17
17
 
18
18
  const CODE_EXTS = new Set(['.ts', '.tsx', '.js', '.jsx', '.py', '.rs', '.go', '.java', '.c', '.cpp', '.h', '.css', '.scss', '.sql', '.sh', '.yaml', '.yml', '.json', '.toml', '.xml', '.cjs', '.mjs']);
19
19
  const PROSE_EXTS = new Set(['.md', '.txt', '.rst', '.adoc']);
@@ -67,7 +67,7 @@ function main() {
67
67
 
68
68
  // Update _session-reads.json with token info
69
69
  const diaryDir = path.join(baseDir, 'diary');
70
- const readsPath = path.join(diaryDir, '_session-reads.json');
70
+ const readsPath = path.join(diaryDir, `_session-reads-${getProjectName()}.json`);
71
71
  let reads = {};
72
72
  if (fs.existsSync(readsPath)) {
73
73
  try { reads = JSON.parse(fs.readFileSync(readsPath, 'utf8')); } catch { reads = {}; }
@@ -14,7 +14,7 @@
14
14
 
15
15
  const fs = require('fs');
16
16
  const path = require('path');
17
- const { findMindloreDir, readHookStdin } = require('./lib/mindlore-common.cjs');
17
+ const { findMindloreDir, readHookStdin, getProjectName } = require('./lib/mindlore-common.cjs');
18
18
 
19
19
  function main() {
20
20
  const baseDir = findMindloreDir();
@@ -35,7 +35,7 @@ function main() {
35
35
  fs.mkdirSync(diaryDir, { recursive: true });
36
36
  }
37
37
 
38
- const readsPath = path.join(diaryDir, '_session-reads.json');
38
+ const readsPath = path.join(diaryDir, `_session-reads-${getProjectName()}.json`);
39
39
  let reads = {};
40
40
  if (fs.existsSync(readsPath)) {
41
41
  try {
@@ -12,7 +12,7 @@
12
12
  const fs = require('fs');
13
13
  const path = require('path');
14
14
  const { execSync } = require('child_process');
15
- const { findMindloreDir, globalDir } = require('./lib/mindlore-common.cjs');
15
+ const { findMindloreDir, globalDir, getProjectName } = require('./lib/mindlore-common.cjs');
16
16
 
17
17
  function formatDate(date) {
18
18
  const y = date.getFullYear();
@@ -50,7 +50,7 @@ function getRecentCommits() {
50
50
  }
51
51
 
52
52
  function getSessionReads(baseDir) {
53
- const readsPath = path.join(baseDir, 'diary', '_session-reads.json');
53
+ const readsPath = path.join(baseDir, 'diary', `_session-reads-${getProjectName()}.json`);
54
54
  if (!fs.existsSync(readsPath)) return null;
55
55
  try {
56
56
  const data = JSON.parse(fs.readFileSync(readsPath, 'utf8'));
@@ -85,7 +85,6 @@ function main() {
85
85
  const changedFiles = getRecentGitChanges();
86
86
  const reads = getSessionReads(baseDir);
87
87
 
88
- const { getProjectName } = require('./lib/mindlore-common.cjs');
89
88
  const project = getProjectName();
90
89
 
91
90
  const sections = [
@@ -10,7 +10,7 @@
10
10
 
11
11
  const fs = require('fs');
12
12
  const path = require('path');
13
- const { findMindloreDir, getLatestDelta } = require('./lib/mindlore-common.cjs');
13
+ const { findMindloreDir, readConfig } = require('./lib/mindlore-common.cjs');
14
14
 
15
15
  function main() {
16
16
  const baseDir = findMindloreDir();
@@ -25,13 +25,28 @@ function main() {
25
25
  output.push(`[Mindlore INDEX]\n${content}`);
26
26
  }
27
27
 
28
- // Inject latest delta
28
+ // Inject latest delta + reflect trigger (single readdirSync)
29
29
  const diaryDir = path.join(baseDir, 'diary');
30
- const latestDelta = getLatestDelta(diaryDir);
31
- if (latestDelta) {
32
- const deltaContent = fs.readFileSync(latestDelta, 'utf8').trim();
33
- const deltaName = path.basename(latestDelta);
34
- output.push(`[Mindlore Delta: ${deltaName}]\n${deltaContent}`);
30
+ if (fs.existsSync(diaryDir)) {
31
+ try {
32
+ const diaryFiles = fs.readdirSync(diaryDir).filter(f => f.startsWith('delta-') && f.endsWith('.md'));
33
+
34
+ // Latest delta
35
+ if (diaryFiles.length > 0) {
36
+ const sorted = [...diaryFiles].sort();
37
+ const latestName = sorted[sorted.length - 1];
38
+ const latestPath = path.join(diaryDir, latestName);
39
+ const deltaContent = fs.readFileSync(latestPath, 'utf8').trim();
40
+ output.push(`[Mindlore Delta: ${latestName}]\n${deltaContent}`);
41
+ }
42
+
43
+ // Reflect trigger
44
+ const config = readConfig(baseDir);
45
+ const threshold = config?.reflect?.threshold ?? 5;
46
+ if (diaryFiles.length >= threshold) {
47
+ output.push(`[Mindlore] ${diaryFiles.length} diary entry birikti — \`/mindlore-log reflect\` calistirmayi dusun.`);
48
+ }
49
+ } catch (_err) { /* skip */ }
35
50
  }
36
51
 
37
52
  // Version check: compare .version (installed) vs .pkg-version (package)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mindlore",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "description": "AI-native knowledge system for Claude Code",
5
5
  "type": "commonjs",
6
6
  "bin": {
@@ -1,9 +1,12 @@
1
1
  {
2
- "version": "0.3.1",
2
+ "version": "0.3.4",
3
3
  "models": {
4
4
  "ingest": "haiku",
5
5
  "evolve": "sonnet",
6
6
  "explore": "sonnet",
7
7
  "default": "haiku"
8
+ },
9
+ "reflect": {
10
+ "threshold": 5
8
11
  }
9
12
  }