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,1849 @@
1
+ "use strict";
2
+ /**
3
+ * Import Resolver
4
+ *
5
+ * Resolves import paths to actual files and symbols.
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
+ Object.defineProperty(exports, "__esModule", { value: true });
41
+ exports.resolveImportPath = resolveImportPath;
42
+ exports.clearCppIncludeDirCache = clearCppIncludeDirCache;
43
+ exports.loadCppIncludeDirs = loadCppIncludeDirs;
44
+ exports.isPhpIncludePathRef = isPhpIncludePathRef;
45
+ exports.extractImportMappings = extractImportMappings;
46
+ exports.clearImportMappingCache = clearImportMappingCache;
47
+ exports.extractReExports = extractReExports;
48
+ exports.resolveJvmImport = resolveJvmImport;
49
+ exports.resolveViaImport = resolveViaImport;
50
+ const fs = __importStar(require("fs"));
51
+ const path = __importStar(require("path"));
52
+ const path_aliases_1 = require("./path-aliases");
53
+ const workspace_packages_1 = require("./workspace-packages");
54
+ /**
55
+ * Extension resolution order by language
56
+ */
57
+ const EXTENSION_RESOLUTION = {
58
+ typescript: ['.ts', '.tsx', '.d.ts', '.js', '.jsx', '/index.ts', '/index.tsx', '/index.js'],
59
+ javascript: ['.js', '.jsx', '.mjs', '.cjs', '/index.js', '/index.jsx'],
60
+ tsx: ['.tsx', '.ts', '.d.ts', '.js', '.jsx', '/index.tsx', '/index.ts', '/index.js'],
61
+ jsx: ['.jsx', '.js', '/index.jsx', '/index.js'],
62
+ // SFC consumers import plain TS/JS, sibling components, and barrels
63
+ // (`./lib` → `./lib/index.ts`). Without a list, relative imports from a
64
+ // `.svelte`/`.vue` file resolve to nothing, so barrel callers vanish (#629).
65
+ svelte: ['.ts', '.js', '.svelte', '.tsx', '.jsx', '/index.ts', '/index.js', '/index.svelte'],
66
+ vue: ['.ts', '.js', '.vue', '.tsx', '.jsx', '/index.ts', '/index.js', '/index.vue'],
67
+ astro: ['.ts', '.js', '.astro', '.tsx', '.jsx', '/index.ts', '/index.js', '/index.astro'],
68
+ python: ['.py', '/__init__.py'],
69
+ go: ['.go'],
70
+ rust: ['.rs', '/mod.rs'],
71
+ java: ['.java'],
72
+ c: ['.h', '.c'],
73
+ cpp: ['.h', '.hpp', '.hxx', '.cpp', '.cc', '.cxx'],
74
+ csharp: ['.cs'],
75
+ php: ['.php'],
76
+ ruby: ['.rb'],
77
+ objc: ['.h', '.m', '.mm'],
78
+ };
79
+ /**
80
+ * Resolve an import path to an actual file
81
+ */
82
+ function resolveImportPath(importPath, fromFile, language, context) {
83
+ // Skip external/npm packages — but pass the context so the
84
+ // bare-specifier heuristic can consult the project's tsconfig
85
+ // alias map first (custom prefixes like `@components/*` would
86
+ // otherwise be misclassified as npm).
87
+ if (isExternalImport(importPath, language, context)) {
88
+ return null;
89
+ }
90
+ const projectRoot = context.getProjectRoot();
91
+ const fromDir = path.dirname(path.join(projectRoot, fromFile));
92
+ // Handle relative imports
93
+ if (importPath.startsWith('.')) {
94
+ return resolveRelativeImport(importPath, fromDir, language, context);
95
+ }
96
+ // Handle absolute/aliased imports (like @/ or src/)
97
+ const aliased = resolveAliasedImport(importPath, projectRoot, language, context);
98
+ if (aliased)
99
+ return aliased;
100
+ // C/C++ include directory search: when neither relative nor aliased
101
+ // resolution found a match, search -I directories from
102
+ // compile_commands.json or heuristic probing.
103
+ if (language === 'c' || language === 'cpp') {
104
+ return resolveCppIncludePath(importPath, language, context);
105
+ }
106
+ return null;
107
+ }
108
+ /**
109
+ * C and C++ standard library header names (without delimiters).
110
+ * Used by isExternalImport to filter system includes from resolution.
111
+ */
112
+ const C_CPP_STDLIB_HEADERS = new Set([
113
+ // C standard library headers
114
+ 'assert.h', 'complex.h', 'ctype.h', 'errno.h', 'fenv.h', 'float.h',
115
+ 'inttypes.h', 'iso646.h', 'limits.h', 'locale.h', 'math.h', 'setjmp.h',
116
+ 'signal.h', 'stdalign.h', 'stdarg.h', 'stdatomic.h', 'stdbool.h',
117
+ 'stddef.h', 'stdint.h', 'stdio.h', 'stdlib.h', 'stdnoreturn.h',
118
+ 'string.h', 'tgmath.h', 'threads.h', 'time.h', 'uchar.h', 'wchar.h',
119
+ 'wctype.h',
120
+ // C++ C-library wrappers (cname form)
121
+ 'cassert', 'ccomplex', 'cctype', 'cerrno', 'cfenv', 'cfloat',
122
+ 'cinttypes', 'ciso646', 'climits', 'clocale', 'cmath', 'csetjmp',
123
+ 'csignal', 'cstdalign', 'cstdarg', 'cstdbool', 'cstddef', 'cstdint',
124
+ 'cstdio', 'cstdlib', 'cstring', 'ctgmath', 'ctime', 'cuchar',
125
+ 'cwchar', 'cwctype',
126
+ // C++ STL headers
127
+ 'algorithm', 'any', 'array', 'atomic', 'barrier', 'bit', 'bitset',
128
+ 'charconv', 'chrono', 'codecvt', 'compare', 'complex', 'concepts',
129
+ 'condition_variable', 'coroutine', 'deque', 'exception', 'execution',
130
+ 'expected', 'filesystem', 'format', 'forward_list', 'fstream',
131
+ 'functional', 'future', 'generator', 'initializer_list', 'iomanip',
132
+ 'ios', 'iosfwd', 'iostream', 'istream', 'iterator', 'latch',
133
+ 'limits', 'list', 'locale', 'map', 'mdspan', 'memory', 'memory_resource',
134
+ 'mutex', 'new', 'numbers', 'numeric', 'optional', 'ostream', 'print',
135
+ 'queue', 'random', 'ranges', 'ratio', 'regex', 'scoped_allocator',
136
+ 'semaphore', 'set', 'shared_mutex', 'source_location', 'span',
137
+ 'spanstream', 'sstream', 'stack', 'stacktrace', 'stdexcept',
138
+ 'stdfloat', 'stop_token', 'streambuf', 'string', 'string_view',
139
+ 'strstream', 'syncstream', 'system_error', 'thread', 'tuple',
140
+ 'type_traits', 'typeindex', 'typeinfo', 'unordered_map',
141
+ 'unordered_set', 'utility', 'valarray', 'variant', 'vector',
142
+ 'version',
143
+ ]);
144
+ /**
145
+ * Check if an import is external (npm package, etc.)
146
+ *
147
+ * `context` is consulted for project-defined path aliases
148
+ * (tsconfig/jsconfig `paths`). Without that check, custom prefixes
149
+ * like `@components/*` would fail the bare-specifier heuristic and
150
+ * be classified as external before alias resolution can run.
151
+ */
152
+ function isExternalImport(importPath, language, context) {
153
+ // Relative imports are not external
154
+ if (importPath.startsWith('.')) {
155
+ return false;
156
+ }
157
+ // Workspace-member imports (`@scope/ui`, `@scope/ui/widgets`) are LOCAL to
158
+ // a monorepo even though they look like bare npm specifiers. Consult the
159
+ // workspace map first so they aren't misclassified as external (#629). The
160
+ // map is null for single-package repos, so this is a no-op there.
161
+ const workspaces = context?.getWorkspacePackages?.();
162
+ if (workspaces && (0, workspace_packages_1.resolveWorkspaceImport)(importPath, workspaces)) {
163
+ return false;
164
+ }
165
+ // Common external patterns
166
+ if (language === 'typescript' || language === 'javascript' || language === 'tsx' || language === 'jsx') {
167
+ // Node built-ins
168
+ if (['fs', 'path', 'os', 'crypto', 'http', 'https', 'url', 'util', 'events', 'stream', 'child_process', 'buffer'].includes(importPath)) {
169
+ return true;
170
+ }
171
+ // Project-defined alias prefix? Treat as local.
172
+ const aliases = context?.getProjectAliases?.();
173
+ if (aliases) {
174
+ for (const pat of aliases.patterns) {
175
+ if (importPath.startsWith(pat.prefix))
176
+ return false;
177
+ }
178
+ }
179
+ // Scoped packages or bare specifiers that don't start with aliases
180
+ if (!importPath.startsWith('@/') && !importPath.startsWith('~/') && !importPath.startsWith('src/')) {
181
+ // Likely an npm package
182
+ return true;
183
+ }
184
+ }
185
+ if (language === 'python') {
186
+ // Standard library modules
187
+ const stdLibs = ['os', 'sys', 'json', 're', 'math', 'datetime', 'collections', 'typing', 'pathlib', 'logging'];
188
+ if (stdLibs.includes(importPath.split('.')[0])) {
189
+ return true;
190
+ }
191
+ }
192
+ if (language === 'go') {
193
+ // Relative imports (rare in idiomatic Go but the grammar allows them).
194
+ if (importPath.startsWith('.')) {
195
+ return false;
196
+ }
197
+ // In-module imports look like `<module-path>/sub/pkg` — local to
198
+ // this project. Without the module-path check we'd flag every
199
+ // cross-package call in a Go monorepo as external (issue #388).
200
+ const mod = context?.getGoModule?.();
201
+ if (mod && (importPath === mod.modulePath || importPath.startsWith(mod.modulePath + '/'))) {
202
+ return false;
203
+ }
204
+ // `internal/` packages stay local even when go.mod is missing —
205
+ // preserves the pre-#388 escape hatch for repos without a parsed module path.
206
+ if (importPath.includes('/internal/')) {
207
+ return false;
208
+ }
209
+ // Anything else is the Go standard library or a third-party module.
210
+ return true;
211
+ }
212
+ if (language === 'c' || language === 'cpp') {
213
+ // C/C++ standard library headers — both C-style (<stdio.h>) and
214
+ // C++-style (<cstdio>, <vector>) forms. Checked against the import
215
+ // path (which the extractor strips of <> or "" delimiters).
216
+ if (C_CPP_STDLIB_HEADERS.has(importPath))
217
+ return true;
218
+ // C++ headers without .h extension (e.g. "vector", "string")
219
+ const withoutExt = importPath.replace(/\.h$/, '');
220
+ if (C_CPP_STDLIB_HEADERS.has(withoutExt))
221
+ return true;
222
+ }
223
+ return false;
224
+ }
225
+ /**
226
+ * Resolve a relative import
227
+ */
228
+ function resolveRelativeImport(importPath, fromDir, language, context) {
229
+ const projectRoot = context.getProjectRoot();
230
+ const extensions = EXTENSION_RESOLUTION[language] || [];
231
+ // Python dotted-relative imports (`from .certs import x`, `from ..pkg.mod
232
+ // import y`): leading dots are PACKAGE levels (1 = current package), and the
233
+ // remainder is a dotted submodule path. `path.resolve(dir, '.certs')` would
234
+ // treat `.certs` as a literal hidden filename, so translate the Python form
235
+ // to a real filesystem-relative path before resolving.
236
+ if (language === 'python' && importPath.startsWith('.')) {
237
+ const dots = importPath.length - importPath.replace(/^\.+/, '').length;
238
+ const up = '../'.repeat(Math.max(0, dots - 1)); // 1 dot = current dir
239
+ const rest = importPath.slice(dots).replace(/\./g, '/'); // 'sub.mod' -> 'sub/mod'
240
+ const pyBase = path.resolve(fromDir, up + rest);
241
+ const pyRel = path.relative(projectRoot, pyBase).replace(/\\/g, '/');
242
+ for (const ext of extensions) {
243
+ if (context.fileExists(pyRel + ext))
244
+ return pyRel + ext;
245
+ }
246
+ if (pyRel && context.fileExists(pyRel))
247
+ return pyRel;
248
+ return null;
249
+ }
250
+ // Try the path as-is first
251
+ const basePath = path.resolve(fromDir, importPath);
252
+ const relativePath = path.relative(projectRoot, basePath).replace(/\\/g, '/');
253
+ // Try each extension
254
+ for (const ext of extensions) {
255
+ const candidatePath = relativePath + ext;
256
+ if (context.fileExists(candidatePath)) {
257
+ return candidatePath;
258
+ }
259
+ }
260
+ // Try without extension (might already have one)
261
+ if (context.fileExists(relativePath)) {
262
+ return relativePath;
263
+ }
264
+ return null;
265
+ }
266
+ /**
267
+ * Resolve an aliased/absolute import.
268
+ *
269
+ * Tries, in order:
270
+ * 1. Project-defined `compilerOptions.paths` (tsconfig/jsconfig).
271
+ * Each pattern can have multiple replacements; tried in tsconfig
272
+ * priority order with extension permutations.
273
+ * 2. The legacy hard-coded fallback list (`@/`, `~/`, `src/`, ...)
274
+ * for projects that have aliases but no tsconfig paths block.
275
+ * 3. Direct path lookup (with extensions).
276
+ */
277
+ function resolveAliasedImport(importPath, projectRoot, language, context) {
278
+ const extensions = EXTENSION_RESOLUTION[language] || [];
279
+ const tryWithExt = (basePath) => {
280
+ for (const ext of extensions) {
281
+ const candidate = basePath + ext;
282
+ if (context.fileExists(candidate))
283
+ return candidate;
284
+ }
285
+ if (context.fileExists(basePath))
286
+ return basePath;
287
+ return null;
288
+ };
289
+ // 1. Project tsconfig/jsconfig paths.
290
+ const aliasMap = context.getProjectAliases?.();
291
+ if (aliasMap) {
292
+ const candidates = (0, path_aliases_1.applyAliases)(importPath, aliasMap, projectRoot);
293
+ for (const c of candidates) {
294
+ const hit = tryWithExt(c);
295
+ if (hit)
296
+ return hit;
297
+ }
298
+ }
299
+ // 1.5 Workspace packages (`@scope/ui/widgets` → `packages/ui/widgets`).
300
+ // Resolves a monorepo member import to the member's directory; the
301
+ // extension/index permutations below then find its barrel (#629).
302
+ const workspaces = context.getWorkspacePackages?.();
303
+ if (workspaces) {
304
+ const base = (0, workspace_packages_1.resolveWorkspaceImport)(importPath, workspaces);
305
+ if (base) {
306
+ const hit = tryWithExt(base);
307
+ if (hit)
308
+ return hit;
309
+ }
310
+ }
311
+ // 2. Hard-coded fallback list. Kept for projects that use these
312
+ // conventional aliases without declaring them in tsconfig.
313
+ const fallbackAliases = {
314
+ '@/': 'src/',
315
+ '~/': 'src/',
316
+ '@src/': 'src/',
317
+ 'src/': 'src/',
318
+ '@app/': 'app/',
319
+ 'app/': 'app/',
320
+ };
321
+ for (const [alias, replacement] of Object.entries(fallbackAliases)) {
322
+ if (importPath.startsWith(alias)) {
323
+ const hit = tryWithExt(importPath.replace(alias, replacement));
324
+ if (hit)
325
+ return hit;
326
+ }
327
+ }
328
+ // 3. Direct path.
329
+ return tryWithExt(importPath);
330
+ }
331
+ /**
332
+ * C/C++ include directory cache (keyed by project root).
333
+ * Loaded once per resolver instance, shared across calls.
334
+ */
335
+ const cppIncludeDirCache = new Map();
336
+ /**
337
+ * Clear the C/C++ include directory cache (call between indexing runs)
338
+ */
339
+ function clearCppIncludeDirCache() {
340
+ cppIncludeDirCache.clear();
341
+ }
342
+ /**
343
+ * Discover C/C++ include search directories for a project.
344
+ *
345
+ * Strategy:
346
+ * 1. Look for compile_commands.json (Clang compilation database) in the
347
+ * project root and common build subdirectories. Parse -I and -isystem
348
+ * flags from compiler commands.
349
+ * 2. If no compilation database is found, probe for common convention
350
+ * directories (include/, src/, lib/, api/) and top-level directories
351
+ * containing .h/.hpp files.
352
+ *
353
+ * Returns paths relative to projectRoot.
354
+ */
355
+ function loadCppIncludeDirs(projectRoot) {
356
+ const cached = cppIncludeDirCache.get(projectRoot);
357
+ if (cached !== undefined)
358
+ return cached;
359
+ const dirs = loadCppIncludeDirsFromCompileDB(projectRoot)
360
+ || loadCppIncludeDirsHeuristic(projectRoot);
361
+ cppIncludeDirCache.set(projectRoot, dirs);
362
+ return dirs;
363
+ }
364
+ /**
365
+ * Try to load include directories from compile_commands.json.
366
+ * Returns null if no compilation database is found (so the heuristic
367
+ * fallback can run). Returns an array (possibly empty) otherwise.
368
+ */
369
+ function loadCppIncludeDirsFromCompileDB(projectRoot) {
370
+ const candidates = [
371
+ path.join(projectRoot, 'compile_commands.json'),
372
+ path.join(projectRoot, 'build', 'compile_commands.json'),
373
+ path.join(projectRoot, 'cmake-build-debug', 'compile_commands.json'),
374
+ path.join(projectRoot, 'cmake-build-release', 'compile_commands.json'),
375
+ path.join(projectRoot, 'out', 'compile_commands.json'),
376
+ ];
377
+ let dbPath;
378
+ for (const c of candidates) {
379
+ try {
380
+ if (fs.existsSync(c)) {
381
+ dbPath = c;
382
+ break;
383
+ }
384
+ }
385
+ catch {
386
+ // ignore
387
+ }
388
+ }
389
+ if (!dbPath)
390
+ return null;
391
+ try {
392
+ const content = fs.readFileSync(dbPath, 'utf-8');
393
+ const entries = JSON.parse(content);
394
+ if (!Array.isArray(entries))
395
+ return null;
396
+ const dirSet = new Set();
397
+ for (const entry of entries) {
398
+ const dir = entry.directory || projectRoot;
399
+ const args = entry.arguments || (entry.command ? shlexSplit(entry.command) : []);
400
+ for (let i = 0; i < args.length; i++) {
401
+ const arg = args[i];
402
+ let includeDir;
403
+ // -I<dir> (no space)
404
+ if (arg.startsWith('-I') && arg.length > 2) {
405
+ includeDir = arg.substring(2);
406
+ }
407
+ // -isystem <dir> (space-separated)
408
+ else if ((arg === '-isystem' || arg === '-I') && i + 1 < args.length) {
409
+ includeDir = args[i + 1];
410
+ i++; // skip next arg
411
+ }
412
+ if (includeDir) {
413
+ // Normalize: resolve relative to the compilation directory
414
+ const absPath = path.isAbsolute(includeDir)
415
+ ? includeDir
416
+ : path.resolve(dir, includeDir);
417
+ const relPath = path.relative(projectRoot, absPath).replace(/\\/g, '/');
418
+ // Skip system directories and paths outside the project
419
+ // (relative paths starting with .. or absolute paths like
420
+ // /usr/include or C:\usr on Windows)
421
+ if (!relPath.startsWith('..') && relPath.length > 0 && !path.isAbsolute(relPath)) {
422
+ dirSet.add(relPath);
423
+ }
424
+ }
425
+ }
426
+ }
427
+ return Array.from(dirSet);
428
+ }
429
+ catch {
430
+ return null;
431
+ }
432
+ }
433
+ /**
434
+ * Minimal shlex-style split for compiler command strings.
435
+ * Handles double-quoted and single-quoted arguments.
436
+ */
437
+ function shlexSplit(cmd) {
438
+ const result = [];
439
+ let i = 0;
440
+ while (i < cmd.length) {
441
+ // Skip whitespace
442
+ while (i < cmd.length && /\s/.test(cmd[i]))
443
+ i++;
444
+ if (i >= cmd.length)
445
+ break;
446
+ const ch = cmd[i];
447
+ if (ch === '"') {
448
+ i++;
449
+ let arg = '';
450
+ while (i < cmd.length && cmd[i] !== '"') {
451
+ if (cmd[i] === '\\' && i + 1 < cmd.length) {
452
+ i++;
453
+ arg += cmd[i];
454
+ }
455
+ else {
456
+ arg += cmd[i];
457
+ }
458
+ i++;
459
+ }
460
+ i++; // closing quote
461
+ result.push(arg);
462
+ }
463
+ else if (ch === "'") {
464
+ i++;
465
+ let arg = '';
466
+ while (i < cmd.length && cmd[i] !== "'") {
467
+ arg += cmd[i];
468
+ i++;
469
+ }
470
+ i++; // closing quote
471
+ result.push(arg);
472
+ }
473
+ else {
474
+ let arg = '';
475
+ while (i < cmd.length && !/\s/.test(cmd[i])) {
476
+ arg += cmd[i];
477
+ i++;
478
+ }
479
+ result.push(arg);
480
+ }
481
+ }
482
+ return result;
483
+ }
484
+ /**
485
+ * Heuristic include directory discovery when no compile_commands.json exists.
486
+ * Checks common convention directories and scans top-level dirs for headers.
487
+ */
488
+ function loadCppIncludeDirsHeuristic(projectRoot) {
489
+ const dirs = [];
490
+ const conventionDirs = ['include', 'src', 'lib', 'api', 'inc'];
491
+ try {
492
+ const entries = fs.readdirSync(projectRoot, { withFileTypes: true });
493
+ for (const entry of entries) {
494
+ if (!entry.isDirectory())
495
+ continue;
496
+ const name = entry.name;
497
+ // Convention directories
498
+ if (conventionDirs.includes(name.toLowerCase())) {
499
+ dirs.push(name);
500
+ continue;
501
+ }
502
+ // Any top-level directory containing .h or .hpp files
503
+ try {
504
+ const subFiles = fs.readdirSync(path.join(projectRoot, name));
505
+ if (subFiles.some(f => /\.(h|hpp|hxx|hh)$/i.test(f))) {
506
+ dirs.push(name);
507
+ }
508
+ }
509
+ catch {
510
+ // ignore permission errors
511
+ }
512
+ }
513
+ }
514
+ catch {
515
+ // ignore
516
+ }
517
+ return dirs;
518
+ }
519
+ /**
520
+ * Resolve a C/C++ include path by searching include directories.
521
+ * Called as a fallback after relative and aliased resolution fail.
522
+ */
523
+ function resolveCppIncludePath(importPath, language, context) {
524
+ const includeDirs = context.getCppIncludeDirs?.() ?? [];
525
+ const extensions = EXTENSION_RESOLUTION[language] ?? [];
526
+ for (const dir of includeDirs) {
527
+ const normalizedDir = dir.replace(/\\/g, '/');
528
+ for (const ext of extensions) {
529
+ const candidate = normalizedDir + '/' + importPath + ext;
530
+ if (context.fileExists(candidate))
531
+ return candidate;
532
+ }
533
+ // Try as-is (already has extension)
534
+ const candidate = normalizedDir + '/' + importPath;
535
+ if (context.fileExists(candidate))
536
+ return candidate;
537
+ }
538
+ return null;
539
+ }
540
+ /**
541
+ * Is this reference a PHP include/require PATH (vs a namespace `use` symbol)?
542
+ *
543
+ * include/require emit a file path ("lib.php", "inc/db.php", "../x.php"),
544
+ * whereas namespace use is an FQN (App\Foo\Bar) or a bare class symbol
545
+ * (Closure). PHP identifiers contain neither '/' nor '.', so a slash or dot
546
+ * marks a path-shaped include. Such references resolve to files only — never
547
+ * to a same-named symbol — so callers must not fall back to the name-matcher.
548
+ */
549
+ function isPhpIncludePathRef(ref) {
550
+ return (ref.language === 'php' &&
551
+ ref.referenceKind === 'imports' &&
552
+ (ref.referenceName.includes('/') || ref.referenceName.includes('.')));
553
+ }
554
+ /**
555
+ * Resolve a PHP include/require path to a project-relative file path.
556
+ *
557
+ * PHP resolves includes relative to the including file's directory (the
558
+ * common case for procedural codebases); php.ini `include_path` is not
559
+ * modeled. Callers pass an already-extracted static literal path.
560
+ */
561
+ function resolvePhpIncludePath(includePath, fromFile, context) {
562
+ const projectRoot = context.getProjectRoot();
563
+ const fromDir = path.dirname(path.join(projectRoot, fromFile));
564
+ const basePath = path.resolve(fromDir, includePath);
565
+ const relativePath = path.relative(projectRoot, basePath).replace(/\\/g, '/');
566
+ if (context.fileExists(relativePath))
567
+ return relativePath;
568
+ // The literal may omit the .php extension (e.g. include "config").
569
+ for (const ext of EXTENSION_RESOLUTION.php ?? []) {
570
+ if (context.fileExists(relativePath + ext))
571
+ return relativePath + ext;
572
+ }
573
+ return null;
574
+ }
575
+ /**
576
+ * Extract import mappings from a file
577
+ */
578
+ function extractImportMappings(_filePath, content, language) {
579
+ const mappings = [];
580
+ if (language === 'typescript' || language === 'javascript' || language === 'tsx' || language === 'jsx') {
581
+ mappings.push(...extractJSImports(content));
582
+ }
583
+ else if (language === 'svelte' || language === 'vue' || language === 'astro') {
584
+ // Svelte/Vue single-file components import via plain ES6 inside their
585
+ // `<script>` block (Astro: the `---` frontmatter). Without this, a
586
+ // `.svelte`/`.vue`/`.astro` consumer produces
587
+ // zero import mappings, so `resolveViaImport` can't run and a barrel
588
+ // import (`import { Foo } from './lib'`) falls back to name-matching —
589
+ // which silently fails whenever the re-export alias differs from the
590
+ // component's real name, yielding a false 0 callers (#629). The ES6
591
+ // import regex only matches `import … from '…'`, so running it over the
592
+ // whole SFC (markup + styles included) is safe.
593
+ mappings.push(...extractJSImports(content));
594
+ }
595
+ else if (language === 'python') {
596
+ mappings.push(...extractPythonImports(content));
597
+ }
598
+ else if (language === 'go') {
599
+ mappings.push(...extractGoImports(content));
600
+ }
601
+ else if (language === 'java' || language === 'kotlin') {
602
+ mappings.push(...extractJavaImports(content));
603
+ }
604
+ else if (language === 'php') {
605
+ mappings.push(...extractPHPImports(content));
606
+ }
607
+ else if (language === 'c' || language === 'cpp') {
608
+ mappings.push(...extractCppImports(content));
609
+ }
610
+ return mappings;
611
+ }
612
+ /**
613
+ * Extract JS/TS import mappings
614
+ */
615
+ function extractJSImports(content) {
616
+ const mappings = [];
617
+ // ES6 imports
618
+ const importRegex = /import\s+(?:(\w+)\s*,?\s*)?(?:\{([^}]+)\})?\s*(?:(\*)\s+as\s+(\w+))?\s*from\s*['"]([^'"]+)['"]/g;
619
+ let match;
620
+ while ((match = importRegex.exec(content)) !== null) {
621
+ const [, defaultImport, namedImports, star, namespaceAlias, source] = match;
622
+ // Default import
623
+ if (defaultImport) {
624
+ mappings.push({
625
+ localName: defaultImport,
626
+ exportedName: 'default',
627
+ source: source,
628
+ isDefault: true,
629
+ isNamespace: false,
630
+ });
631
+ }
632
+ // Named imports
633
+ if (namedImports) {
634
+ const names = namedImports.split(',').map((s) => s.trim());
635
+ for (const name of names) {
636
+ const aliasMatch = name.match(/(\w+)\s+as\s+(\w+)/);
637
+ if (aliasMatch) {
638
+ mappings.push({
639
+ localName: aliasMatch[2],
640
+ exportedName: aliasMatch[1],
641
+ source: source,
642
+ isDefault: false,
643
+ isNamespace: false,
644
+ });
645
+ }
646
+ else if (name) {
647
+ mappings.push({
648
+ localName: name,
649
+ exportedName: name,
650
+ source: source,
651
+ isDefault: false,
652
+ isNamespace: false,
653
+ });
654
+ }
655
+ }
656
+ }
657
+ // Namespace import
658
+ if (star && namespaceAlias) {
659
+ mappings.push({
660
+ localName: namespaceAlias,
661
+ exportedName: '*',
662
+ source: source,
663
+ isDefault: false,
664
+ isNamespace: true,
665
+ });
666
+ }
667
+ }
668
+ // Require statements
669
+ const requireRegex = /(?:const|let|var)\s+(?:(\w+)|{([^}]+)})\s*=\s*require\(['"]([^'"]+)['"]\)/g;
670
+ while ((match = requireRegex.exec(content)) !== null) {
671
+ const [, defaultName, destructured, source] = match;
672
+ if (defaultName) {
673
+ mappings.push({
674
+ localName: defaultName,
675
+ exportedName: 'default',
676
+ source: source,
677
+ isDefault: true,
678
+ isNamespace: false,
679
+ });
680
+ }
681
+ if (destructured) {
682
+ const names = destructured.split(',').map((s) => s.trim());
683
+ for (const name of names) {
684
+ const aliasMatch = name.match(/(\w+)\s*:\s*(\w+)/);
685
+ if (aliasMatch) {
686
+ mappings.push({
687
+ localName: aliasMatch[2],
688
+ exportedName: aliasMatch[1],
689
+ source: source,
690
+ isDefault: false,
691
+ isNamespace: false,
692
+ });
693
+ }
694
+ else if (name) {
695
+ mappings.push({
696
+ localName: name,
697
+ exportedName: name,
698
+ source: source,
699
+ isDefault: false,
700
+ isNamespace: false,
701
+ });
702
+ }
703
+ }
704
+ }
705
+ }
706
+ return mappings;
707
+ }
708
+ /**
709
+ * Extract Python import mappings
710
+ */
711
+ function extractPythonImports(content) {
712
+ const mappings = [];
713
+ // from X import Y
714
+ const fromImportRegex = /from\s+([\w.]+)\s+import\s+([^#\n]+)/g;
715
+ let match;
716
+ while ((match = fromImportRegex.exec(content)) !== null) {
717
+ const [, source, imports] = match;
718
+ const names = imports.split(',').map((s) => s.trim());
719
+ for (const name of names) {
720
+ const aliasMatch = name.match(/(\w+)\s+as\s+(\w+)/);
721
+ if (aliasMatch) {
722
+ mappings.push({
723
+ localName: aliasMatch[2],
724
+ exportedName: aliasMatch[1],
725
+ source: source,
726
+ isDefault: false,
727
+ isNamespace: false,
728
+ });
729
+ }
730
+ else if (name && name !== '*') {
731
+ mappings.push({
732
+ localName: name,
733
+ exportedName: name,
734
+ source: source,
735
+ isDefault: false,
736
+ isNamespace: false,
737
+ });
738
+ }
739
+ }
740
+ }
741
+ // import X
742
+ const importRegex = /^import\s+([\w.]+)(?:\s+as\s+(\w+))?/gm;
743
+ while ((match = importRegex.exec(content)) !== null) {
744
+ const [, source, alias] = match;
745
+ const localName = alias || source.split('.').pop();
746
+ mappings.push({
747
+ localName,
748
+ exportedName: '*',
749
+ source: source,
750
+ isDefault: false,
751
+ isNamespace: true,
752
+ });
753
+ }
754
+ return mappings;
755
+ }
756
+ /**
757
+ * Extract Go import mappings
758
+ */
759
+ function extractGoImports(content) {
760
+ const mappings = [];
761
+ // import "path" or import alias "path"
762
+ const singleImportRegex = /import\s+(?:(\w+)\s+)?["']([^"']+)["']/g;
763
+ let match;
764
+ while ((match = singleImportRegex.exec(content)) !== null) {
765
+ const [, alias, source] = match;
766
+ const packageName = source.split('/').pop();
767
+ mappings.push({
768
+ localName: alias || packageName,
769
+ exportedName: '*',
770
+ source: source,
771
+ isDefault: false,
772
+ isNamespace: true,
773
+ });
774
+ }
775
+ // import ( ... ) block
776
+ const blockImportRegex = /import\s*\(\s*([^)]+)\s*\)/gs;
777
+ while ((match = blockImportRegex.exec(content)) !== null) {
778
+ const block = match[1];
779
+ const lineRegex = /(?:(\w+)\s+)?["']([^"']+)["']/g;
780
+ let lineMatch;
781
+ while ((lineMatch = lineRegex.exec(block)) !== null) {
782
+ const [, alias, source] = lineMatch;
783
+ const packageName = source.split('/').pop();
784
+ mappings.push({
785
+ localName: alias || packageName,
786
+ exportedName: '*',
787
+ source: source,
788
+ isDefault: false,
789
+ isNamespace: true,
790
+ });
791
+ }
792
+ }
793
+ return mappings;
794
+ }
795
+ /**
796
+ * Extract Java / Kotlin import mappings.
797
+ *
798
+ * Java/Kotlin imports carry the full qualified name of the imported
799
+ * symbol — `import com.example.dao.converter.FooConverter;` — which is
800
+ * exactly the disambiguation signal we need when two packages both
801
+ * declare a `FooConverter`. Pre-#314 the resolver had no Java branch
802
+ * here at all, so this mapping was empty and cross-module name
803
+ * collisions were resolved by file-path proximity (often wrongly).
804
+ *
805
+ * `import static com.example.Foo.bar;` is parsed as a local-name `bar`
806
+ * pointing at FQN `com.example.Foo.bar` so static-method call sites
807
+ * (`bar(...)`) can resolve through the same import lookup.
808
+ */
809
+ function extractJavaImports(content) {
810
+ const mappings = [];
811
+ // Strip line and block comments so `// import foo;` doesn't false-match.
812
+ const stripped = content
813
+ .replace(/\/\*[\s\S]*?\*\//g, '')
814
+ .replace(/\/\/[^\n]*/g, '');
815
+ // `import [static] <fqn>[.*];`
816
+ const re = /^\s*import\s+(static\s+)?([\w.]+(?:\.\*)?)\s*;/gm;
817
+ let match;
818
+ while ((match = re.exec(stripped)) !== null) {
819
+ const fqn = match[2];
820
+ // `import com.example.*;` — wildcard. We can't materialize a single
821
+ // local name; skip and let name-matching handle members reachable
822
+ // through the wildcard. (Future enhancement: enumerate package files.)
823
+ if (fqn.endsWith('.*'))
824
+ continue;
825
+ const parts = fqn.split('.');
826
+ const localName = parts[parts.length - 1];
827
+ if (!localName)
828
+ continue;
829
+ mappings.push({
830
+ localName,
831
+ exportedName: localName,
832
+ source: fqn,
833
+ isDefault: false,
834
+ isNamespace: false,
835
+ });
836
+ }
837
+ return mappings;
838
+ }
839
+ /**
840
+ * Extract PHP import mappings (use statements)
841
+ */
842
+ function extractPHPImports(content) {
843
+ const mappings = [];
844
+ // use Namespace\Class; or use Namespace\Class as Alias;
845
+ const useRegex = /use\s+([\w\\]+)(?:\s+as\s+(\w+))?;/g;
846
+ let match;
847
+ while ((match = useRegex.exec(content)) !== null) {
848
+ const [, fullPath, alias] = match;
849
+ const className = fullPath.split('\\').pop();
850
+ mappings.push({
851
+ localName: alias || className,
852
+ exportedName: className,
853
+ source: fullPath,
854
+ isDefault: false,
855
+ isNamespace: false,
856
+ });
857
+ }
858
+ return mappings;
859
+ }
860
+ /**
861
+ * Extract C/C++ import mappings from #include directives.
862
+ *
863
+ * #include brings all symbols from the included header into scope
864
+ * (namespace import), so each mapping uses isNamespace: true and
865
+ * exportedName: '*'. The localName is set to the header's basename
866
+ * without extension so that symbol references like `MyClass` can
867
+ * match against any include that might provide it.
868
+ */
869
+ function extractCppImports(content) {
870
+ const mappings = [];
871
+ // Match both #include <...> and #include "..."
872
+ const includeRegex = /^\s*#\s*include\s+[<"]([^>"]+)[>"]/gm;
873
+ let match;
874
+ while ((match = includeRegex.exec(content)) !== null) {
875
+ const modulePath = match[1];
876
+ // Basename without extension for localName matching
877
+ const basename = modulePath.split('/').pop().replace(/\.(h|hpp|hxx|hh|inl|ipp|cxx|cc|cpp)$/, '');
878
+ mappings.push({
879
+ localName: basename || modulePath,
880
+ exportedName: '*',
881
+ source: modulePath,
882
+ isDefault: false,
883
+ isNamespace: true,
884
+ });
885
+ }
886
+ return mappings;
887
+ }
888
+ // Cache import mappings per file to avoid re-reading and re-parsing
889
+ const importMappingCache = new Map();
890
+ /**
891
+ * Clear the import mapping cache (call between indexing runs)
892
+ */
893
+ function clearImportMappingCache() {
894
+ importMappingCache.clear();
895
+ cppIncludeDirCache.clear();
896
+ }
897
+ /**
898
+ * Strip JS line + block comments from `content` while preserving
899
+ * string literals (so `"//"` inside a string stays intact). Used by
900
+ * {@link extractReExports} so commented-out export-from statements
901
+ * don't generate phantom re-export edges.
902
+ *
903
+ * Scanner is deliberately small: it only tracks the three contexts
904
+ * relevant for JS/TS — single-quote string, double-quote string, and
905
+ * template literal. Comment recognition is the JS spec subset, no
906
+ * regex-literal awareness (which is fine for our use case: we don't
907
+ * apply this to function bodies, only to top-level files).
908
+ */
909
+ function stripJsComments(content) {
910
+ let out = '';
911
+ let i = 0;
912
+ let str = null;
913
+ while (i < content.length) {
914
+ const ch = content[i];
915
+ if (str !== null) {
916
+ out += ch;
917
+ if (ch === '\\' && i + 1 < content.length) {
918
+ out += content[i + 1];
919
+ i += 2;
920
+ continue;
921
+ }
922
+ if (ch === str)
923
+ str = null;
924
+ i++;
925
+ continue;
926
+ }
927
+ if (ch === '"' || ch === "'" || ch === '`') {
928
+ str = ch;
929
+ out += ch;
930
+ i++;
931
+ continue;
932
+ }
933
+ if (ch === '/' && content[i + 1] === '/') {
934
+ while (i < content.length && content[i] !== '\n')
935
+ i++;
936
+ continue;
937
+ }
938
+ if (ch === '/' && content[i + 1] === '*') {
939
+ i += 2;
940
+ while (i < content.length && !(content[i] === '*' && content[i + 1] === '/'))
941
+ i++;
942
+ i += 2;
943
+ continue;
944
+ }
945
+ out += ch;
946
+ i++;
947
+ }
948
+ return out;
949
+ }
950
+ /**
951
+ * Extract JS/TS re-export declarations from `content`.
952
+ *
953
+ * Recognised forms:
954
+ * export { foo } from './a';
955
+ * export { foo as bar } from './a';
956
+ * export * from './a';
957
+ * export * as ns from './a'; (treated as wildcard for chasing)
958
+ * export { default as Foo } from './a';
959
+ *
960
+ * The walker intentionally stays regex-based — the import-resolver
961
+ * elsewhere in this file already chooses regex over a fresh
962
+ * tree-sitter pass, and this function shares that trade-off. Errors
963
+ * fall through silently; resolution simply skips the broken file.
964
+ */
965
+ function extractReExports(content, language) {
966
+ if (language !== 'typescript' &&
967
+ language !== 'javascript' &&
968
+ language !== 'tsx' &&
969
+ language !== 'jsx') {
970
+ return [];
971
+ }
972
+ const out = [];
973
+ // Pre-strip block comments + line comments so a commented-out
974
+ // `// export { x } from '...'` doesn't produce a phantom edge.
975
+ // (Template literals are still a possible source of false positives;
976
+ // a project that builds export statements as runtime strings is
977
+ // out of scope.)
978
+ const cleaned = stripJsComments(content);
979
+ // Wildcard: `export * from '...'` or `export * as ns from '...'`
980
+ const wildcardRe = /export\s*\*(?:\s+as\s+\w+)?\s*from\s*['"]([^'"]+)['"]/g;
981
+ let m;
982
+ while ((m = wildcardRe.exec(cleaned)) !== null) {
983
+ out.push({ kind: 'wildcard', source: m[1] });
984
+ }
985
+ // Named: `export { a, b as c } from '...'`
986
+ const namedRe = /export\s*\{([^}]+)\}\s*from\s*['"]([^'"]+)['"]/g;
987
+ while ((m = namedRe.exec(cleaned)) !== null) {
988
+ const inner = m[1];
989
+ const source = m[2];
990
+ for (const raw of inner.split(',')) {
991
+ const item = raw.trim();
992
+ if (!item)
993
+ continue;
994
+ const aliasMatch = item.match(/^(\w+)\s+as\s+(\w+)$/);
995
+ if (aliasMatch) {
996
+ out.push({
997
+ kind: 'named',
998
+ exportedName: aliasMatch[2],
999
+ originalName: aliasMatch[1],
1000
+ source,
1001
+ });
1002
+ }
1003
+ else if (/^\w+$/.test(item)) {
1004
+ out.push({
1005
+ kind: 'named',
1006
+ exportedName: item,
1007
+ originalName: item,
1008
+ source,
1009
+ });
1010
+ }
1011
+ }
1012
+ }
1013
+ return out;
1014
+ }
1015
+ /**
1016
+ * Resolve a reference using import mappings
1017
+ */
1018
+ /**
1019
+ * JVM (Java / Kotlin) imports use fully-qualified names (`import
1020
+ * com.example.foo.Bar`) decoupled from filenames, so the JS/Python
1021
+ * style filesystem path lookup misses them whenever the file isn't
1022
+ * named after its primary symbol (Kotlin `Utils.kt` exporting `Bar`,
1023
+ * top-level fns, extension fns). Resolve them through the
1024
+ * `qualifiedName` index instead — populated by the package_header /
1025
+ * package_declaration namespace wrappers in the extractor.
1026
+ */
1027
+ function resolveJvmImport(ref, context) {
1028
+ if (ref.referenceKind !== 'imports')
1029
+ return null;
1030
+ if (ref.language !== 'java' && ref.language !== 'kotlin')
1031
+ return null;
1032
+ const fqn = ref.referenceName;
1033
+ const lastDot = fqn.lastIndexOf('.');
1034
+ if (lastDot <= 0)
1035
+ return null;
1036
+ const pkg = fqn.substring(0, lastDot);
1037
+ const sym = fqn.substring(lastDot + 1);
1038
+ // Wildcard imports (`com.example.*`) deliberately punt to name-matcher.
1039
+ if (sym === '*')
1040
+ return null;
1041
+ const candidates = context.getNodesByQualifiedName(`${pkg}::${sym}`);
1042
+ if (candidates.length === 0)
1043
+ return null;
1044
+ // Kotlin Multiplatform: an `expect` declaration and its `actual`s share one
1045
+ // FQN across source sets (commonMain / androidMain / appleMain). Taking the
1046
+ // first candidate let a single platform `actual` absorb every common-side
1047
+ // import, so the `expect` (the canonical API a commonMain file imports)
1048
+ // looked unused. Prefer the candidate CLOSEST to the importing file by
1049
+ // directory proximity — a commonMain import resolves to the commonMain
1050
+ // declaration — with the `expect` side as a tiebreak.
1051
+ const best = candidates.length === 1 ? candidates[0] : pickClosestJvmCandidate(candidates, ref.filePath);
1052
+ return {
1053
+ original: ref,
1054
+ targetNodeId: best.id,
1055
+ confidence: 0.95,
1056
+ resolvedBy: 'import',
1057
+ };
1058
+ }
1059
+ /**
1060
+ * Pick the same-FQN candidate closest to `fromPath` by shared directory
1061
+ * prefix, preferring an `expect` declaration on a tie. Used to keep a Kotlin
1062
+ * Multiplatform `expect`/`actual` import resolving within the importer's own
1063
+ * source set instead of an arbitrary platform `actual`.
1064
+ */
1065
+ function pickClosestJvmCandidate(candidates, fromPath) {
1066
+ const fromDirs = fromPath.split('/').slice(0, -1);
1067
+ const sharedPrefix = (p) => {
1068
+ const d = p.split('/').slice(0, -1);
1069
+ let shared = 0;
1070
+ for (let i = 0; i < Math.min(fromDirs.length, d.length); i++) {
1071
+ if (fromDirs[i] === d[i])
1072
+ shared++;
1073
+ else
1074
+ break;
1075
+ }
1076
+ return shared;
1077
+ };
1078
+ const isExpect = (n) => Array.isArray(n.decorators) && n.decorators.includes('expect');
1079
+ let best = candidates[0];
1080
+ let bestProx = sharedPrefix(best.filePath);
1081
+ for (let i = 1; i < candidates.length; i++) {
1082
+ const c = candidates[i];
1083
+ const prox = sharedPrefix(c.filePath);
1084
+ if (prox > bestProx || (prox === bestProx && isExpect(c) && !isExpect(best))) {
1085
+ best = c;
1086
+ bestProx = prox;
1087
+ }
1088
+ }
1089
+ return best;
1090
+ }
1091
+ function resolveViaImport(ref, context) {
1092
+ // C/C++ #include references — resolve directly to the included file
1093
+ // (file→file edge), bypassing symbol lookup. The extractor emits these
1094
+ // with `referenceKind: 'imports'` and `referenceName: <include path>`
1095
+ // (e.g. "uint256.h" or "common/args.h"). Without this branch the
1096
+ // include-dir scan path inside resolveImportPath never produces an
1097
+ // edge — resolveViaImport's symbol lookup below would search the
1098
+ // resolved file for a symbol named like the file extension and fail.
1099
+ if ((ref.language === 'c' || ref.language === 'cpp') && ref.referenceKind === 'imports') {
1100
+ // C/C++ quoted includes (`#include "X.h"`) resolve relative to the
1101
+ // INCLUDING file's own directory first (the C standard's quoted-include
1102
+ // search order). Prefer a same-directory header over an -I directory or a
1103
+ // same-named header on another platform (windows/code/RNCAsyncStorage.h vs
1104
+ // apple/.../RNCAsyncStorage.h) — the include-dir heuristic below would
1105
+ // otherwise pick an arbitrary same-named header, leaving the real local one
1106
+ // with no dependents.
1107
+ const slash = ref.filePath.lastIndexOf('/');
1108
+ const fromDir = slash >= 0 ? ref.filePath.slice(0, slash) : '';
1109
+ const siblingPath = path.posix.normalize(fromDir ? `${fromDir}/${ref.referenceName}` : ref.referenceName);
1110
+ const siblingBase = siblingPath.split('/').pop();
1111
+ const sibling = context
1112
+ .getNodesByName(siblingBase)
1113
+ .find((n) => n.kind === 'file' && n.filePath === siblingPath);
1114
+ if (sibling) {
1115
+ return { original: ref, targetNodeId: sibling.id, confidence: 0.92, resolvedBy: 'import' };
1116
+ }
1117
+ const resolvedPath = resolveImportPath(ref.referenceName, ref.filePath, ref.language, context);
1118
+ if (!resolvedPath)
1119
+ return null;
1120
+ const basename = resolvedPath.split('/').pop();
1121
+ const fileNodes = context.getNodesByName(basename).filter((n) => n.kind === 'file');
1122
+ const fileNode = fileNodes.find((n) => n.filePath === resolvedPath);
1123
+ if (fileNode) {
1124
+ return {
1125
+ original: ref,
1126
+ targetNodeId: fileNode.id,
1127
+ confidence: 0.9,
1128
+ resolvedBy: 'import',
1129
+ };
1130
+ }
1131
+ return null;
1132
+ }
1133
+ // PHP include/require — resolve the static string path to a file→file
1134
+ // edge, mirroring the C/C++ branch above. Distinguish include PATHS from
1135
+ // namespace `use` symbols by shape: an include path contains a slash or a
1136
+ // file extension ("lib.php", "inc/db.php", "../x.php"), whereas a namespace
1137
+ // use is an FQN (App\Foo\Bar) or a bare class symbol (Closure) — PHP
1138
+ // identifiers contain neither '/' nor '.'. Only path-shaped references are
1139
+ // includes; symbol references fall through to the namespace resolution.
1140
+ if (isPhpIncludePathRef(ref)) {
1141
+ const resolvedPath = resolvePhpIncludePath(ref.referenceName, ref.filePath, context);
1142
+ if (resolvedPath) {
1143
+ const basename = resolvedPath.split('/').pop();
1144
+ const fileNode = context
1145
+ .getNodesByName(basename)
1146
+ .find((n) => n.kind === 'file' && n.filePath === resolvedPath);
1147
+ if (fileNode) {
1148
+ return {
1149
+ original: ref,
1150
+ targetNodeId: fileNode.id,
1151
+ confidence: 0.9,
1152
+ resolvedBy: 'import',
1153
+ };
1154
+ }
1155
+ }
1156
+ // A path-shaped include that doesn't resolve to a known project file is a
1157
+ // dead end. Return unresolved rather than falling through to the symbol
1158
+ // name-matcher, which would mis-connect e.g. "inc/db.php" to an unrelated
1159
+ // db.php elsewhere in the tree — a wrong edge is worse than a missing one.
1160
+ return null;
1161
+ }
1162
+ // Use cached import mappings (avoids re-reading and re-parsing per ref)
1163
+ const imports = context.getImportMappings(ref.filePath, ref.language);
1164
+ if (imports.length === 0 && !context.readFile(ref.filePath)) {
1165
+ return null;
1166
+ }
1167
+ // Go cross-package calls: `pkga.FuncX(...)` extracts to referenceName
1168
+ // `pkga.FuncX` and the import `github.com/example/myproject/pkga`
1169
+ // maps to a *package directory* containing one or more .go files.
1170
+ // The generic file-based lookup below can't follow that — issue #388.
1171
+ if (ref.language === 'go') {
1172
+ const goResult = resolveGoCrossPackageReference(ref, imports, context);
1173
+ if (goResult)
1174
+ return goResult;
1175
+ }
1176
+ // Java / Kotlin: imports are FQNs (`import com.example.Foo;`) — no
1177
+ // resolvable file path the JS/TS-style chain below could follow. Look
1178
+ // up the symbol by name and filter to the candidate whose file path
1179
+ // matches the imported FQN. This is the disambiguation signal that
1180
+ // breaks the same-name class collision the path-proximity matcher
1181
+ // can't resolve (issue #314).
1182
+ if (ref.language === 'java' || ref.language === 'kotlin') {
1183
+ const javaResult = resolveJavaImportedReference(ref, imports, context);
1184
+ if (javaResult)
1185
+ return javaResult;
1186
+ }
1187
+ // Python qualified access through an imported MODULE: `certs.where()` after
1188
+ // `from . import certs`, `mod.func()` after `import mod`. The receiver names a
1189
+ // submodule (a file), not a symbol, so the generic symbol lookup below would
1190
+ // search the *package* for `certs` instead of looking inside the module.
1191
+ if (ref.language === 'python') {
1192
+ const pyResult = resolvePythonModuleMember(ref, imports, context);
1193
+ if (pyResult)
1194
+ return pyResult;
1195
+ // Absolute dotted module import: `import conduit.apps.articles.signals`
1196
+ // (the standard Django AppConfig.ready() signal-registration pattern, and
1197
+ // any side-effect `import pkg.mod`). Map the dotted path to its file.
1198
+ const pyModResult = resolvePythonAbsoluteModule(ref, context);
1199
+ if (pyModResult)
1200
+ return pyModResult;
1201
+ }
1202
+ // Rust qualified path: resolve the module prefix of `crate::m::Item` /
1203
+ // `self::sub::Item` / `super::m::func` to a file, then find the leaf symbol in
1204
+ // it. Disambiguates common-name `pub use self::read::read` re-exports that
1205
+ // name-matching would land on the wrong same-named symbol.
1206
+ if (ref.language === 'rust' && ref.referenceName.includes('::')) {
1207
+ const rustResult = resolveRustPathReference(ref, context);
1208
+ if (rustResult)
1209
+ return rustResult;
1210
+ }
1211
+ // Lua / Luau `require(...)`: a dotted module path (`a.b.c` from
1212
+ // `require("a.b.c")`) or an instance-path leaf (`Signal` from
1213
+ // `require(script.Parent.Signal)`) — map it to a module file. There's no static
1214
+ // import statement, so the generic path-matcher can't bridge the dot↔slash /
1215
+ // leaf↔basename gap; resolve it explicitly to the module file.
1216
+ if ((ref.language === 'lua' || ref.language === 'luau') && ref.referenceKind === 'imports') {
1217
+ const luaResult = resolveLuaRequire(ref, context);
1218
+ if (luaResult)
1219
+ return luaResult;
1220
+ }
1221
+ // Whole-module / namespace imports → link the importing file to the module
1222
+ // file. Python `from . import certs` / `import mod`, and TS/JS `import * as ns
1223
+ // from './x'` (so a namespace touched only via a value-member read still
1224
+ // records the dependency). A named TS/JS import returns null here and falls
1225
+ // through to symbol resolution below.
1226
+ if (ref.language === 'python' ||
1227
+ ref.language === 'typescript' ||
1228
+ ref.language === 'tsx' ||
1229
+ ref.language === 'javascript' ||
1230
+ ref.language === 'jsx') {
1231
+ const moduleFile = resolveModuleImportToFile(ref, imports, context);
1232
+ if (moduleFile)
1233
+ return moduleFile;
1234
+ }
1235
+ // Check if the reference name matches any import
1236
+ for (const imp of imports) {
1237
+ if (imp.localName === ref.referenceName || ref.referenceName.startsWith(imp.localName + '.')) {
1238
+ // Resolve the import path
1239
+ const resolvedPath = resolveImportPath(imp.source, ref.filePath, ref.language, context);
1240
+ if (resolvedPath) {
1241
+ const exportedName = imp.isDefault ? 'default' : imp.exportedName;
1242
+ const memberName = imp.isNamespace
1243
+ ? ref.referenceName.replace(imp.localName + '.', '')
1244
+ : null;
1245
+ const targetNode = findExportedSymbol(resolvedPath, { isDefault: imp.isDefault, isNamespace: imp.isNamespace, exportedName, memberName }, ref.language, context, new Set());
1246
+ if (targetNode) {
1247
+ // `Foo.bar()` / `Foo.CONST` — a NAMED (non-namespace) class import
1248
+ // accessed through a member. `findExportedSymbol` resolved `Foo` to
1249
+ // the class itself; descend into it so the reference links to the
1250
+ // member `bar`, not the class. Without this the edge points at the
1251
+ // class and `createEdges` then mis-promotes the call to an
1252
+ // `instantiates` edge, so the static method shows zero callers and a
1253
+ // hollow impact radius. (#825)
1254
+ if (!imp.isNamespace && ref.referenceName.startsWith(imp.localName + '.')) {
1255
+ const memberNode = resolveStaticMember(targetNode, ref, imp.localName, context);
1256
+ if (memberNode) {
1257
+ return {
1258
+ original: ref,
1259
+ targetNodeId: memberNode.id,
1260
+ confidence: 0.9,
1261
+ resolvedBy: 'import',
1262
+ };
1263
+ }
1264
+ }
1265
+ return {
1266
+ original: ref,
1267
+ targetNodeId: targetNode.id,
1268
+ confidence: 0.9,
1269
+ resolvedBy: 'import',
1270
+ };
1271
+ }
1272
+ }
1273
+ }
1274
+ }
1275
+ return null;
1276
+ }
1277
+ /**
1278
+ * Resolve a Python qualified reference whose receiver is an imported MODULE:
1279
+ * `certs.where()` after `from . import certs`, `mod.func()` after `import mod`
1280
+ * or `from pkg import mod`. The receiver names a submodule (a file), not a
1281
+ * symbol, so the generic symbol lookup in `resolveViaImport` can't follow it —
1282
+ * it would search the *package* for `certs`/`mod` instead of looking inside the
1283
+ * module. This is the Python half of the cross-package qualified-call problem
1284
+ * (cf. `resolveGoCrossPackageReference` for Go's `pkg.Func`, issue #388).
1285
+ *
1286
+ * Builds the module's dotted import path from the binding — `from . import
1287
+ * certs` → `.certs`; `from pkg import mod` → `pkg.mod`; `import mod` → `mod` —
1288
+ * resolves it to the module file, and finds the member defined there. Returns
1289
+ * null when no module file exists at that path, so attribute access on an
1290
+ * imported *value* (`helper.attr` where `helper` is a function) falls through
1291
+ * to the other strategies untouched.
1292
+ */
1293
+ function resolvePythonModuleMember(ref, imports, context) {
1294
+ const dotIdx = ref.referenceName.indexOf('.');
1295
+ if (dotIdx <= 0)
1296
+ return null;
1297
+ const receiver = ref.referenceName.substring(0, dotIdx);
1298
+ // The immediate member of the module (first segment after the receiver).
1299
+ const member = ref.referenceName.substring(dotIdx + 1).split('.')[0];
1300
+ if (!member)
1301
+ return null;
1302
+ for (const imp of imports) {
1303
+ if (imp.localName !== receiver)
1304
+ continue;
1305
+ // `import mod` / `import numpy as np` bind the module at `source` itself;
1306
+ // `from . import certs` / `from pkg import mod` bind a SUBMODULE whose
1307
+ // dotted path is the source joined with the imported name.
1308
+ const modulePath = imp.isNamespace
1309
+ ? imp.source
1310
+ : imp.source.endsWith('.')
1311
+ ? imp.source + imp.localName
1312
+ : imp.source + '.' + imp.localName;
1313
+ // resolveImportPath only maps RELATIVE dotted paths (`.mod`, `..pkg.mod`); an
1314
+ // ABSOLUTE package path (`pkg.module` from `from pkg import module`, or a bare
1315
+ // `import pkg.mod`) resolves to null there, so fall back to the dotted-module
1316
+ // file lookup — the same asymmetry resolveModuleImportToFile already handles
1317
+ // for the file→file import edge. Without this, a `module.func()` call after
1318
+ // `from pkg import module` dropped its `calls` edge even though the import
1319
+ // edge resolved (#578).
1320
+ let resolvedPath = resolveImportPath(modulePath, ref.filePath, ref.language, context);
1321
+ if (!resolvedPath) {
1322
+ resolvedPath = findPythonModuleFile(modulePath, context, ref.filePath)?.filePath ?? null;
1323
+ }
1324
+ if (!resolvedPath || resolvedPath === ref.filePath)
1325
+ continue;
1326
+ // Find the member as a top-level definition in the module file. Exclude
1327
+ // `method` so `mod.foo` never lands on a same-named class method.
1328
+ const target = context.getNodesInFile(resolvedPath).find((n) => n.name === member &&
1329
+ (n.kind === 'function' ||
1330
+ n.kind === 'class' ||
1331
+ n.kind === 'variable' ||
1332
+ n.kind === 'constant'));
1333
+ if (target) {
1334
+ return { original: ref, targetNodeId: target.id, confidence: 0.85, resolvedBy: 'import' };
1335
+ }
1336
+ }
1337
+ return null;
1338
+ }
1339
+ /**
1340
+ * Resolve a whole-MODULE import to that module's file (a file→file dependency).
1341
+ * The imported name is a module, not a symbol, so there's nothing to resolve to
1342
+ * — but importing a module IS a dependency on it. Covers:
1343
+ * - Python submodule imports — `from . import certs`, `from pkg import sub`;
1344
+ * - namespace imports — Python `import mod` / `import numpy as np`, and
1345
+ * TS/JS `import * as ns from './x'`.
1346
+ *
1347
+ * It is also the robust backstop for {@link resolvePythonModuleMember} and for
1348
+ * TS namespace usage: it records the dependency even when the used member is
1349
+ * re-exported elsewhere (requests' `certs.where`, re-exported from `certifi`),
1350
+ * the usage is module-level code that isn't extracted as a call, or a TS
1351
+ * namespace is touched only via a value-member read (`ns.SOME_CONST`).
1352
+ *
1353
+ * Only fires for dot-free `imports`-kind refs whose module path resolves to a
1354
+ * real file. A NAMED TS/JS import (`import { widget }`) is not a module, so it
1355
+ * returns null and normal symbol resolution handles it.
1356
+ */
1357
+ /**
1358
+ * Resolve a Lua/Luau `require(...)` to its module file. The reference name is
1359
+ * either a dotted module path (`telescope.config` → `telescope/config.lua`) or a
1360
+ * Roblox instance-path leaf (`Signal` from `require(script.Parent.Signal)` →
1361
+ * `Signal.luau`). We try `<path>.lua|.luau` and `<path>/init.lua|.luau`, matched
1362
+ * by path suffix (the module root — `lua/`, `src/`, … — is project-specific).
1363
+ * Among suffix matches, the one sharing the longest directory prefix with the
1364
+ * requiring file wins (instance-path requires resolve within the same package).
1365
+ */
1366
+ function resolveLuaRequire(ref, context) {
1367
+ const name = ref.referenceName;
1368
+ if (!name)
1369
+ return null;
1370
+ const base = name.includes('.') ? name.replace(/\./g, '/') : name;
1371
+ const suffixes = [`${base}.lua`, `${base}.luau`, `${base}/init.lua`, `${base}/init.luau`];
1372
+ const files = context.getAllFiles();
1373
+ const shared = (a, b) => {
1374
+ let i = 0;
1375
+ while (i < a.length && i < b.length && a[i] === b[i])
1376
+ i++;
1377
+ return i;
1378
+ };
1379
+ for (const suffix of suffixes) {
1380
+ const matches = files.filter((f) => f === suffix || f.endsWith('/' + suffix));
1381
+ if (matches.length === 0)
1382
+ continue;
1383
+ matches.sort((x, y) => shared(y, ref.filePath) - shared(x, ref.filePath));
1384
+ const best = matches[0];
1385
+ if (best === ref.filePath)
1386
+ continue;
1387
+ const fileNode = context.getNodesInFile(best).find((n) => n.kind === 'file');
1388
+ if (fileNode) {
1389
+ // Confidence ≥ 0.9 so this deterministic path/suffix match wins over
1390
+ // name-matching, which otherwise resolves the require to the import node
1391
+ // itself (a same-name self-match).
1392
+ return { original: ref, targetNodeId: fileNode.id, confidence: 0.9, resolvedBy: 'import' };
1393
+ }
1394
+ }
1395
+ return null;
1396
+ }
1397
+ function resolveModuleImportToFile(ref, imports, context) {
1398
+ if (ref.referenceKind !== 'imports')
1399
+ return null;
1400
+ if (ref.referenceName.includes('.'))
1401
+ return null;
1402
+ for (const imp of imports) {
1403
+ if (imp.localName !== ref.referenceName)
1404
+ continue;
1405
+ let modulePath;
1406
+ if (imp.isNamespace || imp.isDefault) {
1407
+ // `import * as ns from './x'` (namespace) or `import x from './x'`
1408
+ // (default) — the dependency is on the MODULE FILE. A default import binds
1409
+ // a (possibly renamed) local to whatever the module's default export is
1410
+ // (`import articlesController from './article.controller'` ← `export
1411
+ // default router`), so the binding name can't be found as a symbol — link
1412
+ // the file the import resolves to instead. External modules don't resolve
1413
+ // (no file), so `import React from 'react'` creates no edge.
1414
+ modulePath = imp.source;
1415
+ }
1416
+ else if (ref.language === 'python') {
1417
+ // `from . import certs` — the imported NAME is a submodule of the source.
1418
+ modulePath = imp.source.endsWith('.')
1419
+ ? imp.source + imp.localName
1420
+ : imp.source + '.' + imp.localName;
1421
+ }
1422
+ else {
1423
+ // A named TS/JS import binds a symbol, not a module — leave it alone.
1424
+ continue;
1425
+ }
1426
+ const resolvedPath = resolveImportPath(modulePath, ref.filePath, ref.language, context);
1427
+ if (resolvedPath && resolvedPath !== ref.filePath) {
1428
+ const fileNode = context.getNodesInFile(resolvedPath).find((n) => n.kind === 'file');
1429
+ if (fileNode) {
1430
+ return { original: ref, targetNodeId: fileNode.id, confidence: 0.9, resolvedBy: 'import' };
1431
+ }
1432
+ }
1433
+ // Python absolute `from a.b import submodule` (a FastAPI router aggregator's
1434
+ // `from app.api.routes import authentication`): resolveImportPath only maps
1435
+ // RELATIVE dotted paths to a file, so resolve the absolute dotted module
1436
+ // directly to its file node.
1437
+ if (ref.language === 'python') {
1438
+ const modFile = findPythonModuleFile(modulePath, context, ref.filePath);
1439
+ if (modFile) {
1440
+ return { original: ref, targetNodeId: modFile.id, confidence: 0.9, resolvedBy: 'import' };
1441
+ }
1442
+ }
1443
+ }
1444
+ return null;
1445
+ }
1446
+ /**
1447
+ * Find the file node for a Python dotted module path `a.b.c` — a module file
1448
+ * ending in `a/b/c.py`, or a package `a/b/c/__init__.py` (suffix-matched, so a
1449
+ * package rooted under `src/` etc. still resolves). Returns null for
1450
+ * stdlib/external modules (no matching repo file node), so `import os` creates
1451
+ * no edge. Shared by absolute `import a.b.c` and absolute `from a.b import c`
1452
+ * (where `c` is a submodule) resolution.
1453
+ */
1454
+ function findPythonModuleFile(mod, context, excludeFilePath) {
1455
+ if (!mod || mod.startsWith('.'))
1456
+ return null; // relative imports handled elsewhere
1457
+ const rel = mod.replace(/\./g, '/');
1458
+ const lastSeg = mod.split('.').pop();
1459
+ const endsWith = (p, want) => p === want || p.endsWith('/' + want);
1460
+ const moduleFile = context
1461
+ .getNodesByName(`${lastSeg}.py`)
1462
+ .find((n) => n.kind === 'file' && n.filePath !== excludeFilePath && endsWith(n.filePath, `${rel}.py`));
1463
+ if (moduleFile)
1464
+ return moduleFile;
1465
+ const pkgFile = context
1466
+ .getNodesByName('__init__.py')
1467
+ .find((n) => n.kind === 'file' && n.filePath !== excludeFilePath && endsWith(n.filePath, `${rel}/__init__.py`));
1468
+ return pkgFile ?? null;
1469
+ }
1470
+ /**
1471
+ * Resolve a Python ABSOLUTE dotted module import (`import a.b.c`) to its file —
1472
+ * the Django `AppConfig.ready(): import myapp.signals` pattern and any
1473
+ * side-effect module import.
1474
+ */
1475
+ function resolvePythonAbsoluteModule(ref, context) {
1476
+ if (ref.referenceKind !== 'imports')
1477
+ return null;
1478
+ // Only a DOTTED `import a.b.c` ref carries its full module path. A bare leaf
1479
+ // (`from app.api.routes import authentication`) is ambiguous on its own — three
1480
+ // `authentication.py` files may exist — so leave it to resolveModuleImportToFile,
1481
+ // which uses the import's source (`app.api.routes`) to build the full path.
1482
+ if (!ref.referenceName.includes('.'))
1483
+ return null;
1484
+ const hit = findPythonModuleFile(ref.referenceName, context, ref.filePath);
1485
+ return hit ? { original: ref, targetNodeId: hit.id, confidence: 0.9, resolvedBy: 'import' } : null;
1486
+ }
1487
+ /**
1488
+ * Resolve a Rust qualified reference `A::B::C` by mapping the MODULE prefix
1489
+ * (`A::B`) to a file and finding the leaf symbol (`C`) in it. This is the Rust
1490
+ * analog of {@link resolvePythonModuleMember} / {@link resolveGoCrossPackageReference}
1491
+ * and the precise answer to common-name re-exports (`pub use self::read::read`)
1492
+ * that name-matching can't disambiguate. Returns null when the prefix isn't a
1493
+ * real module path (e.g. `Widget::new` — `Widget` is a struct, not a module),
1494
+ * so associated-function calls and enum-variant paths fall through untouched.
1495
+ */
1496
+ function resolveRustPathReference(ref, context) {
1497
+ const segments = ref.referenceName.split('::').filter((s) => s.length > 0);
1498
+ if (segments.length < 2)
1499
+ return null;
1500
+ const leaf = segments[segments.length - 1];
1501
+ const modSegs = segments.slice(0, -1);
1502
+ const file = resolveRustModuleFile(modSegs, ref.filePath, context);
1503
+ if (!file || file === ref.filePath)
1504
+ return null;
1505
+ const target = context.getNodesInFile(file).find((n) => n.name === leaf &&
1506
+ (n.kind === 'function' ||
1507
+ n.kind === 'struct' ||
1508
+ n.kind === 'enum' ||
1509
+ n.kind === 'trait' ||
1510
+ n.kind === 'type_alias' ||
1511
+ n.kind === 'constant' ||
1512
+ n.kind === 'method' ||
1513
+ n.kind === 'class' ||
1514
+ n.kind === 'interface'));
1515
+ if (target) {
1516
+ return { original: ref, targetNodeId: target.id, confidence: 0.9, resolvedBy: 'import' };
1517
+ }
1518
+ return null;
1519
+ }
1520
+ /** The crate-root directory (holds `lib.rs`/`main.rs`), walking up from a file. */
1521
+ function rustCrateRootDir(fromFileAbs, context) {
1522
+ const projectRoot = context.getProjectRoot();
1523
+ const toRel = (p) => path.relative(projectRoot, p).replace(/\\/g, '/');
1524
+ let dir = path.dirname(fromFileAbs);
1525
+ for (let i = 0; i < 64; i++) {
1526
+ if (context.fileExists(toRel(path.join(dir, 'lib.rs'))) ||
1527
+ context.fileExists(toRel(path.join(dir, 'main.rs')))) {
1528
+ return dir;
1529
+ }
1530
+ const parent = path.dirname(dir);
1531
+ if (parent === dir)
1532
+ return null;
1533
+ dir = parent;
1534
+ }
1535
+ return null;
1536
+ }
1537
+ /** Directory under which the current file's module declares its SUBMODULES. */
1538
+ function rustSelfModuleDir(fromFileAbs) {
1539
+ const base = path.basename(fromFileAbs);
1540
+ const dir = path.dirname(fromFileAbs);
1541
+ // mod.rs / lib.rs / main.rs own their directory; `foo.rs`'s submodules live in `foo/`.
1542
+ if (base === 'mod.rs' || base === 'lib.rs' || base === 'main.rs')
1543
+ return dir;
1544
+ return path.join(dir, base.replace(/\.rs$/, ''));
1545
+ }
1546
+ /**
1547
+ * Resolve a Rust module path (segments WITHOUT the leaf symbol) to the file of
1548
+ * the last module segment — `crate::a::b` → `<crate>/a/b.rs` (or `.../b/mod.rs`).
1549
+ * Anchors on `crate` / `self` / `super`; a bare path is tried crate-relative.
1550
+ */
1551
+ function resolveRustModuleFile(segments, fromFile, context) {
1552
+ if (segments.length === 0)
1553
+ return null;
1554
+ const projectRoot = context.getProjectRoot();
1555
+ const fromAbs = path.join(projectRoot, fromFile);
1556
+ const toRel = (p) => path.relative(projectRoot, p).replace(/\\/g, '/');
1557
+ // Walk a sequence of module segments down from `startDir`, mapping each to a
1558
+ // `<seg>.rs` or `<seg>/mod.rs` file. Returns the leaf module's file, or null
1559
+ // if `startDir` is null or any segment has no file on disk.
1560
+ const resolveUnder = (startDir, rest) => {
1561
+ if (!startDir)
1562
+ return null;
1563
+ let dir = startDir;
1564
+ let targetFile = null;
1565
+ for (const seg of rest) {
1566
+ if (seg === 'self' || seg === 'crate' || seg === 'super')
1567
+ continue;
1568
+ const asFile = toRel(path.join(dir, seg + '.rs'));
1569
+ const asMod = toRel(path.join(dir, seg, 'mod.rs'));
1570
+ if (context.fileExists(asFile))
1571
+ targetFile = asFile;
1572
+ else if (context.fileExists(asMod))
1573
+ targetFile = asMod;
1574
+ else
1575
+ return null;
1576
+ dir = path.join(dir, seg);
1577
+ }
1578
+ return targetFile;
1579
+ };
1580
+ const first = segments[0];
1581
+ if (first === 'crate') {
1582
+ return resolveUnder(rustCrateRootDir(fromAbs, context), segments.slice(1));
1583
+ }
1584
+ if (first === 'self') {
1585
+ return resolveUnder(rustSelfModuleDir(fromAbs), segments.slice(1));
1586
+ }
1587
+ if (first === 'super') {
1588
+ let supers = 0;
1589
+ while (segments[supers] === 'super')
1590
+ supers++;
1591
+ let dir = rustSelfModuleDir(fromAbs);
1592
+ for (let s = 0; s < supers && dir; s++)
1593
+ dir = path.dirname(dir);
1594
+ return resolveUnder(dir, segments.slice(supers));
1595
+ }
1596
+ // Bare path. In expression position (`submodule::item()` — the router-assembly
1597
+ // and general cross-module-call pattern) the prefix is a SUBMODULE of the
1598
+ // current module, i.e. 2018 `self::`-relative — so try self-relative FIRST.
1599
+ // Fall back to crate-relative for 2015-edition / crate-root items. External
1600
+ // crate paths (`serde::de::Error`) miss both and fall through to name-matching.
1601
+ return (resolveUnder(rustSelfModuleDir(fromAbs), segments) ??
1602
+ resolveUnder(rustCrateRootDir(fromAbs, context), segments));
1603
+ }
1604
+ /**
1605
+ * Resolve a Java/Kotlin reference whose receiver is the simple name of
1606
+ * an imported FQN: `Foo.bar(...)` where `import com.example.Foo;`. The
1607
+ * imported FQN converts to a file-path suffix (`com/example/Foo.java`
1608
+ * or `.kt`) which uniquely identifies the right symbol when multiple
1609
+ * classes share the same simple name.
1610
+ *
1611
+ * Also handles bare references to the imported class itself
1612
+ * (`new Foo()` extraction emits `Foo` as a `references`/`instantiates`
1613
+ * ref) and `import static <Foo>.bar` style imports of a single member.
1614
+ */
1615
+ function resolveJavaImportedReference(ref, imports, context) {
1616
+ if (imports.length === 0)
1617
+ return null;
1618
+ const ext = ref.language === 'kotlin' ? '.kt' : '.java';
1619
+ for (const imp of imports) {
1620
+ const matchesBare = imp.localName === ref.referenceName;
1621
+ const matchesQualified = ref.referenceName.startsWith(imp.localName + '.');
1622
+ if (!matchesBare && !matchesQualified)
1623
+ continue;
1624
+ // Convert FQN to a file-path suffix. `com.example.Foo` ->
1625
+ // `com/example/Foo.java` (or `.kt`). The actual file may live
1626
+ // under any source root (`src/main/java/`, `src/`, etc.), so match
1627
+ // by suffix rather than exact path.
1628
+ const fqnPath = imp.source.replace(/\./g, '/') + ext;
1629
+ // Which symbol name to look up: the class itself, or a member.
1630
+ const memberName = matchesBare
1631
+ ? imp.localName
1632
+ : ref.referenceName.substring(imp.localName.length + 1);
1633
+ const candidates = context.getNodesByName(memberName);
1634
+ for (const node of candidates) {
1635
+ if (node.language !== ref.language)
1636
+ continue;
1637
+ const fp = node.filePath.replace(/\\/g, '/');
1638
+ if (fp.endsWith(fqnPath) || fp.endsWith('/' + fqnPath)) {
1639
+ return {
1640
+ original: ref,
1641
+ targetNodeId: node.id,
1642
+ confidence: 0.9,
1643
+ resolvedBy: 'import',
1644
+ };
1645
+ }
1646
+ }
1647
+ // `import static com.example.Foo.bar;` — the FQN's tail is the
1648
+ // member name, the part before is the owner class. Look up the
1649
+ // member named `<imp.localName>` (e.g. `bar`) and prefer the
1650
+ // candidate whose file matches the parent FQN's path.
1651
+ if (matchesBare) {
1652
+ const dot = imp.source.lastIndexOf('.');
1653
+ if (dot > 0) {
1654
+ const ownerFqn = imp.source.substring(0, dot);
1655
+ const ownerPath = ownerFqn.replace(/\./g, '/') + ext;
1656
+ for (const node of candidates) {
1657
+ if (node.language !== ref.language)
1658
+ continue;
1659
+ const fp = node.filePath.replace(/\\/g, '/');
1660
+ if (fp.endsWith(ownerPath) || fp.endsWith('/' + ownerPath)) {
1661
+ return {
1662
+ original: ref,
1663
+ targetNodeId: node.id,
1664
+ confidence: 0.9,
1665
+ resolvedBy: 'import',
1666
+ };
1667
+ }
1668
+ }
1669
+ }
1670
+ }
1671
+ }
1672
+ return null;
1673
+ }
1674
+ /**
1675
+ * Resolve a Go cross-package qualified reference (`pkga.FuncX`) by matching
1676
+ * the package alias against an in-module import, stripping the module prefix
1677
+ * to a project-relative directory, and locating the exported symbol in any
1678
+ * `.go` file under that directory. Returns `null` for stdlib / third-party
1679
+ * imports (no `go.mod`-relative match) so the rest of `resolveViaImport`
1680
+ * can still try the file-based path.
1681
+ */
1682
+ function resolveGoCrossPackageReference(ref, imports, context) {
1683
+ const mod = context.getGoModule?.();
1684
+ if (!mod)
1685
+ return null;
1686
+ // Qualified call: receiver before `.`, member after. A bare reference
1687
+ // (no dot) is a same-file/in-package call — handled elsewhere.
1688
+ const dotIdx = ref.referenceName.indexOf('.');
1689
+ if (dotIdx <= 0)
1690
+ return null;
1691
+ const receiver = ref.referenceName.substring(0, dotIdx);
1692
+ const memberName = ref.referenceName.substring(dotIdx + 1);
1693
+ if (!memberName)
1694
+ return null;
1695
+ for (const imp of imports) {
1696
+ if (imp.localName !== receiver)
1697
+ continue;
1698
+ // Only in-module imports map to a known directory.
1699
+ if (imp.source !== mod.modulePath && !imp.source.startsWith(mod.modulePath + '/')) {
1700
+ continue;
1701
+ }
1702
+ const pkgDir = imp.source === mod.modulePath
1703
+ ? ''
1704
+ : imp.source.substring(mod.modulePath.length + 1);
1705
+ // Look up the member by name and pick the candidate whose file lives
1706
+ // directly in the package directory. Match the immediate parent dir
1707
+ // exactly so a call to `pkga.FuncX` doesn't accidentally land on a
1708
+ // `FuncX` declared in `pkga/subpkg/`.
1709
+ const candidates = context.getNodesByName(memberName);
1710
+ for (const node of candidates) {
1711
+ if (node.language !== 'go')
1712
+ continue;
1713
+ if (!node.isExported)
1714
+ continue;
1715
+ const fp = node.filePath.replace(/\\/g, '/');
1716
+ const lastSlash = fp.lastIndexOf('/');
1717
+ const fileDir = lastSlash >= 0 ? fp.substring(0, lastSlash) : '';
1718
+ if (fileDir === pkgDir) {
1719
+ return {
1720
+ original: ref,
1721
+ targetNodeId: node.id,
1722
+ confidence: 0.9,
1723
+ resolvedBy: 'import',
1724
+ };
1725
+ }
1726
+ }
1727
+ }
1728
+ return null;
1729
+ }
1730
+ /** Recursive depth cap for re-export chain following. Real codebases
1731
+ * rarely chain barrels more than 2–3 deep; 8 is a generous safety
1732
+ * net that still bounds worst-case work. */
1733
+ const REEXPORT_MAX_DEPTH = 8;
1734
+ /**
1735
+ * Find an exported symbol in `filePath`, following `export { x } from
1736
+ * './other'` and `export * from './other'` chains until the original
1737
+ * declaration is reached. Cycle-safe via the `visited` set.
1738
+ *
1739
+ * Without this, every barrel-style import (`import { Foo } from
1740
+ * './index'` where `index.ts` only re-exports) used to resolve to
1741
+ * nothing — the existing code only looked for declarations IN the
1742
+ * resolved file, not declarations the file forwarded.
1743
+ */
1744
+ function findExportedSymbol(filePath, want, language, context, visited, depth = 0) {
1745
+ if (depth > REEXPORT_MAX_DEPTH)
1746
+ return undefined;
1747
+ if (visited.has(filePath))
1748
+ return undefined;
1749
+ visited.add(filePath);
1750
+ const nodesInFile = context.getNodesInFile(filePath);
1751
+ // 1. Direct hit: the symbol is declared in this file.
1752
+ if (want.isDefault) {
1753
+ // Svelte/Vue single-file components ARE the module's default export,
1754
+ // but are extracted as kind 'component' (not function/class). Prefer
1755
+ // the component node; fall back to an exported function/class for the
1756
+ // `.ts`/`.tsx` `export default fn`/`class` case. Without the component
1757
+ // branch, an `export { default as X } from './X.svelte'` barrel never
1758
+ // resolves and the component shows a false 0 callers (#629).
1759
+ const direct = nodesInFile.find((n) => n.isExported && n.kind === 'component') ??
1760
+ nodesInFile.find((n) => n.isExported && (n.kind === 'function' || n.kind === 'class'));
1761
+ if (direct)
1762
+ return direct;
1763
+ }
1764
+ else if (want.isNamespace && want.memberName) {
1765
+ const direct = nodesInFile.find((n) => n.name === want.memberName && n.isExported);
1766
+ if (direct)
1767
+ return direct;
1768
+ }
1769
+ else {
1770
+ const direct = nodesInFile.find((n) => n.name === want.exportedName && n.isExported);
1771
+ if (direct)
1772
+ return direct;
1773
+ }
1774
+ // 2. Re-export hit: the file forwards the symbol to another module.
1775
+ const reExports = context.getReExports?.(filePath, language) ?? [];
1776
+ if (reExports.length === 0)
1777
+ return undefined;
1778
+ // Look for explicit `export { want } from './other'` (with optional rename).
1779
+ const targetName = want.isDefault ? 'default' : want.exportedName;
1780
+ for (const rex of reExports) {
1781
+ if (rex.kind === 'named' && rex.exportedName === targetName) {
1782
+ const next = resolveImportPath(rex.source, filePath, language, context);
1783
+ if (!next)
1784
+ continue;
1785
+ // After rename: `export { foo as bar } from './x'` — to chase
1786
+ // `bar`, we look for `foo` in `./x`.
1787
+ const chained = findExportedSymbol(next, {
1788
+ isDefault: rex.originalName === 'default',
1789
+ isNamespace: false,
1790
+ exportedName: rex.originalName,
1791
+ memberName: null,
1792
+ }, language, context, visited, depth + 1);
1793
+ if (chained)
1794
+ return chained;
1795
+ }
1796
+ }
1797
+ // 3. Wildcard re-export: `export * from './other'` — try every
1798
+ // forwarding source. This is the barrel-of-barrels case.
1799
+ for (const rex of reExports) {
1800
+ if (rex.kind === 'wildcard') {
1801
+ const next = resolveImportPath(rex.source, filePath, language, context);
1802
+ if (!next)
1803
+ continue;
1804
+ const chained = findExportedSymbol(next, want, language, context, visited, depth + 1);
1805
+ if (chained)
1806
+ return chained;
1807
+ }
1808
+ }
1809
+ return undefined;
1810
+ }
1811
+ /** Node kinds that own static members reachable as `Container.member`. */
1812
+ const STATIC_MEMBER_CONTAINERS = new Set([
1813
+ 'class', 'struct', 'interface', 'enum', 'trait', 'protocol',
1814
+ ]);
1815
+ /**
1816
+ * Resolve `Container.member` — a static method/property access on a NAMED class
1817
+ * import (`import { Foo } …; Foo.bar()`) — to the member node, given the
1818
+ * already-resolved container class.
1819
+ *
1820
+ * Members carry a `Container::member` qualifiedName, so we look up
1821
+ * `${container.qualifiedName}::${member}` within the container's own file (the
1822
+ * file filter disambiguates same-named classes in other modules). Returns
1823
+ * undefined when the container isn't a member-owning kind or the member isn't
1824
+ * found, so the caller falls back to the container itself (prior behavior) —
1825
+ * languages whose members aren't `::`-qualified, and genuine class references,
1826
+ * are unaffected. See #825.
1827
+ */
1828
+ function resolveStaticMember(container, ref, localName, context) {
1829
+ if (!STATIC_MEMBER_CONTAINERS.has(container.kind))
1830
+ return undefined;
1831
+ // First segment after the receiver: `Foo.bar.baz` → `bar`.
1832
+ const member = ref.referenceName.slice(localName.length + 1).split('.')[0];
1833
+ if (!member)
1834
+ return undefined;
1835
+ const candidates = context
1836
+ .getNodesByQualifiedName(`${container.qualifiedName}::${member}`)
1837
+ .filter((n) => n.filePath === container.filePath);
1838
+ if (candidates.length === 0)
1839
+ return undefined;
1840
+ // When the reference is a call, prefer a callable member if several nodes
1841
+ // share the qualifiedName (e.g. a static property and a method).
1842
+ if (ref.referenceKind === 'calls') {
1843
+ const callable = candidates.find((n) => n.kind === 'method' || n.kind === 'function');
1844
+ if (callable)
1845
+ return callable;
1846
+ }
1847
+ return candidates[0];
1848
+ }
1849
+ //# sourceMappingURL=import-resolver.js.map