purecontext-mcp 1.5.2 → 1.11.0

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 (196) hide show
  1. package/AGENT_INSTRUCTIONS.md +18 -10
  2. package/AGENT_REFERENCE.md +684 -561
  3. package/CHANGELOG.md +567 -445
  4. package/CODE-HISTORY.md +29 -1
  5. package/FRAMEWORK-ADAPTERS.md +368 -351
  6. package/FULL-INSTALLATION-GUIDE.md +351 -341
  7. package/README.md +411 -339
  8. package/REFACTORING-SAFELY.md +338 -279
  9. package/SAFE-CHANGES.md +208 -156
  10. package/USER-GUIDE.md +3 -1
  11. package/WHY-PURECONTEXT.md +103 -73
  12. package/WORKFLOW-PR-REVIEW.md +245 -199
  13. package/dist/adapters/astro-preprocessor.d.ts +25 -0
  14. package/dist/adapters/astro-preprocessor.d.ts.map +1 -0
  15. package/dist/adapters/astro-preprocessor.js +50 -0
  16. package/dist/adapters/astro-preprocessor.js.map +1 -0
  17. package/dist/adapters/astro.d.ts +13 -0
  18. package/dist/adapters/astro.d.ts.map +1 -0
  19. package/dist/adapters/astro.js +83 -0
  20. package/dist/adapters/astro.js.map +1 -0
  21. package/dist/adapters/detect-utils.d.ts +38 -0
  22. package/dist/adapters/detect-utils.d.ts.map +1 -0
  23. package/dist/adapters/detect-utils.js +95 -0
  24. package/dist/adapters/detect-utils.js.map +1 -0
  25. package/dist/adapters/nuxt.d.ts +20 -0
  26. package/dist/adapters/nuxt.d.ts.map +1 -1
  27. package/dist/adapters/nuxt.js +128 -13
  28. package/dist/adapters/nuxt.js.map +1 -1
  29. package/dist/adapters/svelte-preprocessor.d.ts +29 -0
  30. package/dist/adapters/svelte-preprocessor.d.ts.map +1 -0
  31. package/dist/adapters/svelte-preprocessor.js +83 -0
  32. package/dist/adapters/svelte-preprocessor.js.map +1 -0
  33. package/dist/adapters/svelte.d.ts +13 -0
  34. package/dist/adapters/svelte.d.ts.map +1 -0
  35. package/dist/adapters/svelte.js +96 -0
  36. package/dist/adapters/svelte.js.map +1 -0
  37. package/dist/adapters/vue.d.ts.map +1 -1
  38. package/dist/adapters/vue.js +87 -20
  39. package/dist/adapters/vue.js.map +1 -1
  40. package/dist/bin.d.ts +16 -0
  41. package/dist/bin.d.ts.map +1 -0
  42. package/dist/bin.js +21 -0
  43. package/dist/bin.js.map +1 -0
  44. package/dist/cli/hooks.d.ts +2 -2
  45. package/dist/cli/hooks.d.ts.map +1 -1
  46. package/dist/cli/hooks.js +123 -135
  47. package/dist/cli/hooks.js.map +1 -1
  48. package/dist/cli/install-writers.d.ts.map +1 -1
  49. package/dist/cli/install-writers.js +281 -36
  50. package/dist/cli/install-writers.js.map +1 -1
  51. package/dist/cli/resolve-node.d.ts +53 -0
  52. package/dist/cli/resolve-node.d.ts.map +1 -0
  53. package/dist/cli/resolve-node.js +84 -0
  54. package/dist/cli/resolve-node.js.map +1 -0
  55. package/dist/config/config-loader.js +24 -0
  56. package/dist/config/config-loader.js.map +1 -1
  57. package/dist/config/config-schema.d.ts +71 -0
  58. package/dist/config/config-schema.d.ts.map +1 -1
  59. package/dist/config/config-schema.js +102 -0
  60. package/dist/config/config-schema.js.map +1 -1
  61. package/dist/core/db/api-keys.d.ts +1 -1
  62. package/dist/core/db/api-keys.d.ts.map +1 -1
  63. package/dist/core/db/api-keys.js +39 -39
  64. package/dist/core/db/api-keys.js.map +1 -1
  65. package/dist/core/db/co-change-store.d.ts +34 -0
  66. package/dist/core/db/co-change-store.d.ts.map +1 -0
  67. package/dist/core/db/co-change-store.js +78 -0
  68. package/dist/core/db/co-change-store.js.map +1 -0
  69. package/dist/core/db/schema.d.ts +3 -3
  70. package/dist/core/db/schema.d.ts.map +1 -1
  71. package/dist/core/db/schema.js +12 -30
  72. package/dist/core/db/schema.js.map +1 -1
  73. package/dist/core/db/sqlite-loader.d.ts +51 -0
  74. package/dist/core/db/sqlite-loader.d.ts.map +1 -0
  75. package/dist/core/db/sqlite-loader.js +94 -0
  76. package/dist/core/db/sqlite-loader.js.map +1 -0
  77. package/dist/core/db/wasm-sqlite.d.ts +4 -0
  78. package/dist/core/db/wasm-sqlite.d.ts.map +1 -0
  79. package/dist/core/db/wasm-sqlite.js +270 -0
  80. package/dist/core/db/wasm-sqlite.js.map +1 -0
  81. package/dist/core/diff-parser.d.ts.map +1 -1
  82. package/dist/core/diff-parser.js +6 -1
  83. package/dist/core/diff-parser.js.map +1 -1
  84. package/dist/core/git-log-reader.d.ts +28 -0
  85. package/dist/core/git-log-reader.d.ts.map +1 -1
  86. package/dist/core/git-log-reader.js +74 -3
  87. package/dist/core/git-log-reader.js.map +1 -1
  88. package/dist/core/index-manager.d.ts.map +1 -1
  89. package/dist/core/index-manager.js +29 -3
  90. package/dist/core/index-manager.js.map +1 -1
  91. package/dist/core/indexing-worker.d.ts +2 -0
  92. package/dist/core/indexing-worker.d.ts.map +1 -1
  93. package/dist/core/indexing-worker.js +2 -0
  94. package/dist/core/indexing-worker.js.map +1 -1
  95. package/dist/core/watcher/file-watcher.d.ts +6 -0
  96. package/dist/core/watcher/file-watcher.d.ts.map +1 -1
  97. package/dist/core/watcher/file-watcher.js +11 -1
  98. package/dist/core/watcher/file-watcher.js.map +1 -1
  99. package/dist/graph/path-resolver.js +86 -17
  100. package/dist/graph/path-resolver.js.map +1 -1
  101. package/dist/index.d.ts +3 -0
  102. package/dist/index.d.ts.map +1 -1
  103. package/dist/index.js +11 -1
  104. package/dist/index.js.map +1 -1
  105. package/dist/node-guard.d.ts +15 -0
  106. package/dist/node-guard.d.ts.map +1 -0
  107. package/dist/node-guard.js +33 -0
  108. package/dist/node-guard.js.map +1 -0
  109. package/dist/server/admin-api.d.ts +1 -1
  110. package/dist/server/admin-api.d.ts.map +1 -1
  111. package/dist/server/admin-api.js +2 -2
  112. package/dist/server/admin-api.js.map +1 -1
  113. package/dist/server/auth/api-key.d.ts +1 -1
  114. package/dist/server/auth/api-key.d.ts.map +1 -1
  115. package/dist/server/mcp-server.d.ts.map +1 -1
  116. package/dist/server/mcp-server.js +25 -0
  117. package/dist/server/mcp-server.js.map +1 -1
  118. package/dist/server/tools/analyze-diff.d.ts +8 -0
  119. package/dist/server/tools/analyze-diff.d.ts.map +1 -1
  120. package/dist/server/tools/analyze-diff.js +80 -16
  121. package/dist/server/tools/analyze-diff.js.map +1 -1
  122. package/dist/server/tools/change-synthesis.d.ts +90 -0
  123. package/dist/server/tools/change-synthesis.d.ts.map +1 -0
  124. package/dist/server/tools/change-synthesis.js +236 -0
  125. package/dist/server/tools/change-synthesis.js.map +1 -0
  126. package/dist/server/tools/co-change.d.ts +65 -0
  127. package/dist/server/tools/co-change.d.ts.map +1 -0
  128. package/dist/server/tools/co-change.js +146 -0
  129. package/dist/server/tools/co-change.js.map +1 -0
  130. package/dist/server/tools/compare-change-impact.d.ts +58 -0
  131. package/dist/server/tools/compare-change-impact.d.ts.map +1 -0
  132. package/dist/server/tools/compare-change-impact.js +0 -0
  133. package/dist/server/tools/compare-change-impact.js.map +1 -0
  134. package/dist/server/tools/find-refactoring-opportunities.d.ts +1 -1
  135. package/dist/server/tools/get-architecture-snapshot.d.ts.map +1 -1
  136. package/dist/server/tools/get-architecture-snapshot.js +28 -14
  137. package/dist/server/tools/get-architecture-snapshot.js.map +1 -1
  138. package/dist/server/tools/get-churn-metrics.d.ts.map +1 -1
  139. package/dist/server/tools/get-churn-metrics.js +1 -12
  140. package/dist/server/tools/get-churn-metrics.js.map +1 -1
  141. package/dist/server/tools/get-co-change.d.ts +37 -0
  142. package/dist/server/tools/get-co-change.d.ts.map +1 -0
  143. package/dist/server/tools/get-co-change.js +120 -0
  144. package/dist/server/tools/get-co-change.js.map +1 -0
  145. package/dist/server/tools/get-context-bundle.d.ts.map +1 -1
  146. package/dist/server/tools/get-context-bundle.js +56 -3
  147. package/dist/server/tools/get-context-bundle.js.map +1 -1
  148. package/dist/server/tools/get-entry-points.d.ts +1 -1
  149. package/dist/server/tools/get-symbol-risk.d.ts +25 -0
  150. package/dist/server/tools/get-symbol-risk.d.ts.map +1 -0
  151. package/dist/server/tools/get-symbol-risk.js +60 -0
  152. package/dist/server/tools/get-symbol-risk.js.map +1 -0
  153. package/dist/server/tools/get-symbol-source.d.ts +2 -0
  154. package/dist/server/tools/get-symbol-source.d.ts.map +1 -1
  155. package/dist/server/tools/get-symbol-source.js +18 -1
  156. package/dist/server/tools/get-symbol-source.js.map +1 -1
  157. package/dist/server/tools/index-repo.d.ts.map +1 -1
  158. package/dist/server/tools/index-repo.js +8 -2
  159. package/dist/server/tools/index-repo.js.map +1 -1
  160. package/dist/server/tools/prepare-change.d.ts +61 -0
  161. package/dist/server/tools/prepare-change.d.ts.map +1 -0
  162. package/dist/server/tools/prepare-change.js +262 -0
  163. package/dist/server/tools/prepare-change.js.map +1 -0
  164. package/dist/server/tools/search-symbols.d.ts +2 -0
  165. package/dist/server/tools/search-symbols.d.ts.map +1 -1
  166. package/dist/server/tools/search-symbols.js +33 -0
  167. package/dist/server/tools/search-symbols.js.map +1 -1
  168. package/dist/server/tools/symbol-lines.d.ts +25 -0
  169. package/dist/server/tools/symbol-lines.d.ts.map +1 -0
  170. package/dist/server/tools/symbol-lines.js +40 -0
  171. package/dist/server/tools/symbol-lines.js.map +1 -0
  172. package/dist/server/tools/symbol-risk.d.ts +109 -0
  173. package/dist/server/tools/symbol-risk.d.ts.map +1 -0
  174. package/dist/server/tools/symbol-risk.js +251 -0
  175. package/dist/server/tools/symbol-risk.js.map +1 -0
  176. package/dist/server/tools/verify-change.d.ts +40 -0
  177. package/dist/server/tools/verify-change.d.ts.map +1 -0
  178. package/dist/server/tools/verify-change.js +149 -0
  179. package/dist/server/tools/verify-change.js.map +1 -0
  180. package/dist/version.d.ts +1 -1
  181. package/dist/version.d.ts.map +1 -1
  182. package/dist/version.js +1 -1
  183. package/dist/version.js.map +1 -1
  184. package/docs/01-introduction.md +2 -2
  185. package/docs/02-installation.md +97 -89
  186. package/docs/03-quick-start.md +138 -135
  187. package/docs/04-configuration.md +247 -214
  188. package/docs/05-cli-reference.md +236 -219
  189. package/docs/06-tools-reference.md +902 -499
  190. package/docs/14-transport-modes.md +170 -167
  191. package/docs/18-git-history.md +43 -0
  192. package/docs/23-performance.md +123 -121
  193. package/docs/26-troubleshooting.md +249 -234
  194. package/grammars/README.md +88 -0
  195. package/package.json +7 -25
  196. package/AGENT_INSTRUCTIONS_SHORT.md +0 -150
