memgrid 0.5.0 → 0.5.1

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 (59) hide show
  1. package/CHANGELOG.md +88 -80
  2. package/LICENSE +21 -21
  3. package/README.md +251 -251
  4. package/dist/learn/index.d.ts.map +1 -1
  5. package/dist/learn/index.js +28 -9
  6. package/dist/learn/index.js.map +1 -1
  7. package/dist/memgrid.d.ts.map +1 -1
  8. package/dist/memgrid.js +39 -6
  9. package/dist/memgrid.js.map +1 -1
  10. package/dist/retrieve/index.d.ts +1 -1
  11. package/dist/retrieve/index.d.ts.map +1 -1
  12. package/dist/retrieve/index.js +17 -13
  13. package/dist/retrieve/index.js.map +1 -1
  14. package/dist/retrieve/semantic.d.ts.map +1 -1
  15. package/dist/retrieve/semantic.js +9 -7
  16. package/dist/retrieve/semantic.js.map +1 -1
  17. package/dist/scanner/composite.d.ts.map +1 -1
  18. package/dist/scanner/composite.js +1 -3
  19. package/dist/scanner/composite.js.map +1 -1
  20. package/dist/scanner/config.d.ts.map +1 -1
  21. package/dist/scanner/config.js +30 -8
  22. package/dist/scanner/config.js.map +1 -1
  23. package/dist/scanner/golang.d.ts.map +1 -1
  24. package/dist/scanner/golang.js +11 -6
  25. package/dist/scanner/golang.js.map +1 -1
  26. package/dist/scanner/javascript.d.ts.map +1 -1
  27. package/dist/scanner/javascript.js +9 -5
  28. package/dist/scanner/javascript.js.map +1 -1
  29. package/dist/scanner/markdown.d.ts.map +1 -1
  30. package/dist/scanner/markdown.js +8 -3
  31. package/dist/scanner/markdown.js.map +1 -1
  32. package/dist/scanner/python.d.ts.map +1 -1
  33. package/dist/scanner/python.js +7 -3
  34. package/dist/scanner/python.js.map +1 -1
  35. package/dist/scanner/rules.d.ts.map +1 -1
  36. package/dist/scanner/rules.js +17 -3
  37. package/dist/scanner/rules.js.map +1 -1
  38. package/dist/scanner/rust.d.ts.map +1 -1
  39. package/dist/scanner/rust.js +4 -2
  40. package/dist/scanner/rust.js.map +1 -1
  41. package/dist/scanner/sync.d.ts +50 -0
  42. package/dist/scanner/sync.d.ts.map +1 -0
  43. package/dist/scanner/sync.js +384 -0
  44. package/dist/scanner/sync.js.map +1 -0
  45. package/dist/scanner/typescript.d.ts.map +1 -1
  46. package/dist/scanner/typescript.js +93 -17
  47. package/dist/scanner/typescript.js.map +1 -1
  48. package/dist/serve/cli.js +1 -1
  49. package/dist/serve/mcp-server.d.ts.map +1 -1
  50. package/dist/serve/mcp-server.js +27 -9
  51. package/dist/serve/mcp-server.js.map +1 -1
  52. package/dist/store/file-store.d.ts +5 -0
  53. package/dist/store/file-store.d.ts.map +1 -1
  54. package/dist/store/file-store.js +36 -8
  55. package/dist/store/file-store.js.map +1 -1
  56. package/dist/sync/index.d.ts.map +1 -1
  57. package/dist/sync/index.js +64 -23
  58. package/dist/sync/index.js.map +1 -1
  59. package/package.json +64 -51
