memgrid 0.5.0 → 0.5.2

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 (68) hide show
  1. package/CHANGELOG.md +99 -80
  2. package/LICENSE +21 -21
  3. package/README.md +284 -251
  4. package/dist/claude-md.d.ts +4 -0
  5. package/dist/claude-md.d.ts.map +1 -0
  6. package/dist/claude-md.js +58 -0
  7. package/dist/claude-md.js.map +1 -0
  8. package/dist/hooks.d.ts +18 -0
  9. package/dist/hooks.d.ts.map +1 -0
  10. package/dist/hooks.js +138 -0
  11. package/dist/hooks.js.map +1 -0
  12. package/dist/learn/index.d.ts.map +1 -1
  13. package/dist/learn/index.js +28 -9
  14. package/dist/learn/index.js.map +1 -1
  15. package/dist/memgrid.d.ts.map +1 -1
  16. package/dist/memgrid.js +39 -6
  17. package/dist/memgrid.js.map +1 -1
  18. package/dist/retrieve/index.d.ts +1 -1
  19. package/dist/retrieve/index.d.ts.map +1 -1
  20. package/dist/retrieve/index.js +17 -13
  21. package/dist/retrieve/index.js.map +1 -1
  22. package/dist/retrieve/semantic.d.ts.map +1 -1
  23. package/dist/retrieve/semantic.js +9 -7
  24. package/dist/retrieve/semantic.js.map +1 -1
  25. package/dist/scanner/composite.d.ts.map +1 -1
  26. package/dist/scanner/composite.js +1 -3
  27. package/dist/scanner/composite.js.map +1 -1
  28. package/dist/scanner/config.d.ts.map +1 -1
  29. package/dist/scanner/config.js +30 -8
  30. package/dist/scanner/config.js.map +1 -1
  31. package/dist/scanner/golang.d.ts.map +1 -1
  32. package/dist/scanner/golang.js +11 -6
  33. package/dist/scanner/golang.js.map +1 -1
  34. package/dist/scanner/javascript.d.ts.map +1 -1
  35. package/dist/scanner/javascript.js +9 -5
  36. package/dist/scanner/javascript.js.map +1 -1
  37. package/dist/scanner/markdown.d.ts.map +1 -1
  38. package/dist/scanner/markdown.js +8 -3
  39. package/dist/scanner/markdown.js.map +1 -1
  40. package/dist/scanner/python.d.ts.map +1 -1
  41. package/dist/scanner/python.js +7 -3
  42. package/dist/scanner/python.js.map +1 -1
  43. package/dist/scanner/rules.d.ts.map +1 -1
  44. package/dist/scanner/rules.js +17 -3
  45. package/dist/scanner/rules.js.map +1 -1
  46. package/dist/scanner/rust.d.ts.map +1 -1
  47. package/dist/scanner/rust.js +4 -2
  48. package/dist/scanner/rust.js.map +1 -1
  49. package/dist/scanner/sync.d.ts +50 -0
  50. package/dist/scanner/sync.d.ts.map +1 -0
  51. package/dist/scanner/sync.js +384 -0
  52. package/dist/scanner/sync.js.map +1 -0
  53. package/dist/scanner/typescript.d.ts.map +1 -1
  54. package/dist/scanner/typescript.js +93 -17
  55. package/dist/scanner/typescript.js.map +1 -1
  56. package/dist/serve/cli.js +15 -1
  57. package/dist/serve/cli.js.map +1 -1
  58. package/dist/serve/mcp-server.d.ts.map +1 -1
  59. package/dist/serve/mcp-server.js +27 -9
  60. package/dist/serve/mcp-server.js.map +1 -1
  61. package/dist/store/file-store.d.ts +5 -0
  62. package/dist/store/file-store.d.ts.map +1 -1
  63. package/dist/store/file-store.js +36 -8
  64. package/dist/store/file-store.js.map +1 -1
  65. package/dist/sync/index.d.ts.map +1 -1
  66. package/dist/sync/index.js +64 -23
  67. package/dist/sync/index.js.map +1 -1
  68. package/package.json +64 -51