@@ -1,234 +1,249 @@
1
- # Troubleshooting
2
-
3
-
4
- ---
5
-
6
- ## Health check
7
-
8
- Before investigating any problem, run the health check:
9
-
10
- ```bash
11
- purecontext-mcp --health
12
- ```
13
-
14
- ```json
15
- {
16
- "status": "ok",
17
- "version": "1.x.x",
18
- "uptime": 0,
19
- "nodeVersion": "20.11.0",
20
- "platform": "linux",
21
- "indexDir": "/home/user/.purecontext/indexes",
22
- "repoCount": 3,
23
- "grammars": {
24
- "tree-sitter-typescript.wasm": true,
25
- "tree-sitter-javascript.wasm": true
26
- }
27
- }
28
- ```
29
-
30
- In HTTP mode:
31
-
32
- ```bash
33
- curl http://localhost:3000/health
34
- ```
35
-
36
- A non-zero exit code (CLI) or non-200 response (HTTP) indicates something is wrong.
37
-
38
- ---
39
-
40
- ## Debug logging
41
-
42
- ```bash
43
- purecontext-mcp --log-level debug
44
- # or
45
- LOG_LEVEL=debug purecontext-mcp
46
- ```
47
-
48
- Debug logs show: file-by-file parsing progress, hash cache hits/misses, worker thread activity, query plan details, rate limit decisions.
49
-
50
- **Use in production only temporarily** — debug logs are verbose and may include file paths.
51
-
52
- ---
53
-
54
- ## Common errors
55
-
56
- ### "Repo not indexed" / "Index not found"
57
-
58
- The repository has not been indexed yet, or the `repoId` belongs to a different installation.
59
-
60
- ```
61
- Fix: Call index_folder with the correct path.
62
- Use resolve_repo to check if the path is indexed.
63
- ```
64
-
65
- ---
66
-
67
- ### "Grammar file not found"
68
-
69
- A `.wasm` grammar file is missing from the `grammars/` directory.
70
-
71
- ```bash
72
- # Check which grammars are present:
73
- purecontext-mcp config --check
74
-
75
- # Fix: reinstall the package
76
- npm install -g purecontext-mcp
77
- # or
78
- npm rebuild purecontext-mcp
79
- ```
80
-
81
- ---
82
-
83
- ### "better-sqlite3 bindings failed to load"
84
-
85
- The native `better-sqlite3` binary doesn't match your Node.js version or platform.
86
-
87
- ```bash
88
- # Fix: rebuild the native module
89
- cd $(npm root -g)/purecontext-mcp
90
- npm rebuild better-sqlite3
91
-
92
- # If that fails, install build tools first:
93
- # macOS: xcode-select --install
94
- # Linux: apt install python3 make g++
95
- # Windows: npm install -g windows-build-tools
96
- ```
97
-
98
- ---
99
-
100
- ### Missing symbols after indexing
101
-
102
- Check this list in order:
103
-
104
- 1. **Is the file excluded?** Check `excludePatterns` and built-in exclusions (node_modules, dist, .env, etc.)
105
- 2. **Is the file too large?** Files > `maxFileSizeBytes` (default 1 MB) are skipped
106
- 3. **Is it a secret file?** `.pem`, `.key`, `credentials.json` etc. are always excluded
107
- 4. **Is it a private symbol?** Go unexported names, C `static` functions, Java/C# `private` members are excluded by design
108
- 5. **Is the language supported?** Check [Language Support](07-language-support.md)
109
- 6. **Did the adapter detect?** Run `purecontext-mcp config --check` check "Detected adapters" for your project
110
-
111
- Force a specific adapter if auto-detection fails:
112
- ```json
113
- { "adapters": ["vue", "nuxt"] }
114
- ```
115
-
116
- ---
117
-
118
- ### Adapter not activating
119
-
120
- Run `purecontext-mcp config --check` and look at the detected adapters. Common detection requirements:
121
-
122
- | Framework | Detection file |
123
- |-----------|---------------|
124
- | Vue | `vue` in `package.json` dependencies |
125
- | Nuxt | `nuxt.config.ts` at project root |
126
- | Django | `manage.py` at project root |
127
- | Rails | `gem 'rails'` in `Gemfile` |
128
- | Gin | `github.com/gin-gonic/gin` in `go.mod` |
129
- | Spring Boot | `spring-boot-starter` in `pom.xml` |
130
-
131
- ---
132
-
133
- ### Incremental re-index not triggering
134
-
135
- The file watcher uses a 2-second debounce. For manual force re-index:
136
-
137
- ```
138
- Call index_folder again — it skips unchanged files via content hashing.
139
- ```
140
-
141
- If the watcher seems stuck on Linux:
142
-
143
- ```bash
144
- # Check inotify limit
145
- cat /proc/sys/fs/inotify/max_user_watches
146
-
147
- # Increase if needed
148
- echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf
149
- sudo sysctl -p
150
- ```
151
-
152
- ---
153
-
154
- ### HTTP transport not accessible
155
-
156
- 1. **Check `http.host`** default is `127.0.0.1` (loopback only). Set to `0.0.0.0` for network access.
157
- 2. **Check CORS** — `http.corsOrigins` must include the browser's origin.
158
- 3. **Check auth** — if `http.auth.enabled: true`, all requests need `Authorization: Bearer <token>`.
159
- 4. **Check firewall** — port 3000 must be open from the client's perspective.
160
-
161
- ---
162
-
163
- ### Semantic search not working
164
-
165
- 1. Verify `semantic.enabled: true` in config
166
- 2. Verify a provider is configured: `semantic.provider` is not `"none"`
167
- 3. Check if the repo meets the threshold: lower `semantic.threshold` for small repos
168
- 4. Verify the API key: test it with a direct API call
169
- 5. Re-index the HNSW index is built during indexing, not at query time
170
-
171
- ---
172
-
173
- ### Config validation errors
174
-
175
- ```bash
176
- purecontext-mcp config --check
177
- ```
178
-
179
- Reports all schema violations with field names and expected types.
180
-
181
- ---
182
-
183
- ### Rate limit errors (HTTP mode)
184
-
185
- `429 Too Many Requests` — the API key has hit its per-second token limit.
186
-
187
- Check the `Retry-After` header for when to retry. If limits are too low for your use case, ask the server admin to raise `rateLimit.maxTokens` or `rateLimit.refillRate` for your key.
188
-
189
- ---
190
-
191
- ### "git not found" when using `index_repo`
192
-
193
- ```bash
194
- # Verify git is installed and on PATH
195
- git --version
196
-
197
- # Install if missing:
198
- # macOS: xcode-select --install
199
- # Linux: apt install git
200
- # Windows: https://git-scm.com/download/win
201
- ```
202
-
203
- ---
204
-
205
- ### Indexing is slow
206
-
207
- - First index is always slower — subsequent runs are incremental (hash-based)
208
- - AI summarization (`allowRemoteAI: true`) adds API latency — disable during testing
209
- - Semantic indexing adds API latency disable if not needed
210
- - For large repos (> 10k files): increase `workerThreads` in config
211
-
212
- ---
213
-
214
- ## Re-indexing from scratch
215
-
216
- ```
217
- Use invalidate_cache tool with your repoId, then call index_folder again.
218
- ```
219
-
220
- Or manually:
221
-
222
- ```bash
223
- rm ~/.purecontext/indexes/<repoId>.db
224
- rm -rf ~/.purecontext/indexes/<repoId>/
225
- ```
226
-
227
- Then call `index_folder` — a clean full index will be built.
228
-
229
- ---
230
-
231
- ## Getting more help
232
-
233
- - **GitHub Issues:** Report bugs with version, OS, Node.js version, error log, and approximate repo size
234
- - **`--log-level debug`** output is the most useful information to include in a bug report
1
+ # Troubleshooting
2
+
3
+
4
+ ---
5
+
6
+ ## Health check
7
+
8
+ Before investigating any problem, run the health check:
9
+
10
+ ```bash
11
+ purecontext-mcp --health
12
+ ```
13
+
14
+ ```json
15
+ {
16
+ "status": "ok",
17
+ "version": "1.x.x",
18
+ "uptime": 0,
19
+ "nodeVersion": "20.11.0",
20
+ "platform": "linux",
21
+ "indexDir": "/home/user/.purecontext/indexes",
22
+ "repoCount": 3,
23
+ "grammars": {
24
+ "tree-sitter-typescript.wasm": true,
25
+ "tree-sitter-javascript.wasm": true
26
+ }
27
+ }
28
+ ```
29
+
30
+ In HTTP mode:
31
+
32
+ ```bash
33
+ curl http://localhost:3000/health
34
+ ```
35
+
36
+ A non-zero exit code (CLI) or non-200 response (HTTP) indicates something is wrong.
37
+
38
+ ---
39
+
40
+ ## Debug logging
41
+
42
+ ```bash
43
+ purecontext-mcp --log-level debug
44
+ # or
45
+ LOG_LEVEL=debug purecontext-mcp
46
+ ```
47
+
48
+ Debug logs show: file-by-file parsing progress, hash cache hits/misses, worker thread activity, query plan details, rate limit decisions.
49
+
50
+ **Use in production only temporarily** — debug logs are verbose and may include file paths.
51
+
52
+ ---
53
+
54
+ ## Common errors
55
+
56
+ ### "Repo not indexed" / "Index not found"
57
+
58
+ The repository has not been indexed yet, or the `repoId` belongs to a different installation.
59
+
60
+ ```
61
+ Fix: Call index_folder with the correct path.
62
+ Use resolve_repo to check if the path is indexed.
63
+ ```
64
+
65
+ ---
66
+
67
+ ### "Grammar file not found"
68
+
69
+ A `.wasm` grammar file is missing from the `grammars/` directory.
70
+
71
+ ```bash
72
+ # Check which grammars are present:
73
+ purecontext-mcp config --check
74
+
75
+ # Fix: reinstall the package
76
+ npm install -g purecontext-mcp
77
+ # or
78
+ npm rebuild purecontext-mcp
79
+ ```
80
+
81
+ ---
82
+
83
+ ### "better-sqlite3 bindings failed to load" / native ABI mismatch
84
+
85
+ The native `better-sqlite3` binary doesn't match your Node.js version or platform — e.g. `NODE_MODULE_VERSION 127 … requires 108` (an ABI mismatch, common under Volta or other per-project Node managers).
86
+
87
+ **You usually don't need to do anything.** As of 1.10.0, PureContext automatically falls back to a pure-WASM SQLite engine when the native addon can't load, so it keeps working — you'll see `SQLite backend: WASM (@sqlite.org/sqlite-wasm)` in the logs. The fallback is full-featured (FTS5 included), just slower on large indexes.
88
+
89
+ To restore the faster native engine, rebuild it for your current Node:
90
+
91
+ ```bash
92
+ # Fix: rebuild the native module for the current Node
93
+ cd $(npm root -g)/purecontext-mcp
94
+ npm rebuild better-sqlite3
95
+
96
+ # If that fails, install build tools first:
97
+ # macOS: xcode-select --install
98
+ # Linux: apt install python3 make g++
99
+ # Windows: npm install -g windows-build-tools
100
+ ```
101
+
102
+ ---
103
+
104
+ ### "MCP error -32000: Connection closed" / server won't connect
105
+
106
+ The MCP host shows this when the server process exits during startup. Two most common causes:
107
+
108
+ 1. **Node < 18.** PureContext requires Node ≥ 18. As of 1.10.0 it prints a clear "requires Node.js >= 18" message and exits, instead of failing opaquely. Run the command directly to see it: `node <…>/dist/bin.js --version`. Fix: upgrade Node (20 or 22 LTS recommended).
109
+ 2. **The server inherited the wrong Node** (Volta/nvm picked a project-pinned version). An MCP server is a global tool — pin it to your global Node so it doesn't inherit a project's pin. Re-run `npx purecontext-mcp install claude` and use the printed `claude mcp add … --scope user -- <node> <launcher>` command.
110
+
111
+ A native ABI mismatch no longer causes this (the WASM fallback handles it), so a remaining `-32000` is almost always cause #1 or #2.
112
+
113
+ ---
114
+
115
+ ### Missing symbols after indexing
116
+
117
+ Check this list in order:
118
+
119
+ 1. **Is the file excluded?** Check `excludePatterns` and built-in exclusions (node_modules, dist, .env, etc.)
120
+ 2. **Is the file too large?** Files > `maxFileSizeBytes` (default 1 MB) are skipped
121
+ 3. **Is it a secret file?** `.pem`, `.key`, `credentials.json` etc. are always excluded
122
+ 4. **Is it a private symbol?** Go unexported names, C `static` functions, Java/C# `private` members are excluded by design
123
+ 5. **Is the language supported?** Check [Language Support](07-language-support.md)
124
+ 6. **Did the adapter detect?** Run `purecontext-mcp config --check` check "Detected adapters" for your project
125
+
126
+ Force a specific adapter if auto-detection fails:
127
+ ```json
128
+ { "adapters": ["vue", "nuxt"] }
129
+ ```
130
+
131
+ ---
132
+
133
+ ### Adapter not activating
134
+
135
+ Run `purecontext-mcp config --check` and look at the detected adapters. Common detection requirements:
136
+
137
+ | Framework | Detection file |
138
+ |-----------|---------------|
139
+ | Vue | `vue` in `package.json` dependencies |
140
+ | Nuxt | `nuxt.config.ts` at project root |
141
+ | Django | `manage.py` at project root |
142
+ | Rails | `gem 'rails'` in `Gemfile` |
143
+ | Gin | `github.com/gin-gonic/gin` in `go.mod` |
144
+ | Spring Boot | `spring-boot-starter` in `pom.xml` |
145
+
146
+ ---
147
+
148
+ ### Incremental re-index not triggering
149
+
150
+ The file watcher uses a 2-second debounce. For manual force re-index:
151
+
152
+ ```
153
+ Call index_folder again — it skips unchanged files via content hashing.
154
+ ```
155
+
156
+ If the watcher seems stuck on Linux:
157
+
158
+ ```bash
159
+ # Check inotify limit
160
+ cat /proc/sys/fs/inotify/max_user_watches
161
+
162
+ # Increase if needed
163
+ echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf
164
+ sudo sysctl -p
165
+ ```
166
+
167
+ ---
168
+
169
+ ### HTTP transport not accessible
170
+
171
+ 1. **Check `http.host`** — default is `127.0.0.1` (loopback only). Set to `0.0.0.0` for network access.
172
+ 2. **Check CORS** — `http.corsOrigins` must include the browser's origin.
173
+ 3. **Check auth** — if `http.auth.enabled: true`, all requests need `Authorization: Bearer <token>`.
174
+ 4. **Check firewall** — port 3000 must be open from the client's perspective.
175
+
176
+ ---
177
+
178
+ ### Semantic search not working
179
+
180
+ 1. Verify `semantic.enabled: true` in config
181
+ 2. Verify a provider is configured: `semantic.provider` is not `"none"`
182
+ 3. Check if the repo meets the threshold: lower `semantic.threshold` for small repos
183
+ 4. Verify the API key: test it with a direct API call
184
+ 5. Re-index — the HNSW index is built during indexing, not at query time
185
+
186
+ ---
187
+
188
+ ### Config validation errors
189
+
190
+ ```bash
191
+ purecontext-mcp config --check
192
+ ```
193
+
194
+ Reports all schema violations with field names and expected types.
195
+
196
+ ---
197
+
198
+ ### Rate limit errors (HTTP mode)
199
+
200
+ `429 Too Many Requests` — the API key has hit its per-second token limit.
201
+
202
+ Check the `Retry-After` header for when to retry. If limits are too low for your use case, ask the server admin to raise `rateLimit.maxTokens` or `rateLimit.refillRate` for your key.
203
+
204
+ ---
205
+
206
+ ### "git not found" when using `index_repo`
207
+
208
+ ```bash
209
+ # Verify git is installed and on PATH
210
+ git --version
211
+
212
+ # Install if missing:
213
+ # macOS: xcode-select --install
214
+ # Linux: apt install git
215
+ # Windows: https://git-scm.com/download/win
216
+ ```
217
+
218
+ ---
219
+
220
+ ### Indexing is slow
221
+
222
+ - First index is always slower — subsequent runs are incremental (hash-based)
223
+ - AI summarization (`allowRemoteAI: true`) adds API latency — disable during testing
224
+ - Semantic indexing adds API latency — disable if not needed
225
+ - For large repos (> 10k files): increase `workerThreads` in config
226
+
227
+ ---
228
+
229
+ ## Re-indexing from scratch
230
+
231
+ ```
232
+ Use invalidate_cache tool with your repoId, then call index_folder again.
233
+ ```
234
+
235
+ Or manually:
236
+
237
+ ```bash
238
+ rm ~/.purecontext/indexes/<repoId>.db
239
+ rm -rf ~/.purecontext/indexes/<repoId>/
240
+ ```
241
+
242
+ Then call `index_folder` — a clean full index will be built.
243
+
244
+ ---
245
+
246
+ ## Getting more help
247
+
248
+ - **GitHub Issues:** Report bugs with version, OS, Node.js version, error log, and approximate repo size
249
+ - **`--log-level debug`** output is the most useful information to include in a bug report
@@ -0,0 +1,88 @@
1
+ # Bundled tree-sitter grammars (`*.wasm`)
2
+
3
+ PureContext parses source with **`web-tree-sitter` (WASM) on every supported Node
4
+ version** — there is no native parsing path (see `src/core/parse-dispatcher.ts`).
5
+ All language handlers load a precompiled `.wasm` grammar from this directory via
6
+ `grammarPath()`; e.g. `src/handlers/dart.ts` → `tree-sitter-dart.wasm`.
7
+
8
+ These `.wasm` files are **committed to the repo and shipped in the npm package**
9
+ (`grammars/` is in `package.json` `files`). Because of this, the per-language
10
+ `tree-sitter-*` npm packages are **not** runtime or build dependencies — they are
11
+ only *sources* used to regenerate a `.wasm` when a grammar needs an update.
12
+
13
+ Keeping them out of `package.json` is deliberate: every `tree-sitter-*` package is
14
+ a native addon that triggers `node-gyp` at install time, which requires platform
15
+ C/C++ build tools (MSVC on Windows, etc.). Listing them as dependencies made
16
+ `npm ci` — in CI and for end users running `npm install purecontext-mcp` — fail on
17
+ any machine without a toolchain. The committed `.wasm` files make installation
18
+ toolchain-free.
19
+
20
+ > The one genuinely-native dependency is `better-sqlite3`, which ships prebuilt
21
+ > binaries (no `node-gyp`) for Node 18/20/22 and falls back to
22
+ > `@sqlite.org/sqlite-wasm` otherwise. That split is intentional and unrelated to
23
+ > tree-sitter.
24
+
25
+ ## Grammar → source package
26
+
27
+ | `.wasm` file | npm source package | version |
28
+ |-------------------------------|------------------------------|----------|
29
+ | `tree-sitter-bash.wasm` | `tree-sitter-bash` | ^0.23.3 |
30
+ | `tree-sitter-c.wasm` | `tree-sitter-c` | ^0.23.2 |
31
+ | `tree-sitter-cpp.wasm` | `tree-sitter-cpp` | ^0.23.4 |
32
+ | `tree-sitter-csharp.wasm` | `tree-sitter-c-sharp` | ^0.23.1 |
33
+ | `tree-sitter-dart.wasm` | `tree-sitter-dart` | ^1.0.0 |
34
+ | `tree-sitter-elixir.wasm` | `tree-sitter-elixir` | ^0.3.5 |
35
+ | `tree-sitter-go.wasm` | `tree-sitter-go` | ^0.23.4 |
36
+ | `tree-sitter-haskell.wasm` | `tree-sitter-haskell` | ^0.23.1 |
37
+ | `tree-sitter-java.wasm` | `tree-sitter-java` | ^0.23.5 |
38
+ | `tree-sitter-javascript.wasm` | `tree-sitter-javascript` | ^0.25.0 |
39
+ | `tree-sitter-kotlin.wasm` | `tree-sitter-kotlin` | ^0.3.8 |
40
+ | `tree-sitter-lua.wasm` | `tree-sitter-lua` | ^2.0.0 |
41
+ | `tree-sitter-perl.wasm` | `tree-sitter-perl` | ^1.0.0 |
42
+ | `tree-sitter-php.wasm` | `tree-sitter-php` | ^0.23.12 |
43
+ | `tree-sitter-python.wasm` | `tree-sitter-python` | ^0.23.6 |
44
+ | `tree-sitter-r.wasm` | `@davisvaughan/tree-sitter-r`| ^1.2.0 |
45
+ | `tree-sitter-ruby.wasm` | `tree-sitter-ruby` | ^0.23.1 |
46
+ | `tree-sitter-rust.wasm` | `tree-sitter-rust` | ^0.24.0 |
47
+ | `tree-sitter-scala.wasm` | `tree-sitter-scala` | ^0.24.0 |
48
+ | `tree-sitter-swift.wasm` | `tree-sitter-swift` | ^0.7.1 |
49
+ | `tree-sitter-tsx.wasm` | `tree-sitter-typescript` (`tsx/` subdir) | ^0.23.2 |
50
+ | `tree-sitter-typescript.wasm` | `tree-sitter-typescript` (`typescript/` subdir) | ^0.23.2 |
51
+
52
+ Notes:
53
+ - `tree-sitter-typescript` is a multi-grammar package: it produces **two** `.wasm`
54
+ files, one from its `typescript/` subdirectory and one from `tsx/`.
55
+ - The `tree-sitter.wasm` runtime core is *not* in this table — it ships inside the
56
+ `web-tree-sitter` package and is located at runtime (`parse-dispatcher.ts`).
57
+
58
+ ## Regenerating a `.wasm`
59
+
60
+ You only need this when bumping a grammar version or adding a language. It needs
61
+ [Emscripten](https://emscripten.org/) (`emcc` on `PATH`) or Docker, which the
62
+ `tree-sitter` CLI uses to compile the grammar to WASM.
63
+
64
+ ```bash
65
+ # 1. Install the tree-sitter CLI and the single grammar you are rebuilding.
66
+ # (Do NOT add these to package.json — install them ad hoc.)
67
+ npm i -g tree-sitter-cli@0.23 # match the CLI to the grammar's ABI
68
+ npm i tree-sitter-dart@1.0.0 # the grammar source you want to rebuild
69
+
70
+ # 2. Build the grammar to WASM from its package directory.
71
+ # tree-sitter CLI >= 0.23:
72
+ tree-sitter build --wasm node_modules/tree-sitter-dart
73
+ # (older CLI used the now-deprecated `tree-sitter build-wasm` form)
74
+
75
+ # 3. Move the produced tree-sitter-dart.wasm into this directory, overwriting
76
+ # the committed copy, then commit it.
77
+ mv tree-sitter-dart.wasm grammars/
78
+
79
+ # 4. For multi-grammar packages, point the CLI at each subdirectory:
80
+ tree-sitter build --wasm node_modules/tree-sitter-typescript/typescript
81
+ tree-sitter build --wasm node_modules/tree-sitter-typescript/tsx
82
+
83
+ # 5. Sanity-check the new grammar loads and parses:
84
+ npm run build && npm test
85
+ ```
86
+
87
+ After regenerating, uninstall the ad-hoc grammar package so it doesn't leak back
88
+ into `package.json` / the lockfile.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "purecontext-mcp",
3
- "version": "1.5.2",
4
- "description": "Token-efficient source code navigation MCP server for AI agents",
3
+ "version": "1.11.0",
4
+ "description": "Change-aware code intelligence for AI coding agents (MCP): blast radius, temporal co-change, and per-symbol risk before the edit — built on token-efficient code navigation",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -33,7 +33,6 @@
33
33
  "scripts/check-sqlite.js",
34
34
  "README.md",
35
35
  "AGENT_INSTRUCTIONS.md",
36
- "AGENT_INSTRUCTIONS_SHORT.md",
37
36
  "AGENT_REFERENCE.md",
38
37
  "AI-SUMMARIES.md",
39
38
  "AST-SEARCH.md",
@@ -69,7 +68,7 @@
69
68
  "./package.json": "./package.json"
70
69
  },
