cgraphx 1.1.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 (936) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +243 -0
  3. package/dist/.claude-template/commands/my-commit.md +9 -0
  4. package/dist/.claude-template/commands/my-query.md +4 -0
  5. package/dist/.claude-template/hooks/context-monitor/context-monitor.cjs +216 -0
  6. package/dist/.claude-template/plugins/claude-hud/dist/claude-config-dir.d.ts +4 -0
  7. package/dist/.claude-template/plugins/claude-hud/dist/claude-config-dir.d.ts.map +1 -0
  8. package/dist/.claude-template/plugins/claude-hud/dist/claude-config-dir.js +24 -0
  9. package/dist/.claude-template/plugins/claude-hud/dist/claude-config-dir.js.map +1 -0
  10. package/dist/.claude-template/plugins/claude-hud/dist/config-reader.d.ts +8 -0
  11. package/dist/.claude-template/plugins/claude-hud/dist/config-reader.d.ts.map +1 -0
  12. package/dist/.claude-template/plugins/claude-hud/dist/config-reader.js +204 -0
  13. package/dist/.claude-template/plugins/claude-hud/dist/config-reader.js.map +1 -0
  14. package/dist/.claude-template/plugins/claude-hud/dist/config.d.ts +46 -0
  15. package/dist/.claude-template/plugins/claude-hud/dist/config.d.ts.map +1 -0
  16. package/dist/.claude-template/plugins/claude-hud/dist/config.js +220 -0
  17. package/dist/.claude-template/plugins/claude-hud/dist/config.js.map +1 -0
  18. package/dist/.claude-template/plugins/claude-hud/dist/constants.d.ts +10 -0
  19. package/dist/.claude-template/plugins/claude-hud/dist/constants.d.ts.map +1 -0
  20. package/dist/.claude-template/plugins/claude-hud/dist/constants.js +10 -0
  21. package/dist/.claude-template/plugins/claude-hud/dist/constants.js.map +1 -0
  22. package/dist/.claude-template/plugins/claude-hud/dist/debug.d.ts +6 -0
  23. package/dist/.claude-template/plugins/claude-hud/dist/debug.d.ts.map +1 -0
  24. package/dist/.claude-template/plugins/claude-hud/dist/debug.js +15 -0
  25. package/dist/.claude-template/plugins/claude-hud/dist/debug.js.map +1 -0
  26. package/dist/.claude-template/plugins/claude-hud/dist/extra-cmd.d.ts +23 -0
  27. package/dist/.claude-template/plugins/claude-hud/dist/extra-cmd.d.ts.map +1 -0
  28. package/dist/.claude-template/plugins/claude-hud/dist/extra-cmd.js +103 -0
  29. package/dist/.claude-template/plugins/claude-hud/dist/extra-cmd.js.map +1 -0
  30. package/dist/.claude-template/plugins/claude-hud/dist/git.d.ts +16 -0
  31. package/dist/.claude-template/plugins/claude-hud/dist/git.d.ts.map +1 -0
  32. package/dist/.claude-template/plugins/claude-hud/dist/git.js +86 -0
  33. package/dist/.claude-template/plugins/claude-hud/dist/git.js.map +1 -0
  34. package/dist/.claude-template/plugins/claude-hud/dist/index.d.ts +24 -0
  35. package/dist/.claude-template/plugins/claude-hud/dist/index.d.ts.map +1 -0
  36. package/dist/.claude-template/plugins/claude-hud/dist/index.js +97 -0
  37. package/dist/.claude-template/plugins/claude-hud/dist/index.js.map +1 -0
  38. package/dist/.claude-template/plugins/claude-hud/dist/render/agents-line.d.ts +3 -0
  39. package/dist/.claude-template/plugins/claude-hud/dist/render/agents-line.d.ts.map +1 -0
  40. package/dist/.claude-template/plugins/claude-hud/dist/render/agents-line.js +44 -0
  41. package/dist/.claude-template/plugins/claude-hud/dist/render/agents-line.js.map +1 -0
  42. package/dist/.claude-template/plugins/claude-hud/dist/render/colors.d.ts +12 -0
  43. package/dist/.claude-template/plugins/claude-hud/dist/render/colors.d.ts.map +1 -0
  44. package/dist/.claude-template/plugins/claude-hud/dist/render/colors.js +58 -0
  45. package/dist/.claude-template/plugins/claude-hud/dist/render/colors.js.map +1 -0
  46. package/dist/.claude-template/plugins/claude-hud/dist/render/index.d.ts +3 -0
  47. package/dist/.claude-template/plugins/claude-hud/dist/render/index.d.ts.map +1 -0
  48. package/dist/.claude-template/plugins/claude-hud/dist/render/index.js +379 -0
  49. package/dist/.claude-template/plugins/claude-hud/dist/render/index.js.map +1 -0
  50. package/dist/.claude-template/plugins/claude-hud/dist/render/lines/environment.d.ts +3 -0
  51. package/dist/.claude-template/plugins/claude-hud/dist/render/lines/environment.d.ts.map +1 -0
  52. package/dist/.claude-template/plugins/claude-hud/dist/render/lines/environment.js +30 -0
  53. package/dist/.claude-template/plugins/claude-hud/dist/render/lines/environment.js.map +1 -0
  54. package/dist/.claude-template/plugins/claude-hud/dist/render/lines/identity.d.ts +3 -0
  55. package/dist/.claude-template/plugins/claude-hud/dist/render/lines/identity.d.ts.map +1 -0
  56. package/dist/.claude-template/plugins/claude-hud/dist/render/lines/identity.js +52 -0
  57. package/dist/.claude-template/plugins/claude-hud/dist/render/lines/identity.js.map +1 -0
  58. package/dist/.claude-template/plugins/claude-hud/dist/render/lines/index.d.ts +5 -0
  59. package/dist/.claude-template/plugins/claude-hud/dist/render/lines/index.d.ts.map +1 -0
  60. package/dist/.claude-template/plugins/claude-hud/dist/render/lines/index.js +5 -0
  61. package/dist/.claude-template/plugins/claude-hud/dist/render/lines/index.js.map +1 -0
  62. package/dist/.claude-template/plugins/claude-hud/dist/render/lines/project.d.ts +3 -0
  63. package/dist/.claude-template/plugins/claude-hud/dist/render/lines/project.d.ts.map +1 -0
  64. package/dist/.claude-template/plugins/claude-hud/dist/render/lines/project.js +74 -0
  65. package/dist/.claude-template/plugins/claude-hud/dist/render/lines/project.js.map +1 -0
  66. package/dist/.claude-template/plugins/claude-hud/dist/render/lines/usage.d.ts +3 -0
  67. package/dist/.claude-template/plugins/claude-hud/dist/render/lines/usage.d.ts.map +1 -0
  68. package/dist/.claude-template/plugins/claude-hud/dist/render/lines/usage.js +92 -0
  69. package/dist/.claude-template/plugins/claude-hud/dist/render/lines/usage.js.map +1 -0
  70. package/dist/.claude-template/plugins/claude-hud/dist/render/session-line.d.ts +7 -0
  71. package/dist/.claude-template/plugins/claude-hud/dist/render/session-line.d.ts.map +1 -0
  72. package/dist/.claude-template/plugins/claude-hud/dist/render/session-line.js +247 -0
  73. package/dist/.claude-template/plugins/claude-hud/dist/render/session-line.js.map +1 -0
  74. package/dist/.claude-template/plugins/claude-hud/dist/render/todos-line.d.ts +3 -0
  75. package/dist/.claude-template/plugins/claude-hud/dist/render/todos-line.d.ts.map +1 -0
  76. package/dist/.claude-template/plugins/claude-hud/dist/render/todos-line.js +25 -0
  77. package/dist/.claude-template/plugins/claude-hud/dist/render/todos-line.js.map +1 -0
  78. package/dist/.claude-template/plugins/claude-hud/dist/render/tools-line.d.ts +3 -0
  79. package/dist/.claude-template/plugins/claude-hud/dist/render/tools-line.d.ts.map +1 -0
  80. package/dist/.claude-template/plugins/claude-hud/dist/render/tools-line.js +43 -0
  81. package/dist/.claude-template/plugins/claude-hud/dist/render/tools-line.js.map +1 -0
  82. package/dist/.claude-template/plugins/claude-hud/dist/speed-tracker.d.ts +7 -0
  83. package/dist/.claude-template/plugins/claude-hud/dist/speed-tracker.d.ts.map +1 -0
  84. package/dist/.claude-template/plugins/claude-hud/dist/speed-tracker.js +62 -0
  85. package/dist/.claude-template/plugins/claude-hud/dist/speed-tracker.js.map +1 -0
  86. package/dist/.claude-template/plugins/claude-hud/dist/stdin.d.ts +9 -0
  87. package/dist/.claude-template/plugins/claude-hud/dist/stdin.d.ts.map +1 -0
  88. package/dist/.claude-template/plugins/claude-hud/dist/stdin.js +136 -0
  89. package/dist/.claude-template/plugins/claude-hud/dist/stdin.js.map +1 -0
  90. package/dist/.claude-template/plugins/claude-hud/dist/transcript.d.ts +3 -0
  91. package/dist/.claude-template/plugins/claude-hud/dist/transcript.d.ts.map +1 -0
  92. package/dist/.claude-template/plugins/claude-hud/dist/transcript.js +189 -0
  93. package/dist/.claude-template/plugins/claude-hud/dist/transcript.js.map +1 -0
  94. package/dist/.claude-template/plugins/claude-hud/dist/types.d.ts +79 -0
  95. package/dist/.claude-template/plugins/claude-hud/dist/types.d.ts.map +1 -0
  96. package/dist/.claude-template/plugins/claude-hud/dist/types.js +5 -0
  97. package/dist/.claude-template/plugins/claude-hud/dist/types.js.map +1 -0
  98. package/dist/.claude-template/plugins/claude-hud/dist/usage-api.d.ts +59 -0
  99. package/dist/.claude-template/plugins/claude-hud/dist/usage-api.d.ts.map +1 -0
  100. package/dist/.claude-template/plugins/claude-hud/dist/usage-api.js +733 -0
  101. package/dist/.claude-template/plugins/claude-hud/dist/usage-api.js.map +1 -0
  102. package/dist/.claude-template/skills/cgraphx/SKILL.md +143 -0
  103. package/dist/.claude-template/skills/cgraphx/agent-prompt.md +56 -0
  104. package/dist/.claude-template/skills/clarify-requirements/SKILL.md +425 -0
  105. package/dist/.claude-template/skills/code-impact-api/SKILL.md +143 -0
  106. package/dist/.claude-template/skills/code-impact-api/agent-prompt.md +51 -0
  107. package/dist/.claude-template/skills/code-impact-docgen/SKILL.md +366 -0
  108. package/dist/.claude-template/skills/code-impact-docgen/template-business-html.md +242 -0
  109. package/dist/.claude-template/skills/code-impact-docgen/template-business-md.md +107 -0
  110. package/dist/.claude-template/skills/code-impact-docgen/template-technical-html.md +205 -0
  111. package/dist/.claude-template/skills/code-impact-docgen/template-technical-md.md +155 -0
  112. package/dist/.claude-template/skills/code-impact-init/SKILL.md +800 -0
  113. package/dist/.claude-template/skills/code-impact-markdown/SKILL.md +345 -0
  114. package/dist/.claude-template/skills/code-impact-markdown/template-guide.md +68 -0
  115. package/dist/.claude-template/skills/code-impact-markdown/template-memory.md +82 -0
  116. package/dist/.claude-template/skills/code-impact-markdown/template-runbook.md +58 -0
  117. package/dist/.claude-template/skills/db-query/SKILL.md +166 -0
  118. package/dist/.claude-template/skills/db-query/agent-prompt.md +55 -0
  119. package/dist/.claude-template/skills/developer-timeline/SKILL.md +302 -0
  120. package/dist/.claude-template/skills/developer-timeline/demo-single-page-report.html +657 -0
  121. package/dist/.claude-template/skills/implementation/SKILL.md +136 -0
  122. package/dist/.claude-template/skills/subagent-implement/SKILL.md +225 -0
  123. package/dist/.claude-template/skills/subagent-implement/implementer-prompt.md +127 -0
  124. package/dist/.claude-template/skills/subagent-implement/quality-reviewer-prompt.md +130 -0
  125. package/dist/.claude-template/skills/subagent-implement/spec-reviewer-prompt.md +112 -0
  126. package/dist/.claude-template/skills/write-plan/SKILL.md +322 -0
  127. package/dist/.claude-template/skills/write-plan/plan-document-reviewer-prompt.md +134 -0
  128. package/dist/.claude-template/skills/write-prd/SKILL.md +242 -0
  129. package/dist/.claude-template/skills/write-spec/SKILL.md +278 -0
  130. package/dist/bin/codegraph.d.ts +26 -0
  131. package/dist/bin/codegraph.d.ts.map +1 -0
  132. package/dist/bin/codegraph.js +2014 -0
  133. package/dist/bin/codegraph.js.map +1 -0
  134. package/dist/bin/fatal-handler.d.ts +20 -0
  135. package/dist/bin/fatal-handler.d.ts.map +1 -0
  136. package/dist/bin/fatal-handler.js +118 -0
  137. package/dist/bin/fatal-handler.js.map +1 -0
  138. package/dist/bin/node-version-check.d.ts +51 -0
  139. package/dist/bin/node-version-check.d.ts.map +1 -0
  140. package/dist/bin/node-version-check.js +114 -0
  141. package/dist/bin/node-version-check.js.map +1 -0
  142. package/dist/bin/uninstall.d.ts +14 -0
  143. package/dist/bin/uninstall.d.ts.map +1 -0
  144. package/dist/bin/uninstall.js +36 -0
  145. package/dist/bin/uninstall.js.map +1 -0
  146. package/dist/context/formatter.d.ts +30 -0
  147. package/dist/context/formatter.d.ts.map +1 -0
  148. package/dist/context/formatter.js +263 -0
  149. package/dist/context/formatter.js.map +1 -0
  150. package/dist/context/index.d.ts +119 -0
  151. package/dist/context/index.d.ts.map +1 -0
  152. package/dist/context/index.js +1296 -0
  153. package/dist/context/index.js.map +1 -0
  154. package/dist/context/markers.d.ts +19 -0
  155. package/dist/context/markers.d.ts.map +1 -0
  156. package/dist/context/markers.js +22 -0
  157. package/dist/context/markers.js.map +1 -0
  158. package/dist/db/index.d.ts +122 -0
  159. package/dist/db/index.d.ts.map +1 -0
  160. package/dist/db/index.js +296 -0
  161. package/dist/db/index.js.map +1 -0
  162. package/dist/db/migrations.d.ts +44 -0
  163. package/dist/db/migrations.d.ts.map +1 -0
  164. package/dist/db/migrations.js +140 -0
  165. package/dist/db/migrations.js.map +1 -0
  166. package/dist/db/queries.d.ts +401 -0
  167. package/dist/db/queries.d.ts.map +1 -0
  168. package/dist/db/queries.js +1591 -0
  169. package/dist/db/queries.js.map +1 -0
  170. package/dist/db/schema.sql +152 -0
  171. package/dist/db/sqlite-adapter.d.ts +53 -0
  172. package/dist/db/sqlite-adapter.d.ts.map +1 -0
  173. package/dist/db/sqlite-adapter.js +117 -0
  174. package/dist/db/sqlite-adapter.js.map +1 -0
  175. package/dist/dbquery/cli.d.ts +17 -0
  176. package/dist/dbquery/cli.d.ts.map +1 -0
  177. package/dist/dbquery/cli.js +229 -0
  178. package/dist/dbquery/cli.js.map +1 -0
  179. package/dist/dbquery/config.d.ts +38 -0
  180. package/dist/dbquery/config.d.ts.map +1 -0
  181. package/dist/dbquery/config.js +244 -0
  182. package/dist/dbquery/config.js.map +1 -0
  183. package/dist/dbquery/constants.d.ts +40 -0
  184. package/dist/dbquery/constants.d.ts.map +1 -0
  185. package/dist/dbquery/constants.js +65 -0
  186. package/dist/dbquery/constants.js.map +1 -0
  187. package/dist/dbquery/drivers/mysql.d.ts +15 -0
  188. package/dist/dbquery/drivers/mysql.d.ts.map +1 -0
  189. package/dist/dbquery/drivers/mysql.js +102 -0
  190. package/dist/dbquery/drivers/mysql.js.map +1 -0
  191. package/dist/dbquery/drivers/postgres.d.ts +16 -0
  192. package/dist/dbquery/drivers/postgres.d.ts.map +1 -0
  193. package/dist/dbquery/drivers/postgres.js +105 -0
  194. package/dist/dbquery/drivers/postgres.js.map +1 -0
  195. package/dist/dbquery/errors.d.ts +40 -0
  196. package/dist/dbquery/errors.d.ts.map +1 -0
  197. package/dist/dbquery/errors.js +85 -0
  198. package/dist/dbquery/errors.js.map +1 -0
  199. package/dist/dbquery/executor.d.ts +30 -0
  200. package/dist/dbquery/executor.d.ts.map +1 -0
  201. package/dist/dbquery/executor.js +243 -0
  202. package/dist/dbquery/executor.js.map +1 -0
  203. package/dist/dbquery/format.d.ts +18 -0
  204. package/dist/dbquery/format.d.ts.map +1 -0
  205. package/dist/dbquery/format.js +174 -0
  206. package/dist/dbquery/format.js.map +1 -0
  207. package/dist/dbquery/index.d.ts +10 -0
  208. package/dist/dbquery/index.d.ts.map +1 -0
  209. package/dist/dbquery/index.js +23 -0
  210. package/dist/dbquery/index.js.map +1 -0
  211. package/dist/dbquery/init.d.ts +33 -0
  212. package/dist/dbquery/init.d.ts.map +1 -0
  213. package/dist/dbquery/init.js +125 -0
  214. package/dist/dbquery/init.js.map +1 -0
  215. package/dist/dbquery/logging.d.ts +22 -0
  216. package/dist/dbquery/logging.d.ts.map +1 -0
  217. package/dist/dbquery/logging.js +140 -0
  218. package/dist/dbquery/logging.js.map +1 -0
  219. package/dist/dbquery/mcp-tools.d.ts +29 -0
  220. package/dist/dbquery/mcp-tools.d.ts.map +1 -0
  221. package/dist/dbquery/mcp-tools.js +206 -0
  222. package/dist/dbquery/mcp-tools.js.map +1 -0
  223. package/dist/dbquery/queries.d.ts +31 -0
  224. package/dist/dbquery/queries.d.ts.map +1 -0
  225. package/dist/dbquery/queries.js +160 -0
  226. package/dist/dbquery/queries.js.map +1 -0
  227. package/dist/dbquery/safety.d.ts +35 -0
  228. package/dist/dbquery/safety.d.ts.map +1 -0
  229. package/dist/dbquery/safety.js +306 -0
  230. package/dist/dbquery/safety.js.map +1 -0
  231. package/dist/dbquery/types.d.ts +152 -0
  232. package/dist/dbquery/types.d.ts.map +1 -0
  233. package/dist/dbquery/types.js +10 -0
  234. package/dist/dbquery/types.js.map +1 -0
  235. package/dist/directory.d.ts +147 -0
  236. package/dist/directory.d.ts.map +1 -0
  237. package/dist/directory.js +523 -0
  238. package/dist/directory.js.map +1 -0
  239. package/dist/errors.d.ts +136 -0
  240. package/dist/errors.d.ts.map +1 -0
  241. package/dist/errors.js +219 -0
  242. package/dist/errors.js.map +1 -0
  243. package/dist/extraction/astro-extractor.d.ts +79 -0
  244. package/dist/extraction/astro-extractor.d.ts.map +1 -0
  245. package/dist/extraction/astro-extractor.js +320 -0
  246. package/dist/extraction/astro-extractor.js.map +1 -0
  247. package/dist/extraction/dfm-extractor.d.ts +31 -0
  248. package/dist/extraction/dfm-extractor.d.ts.map +1 -0
  249. package/dist/extraction/dfm-extractor.js +151 -0
  250. package/dist/extraction/dfm-extractor.js.map +1 -0
  251. package/dist/extraction/extraction-version.d.ts +25 -0
  252. package/dist/extraction/extraction-version.d.ts.map +1 -0
  253. package/dist/extraction/extraction-version.js +28 -0
  254. package/dist/extraction/extraction-version.js.map +1 -0
  255. package/dist/extraction/function-ref.d.ts +118 -0
  256. package/dist/extraction/function-ref.d.ts.map +1 -0
  257. package/dist/extraction/function-ref.js +727 -0
  258. package/dist/extraction/function-ref.js.map +1 -0
  259. package/dist/extraction/generated-detection.d.ts +30 -0
  260. package/dist/extraction/generated-detection.d.ts.map +1 -0
  261. package/dist/extraction/generated-detection.js +83 -0
  262. package/dist/extraction/generated-detection.js.map +1 -0
  263. package/dist/extraction/grammars.d.ts +114 -0
  264. package/dist/extraction/grammars.d.ts.map +1 -0
  265. package/dist/extraction/grammars.js +477 -0
  266. package/dist/extraction/grammars.js.map +1 -0
  267. package/dist/extraction/index.d.ts +175 -0
  268. package/dist/extraction/index.d.ts.map +1 -0
  269. package/dist/extraction/index.js +1887 -0
  270. package/dist/extraction/index.js.map +1 -0
  271. package/dist/extraction/languages/c-cpp.d.ts +12 -0
  272. package/dist/extraction/languages/c-cpp.d.ts.map +1 -0
  273. package/dist/extraction/languages/c-cpp.js +275 -0
  274. package/dist/extraction/languages/c-cpp.js.map +1 -0
  275. package/dist/extraction/languages/csharp.d.ts +25 -0
  276. package/dist/extraction/languages/csharp.d.ts.map +1 -0
  277. package/dist/extraction/languages/csharp.js +175 -0
  278. package/dist/extraction/languages/csharp.js.map +1 -0
  279. package/dist/extraction/languages/dart.d.ts +3 -0
  280. package/dist/extraction/languages/dart.d.ts.map +1 -0
  281. package/dist/extraction/languages/dart.js +374 -0
  282. package/dist/extraction/languages/dart.js.map +1 -0
  283. package/dist/extraction/languages/go.d.ts +3 -0
  284. package/dist/extraction/languages/go.d.ts.map +1 -0
  285. package/dist/extraction/languages/go.js +111 -0
  286. package/dist/extraction/languages/go.js.map +1 -0
  287. package/dist/extraction/languages/index.d.ts +10 -0
  288. package/dist/extraction/languages/index.d.ts.map +1 -0
  289. package/dist/extraction/languages/index.js +53 -0
  290. package/dist/extraction/languages/index.js.map +1 -0
  291. package/dist/extraction/languages/java.d.ts +3 -0
  292. package/dist/extraction/languages/java.d.ts.map +1 -0
  293. package/dist/extraction/languages/java.js +315 -0
  294. package/dist/extraction/languages/java.js.map +1 -0
  295. package/dist/extraction/languages/javascript.d.ts +3 -0
  296. package/dist/extraction/languages/javascript.d.ts.map +1 -0
  297. package/dist/extraction/languages/javascript.js +106 -0
  298. package/dist/extraction/languages/javascript.js.map +1 -0
  299. package/dist/extraction/languages/kotlin.d.ts +3 -0
  300. package/dist/extraction/languages/kotlin.d.ts.map +1 -0
  301. package/dist/extraction/languages/kotlin.js +379 -0
  302. package/dist/extraction/languages/kotlin.js.map +1 -0
  303. package/dist/extraction/languages/lua.d.ts +3 -0
  304. package/dist/extraction/languages/lua.d.ts.map +1 -0
  305. package/dist/extraction/languages/lua.js +150 -0
  306. package/dist/extraction/languages/lua.js.map +1 -0
  307. package/dist/extraction/languages/luau.d.ts +3 -0
  308. package/dist/extraction/languages/luau.d.ts.map +1 -0
  309. package/dist/extraction/languages/luau.js +37 -0
  310. package/dist/extraction/languages/luau.js.map +1 -0
  311. package/dist/extraction/languages/objc.d.ts +3 -0
  312. package/dist/extraction/languages/objc.d.ts.map +1 -0
  313. package/dist/extraction/languages/objc.js +175 -0
  314. package/dist/extraction/languages/objc.js.map +1 -0
  315. package/dist/extraction/languages/pascal.d.ts +3 -0
  316. package/dist/extraction/languages/pascal.d.ts.map +1 -0
  317. package/dist/extraction/languages/pascal.js +77 -0
  318. package/dist/extraction/languages/pascal.js.map +1 -0
  319. package/dist/extraction/languages/php.d.ts +3 -0
  320. package/dist/extraction/languages/php.d.ts.map +1 -0
  321. package/dist/extraction/languages/php.js +196 -0
  322. package/dist/extraction/languages/php.js.map +1 -0
  323. package/dist/extraction/languages/python.d.ts +3 -0
  324. package/dist/extraction/languages/python.d.ts.map +1 -0
  325. package/dist/extraction/languages/python.js +56 -0
  326. package/dist/extraction/languages/python.js.map +1 -0
  327. package/dist/extraction/languages/r.d.ts +3 -0
  328. package/dist/extraction/languages/r.d.ts.map +1 -0
  329. package/dist/extraction/languages/r.js +314 -0
  330. package/dist/extraction/languages/r.js.map +1 -0
  331. package/dist/extraction/languages/ruby.d.ts +3 -0
  332. package/dist/extraction/languages/ruby.d.ts.map +1 -0
  333. package/dist/extraction/languages/ruby.js +149 -0
  334. package/dist/extraction/languages/ruby.js.map +1 -0
  335. package/dist/extraction/languages/rust.d.ts +3 -0
  336. package/dist/extraction/languages/rust.d.ts.map +1 -0
  337. package/dist/extraction/languages/rust.js +142 -0
  338. package/dist/extraction/languages/rust.js.map +1 -0
  339. package/dist/extraction/languages/scala.d.ts +3 -0
  340. package/dist/extraction/languages/scala.d.ts.map +1 -0
  341. package/dist/extraction/languages/scala.js +209 -0
  342. package/dist/extraction/languages/scala.js.map +1 -0
  343. package/dist/extraction/languages/swift.d.ts +3 -0
  344. package/dist/extraction/languages/swift.d.ts.map +1 -0
  345. package/dist/extraction/languages/swift.js +152 -0
  346. package/dist/extraction/languages/swift.js.map +1 -0
  347. package/dist/extraction/languages/typescript.d.ts +16 -0
  348. package/dist/extraction/languages/typescript.d.ts.map +1 -0
  349. package/dist/extraction/languages/typescript.js +167 -0
  350. package/dist/extraction/languages/typescript.js.map +1 -0
  351. package/dist/extraction/liquid-extractor.d.ts +59 -0
  352. package/dist/extraction/liquid-extractor.d.ts.map +1 -0
  353. package/dist/extraction/liquid-extractor.js +357 -0
  354. package/dist/extraction/liquid-extractor.js.map +1 -0
  355. package/dist/extraction/mybatis-extractor.d.ts +48 -0
  356. package/dist/extraction/mybatis-extractor.d.ts.map +1 -0
  357. package/dist/extraction/mybatis-extractor.js +198 -0
  358. package/dist/extraction/mybatis-extractor.js.map +1 -0
  359. package/dist/extraction/parse-worker.d.ts +8 -0
  360. package/dist/extraction/parse-worker.d.ts.map +1 -0
  361. package/dist/extraction/parse-worker.js +97 -0
  362. package/dist/extraction/parse-worker.js.map +1 -0
  363. package/dist/extraction/razor-extractor.d.ts +42 -0
  364. package/dist/extraction/razor-extractor.d.ts.map +1 -0
  365. package/dist/extraction/razor-extractor.js +285 -0
  366. package/dist/extraction/razor-extractor.js.map +1 -0
  367. package/dist/extraction/svelte-extractor.d.ts +56 -0
  368. package/dist/extraction/svelte-extractor.d.ts.map +1 -0
  369. package/dist/extraction/svelte-extractor.js +275 -0
  370. package/dist/extraction/svelte-extractor.js.map +1 -0
  371. package/dist/extraction/tree-sitter-helpers.d.ts +28 -0
  372. package/dist/extraction/tree-sitter-helpers.d.ts.map +1 -0
  373. package/dist/extraction/tree-sitter-helpers.js +152 -0
  374. package/dist/extraction/tree-sitter-helpers.js.map +1 -0
  375. package/dist/extraction/tree-sitter-types.d.ts +239 -0
  376. package/dist/extraction/tree-sitter-types.d.ts.map +1 -0
  377. package/dist/extraction/tree-sitter-types.js +10 -0
  378. package/dist/extraction/tree-sitter-types.js.map +1 -0
  379. package/dist/extraction/tree-sitter.d.ts +647 -0
  380. package/dist/extraction/tree-sitter.d.ts.map +1 -0
  381. package/dist/extraction/tree-sitter.js +5592 -0
  382. package/dist/extraction/tree-sitter.js.map +1 -0
  383. package/dist/extraction/vue-extractor.d.ts +51 -0
  384. package/dist/extraction/vue-extractor.d.ts.map +1 -0
  385. package/dist/extraction/vue-extractor.js +254 -0
  386. package/dist/extraction/vue-extractor.js.map +1 -0
  387. package/dist/extraction/wasm/tree-sitter-c_sharp.wasm +0 -0
  388. package/dist/extraction/wasm/tree-sitter-lua.wasm +0 -0
  389. package/dist/extraction/wasm/tree-sitter-luau.wasm +0 -0
  390. package/dist/extraction/wasm/tree-sitter-pascal.wasm +0 -0
  391. package/dist/extraction/wasm/tree-sitter-r.wasm +0 -0
  392. package/dist/extraction/wasm/tree-sitter-scala.wasm +0 -0
  393. package/dist/extraction/wasm-runtime-flags.d.ts +38 -0
  394. package/dist/extraction/wasm-runtime-flags.d.ts.map +1 -0
  395. package/dist/extraction/wasm-runtime-flags.js +106 -0
  396. package/dist/extraction/wasm-runtime-flags.js.map +1 -0
  397. package/dist/graph/index.d.ts +8 -0
  398. package/dist/graph/index.d.ts.map +1 -0
  399. package/dist/graph/index.js +13 -0
  400. package/dist/graph/index.js.map +1 -0
  401. package/dist/graph/queries.d.ts +106 -0
  402. package/dist/graph/queries.d.ts.map +1 -0
  403. package/dist/graph/queries.js +339 -0
  404. package/dist/graph/queries.js.map +1 -0
  405. package/dist/graph/traversal.d.ts +127 -0
  406. package/dist/graph/traversal.d.ts.map +1 -0
  407. package/dist/graph/traversal.js +540 -0
  408. package/dist/graph/traversal.js.map +1 -0
  409. package/dist/index.d.ts +563 -0
  410. package/dist/index.d.ts.map +1 -0
  411. package/dist/index.js +1041 -0
  412. package/dist/index.js.map +1 -0
  413. package/dist/installer/claude-assets.d.ts +45 -0
  414. package/dist/installer/claude-assets.d.ts.map +1 -0
  415. package/dist/installer/claude-assets.js +144 -0
  416. package/dist/installer/claude-assets.js.map +1 -0
  417. package/dist/installer/config-writer.d.ts +28 -0
  418. package/dist/installer/config-writer.d.ts.map +1 -0
  419. package/dist/installer/config-writer.js +91 -0
  420. package/dist/installer/config-writer.js.map +1 -0
  421. package/dist/installer/index.d.ts +101 -0
  422. package/dist/installer/index.d.ts.map +1 -0
  423. package/dist/installer/index.js +692 -0
  424. package/dist/installer/index.js.map +1 -0
  425. package/dist/installer/instructions-template.d.ts +41 -0
  426. package/dist/installer/instructions-template.d.ts.map +1 -0
  427. package/dist/installer/instructions-template.js +53 -0
  428. package/dist/installer/instructions-template.js.map +1 -0
  429. package/dist/installer/targets/antigravity.d.ts +57 -0
  430. package/dist/installer/targets/antigravity.d.ts.map +1 -0
  431. package/dist/installer/targets/antigravity.js +308 -0
  432. package/dist/installer/targets/antigravity.js.map +1 -0
  433. package/dist/installer/targets/claude.d.ts +66 -0
  434. package/dist/installer/targets/claude.d.ts.map +1 -0
  435. package/dist/installer/targets/claude.js +564 -0
  436. package/dist/installer/targets/claude.js.map +1 -0
  437. package/dist/installer/targets/codex.d.ts +18 -0
  438. package/dist/installer/targets/codex.d.ts.map +1 -0
  439. package/dist/installer/targets/codex.js +185 -0
  440. package/dist/installer/targets/codex.js.map +1 -0
  441. package/dist/installer/targets/cursor.d.ts +35 -0
  442. package/dist/installer/targets/cursor.d.ts.map +1 -0
  443. package/dist/installer/targets/cursor.js +254 -0
  444. package/dist/installer/targets/cursor.js.map +1 -0
  445. package/dist/installer/targets/gemini.d.ts +26 -0
  446. package/dist/installer/targets/gemini.d.ts.map +1 -0
  447. package/dist/installer/targets/gemini.js +165 -0
  448. package/dist/installer/targets/gemini.js.map +1 -0
  449. package/dist/installer/targets/hermes.d.ts +18 -0
  450. package/dist/installer/targets/hermes.d.ts.map +1 -0
  451. package/dist/installer/targets/hermes.js +359 -0
  452. package/dist/installer/targets/hermes.js.map +1 -0
  453. package/dist/installer/targets/kiro.d.ts +27 -0
  454. package/dist/installer/targets/kiro.d.ts.map +1 -0
  455. package/dist/installer/targets/kiro.js +178 -0
  456. package/dist/installer/targets/kiro.js.map +1 -0
  457. package/dist/installer/targets/opencode.d.ts +38 -0
  458. package/dist/installer/targets/opencode.d.ts.map +1 -0
  459. package/dist/installer/targets/opencode.js +288 -0
  460. package/dist/installer/targets/opencode.js.map +1 -0
  461. package/dist/installer/targets/registry.d.ts +35 -0
  462. package/dist/installer/targets/registry.d.ts.map +1 -0
  463. package/dist/installer/targets/registry.js +91 -0
  464. package/dist/installer/targets/registry.js.map +1 -0
  465. package/dist/installer/targets/shared.d.ts +101 -0
  466. package/dist/installer/targets/shared.d.ts.map +1 -0
  467. package/dist/installer/targets/shared.js +264 -0
  468. package/dist/installer/targets/shared.js.map +1 -0
  469. package/dist/installer/targets/toml.d.ts +52 -0
  470. package/dist/installer/targets/toml.d.ts.map +1 -0
  471. package/dist/installer/targets/toml.js +147 -0
  472. package/dist/installer/targets/toml.js.map +1 -0
  473. package/dist/installer/targets/types.d.ts +108 -0
  474. package/dist/installer/targets/types.d.ts.map +1 -0
  475. package/dist/installer/targets/types.js +16 -0
  476. package/dist/installer/targets/types.js.map +1 -0
  477. package/dist/markdown/cli.d.ts +16 -0
  478. package/dist/markdown/cli.d.ts.map +1 -0
  479. package/dist/markdown/cli.js +533 -0
  480. package/dist/markdown/cli.js.map +1 -0
  481. package/dist/markdown/constants.d.ts +22 -0
  482. package/dist/markdown/constants.d.ts.map +1 -0
  483. package/dist/markdown/constants.js +71 -0
  484. package/dist/markdown/constants.js.map +1 -0
  485. package/dist/markdown/dedup.d.ts +20 -0
  486. package/dist/markdown/dedup.d.ts.map +1 -0
  487. package/dist/markdown/dedup.js +64 -0
  488. package/dist/markdown/dedup.js.map +1 -0
  489. package/dist/markdown/errors.d.ts +22 -0
  490. package/dist/markdown/errors.d.ts.map +1 -0
  491. package/dist/markdown/errors.js +45 -0
  492. package/dist/markdown/errors.js.map +1 -0
  493. package/dist/markdown/extractor.d.ts +43 -0
  494. package/dist/markdown/extractor.d.ts.map +1 -0
  495. package/dist/markdown/extractor.js +152 -0
  496. package/dist/markdown/extractor.js.map +1 -0
  497. package/dist/markdown/frontmatter-parser.d.ts +47 -0
  498. package/dist/markdown/frontmatter-parser.d.ts.map +1 -0
  499. package/dist/markdown/frontmatter-parser.js +199 -0
  500. package/dist/markdown/frontmatter-parser.js.map +1 -0
  501. package/dist/markdown/indexer.d.ts +34 -0
  502. package/dist/markdown/indexer.d.ts.map +1 -0
  503. package/dist/markdown/indexer.js +256 -0
  504. package/dist/markdown/indexer.js.map +1 -0
  505. package/dist/markdown/mcp-tools.d.ts +33 -0
  506. package/dist/markdown/mcp-tools.d.ts.map +1 -0
  507. package/dist/markdown/mcp-tools.js +300 -0
  508. package/dist/markdown/mcp-tools.js.map +1 -0
  509. package/dist/markdown/query.d.ts +108 -0
  510. package/dist/markdown/query.d.ts.map +1 -0
  511. package/dist/markdown/query.js +570 -0
  512. package/dist/markdown/query.js.map +1 -0
  513. package/dist/markdown/schema-bootstrap.d.ts +40 -0
  514. package/dist/markdown/schema-bootstrap.d.ts.map +1 -0
  515. package/dist/markdown/schema-bootstrap.js +85 -0
  516. package/dist/markdown/schema-bootstrap.js.map +1 -0
  517. package/dist/markdown/schema.sql +124 -0
  518. package/dist/markdown/store.d.ts +77 -0
  519. package/dist/markdown/store.d.ts.map +1 -0
  520. package/dist/markdown/store.js +194 -0
  521. package/dist/markdown/store.js.map +1 -0
  522. package/dist/markdown/summary-extractor.d.ts +22 -0
  523. package/dist/markdown/summary-extractor.d.ts.map +1 -0
  524. package/dist/markdown/summary-extractor.js +66 -0
  525. package/dist/markdown/summary-extractor.js.map +1 -0
  526. package/dist/markdown/types.d.ts +159 -0
  527. package/dist/markdown/types.d.ts.map +1 -0
  528. package/dist/markdown/types.js +9 -0
  529. package/dist/markdown/types.js.map +1 -0
  530. package/dist/markdown/validator.d.ts +44 -0
  531. package/dist/markdown/validator.d.ts.map +1 -0
  532. package/dist/markdown/validator.js +95 -0
  533. package/dist/markdown/validator.js.map +1 -0
  534. package/dist/mcp/daemon-manager.d.ts +42 -0
  535. package/dist/mcp/daemon-manager.d.ts.map +1 -0
  536. package/dist/mcp/daemon-manager.js +129 -0
  537. package/dist/mcp/daemon-manager.js.map +1 -0
  538. package/dist/mcp/daemon-paths.d.ts +46 -0
  539. package/dist/mcp/daemon-paths.d.ts.map +1 -0
  540. package/dist/mcp/daemon-paths.js +125 -0
  541. package/dist/mcp/daemon-paths.js.map +1 -0
  542. package/dist/mcp/daemon-registry.d.ts +47 -0
  543. package/dist/mcp/daemon-registry.d.ts.map +1 -0
  544. package/dist/mcp/daemon-registry.js +229 -0
  545. package/dist/mcp/daemon-registry.js.map +1 -0
  546. package/dist/mcp/daemon.d.ts +220 -0
  547. package/dist/mcp/daemon.d.ts.map +1 -0
  548. package/dist/mcp/daemon.js +637 -0
  549. package/dist/mcp/daemon.js.map +1 -0
  550. package/dist/mcp/dynamic-boundaries.d.ts +41 -0
  551. package/dist/mcp/dynamic-boundaries.d.ts.map +1 -0
  552. package/dist/mcp/dynamic-boundaries.js +359 -0
  553. package/dist/mcp/dynamic-boundaries.js.map +1 -0
  554. package/dist/mcp/engine.d.ts +105 -0
  555. package/dist/mcp/engine.d.ts.map +1 -0
  556. package/dist/mcp/engine.js +278 -0
  557. package/dist/mcp/engine.js.map +1 -0
  558. package/dist/mcp/index.d.ts +113 -0
  559. package/dist/mcp/index.d.ts.map +1 -0
  560. package/dist/mcp/index.js +499 -0
  561. package/dist/mcp/index.js.map +1 -0
  562. package/dist/mcp/liveness-watchdog.d.ts +18 -0
  563. package/dist/mcp/liveness-watchdog.d.ts.map +1 -0
  564. package/dist/mcp/liveness-watchdog.js +207 -0
  565. package/dist/mcp/liveness-watchdog.js.map +1 -0
  566. package/dist/mcp/ppid-watchdog.d.ts +44 -0
  567. package/dist/mcp/ppid-watchdog.d.ts.map +1 -0
  568. package/dist/mcp/ppid-watchdog.js +27 -0
  569. package/dist/mcp/ppid-watchdog.js.map +1 -0
  570. package/dist/mcp/proxy.d.ts +87 -0
  571. package/dist/mcp/proxy.d.ts.map +1 -0
  572. package/dist/mcp/proxy.js +641 -0
  573. package/dist/mcp/proxy.js.map +1 -0
  574. package/dist/mcp/server-instructions.d.ts +34 -0
  575. package/dist/mcp/server-instructions.d.ts.map +1 -0
  576. package/dist/mcp/server-instructions.js +106 -0
  577. package/dist/mcp/server-instructions.js.map +1 -0
  578. package/dist/mcp/session.d.ts +79 -0
  579. package/dist/mcp/session.d.ts.map +1 -0
  580. package/dist/mcp/session.js +330 -0
  581. package/dist/mcp/session.js.map +1 -0
  582. package/dist/mcp/stdin-teardown.d.ts +27 -0
  583. package/dist/mcp/stdin-teardown.d.ts.map +1 -0
  584. package/dist/mcp/stdin-teardown.js +49 -0
  585. package/dist/mcp/stdin-teardown.js.map +1 -0
  586. package/dist/mcp/tools.d.ts +547 -0
  587. package/dist/mcp/tools.d.ts.map +1 -0
  588. package/dist/mcp/tools.js +4122 -0
  589. package/dist/mcp/tools.js.map +1 -0
  590. package/dist/mcp/transport.d.ts +188 -0
  591. package/dist/mcp/transport.d.ts.map +1 -0
  592. package/dist/mcp/transport.js +359 -0
  593. package/dist/mcp/transport.js.map +1 -0
  594. package/dist/mcp/version.d.ts +19 -0
  595. package/dist/mcp/version.d.ts.map +1 -0
  596. package/dist/mcp/version.js +71 -0
  597. package/dist/mcp/version.js.map +1 -0
  598. package/dist/project-config.d.ts +36 -0
  599. package/dist/project-config.d.ts.map +1 -0
  600. package/dist/project-config.js +235 -0
  601. package/dist/project-config.js.map +1 -0
  602. package/dist/reasoning/config.d.ts +45 -0
  603. package/dist/reasoning/config.d.ts.map +1 -0
  604. package/dist/reasoning/config.js +171 -0
  605. package/dist/reasoning/config.js.map +1 -0
  606. package/dist/reasoning/credentials.d.ts +5 -0
  607. package/dist/reasoning/credentials.d.ts.map +1 -0
  608. package/dist/reasoning/credentials.js +83 -0
  609. package/dist/reasoning/credentials.js.map +1 -0
  610. package/dist/reasoning/login.d.ts +21 -0
  611. package/dist/reasoning/login.d.ts.map +1 -0
  612. package/dist/reasoning/login.js +85 -0
  613. package/dist/reasoning/login.js.map +1 -0
  614. package/dist/reasoning/reasoner.d.ts +43 -0
  615. package/dist/reasoning/reasoner.d.ts.map +1 -0
  616. package/dist/reasoning/reasoner.js +308 -0
  617. package/dist/reasoning/reasoner.js.map +1 -0
  618. package/dist/resolution/c-fnptr-synthesizer.d.ts +33 -0
  619. package/dist/resolution/c-fnptr-synthesizer.d.ts.map +1 -0
  620. package/dist/resolution/c-fnptr-synthesizer.js +352 -0
  621. package/dist/resolution/c-fnptr-synthesizer.js.map +1 -0
  622. package/dist/resolution/callback-synthesizer.d.ts +15 -0
  623. package/dist/resolution/callback-synthesizer.d.ts.map +1 -0
  624. package/dist/resolution/callback-synthesizer.js +2926 -0
  625. package/dist/resolution/callback-synthesizer.js.map +1 -0
  626. package/dist/resolution/frameworks/astro.d.ts +9 -0
  627. package/dist/resolution/frameworks/astro.d.ts.map +1 -0
  628. package/dist/resolution/frameworks/astro.js +169 -0
  629. package/dist/resolution/frameworks/astro.js.map +1 -0
  630. package/dist/resolution/frameworks/cargo-workspace.d.ts +18 -0
  631. package/dist/resolution/frameworks/cargo-workspace.d.ts.map +1 -0
  632. package/dist/resolution/frameworks/cargo-workspace.js +225 -0
  633. package/dist/resolution/frameworks/cargo-workspace.js.map +1 -0
  634. package/dist/resolution/frameworks/csharp.d.ts +8 -0
  635. package/dist/resolution/frameworks/csharp.d.ts.map +1 -0
  636. package/dist/resolution/frameworks/csharp.js +241 -0
  637. package/dist/resolution/frameworks/csharp.js.map +1 -0
  638. package/dist/resolution/frameworks/drupal.d.ts +51 -0
  639. package/dist/resolution/frameworks/drupal.d.ts.map +1 -0
  640. package/dist/resolution/frameworks/drupal.js +367 -0
  641. package/dist/resolution/frameworks/drupal.js.map +1 -0
  642. package/dist/resolution/frameworks/expo-modules.d.ts +3 -0
  643. package/dist/resolution/frameworks/expo-modules.d.ts.map +1 -0
  644. package/dist/resolution/frameworks/expo-modules.js +148 -0
  645. package/dist/resolution/frameworks/expo-modules.js.map +1 -0
  646. package/dist/resolution/frameworks/express.d.ts +8 -0
  647. package/dist/resolution/frameworks/express.d.ts.map +1 -0
  648. package/dist/resolution/frameworks/express.js +308 -0
  649. package/dist/resolution/frameworks/express.js.map +1 -0
  650. package/dist/resolution/frameworks/fabric.d.ts +3 -0
  651. package/dist/resolution/frameworks/fabric.d.ts.map +1 -0
  652. package/dist/resolution/frameworks/fabric.js +354 -0
  653. package/dist/resolution/frameworks/fabric.js.map +1 -0
  654. package/dist/resolution/frameworks/go.d.ts +8 -0
  655. package/dist/resolution/frameworks/go.d.ts.map +1 -0
  656. package/dist/resolution/frameworks/go.js +161 -0
  657. package/dist/resolution/frameworks/go.js.map +1 -0
  658. package/dist/resolution/frameworks/goframe.d.ts +41 -0
  659. package/dist/resolution/frameworks/goframe.d.ts.map +1 -0
  660. package/dist/resolution/frameworks/goframe.js +112 -0
  661. package/dist/resolution/frameworks/goframe.js.map +1 -0
  662. package/dist/resolution/frameworks/index.d.ts +50 -0
  663. package/dist/resolution/frameworks/index.d.ts.map +1 -0
  664. package/dist/resolution/frameworks/index.js +169 -0
  665. package/dist/resolution/frameworks/index.js.map +1 -0
  666. package/dist/resolution/frameworks/java.d.ts +8 -0
  667. package/dist/resolution/frameworks/java.d.ts.map +1 -0
  668. package/dist/resolution/frameworks/java.js +509 -0
  669. package/dist/resolution/frameworks/java.js.map +1 -0
  670. package/dist/resolution/frameworks/laravel.d.ts +13 -0
  671. package/dist/resolution/frameworks/laravel.d.ts.map +1 -0
  672. package/dist/resolution/frameworks/laravel.js +257 -0
  673. package/dist/resolution/frameworks/laravel.js.map +1 -0
  674. package/dist/resolution/frameworks/nestjs.d.ts +26 -0
  675. package/dist/resolution/frameworks/nestjs.d.ts.map +1 -0
  676. package/dist/resolution/frameworks/nestjs.js +698 -0
  677. package/dist/resolution/frameworks/nestjs.js.map +1 -0
  678. package/dist/resolution/frameworks/play.d.ts +19 -0
  679. package/dist/resolution/frameworks/play.d.ts.map +1 -0
  680. package/dist/resolution/frameworks/play.js +111 -0
  681. package/dist/resolution/frameworks/play.js.map +1 -0
  682. package/dist/resolution/frameworks/python.d.ts +10 -0
  683. package/dist/resolution/frameworks/python.d.ts.map +1 -0
  684. package/dist/resolution/frameworks/python.js +400 -0
  685. package/dist/resolution/frameworks/python.js.map +1 -0
  686. package/dist/resolution/frameworks/react-native.d.ts +3 -0
  687. package/dist/resolution/frameworks/react-native.d.ts.map +1 -0
  688. package/dist/resolution/frameworks/react-native.js +410 -0
  689. package/dist/resolution/frameworks/react-native.js.map +1 -0
  690. package/dist/resolution/frameworks/react.d.ts +8 -0
  691. package/dist/resolution/frameworks/react.d.ts.map +1 -0
  692. package/dist/resolution/frameworks/react.js +334 -0
  693. package/dist/resolution/frameworks/react.js.map +1 -0
  694. package/dist/resolution/frameworks/ruby.d.ts +8 -0
  695. package/dist/resolution/frameworks/ruby.d.ts.map +1 -0
  696. package/dist/resolution/frameworks/ruby.js +302 -0
  697. package/dist/resolution/frameworks/ruby.js.map +1 -0
  698. package/dist/resolution/frameworks/rust.d.ts +8 -0
  699. package/dist/resolution/frameworks/rust.d.ts.map +1 -0
  700. package/dist/resolution/frameworks/rust.js +304 -0
  701. package/dist/resolution/frameworks/rust.js.map +1 -0
  702. package/dist/resolution/frameworks/svelte.d.ts +9 -0
  703. package/dist/resolution/frameworks/svelte.d.ts.map +1 -0
  704. package/dist/resolution/frameworks/svelte.js +253 -0
  705. package/dist/resolution/frameworks/svelte.js.map +1 -0
  706. package/dist/resolution/frameworks/swift-objc.d.ts +37 -0
  707. package/dist/resolution/frameworks/swift-objc.d.ts.map +1 -0
  708. package/dist/resolution/frameworks/swift-objc.js +252 -0
  709. package/dist/resolution/frameworks/swift-objc.js.map +1 -0
  710. package/dist/resolution/frameworks/swift.d.ts +10 -0
  711. package/dist/resolution/frameworks/swift.d.ts.map +1 -0
  712. package/dist/resolution/frameworks/swift.js +400 -0
  713. package/dist/resolution/frameworks/swift.js.map +1 -0
  714. package/dist/resolution/frameworks/vue.d.ts +9 -0
  715. package/dist/resolution/frameworks/vue.d.ts.map +1 -0
  716. package/dist/resolution/frameworks/vue.js +303 -0
  717. package/dist/resolution/frameworks/vue.js.map +1 -0
  718. package/dist/resolution/go-module.d.ts +26 -0
  719. package/dist/resolution/go-module.d.ts.map +1 -0
  720. package/dist/resolution/go-module.js +78 -0
  721. package/dist/resolution/go-module.js.map +1 -0
  722. package/dist/resolution/goframe-synthesizer.d.ts +28 -0
  723. package/dist/resolution/goframe-synthesizer.d.ts.map +1 -0
  724. package/dist/resolution/goframe-synthesizer.js +158 -0
  725. package/dist/resolution/goframe-synthesizer.js.map +1 -0
  726. package/dist/resolution/import-resolver.d.ts +78 -0
  727. package/dist/resolution/import-resolver.d.ts.map +1 -0
  728. package/dist/resolution/import-resolver.js +1849 -0
  729. package/dist/resolution/import-resolver.js.map +1 -0
  730. package/dist/resolution/index.d.ts +196 -0
  731. package/dist/resolution/index.d.ts.map +1 -0
  732. package/dist/resolution/index.js +1328 -0
  733. package/dist/resolution/index.js.map +1 -0
  734. package/dist/resolution/lru-cache.d.ts +24 -0
  735. package/dist/resolution/lru-cache.d.ts.map +1 -0
  736. package/dist/resolution/lru-cache.js +62 -0
  737. package/dist/resolution/lru-cache.js.map +1 -0
  738. package/dist/resolution/name-matcher.d.ts +93 -0
  739. package/dist/resolution/name-matcher.d.ts.map +1 -0
  740. package/dist/resolution/name-matcher.js +1212 -0
  741. package/dist/resolution/name-matcher.js.map +1 -0
  742. package/dist/resolution/path-aliases.d.ts +68 -0
  743. package/dist/resolution/path-aliases.d.ts.map +1 -0
  744. package/dist/resolution/path-aliases.js +238 -0
  745. package/dist/resolution/path-aliases.js.map +1 -0
  746. package/dist/resolution/strip-comments.d.ts +27 -0
  747. package/dist/resolution/strip-comments.d.ts.map +1 -0
  748. package/dist/resolution/strip-comments.js +443 -0
  749. package/dist/resolution/strip-comments.js.map +1 -0
  750. package/dist/resolution/swift-objc-bridge.d.ts +134 -0
  751. package/dist/resolution/swift-objc-bridge.d.ts.map +1 -0
  752. package/dist/resolution/swift-objc-bridge.js +256 -0
  753. package/dist/resolution/swift-objc-bridge.js.map +1 -0
  754. package/dist/resolution/types.d.ts +233 -0
  755. package/dist/resolution/types.d.ts.map +1 -0
  756. package/dist/resolution/types.js +8 -0
  757. package/dist/resolution/types.js.map +1 -0
  758. package/dist/resolution/workspace-packages.d.ts +48 -0
  759. package/dist/resolution/workspace-packages.d.ts.map +1 -0
  760. package/dist/resolution/workspace-packages.js +208 -0
  761. package/dist/resolution/workspace-packages.js.map +1 -0
  762. package/dist/search/query-parser.d.ts +57 -0
  763. package/dist/search/query-parser.d.ts.map +1 -0
  764. package/dist/search/query-parser.js +177 -0
  765. package/dist/search/query-parser.js.map +1 -0
  766. package/dist/search/query-utils.d.ts +87 -0
  767. package/dist/search/query-utils.d.ts.map +1 -0
  768. package/dist/search/query-utils.js +449 -0
  769. package/dist/search/query-utils.js.map +1 -0
  770. package/dist/sync/git-hooks.d.ts +45 -0
  771. package/dist/sync/git-hooks.d.ts.map +1 -0
  772. package/dist/sync/git-hooks.js +225 -0
  773. package/dist/sync/git-hooks.js.map +1 -0
  774. package/dist/sync/index.d.ts +19 -0
  775. package/dist/sync/index.d.ts.map +1 -0
  776. package/dist/sync/index.js +35 -0
  777. package/dist/sync/index.js.map +1 -0
  778. package/dist/sync/watch-policy.d.ts +48 -0
  779. package/dist/sync/watch-policy.d.ts.map +1 -0
  780. package/dist/sync/watch-policy.js +124 -0
  781. package/dist/sync/watch-policy.js.map +1 -0
  782. package/dist/sync/watcher.d.ts +350 -0
  783. package/dist/sync/watcher.d.ts.map +1 -0
  784. package/dist/sync/watcher.js +811 -0
  785. package/dist/sync/watcher.js.map +1 -0
  786. package/dist/sync/worktree.d.ts +54 -0
  787. package/dist/sync/worktree.d.ts.map +1 -0
  788. package/dist/sync/worktree.js +137 -0
  789. package/dist/sync/worktree.js.map +1 -0
  790. package/dist/telemetry/index.d.ts +143 -0
  791. package/dist/telemetry/index.d.ts.map +1 -0
  792. package/dist/telemetry/index.js +541 -0
  793. package/dist/telemetry/index.js.map +1 -0
  794. package/dist/timeline/bash-semantics.d.ts +52 -0
  795. package/dist/timeline/bash-semantics.d.ts.map +1 -0
  796. package/dist/timeline/bash-semantics.js +376 -0
  797. package/dist/timeline/bash-semantics.js.map +1 -0
  798. package/dist/timeline/cli.d.ts +50 -0
  799. package/dist/timeline/cli.d.ts.map +1 -0
  800. package/dist/timeline/cli.js +367 -0
  801. package/dist/timeline/cli.js.map +1 -0
  802. package/dist/timeline/constants.d.ts +62 -0
  803. package/dist/timeline/constants.d.ts.map +1 -0
  804. package/dist/timeline/constants.js +73 -0
  805. package/dist/timeline/constants.js.map +1 -0
  806. package/dist/timeline/errors.d.ts +27 -0
  807. package/dist/timeline/errors.d.ts.map +1 -0
  808. package/dist/timeline/errors.js +51 -0
  809. package/dist/timeline/errors.js.map +1 -0
  810. package/dist/timeline/hook-runner.d.ts +36 -0
  811. package/dist/timeline/hook-runner.d.ts.map +1 -0
  812. package/dist/timeline/hook-runner.js +61 -0
  813. package/dist/timeline/hook-runner.js.map +1 -0
  814. package/dist/timeline/hooks.d.ts +45 -0
  815. package/dist/timeline/hooks.d.ts.map +1 -0
  816. package/dist/timeline/hooks.js +364 -0
  817. package/dist/timeline/hooks.js.map +1 -0
  818. package/dist/timeline/index.d.ts +12 -0
  819. package/dist/timeline/index.d.ts.map +1 -0
  820. package/dist/timeline/index.js +28 -0
  821. package/dist/timeline/index.js.map +1 -0
  822. package/dist/timeline/indexer.d.ts +37 -0
  823. package/dist/timeline/indexer.d.ts.map +1 -0
  824. package/dist/timeline/indexer.js +76 -0
  825. package/dist/timeline/indexer.js.map +1 -0
  826. package/dist/timeline/installer.d.ts +33 -0
  827. package/dist/timeline/installer.d.ts.map +1 -0
  828. package/dist/timeline/installer.js +255 -0
  829. package/dist/timeline/installer.js.map +1 -0
  830. package/dist/timeline/payload.d.ts +31 -0
  831. package/dist/timeline/payload.d.ts.map +1 -0
  832. package/dist/timeline/payload.js +58 -0
  833. package/dist/timeline/payload.js.map +1 -0
  834. package/dist/timeline/post-tool-summary.d.ts +29 -0
  835. package/dist/timeline/post-tool-summary.d.ts.map +1 -0
  836. package/dist/timeline/post-tool-summary.js +190 -0
  837. package/dist/timeline/post-tool-summary.js.map +1 -0
  838. package/dist/timeline/recorder.d.ts +36 -0
  839. package/dist/timeline/recorder.d.ts.map +1 -0
  840. package/dist/timeline/recorder.js +42 -0
  841. package/dist/timeline/recorder.js.map +1 -0
  842. package/dist/timeline/schema-bootstrap.d.ts +42 -0
  843. package/dist/timeline/schema-bootstrap.d.ts.map +1 -0
  844. package/dist/timeline/schema-bootstrap.js +81 -0
  845. package/dist/timeline/schema-bootstrap.js.map +1 -0
  846. package/dist/timeline/schema.sql +37 -0
  847. package/dist/timeline/store.d.ts +69 -0
  848. package/dist/timeline/store.d.ts.map +1 -0
  849. package/dist/timeline/store.js +429 -0
  850. package/dist/timeline/store.js.map +1 -0
  851. package/dist/timeline/types.d.ts +78 -0
  852. package/dist/timeline/types.d.ts.map +1 -0
  853. package/dist/timeline/types.js +9 -0
  854. package/dist/timeline/types.js.map +1 -0
  855. package/dist/types.d.ts +392 -0
  856. package/dist/types.d.ts.map +1 -0
  857. package/dist/types.js +81 -0
  858. package/dist/types.js.map +1 -0
  859. package/dist/ui/glyphs.d.ts +42 -0
  860. package/dist/ui/glyphs.d.ts.map +1 -0
  861. package/dist/ui/glyphs.js +78 -0
  862. package/dist/ui/glyphs.js.map +1 -0
  863. package/dist/ui/shimmer-progress.d.ts +11 -0
  864. package/dist/ui/shimmer-progress.d.ts.map +1 -0
  865. package/dist/ui/shimmer-progress.js +90 -0
  866. package/dist/ui/shimmer-progress.js.map +1 -0
  867. package/dist/ui/shimmer-worker.d.ts +2 -0
  868. package/dist/ui/shimmer-worker.d.ts.map +1 -0
  869. package/dist/ui/shimmer-worker.js +118 -0
  870. package/dist/ui/shimmer-worker.js.map +1 -0
  871. package/dist/ui/types.d.ts +17 -0
  872. package/dist/ui/types.d.ts.map +1 -0
  873. package/dist/ui/types.js +3 -0
  874. package/dist/ui/types.js.map +1 -0
  875. package/dist/upgrade/index.d.ts +132 -0
  876. package/dist/upgrade/index.d.ts.map +1 -0
  877. package/dist/upgrade/index.js +498 -0
  878. package/dist/upgrade/index.js.map +1 -0
  879. package/dist/utils.d.ts +224 -0
  880. package/dist/utils.d.ts.map +1 -0
  881. package/dist/utils.js +583 -0
  882. package/dist/utils.js.map +1 -0
  883. package/package.json +60 -0
  884. package/scripts/add-lang/bench.sh +60 -0
  885. package/scripts/add-lang/check-grammar.mjs +75 -0
  886. package/scripts/add-lang/dump-ast.mjs +103 -0
  887. package/scripts/add-lang/verify-extraction.mjs +70 -0
  888. package/scripts/agent-eval/ab-adoption.sh +91 -0
  889. package/scripts/agent-eval/ab-hook.sh +86 -0
  890. package/scripts/agent-eval/ab-impl.sh +78 -0
  891. package/scripts/agent-eval/ab-new-vs-baseline.sh +102 -0
  892. package/scripts/agent-eval/ab-sufficiency.sh +78 -0
  893. package/scripts/agent-eval/arms-F.sh +21 -0
  894. package/scripts/agent-eval/arms-matrix.sh +37 -0
  895. package/scripts/agent-eval/audit.sh +68 -0
  896. package/scripts/agent-eval/bench-readme.sh +28 -0
  897. package/scripts/agent-eval/bench-why-repo.sh +22 -0
  898. package/scripts/agent-eval/block-read-hook.sh +19 -0
  899. package/scripts/agent-eval/hook-settings.json +15 -0
  900. package/scripts/agent-eval/itrun.sh +120 -0
  901. package/scripts/agent-eval/offload-eval-3arm.sh +72 -0
  902. package/scripts/agent-eval/offload-eval-cost.mjs +133 -0
  903. package/scripts/agent-eval/offload-eval-effort.mjs +108 -0
  904. package/scripts/agent-eval/offload-eval-frontload-matrix.sh +25 -0
  905. package/scripts/agent-eval/offload-eval-frontload.sh +47 -0
  906. package/scripts/agent-eval/offload-eval-ground-truth.json +18 -0
  907. package/scripts/agent-eval/offload-eval-hook.mjs +84 -0
  908. package/scripts/agent-eval/offload-eval-judge.mjs +103 -0
  909. package/scripts/agent-eval/offload-eval-matrix.sh +20 -0
  910. package/scripts/agent-eval/offload-eval-metrics.mjs +94 -0
  911. package/scripts/agent-eval/offload-eval-refs1.sh +50 -0
  912. package/scripts/agent-eval/offload-eval-setup.sh +24 -0
  913. package/scripts/agent-eval/offload-eval-styles.sh +72 -0
  914. package/scripts/agent-eval/offload-eval-summarize.mjs +68 -0
  915. package/scripts/agent-eval/offload-eval.md +76 -0
  916. package/scripts/agent-eval/parse-arms.mjs +116 -0
  917. package/scripts/agent-eval/parse-bench-readme.mjs +84 -0
  918. package/scripts/agent-eval/parse-run.mjs +45 -0
  919. package/scripts/agent-eval/parse-session.mjs +93 -0
  920. package/scripts/agent-eval/probe-context.mjs +21 -0
  921. package/scripts/agent-eval/probe-explore.mjs +40 -0
  922. package/scripts/agent-eval/probe-node.mjs +20 -0
  923. package/scripts/agent-eval/probe-sweep.mjs +119 -0
  924. package/scripts/agent-eval/probe-trace.mjs +20 -0
  925. package/scripts/agent-eval/redirect-read-hook.sh +38 -0
  926. package/scripts/agent-eval/run-agent.sh +34 -0
  927. package/scripts/agent-eval/run-all.sh +69 -0
  928. package/scripts/agent-eval/run-arms.sh +56 -0
  929. package/scripts/agent-eval/seq-matrix.mjs +137 -0
  930. package/scripts/build-bundle.sh +118 -0
  931. package/scripts/extract-release-notes.mjs +130 -0
  932. package/scripts/local-install.sh +41 -0
  933. package/scripts/npm-sdk.js +75 -0
  934. package/scripts/npm-shim.js +246 -0
  935. package/scripts/pack-npm.sh +118 -0
  936. package/scripts/prepare-release.mjs +270 -0
