mindlore 0.3.2 → 0.3.3

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 (54) hide show
  1. package/README.md +46 -23
  2. package/SCHEMA.md +6 -10
  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 +63 -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/mindlore-fts5-index.js +3 -2
  12. package/dist/scripts/mindlore-fts5-index.js.map +1 -1
  13. package/dist/scripts/mindlore-fts5-search.d.ts +3 -2
  14. package/dist/scripts/mindlore-fts5-search.d.ts.map +1 -1
  15. package/dist/scripts/mindlore-fts5-search.js +38 -50
  16. package/dist/scripts/mindlore-fts5-search.js.map +1 -1
  17. package/dist/scripts/mindlore-health-check.js +4 -4
  18. package/dist/scripts/mindlore-health-check.js.map +1 -1
  19. package/dist/scripts/quality-populate.js +1 -3
  20. package/dist/scripts/quality-populate.js.map +1 -1
  21. package/dist/scripts/uninstall.d.ts +4 -3
  22. package/dist/scripts/uninstall.d.ts.map +1 -1
  23. package/dist/scripts/uninstall.js +10 -29
  24. package/dist/scripts/uninstall.js.map +1 -1
  25. package/dist/tests/cwd-changed.test.js +6 -5
  26. package/dist/tests/cwd-changed.test.js.map +1 -1
  27. package/dist/tests/decision.test.js +1 -1
  28. package/dist/tests/decision.test.js.map +1 -1
  29. package/dist/tests/global-layer.test.js +22 -39
  30. package/dist/tests/global-layer.test.js.map +1 -1
  31. package/dist/tests/helpers/db.d.ts +1 -0
  32. package/dist/tests/helpers/db.d.ts.map +1 -1
  33. package/dist/tests/helpers/db.js.map +1 -1
  34. package/dist/tests/init.test.js +22 -0
  35. package/dist/tests/init.test.js.map +1 -1
  36. package/dist/tests/model-router.test.js +2 -1
  37. package/dist/tests/model-router.test.js.map +1 -1
  38. package/dist/tests/project-namespace.test.d.ts +2 -0
  39. package/dist/tests/project-namespace.test.d.ts.map +1 -0
  40. package/dist/tests/project-namespace.test.js +151 -0
  41. package/dist/tests/project-namespace.test.js.map +1 -0
  42. package/dist/tests/read-guard.test.js +1 -1
  43. package/dist/tests/read-guard.test.js.map +1 -1
  44. package/dist/tests/session-focus.test.js +5 -0
  45. package/dist/tests/session-focus.test.js.map +1 -1
  46. package/hooks/lib/mindlore-common.cjs +38 -29
  47. package/hooks/lib/types.d.ts +2 -0
  48. package/hooks/mindlore-cwd-changed.cjs +1 -1
  49. package/hooks/mindlore-fts5-sync.cjs +4 -3
  50. package/hooks/mindlore-index.cjs +2 -2
  51. package/hooks/mindlore-search.cjs +0 -2
  52. package/hooks/mindlore-session-end.cjs +4 -0
  53. package/package.json +1 -1
  54. package/templates/SCHEMA.md +9 -11
@@ -10,7 +10,7 @@
10
10
 
11
11
  const fs = require('fs');
12
12
  const path = require('path');
13
- const { MINDLORE_DIR, DB_NAME, SKIP_FILES, sha256, openDatabase, parseFrontmatter, extractFtsMetadata, insertFtsRow, readHookStdin } = require('./lib/mindlore-common.cjs');
13
+ const { MINDLORE_DIR, DB_NAME, SKIP_FILES, sha256, openDatabase, parseFrontmatter, extractFtsMetadata, insertFtsRow, readHookStdin, getProjectName } = require('./lib/mindlore-common.cjs');
14
14
 
15
15
  function main() {
16
16
  const filePath = readHookStdin(['path', 'file_path']);
@@ -62,7 +62,7 @@ function main() {
62
62
 
63
63
  // Update FTS5
64
64
  db.prepare('DELETE FROM mindlore_fts WHERE path = ?').run(filePath);
65
- insertFtsRow(db, { path: filePath, slug, description, type, category, title, content: body, tags, quality, dateCaptured });
65
+ insertFtsRow(db, { path: filePath, slug, description, type, category, title, content: body, tags, quality, dateCaptured, project: getProjectName() });
66
66
 
67
67
  // Update hash
68
68
  db.prepare(
@@ -117,8 +117,6 @@ function main() {
117
117
  const Database = requireDatabase();
118
118
  if (!Database) return;
119
119
 
120
- // Layered search: project DB first, global DB second
121
- // Project results appear first in output (higher priority)
122
120
  const allScores = [];
123
121
  for (const dbPath of dbPaths) {
124
122
  allScores.push(...searchDb(dbPath, keywords, Database));
@@ -85,11 +85,15 @@ function main() {
85
85
  const changedFiles = getRecentGitChanges();
86
86
  const reads = getSessionReads(baseDir);
87
87
 
88
+ const { getProjectName } = require('./lib/mindlore-common.cjs');
89
+ const project = getProjectName();
90
+
88
91
  const sections = [
89
92
  '---',
90
93
  `slug: delta-${dateStr}`,
91
94
  'type: diary',
92
95
  `date: ${now.toISOString().slice(0, 10)}`,
96
+ `project: ${project}`,
93
97
  '---',
94
98
  '',
95
99
  `# Session Delta — ${dateStr}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mindlore",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
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