@saluzi/codegraph 0.2.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (658) hide show
  1. package/README.md +2 -2
  2. package/dist/bin/codegraph.d.ts +26 -0
  3. package/dist/bin/codegraph.d.ts.map +1 -0
  4. package/dist/bin/codegraph.js +2249 -0
  5. package/dist/bin/codegraph.js.map +1 -0
  6. package/dist/bin/command-supervision.d.ts +49 -0
  7. package/dist/bin/command-supervision.d.ts.map +1 -0
  8. package/dist/bin/command-supervision.js +95 -0
  9. package/dist/bin/command-supervision.js.map +1 -0
  10. package/dist/bin/fatal-handler.d.ts +20 -0
  11. package/dist/bin/fatal-handler.d.ts.map +1 -0
  12. package/dist/bin/fatal-handler.js +118 -0
  13. package/dist/bin/fatal-handler.js.map +1 -0
  14. package/dist/bin/node-version-check.d.ts +37 -0
  15. package/dist/bin/node-version-check.d.ts.map +1 -0
  16. package/dist/bin/node-version-check.js +79 -0
  17. package/dist/bin/node-version-check.js.map +1 -0
  18. package/dist/bin/uninstall.d.ts +14 -0
  19. package/dist/bin/uninstall.d.ts.map +1 -0
  20. package/dist/bin/uninstall.js +36 -0
  21. package/dist/bin/uninstall.js.map +1 -0
  22. package/dist/context/formatter.d.ts +30 -0
  23. package/dist/context/formatter.d.ts.map +1 -0
  24. package/dist/context/formatter.js +263 -0
  25. package/dist/context/formatter.js.map +1 -0
  26. package/dist/context/index.d.ts +119 -0
  27. package/dist/context/index.d.ts.map +1 -0
  28. package/dist/context/index.js +1296 -0
  29. package/dist/context/index.js.map +1 -0
  30. package/dist/context/markers.d.ts +19 -0
  31. package/dist/context/markers.d.ts.map +1 -0
  32. package/dist/context/markers.js +22 -0
  33. package/dist/context/markers.js.map +1 -0
  34. package/dist/db/index.d.ts +201 -0
  35. package/dist/db/index.d.ts.map +1 -0
  36. package/dist/db/index.js +493 -0
  37. package/dist/db/index.js.map +1 -0
  38. package/dist/db/migrations.d.ts +44 -0
  39. package/dist/db/migrations.d.ts.map +1 -0
  40. package/dist/db/migrations.js +212 -0
  41. package/dist/db/migrations.js.map +1 -0
  42. package/dist/db/queries.d.ts +513 -0
  43. package/dist/db/queries.d.ts.map +1 -0
  44. package/dist/db/queries.js +1886 -0
  45. package/dist/db/queries.js.map +1 -0
  46. package/dist/db/schema.sql +194 -0
  47. package/dist/db/sqlite-adapter.d.ts +65 -0
  48. package/dist/db/sqlite-adapter.d.ts.map +1 -0
  49. package/dist/db/sqlite-adapter.js +274 -0
  50. package/dist/db/sqlite-adapter.js.map +1 -0
  51. package/dist/db/wal-valve.d.ts +106 -0
  52. package/dist/db/wal-valve.d.ts.map +1 -0
  53. package/dist/db/wal-valve.js +208 -0
  54. package/dist/db/wal-valve.js.map +1 -0
  55. package/dist/directory.d.ts +183 -0
  56. package/dist/directory.d.ts.map +1 -0
  57. package/dist/directory.js +797 -0
  58. package/dist/directory.js.map +1 -0
  59. package/dist/errors.d.ts +136 -0
  60. package/dist/errors.d.ts.map +1 -0
  61. package/dist/errors.js +219 -0
  62. package/dist/errors.js.map +1 -0
  63. package/dist/extraction/astro-extractor.d.ts +79 -0
  64. package/dist/extraction/astro-extractor.d.ts.map +1 -0
  65. package/dist/extraction/astro-extractor.js +320 -0
  66. package/dist/extraction/astro-extractor.js.map +1 -0
  67. package/dist/extraction/cfml-extractor.d.ts +107 -0
  68. package/dist/extraction/cfml-extractor.d.ts.map +1 -0
  69. package/dist/extraction/cfml-extractor.js +494 -0
  70. package/dist/extraction/cfml-extractor.js.map +1 -0
  71. package/dist/extraction/dfm-extractor.d.ts +31 -0
  72. package/dist/extraction/dfm-extractor.d.ts.map +1 -0
  73. package/dist/extraction/dfm-extractor.js +151 -0
  74. package/dist/extraction/dfm-extractor.js.map +1 -0
  75. package/dist/extraction/extraction-version.d.ts +25 -0
  76. package/dist/extraction/extraction-version.d.ts.map +1 -0
  77. package/dist/extraction/extraction-version.js +28 -0
  78. package/dist/extraction/extraction-version.js.map +1 -0
  79. package/dist/extraction/function-ref.d.ts +118 -0
  80. package/dist/extraction/function-ref.d.ts.map +1 -0
  81. package/dist/extraction/function-ref.js +727 -0
  82. package/dist/extraction/function-ref.js.map +1 -0
  83. package/dist/extraction/generated-detection.d.ts +30 -0
  84. package/dist/extraction/generated-detection.d.ts.map +1 -0
  85. package/dist/extraction/generated-detection.js +83 -0
  86. package/dist/extraction/generated-detection.js.map +1 -0
  87. package/dist/extraction/grammars.d.ts +138 -0
  88. package/dist/extraction/grammars.d.ts.map +1 -0
  89. package/dist/extraction/grammars.js +631 -0
  90. package/dist/extraction/grammars.js.map +1 -0
  91. package/dist/extraction/index.d.ts +232 -0
  92. package/dist/extraction/index.d.ts.map +1 -0
  93. package/dist/extraction/index.js +2409 -0
  94. package/dist/extraction/index.js.map +1 -0
  95. package/dist/extraction/languages/arkts.d.ts +3 -0
  96. package/dist/extraction/languages/arkts.d.ts.map +1 -0
  97. package/dist/extraction/languages/arkts.js +127 -0
  98. package/dist/extraction/languages/arkts.js.map +1 -0
  99. package/dist/extraction/languages/c-cpp.d.ts +110 -0
  100. package/dist/extraction/languages/c-cpp.d.ts.map +1 -0
  101. package/dist/extraction/languages/c-cpp.js +837 -0
  102. package/dist/extraction/languages/c-cpp.js.map +1 -0
  103. package/dist/extraction/languages/cfquery.d.ts +12 -0
  104. package/dist/extraction/languages/cfquery.d.ts.map +1 -0
  105. package/dist/extraction/languages/cfquery.js +28 -0
  106. package/dist/extraction/languages/cfquery.js.map +1 -0
  107. package/dist/extraction/languages/cfscript.d.ts +3 -0
  108. package/dist/extraction/languages/cfscript.d.ts.map +1 -0
  109. package/dist/extraction/languages/cfscript.js +73 -0
  110. package/dist/extraction/languages/cfscript.js.map +1 -0
  111. package/dist/extraction/languages/cobol.d.ts +33 -0
  112. package/dist/extraction/languages/cobol.d.ts.map +1 -0
  113. package/dist/extraction/languages/cobol.js +499 -0
  114. package/dist/extraction/languages/cobol.js.map +1 -0
  115. package/dist/extraction/languages/csharp.d.ts +25 -0
  116. package/dist/extraction/languages/csharp.d.ts.map +1 -0
  117. package/dist/extraction/languages/csharp.js +175 -0
  118. package/dist/extraction/languages/csharp.js.map +1 -0
  119. package/dist/extraction/languages/dart.d.ts +3 -0
  120. package/dist/extraction/languages/dart.d.ts.map +1 -0
  121. package/dist/extraction/languages/dart.js +374 -0
  122. package/dist/extraction/languages/dart.js.map +1 -0
  123. package/dist/extraction/languages/erlang.d.ts +3 -0
  124. package/dist/extraction/languages/erlang.d.ts.map +1 -0
  125. package/dist/extraction/languages/erlang.js +350 -0
  126. package/dist/extraction/languages/erlang.js.map +1 -0
  127. package/dist/extraction/languages/go.d.ts +3 -0
  128. package/dist/extraction/languages/go.d.ts.map +1 -0
  129. package/dist/extraction/languages/go.js +111 -0
  130. package/dist/extraction/languages/go.js.map +1 -0
  131. package/dist/extraction/languages/index.d.ts +10 -0
  132. package/dist/extraction/languages/index.d.ts.map +1 -0
  133. package/dist/extraction/languages/index.js +71 -0
  134. package/dist/extraction/languages/index.js.map +1 -0
  135. package/dist/extraction/languages/java.d.ts +3 -0
  136. package/dist/extraction/languages/java.d.ts.map +1 -0
  137. package/dist/extraction/languages/java.js +315 -0
  138. package/dist/extraction/languages/java.js.map +1 -0
  139. package/dist/extraction/languages/javascript.d.ts +3 -0
  140. package/dist/extraction/languages/javascript.d.ts.map +1 -0
  141. package/dist/extraction/languages/javascript.js +106 -0
  142. package/dist/extraction/languages/javascript.js.map +1 -0
  143. package/dist/extraction/languages/kotlin.d.ts +3 -0
  144. package/dist/extraction/languages/kotlin.d.ts.map +1 -0
  145. package/dist/extraction/languages/kotlin.js +379 -0
  146. package/dist/extraction/languages/kotlin.js.map +1 -0
  147. package/dist/extraction/languages/lua.d.ts +3 -0
  148. package/dist/extraction/languages/lua.d.ts.map +1 -0
  149. package/dist/extraction/languages/lua.js +150 -0
  150. package/dist/extraction/languages/lua.js.map +1 -0
  151. package/dist/extraction/languages/luau.d.ts +3 -0
  152. package/dist/extraction/languages/luau.d.ts.map +1 -0
  153. package/dist/extraction/languages/luau.js +37 -0
  154. package/dist/extraction/languages/luau.js.map +1 -0
  155. package/dist/extraction/languages/nix.d.ts +3 -0
  156. package/dist/extraction/languages/nix.d.ts.map +1 -0
  157. package/dist/extraction/languages/nix.js +294 -0
  158. package/dist/extraction/languages/nix.js.map +1 -0
  159. package/dist/extraction/languages/objc.d.ts +3 -0
  160. package/dist/extraction/languages/objc.d.ts.map +1 -0
  161. package/dist/extraction/languages/objc.js +175 -0
  162. package/dist/extraction/languages/objc.js.map +1 -0
  163. package/dist/extraction/languages/pascal.d.ts +3 -0
  164. package/dist/extraction/languages/pascal.d.ts.map +1 -0
  165. package/dist/extraction/languages/pascal.js +77 -0
  166. package/dist/extraction/languages/pascal.js.map +1 -0
  167. package/dist/extraction/languages/php.d.ts +3 -0
  168. package/dist/extraction/languages/php.d.ts.map +1 -0
  169. package/dist/extraction/languages/php.js +196 -0
  170. package/dist/extraction/languages/php.js.map +1 -0
  171. package/dist/extraction/languages/python.d.ts +3 -0
  172. package/dist/extraction/languages/python.d.ts.map +1 -0
  173. package/dist/extraction/languages/python.js +56 -0
  174. package/dist/extraction/languages/python.js.map +1 -0
  175. package/dist/extraction/languages/r.d.ts +3 -0
  176. package/dist/extraction/languages/r.d.ts.map +1 -0
  177. package/dist/extraction/languages/r.js +314 -0
  178. package/dist/extraction/languages/r.js.map +1 -0
  179. package/dist/extraction/languages/ruby.d.ts +3 -0
  180. package/dist/extraction/languages/ruby.d.ts.map +1 -0
  181. package/dist/extraction/languages/ruby.js +149 -0
  182. package/dist/extraction/languages/ruby.js.map +1 -0
  183. package/dist/extraction/languages/rust.d.ts +3 -0
  184. package/dist/extraction/languages/rust.d.ts.map +1 -0
  185. package/dist/extraction/languages/rust.js +142 -0
  186. package/dist/extraction/languages/rust.js.map +1 -0
  187. package/dist/extraction/languages/scala.d.ts +3 -0
  188. package/dist/extraction/languages/scala.d.ts.map +1 -0
  189. package/dist/extraction/languages/scala.js +209 -0
  190. package/dist/extraction/languages/scala.js.map +1 -0
  191. package/dist/extraction/languages/solidity.d.ts +3 -0
  192. package/dist/extraction/languages/solidity.d.ts.map +1 -0
  193. package/dist/extraction/languages/solidity.js +293 -0
  194. package/dist/extraction/languages/solidity.js.map +1 -0
  195. package/dist/extraction/languages/swift.d.ts +3 -0
  196. package/dist/extraction/languages/swift.d.ts.map +1 -0
  197. package/dist/extraction/languages/swift.js +152 -0
  198. package/dist/extraction/languages/swift.js.map +1 -0
  199. package/dist/extraction/languages/terraform.d.ts +3 -0
  200. package/dist/extraction/languages/terraform.d.ts.map +1 -0
  201. package/dist/extraction/languages/terraform.js +641 -0
  202. package/dist/extraction/languages/terraform.js.map +1 -0
  203. package/dist/extraction/languages/typescript.d.ts +16 -0
  204. package/dist/extraction/languages/typescript.d.ts.map +1 -0
  205. package/dist/extraction/languages/typescript.js +167 -0
  206. package/dist/extraction/languages/typescript.js.map +1 -0
  207. package/dist/extraction/languages/vbnet.d.ts +11 -0
  208. package/dist/extraction/languages/vbnet.d.ts.map +1 -0
  209. package/dist/extraction/languages/vbnet.js +141 -0
  210. package/dist/extraction/languages/vbnet.js.map +1 -0
  211. package/dist/extraction/liquid-extractor.d.ts +59 -0
  212. package/dist/extraction/liquid-extractor.d.ts.map +1 -0
  213. package/dist/extraction/liquid-extractor.js +357 -0
  214. package/dist/extraction/liquid-extractor.js.map +1 -0
  215. package/dist/extraction/mybatis-extractor.d.ts +68 -0
  216. package/dist/extraction/mybatis-extractor.d.ts.map +1 -0
  217. package/dist/extraction/mybatis-extractor.js +300 -0
  218. package/dist/extraction/mybatis-extractor.js.map +1 -0
  219. package/dist/extraction/parse-pool.d.ts +152 -0
  220. package/dist/extraction/parse-pool.d.ts.map +1 -0
  221. package/dist/extraction/parse-pool.js +387 -0
  222. package/dist/extraction/parse-pool.js.map +1 -0
  223. package/dist/extraction/parse-worker.d.ts +8 -0
  224. package/dist/extraction/parse-worker.d.ts.map +1 -0
  225. package/dist/extraction/parse-worker.js +104 -0
  226. package/dist/extraction/parse-worker.js.map +1 -0
  227. package/dist/extraction/razor-extractor.d.ts +42 -0
  228. package/dist/extraction/razor-extractor.d.ts.map +1 -0
  229. package/dist/extraction/razor-extractor.js +285 -0
  230. package/dist/extraction/razor-extractor.js.map +1 -0
  231. package/dist/extraction/svelte-extractor.d.ts +56 -0
  232. package/dist/extraction/svelte-extractor.d.ts.map +1 -0
  233. package/dist/extraction/svelte-extractor.js +275 -0
  234. package/dist/extraction/svelte-extractor.js.map +1 -0
  235. package/dist/extraction/tree-sitter-helpers.d.ts +28 -0
  236. package/dist/extraction/tree-sitter-helpers.d.ts.map +1 -0
  237. package/dist/extraction/tree-sitter-helpers.js +153 -0
  238. package/dist/extraction/tree-sitter-helpers.js.map +1 -0
  239. package/dist/extraction/tree-sitter-types.d.ts +258 -0
  240. package/dist/extraction/tree-sitter-types.d.ts.map +1 -0
  241. package/dist/extraction/tree-sitter-types.js +10 -0
  242. package/dist/extraction/tree-sitter-types.js.map +1 -0
  243. package/dist/extraction/tree-sitter.d.ts +706 -0
  244. package/dist/extraction/tree-sitter.d.ts.map +1 -0
  245. package/dist/extraction/tree-sitter.js +6506 -0
  246. package/dist/extraction/tree-sitter.js.map +1 -0
  247. package/dist/extraction/vue-extractor.d.ts +51 -0
  248. package/dist/extraction/vue-extractor.d.ts.map +1 -0
  249. package/dist/extraction/vue-extractor.js +254 -0
  250. package/dist/extraction/vue-extractor.js.map +1 -0
  251. package/dist/extraction/wasm/tree-sitter-arkts.wasm +0 -0
  252. package/dist/extraction/wasm/tree-sitter-c_sharp.wasm +0 -0
  253. package/dist/extraction/wasm/tree-sitter-cfml.wasm +0 -0
  254. package/dist/extraction/wasm/tree-sitter-cfquery.wasm +0 -0
  255. package/dist/extraction/wasm/tree-sitter-cfscript.wasm +0 -0
  256. package/dist/extraction/wasm/tree-sitter-cobol.wasm +0 -0
  257. package/dist/extraction/wasm/tree-sitter-erlang.wasm +0 -0
  258. package/dist/extraction/wasm/tree-sitter-lua.wasm +0 -0
  259. package/dist/extraction/wasm/tree-sitter-luau.wasm +0 -0
  260. package/dist/extraction/wasm/tree-sitter-nix.wasm +0 -0
  261. package/dist/extraction/wasm/tree-sitter-pascal.wasm +0 -0
  262. package/dist/extraction/wasm/tree-sitter-r.wasm +0 -0
  263. package/dist/extraction/wasm/tree-sitter-scala.wasm +0 -0
  264. package/dist/extraction/wasm/tree-sitter-terraform.wasm +0 -0
  265. package/dist/extraction/wasm/tree-sitter-vbnet.wasm +0 -0
  266. package/dist/extraction/wasm-runtime-flags.d.ts +38 -0
  267. package/dist/extraction/wasm-runtime-flags.d.ts.map +1 -0
  268. package/dist/extraction/wasm-runtime-flags.js +106 -0
  269. package/dist/extraction/wasm-runtime-flags.js.map +1 -0
  270. package/dist/graph/index.d.ts +8 -0
  271. package/dist/graph/index.d.ts.map +1 -0
  272. package/dist/graph/index.js +13 -0
  273. package/dist/graph/index.js.map +1 -0
  274. package/dist/graph/queries.d.ts +106 -0
  275. package/dist/graph/queries.d.ts.map +1 -0
  276. package/dist/graph/queries.js +339 -0
  277. package/dist/graph/queries.js.map +1 -0
  278. package/dist/graph/traversal.d.ts +127 -0
  279. package/dist/graph/traversal.d.ts.map +1 -0
  280. package/dist/graph/traversal.js +599 -0
  281. package/dist/graph/traversal.js.map +1 -0
  282. package/dist/index.d.ts +644 -0
  283. package/dist/index.d.ts.map +1 -0
  284. package/dist/index.js +1492 -0
  285. package/dist/index.js.map +1 -0
  286. package/dist/installer/config-writer.d.ts +28 -0
  287. package/dist/installer/config-writer.d.ts.map +1 -0
  288. package/dist/installer/config-writer.js +91 -0
  289. package/dist/installer/config-writer.js.map +1 -0
  290. package/dist/installer/index.d.ts +142 -0
  291. package/dist/installer/index.d.ts.map +1 -0
  292. package/dist/installer/index.js +619 -0
  293. package/dist/installer/index.js.map +1 -0
  294. package/dist/installer/instructions-template.d.ts +41 -0
  295. package/dist/installer/instructions-template.d.ts.map +1 -0
  296. package/dist/installer/instructions-template.js +53 -0
  297. package/dist/installer/instructions-template.js.map +1 -0
  298. package/dist/installer/targets/antigravity.d.ts +57 -0
  299. package/dist/installer/targets/antigravity.d.ts.map +1 -0
  300. package/dist/installer/targets/antigravity.js +308 -0
  301. package/dist/installer/targets/antigravity.js.map +1 -0
  302. package/dist/installer/targets/claude.d.ts +62 -0
  303. package/dist/installer/targets/claude.d.ts.map +1 -0
  304. package/dist/installer/targets/claude.js +454 -0
  305. package/dist/installer/targets/claude.js.map +1 -0
  306. package/dist/installer/targets/codex.d.ts +18 -0
  307. package/dist/installer/targets/codex.d.ts.map +1 -0
  308. package/dist/installer/targets/codex.js +185 -0
  309. package/dist/installer/targets/codex.js.map +1 -0
  310. package/dist/installer/targets/cursor.d.ts +35 -0
  311. package/dist/installer/targets/cursor.d.ts.map +1 -0
  312. package/dist/installer/targets/cursor.js +254 -0
  313. package/dist/installer/targets/cursor.js.map +1 -0
  314. package/dist/installer/targets/gemini.d.ts +26 -0
  315. package/dist/installer/targets/gemini.d.ts.map +1 -0
  316. package/dist/installer/targets/gemini.js +165 -0
  317. package/dist/installer/targets/gemini.js.map +1 -0
  318. package/dist/installer/targets/hermes.d.ts +18 -0
  319. package/dist/installer/targets/hermes.d.ts.map +1 -0
  320. package/dist/installer/targets/hermes.js +359 -0
  321. package/dist/installer/targets/hermes.js.map +1 -0
  322. package/dist/installer/targets/kiro.d.ts +27 -0
  323. package/dist/installer/targets/kiro.d.ts.map +1 -0
  324. package/dist/installer/targets/kiro.js +178 -0
  325. package/dist/installer/targets/kiro.js.map +1 -0
  326. package/dist/installer/targets/opencode.d.ts +38 -0
  327. package/dist/installer/targets/opencode.d.ts.map +1 -0
  328. package/dist/installer/targets/opencode.js +288 -0
  329. package/dist/installer/targets/opencode.js.map +1 -0
  330. package/dist/installer/targets/registry.d.ts +35 -0
  331. package/dist/installer/targets/registry.d.ts.map +1 -0
  332. package/dist/installer/targets/registry.js +91 -0
  333. package/dist/installer/targets/registry.js.map +1 -0
  334. package/dist/installer/targets/shared.d.ts +101 -0
  335. package/dist/installer/targets/shared.d.ts.map +1 -0
  336. package/dist/installer/targets/shared.js +264 -0
  337. package/dist/installer/targets/shared.js.map +1 -0
  338. package/dist/installer/targets/toml.d.ts +52 -0
  339. package/dist/installer/targets/toml.d.ts.map +1 -0
  340. package/dist/installer/targets/toml.js +147 -0
  341. package/dist/installer/targets/toml.js.map +1 -0
  342. package/dist/installer/targets/types.d.ts +108 -0
  343. package/dist/installer/targets/types.d.ts.map +1 -0
  344. package/dist/installer/targets/types.js +16 -0
  345. package/dist/installer/targets/types.js.map +1 -0
  346. package/dist/mcp/daemon-manager.d.ts +42 -0
  347. package/dist/mcp/daemon-manager.d.ts.map +1 -0
  348. package/dist/mcp/daemon-manager.js +129 -0
  349. package/dist/mcp/daemon-manager.js.map +1 -0
  350. package/dist/mcp/daemon-paths.d.ts +73 -0
  351. package/dist/mcp/daemon-paths.d.ts.map +1 -0
  352. package/dist/mcp/daemon-paths.js +165 -0
  353. package/dist/mcp/daemon-paths.js.map +1 -0
  354. package/dist/mcp/daemon-registry.d.ts +47 -0
  355. package/dist/mcp/daemon-registry.d.ts.map +1 -0
  356. package/dist/mcp/daemon-registry.js +233 -0
  357. package/dist/mcp/daemon-registry.js.map +1 -0
  358. package/dist/mcp/daemon.d.ts +290 -0
  359. package/dist/mcp/daemon.d.ts.map +1 -0
  360. package/dist/mcp/daemon.js +862 -0
  361. package/dist/mcp/daemon.js.map +1 -0
  362. package/dist/mcp/dynamic-boundaries.d.ts +41 -0
  363. package/dist/mcp/dynamic-boundaries.d.ts.map +1 -0
  364. package/dist/mcp/dynamic-boundaries.js +360 -0
  365. package/dist/mcp/dynamic-boundaries.js.map +1 -0
  366. package/dist/mcp/early-ppid.d.ts +26 -0
  367. package/dist/mcp/early-ppid.d.ts.map +1 -0
  368. package/dist/mcp/early-ppid.js +29 -0
  369. package/dist/mcp/early-ppid.js.map +1 -0
  370. package/dist/mcp/engine.d.ts +122 -0
  371. package/dist/mcp/engine.d.ts.map +1 -0
  372. package/dist/mcp/engine.js +350 -0
  373. package/dist/mcp/engine.js.map +1 -0
  374. package/dist/mcp/index.d.ts +113 -0
  375. package/dist/mcp/index.d.ts.map +1 -0
  376. package/dist/mcp/index.js +506 -0
  377. package/dist/mcp/index.js.map +1 -0
  378. package/dist/mcp/liveness-watchdog.d.ts +35 -0
  379. package/dist/mcp/liveness-watchdog.d.ts.map +1 -0
  380. package/dist/mcp/liveness-watchdog.js +267 -0
  381. package/dist/mcp/liveness-watchdog.js.map +1 -0
  382. package/dist/mcp/ppid-watchdog.d.ts +62 -0
  383. package/dist/mcp/ppid-watchdog.d.ts.map +1 -0
  384. package/dist/mcp/ppid-watchdog.js +64 -0
  385. package/dist/mcp/ppid-watchdog.js.map +1 -0
  386. package/dist/mcp/proxy.d.ts +87 -0
  387. package/dist/mcp/proxy.d.ts.map +1 -0
  388. package/dist/mcp/proxy.js +667 -0
  389. package/dist/mcp/proxy.js.map +1 -0
  390. package/dist/mcp/query-pool.d.ts +108 -0
  391. package/dist/mcp/query-pool.d.ts.map +1 -0
  392. package/dist/mcp/query-pool.js +315 -0
  393. package/dist/mcp/query-pool.js.map +1 -0
  394. package/dist/mcp/query-worker.d.ts +24 -0
  395. package/dist/mcp/query-worker.d.ts.map +1 -0
  396. package/dist/mcp/query-worker.js +87 -0
  397. package/dist/mcp/query-worker.js.map +1 -0
  398. package/dist/mcp/server-instructions.d.ts +34 -0
  399. package/dist/mcp/server-instructions.d.ts.map +1 -0
  400. package/dist/mcp/server-instructions.js +106 -0
  401. package/dist/mcp/server-instructions.js.map +1 -0
  402. package/dist/mcp/session.d.ts +93 -0
  403. package/dist/mcp/session.d.ts.map +1 -0
  404. package/dist/mcp/session.js +357 -0
  405. package/dist/mcp/session.js.map +1 -0
  406. package/dist/mcp/startup-handshake.d.ts +44 -0
  407. package/dist/mcp/startup-handshake.d.ts.map +1 -0
  408. package/dist/mcp/startup-handshake.js +73 -0
  409. package/dist/mcp/startup-handshake.js.map +1 -0
  410. package/dist/mcp/stdin-teardown.d.ts +27 -0
  411. package/dist/mcp/stdin-teardown.d.ts.map +1 -0
  412. package/dist/mcp/stdin-teardown.js +49 -0
  413. package/dist/mcp/stdin-teardown.js.map +1 -0
  414. package/dist/mcp/tools.d.ts +613 -0
  415. package/dist/mcp/tools.d.ts.map +1 -0
  416. package/dist/mcp/tools.js +4477 -0
  417. package/dist/mcp/tools.js.map +1 -0
  418. package/dist/mcp/transport.d.ts +188 -0
  419. package/dist/mcp/transport.d.ts.map +1 -0
  420. package/dist/mcp/transport.js +377 -0
  421. package/dist/mcp/transport.js.map +1 -0
  422. package/dist/mcp/version.d.ts +19 -0
  423. package/dist/mcp/version.d.ts.map +1 -0
  424. package/dist/mcp/version.js +71 -0
  425. package/dist/mcp/version.js.map +1 -0
  426. package/dist/project-config.d.ts +94 -0
  427. package/dist/project-config.d.ts.map +1 -0
  428. package/dist/project-config.js +374 -0
  429. package/dist/project-config.js.map +1 -0
  430. package/dist/resolution/c-fnptr-synthesizer.d.ts +6 -0
  431. package/dist/resolution/c-fnptr-synthesizer.d.ts.map +1 -0
  432. package/dist/resolution/c-fnptr-synthesizer.js +1062 -0
  433. package/dist/resolution/c-fnptr-synthesizer.js.map +1 -0
  434. package/dist/resolution/callback-synthesizer.d.ts +15 -0
  435. package/dist/resolution/callback-synthesizer.d.ts.map +1 -0
  436. package/dist/resolution/callback-synthesizer.js +3938 -0
  437. package/dist/resolution/callback-synthesizer.js.map +1 -0
  438. package/dist/resolution/cooperative-yield.d.ts +32 -0
  439. package/dist/resolution/cooperative-yield.d.ts.map +1 -0
  440. package/dist/resolution/cooperative-yield.js +42 -0
  441. package/dist/resolution/cooperative-yield.js.map +1 -0
  442. package/dist/resolution/frameworks/astro.d.ts +9 -0
  443. package/dist/resolution/frameworks/astro.d.ts.map +1 -0
  444. package/dist/resolution/frameworks/astro.js +169 -0
  445. package/dist/resolution/frameworks/astro.js.map +1 -0
  446. package/dist/resolution/frameworks/cargo-workspace.d.ts +18 -0
  447. package/dist/resolution/frameworks/cargo-workspace.d.ts.map +1 -0
  448. package/dist/resolution/frameworks/cargo-workspace.js +225 -0
  449. package/dist/resolution/frameworks/cargo-workspace.js.map +1 -0
  450. package/dist/resolution/frameworks/cics.d.ts +20 -0
  451. package/dist/resolution/frameworks/cics.d.ts.map +1 -0
  452. package/dist/resolution/frameworks/cics.js +90 -0
  453. package/dist/resolution/frameworks/cics.js.map +1 -0
  454. package/dist/resolution/frameworks/csharp.d.ts +8 -0
  455. package/dist/resolution/frameworks/csharp.d.ts.map +1 -0
  456. package/dist/resolution/frameworks/csharp.js +241 -0
  457. package/dist/resolution/frameworks/csharp.js.map +1 -0
  458. package/dist/resolution/frameworks/drupal.d.ts +51 -0
  459. package/dist/resolution/frameworks/drupal.d.ts.map +1 -0
  460. package/dist/resolution/frameworks/drupal.js +367 -0
  461. package/dist/resolution/frameworks/drupal.js.map +1 -0
  462. package/dist/resolution/frameworks/expo-modules.d.ts +3 -0
  463. package/dist/resolution/frameworks/expo-modules.d.ts.map +1 -0
  464. package/dist/resolution/frameworks/expo-modules.js +148 -0
  465. package/dist/resolution/frameworks/expo-modules.js.map +1 -0
  466. package/dist/resolution/frameworks/express.d.ts +8 -0
  467. package/dist/resolution/frameworks/express.d.ts.map +1 -0
  468. package/dist/resolution/frameworks/express.js +308 -0
  469. package/dist/resolution/frameworks/express.js.map +1 -0
  470. package/dist/resolution/frameworks/fabric.d.ts +3 -0
  471. package/dist/resolution/frameworks/fabric.d.ts.map +1 -0
  472. package/dist/resolution/frameworks/fabric.js +354 -0
  473. package/dist/resolution/frameworks/fabric.js.map +1 -0
  474. package/dist/resolution/frameworks/go.d.ts +8 -0
  475. package/dist/resolution/frameworks/go.d.ts.map +1 -0
  476. package/dist/resolution/frameworks/go.js +161 -0
  477. package/dist/resolution/frameworks/go.js.map +1 -0
  478. package/dist/resolution/frameworks/goframe.d.ts +41 -0
  479. package/dist/resolution/frameworks/goframe.d.ts.map +1 -0
  480. package/dist/resolution/frameworks/goframe.js +112 -0
  481. package/dist/resolution/frameworks/goframe.js.map +1 -0
  482. package/dist/resolution/frameworks/index.d.ts +50 -0
  483. package/dist/resolution/frameworks/index.d.ts.map +1 -0
  484. package/dist/resolution/frameworks/index.js +175 -0
  485. package/dist/resolution/frameworks/index.js.map +1 -0
  486. package/dist/resolution/frameworks/java.d.ts +8 -0
  487. package/dist/resolution/frameworks/java.d.ts.map +1 -0
  488. package/dist/resolution/frameworks/java.js +517 -0
  489. package/dist/resolution/frameworks/java.js.map +1 -0
  490. package/dist/resolution/frameworks/laravel.d.ts +13 -0
  491. package/dist/resolution/frameworks/laravel.d.ts.map +1 -0
  492. package/dist/resolution/frameworks/laravel.js +257 -0
  493. package/dist/resolution/frameworks/laravel.js.map +1 -0
  494. package/dist/resolution/frameworks/nestjs.d.ts +26 -0
  495. package/dist/resolution/frameworks/nestjs.d.ts.map +1 -0
  496. package/dist/resolution/frameworks/nestjs.js +698 -0
  497. package/dist/resolution/frameworks/nestjs.js.map +1 -0
  498. package/dist/resolution/frameworks/play.d.ts +19 -0
  499. package/dist/resolution/frameworks/play.d.ts.map +1 -0
  500. package/dist/resolution/frameworks/play.js +111 -0
  501. package/dist/resolution/frameworks/play.js.map +1 -0
  502. package/dist/resolution/frameworks/python.d.ts +10 -0
  503. package/dist/resolution/frameworks/python.d.ts.map +1 -0
  504. package/dist/resolution/frameworks/python.js +400 -0
  505. package/dist/resolution/frameworks/python.js.map +1 -0
  506. package/dist/resolution/frameworks/react-native.d.ts +3 -0
  507. package/dist/resolution/frameworks/react-native.d.ts.map +1 -0
  508. package/dist/resolution/frameworks/react-native.js +410 -0
  509. package/dist/resolution/frameworks/react-native.js.map +1 -0
  510. package/dist/resolution/frameworks/react.d.ts +8 -0
  511. package/dist/resolution/frameworks/react.d.ts.map +1 -0
  512. package/dist/resolution/frameworks/react.js +334 -0
  513. package/dist/resolution/frameworks/react.js.map +1 -0
  514. package/dist/resolution/frameworks/ruby.d.ts +8 -0
  515. package/dist/resolution/frameworks/ruby.d.ts.map +1 -0
  516. package/dist/resolution/frameworks/ruby.js +302 -0
  517. package/dist/resolution/frameworks/ruby.js.map +1 -0
  518. package/dist/resolution/frameworks/rust.d.ts +8 -0
  519. package/dist/resolution/frameworks/rust.d.ts.map +1 -0
  520. package/dist/resolution/frameworks/rust.js +304 -0
  521. package/dist/resolution/frameworks/rust.js.map +1 -0
  522. package/dist/resolution/frameworks/svelte.d.ts +9 -0
  523. package/dist/resolution/frameworks/svelte.d.ts.map +1 -0
  524. package/dist/resolution/frameworks/svelte.js +253 -0
  525. package/dist/resolution/frameworks/svelte.js.map +1 -0
  526. package/dist/resolution/frameworks/swift-objc.d.ts +37 -0
  527. package/dist/resolution/frameworks/swift-objc.d.ts.map +1 -0
  528. package/dist/resolution/frameworks/swift-objc.js +252 -0
  529. package/dist/resolution/frameworks/swift-objc.js.map +1 -0
  530. package/dist/resolution/frameworks/swift.d.ts +10 -0
  531. package/dist/resolution/frameworks/swift.d.ts.map +1 -0
  532. package/dist/resolution/frameworks/swift.js +400 -0
  533. package/dist/resolution/frameworks/swift.js.map +1 -0
  534. package/dist/resolution/frameworks/terraform.d.ts +38 -0
  535. package/dist/resolution/frameworks/terraform.d.ts.map +1 -0
  536. package/dist/resolution/frameworks/terraform.js +277 -0
  537. package/dist/resolution/frameworks/terraform.js.map +1 -0
  538. package/dist/resolution/frameworks/vue.d.ts +9 -0
  539. package/dist/resolution/frameworks/vue.d.ts.map +1 -0
  540. package/dist/resolution/frameworks/vue.js +303 -0
  541. package/dist/resolution/frameworks/vue.js.map +1 -0
  542. package/dist/resolution/go-module.d.ts +26 -0
  543. package/dist/resolution/go-module.d.ts.map +1 -0
  544. package/dist/resolution/go-module.js +78 -0
  545. package/dist/resolution/go-module.js.map +1 -0
  546. package/dist/resolution/goframe-synthesizer.d.ts +29 -0
  547. package/dist/resolution/goframe-synthesizer.d.ts.map +1 -0
  548. package/dist/resolution/goframe-synthesizer.js +163 -0
  549. package/dist/resolution/goframe-synthesizer.js.map +1 -0
  550. package/dist/resolution/import-resolver.d.ts +85 -0
  551. package/dist/resolution/import-resolver.d.ts.map +1 -0
  552. package/dist/resolution/import-resolver.js +1974 -0
  553. package/dist/resolution/import-resolver.js.map +1 -0
  554. package/dist/resolution/index.d.ts +258 -0
  555. package/dist/resolution/index.d.ts.map +1 -0
  556. package/dist/resolution/index.js +1746 -0
  557. package/dist/resolution/index.js.map +1 -0
  558. package/dist/resolution/lru-cache.d.ts +24 -0
  559. package/dist/resolution/lru-cache.d.ts.map +1 -0
  560. package/dist/resolution/lru-cache.js +62 -0
  561. package/dist/resolution/lru-cache.js.map +1 -0
  562. package/dist/resolution/name-matcher.d.ts +112 -0
  563. package/dist/resolution/name-matcher.d.ts.map +1 -0
  564. package/dist/resolution/name-matcher.js +1830 -0
  565. package/dist/resolution/name-matcher.js.map +1 -0
  566. package/dist/resolution/path-aliases.d.ts +68 -0
  567. package/dist/resolution/path-aliases.d.ts.map +1 -0
  568. package/dist/resolution/path-aliases.js +238 -0
  569. package/dist/resolution/path-aliases.js.map +1 -0
  570. package/dist/resolution/strip-comments.d.ts +27 -0
  571. package/dist/resolution/strip-comments.d.ts.map +1 -0
  572. package/dist/resolution/strip-comments.js +492 -0
  573. package/dist/resolution/strip-comments.js.map +1 -0
  574. package/dist/resolution/swift-objc-bridge.d.ts +134 -0
  575. package/dist/resolution/swift-objc-bridge.d.ts.map +1 -0
  576. package/dist/resolution/swift-objc-bridge.js +256 -0
  577. package/dist/resolution/swift-objc-bridge.js.map +1 -0
  578. package/dist/resolution/types.d.ts +262 -0
  579. package/dist/resolution/types.d.ts.map +1 -0
  580. package/dist/resolution/types.js +8 -0
  581. package/dist/resolution/types.js.map +1 -0
  582. package/dist/resolution/workspace-packages.d.ts +58 -0
  583. package/dist/resolution/workspace-packages.d.ts.map +1 -0
  584. package/dist/resolution/workspace-packages.js +346 -0
  585. package/dist/resolution/workspace-packages.js.map +1 -0
  586. package/dist/search/identifier-segments.d.ts +60 -0
  587. package/dist/search/identifier-segments.d.ts.map +1 -0
  588. package/dist/search/identifier-segments.js +176 -0
  589. package/dist/search/identifier-segments.js.map +1 -0
  590. package/dist/search/query-parser.d.ts +57 -0
  591. package/dist/search/query-parser.d.ts.map +1 -0
  592. package/dist/search/query-parser.js +177 -0
  593. package/dist/search/query-parser.js.map +1 -0
  594. package/dist/search/query-utils.d.ts +87 -0
  595. package/dist/search/query-utils.d.ts.map +1 -0
  596. package/dist/search/query-utils.js +449 -0
  597. package/dist/search/query-utils.js.map +1 -0
  598. package/dist/sync/git-hooks.d.ts +45 -0
  599. package/dist/sync/git-hooks.d.ts.map +1 -0
  600. package/dist/sync/git-hooks.js +227 -0
  601. package/dist/sync/git-hooks.js.map +1 -0
  602. package/dist/sync/index.d.ts +19 -0
  603. package/dist/sync/index.d.ts.map +1 -0
  604. package/dist/sync/index.js +35 -0
  605. package/dist/sync/index.js.map +1 -0
  606. package/dist/sync/watch-policy.d.ts +48 -0
  607. package/dist/sync/watch-policy.d.ts.map +1 -0
  608. package/dist/sync/watch-policy.js +124 -0
  609. package/dist/sync/watch-policy.js.map +1 -0
  610. package/dist/sync/watcher.d.ts +355 -0
  611. package/dist/sync/watcher.d.ts.map +1 -0
  612. package/dist/sync/watcher.js +848 -0
  613. package/dist/sync/watcher.js.map +1 -0
  614. package/dist/sync/worktree.d.ts +63 -0
  615. package/dist/sync/worktree.d.ts.map +1 -0
  616. package/dist/sync/worktree.js +182 -0
  617. package/dist/sync/worktree.js.map +1 -0
  618. package/dist/telemetry/index.d.ts +143 -0
  619. package/dist/telemetry/index.d.ts.map +1 -0
  620. package/dist/telemetry/index.js +541 -0
  621. package/dist/telemetry/index.js.map +1 -0
  622. package/dist/types.d.ts +415 -0
  623. package/dist/types.d.ts.map +1 -0
  624. package/dist/types.js +91 -0
  625. package/dist/types.js.map +1 -0
  626. package/dist/ui/glyphs.d.ts +42 -0
  627. package/dist/ui/glyphs.d.ts.map +1 -0
  628. package/dist/ui/glyphs.js +78 -0
  629. package/dist/ui/glyphs.js.map +1 -0
  630. package/dist/ui/shimmer-progress.d.ts +11 -0
  631. package/dist/ui/shimmer-progress.d.ts.map +1 -0
  632. package/dist/ui/shimmer-progress.js +90 -0
  633. package/dist/ui/shimmer-progress.js.map +1 -0
  634. package/dist/ui/shimmer-worker.d.ts +2 -0
  635. package/dist/ui/shimmer-worker.d.ts.map +1 -0
  636. package/dist/ui/shimmer-worker.js +118 -0
  637. package/dist/ui/shimmer-worker.js.map +1 -0
  638. package/dist/ui/types.d.ts +17 -0
  639. package/dist/ui/types.d.ts.map +1 -0
  640. package/dist/ui/types.js +3 -0
  641. package/dist/ui/types.js.map +1 -0
  642. package/dist/upgrade/index.d.ts +164 -0
  643. package/dist/upgrade/index.d.ts.map +1 -0
  644. package/dist/upgrade/index.js +646 -0
  645. package/dist/upgrade/index.js.map +1 -0
  646. package/dist/upgrade/remove-binary.d.ts +87 -0
  647. package/dist/upgrade/remove-binary.d.ts.map +1 -0
  648. package/dist/upgrade/remove-binary.js +289 -0
  649. package/dist/upgrade/remove-binary.js.map +1 -0
  650. package/dist/upgrade/update-check.d.ts +92 -0
  651. package/dist/upgrade/update-check.d.ts.map +1 -0
  652. package/dist/upgrade/update-check.js +258 -0
  653. package/dist/upgrade/update-check.js.map +1 -0
  654. package/dist/utils.d.ts +224 -0
  655. package/dist/utils.d.ts.map +1 -0
  656. package/dist/utils.js +583 -0
  657. package/dist/utils.js.map +1 -0
  658. package/package.json +1 -1
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Server-level instructions emitted in the MCP `initialize` response.
3
+ *
4
+ * MCP clients (Claude Code, Cursor, opencode, LangChain, OpenAI Agent
5
+ * SDK, …) surface this text in the agent's system prompt automatically,
6
+ * giving the agent a high-level playbook for the codegraph toolset
7
+ * before it sees individual tool descriptions.
8
+ *
9
+ * Goals when editing this:
10
+ * - Lead the agent to codegraph_explore for any structural/flow question
11
+ * - Reinforce "explore instead of Read/Grep" for indexed code
12
+ * - Anti-patterns (don't re-verify with grep; don't hand-reconstruct flows)
13
+ *
14
+ * Keep it tight. The agent reads this every session — long instructions
15
+ * burn tokens. The DEFAULT MCP surface is `codegraph_explore` ALONE (see
16
+ * DEFAULT_MCP_TOOLS in tools.ts) — reference only that tool here. The other
17
+ * tools (node/search/callers/…) stay defined and are re-enablable via
18
+ * CODEGRAPH_MCP_TOOLS, but they are NOT listed to agents, so don't name them.
19
+ */
20
+ export declare const SERVER_INSTRUCTIONS = "# Codegraph \u2014 code intelligence over an indexed knowledge graph\n\nCodegraph is a SQLite knowledge graph of every symbol, edge, and file in\nthe workspace \u2014 pre-computed structure you would otherwise re-derive by\nreading files (cached intelligence: thousands of parse/trace decisions you\ndon't pay to re-reason each run). Reads are sub-millisecond; the index lags\nwrites by ~1s through the file watcher. Reach for it BEFORE *and* while\nwriting or editing code \u2014 not just for questions: one call returns the\nverbatim source PLUS who calls it and what it affects, so you edit with the\nblast radius in view. More accurate context, in far fewer tokens and\nround-trips than reading files yourself.\n\n## One tool: codegraph_explore \u2014 use it instead of reading files\n\nThere is a single tool, `codegraph_explore`, and it is Read-equivalent. It\ntakes either a natural-language question or a bag of symbol/file names and\nreturns the **verbatim, line-numbered source** of the relevant symbols\ngrouped by file \u2014 the same `<n>\\t<line>` shape `Read` gives you, safe to\n`Edit` from \u2014 PLUS the call path among them (including dynamic-dispatch hops\nlike callbacks, React re-render, and JSX children that grep can't follow) and\na blast-radius summary of what depends on them.\n\nWhether you're answering \"how does X work\" or implementing a change (fixing a\nbug, adding a feature), call `codegraph_explore` before you Read. ONE call\nusually answers the whole question. Codegraph IS the pre-built search index \u2014\nso running your own grep + read loop, or delegating the lookup to a separate\nfile-reading sub-task/agent, repeats work codegraph already did and costs more\nfor the same answer. A direct codegraph answer is typically one to a few\ncalls; a grep/read exploration is dozens.\n\n## How to query\n\n- **Almost any question \u2014 \"how does X work\", architecture, a bug, \"what/where is X\", or surveying an area** \u2192 `codegraph_explore` with a natural-language question or the relevant names. ONE capped call returns the verbatim source grouped by file; most often the ONLY call you need.\n- **\"How does X reach/become Y? / the flow / the path from X to Y\"** \u2192 `codegraph_explore`, naming the symbols that span the flow (e.g. `mutateElement renderScene`) \u2014 it surfaces the call path among them, riding dynamic-dispatch hops, and returns their source.\n- **Reading or editing a file/symbol you can name** \u2192 put its name or file path in the `codegraph_explore` query \u2014 it returns that current line-numbered source (safe to `Edit` from) with the call path and blast radius attached, so you don't Read it separately. For an overloaded name it returns every matching definition's body in one call.\n- **Need more?** Call `codegraph_explore` again with more specific names \u2014 treat the source it returns as already Read.\n\n## Anti-patterns\n\n- **Trust codegraph's results \u2014 don't re-verify them with grep.** They come from a full AST parse; re-checking with grep is slower, less accurate, and wastes context.\n- **Don't grep or Read first** to find or understand indexed code \u2014 ONE `codegraph_explore` returns the relevant symbols' source together in a single round-trip. Reach for raw `Read`/`Grep` only to confirm a specific detail codegraph didn't cover, or for what codegraph doesn't index (configs, docs).\n- **Don't reconstruct a flow by hand** \u2014 name the endpoints in one `codegraph_explore` and it surfaces the path between them, dynamic-dispatch hops included.\n- **After editing, check the staleness banner.** When a tool response starts with \"\u26A0\uFE0F Some files referenced below were edited since the last index sync\u2026\", the listed files are pending re-index \u2014 Read those specific files for accurate content. Every file NOT in that banner is fresh, so still trust codegraph. A different, rarer banner \u2014 \"\u26A0\uFE0F CodeGraph auto-sync is DISABLED\u2026\" \u2014 means live watching stopped entirely (the whole index is frozen, not just a few files); until it's resolved, Read files directly to confirm anything that may have changed.\n\n## Limitations\n\n- If a tool reports a project isn't indexed (no `.codegraph/`), stop calling codegraph tools for that project for the rest of the session and use your built-in tools there instead. Indexing is the user's decision \u2014 mention they can run `codegraph init` if it comes up, but don't run it yourself.\n- Index lags file writes by ~1 second.\n- Cross-file resolution is best-effort name matching; ambiguous calls may return multiple candidates.\n- No live correctness validation \u2014 that's still the TypeScript compiler / test suite / linter's job. Codegraph supplements those with structural context they don't have.\n";
21
+ /**
22
+ * Instructions variant sent when the server's own root has NO codegraph index.
23
+ *
24
+ * The tools are still exposed (gating tool availability on whether `./` has an
25
+ * index is the bug behind #964: it breaks monorepos where only sub-projects are
26
+ * indexed, and a server that started before `codegraph init` never surfaces the
27
+ * tools afterward). Instead of an "inactive" note, this variant tells the agent
28
+ * codegraph works **per project**: there's no default project to query, so pass
29
+ * a `projectPath` to any project that HAS a `.codegraph/`. The full single-
30
+ * project playbook ({@link SERVER_INSTRUCTIONS}) is sent instead when the root
31
+ * IS indexed, so the common case stays tight.
32
+ */
33
+ export declare const SERVER_INSTRUCTIONS_NO_ROOT_INDEX = "# Codegraph \u2014 available (per-project; pass projectPath)\n\nCodegraph is a SQLite knowledge graph of a codebase's symbols, edges, and\nfiles: one `codegraph_explore` call returns the verbatim, line-numbered source\nof the relevant symbols PLUS the call paths between them and a blast-radius\nsummary \u2014 replacing a grep + Read loop with one round-trip.\n\nThis server started somewhere with no `.codegraph/` of its own, so there is no\ndefault project \u2014 but the tools are available and work **per project**:\n\n- To query a project that HAS a `.codegraph/` index (e.g. a service inside a\n monorepo, or a second repo), pass its path as `projectPath` to\n `codegraph_explore` (and any other codegraph tool). Codegraph resolves the\n nearest `.codegraph/` at or above that path and answers from it \u2014 for as many\n projects as you like in one session.\n- For a project with no `.codegraph/`, use your built-in tools (Read/Grep/Glob)\n for that project. Indexing is the user's decision \u2014 don't run it yourself, but\n if it comes up they can run `codegraph init` in a project to enable codegraph\n there (a new index is picked up live, no restart).\n";
34
+ //# sourceMappingURL=server-instructions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server-instructions.d.ts","sourceRoot":"","sources":["../../src/mcp/server-instructions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,mBAAmB,qsJAkD/B,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,iCAAiC,4pCAmB7C,CAAC"}
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SERVER_INSTRUCTIONS_NO_ROOT_INDEX = exports.SERVER_INSTRUCTIONS = void 0;
4
+ /**
5
+ * Server-level instructions emitted in the MCP `initialize` response.
6
+ *
7
+ * MCP clients (Claude Code, Cursor, opencode, LangChain, OpenAI Agent
8
+ * SDK, …) surface this text in the agent's system prompt automatically,
9
+ * giving the agent a high-level playbook for the codegraph toolset
10
+ * before it sees individual tool descriptions.
11
+ *
12
+ * Goals when editing this:
13
+ * - Lead the agent to codegraph_explore for any structural/flow question
14
+ * - Reinforce "explore instead of Read/Grep" for indexed code
15
+ * - Anti-patterns (don't re-verify with grep; don't hand-reconstruct flows)
16
+ *
17
+ * Keep it tight. The agent reads this every session — long instructions
18
+ * burn tokens. The DEFAULT MCP surface is `codegraph_explore` ALONE (see
19
+ * DEFAULT_MCP_TOOLS in tools.ts) — reference only that tool here. The other
20
+ * tools (node/search/callers/…) stay defined and are re-enablable via
21
+ * CODEGRAPH_MCP_TOOLS, but they are NOT listed to agents, so don't name them.
22
+ */
23
+ exports.SERVER_INSTRUCTIONS = `# Codegraph — code intelligence over an indexed knowledge graph
24
+
25
+ Codegraph is a SQLite knowledge graph of every symbol, edge, and file in
26
+ the workspace — pre-computed structure you would otherwise re-derive by
27
+ reading files (cached intelligence: thousands of parse/trace decisions you
28
+ don't pay to re-reason each run). Reads are sub-millisecond; the index lags
29
+ writes by ~1s through the file watcher. Reach for it BEFORE *and* while
30
+ writing or editing code — not just for questions: one call returns the
31
+ verbatim source PLUS who calls it and what it affects, so you edit with the
32
+ blast radius in view. More accurate context, in far fewer tokens and
33
+ round-trips than reading files yourself.
34
+
35
+ ## One tool: codegraph_explore — use it instead of reading files
36
+
37
+ There is a single tool, \`codegraph_explore\`, and it is Read-equivalent. It
38
+ takes either a natural-language question or a bag of symbol/file names and
39
+ returns the **verbatim, line-numbered source** of the relevant symbols
40
+ grouped by file — the same \`<n>\\t<line>\` shape \`Read\` gives you, safe to
41
+ \`Edit\` from — PLUS the call path among them (including dynamic-dispatch hops
42
+ like callbacks, React re-render, and JSX children that grep can't follow) and
43
+ a blast-radius summary of what depends on them.
44
+
45
+ Whether you're answering "how does X work" or implementing a change (fixing a
46
+ bug, adding a feature), call \`codegraph_explore\` before you Read. ONE call
47
+ usually answers the whole question. Codegraph IS the pre-built search index —
48
+ so running your own grep + read loop, or delegating the lookup to a separate
49
+ file-reading sub-task/agent, repeats work codegraph already did and costs more
50
+ for the same answer. A direct codegraph answer is typically one to a few
51
+ calls; a grep/read exploration is dozens.
52
+
53
+ ## How to query
54
+
55
+ - **Almost any question — "how does X work", architecture, a bug, "what/where is X", or surveying an area** → \`codegraph_explore\` with a natural-language question or the relevant names. ONE capped call returns the verbatim source grouped by file; most often the ONLY call you need.
56
+ - **"How does X reach/become Y? / the flow / the path from X to Y"** → \`codegraph_explore\`, naming the symbols that span the flow (e.g. \`mutateElement renderScene\`) — it surfaces the call path among them, riding dynamic-dispatch hops, and returns their source.
57
+ - **Reading or editing a file/symbol you can name** → put its name or file path in the \`codegraph_explore\` query — it returns that current line-numbered source (safe to \`Edit\` from) with the call path and blast radius attached, so you don't Read it separately. For an overloaded name it returns every matching definition's body in one call.
58
+ - **Need more?** Call \`codegraph_explore\` again with more specific names — treat the source it returns as already Read.
59
+
60
+ ## Anti-patterns
61
+
62
+ - **Trust codegraph's results — don't re-verify them with grep.** They come from a full AST parse; re-checking with grep is slower, less accurate, and wastes context.
63
+ - **Don't grep or Read first** to find or understand indexed code — ONE \`codegraph_explore\` returns the relevant symbols' source together in a single round-trip. Reach for raw \`Read\`/\`Grep\` only to confirm a specific detail codegraph didn't cover, or for what codegraph doesn't index (configs, docs).
64
+ - **Don't reconstruct a flow by hand** — name the endpoints in one \`codegraph_explore\` and it surfaces the path between them, dynamic-dispatch hops included.
65
+ - **After editing, check the staleness banner.** When a tool response starts with "⚠️ Some files referenced below were edited since the last index sync…", the listed files are pending re-index — Read those specific files for accurate content. Every file NOT in that banner is fresh, so still trust codegraph. A different, rarer banner — "⚠️ CodeGraph auto-sync is DISABLED…" — means live watching stopped entirely (the whole index is frozen, not just a few files); until it's resolved, Read files directly to confirm anything that may have changed.
66
+
67
+ ## Limitations
68
+
69
+ - If a tool reports a project isn't indexed (no \`.codegraph/\`), stop calling codegraph tools for that project for the rest of the session and use your built-in tools there instead. Indexing is the user's decision — mention they can run \`codegraph init\` if it comes up, but don't run it yourself.
70
+ - Index lags file writes by ~1 second.
71
+ - Cross-file resolution is best-effort name matching; ambiguous calls may return multiple candidates.
72
+ - No live correctness validation — that's still the TypeScript compiler / test suite / linter's job. Codegraph supplements those with structural context they don't have.
73
+ `;
74
+ /**
75
+ * Instructions variant sent when the server's own root has NO codegraph index.
76
+ *
77
+ * The tools are still exposed (gating tool availability on whether `./` has an
78
+ * index is the bug behind #964: it breaks monorepos where only sub-projects are
79
+ * indexed, and a server that started before `codegraph init` never surfaces the
80
+ * tools afterward). Instead of an "inactive" note, this variant tells the agent
81
+ * codegraph works **per project**: there's no default project to query, so pass
82
+ * a `projectPath` to any project that HAS a `.codegraph/`. The full single-
83
+ * project playbook ({@link SERVER_INSTRUCTIONS}) is sent instead when the root
84
+ * IS indexed, so the common case stays tight.
85
+ */
86
+ exports.SERVER_INSTRUCTIONS_NO_ROOT_INDEX = `# Codegraph — available (per-project; pass projectPath)
87
+
88
+ Codegraph is a SQLite knowledge graph of a codebase's symbols, edges, and
89
+ files: one \`codegraph_explore\` call returns the verbatim, line-numbered source
90
+ of the relevant symbols PLUS the call paths between them and a blast-radius
91
+ summary — replacing a grep + Read loop with one round-trip.
92
+
93
+ This server started somewhere with no \`.codegraph/\` of its own, so there is no
94
+ default project — but the tools are available and work **per project**:
95
+
96
+ - To query a project that HAS a \`.codegraph/\` index (e.g. a service inside a
97
+ monorepo, or a second repo), pass its path as \`projectPath\` to
98
+ \`codegraph_explore\` (and any other codegraph tool). Codegraph resolves the
99
+ nearest \`.codegraph/\` at or above that path and answers from it — for as many
100
+ projects as you like in one session.
101
+ - For a project with no \`.codegraph/\`, use your built-in tools (Read/Grep/Glob)
102
+ for that project. Indexing is the user's decision — don't run it yourself, but
103
+ if it comes up they can run \`codegraph init\` in a project to enable codegraph
104
+ there (a new index is picked up live, no restart).
105
+ `;
106
+ //# sourceMappingURL=server-instructions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server-instructions.js","sourceRoot":"","sources":["../../src/mcp/server-instructions.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACU,QAAA,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkDlC,CAAC;AAEF;;;;;;;;;;;GAWG;AACU,QAAA,iCAAiC,GAAG;;;;;;;;;;;;;;;;;;;CAmBhD,CAAC"}
@@ -0,0 +1,93 @@
1
+ /**
2
+ * MCP per-connection session — speaks the JSON-RPC protocol (initialize,
3
+ * tools/list, tools/call) over a single {@link JsonRpcTransport}. It owns
4
+ * per-client state only (which protocol version the client asked for, whether
5
+ * it advertised `roots`, the one-shot roots/list latch); the heavyweight
6
+ * resources (CodeGraph, watcher, ToolHandler) live in the shared
7
+ * {@link MCPEngine} so daemon mode can collapse N inotify sets / DB handles
8
+ * to one.
9
+ *
10
+ * The state-machine itself mirrors what `MCPServer` used to do inline before
11
+ * issue #411 split it out — the same regression tests in
12
+ * `__tests__/mcp-initialize.test.ts` still drive this code path.
13
+ */
14
+ import { JsonRpcTransport } from './transport';
15
+ import { MCPEngine } from './engine';
16
+ /**
17
+ * MCP Server Info — kept on the session because some clients log it. The
18
+ * version tracks the real package version (was a hard-coded '0.1.0').
19
+ */
20
+ export declare const SERVER_INFO: {
21
+ name: string;
22
+ version: string;
23
+ };
24
+ /**
25
+ * Instructions for the `initialize` response, with the update-availability
26
+ * notice appended when one is known (#1243). Exported so the proxy's local
27
+ * handshake sends the IDENTICAL payload — same convention as SERVER_INFO.
28
+ * `getUpdateNotice` is a memoized synchronous cache read, so the #172
29
+ * respond-fast contract holds; when no notice exists the instructions are
30
+ * byte-identical to the bare constants.
31
+ *
32
+ * Test-authoring note: on a machine whose real `~/.codegraph` cache knows a
33
+ * newer release, spawned servers append the notice — a test asserting exact
34
+ * instructions equality must set `CODEGRAPH_NO_UPDATE_CHECK=1` in the spawn
35
+ * env or it will fail only in the weeks after a release ships.
36
+ */
37
+ export declare function initializeInstructions(base: string, notice?: string | null): string;
38
+ /** MCP Protocol Version (latest the server claims). */
39
+ export declare const PROTOCOL_VERSION = "2024-11-05";
40
+ export interface MCPSessionOptions {
41
+ /**
42
+ * Explicit project path from the `--path` CLI flag. When set, the session
43
+ * will not bother asking the client for `roots/list` — we already know
44
+ * where the project lives.
45
+ */
46
+ explicitProjectPath?: string | null;
47
+ }
48
+ /**
49
+ * One MCP client's view of the server. Created fresh per stdio launch
50
+ * (direct mode) or per socket connection (daemon mode).
51
+ */
52
+ export declare class MCPSession {
53
+ private transport;
54
+ private engine;
55
+ private clientSupportsRoots;
56
+ /** From the initialize handshake — attributes usage rollups to the agent host. */
57
+ private clientInfo;
58
+ private rootsAttempted;
59
+ private resolvePromise;
60
+ private explicitProjectPath;
61
+ constructor(transport: JsonRpcTransport, engine: MCPEngine, opts?: MCPSessionOptions);
62
+ /**
63
+ * Start handling messages from the transport. Returns immediately — the
64
+ * session lives for as long as the transport is open.
65
+ */
66
+ start(): void;
67
+ /**
68
+ * Tear down the session. Does NOT touch the engine (the engine may serve
69
+ * other sessions) or call `process.exit` (the daemon decides when to exit).
70
+ */
71
+ stop(): void;
72
+ /** Underlying transport — exposed for daemon-side close hooks. */
73
+ getTransport(): JsonRpcTransport;
74
+ private handleMessage;
75
+ private handleInitialize;
76
+ private handleToolsList;
77
+ private handleToolsCall;
78
+ /**
79
+ * Lazy default-project resolution. Three layers:
80
+ * 1. await the in-flight init kicked off from `handleInitialize` (if any);
81
+ * 2. if still uninitialized and we never asked the client for its roots,
82
+ * do so now (one-shot); fall back to cwd if the client lacks roots;
83
+ * 3. last-resort: re-walk from the best candidate — picks up projects
84
+ * that were `codegraph init`'d *after* the server started.
85
+ */
86
+ private retryInitIfNeeded;
87
+ /**
88
+ * Ask the client for its workspace root via `roots/list` and open the
89
+ * first one. Falls back to `process.cwd()` on timeout or empty answer.
90
+ */
91
+ private initFromRoots;
92
+ }
93
+ //# sourceMappingURL=session.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/mcp/session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAAuC,gBAAgB,EAAc,MAAM,aAAa,CAAC;AAChG,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAQrC;;;GAGG;AAGH,eAAO,MAAM,WAAW;;;CAGvB,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,GAAE,MAAM,GAAG,IAAwB,GAAG,MAAM,CAMtG;AAED,uDAAuD;AACvD,eAAO,MAAM,gBAAgB,eAAe,CAAC;AAmC7C,MAAM,WAAW,iBAAiB;IAChC;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACrC;AAED;;;GAGG;AACH,qBAAa,UAAU;IASnB,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,MAAM;IAThB,OAAO,CAAC,mBAAmB,CAAS;IACpC,kFAAkF;IAClF,OAAO,CAAC,UAAU,CAAyB;IAC3C,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,cAAc,CAA8B;IACpD,OAAO,CAAC,mBAAmB,CAAgB;gBAGjC,SAAS,EAAE,gBAAgB,EAC3B,MAAM,EAAE,SAAS,EACzB,IAAI,GAAE,iBAAsB;IAK9B;;;OAGG;IACH,KAAK,IAAI,IAAI;IAIb;;;OAGG;IACH,IAAI,IAAI,IAAI;IAIZ,kEAAkE;IAClE,YAAY,IAAI,gBAAgB;YAIlB,aAAa;YA0Cb,gBAAgB;YA0DhB,eAAe;YAkBf,eAAe;IAoC7B;;;;;;;OAOG;YACW,iBAAiB;IAyB/B;;;OAGG;YACW,aAAa;CAgB5B"}
@@ -0,0 +1,357 @@
1
+ "use strict";
2
+ /**
3
+ * MCP per-connection session — speaks the JSON-RPC protocol (initialize,
4
+ * tools/list, tools/call) over a single {@link JsonRpcTransport}. It owns
5
+ * per-client state only (which protocol version the client asked for, whether
6
+ * it advertised `roots`, the one-shot roots/list latch); the heavyweight
7
+ * resources (CodeGraph, watcher, ToolHandler) live in the shared
8
+ * {@link MCPEngine} so daemon mode can collapse N inotify sets / DB handles
9
+ * to one.
10
+ *
11
+ * The state-machine itself mirrors what `MCPServer` used to do inline before
12
+ * issue #411 split it out — the same regression tests in
13
+ * `__tests__/mcp-initialize.test.ts` still drive this code path.
14
+ */
15
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ var desc = Object.getOwnPropertyDescriptor(m, k);
18
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
19
+ desc = { enumerable: true, get: function() { return m[k]; } };
20
+ }
21
+ Object.defineProperty(o, k2, desc);
22
+ }) : (function(o, m, k, k2) {
23
+ if (k2 === undefined) k2 = k;
24
+ o[k2] = m[k];
25
+ }));
26
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
27
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
28
+ }) : function(o, v) {
29
+ o["default"] = v;
30
+ });
31
+ var __importStar = (this && this.__importStar) || (function () {
32
+ var ownKeys = function(o) {
33
+ ownKeys = Object.getOwnPropertyNames || function (o) {
34
+ var ar = [];
35
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
36
+ return ar;
37
+ };
38
+ return ownKeys(o);
39
+ };
40
+ return function (mod) {
41
+ if (mod && mod.__esModule) return mod;
42
+ var result = {};
43
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
44
+ __setModuleDefault(result, mod);
45
+ return result;
46
+ };
47
+ })();
48
+ Object.defineProperty(exports, "__esModule", { value: true });
49
+ exports.MCPSession = exports.PROTOCOL_VERSION = exports.SERVER_INFO = void 0;
50
+ exports.initializeInstructions = initializeInstructions;
51
+ const path = __importStar(require("path"));
52
+ const transport_1 = require("./transport");
53
+ const tools_1 = require("./tools");
54
+ const server_instructions_1 = require("./server-instructions");
55
+ const version_1 = require("./version");
56
+ const directory_1 = require("../directory");
57
+ const telemetry_1 = require("../telemetry");
58
+ const update_check_1 = require("../upgrade/update-check");
59
+ /**
60
+ * MCP Server Info — kept on the session because some clients log it. The
61
+ * version tracks the real package version (was a hard-coded '0.1.0').
62
+ */
63
+ // Exported so the proxy can answer `initialize` locally with the IDENTICAL
64
+ // payload the daemon would send — no drift between the two handshake paths.
65
+ exports.SERVER_INFO = {
66
+ name: 'codegraph',
67
+ version: version_1.CodeGraphPackageVersion,
68
+ };
69
+ /**
70
+ * Instructions for the `initialize` response, with the update-availability
71
+ * notice appended when one is known (#1243). Exported so the proxy's local
72
+ * handshake sends the IDENTICAL payload — same convention as SERVER_INFO.
73
+ * `getUpdateNotice` is a memoized synchronous cache read, so the #172
74
+ * respond-fast contract holds; when no notice exists the instructions are
75
+ * byte-identical to the bare constants.
76
+ *
77
+ * Test-authoring note: on a machine whose real `~/.codegraph` cache knows a
78
+ * newer release, spawned servers append the notice — a test asserting exact
79
+ * instructions equality must set `CODEGRAPH_NO_UPDATE_CHECK=1` in the spawn
80
+ * env or it will fail only in the weeks after a release ships.
81
+ */
82
+ function initializeInstructions(base, notice = (0, update_check_1.getUpdateNotice)()) {
83
+ if (!notice)
84
+ return base;
85
+ return (`${base}\n\n---\n${notice} This server keeps running the old version until ` +
86
+ `the user upgrades — mention it when convenient; do not run the upgrade yourself.`);
87
+ }
88
+ /** MCP Protocol Version (latest the server claims). */
89
+ exports.PROTOCOL_VERSION = '2024-11-05';
90
+ /**
91
+ * How long to wait for the client's `roots/list` response before giving up
92
+ * and falling back to the process cwd.
93
+ */
94
+ const ROOTS_LIST_TIMEOUT_MS = 5000;
95
+ /**
96
+ * Convert a file:// URI to a filesystem path. Handles URL encoding and
97
+ * Windows drive letter paths.
98
+ */
99
+ function fileUriToPath(uri) {
100
+ try {
101
+ const url = new URL(uri);
102
+ let filePath = decodeURIComponent(url.pathname);
103
+ if (process.platform === 'win32' && /^\/[a-zA-Z]:/.test(filePath)) {
104
+ filePath = filePath.slice(1);
105
+ }
106
+ return path.resolve(filePath);
107
+ }
108
+ catch {
109
+ return uri.replace(/^file:\/\/\/?/, '');
110
+ }
111
+ }
112
+ /** First usable filesystem path from a `roots/list` result, or null. */
113
+ function firstRootPath(result) {
114
+ if (!result || typeof result !== 'object')
115
+ return null;
116
+ const roots = result.roots;
117
+ if (!Array.isArray(roots) || roots.length === 0)
118
+ return null;
119
+ const first = roots[0];
120
+ if (typeof first?.uri !== 'string')
121
+ return null;
122
+ return fileUriToPath(first.uri);
123
+ }
124
+ /**
125
+ * One MCP client's view of the server. Created fresh per stdio launch
126
+ * (direct mode) or per socket connection (daemon mode).
127
+ */
128
+ class MCPSession {
129
+ transport;
130
+ engine;
131
+ clientSupportsRoots = false;
132
+ /** From the initialize handshake — attributes usage rollups to the agent host. */
133
+ clientInfo;
134
+ rootsAttempted = false;
135
+ resolvePromise = null;
136
+ explicitProjectPath;
137
+ constructor(transport, engine, opts = {}) {
138
+ this.transport = transport;
139
+ this.engine = engine;
140
+ this.explicitProjectPath = opts.explicitProjectPath ?? null;
141
+ }
142
+ /**
143
+ * Start handling messages from the transport. Returns immediately — the
144
+ * session lives for as long as the transport is open.
145
+ */
146
+ start() {
147
+ this.transport.start(this.handleMessage.bind(this));
148
+ }
149
+ /**
150
+ * Tear down the session. Does NOT touch the engine (the engine may serve
151
+ * other sessions) or call `process.exit` (the daemon decides when to exit).
152
+ */
153
+ stop() {
154
+ this.transport.stop();
155
+ }
156
+ /** Underlying transport — exposed for daemon-side close hooks. */
157
+ getTransport() {
158
+ return this.transport;
159
+ }
160
+ async handleMessage(message) {
161
+ const isRequest = 'id' in message;
162
+ switch (message.method) {
163
+ case 'initialize':
164
+ if (isRequest)
165
+ await this.handleInitialize(message);
166
+ break;
167
+ case 'initialized':
168
+ // Notification that client has finished initialization — no action needed.
169
+ break;
170
+ case 'tools/list':
171
+ if (isRequest)
172
+ await this.handleToolsList(message);
173
+ break;
174
+ case 'tools/call':
175
+ if (isRequest)
176
+ await this.handleToolsCall(message);
177
+ break;
178
+ case 'ping':
179
+ if (isRequest)
180
+ this.transport.sendResult(message.id, {});
181
+ break;
182
+ case 'resources/list':
183
+ // We expose no MCP resources, but some clients (opencode, Codex) probe
184
+ // for them on connect; reply with an empty list instead of a
185
+ // MethodNotFound error that surfaces as a scary `-32601` log line. (#621)
186
+ if (isRequest)
187
+ this.transport.sendResult(message.id, { resources: [] });
188
+ break;
189
+ case 'resources/templates/list':
190
+ if (isRequest)
191
+ this.transport.sendResult(message.id, { resourceTemplates: [] });
192
+ break;
193
+ case 'prompts/list':
194
+ // Likewise — no prompts exposed, but answer the probe cleanly. (#621)
195
+ if (isRequest)
196
+ this.transport.sendResult(message.id, { prompts: [] });
197
+ break;
198
+ default:
199
+ if (isRequest) {
200
+ this.transport.sendError(message.id, transport_1.ErrorCodes.MethodNotFound, `Method not found: ${message.method}`);
201
+ }
202
+ }
203
+ }
204
+ async handleInitialize(request) {
205
+ const params = request.params;
206
+ this.clientSupportsRoots = !!params?.capabilities?.roots;
207
+ if (params?.clientInfo) {
208
+ this.clientInfo = {
209
+ name: typeof params.clientInfo.name === 'string' ? params.clientInfo.name : undefined,
210
+ version: typeof params.clientInfo.version === 'string' ? params.clientInfo.version : undefined,
211
+ };
212
+ }
213
+ // Explicit project signal, strongest first: client-provided rootUri /
214
+ // workspaceFolders (LSP-style), else the --path the server was launched
215
+ // with. cwd is NOT used here — we defer it so a roots/list answer can
216
+ // win over it. See issue #196.
217
+ let explicitPath = null;
218
+ if (params?.rootUri) {
219
+ explicitPath = fileUriToPath(params.rootUri);
220
+ }
221
+ else if (params?.workspaceFolders?.[0]?.uri) {
222
+ explicitPath = fileUriToPath(params.workspaceFolders[0].uri);
223
+ }
224
+ else if (this.explicitProjectPath) {
225
+ explicitPath = this.explicitProjectPath;
226
+ }
227
+ // Pick the instructions variant by the root's index state — a cheap
228
+ // synchronous walk-up (existsSync loop only, no DB open, so the #172
229
+ // respond-fast contract holds). When the root IS indexed, send the full
230
+ // single-project playbook. When it ISN'T, send the per-project variant
231
+ // (tools are still exposed — see handleToolsList): it tells the agent there
232
+ // is no default project and to pass `projectPath` to any project that has a
233
+ // `.codegraph/`. Gating tool AVAILABILITY on whether `./` is indexed was the
234
+ // #964 bug — it broke monorepos (only sub-projects indexed) and never
235
+ // surfaced the tools after a mid-session `codegraph init`. When no explicit
236
+ // path is known yet (roots/list dance pending), cwd is the best predictor of
237
+ // where the default project will resolve.
238
+ const indexed = (0, directory_1.findNearestCodeGraphRoot)(explicitPath ?? process.cwd()) !== null;
239
+ // Respond to the handshake BEFORE doing any heavy init — see issue #172.
240
+ this.transport.sendResult(request.id, {
241
+ protocolVersion: exports.PROTOCOL_VERSION,
242
+ capabilities: { tools: {} },
243
+ serverInfo: exports.SERVER_INFO,
244
+ instructions: initializeInstructions(indexed ? server_instructions_1.SERVER_INSTRUCTIONS : server_instructions_1.SERVER_INSTRUCTIONS_NO_ROOT_INDEX),
245
+ });
246
+ if (explicitPath) {
247
+ // Kick off engine init in the background. If another session in the
248
+ // same daemon already opened the project, `ensureInitialized` is a
249
+ // ~free no-op — N concurrent clients pay exactly one open.
250
+ this.resolvePromise = this.engine.ensureInitialized(explicitPath);
251
+ }
252
+ }
253
+ async handleToolsList(request) {
254
+ await this.retryInitIfNeeded();
255
+ // Always expose the tools — even when the server root has no index. Gating
256
+ // availability on whether `./` is indexed (the old behavior) breaks the
257
+ // monorepo case where only sub-projects carry a `.codegraph/` (the agent
258
+ // saw zero tools and couldn't even reach an indexed sub-project by
259
+ // `projectPath`), and it hides the tools from a session that started before
260
+ // the user ran `codegraph init` (most hosts request the list once, so the
261
+ // freshly-built index never surfaces). #964. The not-indexed case is still
262
+ // safe: a call against an un-indexed path returns SUCCESS-shaped guidance
263
+ // ("pass projectPath / run codegraph init"), never `isError`, so it can't
264
+ // teach the agent to abandon codegraph. `getTools()` returns the default
265
+ // surface even before a project is open.
266
+ this.transport.sendResult(request.id, {
267
+ tools: this.engine.getToolHandler().getTools(),
268
+ });
269
+ }
270
+ async handleToolsCall(request) {
271
+ const params = request.params;
272
+ if (!params || !params.name) {
273
+ this.transport.sendError(request.id, transport_1.ErrorCodes.InvalidParams, 'Missing tool name');
274
+ return;
275
+ }
276
+ const toolName = params.name;
277
+ const toolArgs = params.arguments || {};
278
+ const tool = tools_1.tools.find((t) => t.name === toolName);
279
+ if (!tool) {
280
+ this.transport.sendError(request.id, transport_1.ErrorCodes.InvalidParams, `Unknown tool: ${toolName}`);
281
+ return;
282
+ }
283
+ if (process.env.CODEGRAPH_MCP_DEBUG)
284
+ process.stderr.write(`[mcp-debug] toolsCall ${toolName} id=${String(request.id)} pre-init\n`);
285
+ await this.retryInitIfNeeded();
286
+ if (process.env.CODEGRAPH_MCP_DEBUG)
287
+ process.stderr.write(`[mcp-debug] toolsCall ${toolName} id=${String(request.id)} dispatch\n`);
288
+ const result = await this.engine.getToolHandler().execute(toolName, toolArgs);
289
+ if (process.env.CODEGRAPH_MCP_DEBUG)
290
+ process.stderr.write(`[mcp-debug] toolsCall ${toolName} id=${String(request.id)} done\n`);
291
+ this.transport.sendResult(request.id, result);
292
+ // After the reply is on the wire — telemetry must never delay a tool
293
+ // response (in-memory increment only; see src/telemetry).
294
+ (0, telemetry_1.getTelemetry)().recordUsage('mcp_tool', toolName, !result.isError, this.clientInfo);
295
+ }
296
+ /**
297
+ * Lazy default-project resolution. Three layers:
298
+ * 1. await the in-flight init kicked off from `handleInitialize` (if any);
299
+ * 2. if still uninitialized and we never asked the client for its roots,
300
+ * do so now (one-shot); fall back to cwd if the client lacks roots;
301
+ * 3. last-resort: re-walk from the best candidate — picks up projects
302
+ * that were `codegraph init`'d *after* the server started.
303
+ */
304
+ async retryInitIfNeeded() {
305
+ if (this.resolvePromise) {
306
+ try {
307
+ await this.resolvePromise;
308
+ }
309
+ catch { /* fall through to retry */ }
310
+ this.resolvePromise = null;
311
+ }
312
+ if (this.engine.hasDefaultCodeGraph())
313
+ return;
314
+ const hint = this.explicitProjectPath ?? this.engine.getProjectPath();
315
+ if (!hint && !this.rootsAttempted) {
316
+ this.rootsAttempted = true;
317
+ this.resolvePromise = this.clientSupportsRoots
318
+ ? this.initFromRoots()
319
+ : this.engine.ensureInitialized(process.cwd());
320
+ try {
321
+ await this.resolvePromise;
322
+ }
323
+ catch { /* fall through */ }
324
+ this.resolvePromise = null;
325
+ if (this.engine.hasDefaultCodeGraph())
326
+ return;
327
+ }
328
+ // Last resort: walk from the best candidate (sync open). Picks up
329
+ // projects that appeared after the server started.
330
+ const candidate = hint ?? process.cwd();
331
+ this.engine.retryInitializeSync(candidate);
332
+ }
333
+ /**
334
+ * Ask the client for its workspace root via `roots/list` and open the
335
+ * first one. Falls back to `process.cwd()` on timeout or empty answer.
336
+ */
337
+ async initFromRoots() {
338
+ let target = process.cwd();
339
+ try {
340
+ const result = await this.transport.request('roots/list', undefined, ROOTS_LIST_TIMEOUT_MS);
341
+ const rootPath = firstRootPath(result);
342
+ if (rootPath) {
343
+ target = rootPath;
344
+ }
345
+ else {
346
+ process.stderr.write('[CodeGraph MCP] Client returned no workspace roots; falling back to process cwd.\n');
347
+ }
348
+ }
349
+ catch (err) {
350
+ const msg = err instanceof Error ? err.message : String(err);
351
+ process.stderr.write(`[CodeGraph MCP] roots/list request failed (${msg}); falling back to process cwd.\n`);
352
+ }
353
+ await this.engine.ensureInitialized(target);
354
+ }
355
+ }
356
+ exports.MCPSession = MCPSession;
357
+ //# sourceMappingURL=session.js.map
@@ -0,0 +1 @@
1
+ {"version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