package/CHANGELOG.md CHANGED
@@ -1,80 +1,99 @@
1
- # Changelog
2
-
3
- All notable changes to MemGrid.
4
-
5
- ## v0.5.0Multi-Language + Incremental Sync (2026-06-28)
6
-
7
- ### Added — Language-Agnostic Scanner Architecture
8
- - `Scanner` interface: `name`, `scan()`, `scanFiles?()`, `detect()`
9
- - `CompositeScanner`: auto-detects and composes multiple language scanners
10
- - **TypeScript** — `ts-morph` AST (classes, methods, exported functions, call graph associations)
11
- - **JavaScript** regex (exported functions, classes, arrow functions)
12
- - **Python** — regex (functions, classes, decorators, docstrings)
13
- - **Go** — regex (functions, methods, structs, interfaces)
14
- - **Rust** regex (functions, structs, enums, traits, impl blocks)
15
- - **Markdown** — headings as knowledge units from any `.md` file
16
- - **Rules**`.claude/rules/*.md` pattern + trigger units (universal, extracted from TS scanner)
17
- - **Config** — `package.json`, `pyproject.toml`, `go.mod`, `Cargo.toml`, `docker-compose.yml` (universal)
18
-
19
- ### Added Incremental Sync
20
- - `memgrid sync` CLI command for incremental re-scan after code changes
21
- - `mg.sync()` API: hash-based file diff against baseline snapshot
22
- - File snapshots stored in `mesh.json.fileSnapshot` (SHA-256 per scanned file)
23
- - Fuzzy match repair: Jaccard + Dice similarity for fixing broken associations
24
- - Stale detection: marks orphaned units when source files are deleted
25
- - Fast path: 0 changes detected in ~5ms (hash compare only)
26
-
27
- ### Changed
28
- - `mg.init()` now records initial file snapshot for future syncs
29
- - `MemoryGrid` type extended with optional `fileSnapshot`
30
-
31
- ### Performance
32
- | Scenario | Time |
33
- |----------|------|
34
- | Sync 0 changes | ~5ms |
35
- | Sync 1 file | ~2s |
36
- | Sync 5 files (typical PR) | ~2-3s |
37
- | Full init (150 units) | ~10s |
38
-
39
- ## v0.4.0 Hybrid Semantic Search (2026-06-27)
40
-
41
- ### Added
42
- - Hybrid search: combines MiniSearch (keyword) with semantic similarity
43
- - Configurable `semanticWeight` (0.0 = pure keyword, 1.0 = pure semantic)
44
- - Keyword embedding provider built-in (no external API required)
45
- - `--semantic` flag on CLI search command
46
-
47
- ### Performance
48
- - 10 searches: 670ms 3ms (223x improvement)
49
- - Repeated queries: 0ms (LRU cache)
50
- - Disk reload: 45ms → 5ms (9x, switched from YAML to JSON)
51
-
52
- ## v0.3.0 — Auto-Learning Engine (2026-06-27)
53
-
54
- ### Added
55
- - Post-task analysis: `mg.analyzeTask()` detects new methods, patterns, errors, decisions
56
- - `mg.applySuggestions()` writes learning results back to grid
57
- - `mg.formatSuggestions()` renders diff for human review
58
- - Learning suggestion types: `add`, `archive`, `update_confidence`
59
-
60
- ### Changed
61
- - Memory unit meta fields: `confidence` (0.0-1.0) and `status` (active/stale/archived)
62
-
63
- ## v0.2.0 MCP Server + Tests (2026-06-26)
64
-
65
- ### Added
66
- - Full MCP (Model Context Protocol) server via `memgrid serve`
67
- - MCP tools: `memgrid_search`, `memgrid_context`
68
- - Test suite with Vitest
69
- - Septonir project integration test
70
-
71
- ## v0.1.0 — Core Engine (2026-06-26)
72
-
73
- ### Added
74
- - TypeScript AST scanning with `ts-morph`: extracts methods, classes, exported functions
75
- - Rule extraction from `.claude/rules/*.md` (sections pattern/trigger units)
76
- - Example extraction from `.claude/examples/` (good/bad patterns)
77
- - Config extraction from `package.json`, `docker-compose.yml`
78
- - Association graph building (call graph, pattern matching)
79
- - CLI: `init`, `search`, `add`, `stats`
80
- - File-based storage in `.claude/memory-grid/`
1
+ # Changelog
2
+
3
+ All notable changes to MemGrid.
4
+
5
+ ## v0.5.2Auto-Sync Hooks (unreleased)
6
+
7
+ ### Added
8
+ - `memgrid init` auto-configures memory sync hooks:
9
+ - **Claude Code PostCompletion** runs `memgrid sync` after each task
10
+ - **Git post-commit** runs `memgrid sync` after each commit
11
+ - All injections are non-destructive (merges with existing config)
12
+
13
+ ### Changed
14
+ - README: added Auto-Sync Hooks section + CLAUDE.md integration template
15
+
16
+ ## v0.5.1Search Bug Fix (2026-06-28)
17
+
18
+ ### Fixed
19
+ - `memgrid search` returning empty results after fresh init
20
+ - Root cause: ES2022 `#private` fields broke internal cache access
21
+ - Fix: `listUnitsSync()` public method replaces direct private field access
22
+ - Also added `store.load()` to `search()`, `sync()`, `stats()` entry points
23
+
24
+ ## v0.5.0 Multi-Language + Incremental Sync (2026-06-28)
25
+
26
+ ### Added — Language-Agnostic Scanner Architecture
27
+ - `Scanner` interface: `name`, `scan()`, `scanFiles?()`, `detect()`
28
+ - `CompositeScanner`: auto-detects and composes multiple language scanners
29
+ - **TypeScript** — `ts-morph` AST (classes, methods, exported functions, call graph associations)
30
+ - **JavaScript** — regex (exported functions, classes, arrow functions)
31
+ - **Python** — regex (functions, classes, decorators, docstrings)
32
+ - **Go** regex (functions, methods, structs, interfaces)
33
+ - **Rust** — regex (functions, structs, enums, traits, impl blocks)
34
+ - **Markdown** headings as knowledge units from any `.md` file
35
+ - **Rules** `.claude/rules/*.md` pattern + trigger units (universal, extracted from TS scanner)
36
+ - **Config** `package.json`, `pyproject.toml`, `go.mod`, `Cargo.toml`, `docker-compose.yml` (universal)
37
+
38
+ ### Added — Incremental Sync
39
+ - `memgrid sync` CLI command for incremental re-scan after code changes
40
+ - `mg.sync()` API: hash-based file diff against baseline snapshot
41
+ - File snapshots stored in `mesh.json.fileSnapshot` (SHA-256 per scanned file)
42
+ - Fuzzy match repair: Jaccard + Dice similarity for fixing broken associations
43
+ - Stale detection: marks orphaned units when source files are deleted
44
+ - Fast path: 0 changes detected in ~5ms (hash compare only)
45
+
46
+ ### Changed
47
+ - `mg.init()` now records initial file snapshot for future syncs
48
+ - `MemoryGrid` type extended with optional `fileSnapshot`
49
+
50
+ ### Performance
51
+ | Scenario | Time |
52
+ |----------|------|
53
+ | Sync 0 changes | ~5ms |
54
+ | Sync 1 file | ~2s |
55
+ | Sync 5 files (typical PR) | ~2-3s |
56
+ | Full init (150 units) | ~10s |
57
+
58
+ ## v0.4.0 Hybrid Semantic Search (2026-06-27)
59
+
60
+ ### Added
61
+ - Hybrid search: combines MiniSearch (keyword) with semantic similarity
62
+ - Configurable `semanticWeight` (0.0 = pure keyword, 1.0 = pure semantic)
63
+ - Keyword embedding provider built-in (no external API required)
64
+ - `--semantic` flag on CLI search command
65
+
66
+ ### Performance
67
+ - 10 searches: 670ms → 3ms (223x improvement)
68
+ - Repeated queries: 0ms (LRU cache)
69
+ - Disk reload: 45ms → 5ms (9x, switched from YAML to JSON)
70
+
71
+ ## v0.3.0 — Auto-Learning Engine (2026-06-27)
72
+
73
+ ### Added
74
+ - Post-task analysis: `mg.analyzeTask()` detects new methods, patterns, errors, decisions
75
+ - `mg.applySuggestions()` writes learning results back to grid
76
+ - `mg.formatSuggestions()` renders diff for human review
77
+ - Learning suggestion types: `add`, `archive`, `update_confidence`
78
+
79
+ ### Changed
80
+ - Memory unit meta fields: `confidence` (0.0-1.0) and `status` (active/stale/archived)
81
+
82
+ ## v0.2.0 — MCP Server + Tests (2026-06-26)
83
+
84
+ ### Added
85
+ - Full MCP (Model Context Protocol) server via `memgrid serve`
86
+ - MCP tools: `memgrid_search`, `memgrid_context`
87
+ - Test suite with Vitest
88
+ - Septonir project integration test
89
+
90
+ ## v0.1.0 — Core Engine (2026-06-26)
91
+
92
+ ### Added
93
+ - TypeScript AST scanning with `ts-morph`: extracts methods, classes, exported functions
94
+ - Rule extraction from `.claude/rules/*.md` (sections → pattern/trigger units)
95
+ - Example extraction from `.claude/examples/` (good/bad patterns)
96
+ - Config extraction from `package.json`, `docker-compose.yml`
97
+ - Association graph building (call graph, pattern matching)
98
+ - CLI: `init`, `search`, `add`, `stats`
99
+ - File-based storage in `.claude/memory-grid/`
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 wenliangw
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 wenliangw
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.