mindlore 0.3.2 → 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 (81) hide show
  1. package/README.md +50 -24
  2. package/SCHEMA.md +9 -11
  3. package/dist/scripts/init.d.ts +4 -2
  4. package/dist/scripts/init.d.ts.map +1 -1
  5. package/dist/scripts/init.js +67 -59
  6. package/dist/scripts/init.js.map +1 -1
  7. package/dist/scripts/lib/constants.d.ts +10 -5
  8. package/dist/scripts/lib/constants.d.ts.map +1 -1
  9. package/dist/scripts/lib/constants.js +18 -20
  10. package/dist/scripts/lib/constants.js.map +1 -1
  11. package/dist/scripts/lib/obsidian-helpers.d.ts +25 -0
  12. package/dist/scripts/lib/obsidian-helpers.d.ts.map +1 -0
  13. package/dist/scripts/lib/obsidian-helpers.js +88 -0
  14. package/dist/scripts/lib/obsidian-helpers.js.map +1 -0
  15. package/dist/scripts/mindlore-backup.d.ts +12 -0
  16. package/dist/scripts/mindlore-backup.d.ts.map +1 -0
  17. package/dist/scripts/mindlore-backup.js +218 -0
  18. package/dist/scripts/mindlore-backup.js.map +1 -0
  19. package/dist/scripts/mindlore-fts5-index.js +3 -2
  20. package/dist/scripts/mindlore-fts5-index.js.map +1 -1
  21. package/dist/scripts/mindlore-fts5-search.d.ts +3 -2
  22. package/dist/scripts/mindlore-fts5-search.d.ts.map +1 -1
  23. package/dist/scripts/mindlore-fts5-search.js +38 -50
  24. package/dist/scripts/mindlore-fts5-search.js.map +1 -1
  25. package/dist/scripts/mindlore-health-check.js +4 -4
  26. package/dist/scripts/mindlore-health-check.js.map +1 -1
  27. package/dist/scripts/mindlore-obsidian.d.ts +11 -0
  28. package/dist/scripts/mindlore-obsidian.d.ts.map +1 -0
  29. package/dist/scripts/mindlore-obsidian.js +182 -0
  30. package/dist/scripts/mindlore-obsidian.js.map +1 -0
  31. package/dist/scripts/quality-populate.js +1 -3
  32. package/dist/scripts/quality-populate.js.map +1 -1
  33. package/dist/scripts/uninstall.d.ts +4 -3
  34. package/dist/scripts/uninstall.d.ts.map +1 -1
  35. package/dist/scripts/uninstall.js +10 -29
  36. package/dist/scripts/uninstall.js.map +1 -1
  37. package/dist/tests/backup.test.d.ts +2 -0
  38. package/dist/tests/backup.test.d.ts.map +1 -0
  39. package/dist/tests/backup.test.js +105 -0
  40. package/dist/tests/backup.test.js.map +1 -0
  41. package/dist/tests/cwd-changed.test.js +6 -5
  42. package/dist/tests/cwd-changed.test.js.map +1 -1
  43. package/dist/tests/decision.test.js +1 -1
  44. package/dist/tests/decision.test.js.map +1 -1
  45. package/dist/tests/global-layer.test.js +22 -39
  46. package/dist/tests/global-layer.test.js.map +1 -1
  47. package/dist/tests/helpers/db.d.ts +1 -0
  48. package/dist/tests/helpers/db.d.ts.map +1 -1
  49. package/dist/tests/helpers/db.js.map +1 -1
  50. package/dist/tests/init.test.js +22 -0
  51. package/dist/tests/init.test.js.map +1 -1
  52. package/dist/tests/model-router.test.js +2 -1
  53. package/dist/tests/model-router.test.js.map +1 -1
  54. package/dist/tests/obsidian.test.d.ts +2 -0
  55. package/dist/tests/obsidian.test.d.ts.map +1 -0
  56. package/dist/tests/obsidian.test.js +138 -0
  57. package/dist/tests/obsidian.test.js.map +1 -0
  58. package/dist/tests/post-read.test.js +2 -1
  59. package/dist/tests/post-read.test.js.map +1 -1
  60. package/dist/tests/project-namespace.test.d.ts +2 -0
  61. package/dist/tests/project-namespace.test.d.ts.map +1 -0
  62. package/dist/tests/project-namespace.test.js +151 -0
  63. package/dist/tests/project-namespace.test.js.map +1 -0
  64. package/dist/tests/read-guard.test.js +5 -4
  65. package/dist/tests/read-guard.test.js.map +1 -1
  66. package/dist/tests/session-focus.test.js +50 -0
  67. package/dist/tests/session-focus.test.js.map +1 -1
  68. package/hooks/lib/mindlore-common.cjs +38 -29
  69. package/hooks/lib/types.d.ts +2 -0
  70. package/hooks/mindlore-cwd-changed.cjs +1 -1
  71. package/hooks/mindlore-dont-repeat.cjs +2 -2
  72. package/hooks/mindlore-fts5-sync.cjs +4 -3
  73. package/hooks/mindlore-index.cjs +2 -2
  74. package/hooks/mindlore-post-read.cjs +2 -2
  75. package/hooks/mindlore-read-guard.cjs +2 -2
  76. package/hooks/mindlore-search.cjs +0 -2
  77. package/hooks/mindlore-session-end.cjs +5 -2
  78. package/hooks/mindlore-session-focus.cjs +22 -7
  79. package/package.json +1 -1
  80. package/templates/SCHEMA.md +9 -11
  81. package/templates/config.json +4 -1