package/CHANGELOG.md CHANGED
@@ -1,80 +1,88 @@
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
- ### AddedIncremental 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.1Search Bug Fix (2026-06-28)
6
+
7
+ ### Fixed
8
+ - `memgrid search` returning empty results after fresh init
9
+ - Root cause: ES2022 `#private` fields broke internal cache access
10
+ - Fix: `listUnitsSync()` public method replaces direct private field access
11
+ - Also added `store.load()` to `search()`, `sync()`, `stats()` entry points
12
+
13
+ ## v0.5.0Multi-Language + Incremental Sync (2026-06-28)
14
+
15
+ ### AddedLanguage-Agnostic Scanner Architecture
16
+ - `Scanner` interface: `name`, `scan()`, `scanFiles?()`, `detect()`
17
+ - `CompositeScanner`: auto-detects and composes multiple language scanners
18
+ - **TypeScript** — `ts-morph` AST (classes, methods, exported functions, call graph associations)
19
+ - **JavaScript**regex (exported functions, classes, arrow functions)
20
+ - **Python** regex (functions, classes, decorators, docstrings)
21
+ - **Go** regex (functions, methods, structs, interfaces)
22
+ - **Rust** regex (functions, structs, enums, traits, impl blocks)
23
+ - **Markdown** headings as knowledge units from any `.md` file
24
+ - **Rules** `.claude/rules/*.md` pattern + trigger units (universal, extracted from TS scanner)
25
+ - **Config** `package.json`, `pyproject.toml`, `go.mod`, `Cargo.toml`, `docker-compose.yml` (universal)
26
+
27
+ ### Added — Incremental Sync
28
+ - `memgrid sync` CLI command for incremental re-scan after code changes
29
+ - `mg.sync()` API: hash-based file diff against baseline snapshot
30
+ - File snapshots stored in `mesh.json.fileSnapshot` (SHA-256 per scanned file)
31
+ - Fuzzy match repair: Jaccard + Dice similarity for fixing broken associations
32
+ - Stale detection: marks orphaned units when source files are deleted
33
+ - Fast path: 0 changes detected in ~5ms (hash compare only)
34
+
35
+ ### Changed
36
+ - `mg.init()` now records initial file snapshot for future syncs
37
+ - `MemoryGrid` type extended with optional `fileSnapshot`
38
+
39
+ ### Performance
40
+ | Scenario | Time |
41
+ |----------|------|
42
+ | Sync 0 changes | ~5ms |
43
+ | Sync 1 file | ~2s |
44
+ | Sync 5 files (typical PR) | ~2-3s |
45
+ | Full init (150 units) | ~10s |
46
+
47
+ ## v0.4.0 — Hybrid Semantic Search (2026-06-27)
48
+
49
+ ### Added
50
+ - Hybrid search: combines MiniSearch (keyword) with semantic similarity
51
+ - Configurable `semanticWeight` (0.0 = pure keyword, 1.0 = pure semantic)
52
+ - Keyword embedding provider built-in (no external API required)
53
+ - `--semantic` flag on CLI search command
54
+
55
+ ### Performance
56
+ - 10 searches: 670ms 3ms (223x improvement)
57
+ - Repeated queries: 0ms (LRU cache)
58
+ - Disk reload: 45ms 5ms (9x, switched from YAML to JSON)
59
+
60
+ ## v0.3.0 — Auto-Learning Engine (2026-06-27)
61
+
62
+ ### Added
63
+ - Post-task analysis: `mg.analyzeTask()` detects new methods, patterns, errors, decisions
64
+ - `mg.applySuggestions()` writes learning results back to grid
65
+ - `mg.formatSuggestions()` renders diff for human review
66
+ - Learning suggestion types: `add`, `archive`, `update_confidence`
67
+
68
+ ### Changed
69
+ - Memory unit meta fields: `confidence` (0.0-1.0) and `status` (active/stale/archived)
70
+
71
+ ## v0.2.0 — MCP Server + Tests (2026-06-26)
72
+
73
+ ### Added
74
+ - Full MCP (Model Context Protocol) server via `memgrid serve`
75
+ - MCP tools: `memgrid_search`, `memgrid_context`
76
+ - Test suite with Vitest
77
+ - Septonir project integration test
78
+
79
+ ## v0.1.0 Core Engine (2026-06-26)
80
+
81
+ ### Added
82
+ - TypeScript AST scanning with `ts-morph`: extracts methods, classes, exported functions
83
+ - Rule extraction from `.claude/rules/*.md` (sections → pattern/trigger units)
84
+ - Example extraction from `.claude/examples/` (good/bad patterns)
85
+ - Config extraction from `package.json`, `docker-compose.yml`
86
+ - Association graph building (call graph, pattern matching)
87
+ - CLI: `init`, `search`, `add`, `stats`
88
+ - 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.