@@ -0,0 +1,1328 @@
1
+ "use strict";
2
+ /**
3
+ * Reference Resolution Orchestrator
4
+ *
5
+ * Coordinates all reference resolution strategies.
6
+ */
7
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
8
+ if (k2 === undefined) k2 = k;
9
+ var desc = Object.getOwnPropertyDescriptor(m, k);
10
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
11
+ desc = { enumerable: true, get: function() { return m[k]; } };
12
+ }
13
+ Object.defineProperty(o, k2, desc);
14
+ }) : (function(o, m, k, k2) {
15
+ if (k2 === undefined) k2 = k;
16
+ o[k2] = m[k];
17
+ }));
18
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
19
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
20
+ }) : function(o, v) {
21
+ o["default"] = v;
22
+ });
23
+ var __importStar = (this && this.__importStar) || (function () {
24
+ var ownKeys = function(o) {
25
+ ownKeys = Object.getOwnPropertyNames || function (o) {
26
+ var ar = [];
27
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
28
+ return ar;
29
+ };
30
+ return ownKeys(o);
31
+ };
32
+ return function (mod) {
33
+ if (mod && mod.__esModule) return mod;
34
+ var result = {};
35
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
36
+ __setModuleDefault(result, mod);
37
+ return result;
38
+ };
39
+ })();
40
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
41
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
42
+ };
43
+ Object.defineProperty(exports, "__esModule", { value: true });
44
+ exports.ReferenceResolver = void 0;
45
+ exports.createResolver = createResolver;
46
+ const fs = __importStar(require("fs"));
47
+ const path = __importStar(require("path"));
48
+ const name_matcher_1 = require("./name-matcher");
49
+ const import_resolver_1 = require("./import-resolver");
50
+ const frameworks_1 = require("./frameworks");
51
+ const callback_synthesizer_1 = require("./callback-synthesizer");
52
+ const path_aliases_1 = require("./path-aliases");
53
+ const go_module_1 = require("./go-module");
54
+ const workspace_packages_1 = require("./workspace-packages");
55
+ const errors_1 = require("../errors");
56
+ const lru_cache_1 = require("./lru-cache");
57
+ /** Node kinds that can declare supertypes (extends/implements). */
58
+ const SUPERTYPE_BEARING_KINDS = new Set([
59
+ 'class', 'struct', 'interface', 'trait', 'protocol', 'enum',
60
+ ]);
61
+ /**
62
+ * Languages whose chained static-factory/fluent calls defer to the conformance
63
+ * second pass. Dotted-receiver languages resolve via matchDottedCallChain; the
64
+ * `::`-receiver ones (Rust) via matchScopedCallChain.
65
+ */
66
+ const CHAIN_LANGUAGES = new Set(['java', 'kotlin', 'csharp', 'swift', 'rust', 'go', 'scala', 'dart', 'objc', 'pascal']);
67
+ const SCOPED_CHAIN_LANGUAGES = new Set(['rust']);
68
+ /** The extractor's chained-receiver encoding: `<inner>().<method>`. */
69
+ const CHAIN_SHAPE = /^(.+)\(\)\.(\w+)$/;
70
+ /**
71
+ * Cache size limits. Each per-resolver cache is bounded so memory
72
+ * stays flat on large codebases (20k+ files). Sizes were chosen to
73
+ * cover the working set for typical resolution batches without
74
+ * exceeding a few hundred MB worst-case. Override via the env var
75
+ * `CGRAPHX_RESOLVER_CACHE_SIZE` (single integer applied to all
76
+ * caches) when tuning for very large or very small projects.
77
+ */
78
+ const DEFAULT_CACHE_LIMIT = 5_000;
79
+ function resolveCacheLimit() {
80
+ const raw = process.env.CGRAPHX_RESOLVER_CACHE_SIZE;
81
+ if (!raw)
82
+ return DEFAULT_CACHE_LIMIT;
83
+ const parsed = Number.parseInt(raw, 10);
84
+ if (Number.isFinite(parsed) && parsed > 0)
85
+ return parsed;
86
+ return DEFAULT_CACHE_LIMIT;
87
+ }
88
+ // Re-export types
89
+ __exportStar(require("./types"), exports);
90
+ // Pre-built Sets for O(1) built-in lookups (allocated once, shared across all instances)
91
+ const JS_BUILT_INS = new Set([
92
+ 'console', 'window', 'document', 'global', 'process',
93
+ 'Promise', 'Array', 'Object', 'String', 'Number', 'Boolean',
94
+ 'Date', 'Math', 'JSON', 'RegExp', 'Error', 'Map', 'Set',
95
+ 'setTimeout', 'setInterval', 'clearTimeout', 'clearInterval',
96
+ 'fetch', 'require', 'module', 'exports', '__dirname', '__filename',
97
+ ]);
98
+ const REACT_HOOKS = new Set([
99
+ 'useState', 'useEffect', 'useContext', 'useReducer', 'useCallback',
100
+ 'useMemo', 'useRef', 'useLayoutEffect', 'useImperativeHandle', 'useDebugValue',
101
+ ]);
102
+ const PYTHON_BUILT_INS = new Set([
103
+ 'print', 'len', 'range', 'str', 'int', 'float', 'list', 'dict', 'set', 'tuple',
104
+ 'open', 'input', 'type', 'isinstance', 'hasattr', 'getattr', 'setattr',
105
+ 'super', 'self', 'cls', 'None', 'True', 'False',
106
+ ]);
107
+ const PYTHON_BUILT_IN_TYPES = new Set([
108
+ 'list', 'dict', 'set', 'tuple', 'str', 'int', 'float', 'bool',
109
+ 'bytes', 'bytearray', 'frozenset', 'object', 'super',
110
+ ]);
111
+ const PYTHON_BUILT_IN_METHODS = new Set([
112
+ 'append', 'extend', 'insert', 'remove', 'pop', 'clear', 'sort', 'reverse', 'copy',
113
+ 'update', 'keys', 'values', 'items', 'get',
114
+ 'add', 'discard', 'union', 'intersection', 'difference',
115
+ 'split', 'join', 'strip', 'lstrip', 'rstrip', 'replace', 'lower', 'upper',
116
+ 'startswith', 'endswith', 'find', 'index', 'count', 'encode', 'decode',
117
+ 'format', 'isdigit', 'isalpha', 'isalnum',
118
+ 'read', 'write', 'readline', 'readlines', 'close', 'flush', 'seek',
119
+ ]);
120
+ const GO_STDLIB_PACKAGES = new Set([
121
+ 'fmt', 'os', 'io', 'net', 'http', 'log', 'math', 'sort', 'sync',
122
+ 'time', 'path', 'bytes', 'strings', 'strconv', 'errors', 'context',
123
+ 'json', 'xml', 'csv', 'html', 'template', 'regexp', 'reflect',
124
+ 'runtime', 'testing', 'flag', 'bufio', 'crypto', 'encoding',
125
+ 'filepath', 'hash', 'mime', 'rand', 'signal', 'sql', 'syscall',
126
+ 'unicode', 'unsafe', 'atomic', 'binary', 'debug', 'exec', 'heap',
127
+ 'ring', 'scanner', 'tar', 'zip', 'gzip', 'zlib', 'tls', 'url',
128
+ 'user', 'pprof', 'trace', 'ast', 'build', 'parser', 'printer',
129
+ 'token', 'types', 'cgo', 'plugin', 'race', 'ioutil',
130
+ // Kubernetes-common stdlib aliases
131
+ 'utilruntime', 'utilwait', 'utilnet',
132
+ ]);
133
+ const GO_BUILT_INS = new Set([
134
+ 'make', 'new', 'len', 'cap', 'append', 'copy', 'delete', 'close',
135
+ 'panic', 'recover', 'print', 'println', 'complex', 'real', 'imag',
136
+ 'error', 'nil', 'true', 'false', 'iota',
137
+ 'int', 'int8', 'int16', 'int32', 'int64',
138
+ 'uint', 'uint8', 'uint16', 'uint32', 'uint64', 'uintptr',
139
+ 'float32', 'float64', 'complex64', 'complex128',
140
+ 'string', 'bool', 'byte', 'rune', 'any',
141
+ ]);
142
+ const PASCAL_UNIT_PREFIXES = [
143
+ 'System.', 'Winapi.', 'Vcl.', 'Fmx.', 'Data.', 'Datasnap.',
144
+ 'Soap.', 'Xml.', 'Web.', 'REST.', 'FireDAC.', 'IBX.',
145
+ 'IdHTTP', 'IdTCP', 'IdSSL',
146
+ ];
147
+ const PASCAL_BUILT_INS = new Set([
148
+ 'System', 'SysUtils', 'Classes', 'Types', 'Variants', 'StrUtils',
149
+ 'Math', 'DateUtils', 'IOUtils', 'Generics.Collections', 'Generics.Defaults',
150
+ 'Rtti', 'TypInfo', 'SyncObjs', 'RegularExpressions',
151
+ 'SysInit', 'Windows', 'Messages', 'Graphics', 'Controls', 'Forms',
152
+ 'Dialogs', 'StdCtrls', 'ExtCtrls', 'ComCtrls', 'Menus', 'ActnList',
153
+ 'WriteLn', 'Write', 'ReadLn', 'Read', 'Inc', 'Dec', 'Ord', 'Chr',
154
+ 'Length', 'SetLength', 'High', 'Low', 'Assigned', 'FreeAndNil',
155
+ 'Format', 'IntToStr', 'StrToInt', 'FloatToStr', 'StrToFloat',
156
+ 'Trim', 'UpperCase', 'LowerCase', 'Pos', 'Copy', 'Delete', 'Insert',
157
+ 'Now', 'Date', 'Time', 'DateToStr', 'StrToDate',
158
+ 'Raise', 'Exit', 'Break', 'Continue', 'Abort',
159
+ 'True', 'False', 'nil', 'Self', 'Result',
160
+ 'Create', 'Destroy', 'Free',
161
+ 'TObject', 'TComponent', 'TPersistent', 'TInterfacedObject',
162
+ 'TList', 'TStringList', 'TStrings', 'TStream', 'TMemoryStream', 'TFileStream',
163
+ 'Exception', 'EAbort', 'EConvertError', 'EAccessViolation',
164
+ 'IInterface', 'IUnknown',
165
+ ]);
166
+ const C_BUILT_INS = new Set([
167
+ // Standard C library functions
168
+ 'printf', 'fprintf', 'sprintf', 'snprintf', 'scanf', 'fscanf', 'sscanf',
169
+ 'malloc', 'calloc', 'realloc', 'free',
170
+ 'memcpy', 'memmove', 'memset', 'memcmp', 'memchr',
171
+ 'strlen', 'strcpy', 'strncpy', 'strcat', 'strncat', 'strcmp', 'strncmp',
172
+ 'strstr', 'strchr', 'strrchr', 'strtok', 'strdup',
173
+ 'fopen', 'fclose', 'fread', 'fwrite', 'fgets', 'fputs', 'fputc', 'fgetc',
174
+ 'feof', 'ferror', 'fflush', 'fseek', 'ftell', 'rewind',
175
+ 'exit', 'abort', 'atexit', 'atoi', 'atol', 'atof', 'strtol', 'strtoul', 'strtod',
176
+ 'qsort', 'bsearch',
177
+ 'abs', 'labs', 'rand', 'srand',
178
+ 'sin', 'cos', 'tan', 'sqrt', 'pow', 'log', 'log10', 'exp', 'ceil', 'floor', 'fabs',
179
+ 'time', 'clock', 'difftime', 'mktime', 'localtime', 'gmtime', 'strftime', 'asctime',
180
+ 'assert', 'errno',
181
+ 'perror', 'remove', 'rename', 'tmpfile', 'tmpnam',
182
+ 'getenv', 'system',
183
+ 'signal', 'raise',
184
+ 'setjmp', 'longjmp',
185
+ 'va_start', 'va_end', 'va_arg', 'va_copy',
186
+ 'NULL', 'EOF', 'BUFSIZ', 'FILENAME_MAX', 'RAND_MAX', 'EXIT_SUCCESS', 'EXIT_FAILURE',
187
+ 'size_t', 'ptrdiff_t', 'wchar_t', 'intptr_t', 'uintptr_t',
188
+ 'int8_t', 'int16_t', 'int32_t', 'int64_t',
189
+ 'uint8_t', 'uint16_t', 'uint32_t', 'uint64_t',
190
+ 'FILE',
191
+ // POSIX additions commonly seen
192
+ 'stat', 'lstat', 'fstat', 'open', 'close', 'read', 'write', 'pipe',
193
+ 'fork', 'exec', 'waitpid', 'getpid', 'getppid', 'kill', 'sleep', 'usleep',
194
+ 'pthread_create', 'pthread_join', 'pthread_mutex_lock', 'pthread_mutex_unlock',
195
+ 'dlopen', 'dlsym', 'dlclose',
196
+ ]);
197
+ const CPP_BUILT_INS = new Set([
198
+ // iostream objects (often used without std:: prefix via using)
199
+ 'cout', 'cin', 'cerr', 'clog', 'endl', 'flush', 'ws',
200
+ 'std', // the namespace itself when used as std::something
201
+ // Common C++ keywords that leak as references
202
+ 'nullptr', 'true', 'false', 'this', 'sizeof', 'alignof', 'typeid',
203
+ 'static_cast', 'dynamic_cast', 'reinterpret_cast', 'const_cast',
204
+ 'make_unique', 'make_shared', 'make_pair',
205
+ 'move', 'forward', 'swap',
206
+ ]);
207
+ /**
208
+ * Reference Resolver
209
+ *
210
+ * Orchestrates reference resolution using multiple strategies.
211
+ */
212
+ class ReferenceResolver {
213
+ projectRoot;
214
+ queries;
215
+ context;
216
+ frameworks = [];
217
+ // Chained static-factory/fluent call refs the first pass couldn't resolve,
218
+ // collected in-memory (the batched resolver deletes unresolved refs from the
219
+ // DB, so they can't be re-read). Drained by resolveChainedCallsViaConformance
220
+ // once implements/extends edges exist, to resolve methods on a supertype the
221
+ // receiver conforms to (#750).
222
+ deferredChainRefs = [];
223
+ // `this.<member>` function-as-value refs whose member is NOT on the
224
+ // enclosing class itself — possibly inherited. Collected in-memory for the
225
+ // same reason as deferredChainRefs and drained by
226
+ // resolveDeferredThisMemberRefs once implements/extends edges exist (#808).
227
+ deferredThisMemberRefs = [];
228
+ // Per-`.razor`/`.cshtml`-file `@using` namespace set (own directives + folder
229
+ // `_Imports.razor`, cascading to the project root). Used to disambiguate a
230
+ // markup type ref to the right C# namespace.
231
+ razorUsingsCache = new Map();
232
+ // All per-resolver caches are LRU-bounded. Previously these were
233
+ // unbounded Maps that grew with every distinct lookup and OOM'd on
234
+ // codebases with 20k+ files (see issue: unbounded cache growth).
235
+ nodeCache; // per-file node cache
236
+ fileCache; // per-file content cache
237
+ importMappingCache;
238
+ reExportCache;
239
+ nameCache; // name → nodes cache
240
+ lowerNameCache; // lower(name) → nodes cache
241
+ qualifiedNameCache; // qualified_name → nodes cache
242
+ knownNames = null; // all known symbol names for fast pre-filtering
243
+ knownFiles = null;
244
+ cachesWarmed = false;
245
+ // tsconfig/jsconfig path-alias map. `undefined` = not yet computed,
246
+ // `null` = computed and absent. Treated as immutable for the
247
+ // resolver's lifetime; callers re-create the resolver if config changes.
248
+ projectAliases = undefined;
249
+ // go.mod module path. Same lazy/immutable convention as projectAliases.
250
+ goModule = undefined;
251
+ // Monorepo workspace member packages. Same lazy/immutable convention.
252
+ workspacePackages = undefined;
253
+ constructor(projectRoot, queries) {
254
+ this.projectRoot = projectRoot;
255
+ this.queries = queries;
256
+ const limit = resolveCacheLimit();
257
+ // The content cache is heavier (full file text), so we give it a
258
+ // smaller budget than the metadata caches.
259
+ const contentLimit = Math.max(64, Math.floor(limit / 5));
260
+ this.nodeCache = new lru_cache_1.LRUCache(limit);
261
+ this.fileCache = new lru_cache_1.LRUCache(contentLimit);
262
+ this.importMappingCache = new lru_cache_1.LRUCache(limit);
263
+ this.reExportCache = new lru_cache_1.LRUCache(limit);
264
+ this.nameCache = new lru_cache_1.LRUCache(limit);
265
+ this.lowerNameCache = new lru_cache_1.LRUCache(limit);
266
+ this.qualifiedNameCache = new lru_cache_1.LRUCache(limit);
267
+ this.context = this.createContext();
268
+ }
269
+ /**
270
+ * Initialize the resolver (detect frameworks, etc.)
271
+ */
272
+ initialize() {
273
+ this.frameworks = (0, frameworks_1.detectFrameworks)(this.context);
274
+ this.clearCaches();
275
+ }
276
+ /**
277
+ * Run each framework resolver's cross-file finalization pass and persist
278
+ * the returned node updates. Idempotent — safe to call after every indexAll
279
+ * and every incremental sync. Returns the number of nodes updated.
280
+ *
281
+ * Caches are cleared before/after so the post-extract pass sees fresh DB
282
+ * state and downstream queries see the updated names.
283
+ */
284
+ runPostExtract() {
285
+ let updated = 0;
286
+ this.clearCaches();
287
+ for (const fw of this.frameworks) {
288
+ if (!fw.postExtract)
289
+ continue;
290
+ try {
291
+ const nodes = fw.postExtract(this.context);
292
+ for (const node of nodes) {
293
+ this.queries.updateNode(node);
294
+ updated++;
295
+ }
296
+ }
297
+ catch (err) {
298
+ (0, errors_1.logDebug)(`Framework '${fw.name}' postExtract failed`, {
299
+ error: err instanceof Error ? err.message : String(err),
300
+ });
301
+ }
302
+ }
303
+ if (updated > 0)
304
+ this.clearCaches();
305
+ return updated;
306
+ }
307
+ /**
308
+ * Pre-build lightweight caches for resolution.
309
+ * Node lookups are now handled by indexed SQLite queries instead of
310
+ * loading all nodes into memory (which caused OOM on large codebases).
311
+ * We cache the set of known symbol names for fast pre-filtering.
312
+ */
313
+ warmCaches() {
314
+ if (this.cachesWarmed)
315
+ return;
316
+ // Only cache the set of known file paths (lightweight string set)
317
+ this.knownFiles = new Set(this.queries.getAllFilePaths());
318
+ // Cache all distinct symbol names for fast pre-filtering (just strings, not full nodes)
319
+ this.knownNames = new Set(this.queries.getAllNodeNames());
320
+ this.cachesWarmed = true;
321
+ }
322
+ /**
323
+ * Clear internal caches
324
+ */
325
+ clearCaches() {
326
+ this.nodeCache.clear();
327
+ this.fileCache.clear();
328
+ this.importMappingCache.clear();
329
+ this.reExportCache.clear();
330
+ this.nameCache.clear();
331
+ this.lowerNameCache.clear();
332
+ this.qualifiedNameCache.clear();
333
+ this.knownNames = null;
334
+ this.knownFiles = null;
335
+ this.cachesWarmed = false;
336
+ }
337
+ /**
338
+ * Create the resolution context
339
+ */
340
+ createContext() {
341
+ return {
342
+ getNodesInFile: (filePath) => {
343
+ if (!this.nodeCache.has(filePath)) {
344
+ this.nodeCache.set(filePath, this.queries.getNodesByFile(filePath));
345
+ }
346
+ return this.nodeCache.get(filePath);
347
+ },
348
+ getNodesByName: (name) => {
349
+ const cached = this.nameCache.get(name);
350
+ if (cached !== undefined)
351
+ return cached;
352
+ const result = this.queries.getNodesByName(name);
353
+ this.nameCache.set(name, result);
354
+ return result;
355
+ },
356
+ getNodesByQualifiedName: (qualifiedName) => {
357
+ const cached = this.qualifiedNameCache.get(qualifiedName);
358
+ if (cached !== undefined)
359
+ return cached;
360
+ const result = this.queries.getNodesByQualifiedNameExact(qualifiedName);
361
+ this.qualifiedNameCache.set(qualifiedName, result);
362
+ return result;
363
+ },
364
+ getNodesByKind: (kind) => {
365
+ return this.queries.getNodesByKind(kind);
366
+ },
367
+ fileExists: (filePath) => {
368
+ // Check pre-built known files set first (O(1))
369
+ if (this.knownFiles) {
370
+ const normalized = filePath.replace(/\\/g, '/');
371
+ if (this.knownFiles.has(filePath) || this.knownFiles.has(normalized)) {
372
+ return true;
373
+ }
374
+ }
375
+ // Fall back to filesystem for files not yet indexed
376
+ const fullPath = path.join(this.projectRoot, filePath);
377
+ try {
378
+ return fs.existsSync(fullPath);
379
+ }
380
+ catch (error) {
381
+ (0, errors_1.logDebug)('Error checking file existence', { filePath, error: String(error) });
382
+ return false;
383
+ }
384
+ },
385
+ readFile: (filePath) => {
386
+ if (this.fileCache.has(filePath)) {
387
+ return this.fileCache.get(filePath);
388
+ }
389
+ const fullPath = path.join(this.projectRoot, filePath);
390
+ try {
391
+ const content = fs.readFileSync(fullPath, 'utf-8');
392
+ this.fileCache.set(filePath, content);
393
+ return content;
394
+ }
395
+ catch (error) {
396
+ (0, errors_1.logDebug)('Failed to read file for resolution', { filePath, error: String(error) });
397
+ this.fileCache.set(filePath, null);
398
+ return null;
399
+ }
400
+ },
401
+ getProjectRoot: () => this.projectRoot,
402
+ getAllFiles: () => {
403
+ return this.queries.getAllFilePaths();
404
+ },
405
+ listDirectories: (relativePath) => {
406
+ const target = relativePath === '.' || relativePath === ''
407
+ ? this.projectRoot
408
+ : path.join(this.projectRoot, relativePath);
409
+ try {
410
+ return fs
411
+ .readdirSync(target, { withFileTypes: true })
412
+ .filter((entry) => entry.isDirectory())
413
+ .map((entry) => entry.name);
414
+ }
415
+ catch (error) {
416
+ (0, errors_1.logDebug)('Failed to list directory for resolution', {
417
+ relativePath,
418
+ error: String(error),
419
+ });
420
+ return [];
421
+ }
422
+ },
423
+ getNodesByLowerName: (lowerName) => {
424
+ const cached = this.lowerNameCache.get(lowerName);
425
+ if (cached !== undefined)
426
+ return cached;
427
+ const result = this.queries.getNodesByLowerName(lowerName);
428
+ this.lowerNameCache.set(lowerName, result);
429
+ return result;
430
+ },
431
+ getNodeById: (id) => {
432
+ return this.queries.getNodeById(id);
433
+ },
434
+ getSupertypes: (typeName, language) => {
435
+ // Union the `implements`/`extends` targets of every same-named type node.
436
+ // Matching by simple name (not id) reconciles a type declared in one node
437
+ // (`KF::Builder`) with conformance declared in a separate extension node
438
+ // (`KF.Builder: KFOptionSetter`) — both have name `Builder`.
439
+ const typeNodes = this.context
440
+ .getNodesByName(typeName)
441
+ .filter((n) => SUPERTYPE_BEARING_KINDS.has(n.kind) && n.language === language);
442
+ if (typeNodes.length === 0)
443
+ return [];
444
+ const supertypes = new Set();
445
+ for (const tn of typeNodes) {
446
+ for (const edge of this.queries.getOutgoingEdges(tn.id, ['implements', 'extends'])) {
447
+ const target = this.queries.getNodeById(edge.target);
448
+ if (target?.name && target.name !== typeName)
449
+ supertypes.add(target.name);
450
+ }
451
+ }
452
+ return [...supertypes];
453
+ },
454
+ getImportMappings: (filePath, language) => {
455
+ const cacheKey = filePath;
456
+ const cached = this.importMappingCache.get(cacheKey);
457
+ if (cached)
458
+ return cached;
459
+ const content = this.context.readFile(filePath);
460
+ if (!content) {
461
+ this.importMappingCache.set(cacheKey, []);
462
+ return [];
463
+ }
464
+ const mappings = (0, import_resolver_1.extractImportMappings)(filePath, content, language);
465
+ this.importMappingCache.set(cacheKey, mappings);
466
+ return mappings;
467
+ },
468
+ getProjectAliases: () => {
469
+ if (this.projectAliases === undefined) {
470
+ this.projectAliases = (0, path_aliases_1.loadProjectAliases)(this.projectRoot);
471
+ }
472
+ return this.projectAliases;
473
+ },
474
+ getGoModule: () => {
475
+ if (this.goModule === undefined) {
476
+ this.goModule = (0, go_module_1.loadGoModule)(this.projectRoot);
477
+ }
478
+ return this.goModule;
479
+ },
480
+ getWorkspacePackages: () => {
481
+ if (this.workspacePackages === undefined) {
482
+ this.workspacePackages = (0, workspace_packages_1.loadWorkspacePackages)(this.projectRoot);
483
+ }
484
+ return this.workspacePackages;
485
+ },
486
+ getReExports: (filePath, language) => {
487
+ const cached = this.reExportCache.get(filePath);
488
+ if (cached)
489
+ return cached;
490
+ const content = this.context.readFile(filePath);
491
+ if (!content) {
492
+ this.reExportCache.set(filePath, []);
493
+ return [];
494
+ }
495
+ // Re-exports are a JS/TS-only construct, and what matters is the
496
+ // BARREL file's own language — not the consuming reference's. A
497
+ // `.svelte`/`.vue` consumer threads its own language down the
498
+ // re-export chase, which would make extractReExports() bail on a
499
+ // `.ts` index barrel and silently break the chain (#629). Re-key
500
+ // the parse on the barrel's extension so the chase works no matter
501
+ // what kind of file imports through it.
502
+ const isJsFamily = /\.(?:d\.ts|[cm]?tsx?|[cm]?jsx?)$/i.test(filePath);
503
+ const reExports = (0, import_resolver_1.extractReExports)(content, isJsFamily ? 'typescript' : language);
504
+ this.reExportCache.set(filePath, reExports);
505
+ return reExports;
506
+ },
507
+ getCppIncludeDirs: () => {
508
+ return (0, import_resolver_1.loadCppIncludeDirs)(this.projectRoot);
509
+ },
510
+ };
511
+ }
512
+ /**
513
+ * Resolve all unresolved references
514
+ */
515
+ resolveAll(unresolvedRefs, onProgress) {
516
+ // Pre-load all nodes into memory for fast lookups
517
+ this.warmCaches();
518
+ const resolved = [];
519
+ const unresolved = [];
520
+ const byMethod = {};
521
+ // Convert to our internal format, using denormalized fields when available
522
+ const refs = unresolvedRefs.map((ref) => ({
523
+ fromNodeId: ref.fromNodeId,
524
+ referenceName: ref.referenceName,
525
+ referenceKind: ref.referenceKind,
526
+ line: ref.line,
527
+ column: ref.column,
528
+ filePath: ref.filePath || this.getFilePathFromNodeId(ref.fromNodeId),
529
+ language: ref.language || this.getLanguageFromNodeId(ref.fromNodeId),
530
+ }));
531
+ const total = refs.length;
532
+ let lastReportedPercent = -1;
533
+ for (let i = 0; i < refs.length; i++) {
534
+ const ref = refs[i]; // Array index is guaranteed to be in bounds
535
+ const result = this.resolveOne(ref);
536
+ if (result) {
537
+ resolved.push(result);
538
+ byMethod[result.resolvedBy] = (byMethod[result.resolvedBy] || 0) + 1;
539
+ }
540
+ else {
541
+ unresolved.push(ref);
542
+ }
543
+ // Report progress every 1% to avoid too many updates
544
+ if (onProgress) {
545
+ const currentPercent = Math.floor((i / total) * 100);
546
+ if (currentPercent > lastReportedPercent) {
547
+ lastReportedPercent = currentPercent;
548
+ onProgress(i + 1, total);
549
+ }
550
+ }
551
+ }
552
+ // Final progress report
553
+ if (onProgress && total > 0) {
554
+ onProgress(total, total);
555
+ }
556
+ return {
557
+ resolved,
558
+ unresolved,
559
+ stats: {
560
+ total: refs.length,
561
+ resolved: resolved.length,
562
+ unresolved: unresolved.length,
563
+ byMethod,
564
+ },
565
+ };
566
+ }
567
+ /**
568
+ * Check if a reference name has any possible match in the codebase.
569
+ * Uses the pre-built knownNames set to skip expensive resolution
570
+ * for names that definitely don't exist as symbols.
571
+ */
572
+ hasAnyPossibleMatch(name) {
573
+ if (!this.knownNames)
574
+ return true; // no pre-filter available
575
+ // Direct name match
576
+ if (this.knownNames.has(name))
577
+ return true;
578
+ // For qualified names like "obj.method" or "Class::method", check the parts
579
+ const dotIdx = name.indexOf('.');
580
+ if (dotIdx > 0) {
581
+ const receiver = name.substring(0, dotIdx);
582
+ const member = name.substring(dotIdx + 1);
583
+ if (this.knownNames.has(receiver) || this.knownNames.has(member))
584
+ return true;
585
+ // Also check capitalized receiver (instance-method resolution)
586
+ const capitalized = receiver.charAt(0).toUpperCase() + receiver.slice(1);
587
+ if (this.knownNames.has(capitalized))
588
+ return true;
589
+ // JVM FQN: `com.example.foo.Bar` — the only useful segment is the
590
+ // last one (`Bar`); the earlier check finds `example.foo.Bar` which
591
+ // never matches a node name.
592
+ const lastDot = name.lastIndexOf('.');
593
+ if (lastDot > dotIdx) {
594
+ const tail = name.substring(lastDot + 1);
595
+ if (tail && this.knownNames.has(tail))
596
+ return true;
597
+ }
598
+ }
599
+ const colonIdx = name.indexOf('::');
600
+ if (colonIdx > 0) {
601
+ const receiver = name.substring(0, colonIdx);
602
+ const member = name.substring(colonIdx + 2);
603
+ if (this.knownNames.has(receiver) || this.knownNames.has(member))
604
+ return true;
605
+ // Multi-segment path `a::b::c` (a Rust/C++ module call like
606
+ // `database::profiles::find`) — the only segment that names a symbol is
607
+ // the last (`c`); `member` above is `b::c`, which never matches a node
608
+ // name, so without this the pre-filter drops the ref before the Rust path
609
+ // resolver ever sees it. Mirror the dotted-name leaf check above.
610
+ const lastColon = name.lastIndexOf('::');
611
+ if (lastColon > colonIdx) {
612
+ const tail = name.substring(lastColon + 2);
613
+ if (tail && this.knownNames.has(tail))
614
+ return true;
615
+ }
616
+ }
617
+ // For path-like references (e.g., "snippets/drawer-menu.liquid"), check the filename
618
+ const slashIdx = name.lastIndexOf('/');
619
+ if (slashIdx > 0) {
620
+ const fileName = name.substring(slashIdx + 1);
621
+ if (this.knownNames.has(fileName))
622
+ return true;
623
+ }
624
+ return false;
625
+ }
626
+ /**
627
+ * Does `ref.referenceName` match an import declared in its containing
628
+ * file? Used as a pre-filter escape so re-export chain resolution
629
+ * still gets a chance when the name has no project-wide declaration.
630
+ */
631
+ matchesAnyImport(ref) {
632
+ const imports = this.context.getImportMappings(ref.filePath, ref.language);
633
+ if (imports.length === 0)
634
+ return false;
635
+ for (const imp of imports) {
636
+ if (imp.localName === ref.referenceName ||
637
+ ref.referenceName.startsWith(imp.localName + '.')) {
638
+ return true;
639
+ }
640
+ }
641
+ return false;
642
+ }
643
+ /**
644
+ * Resolve a single reference
645
+ */
646
+ resolveOne(ref) {
647
+ // Skip built-in/external references
648
+ if (this.isBuiltInOrExternal(ref)) {
649
+ return null;
650
+ }
651
+ // Fast pre-filter: skip if no symbol with this name exists anywhere
652
+ // AND the name doesn't match a local import. The import escape is
653
+ // necessary because re-export rename chains (`import { login }
654
+ // from './barrel'` where the barrel has `export { signIn as login }
655
+ // from './auth'`) intentionally call a name that has no
656
+ // declaration anywhere — only the renamed upstream symbol does.
657
+ if (!this.hasAnyPossibleMatch(ref.referenceName) &&
658
+ !this.matchesAnyImport(ref) &&
659
+ !this.frameworks.some((f) => f.claimsReference?.(ref.referenceName))) {
660
+ return null;
661
+ }
662
+ // Function-as-value refs (#756) get a dedicated, strictly-gated path:
663
+ // import-based resolution first (an imported callback resolves through its
664
+ // import, the most precise cross-file signal), then matchFunctionRef
665
+ // (same-file first, unique-only cross-file, function/method targets only).
666
+ // They never reach the framework or fuzzy strategies below.
667
+ if (ref.referenceKind === 'function_ref') {
668
+ // `this.<member>` values (TS/JS) resolve ONLY against the enclosing
669
+ // class's own members — never a same-named symbol elsewhere.
670
+ if (ref.referenceName.startsWith('this.')) {
671
+ return this.gateLanguage(this.resolveThisMemberFnRef(ref), ref);
672
+ }
673
+ const viaImport = this.gateLanguage((0, import_resolver_1.resolveViaImport)(ref, this.context), ref);
674
+ if (viaImport) {
675
+ const target = this.queries.getNodeById(viaImport.targetNodeId);
676
+ if (target && (target.kind === 'function' || target.kind === 'method')) {
677
+ return viaImport;
678
+ }
679
+ }
680
+ return this.gateLanguage((0, name_matcher_1.matchFunctionRef)(ref, this.context), ref);
681
+ }
682
+ // JVM FQN imports skip framework/name-matcher: `import com.example.Bar`
683
+ // resolves directly through the qualifiedName index, which is unambiguous
684
+ // even when several `Bar` classes exist in different packages.
685
+ const jvmImport = (0, import_resolver_1.resolveJvmImport)(ref, this.context);
686
+ if (jvmImport)
687
+ return jvmImport;
688
+ // Razor/Blazor: a markup or `@code` type ref resolves through the file's
689
+ // `@using` namespaces (incl. folder `_Imports.razor`). This precisely
690
+ // disambiguates a simple name that exists in several namespaces — e.g.
691
+ // `CatalogBrand` resolving to `BlazorShared.Models::CatalogBrand` (the DTO,
692
+ // which the `.razor` `@using`s) rather than the same-named domain entity.
693
+ if (ref.language === 'razor') {
694
+ const razorResult = this.resolveRazorUsing(ref);
695
+ if (razorResult)
696
+ return razorResult;
697
+ }
698
+ const candidates = [];
699
+ // Strategy 1: Try framework-specific resolution. Cross-language bridges
700
+ // are deliberately preserved (Drupal `routing.yml` → PHP controller, RN
701
+ // JS → native `calls`) — `gateFrameworkLanguage` only drops a type/import
702
+ // edge between two KNOWN families (see its doc), never a `calls` bridge or
703
+ // a config↔code edge.
704
+ for (const framework of this.frameworks) {
705
+ const result = this.gateFrameworkLanguage(framework.resolve(ref, this.context), ref);
706
+ if (result) {
707
+ if (result.confidence >= 0.9)
708
+ return result; // High confidence, return immediately
709
+ candidates.push(result);
710
+ }
711
+ }
712
+ // Strategy 2: Try import-based resolution
713
+ const importResult = this.gateLanguage((0, import_resolver_1.resolveViaImport)(ref, this.context), ref);
714
+ if (importResult) {
715
+ if (importResult.confidence >= 0.9)
716
+ return importResult;
717
+ candidates.push(importResult);
718
+ }
719
+ // PHP include/require paths resolve to files via import resolution only.
720
+ // If that didn't find the file, do NOT fall back to the symbol
721
+ // name-matcher — it would mis-connect e.g. "inc/db.php" to an unrelated
722
+ // db.php elsewhere in the tree (a wrong edge is worse than none, #660).
723
+ if ((0, import_resolver_1.isPhpIncludePathRef)(ref)) {
724
+ return candidates.length > 0
725
+ ? candidates.reduce((best, curr) => curr.confidence > best.confidence ? curr : best)
726
+ : null;
727
+ }
728
+ // Strategy 3: Try name matching
729
+ const nameResult = this.gateLanguage((0, name_matcher_1.matchReference)(ref, this.context), ref);
730
+ if (nameResult) {
731
+ candidates.push(nameResult);
732
+ }
733
+ if (candidates.length === 0) {
734
+ // Defer a chained static-factory/fluent call the first pass couldn't
735
+ // resolve — its method may live on a supertype the receiver conforms to,
736
+ // resolvable once implements/extends edges exist (the conformance pass).
737
+ if (ref.referenceKind === 'calls' &&
738
+ CHAIN_LANGUAGES.has(ref.language) &&
739
+ CHAIN_SHAPE.test(ref.referenceName)) {
740
+ this.deferredChainRefs.push(ref);
741
+ }
742
+ return null;
743
+ }
744
+ // Return highest confidence candidate
745
+ return candidates.reduce((best, curr) => curr.confidence > best.confidence ? curr : best);
746
+ }
747
+ /**
748
+ * Create edges from resolved references
749
+ */
750
+ createEdges(resolved) {
751
+ return resolved.map((ref) => {
752
+ // `function_ref` (#756) is internal-only: it persists as a `references`
753
+ // edge (the registration site depends on the callback), distinguishable
754
+ // by metadata.resolvedBy === 'function-ref'. callers/impact already
755
+ // traverse `references`, so registration sites surface with no
756
+ // graph-layer changes.
757
+ let kind = ref.original.referenceKind === 'function_ref' ? 'references' : ref.original.referenceKind;
758
+ // Promote "extends" to "implements" when a class/struct targets an interface
759
+ if (kind === 'extends') {
760
+ const targetNode = this.queries.getNodeById(ref.targetNodeId);
761
+ if (targetNode && (targetNode.kind === 'interface' || targetNode.kind === 'protocol')) {
762
+ const sourceNode = this.queries.getNodeById(ref.original.fromNodeId);
763
+ if (sourceNode && sourceNode.kind !== 'interface' && sourceNode.kind !== 'protocol') {
764
+ kind = 'implements';
765
+ }
766
+ }
767
+ }
768
+ // Promote "calls" to "instantiates" when the resolved target is a
769
+ // class/struct. Languages without a `new` keyword (Python, Ruby)
770
+ // express instantiation as `Foo()` — extraction can't tell that
771
+ // apart from a function call without symbol info, but resolution
772
+ // can: if `Foo` resolves to a class, the call IS an instantiation.
773
+ if (kind === 'calls') {
774
+ const targetNode = this.queries.getNodeById(ref.targetNodeId);
775
+ if (targetNode && (targetNode.kind === 'class' || targetNode.kind === 'struct')) {
776
+ kind = 'instantiates';
777
+ }
778
+ }
779
+ return {
780
+ source: ref.original.fromNodeId,
781
+ target: ref.targetNodeId,
782
+ kind,
783
+ line: ref.original.line,
784
+ column: ref.original.column,
785
+ metadata: {
786
+ confidence: ref.confidence,
787
+ resolvedBy: ref.resolvedBy,
788
+ // Uniform marker for function-as-value edges (#756), regardless of
789
+ // which strategy resolved them (import vs matchFunctionRef) — lets
790
+ // tooling label "callback registration" and lets validation diff
791
+ // exactly the edges this feature added.
792
+ ...(ref.original.referenceKind === 'function_ref' ? { fnRef: true } : {}),
793
+ },
794
+ };
795
+ });
796
+ }
797
+ /**
798
+ * Resolve and persist edges to database
799
+ */
800
+ resolveAndPersist(unresolvedRefs, onProgress) {
801
+ const result = this.resolveAll(unresolvedRefs, onProgress);
802
+ // Create edges from resolved references
803
+ const edges = this.createEdges(result.resolved);
804
+ // Insert edges into database
805
+ if (edges.length > 0) {
806
+ this.queries.insertEdges(edges);
807
+ }
808
+ // Clean up resolved refs from unresolved_refs table so metrics are accurate
809
+ if (result.resolved.length > 0) {
810
+ this.queries.deleteSpecificResolvedReferences(result.resolved.map((r) => ({
811
+ fromNodeId: r.original.fromNodeId,
812
+ referenceName: r.original.referenceName,
813
+ referenceKind: r.original.referenceKind,
814
+ })));
815
+ }
816
+ return result;
817
+ }
818
+ /**
819
+ * Second resolution pass for chained static-factory / fluent calls whose
820
+ * chained method is defined on a SUPERTYPE the receiver's type conforms to —
821
+ * a protocol-extension / inherited / default-interface method (#750). The
822
+ * first pass can't resolve these because `implements`/`extends` edges aren't
823
+ * built yet; this runs AFTER edges are persisted, so `context.getSupertypes`
824
+ * (and the conformance fallback in resolveMethodOnType) can walk them.
825
+ *
826
+ * Operates only on the leftover unresolved refs that have the `inner().method`
827
+ * chain shape, for the dotted-chain languages — a small set — and is idempotent
828
+ * (re-resolving an already-resolved ref is a no-op since it's been deleted).
829
+ * Returns the number of newly-created edges.
830
+ */
831
+ resolveChainedCallsViaConformance() {
832
+ const deferred = this.deferredChainRefs;
833
+ this.deferredChainRefs = [];
834
+ if (deferred.length === 0)
835
+ return 0;
836
+ // Read fresh edges (the main pass built the implements/extends edges after
837
+ // these refs were deferred). matchDottedCallChain now resolves a method on a
838
+ // supertype via context.getSupertypes -> resolveMethodOnType's conformance walk.
839
+ this.clearCaches();
840
+ const resolved = [];
841
+ for (const ref of deferred) {
842
+ // `::`-receiver languages (Rust) split on `::` (matchScopedCallChain);
843
+ // dotted-receiver languages on `.` (matchDottedCallChain).
844
+ const chainMatch = SCOPED_CHAIN_LANGUAGES.has(ref.language)
845
+ ? (0, name_matcher_1.matchScopedCallChain)(ref, this.context)
846
+ : (0, name_matcher_1.matchDottedCallChain)(ref, this.context);
847
+ const match = this.gateLanguage(chainMatch, ref);
848
+ if (match)
849
+ resolved.push(match);
850
+ }
851
+ if (resolved.length === 0)
852
+ return 0;
853
+ const edges = this.createEdges(resolved);
854
+ if (edges.length > 0) {
855
+ this.queries.insertEdges(edges);
856
+ this.clearCaches();
857
+ }
858
+ return edges.length;
859
+ }
860
+ /**
861
+ * Resolve and persist in batches to keep memory bounded.
862
+ * Processes unresolved references in chunks, persisting edges and cleaning
863
+ * up resolved refs after each batch to avoid accumulating large arrays.
864
+ */
865
+ async resolveAndPersistBatched(onProgress, batchSize = 5000) {
866
+ this.warmCaches();
867
+ const total = this.queries.getUnresolvedReferencesCount();
868
+ let processed = 0;
869
+ const aggregateStats = {
870
+ total: 0,
871
+ resolved: 0,
872
+ unresolved: 0,
873
+ byMethod: {},
874
+ };
875
+ // Process in batches. We always read from offset 0 because resolved refs
876
+ // are deleted after each batch, shifting the remaining rows forward.
877
+ let prevRemaining = Number.POSITIVE_INFINITY;
878
+ while (true) {
879
+ const batch = this.queries.getUnresolvedReferencesBatch(0, batchSize);
880
+ if (batch.length === 0)
881
+ break;
882
+ const result = this.resolveAll(batch);
883
+ // Persist edges immediately
884
+ const edges = this.createEdges(result.resolved);
885
+ if (edges.length > 0) {
886
+ this.queries.insertEdges(edges);
887
+ }
888
+ // Clean up resolved refs so they don't appear in the next batch
889
+ if (result.resolved.length > 0) {
890
+ this.queries.deleteSpecificResolvedReferences(result.resolved.map((r) => ({
891
+ fromNodeId: r.original.fromNodeId,
892
+ referenceName: r.original.referenceName,
893
+ referenceKind: r.original.referenceKind,
894
+ })));
895
+ }
896
+ // Delete unresolvable refs from this batch to avoid re-processing them
897
+ if (result.unresolved.length > 0) {
898
+ this.queries.deleteSpecificResolvedReferences(result.unresolved.map((r) => ({
899
+ fromNodeId: r.fromNodeId,
900
+ referenceName: r.referenceName,
901
+ referenceKind: r.referenceKind,
902
+ })));
903
+ }
904
+ // Aggregate stats
905
+ aggregateStats.total += result.stats.total;
906
+ aggregateStats.resolved += result.stats.resolved;
907
+ aggregateStats.unresolved += result.stats.unresolved;
908
+ for (const [method, count] of Object.entries(result.stats.byMethod)) {
909
+ aggregateStats.byMethod[method] = (aggregateStats.byMethod[method] || 0) + count;
910
+ }
911
+ processed += batch.length;
912
+ onProgress?.(processed, total);
913
+ // Yield so progress UI can render between batches
914
+ await new Promise(resolve => setImmediate(resolve));
915
+ // If nothing was resolved or removed in this batch, we'd loop forever
916
+ // on the same rows. Break to avoid infinite loop.
917
+ if (result.resolved.length === 0 && result.unresolved.length === batch.length) {
918
+ break;
919
+ }
920
+ // Non-progress guard (defense-in-depth). Because we re-read from offset 0
921
+ // each pass, the unresolved_refs table MUST shrink every iteration — both
922
+ // resolved and unresolved refs are deleted above. If it didn't shrink, a
923
+ // resolver returned a match whose `original.referenceName` differs from the
924
+ // stored row, so the keyed delete no-ops, and we'd re-read + re-resolve +
925
+ // re-insert the same rows forever (the runaway that grew a 99-file repo to
926
+ // 5M edges / 1.4 GB before the Go-fallback fix). Stop rather than grow the
927
+ // graph without bound.
928
+ const remaining = this.queries.getUnresolvedReferencesCount();
929
+ if (remaining >= prevRemaining)
930
+ break;
931
+ prevRemaining = remaining;
932
+ }
933
+ // Dynamic-edge synthesis: now that all base `calls` edges are persisted,
934
+ // synthesize observer/callback dispatch edges (dispatcher → registered
935
+ // callbacks) that static parsing leaves out. Best-effort — never fail the
936
+ // index on it. See docs/design/callback-edge-synthesis.md.
937
+ try {
938
+ aggregateStats.byMethod['callback-synthesis'] = (0, callback_synthesizer_1.synthesizeCallbackEdges)(this.queries, this.context);
939
+ }
940
+ catch {
941
+ // synthesis is additive and optional; ignore failures
942
+ }
943
+ return {
944
+ resolved: [],
945
+ unresolved: [],
946
+ stats: aggregateStats,
947
+ };
948
+ }
949
+ /**
950
+ * Get detected frameworks
951
+ */
952
+ getDetectedFrameworks() {
953
+ return this.frameworks.map((f) => f.name);
954
+ }
955
+ /**
956
+ * Check if reference is to a built-in or external symbol
957
+ */
958
+ isBuiltInOrExternal(ref) {
959
+ const name = ref.referenceName;
960
+ const isJsTs = ref.language === 'typescript' || ref.language === 'javascript'
961
+ || ref.language === 'tsx' || ref.language === 'jsx';
962
+ // JavaScript/TypeScript built-ins
963
+ if (isJsTs && JS_BUILT_INS.has(name)) {
964
+ return true;
965
+ }
966
+ // Common JS/TS library calls (console.log, Math.floor, JSON.parse)
967
+ if (isJsTs && (name.startsWith('console.') || name.startsWith('Math.') || name.startsWith('JSON.'))) {
968
+ return true;
969
+ }
970
+ // React hooks from React itself
971
+ if (isJsTs && REACT_HOOKS.has(name)) {
972
+ return true;
973
+ }
974
+ // Python built-ins (bare calls only — dotted calls like console.print are method calls)
975
+ if (ref.language === 'python' && PYTHON_BUILT_INS.has(name)) {
976
+ return true;
977
+ }
978
+ // Python built-in method calls (e.g., list.extend, dict.update)
979
+ if (ref.language === 'python') {
980
+ const dotIdx = name.indexOf('.');
981
+ if (dotIdx > 0) {
982
+ const receiver = name.substring(0, dotIdx);
983
+ const method = name.substring(dotIdx + 1);
984
+ // Filter calls on built-in types (list.append, dict.update, etc.)
985
+ if (PYTHON_BUILT_IN_TYPES.has(receiver)) {
986
+ return true;
987
+ }
988
+ // Filter built-in methods on non-class receivers
989
+ // (e.g., items.append where items is a local list variable)
990
+ // But allow if the capitalized receiver matches a known codebase class
991
+ if (PYTHON_BUILT_IN_METHODS.has(method)) {
992
+ const capitalized = receiver.charAt(0).toUpperCase() + receiver.slice(1);
993
+ if (!this.knownNames?.has(capitalized)) {
994
+ return true;
995
+ }
996
+ }
997
+ }
998
+ // A bare name colliding with a builtin method (index, get, update, count…)
999
+ // is only a builtin when NOTHING in the codebase declares it. A declared
1000
+ // symbol with that exact name — e.g. a Flask/FastAPI view `def index()` or
1001
+ // `def get()` — is a real reference target. Mirrors the knownNames guard on
1002
+ // the dotted branch above; without it, every handler named after a builtin
1003
+ // method silently loses its route→handler edge.
1004
+ if (PYTHON_BUILT_IN_METHODS.has(name) && !this.knownNames?.has(name)) {
1005
+ return true;
1006
+ }
1007
+ }
1008
+ // Go standard library packages — refs like "fmt.Println", "http.ListenAndServe", etc.
1009
+ if (ref.language === 'go') {
1010
+ const dotIdx = name.indexOf('.');
1011
+ if (dotIdx > 0) {
1012
+ const pkg = name.substring(0, dotIdx);
1013
+ if (GO_STDLIB_PACKAGES.has(pkg)) {
1014
+ return true;
1015
+ }
1016
+ }
1017
+ if (GO_BUILT_INS.has(name)) {
1018
+ return true;
1019
+ }
1020
+ }
1021
+ // Pascal/Delphi built-ins and standard library units
1022
+ if (ref.language === 'pascal') {
1023
+ if (PASCAL_UNIT_PREFIXES.some((p) => name.startsWith(p))) {
1024
+ return true;
1025
+ }
1026
+ if (PASCAL_BUILT_INS.has(name)) {
1027
+ return true;
1028
+ }
1029
+ }
1030
+ // C/C++ standard library symbols (printf, malloc, std::vector, etc.).
1031
+ // Names that collide with user-defined symbols are NOT filtered —
1032
+ // C and C++ projects routinely shadow stdlib names (custom allocators
1033
+ // define `malloc`/`free`, stream wrappers define `read`/`write`/`open`,
1034
+ // containers define `move`/`swap`, logging libs wrap `printf`). Killing
1035
+ // those resolutions makes the graph wrong, not cleaner. We only filter
1036
+ // when there's no user node with this name — then name-matching would
1037
+ // produce zero edges anyway and the filter just short-circuits work.
1038
+ if (ref.language === 'c' || ref.language === 'cpp') {
1039
+ // C++ std:: namespace prefix — safe to filter unconditionally,
1040
+ // since `std::foo` is never a user-defined qualified name in
1041
+ // tree-sitter output.
1042
+ if (name.startsWith('std::'))
1043
+ return true;
1044
+ if (C_BUILT_INS.has(name) || CPP_BUILT_INS.has(name)) {
1045
+ return !this.hasAnyPossibleMatch(name);
1046
+ }
1047
+ }
1048
+ return false;
1049
+ }
1050
+ /**
1051
+ * Get file path from node ID
1052
+ */
1053
+ getFilePathFromNodeId(nodeId) {
1054
+ const node = this.queries.getNodeById(nodeId);
1055
+ return node?.filePath || '';
1056
+ }
1057
+ /**
1058
+ * Get language from node ID
1059
+ */
1060
+ getLanguageFromNodeId(nodeId) {
1061
+ const node = this.queries.getNodeById(nodeId);
1062
+ return node?.language || 'unknown';
1063
+ }
1064
+ /**
1065
+ * Drop an import/name-strategy resolution that crosses a language family.
1066
+ * Two regimes (mirrors `applyLanguageGate`'s candidate filter):
1067
+ * - `references` (type usage): STRICT — a `Type.member` static read names a
1068
+ * same-family type, never a coincidentally same-named symbol in another
1069
+ * language. Drops any non-same-family target.
1070
+ * - `imports` (import binding / `#include`): both-known — a C++ `#include
1071
+ * "X.h"` must not resolve to a same-named ObjC header on another platform
1072
+ * (basename collision), but a singleton-family / SFC language (`vue` →
1073
+ * `.ts`) importing across is left alone.
1074
+ * Applies to the import (strategy 2) + name-match (strategy 3) results.
1075
+ */
1076
+ /**
1077
+ * Collect the `@using` namespaces in scope for a `.razor`/`.cshtml` file: its
1078
+ * own `@using` directives plus every `_Imports.razor` from the file's folder up
1079
+ * to the project root (Razor `_Imports` cascade). Cached per file.
1080
+ */
1081
+ getRazorUsings(filePath) {
1082
+ const cached = this.razorUsingsCache.get(filePath);
1083
+ if (cached)
1084
+ return cached;
1085
+ const usings = new Set();
1086
+ const addFrom = (src) => {
1087
+ if (!src)
1088
+ return;
1089
+ for (const m of src.matchAll(/^\s*@using\s+(?:static\s+)?([A-Za-z_][\w.]*)/gm))
1090
+ usings.add(m[1]);
1091
+ };
1092
+ addFrom(this.context.readFile(filePath));
1093
+ let dir = filePath.includes('/') ? filePath.slice(0, filePath.lastIndexOf('/')) : '';
1094
+ // Walk up to the project root, reading each level's _Imports.razor.
1095
+ for (;;) {
1096
+ addFrom(this.context.readFile(dir ? `${dir}/_Imports.razor` : '_Imports.razor'));
1097
+ if (!dir)
1098
+ break;
1099
+ const slash = dir.lastIndexOf('/');
1100
+ dir = slash >= 0 ? dir.slice(0, slash) : '';
1101
+ }
1102
+ const arr = [...usings];
1103
+ this.razorUsingsCache.set(filePath, arr);
1104
+ return arr;
1105
+ }
1106
+ /**
1107
+ * Resolve a Razor/Blazor simple type ref through the file's `@using`
1108
+ * namespaces: `CatalogBrand` + `@using BlazorShared.Models` → the node whose
1109
+ * qualified name is `BlazorShared.Models::CatalogBrand`. Only resolves when the
1110
+ * `@using` set yields exactly ONE type (otherwise it stays ambiguous and falls
1111
+ * through to name-matching).
1112
+ */
1113
+ resolveRazorUsing(ref) {
1114
+ if (ref.referenceName.includes('.') || ref.referenceName.includes('::'))
1115
+ return null;
1116
+ const usings = this.getRazorUsings(ref.filePath);
1117
+ if (usings.length === 0)
1118
+ return null;
1119
+ const found = new Map();
1120
+ for (const ns of usings) {
1121
+ for (const cand of this.context.getNodesByQualifiedName(`${ns}::${ref.referenceName}`)) {
1122
+ found.set(cand.id, cand);
1123
+ }
1124
+ }
1125
+ if (found.size !== 1)
1126
+ return null;
1127
+ const target = found.values().next().value;
1128
+ return { original: ref, targetNodeId: target.id, confidence: 0.9, resolvedBy: 'import' };
1129
+ }
1130
+ /**
1131
+ * Resolve a `this.<member>` function-as-value reference (#756/#808) to the
1132
+ * ENCLOSING CLASS's own member — never a same-named symbol elsewhere. The
1133
+ * registration idiom (`btn.on('click', this.handleClick)`) names a member
1134
+ * of the class being defined, so the only valid target shares the
1135
+ * from-symbol's qualified-name scope. Function/method targets only — a
1136
+ * property (a data field, post-#808 classification) yields no edge — same
1137
+ * file required, no fallback of any kind.
1138
+ */
1139
+ resolveThisMemberFnRef(ref) {
1140
+ const member = ref.referenceName.slice('this.'.length);
1141
+ if (!member)
1142
+ return null;
1143
+ const fromNode = this.queries.getNodeById(ref.fromNodeId);
1144
+ if (!fromNode)
1145
+ return null;
1146
+ // A hook declared at class-body level (Ruby `before_action :authenticate`)
1147
+ // attributes to the CLASS node itself — its qualified name IS the scope.
1148
+ // For members, strip the member segment.
1149
+ let classPrefix;
1150
+ if (SUPERTYPE_BEARING_KINDS.has(fromNode.kind) || fromNode.kind === 'module') {
1151
+ classPrefix = fromNode.qualifiedName;
1152
+ }
1153
+ else {
1154
+ const sep = fromNode.qualifiedName.lastIndexOf('::');
1155
+ if (sep <= 0)
1156
+ return null; // not inside a class scope
1157
+ classPrefix = fromNode.qualifiedName.slice(0, sep);
1158
+ }
1159
+ const candidates = this.context
1160
+ .getNodesByQualifiedName(`${classPrefix}::${member}`)
1161
+ .filter((n) => (n.kind === 'function' || n.kind === 'method') &&
1162
+ n.filePath === ref.filePath &&
1163
+ n.id !== ref.fromNodeId);
1164
+ if (candidates.length === 0) {
1165
+ // Not on the class itself — possibly INHERITED. implements/extends
1166
+ // edges don't exist yet in this pass, so retry in the supertype pass
1167
+ // (resolveDeferredThisMemberRefs) instead of giving up.
1168
+ this.deferredThisMemberRefs.push(ref);
1169
+ return null;
1170
+ }
1171
+ const target = candidates.reduce((a, b) => (a.startLine <= b.startLine ? a : b));
1172
+ return {
1173
+ original: ref,
1174
+ targetNodeId: target.id,
1175
+ confidence: 0.95,
1176
+ resolvedBy: 'function-ref',
1177
+ };
1178
+ }
1179
+ /**
1180
+ * Second pass for `this.<member>` refs whose member wasn't on the enclosing
1181
+ * class itself (#808): once implements/extends edges exist, walk the
1182
+ * class's supertypes (transitively, depth-capped) and resolve the member on
1183
+ * the nearest one that declares it — `this.handleSubmit` registered in a
1184
+ * subclass resolves to `FormBase::handleSubmit`. Validated targets only
1185
+ * (function/method kind, same language family); no match → no edge.
1186
+ * Mirrors resolveChainedCallsViaConformance's lifecycle. Returns the number
1187
+ * of newly-created edges.
1188
+ */
1189
+ resolveDeferredThisMemberRefs() {
1190
+ const deferred = this.deferredThisMemberRefs;
1191
+ this.deferredThisMemberRefs = [];
1192
+ if (deferred.length === 0)
1193
+ return 0;
1194
+ this.clearCaches();
1195
+ const resolved = [];
1196
+ for (const ref of deferred) {
1197
+ const member = ref.referenceName.slice('this.'.length);
1198
+ const fromNode = this.queries.getNodeById(ref.fromNodeId);
1199
+ if (!fromNode || !member)
1200
+ continue;
1201
+ // Class-body-level hooks (Ruby) attribute to the CLASS node itself.
1202
+ let className;
1203
+ if (SUPERTYPE_BEARING_KINDS.has(fromNode.kind) || fromNode.kind === 'module') {
1204
+ className = fromNode.name;
1205
+ }
1206
+ else {
1207
+ const sep = fromNode.qualifiedName.lastIndexOf('::');
1208
+ if (sep <= 0)
1209
+ continue;
1210
+ const classPrefix = fromNode.qualifiedName.slice(0, sep);
1211
+ className = classPrefix.includes('::')
1212
+ ? classPrefix.slice(classPrefix.lastIndexOf('::') + 2)
1213
+ : classPrefix;
1214
+ }
1215
+ // NODE-anchored BFS up the supertype graph: start from the class node
1216
+ // in the ref's own file (never a same-named class elsewhere — rails has
1217
+ // a dozen `Engine`s), follow implements/extends EDGES to supertype
1218
+ // NODES, and look members up through `contains` edges. No name-based
1219
+ // unions anywhere — a name-keyed getSupertypes('Engine') merged every
1220
+ // Engine's parents and produced a cross-class wrong edge on rails.
1221
+ let frontierNodes = this.context
1222
+ .getNodesByName(className)
1223
+ .filter((n) => SUPERTYPE_BEARING_KINDS.has(n.kind) &&
1224
+ n.filePath === ref.filePath);
1225
+ if (frontierNodes.length === 0) {
1226
+ // The class itself may be declared in another file (partial/reopened
1227
+ // classes); fall back to same-family nodes of that name.
1228
+ frontierNodes = this.context
1229
+ .getNodesByName(className)
1230
+ .filter((n) => SUPERTYPE_BEARING_KINDS.has(n.kind) &&
1231
+ (0, name_matcher_1.sameLanguageFamily)(n.language, ref.language));
1232
+ }
1233
+ const seenNodes = new Set(frontierNodes.map((n) => n.id));
1234
+ let target = null;
1235
+ for (let depth = 0; depth < 5 && frontierNodes.length > 0 && !target; depth++) {
1236
+ const next = [];
1237
+ for (const typeNode of frontierNodes) {
1238
+ for (const edge of this.queries.getOutgoingEdges(typeNode.id, ['implements', 'extends'])) {
1239
+ const superNode = this.queries.getNodeById(edge.target);
1240
+ if (!superNode || seenNodes.has(superNode.id))
1241
+ continue;
1242
+ seenNodes.add(superNode.id);
1243
+ if (!SUPERTYPE_BEARING_KINDS.has(superNode.kind))
1244
+ continue;
1245
+ // Member lookup anchored on the supertype's contains edges.
1246
+ for (const c of this.queries.getOutgoingEdges(superNode.id, ['contains'])) {
1247
+ const m = this.queries.getNodeById(c.target);
1248
+ if (m &&
1249
+ m.name === member &&
1250
+ (m.kind === 'function' || m.kind === 'method') &&
1251
+ (0, name_matcher_1.sameLanguageFamily)(m.language, ref.language)) {
1252
+ target = m;
1253
+ break;
1254
+ }
1255
+ }
1256
+ if (target)
1257
+ break;
1258
+ next.push(superNode);
1259
+ }
1260
+ if (target)
1261
+ break;
1262
+ }
1263
+ frontierNodes = next;
1264
+ }
1265
+ if (target) {
1266
+ resolved.push({
1267
+ original: ref,
1268
+ targetNodeId: target.id,
1269
+ confidence: 0.85,
1270
+ resolvedBy: 'function-ref',
1271
+ });
1272
+ }
1273
+ }
1274
+ if (resolved.length === 0)
1275
+ return 0;
1276
+ const edges = this.createEdges(resolved);
1277
+ if (edges.length > 0) {
1278
+ this.queries.insertEdges(edges);
1279
+ this.clearCaches();
1280
+ }
1281
+ return edges.length;
1282
+ }
1283
+ gateLanguage(result, ref) {
1284
+ if (!result)
1285
+ return result;
1286
+ const tgt = this.getLanguageFromNodeId(result.targetNodeId);
1287
+ if (!tgt || !ref.language)
1288
+ return result;
1289
+ if ((ref.referenceKind === 'references' || ref.referenceKind === 'function_ref') && !(0, name_matcher_1.sameLanguageFamily)(tgt, ref.language))
1290
+ return null;
1291
+ if (ref.referenceKind === 'imports' && (0, name_matcher_1.crossesKnownFamily)(tgt, ref.language))
1292
+ return null;
1293
+ return result;
1294
+ }
1295
+ /**
1296
+ * Drop a FRAMEWORK-strategy resolution that crosses two *known* language
1297
+ * families for a type-usage (`references`) or import-binding (`imports`)
1298
+ * edge. The framework strategy is intentionally ungated for cross-language
1299
+ * bridges, but those legitimate bridges are either `calls` edges (RN/Expo
1300
+ * JS → native) or config↔code edges whose config side (`yaml`/`blade`/…) is
1301
+ * not a known programming-language family. A `references`/`imports` edge
1302
+ * between two *known* families is always a coincidental name collision — the
1303
+ * React/Svelte/Vue PascalCase component resolvers name-match `getNodesByName`
1304
+ * without a language check, so a TS `<TestRunner>` ref happily matched a
1305
+ * Kotlin `class TestRunner`. Gating only the both-known-cross-family case
1306
+ * lets config bridges and `calls` bridges through untouched.
1307
+ */
1308
+ gateFrameworkLanguage(result, ref) {
1309
+ if (!result)
1310
+ return result;
1311
+ if (ref.referenceKind !== 'references' && ref.referenceKind !== 'imports')
1312
+ return result;
1313
+ const tgt = this.getLanguageFromNodeId(result.targetNodeId);
1314
+ if (tgt && ref.language && (0, name_matcher_1.crossesKnownFamily)(tgt, ref.language))
1315
+ return null;
1316
+ return result;
1317
+ }
1318
+ }
1319
+ exports.ReferenceResolver = ReferenceResolver;
1320
+ /**
1321
+ * Create a reference resolver instance
1322
+ */
1323
+ function createResolver(projectRoot, queries) {
1324
+ const resolver = new ReferenceResolver(projectRoot, queries);
1325
+ resolver.initialize();
1326
+ return resolver;
1327
+ }
1328
+ //# sourceMappingURL=index.js.map