@@ -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.2",
3
+ "version": "0.3.4",
4
4
  "description": "AI-native knowledge system for Claude Code",
5
5
  "type": "commonjs",
6
6
  "bin": {
@@ -28,17 +28,14 @@ with YAML frontmatter. Search is powered by FTS5 (SQLite full-text search).
28
28
  └── mindlore.db # FTS5 search database (SQLite)
29
29
  ```
30
30
 
31
- ### Global Scope (v0.3)
31
+ ### Global Scope (v0.3.3)
32
32
 
33
- Mindlore supports two scopes:
34
- - **Project scope:** `.mindlore/` in the current working directory (project-specific knowledge)
35
- - **Global scope:** `~/.mindlore/` in the user's home directory (cross-project knowledge)
36
-
37
- Rules:
38
- - `getActiveMindloreDir()` resolves scope: project if exists, otherwise global
39
- - Search is layered: project results first, global results second
40
- - Skills accept `--global` (force global) and `--all` (both scopes) flags
41
- - `npx mindlore init --global` creates `~/.mindlore/` with git repo for auto-sync
33
+ Mindlore uses a single global directory:
34
+ - **Global:** `~/.mindlore/` (or `$MINDLORE_HOME` if set)
35
+ - All projects share one DB; project namespace is stored in the `project` FTS5 column
36
+ - `project` = `path.basename(cwd)` at index/search time
37
+ - `npx mindlore init` always initializes `~/.mindlore/` with git repo for auto-sync
38
+ - Search defaults to current project; use `--all` flag to search all projects
42
39
 
43
40
  ### Directory Rules
44
41
 
@@ -155,7 +152,7 @@ Discover unexpected connections between sources. Cross-reference analysis.
155
152
  - Max results: 3 per query (BM25 ranking)
156
153
  - Hook injects: file path + first 2 headings
157
154
 
158
- ### FTS5 Columns (10-col schema, v0.3)
155
+ ### FTS5 Columns (11-col schema, v0.3.3)
159
156
 
160
157
  | Column | Indexed | Source |
161
158
  |--------|---------|--------|
@@ -169,6 +166,7 @@ Discover unexpected connections between sources. Cross-reference analysis.
169
166
  | `tags` | Yes | Frontmatter tags (comma-separated) |
170
167
  | `quality` | UNINDEXED | Frontmatter quality (high/medium/low) |
171
168
  | `date_captured` | UNINDEXED | Frontmatter date_captured or date |
169
+ | `project` | UNINDEXED | path.basename(cwd) at index time |
172
170
 
173
171
  ### Search Flow (UserPromptSubmit hook)
174
172
 
@@ -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
  }