contextpro-mcp 0.0.0-stage → 1.4.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 (466) hide show
  1. package/CHANGELOG.md +416 -0
  2. package/INSTALL.md +128 -0
  3. package/INSTRUCTIONS.md +33 -0
  4. package/LICENSE +21 -0
  5. package/NOTICE +12 -0
  6. package/README.md +164 -2
  7. package/SECURITY.md +27 -0
  8. package/agent-guide.md +323 -0
  9. package/agent-instructions.md +1 -0
  10. package/build/core/agent-setup.d.ts +5 -0
  11. package/build/core/agent-setup.d.ts.map +1 -0
  12. package/build/core/agent-setup.js +94 -0
  13. package/build/core/agent-setup.js.map +1 -0
  14. package/build/core/artifacts.d.ts +64 -0
  15. package/build/core/artifacts.d.ts.map +1 -0
  16. package/build/core/artifacts.js +370 -0
  17. package/build/core/artifacts.js.map +1 -0
  18. package/build/core/bounded-source.d.ts +15 -0
  19. package/build/core/bounded-source.d.ts.map +1 -0
  20. package/build/core/bounded-source.js +78 -0
  21. package/build/core/bounded-source.js.map +1 -0
  22. package/build/core/changed-since.d.ts +20 -0
  23. package/build/core/changed-since.d.ts.map +1 -0
  24. package/build/core/changed-since.js +43 -0
  25. package/build/core/changed-since.js.map +1 -0
  26. package/build/core/chat-model.d.ts +8 -0
  27. package/build/core/chat-model.d.ts.map +1 -0
  28. package/build/core/chat-model.js +135 -0
  29. package/build/core/chat-model.js.map +1 -0
  30. package/build/core/clustering.d.ts +6 -0
  31. package/build/core/clustering.d.ts.map +1 -0
  32. package/build/core/clustering.js +201 -0
  33. package/build/core/clustering.js.map +1 -0
  34. package/build/core/context-metadata.d.ts +50 -0
  35. package/build/core/context-metadata.d.ts.map +1 -0
  36. package/build/core/context-metadata.js +118 -0
  37. package/build/core/context-metadata.js.map +1 -0
  38. package/build/core/data-dir.d.ts +5 -0
  39. package/build/core/data-dir.d.ts.map +1 -0
  40. package/build/core/data-dir.js +53 -0
  41. package/build/core/data-dir.js.map +1 -0
  42. package/build/core/db-native.d.ts +28 -0
  43. package/build/core/db-native.d.ts.map +1 -0
  44. package/build/core/db-native.js +120 -0
  45. package/build/core/db-native.js.map +1 -0
  46. package/build/core/db.d.ts +294 -0
  47. package/build/core/db.d.ts.map +1 -0
  48. package/build/core/db.js +1047 -0
  49. package/build/core/db.js.map +1 -0
  50. package/build/core/doctor.d.ts +13 -0
  51. package/build/core/doctor.d.ts.map +1 -0
  52. package/build/core/doctor.js +55 -0
  53. package/build/core/doctor.js.map +1 -0
  54. package/build/core/efficiency.d.ts +16 -0
  55. package/build/core/efficiency.d.ts.map +1 -0
  56. package/build/core/efficiency.js +170 -0
  57. package/build/core/efficiency.js.map +1 -0
  58. package/build/core/embedding-tracker.d.ts +25 -0
  59. package/build/core/embedding-tracker.d.ts.map +1 -0
  60. package/build/core/embedding-tracker.js +228 -0
  61. package/build/core/embedding-tracker.js.map +1 -0
  62. package/build/core/embeddings.d.ts +90 -0
  63. package/build/core/embeddings.d.ts.map +1 -0
  64. package/build/core/embeddings.js +693 -0
  65. package/build/core/embeddings.js.map +1 -0
  66. package/build/core/evidence-state.d.ts +42 -0
  67. package/build/core/evidence-state.d.ts.map +1 -0
  68. package/build/core/evidence-state.js +153 -0
  69. package/build/core/evidence-state.js.map +1 -0
  70. package/build/core/extractor-stamp.d.ts +10 -0
  71. package/build/core/extractor-stamp.d.ts.map +1 -0
  72. package/build/core/extractor-stamp.js +51 -0
  73. package/build/core/extractor-stamp.js.map +1 -0
  74. package/build/core/feature-brief-cache.d.ts +37 -0
  75. package/build/core/feature-brief-cache.d.ts.map +1 -0
  76. package/build/core/feature-brief-cache.js +100 -0
  77. package/build/core/feature-brief-cache.js.map +1 -0
  78. package/build/core/file-fingerprint.d.ts +15 -0
  79. package/build/core/file-fingerprint.d.ts.map +1 -0
  80. package/build/core/file-fingerprint.js +24 -0
  81. package/build/core/file-fingerprint.js.map +1 -0
  82. package/build/core/graph-analytics.d.ts +46 -0
  83. package/build/core/graph-analytics.d.ts.map +1 -0
  84. package/build/core/graph-analytics.js +371 -0
  85. package/build/core/graph-analytics.js.map +1 -0
  86. package/build/core/hub.d.ts +23 -0
  87. package/build/core/hub.d.ts.map +1 -0
  88. package/build/core/hub.js +123 -0
  89. package/build/core/hub.js.map +1 -0
  90. package/build/core/ignore-dirs.d.ts +7 -0
  91. package/build/core/ignore-dirs.d.ts.map +1 -0
  92. package/build/core/ignore-dirs.js +84 -0
  93. package/build/core/ignore-dirs.js.map +1 -0
  94. package/build/core/index-freshness.d.ts +15 -0
  95. package/build/core/index-freshness.d.ts.map +1 -0
  96. package/build/core/index-freshness.js +96 -0
  97. package/build/core/index-freshness.js.map +1 -0
  98. package/build/core/index-reconcile.d.ts +28 -0
  99. package/build/core/index-reconcile.d.ts.map +1 -0
  100. package/build/core/index-reconcile.js +129 -0
  101. package/build/core/index-reconcile.js.map +1 -0
  102. package/build/core/local-daemon.d.ts +5 -0
  103. package/build/core/local-daemon.d.ts.map +1 -0
  104. package/build/core/local-daemon.js +282 -0
  105. package/build/core/local-daemon.js.map +1 -0
  106. package/build/core/memory-graph.d.ts +68 -0
  107. package/build/core/memory-graph.d.ts.map +1 -0
  108. package/build/core/memory-graph.js +152 -0
  109. package/build/core/memory-graph.js.map +1 -0
  110. package/build/core/native-repair.d.ts +12 -0
  111. package/build/core/native-repair.d.ts.map +1 -0
  112. package/build/core/native-repair.js +167 -0
  113. package/build/core/native-repair.js.map +1 -0
  114. package/build/core/native-runtime.d.ts +12 -0
  115. package/build/core/native-runtime.d.ts.map +1 -0
  116. package/build/core/native-runtime.js +38 -0
  117. package/build/core/native-runtime.js.map +1 -0
  118. package/build/core/pagerank.d.ts +29 -0
  119. package/build/core/pagerank.d.ts.map +1 -0
  120. package/build/core/pagerank.js +90 -0
  121. package/build/core/pagerank.js.map +1 -0
  122. package/build/core/parser-process.d.ts +21 -0
  123. package/build/core/parser-process.d.ts.map +1 -0
  124. package/build/core/parser-process.js +103 -0
  125. package/build/core/parser-process.js.map +1 -0
  126. package/build/core/parser-worker.d.ts +2 -0
  127. package/build/core/parser-worker.d.ts.map +1 -0
  128. package/build/core/parser-worker.js +17 -0
  129. package/build/core/parser-worker.js.map +1 -0
  130. package/build/core/parser.d.ts +66 -0
  131. package/build/core/parser.d.ts.map +1 -0
  132. package/build/core/parser.js +750 -0
  133. package/build/core/parser.js.map +1 -0
  134. package/build/core/path-guard.d.ts +6 -0
  135. package/build/core/path-guard.d.ts.map +1 -0
  136. package/build/core/path-guard.js +55 -0
  137. package/build/core/path-guard.js.map +1 -0
  138. package/build/core/process-lifecycle.d.ts +30 -0
  139. package/build/core/process-lifecycle.d.ts.map +1 -0
  140. package/build/core/process-lifecycle.js +129 -0
  141. package/build/core/process-lifecycle.js.map +1 -0
  142. package/build/core/project-config.d.ts +83 -0
  143. package/build/core/project-config.d.ts.map +1 -0
  144. package/build/core/project-config.js +302 -0
  145. package/build/core/project-config.js.map +1 -0
  146. package/build/core/project-graph.d.ts +69 -0
  147. package/build/core/project-graph.d.ts.map +1 -0
  148. package/build/core/project-graph.js +874 -0
  149. package/build/core/project-graph.js.map +1 -0
  150. package/build/core/provider-config.d.ts +15 -0
  151. package/build/core/provider-config.d.ts.map +1 -0
  152. package/build/core/provider-config.js +67 -0
  153. package/build/core/provider-config.js.map +1 -0
  154. package/build/core/provider-usage.d.ts +21 -0
  155. package/build/core/provider-usage.d.ts.map +1 -0
  156. package/build/core/provider-usage.js +52 -0
  157. package/build/core/provider-usage.js.map +1 -0
  158. package/build/core/python-language-server.d.ts +23 -0
  159. package/build/core/python-language-server.d.ts.map +1 -0
  160. package/build/core/python-language-server.js +217 -0
  161. package/build/core/python-language-server.js.map +1 -0
  162. package/build/core/python-runtime-identity.d.ts +3 -0
  163. package/build/core/python-runtime-identity.d.ts.map +1 -0
  164. package/build/core/python-runtime-identity.js +53 -0
  165. package/build/core/python-runtime-identity.js.map +1 -0
  166. package/build/core/reconcile-scheduler.d.ts +20 -0
  167. package/build/core/reconcile-scheduler.d.ts.map +1 -0
  168. package/build/core/reconcile-scheduler.js +58 -0
  169. package/build/core/reconcile-scheduler.js.map +1 -0
  170. package/build/core/request-context.d.ts +7 -0
  171. package/build/core/request-context.d.ts.map +1 -0
  172. package/build/core/request-context.js +17 -0
  173. package/build/core/request-context.js.map +1 -0
  174. package/build/core/request-root.d.ts +19 -0
  175. package/build/core/request-root.d.ts.map +1 -0
  176. package/build/core/request-root.js +26 -0
  177. package/build/core/request-root.js.map +1 -0
  178. package/build/core/root-guard.d.ts +8 -0
  179. package/build/core/root-guard.d.ts.map +1 -0
  180. package/build/core/root-guard.js +53 -0
  181. package/build/core/root-guard.js.map +1 -0
  182. package/build/core/roots-detect.d.ts +17 -0
  183. package/build/core/roots-detect.d.ts.map +1 -0
  184. package/build/core/roots-detect.js +63 -0
  185. package/build/core/roots-detect.js.map +1 -0
  186. package/build/core/runtime-session.d.ts +5 -0
  187. package/build/core/runtime-session.d.ts.map +1 -0
  188. package/build/core/runtime-session.js +10 -0
  189. package/build/core/runtime-session.js.map +1 -0
  190. package/build/core/scip-index.d.ts +71 -0
  191. package/build/core/scip-index.d.ts.map +1 -0
  192. package/build/core/scip-index.js +343 -0
  193. package/build/core/scip-index.js.map +1 -0
  194. package/build/core/semantic-diff.d.ts +32 -0
  195. package/build/core/semantic-diff.d.ts.map +1 -0
  196. package/build/core/semantic-diff.js +259 -0
  197. package/build/core/semantic-diff.js.map +1 -0
  198. package/build/core/source-context.d.ts +3 -0
  199. package/build/core/source-context.d.ts.map +1 -0
  200. package/build/core/source-context.js +86 -0
  201. package/build/core/source-context.js.map +1 -0
  202. package/build/core/source-mask.d.ts +8 -0
  203. package/build/core/source-mask.d.ts.map +1 -0
  204. package/build/core/source-mask.js +156 -0
  205. package/build/core/source-mask.js.map +1 -0
  206. package/build/core/source-mutation.d.ts +16 -0
  207. package/build/core/source-mutation.d.ts.map +1 -0
  208. package/build/core/source-mutation.js +193 -0
  209. package/build/core/source-mutation.js.map +1 -0
  210. package/build/core/sql-schema.d.ts +59 -0
  211. package/build/core/sql-schema.d.ts.map +1 -0
  212. package/build/core/sql-schema.js +218 -0
  213. package/build/core/sql-schema.js.map +1 -0
  214. package/build/core/startup-health.d.ts +40 -0
  215. package/build/core/startup-health.d.ts.map +1 -0
  216. package/build/core/startup-health.js +132 -0
  217. package/build/core/startup-health.js.map +1 -0
  218. package/build/core/team-ledger.d.ts +60 -0
  219. package/build/core/team-ledger.d.ts.map +1 -0
  220. package/build/core/team-ledger.js +171 -0
  221. package/build/core/team-ledger.js.map +1 -0
  222. package/build/core/test-impact.d.ts +23 -0
  223. package/build/core/test-impact.d.ts.map +1 -0
  224. package/build/core/test-impact.js +131 -0
  225. package/build/core/test-impact.js.map +1 -0
  226. package/build/core/tool-metrics.d.ts +29 -0
  227. package/build/core/tool-metrics.d.ts.map +1 -0
  228. package/build/core/tool-metrics.js +74 -0
  229. package/build/core/tool-metrics.js.map +1 -0
  230. package/build/core/tool-profile.d.ts +12 -0
  231. package/build/core/tool-profile.d.ts.map +1 -0
  232. package/build/core/tool-profile.js +102 -0
  233. package/build/core/tool-profile.js.map +1 -0
  234. package/build/core/tool-trace.d.ts +8 -0
  235. package/build/core/tool-trace.d.ts.map +1 -0
  236. package/build/core/tool-trace.js +70 -0
  237. package/build/core/tool-trace.js.map +1 -0
  238. package/build/core/tree-sitter-runtime.d.ts +20 -0
  239. package/build/core/tree-sitter-runtime.d.ts.map +1 -0
  240. package/build/core/tree-sitter-runtime.js +324 -0
  241. package/build/core/tree-sitter-runtime.js.map +1 -0
  242. package/build/core/tree-sitter.d.ts +6 -0
  243. package/build/core/tree-sitter.d.ts.map +1 -0
  244. package/build/core/tree-sitter.js +24 -0
  245. package/build/core/tree-sitter.js.map +1 -0
  246. package/build/core/typescript-reference-process.d.ts +30 -0
  247. package/build/core/typescript-reference-process.d.ts.map +1 -0
  248. package/build/core/typescript-reference-process.js +124 -0
  249. package/build/core/typescript-reference-process.js.map +1 -0
  250. package/build/core/typescript-reference-worker.d.ts +2 -0
  251. package/build/core/typescript-reference-worker.d.ts.map +1 -0
  252. package/build/core/typescript-reference-worker.js +14 -0
  253. package/build/core/typescript-reference-worker.js.map +1 -0
  254. package/build/core/typescript-references.d.ts +71 -0
  255. package/build/core/typescript-references.d.ts.map +1 -0
  256. package/build/core/typescript-references.js +392 -0
  257. package/build/core/typescript-references.js.map +1 -0
  258. package/build/core/typescript-skeleton.d.ts +5 -0
  259. package/build/core/typescript-skeleton.d.ts.map +1 -0
  260. package/build/core/typescript-skeleton.js +49 -0
  261. package/build/core/typescript-skeleton.js.map +1 -0
  262. package/build/core/walker.d.ts +16 -0
  263. package/build/core/walker.d.ts.map +1 -0
  264. package/build/core/walker.js +152 -0
  265. package/build/core/walker.js.map +1 -0
  266. package/build/core/workspace-router.d.ts +28 -0
  267. package/build/core/workspace-router.d.ts.map +1 -0
  268. package/build/core/workspace-router.js +93 -0
  269. package/build/core/workspace-router.js.map +1 -0
  270. package/build/core/worktree-gc.d.ts +16 -0
  271. package/build/core/worktree-gc.d.ts.map +1 -0
  272. package/build/core/worktree-gc.js +69 -0
  273. package/build/core/worktree-gc.js.map +1 -0
  274. package/build/core/worktree-overlay.d.ts +22 -0
  275. package/build/core/worktree-overlay.d.ts.map +1 -0
  276. package/build/core/worktree-overlay.js +84 -0
  277. package/build/core/worktree-overlay.js.map +1 -0
  278. package/build/core/worktree-root-guard.d.ts +8 -0
  279. package/build/core/worktree-root-guard.d.ts.map +1 -0
  280. package/build/core/worktree-root-guard.js +82 -0
  281. package/build/core/worktree-root-guard.js.map +1 -0
  282. package/build/core/worktree-seed.d.ts +14 -0
  283. package/build/core/worktree-seed.d.ts.map +1 -0
  284. package/build/core/worktree-seed.js +98 -0
  285. package/build/core/worktree-seed.js.map +1 -0
  286. package/build/git/shadow.d.ts +40 -0
  287. package/build/git/shadow.d.ts.map +1 -0
  288. package/build/git/shadow.js +298 -0
  289. package/build/git/shadow.js.map +1 -0
  290. package/build/index.d.ts +3 -0
  291. package/build/index.d.ts.map +1 -0
  292. package/build/index.js +599 -0
  293. package/build/index.js.map +1 -0
  294. package/build/tools/agentic-context.d.ts +86 -0
  295. package/build/tools/agentic-context.d.ts.map +1 -0
  296. package/build/tools/agentic-context.js +1546 -0
  297. package/build/tools/agentic-context.js.map +1 -0
  298. package/build/tools/blast-radius.d.ts +24 -0
  299. package/build/tools/blast-radius.d.ts.map +1 -0
  300. package/build/tools/blast-radius.js +231 -0
  301. package/build/tools/blast-radius.js.map +1 -0
  302. package/build/tools/changed-since.d.ts +7 -0
  303. package/build/tools/changed-since.d.ts.map +1 -0
  304. package/build/tools/changed-since.js +68 -0
  305. package/build/tools/changed-since.js.map +1 -0
  306. package/build/tools/compiler-actions.d.ts +26 -0
  307. package/build/tools/compiler-actions.d.ts.map +1 -0
  308. package/build/tools/compiler-actions.js +121 -0
  309. package/build/tools/compiler-actions.js.map +1 -0
  310. package/build/tools/context-tree.d.ts +9 -0
  311. package/build/tools/context-tree.d.ts.map +1 -0
  312. package/build/tools/context-tree.js +131 -0
  313. package/build/tools/context-tree.js.map +1 -0
  314. package/build/tools/context.d.ts +37 -0
  315. package/build/tools/context.d.ts.map +1 -0
  316. package/build/tools/context.js +800 -0
  317. package/build/tools/context.js.map +1 -0
  318. package/build/tools/diff.d.ts +9 -0
  319. package/build/tools/diff.d.ts.map +1 -0
  320. package/build/tools/diff.js +176 -0
  321. package/build/tools/diff.js.map +1 -0
  322. package/build/tools/directory-prior.d.ts +16 -0
  323. package/build/tools/directory-prior.d.ts.map +1 -0
  324. package/build/tools/directory-prior.js +121 -0
  325. package/build/tools/directory-prior.js.map +1 -0
  326. package/build/tools/discovery-documents.d.ts +11 -0
  327. package/build/tools/discovery-documents.d.ts.map +1 -0
  328. package/build/tools/discovery-documents.js +71 -0
  329. package/build/tools/discovery-documents.js.map +1 -0
  330. package/build/tools/discovery-hints.d.ts +25 -0
  331. package/build/tools/discovery-hints.d.ts.map +1 -0
  332. package/build/tools/discovery-hints.js +329 -0
  333. package/build/tools/discovery-hints.js.map +1 -0
  334. package/build/tools/efficiency-report.d.ts +13 -0
  335. package/build/tools/efficiency-report.d.ts.map +1 -0
  336. package/build/tools/efficiency-report.js +78 -0
  337. package/build/tools/efficiency-report.js.map +1 -0
  338. package/build/tools/evidence-retrieval.d.ts +33 -0
  339. package/build/tools/evidence-retrieval.d.ts.map +1 -0
  340. package/build/tools/evidence-retrieval.js +200 -0
  341. package/build/tools/evidence-retrieval.js.map +1 -0
  342. package/build/tools/exact-references.d.ts +10 -0
  343. package/build/tools/exact-references.d.ts.map +1 -0
  344. package/build/tools/exact-references.js +349 -0
  345. package/build/tools/exact-references.js.map +1 -0
  346. package/build/tools/explain.d.ts +14 -0
  347. package/build/tools/explain.d.ts.map +1 -0
  348. package/build/tools/explain.js +370 -0
  349. package/build/tools/explain.js.map +1 -0
  350. package/build/tools/feature-brief.d.ts +7 -0
  351. package/build/tools/feature-brief.d.ts.map +1 -0
  352. package/build/tools/feature-brief.js +89 -0
  353. package/build/tools/feature-brief.js.map +1 -0
  354. package/build/tools/feature-hub.d.ts +15 -0
  355. package/build/tools/feature-hub.d.ts.map +1 -0
  356. package/build/tools/feature-hub.js +404 -0
  357. package/build/tools/feature-hub.js.map +1 -0
  358. package/build/tools/file-skeleton.d.ts +7 -0
  359. package/build/tools/file-skeleton.d.ts.map +1 -0
  360. package/build/tools/file-skeleton.js +190 -0
  361. package/build/tools/file-skeleton.js.map +1 -0
  362. package/build/tools/grep.d.ts +25 -0
  363. package/build/tools/grep.d.ts.map +1 -0
  364. package/build/tools/grep.js +341 -0
  365. package/build/tools/grep.js.map +1 -0
  366. package/build/tools/impact-delta.d.ts +7 -0
  367. package/build/tools/impact-delta.d.ts.map +1 -0
  368. package/build/tools/impact-delta.js +102 -0
  369. package/build/tools/impact-delta.js.map +1 -0
  370. package/build/tools/memory-tools.d.ts +69 -0
  371. package/build/tools/memory-tools.d.ts.map +1 -0
  372. package/build/tools/memory-tools.js +366 -0
  373. package/build/tools/memory-tools.js.map +1 -0
  374. package/build/tools/planning-helpers.d.ts +26 -0
  375. package/build/tools/planning-helpers.d.ts.map +1 -0
  376. package/build/tools/planning-helpers.js +269 -0
  377. package/build/tools/planning-helpers.js.map +1 -0
  378. package/build/tools/project-graph.d.ts +19 -0
  379. package/build/tools/project-graph.d.ts.map +1 -0
  380. package/build/tools/project-graph.js +259 -0
  381. package/build/tools/project-graph.js.map +1 -0
  382. package/build/tools/propose-commit.d.ts +9 -0
  383. package/build/tools/propose-commit.d.ts.map +1 -0
  384. package/build/tools/propose-commit.js +156 -0
  385. package/build/tools/propose-commit.js.map +1 -0
  386. package/build/tools/register-tools.d.ts +18 -0
  387. package/build/tools/register-tools.d.ts.map +1 -0
  388. package/build/tools/register-tools.js +1131 -0
  389. package/build/tools/register-tools.js.map +1 -0
  390. package/build/tools/reindex.d.ts +76 -0
  391. package/build/tools/reindex.d.ts.map +1 -0
  392. package/build/tools/reindex.js +871 -0
  393. package/build/tools/reindex.js.map +1 -0
  394. package/build/tools/related.d.ts +6 -0
  395. package/build/tools/related.d.ts.map +1 -0
  396. package/build/tools/related.js +143 -0
  397. package/build/tools/related.js.map +1 -0
  398. package/build/tools/repo-map.d.ts +59 -0
  399. package/build/tools/repo-map.d.ts.map +1 -0
  400. package/build/tools/repo-map.js +270 -0
  401. package/build/tools/repo-map.js.map +1 -0
  402. package/build/tools/resolve-symbol.d.ts +41 -0
  403. package/build/tools/resolve-symbol.d.ts.map +1 -0
  404. package/build/tools/resolve-symbol.js +250 -0
  405. package/build/tools/resolve-symbol.js.map +1 -0
  406. package/build/tools/retrieval-helpers.d.ts +35 -0
  407. package/build/tools/retrieval-helpers.d.ts.map +1 -0
  408. package/build/tools/retrieval-helpers.js +302 -0
  409. package/build/tools/retrieval-helpers.js.map +1 -0
  410. package/build/tools/scip-index.d.ts +12 -0
  411. package/build/tools/scip-index.d.ts.map +1 -0
  412. package/build/tools/scip-index.js +66 -0
  413. package/build/tools/scip-index.js.map +1 -0
  414. package/build/tools/scoped-discovery.d.ts +7 -0
  415. package/build/tools/scoped-discovery.d.ts.map +1 -0
  416. package/build/tools/scoped-discovery.js +89 -0
  417. package/build/tools/scoped-discovery.js.map +1 -0
  418. package/build/tools/search.d.ts +62 -0
  419. package/build/tools/search.d.ts.map +1 -0
  420. package/build/tools/search.js +419 -0
  421. package/build/tools/search.js.map +1 -0
  422. package/build/tools/semantic-diff.d.ts +7 -0
  423. package/build/tools/semantic-diff.d.ts.map +1 -0
  424. package/build/tools/semantic-diff.js +45 -0
  425. package/build/tools/semantic-diff.js.map +1 -0
  426. package/build/tools/semantic-identifiers.d.ts +51 -0
  427. package/build/tools/semantic-identifiers.d.ts.map +1 -0
  428. package/build/tools/semantic-identifiers.js +522 -0
  429. package/build/tools/semantic-identifiers.js.map +1 -0
  430. package/build/tools/semantic-navigate.d.ts +18 -0
  431. package/build/tools/semantic-navigate.d.ts.map +1 -0
  432. package/build/tools/semantic-navigate.js +413 -0
  433. package/build/tools/semantic-navigate.js.map +1 -0
  434. package/build/tools/semantic-search.d.ts +30 -0
  435. package/build/tools/semantic-search.d.ts.map +1 -0
  436. package/build/tools/semantic-search.js +466 -0
  437. package/build/tools/semantic-search.js.map +1 -0
  438. package/build/tools/sql-schema.d.ts +23 -0
  439. package/build/tools/sql-schema.d.ts.map +1 -0
  440. package/build/tools/sql-schema.js +155 -0
  441. package/build/tools/sql-schema.js.map +1 -0
  442. package/build/tools/static-analysis.d.ts +7 -0
  443. package/build/tools/static-analysis.d.ts.map +1 -0
  444. package/build/tools/static-analysis.js +331 -0
  445. package/build/tools/static-analysis.js.map +1 -0
  446. package/build/tools/status.d.ts +74 -0
  447. package/build/tools/status.d.ts.map +1 -0
  448. package/build/tools/status.js +227 -0
  449. package/build/tools/status.js.map +1 -0
  450. package/build/tools/symbolic-edit.d.ts +57 -0
  451. package/build/tools/symbolic-edit.d.ts.map +1 -0
  452. package/build/tools/symbolic-edit.js +500 -0
  453. package/build/tools/symbolic-edit.js.map +1 -0
  454. package/build/tools/test-impact.d.ts +7 -0
  455. package/build/tools/test-impact.d.ts.map +1 -0
  456. package/build/tools/test-impact.js +34 -0
  457. package/build/tools/test-impact.js.map +1 -0
  458. package/build/tools/test-map.d.ts +8 -0
  459. package/build/tools/test-map.d.ts.map +1 -0
  460. package/build/tools/test-map.js +75 -0
  461. package/build/tools/test-map.js.map +1 -0
  462. package/docs/README.md +26 -0
  463. package/docs/architecture.md +35 -0
  464. package/docs/configuration.md +178 -0
  465. package/docs/maintenance.md +77 -0
  466. package/package.json +80 -4