71
70
  "bin": {
72
- "purecontext-mcp": "./dist/index.js"
71
+ "purecontext-mcp": "./dist/bin.js"
73
72
  },
74
73
  "scripts": {
75
74
  "build": "npm run build:server && npm run build:ui",
@@ -88,8 +87,12 @@
88
87
  "prepublishOnly": "npm run build && npm test",
89
88
  "postinstall": "node scripts/check-sqlite.js"
90
89
  },
90
+ "overrides": {
91
+ "shell-quote": "1.8.4"
92
+ },
91
93
  "dependencies": {
92
94
  "@modelcontextprotocol/sdk": "^1.0.0",
95
+ "@sqlite.org/sqlite-wasm": "3.53.0-build1",
93
96
  "@types/js-yaml": "^4.0.9",
94
97
  "better-sqlite3": "^11.9.0",
95
98
  "chokidar": "^3.6.0",
@@ -97,23 +100,10 @@
97
100
  "ignore": "^7.0.5",
98
101
  "js-yaml": "^4.1.1",
99
102
  "minimatch": "^9.0.9",
100
- "tree-sitter-c": "^0.23.2",
101
- "tree-sitter-c-sharp": "^0.23.1",
102
- "tree-sitter-dart": "^1.0.0",
103
- "tree-sitter-go": "^0.23.4",
104
- "tree-sitter-haskell": "^0.23.1",
105
- "tree-sitter-java": "^0.23.5",
106
- "tree-sitter-javascript": "^0.25.0",
107
- "tree-sitter-kotlin": "^0.3.8",
108
- "tree-sitter-python": "^0.23.6",
109
- "tree-sitter-rust": "^0.24.0",
110
- "tree-sitter-swift": "^0.7.1",
111
- "tree-sitter-typescript": "^0.23.2",
112
103
  "web-tree-sitter": "^0.22.6",
113
104
  "zod": "^4.3.6"
114
105
  },
115
106
  "devDependencies": {
116
- "@davisvaughan/tree-sitter-r": "^1.2.0",
117
107
  "@playwright/test": "^1.59.1",
118
108
  "@types/better-sqlite3": "^7.6.8",
119
109
  "@types/node": "^20.19.39",
@@ -124,14 +114,6 @@
124
114
  "gpt-tokenizer": "^2.9.0",
125
115
  "node-gyp": "^11.0.0",
126
116
  "prebuildify": "^6.0.1",
127
- "tree-sitter-bash": "^0.23.3",
128
- "tree-sitter-cpp": "^0.23.4",
129
- "tree-sitter-elixir": "^0.3.5",
130
- "tree-sitter-lua": "^2.0.0",
131
- "tree-sitter-perl": "^1.0.0",
132
- "tree-sitter-php": "^0.23.12",
133
- "tree-sitter-ruby": "^0.23.1",
134
- "tree-sitter-scala": "^0.24.0",
135
117
  "tsx": "^4.21.0",
136
118
  "typescript": "^5.5.0",
137
119
  "vitest": "^1.6.0"