@@ -0,0 +1,84 @@
1
+ // Framework-aware directory ignore policy for indexing.
2
+ //
3
+ // FEATURE: The walker honors a project's `.gitignore`, but that's not enough on
4
+ // its own — many repos have an absent or incomplete `.gitignore`, and some heavy
5
+ // build/cache dirs (e.g. `target`, `.next`, `__pycache__`) are not always listed.
6
+ // This is the SAFETY NET: a curated set of dependency / build / cache / tooling
7
+ // directories, across the major languages and frameworks, that should never be
8
+ // indexed regardless of `.gitignore`. Skipping them keeps the index small and the
9
+ // reindex fast (it's the difference between indexing your code and indexing all of
10
+ // node_modules + target + .venv).
11
+ //
12
+ // `.gitignore` is applied SEPARATELY by the walker; this set composes with it.
13
+ // Exact directory names to always skip (matched case-sensitively by basename).
14
+ export const ALWAYS_IGNORE_DIRS = new Set([
15
+ // Version control
16
+ ".git", ".svn", ".hg", ".bzr", "CVS",
17
+ // JS/TS dependencies & package managers
18
+ "node_modules", "bower_components", ".pnp", ".yarn", ".pnpm-store",
19
+ // JS/TS build output & framework caches
20
+ // (bare "out" omitted — ambiguous; `.gitignore` handles it when it's build output)
21
+ "dist", "build", ".next", ".nuxt", ".svelte-kit", ".astro",
22
+ ".vercel", ".netlify", ".docusaurus", ".vitepress", ".angular",
23
+ "storybook-static", ".storybook-out",
24
+ // JS/TS tooling caches
25
+ ".cache", ".turbo", ".parcel-cache", ".vite", ".rollup.cache",
26
+ ".eslintcache", ".rpt2_cache",
27
+ // Test / coverage (generated output only)
28
+ // NOTE: "__snapshots__" is intentionally NOT here — Jest `.snap` files are
29
+ // checked-in, source-controlled test expectations, not generated build output;
30
+ // agents need to read/update them.
31
+ "coverage", ".nyc_output", ".vscode-test", "playwright-report",
32
+ "test-results",
33
+ // Python (bare "env" omitted — ambiguous; ".venv"/"venv" are conventional)
34
+ "__pycache__", ".venv", "venv", ".tox", ".nox",
35
+ ".mypy_cache", ".pytest_cache", ".ruff_cache", ".pytype",
36
+ ".eggs", ".hypothesis", "site-packages", ".pyenv",
37
+ // JVM (Java / Kotlin / Scala / Gradle / Maven)
38
+ // NOTE: bare "bin"/"out" are intentionally NOT here — they're too often real
39
+ // source dirs; `.gitignore` covers them when they're genuinely build output.
40
+ "target", ".gradle", ".settings", ".metadata",
41
+ ".idea", ".project", "out-tsc",
42
+ // Rust
43
+ // ("target" already covered above)
44
+ // Go
45
+ "vendor",
46
+ // Elixir / Erlang
47
+ "_build", ".elixir_ls",
48
+ // Dart / Flutter
49
+ ".dart_tool", ".flutter-plugins", ".pub-cache",
50
+ // iOS / CocoaPods / Carthage
51
+ "Pods", "Carthage", "DerivedData", ".swiftpm",
52
+ // PHP (Composer "vendor" already covered)
53
+ // Ruby
54
+ ".bundle",
55
+ // Infra / IaC
56
+ ".terraform", ".serverless", "cdk.out",
57
+ // Editor / OS / misc
58
+ ".DS_Store", ".vscode-test", ".history", ".vs",
59
+ ".contextpro", ".contextplus",
60
+ ]);
61
+ // Suffix patterns (glob-style `*.suffix`) matched against the basename. Kept small
62
+ // and specific so it can't accidentally swallow source directories.
63
+ // NOTE: `*.xcodeproj` / `*.xcworkspace` are intentionally NOT here — those bundles
64
+ // hold checked-in project configuration (project.pbxproj, workspace metadata) that
65
+ // agents need indexed, not generated build/cache content. `*.dSYM` (debug symbols)
66
+ // and `*.egg-info` (generated package metadata) are safe to skip.
67
+ const IGNORE_SUFFIXES = [
68
+ ".egg-info",
69
+ ".dSYM",
70
+ ];
71
+ /**
72
+ * Whether a directory basename should always be skipped during indexing,
73
+ * independent of `.gitignore`. Matches exact names and a few suffix globs.
74
+ */
75
+ export function isAlwaysIgnoredDir(name) {
76
+ if (ALWAYS_IGNORE_DIRS.has(name))
77
+ return true;
78
+ for (const suffix of IGNORE_SUFFIXES) {
79
+ if (name.endsWith(suffix) && name.length > suffix.length)
80
+ return true;
81
+ }
82
+ return false;
83
+ }
84
+ //# sourceMappingURL=ignore-dirs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ignore-dirs.js","sourceRoot":"","sources":["../../src/core/ignore-dirs.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,EAAE;AACF,gFAAgF;AAChF,iFAAiF;AACjF,kFAAkF;AAClF,gFAAgF;AAChF,+EAA+E;AAC/E,kFAAkF;AAClF,mFAAmF;AACnF,kCAAkC;AAClC,EAAE;AACF,+EAA+E;AAE/E,+EAA+E;AAC/E,MAAM,CAAC,MAAM,kBAAkB,GAAwB,IAAI,GAAG,CAAC;IAC7D,kBAAkB;IAClB,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK;IAEpC,wCAAwC;IACxC,cAAc,EAAE,kBAAkB,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa;IAElE,wCAAwC;IACxC,mFAAmF;IACnF,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ;IAC1D,SAAS,EAAE,UAAU,EAAE,aAAa,EAAE,YAAY,EAAE,UAAU;IAC9D,kBAAkB,EAAE,gBAAgB;IAEpC,uBAAuB;IACvB,QAAQ,EAAE,QAAQ,EAAE,eAAe,EAAE,OAAO,EAAE,eAAe;IAC7D,cAAc,EAAE,aAAa;IAE7B,2CAA2C;IAC3C,2EAA2E;IAC3E,+EAA+E;IAC/E,mCAAmC;IACnC,UAAU,EAAE,aAAa,EAAE,cAAc,EAAE,mBAAmB;IAC9D,cAAc;IAEd,4EAA4E;IAC5E,aAAa,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAC9C,aAAa,EAA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: boolean;
7
+ durationMs: number;
8
+ warning: string | null;
9
+ }
10
+ /**
11
+ * Coalesce concurrent checks inside this process. Cross-process writers are
12
+ * coordinated by the SQLite compare-and-set lock in quickRefresh/reindex.
13
+ */
14
+ export declare function ensureFreshIndex(rootDir: string): Promise<IndexFreshnessResult>;
15
+ //# sourceMappingURL=index-freshness.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-freshness.d.ts","sourceRoot":"","sources":["../../src/core/index-freshness.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAuED;;;GAGG;AACH,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAarF"}
@@ -0,0 +1,96 @@
1
+ // Shared pre-query freshness gate for structural code intelligence.
2
+ // FEATURE: Every graph reader observes current files without refresh stampedes.
3
+ import { resolve } from "path";
4
+ import { getDB } from "./db.js";
5
+ import { quickRefresh, reindex } from "../tools/reindex.js";
6
+ import { requestFreshness } from "./request-context.js";
7
+ import { sharedCompute } from "./local-daemon.js";
8
+ const refreshes = new Map();
9
+ function autoRefreshDisabled() {
10
+ const raw = (process.env.CONTEXTPRO_AUTO_REFRESH ?? process.env.CONTEXTPLUS_AUTO_REFRESH ?? "").trim().toLowerCase();
11
+ return raw === "0" || raw === "false" || raw === "no" || raw === "off";
12
+ }
13
+ async function runFreshnessCheck(rootDir) {
14
+ const shared = await sharedCompute("freshness", { rootDir });
15
+ if (shared)
16
+ return shared.value;
17
+ const startedAt = Date.now();
18
+ if (autoRefreshDisabled()) {
19
+ return {
20
+ checked: false,
21
+ refreshed: false,
22
+ fullReindex: false,
23
+ staleCount: 0,
24
+ waitedForIndexing: false,
25
+ durationMs: 0,
26
+ warning: "Automatic index refresh is disabled by CONTEXTPRO_AUTO_REFRESH.",
27
+ };
28
+ }
29
+ try {
30
+ const quick = await quickRefresh(rootDir, { includeEmbeddings: false });
31
+ let refreshed = quick.refreshed;
32
+ let fullReindex = quick.fullReindex === true;
33
+ let warning = quick.indexingTimedOut
34
+ ? "Index refresh timed out waiting for another process; serving the last complete index."
35
+ : null;
36
+ if (!quick.complete && !quick.indexingTimedOut) {
37
+ const db = await getDB(rootDir);
38
+ const generationBefore = db.getIndexGeneration();
39
+ await reindex({ rootDir, noEmbed: true, autoHubs: false });
40
+ refreshed = db.getIndexGeneration() > generationBefore;
41
+ fullReindex = refreshed;
42
+ const confirmation = await quickRefresh(rootDir, { includeEmbeddings: false });
43
+ refreshed = refreshed || confirmation.refreshed;
44
+ fullReindex = fullReindex || confirmation.fullReindex === true;
45
+ if (!confirmation.complete) {
46
+ warning = "A large source change was detected but the fallback reindex did not complete; serving the last complete index.";
47
+ }
48
+ }
49
+ return {
50
+ checked: true,
51
+ refreshed,
52
+ fullReindex,
53
+ staleCount: quick.staleCount,
54
+ waitedForIndexing: quick.waitedForIndexing === true,
55
+ durationMs: Date.now() - startedAt,
56
+ warning,
57
+ };
58
+ }
59
+ catch (error) {
60
+ const message = error instanceof Error ? error.message : String(error);
61
+ process.stderr.write(`[contextpro/freshness] refresh failed; serving last complete index: ${message}\n`);
62
+ return {
63
+ checked: true,
64
+ refreshed: false,
65
+ fullReindex: false,
66
+ staleCount: 0,
67
+ waitedForIndexing: false,
68
+ durationMs: Date.now() - startedAt,
69
+ warning: `Automatic index refresh failed: ${message}`,
70
+ };
71
+ }
72
+ }
73
+ /**
74
+ * Coalesce concurrent checks inside this process. Cross-process writers are
75
+ * coordinated by the SQLite compare-and-set lock in quickRefresh/reindex.
76
+ */
77
+ export async function ensureFreshIndex(rootDir) {
78
+ const normalizedRoot = resolve(rootDir);
79
+ const request = requestFreshness();
80
+ const existing = request?.get(normalizedRoot) ?? refreshes.get(normalizedRoot);
81
+ if (existing) {
82
+ request?.set(normalizedRoot, existing);
83
+ return existing;
84
+ }
85
+ const pending = runFreshnessCheck(normalizedRoot);
86
+ refreshes.set(normalizedRoot, pending);
87
+ request?.set(normalizedRoot, pending);
88
+ try {
89
+ return await pending;
90
+ }
91
+ finally {
92
+ if (refreshes.get(normalizedRoot) === pending)
93
+ refreshes.delete(normalizedRoot);
94
+ }
95
+ }
96
+ //# sourceMappingURL=index-freshness.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-freshness.js","sourceRoot":"","sources":["../../src/core/index-freshness.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,gFAAgF;AAEhF,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAYlD,MAAM,SAAS,GAAG,IAAI,GAAG,EAAyC,CAAC;AAEnE,SAAS,mBAAmB;IAC1B,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,uBAAuB,IAAI,OAAO,CAAC,GAAG,CAAC,wBAAwB,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACrH,OAAO,GAAG,KAAK,GAAG,IAAI,GAAG,KAAK,OAAO,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,KAAK,CAAC;AACzE,CAAC;AAED,KAAK,UAAU,iBAAiB,CAAC,OAAe;IAC9C,MAAM,MAAM,GAAG,MAAM,aAAa,CAAuB,WAAW,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;IACnF,IAAI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E,QAAQ,CAAC,CAAC;QAAC,OAAO,QAAQ,CAAC;IAAC,CAAC;IAC1E,MAAM,OAAO,GAAG,iBAAiB,CAAC,cAAc,CAAC,CAAC;IAClD,SAAS,CAAC,GAAG,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IACvC,OAAO,EAAE,GAAG,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IACtC,IAAI,CAAC;QACH,OAAO,MAAM,OAAO,CAAC;IACvB,CAAC;YAAS,CAAC;QACT,IAAI,SAAS,CAAC,GAAG,CAAC,cAAc,CAAC,KAAK,OAAO;YAAE,SAAS,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;IAClF,CAAC;AACH,CAAC"}
@@ -0,0 +1,28 @@
1
+ /** Drop a root's stat cache (e.g. on worktree GC) so it can't leak memory. */
2
+ export declare function forgetReconcileStatCache(rootDir: string): void;
3
+ export interface ReconcileOptions {
4
+ /** Maximum number of drifted files to refresh in a single sweep. */
5
+ maxFiles?: number;
6
+ }
7
+ export interface ReconcileResult {
8
+ /** Drifted files this sweep actually re-indexed (new + content-changed). */
9
+ refreshed: number;
10
+ /** Index entries pruned because the file no longer exists on disk. */
11
+ removed: number;
12
+ /** Total drifted files detected this sweep (may exceed `refreshed` when capped). */
13
+ drifted: number;
14
+ /** Drifted files left for a future sweep after the per-sweep cap was applied. */
15
+ pending: number;
16
+ /** `+path:name` / `-path:name` markers for symbols changed by the refresh. */
17
+ changedSymbols: string[];
18
+ }
19
+ /**
20
+ * Diff the on-disk source tree against the index and heal the difference.
21
+ *
22
+ * Returns counts so a caller (the embedding tracker) can decide whether to sweep
23
+ * again sooner to drain a backlog. Reads file content only for the candidate set
24
+ * required to compute hashes; callers gate *how often* this runs (e.g. skip while
25
+ * idle) — this function always does the full diff when invoked.
26
+ */
27
+ export declare function reconcileIndex(rootDir: string, options?: ReconcileOptions): Promise<ReconcileResult>;
28
+ //# sourceMappingURL=index-reconcile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-reconcile.d.ts","sourceRoot":"","sources":["../../src/core/index-reconcile.ts"],"names":[],"mappings":"AAiCA,8EAA8E;AAC9E,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE9D;AAED,MAAM,WAAW,gBAAgB;IAC/B,oEAAoE;IACpE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,eAAe;IAC9B,4EAA4E;IAC5E,SAAS,EAAE,MAAM,CAAC;IAClB,sEAAsE;IACtE,OAAO,EAAE,MAAM,CAAC;IAChB,oFAAoF;IACpF,OAAO,EAAE,MAAM,CAAC;IAChB,iFAAiF;IACjF,OAAO,EAAE,MAAM,CAAC;IAChB,8EAA8E;IAC9E,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B;AASD;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,gBAAqB,GAC7B,OAAO,CAAC,eAAe,CAAC,CAwF1B"}
@@ -0,0 +1,129 @@
1
+ // Self-healing index reconciliation — a periodic FS<->index diff that catches
2
+ // drift the FS-watch events miss.
3
+ //
4
+ // FEATURE: fs.watch is unreliable in practice — it does not recurse on Linux,
5
+ // drops events under heavy churn, and misses atomic renames and out-of-band git
6
+ // operations. A purely event-driven tracker therefore goes stale during a
7
+ // fast-moving session and forces a manual full reindex. This module reconciles
8
+ // the index against the real filesystem: new and content-drifted files are
9
+ // re-indexed through the same per-file structural pass the tracker already uses,
10
+ // and files deleted on disk are pruned. Work is capped per sweep so a large
11
+ // backlog drains over several cheap sweeps instead of one long stall.
12
+ import { readFile, stat } from "fs/promises";
13
+ import { getDB, hashContent } from "./db.js";
14
+ import { walkDirectory } from "./walker.js";
15
+ import { isSupportedFile } from "./parser.js";
16
+ import { resolveProjectPath } from "./path-guard.js";
17
+ import { refreshFilesStructural } from "../tools/reindex.js";
18
+ const fileStatCache = new Map();
19
+ function statCacheFor(rootDir) {
20
+ let m = fileStatCache.get(rootDir);
21
+ if (!m) {
22
+ m = new Map();
23
+ fileStatCache.set(rootDir, m);
24
+ }
25
+ return m;
26
+ }
27
+ /** Drop a root's stat cache (e.g. on worktree GC) so it can't leak memory. */
28
+ export function forgetReconcileStatCache(rootDir) {
29
+ fileStatCache.delete(rootDir);
30
+ }
31
+ const DEFAULT_MAX_FILES = 40;
32
+ function clampMaxFiles(value) {
33
+ if (!Number.isFinite(value) || (value ?? 0) <= 0)
34
+ return DEFAULT_MAX_FILES;
35
+ return Math.floor(value);
36
+ }
37
+ /**
38
+ * Diff the on-disk source tree against the index and heal the difference.
39
+ *
40
+ * Returns counts so a caller (the embedding tracker) can decide whether to sweep
41
+ * again sooner to drain a backlog. Reads file content only for the candidate set
42
+ * required to compute hashes; callers gate *how often* this runs (e.g. skip while
43
+ * idle) — this function always does the full diff when invoked.
44
+ */
45
+ export async function reconcileIndex(rootDir, options = {}) {
46
+ const maxFiles = clampMaxFiles(options.maxFiles);
47
+ const db = await getDB(rootDir);
48
+ // Index side: path -> stored content hash.
49
+ const indexedHashes = new Map();
50
+ for (const file of db.getAllFiles()) {
51
+ if (isSupportedFile(file.path))
52
+ indexedHashes.set(file.path, file.content_hash);
53
+ }
54
+ // Filesystem side: every supported source file currently on disk.
55
+ const entries = await walkDirectory({ rootDir, depthLimit: 0 });
56
+ const diskPaths = new Set();
57
+ const drifted = [];
58
+ const statCache = statCacheFor(rootDir);
59
+ let scanned = 0;
60
+ for (const entry of entries) {
61
+ if (entry.isDirectory || !isSupportedFile(entry.path))
62
+ continue;
63
+ diskPaths.add(entry.relativePath);
64
+ // Yield to the event loop periodically so the sweep never feels hung.
65
+ if (++scanned % 64 === 0)
66
+ await new Promise((resolve) => setImmediate(resolve));
67
+ const indexedHash = indexedHashes.get(entry.relativePath);
68
+ if (indexedHash === undefined) {
69
+ // Brand-new file the index has never seen.
70
+ drifted.push(entry.relativePath);
71
+ continue;
72
+ }
73
+ try {
74
+ const fullPath = resolveProjectPath(rootDir, entry.relativePath, "reconcile file");
75
+ // CHEAP pre-filter: stat first. If mtime+size match what we last saw for an
76
+ // already-indexed file, its content can't have changed — skip the expensive
77
+ // readFile + sha256 entirely. This is what makes idle sweeps near-free.
78
+ const st = await stat(fullPath);
79
+ const prev = statCache.get(entry.relativePath);
80
+ if (prev && prev.mtimeMs === st.mtimeMs && prev.ctimeMs === st.ctimeMs
81
+ && prev.size === st.size && prev.indexedHash === indexedHash) {
82
+ continue; // unchanged since last sweep — no hashing needed
83
+ }
84
+ // mtime/size changed (or first time we've seen it this session): hash to
85
+ // confirm a real content change before marking drift, then remember the stat.
86
+ const content = await readFile(fullPath, "utf-8");
87
+ if (hashContent(content) !== indexedHash) {
88
+ // A seen file is not necessarily reconciled: capped or failed refreshes
89
+ // must remain eligible next sweep even when its filesystem stat is stable.
90
+ statCache.delete(entry.relativePath);
91
+ drifted.push(entry.relativePath);
92
+ }
93
+ else {
94
+ statCache.set(entry.relativePath, { mtimeMs: st.mtimeMs, ctimeMs: st.ctimeMs, size: st.size, indexedHash });
95
+ }
96
+ }
97
+ catch {
98
+ // Unreadable (race with deletion / permissions) — let prune or the next
99
+ // sweep handle it rather than treating an error as drift.
100
+ statCache.delete(entry.relativePath);
101
+ }
102
+ }
103
+ // Prune index entries whose files are gone from disk.
104
+ const removedPaths = db.getRemovedFiles(diskPaths).filter((path) => isSupportedFile(path));
105
+ for (const path of removedPaths)
106
+ statCache.delete(path);
107
+ // Refresh up to the per-sweep cap; the remainder is reported as pending so the
108
+ // tracker can schedule a prompt follow-up sweep.
109
+ const batch = drifted.slice(0, maxFiles);
110
+ let refreshed = 0;
111
+ let removed = 0;
112
+ let changedSymbols = [];
113
+ if (batch.length > 0 || removedPaths.length > 0) {
114
+ // Deletions use the same writer lock, generation, and cache invalidation as
115
+ // updates. The mutation rechecks existence after acquiring the lock.
116
+ const result = await refreshFilesStructural(rootDir, batch, { removedPaths });
117
+ refreshed = result.indexed;
118
+ removed = result.removed ?? 0;
119
+ changedSymbols = result.changedSymbols;
120
+ }
121
+ return {
122
+ refreshed,
123
+ removed,
124
+ drifted: drifted.length,
125
+ pending: Math.max(0, drifted.length - refreshed),
126
+ changedSymbols,
127
+ };
128
+ }
129
+ //# sourceMappingURL=index-reconcile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-reconcile.js","sourceRoot":"","sources":["../../src/core/index-reconcile.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,kCAAkC;AAClC,EAAE;AACF,8EAA8E;AAC9E,gFAAgF;AAChF,0EAA0E;AAC1E,+EAA+E;AAC/E,2EAA2E;AAC3E,iFAAiF;AACjF,4EAA4E;AAC5E,sEAAsE;AAEtE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAQ7D,MAAM,aAAa,GAAG,IAAI,GAAG,EAA8C,CAAC;AAE5E,SAAS,YAAY,CAAC,OAAe;IACnC,IAAI,CAAC,GAAG,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACnC,IAAI,CAAC,CAAC,EAAE,CAAC;QAAC,CAAC,GAAG,IAAI,GAAG,EAAE,CAAC;QAAC,aAAa,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IAAC,CAAC;IACzD,OAAO,CAAC,CAAC;AACX,CAAC;AAED,8EAA8E;AAC9E,MAAM,UAAU,wBAAwB,CAAC,OAAe;IACtD,aAAa,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AAChC,CAAC;AAoBD,MAAM,iBAAiB,GAAG,EAAE,CAAC;A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QACP,OAAO,EAAE,OAAO,CAAC,MAAM;QACvB,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;QAChD,cAAc;KACf,CAAC;AACJ,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare function sharedCompute<T>(method: "freshness" | "references" | "reindex" | "quickRefresh" | "compiler" | "python", args: unknown): Promise<{
2
+ value: T;
3
+ } | undefined>;
4
+ export declare function daemonCommand(action: string): Promise<unknown>;
5
+ //# sourceMappingURL=local-daemon.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-daemon.d.ts","sourceRoot":"","sources":["../../src/core/local-daemon.ts"],"names":[],"mappings":"AAuEA,wBAAsB,aAAa,CAAC,CAAC,EAAE,MAAM,EAAE,WAAW,GAAG,YAAY,GAAG,SAAS,GAAG,cAAc,GAAG,UAAU,GAAG,QAAQ,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC;IAAE,KAAK,EAAE,CAAC,CAAA;CAAE,GAAG,SAAS,CAAC,CAOhL;AAED,wBAAsB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAoBpE"}