@ltm-alpha/alpha-cs 1.6.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 (1107) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +972 -0
  3. package/dist/bin/command-supervision.d.ts +49 -0
  4. package/dist/bin/command-supervision.d.ts.map +1 -0
  5. package/dist/bin/command-supervision.js +95 -0
  6. package/dist/bin/command-supervision.js.map +1 -0
  7. package/dist/bin/fatal-handler.d.ts +20 -0
  8. package/dist/bin/fatal-handler.d.ts.map +1 -0
  9. package/dist/bin/fatal-handler.js +118 -0
  10. package/dist/bin/fatal-handler.js.map +1 -0
  11. package/dist/bin/ltm-alpha-cs.d.ts +27 -0
  12. package/dist/bin/ltm-alpha-cs.d.ts.map +1 -0
  13. package/dist/bin/ltm-alpha-cs.js +2643 -0
  14. package/dist/bin/ltm-alpha-cs.js.map +1 -0
  15. package/dist/bin/node-version-check.d.ts +37 -0
  16. package/dist/bin/node-version-check.d.ts.map +1 -0
  17. package/dist/bin/node-version-check.js +79 -0
  18. package/dist/bin/node-version-check.js.map +1 -0
  19. package/dist/bin/uninstall.d.ts +14 -0
  20. package/dist/bin/uninstall.d.ts.map +1 -0
  21. package/dist/bin/uninstall.js +36 -0
  22. package/dist/bin/uninstall.js.map +1 -0
  23. package/dist/context/formatter.d.ts +36 -0
  24. package/dist/context/formatter.d.ts.map +1 -0
  25. package/dist/context/formatter.js +269 -0
  26. package/dist/context/formatter.js.map +1 -0
  27. package/dist/context/index.d.ts +131 -0
  28. package/dist/context/index.d.ts.map +1 -0
  29. package/dist/context/index.js +1378 -0
  30. package/dist/context/index.js.map +1 -0
  31. package/dist/context/markers.d.ts +19 -0
  32. package/dist/context/markers.d.ts.map +1 -0
  33. package/dist/context/markers.js +22 -0
  34. package/dist/context/markers.js.map +1 -0
  35. package/dist/db/index.d.ts +385 -0
  36. package/dist/db/index.d.ts.map +1 -0
  37. package/dist/db/index.js +902 -0
  38. package/dist/db/index.js.map +1 -0
  39. package/dist/db/migrations.d.ts +44 -0
  40. package/dist/db/migrations.d.ts.map +1 -0
  41. package/dist/db/migrations.js +236 -0
  42. package/dist/db/migrations.js.map +1 -0
  43. package/dist/db/queries.d.ts +1095 -0
  44. package/dist/db/queries.d.ts.map +1 -0
  45. package/dist/db/queries.js +3285 -0
  46. package/dist/db/queries.js.map +1 -0
  47. package/dist/db/schema.sql +207 -0
  48. package/dist/db/sqlite-adapter.d.ts +55 -0
  49. package/dist/db/sqlite-adapter.d.ts.map +1 -0
  50. package/dist/db/sqlite-adapter.js +135 -0
  51. package/dist/db/sqlite-adapter.js.map +1 -0
  52. package/dist/db/wal-valve.d.ts +139 -0
  53. package/dist/db/wal-valve.d.ts.map +1 -0
  54. package/dist/db/wal-valve.js +333 -0
  55. package/dist/db/wal-valve.js.map +1 -0
  56. package/dist/directory.d.ts +232 -0
  57. package/dist/directory.d.ts.map +1 -0
  58. package/dist/directory.js +877 -0
  59. package/dist/directory.js.map +1 -0
  60. package/dist/errors.d.ts +150 -0
  61. package/dist/errors.d.ts.map +1 -0
  62. package/dist/errors.js +234 -0
  63. package/dist/errors.js.map +1 -0
  64. package/dist/extraction/astro-extractor.d.ts +79 -0
  65. package/dist/extraction/astro-extractor.d.ts.map +1 -0
  66. package/dist/extraction/astro-extractor.js +320 -0
  67. package/dist/extraction/astro-extractor.js.map +1 -0
  68. package/dist/extraction/cfml-extractor.d.ts +107 -0
  69. package/dist/extraction/cfml-extractor.d.ts.map +1 -0
  70. package/dist/extraction/cfml-extractor.js +505 -0
  71. package/dist/extraction/cfml-extractor.js.map +1 -0
  72. package/dist/extraction/dfm-extractor.d.ts +31 -0
  73. package/dist/extraction/dfm-extractor.d.ts.map +1 -0
  74. package/dist/extraction/dfm-extractor.js +151 -0
  75. package/dist/extraction/dfm-extractor.js.map +1 -0
  76. package/dist/extraction/extraction-version.d.ts +25 -0
  77. package/dist/extraction/extraction-version.d.ts.map +1 -0
  78. package/dist/extraction/extraction-version.js +28 -0
  79. package/dist/extraction/extraction-version.js.map +1 -0
  80. package/dist/extraction/function-ref.d.ts +118 -0
  81. package/dist/extraction/function-ref.d.ts.map +1 -0
  82. package/dist/extraction/function-ref.js +746 -0
  83. package/dist/extraction/function-ref.js.map +1 -0
  84. package/dist/extraction/generated-detection.d.ts +66 -0
  85. package/dist/extraction/generated-detection.d.ts.map +1 -0
  86. package/dist/extraction/generated-detection.js +248 -0
  87. package/dist/extraction/generated-detection.js.map +1 -0
  88. package/dist/extraction/grammars.d.ts +148 -0
  89. package/dist/extraction/grammars.d.ts.map +1 -0
  90. package/dist/extraction/grammars.js +743 -0
  91. package/dist/extraction/grammars.js.map +1 -0
  92. package/dist/extraction/index.d.ts +455 -0
  93. package/dist/extraction/index.d.ts.map +1 -0
  94. package/dist/extraction/index.js +3208 -0
  95. package/dist/extraction/index.js.map +1 -0
  96. package/dist/extraction/kernel/decode.d.ts +9 -0
  97. package/dist/extraction/kernel/decode.d.ts.map +1 -0
  98. package/dist/extraction/kernel/decode.js +162 -0
  99. package/dist/extraction/kernel/decode.js.map +1 -0
  100. package/dist/extraction/kernel/index.d.ts +64 -0
  101. package/dist/extraction/kernel/index.d.ts.map +1 -0
  102. package/dist/extraction/kernel/index.js +279 -0
  103. package/dist/extraction/kernel/index.js.map +1 -0
  104. package/dist/extraction/kernel/layout.d.ts +101 -0
  105. package/dist/extraction/kernel/layout.d.ts.map +1 -0
  106. package/dist/extraction/kernel/layout.js +104 -0
  107. package/dist/extraction/kernel/layout.js.map +1 -0
  108. package/dist/extraction/kernel/loader.d.ts +103 -0
  109. package/dist/extraction/kernel/loader.d.ts.map +1 -0
  110. package/dist/extraction/kernel/loader.js +146 -0
  111. package/dist/extraction/kernel/loader.js.map +1 -0
  112. package/dist/extraction/languages/arkts.d.ts +3 -0
  113. package/dist/extraction/languages/arkts.d.ts.map +1 -0
  114. package/dist/extraction/languages/arkts.js +127 -0
  115. package/dist/extraction/languages/arkts.js.map +1 -0
  116. package/dist/extraction/languages/c-cpp.d.ts +167 -0
  117. package/dist/extraction/languages/c-cpp.d.ts.map +1 -0
  118. package/dist/extraction/languages/c-cpp.js +1850 -0
  119. package/dist/extraction/languages/c-cpp.js.map +1 -0
  120. package/dist/extraction/languages/cfquery.d.ts +12 -0
  121. package/dist/extraction/languages/cfquery.d.ts.map +1 -0
  122. package/dist/extraction/languages/cfquery.js +28 -0
  123. package/dist/extraction/languages/cfquery.js.map +1 -0
  124. package/dist/extraction/languages/cfscript.d.ts +3 -0
  125. package/dist/extraction/languages/cfscript.d.ts.map +1 -0
  126. package/dist/extraction/languages/cfscript.js +73 -0
  127. package/dist/extraction/languages/cfscript.js.map +1 -0
  128. package/dist/extraction/languages/cobol.d.ts +33 -0
  129. package/dist/extraction/languages/cobol.d.ts.map +1 -0
  130. package/dist/extraction/languages/cobol.js +499 -0
  131. package/dist/extraction/languages/cobol.js.map +1 -0
  132. package/dist/extraction/languages/csharp.d.ts +25 -0
  133. package/dist/extraction/languages/csharp.d.ts.map +1 -0
  134. package/dist/extraction/languages/csharp.js +175 -0
  135. package/dist/extraction/languages/csharp.js.map +1 -0
  136. package/dist/extraction/languages/dart.d.ts +3 -0
  137. package/dist/extraction/languages/dart.d.ts.map +1 -0
  138. package/dist/extraction/languages/dart.js +374 -0
  139. package/dist/extraction/languages/dart.js.map +1 -0
  140. package/dist/extraction/languages/erlang.d.ts +3 -0
  141. package/dist/extraction/languages/erlang.d.ts.map +1 -0
  142. package/dist/extraction/languages/erlang.js +386 -0
  143. package/dist/extraction/languages/erlang.js.map +1 -0
  144. package/dist/extraction/languages/go.d.ts +3 -0
  145. package/dist/extraction/languages/go.d.ts.map +1 -0
  146. package/dist/extraction/languages/go.js +111 -0
  147. package/dist/extraction/languages/go.js.map +1 -0
  148. package/dist/extraction/languages/index.d.ts +10 -0
  149. package/dist/extraction/languages/index.d.ts.map +1 -0
  150. package/dist/extraction/languages/index.js +71 -0
  151. package/dist/extraction/languages/index.js.map +1 -0
  152. package/dist/extraction/languages/java.d.ts +3 -0
  153. package/dist/extraction/languages/java.d.ts.map +1 -0
  154. package/dist/extraction/languages/java.js +315 -0
  155. package/dist/extraction/languages/java.js.map +1 -0
  156. package/dist/extraction/languages/javascript.d.ts +3 -0
  157. package/dist/extraction/languages/javascript.d.ts.map +1 -0
  158. package/dist/extraction/languages/javascript.js +106 -0
  159. package/dist/extraction/languages/javascript.js.map +1 -0
  160. package/dist/extraction/languages/kotlin.d.ts +3 -0
  161. package/dist/extraction/languages/kotlin.d.ts.map +1 -0
  162. package/dist/extraction/languages/kotlin.js +512 -0
  163. package/dist/extraction/languages/kotlin.js.map +1 -0
  164. package/dist/extraction/languages/lua.d.ts +3 -0
  165. package/dist/extraction/languages/lua.d.ts.map +1 -0
  166. package/dist/extraction/languages/lua.js +153 -0
  167. package/dist/extraction/languages/lua.js.map +1 -0
  168. package/dist/extraction/languages/luau.d.ts +3 -0
  169. package/dist/extraction/languages/luau.d.ts.map +1 -0
  170. package/dist/extraction/languages/luau.js +37 -0
  171. package/dist/extraction/languages/luau.js.map +1 -0
  172. package/dist/extraction/languages/nix.d.ts +3 -0
  173. package/dist/extraction/languages/nix.d.ts.map +1 -0
  174. package/dist/extraction/languages/nix.js +294 -0
  175. package/dist/extraction/languages/nix.js.map +1 -0
  176. package/dist/extraction/languages/objc.d.ts +3 -0
  177. package/dist/extraction/languages/objc.d.ts.map +1 -0
  178. package/dist/extraction/languages/objc.js +179 -0
  179. package/dist/extraction/languages/objc.js.map +1 -0
  180. package/dist/extraction/languages/pascal.d.ts +3 -0
  181. package/dist/extraction/languages/pascal.d.ts.map +1 -0
  182. package/dist/extraction/languages/pascal.js +77 -0
  183. package/dist/extraction/languages/pascal.js.map +1 -0
  184. package/dist/extraction/languages/php.d.ts +3 -0
  185. package/dist/extraction/languages/php.d.ts.map +1 -0
  186. package/dist/extraction/languages/php.js +196 -0
  187. package/dist/extraction/languages/php.js.map +1 -0
  188. package/dist/extraction/languages/python.d.ts +3 -0
  189. package/dist/extraction/languages/python.d.ts.map +1 -0
  190. package/dist/extraction/languages/python.js +56 -0
  191. package/dist/extraction/languages/python.js.map +1 -0
  192. package/dist/extraction/languages/r.d.ts +3 -0
  193. package/dist/extraction/languages/r.d.ts.map +1 -0
  194. package/dist/extraction/languages/r.js +314 -0
  195. package/dist/extraction/languages/r.js.map +1 -0
  196. package/dist/extraction/languages/ruby.d.ts +3 -0
  197. package/dist/extraction/languages/ruby.d.ts.map +1 -0
  198. package/dist/extraction/languages/ruby.js +149 -0
  199. package/dist/extraction/languages/ruby.js.map +1 -0
  200. package/dist/extraction/languages/rust.d.ts +23 -0
  201. package/dist/extraction/languages/rust.d.ts.map +1 -0
  202. package/dist/extraction/languages/rust.js +172 -0
  203. package/dist/extraction/languages/rust.js.map +1 -0
  204. package/dist/extraction/languages/scala.d.ts +3 -0
  205. package/dist/extraction/languages/scala.d.ts.map +1 -0
  206. package/dist/extraction/languages/scala.js +219 -0
  207. package/dist/extraction/languages/scala.js.map +1 -0
  208. package/dist/extraction/languages/solidity.d.ts +3 -0
  209. package/dist/extraction/languages/solidity.d.ts.map +1 -0
  210. package/dist/extraction/languages/solidity.js +293 -0
  211. package/dist/extraction/languages/solidity.js.map +1 -0
  212. package/dist/extraction/languages/swift.d.ts +3 -0
  213. package/dist/extraction/languages/swift.d.ts.map +1 -0
  214. package/dist/extraction/languages/swift.js +152 -0
  215. package/dist/extraction/languages/swift.js.map +1 -0
  216. package/dist/extraction/languages/terraform.d.ts +3 -0
  217. package/dist/extraction/languages/terraform.d.ts.map +1 -0
  218. package/dist/extraction/languages/terraform.js +641 -0
  219. package/dist/extraction/languages/terraform.js.map +1 -0
  220. package/dist/extraction/languages/typescript.d.ts +16 -0
  221. package/dist/extraction/languages/typescript.d.ts.map +1 -0
  222. package/dist/extraction/languages/typescript.js +174 -0
  223. package/dist/extraction/languages/typescript.js.map +1 -0
  224. package/dist/extraction/languages/vbnet.d.ts +11 -0
  225. package/dist/extraction/languages/vbnet.d.ts.map +1 -0
  226. package/dist/extraction/languages/vbnet.js +141 -0
  227. package/dist/extraction/languages/vbnet.js.map +1 -0
  228. package/dist/extraction/liquid-extractor.d.ts +59 -0
  229. package/dist/extraction/liquid-extractor.d.ts.map +1 -0
  230. package/dist/extraction/liquid-extractor.js +357 -0
  231. package/dist/extraction/liquid-extractor.js.map +1 -0
  232. package/dist/extraction/mybatis-extractor.d.ts +68 -0
  233. package/dist/extraction/mybatis-extractor.d.ts.map +1 -0
  234. package/dist/extraction/mybatis-extractor.js +300 -0
  235. package/dist/extraction/mybatis-extractor.js.map +1 -0
  236. package/dist/extraction/parse-pool.d.ts +167 -0
  237. package/dist/extraction/parse-pool.d.ts.map +1 -0
  238. package/dist/extraction/parse-pool.js +421 -0
  239. package/dist/extraction/parse-pool.js.map +1 -0
  240. package/dist/extraction/parse-worker.d.ts +8 -0
  241. package/dist/extraction/parse-worker.d.ts.map +1 -0
  242. package/dist/extraction/parse-worker.js +138 -0
  243. package/dist/extraction/parse-worker.js.map +1 -0
  244. package/dist/extraction/razor-extractor.d.ts +42 -0
  245. package/dist/extraction/razor-extractor.d.ts.map +1 -0
  246. package/dist/extraction/razor-extractor.js +285 -0
  247. package/dist/extraction/razor-extractor.js.map +1 -0
  248. package/dist/extraction/store-worker.d.ts +24 -0
  249. package/dist/extraction/store-worker.d.ts.map +1 -0
  250. package/dist/extraction/store-worker.js +139 -0
  251. package/dist/extraction/store-worker.js.map +1 -0
  252. package/dist/extraction/store-writer.d.ts +63 -0
  253. package/dist/extraction/store-writer.d.ts.map +1 -0
  254. package/dist/extraction/store-writer.js +174 -0
  255. package/dist/extraction/store-writer.js.map +1 -0
  256. package/dist/extraction/svelte-extractor.d.ts +56 -0
  257. package/dist/extraction/svelte-extractor.d.ts.map +1 -0
  258. package/dist/extraction/svelte-extractor.js +275 -0
  259. package/dist/extraction/svelte-extractor.js.map +1 -0
  260. package/dist/extraction/syntax-tokens.d.ts +103 -0
  261. package/dist/extraction/syntax-tokens.d.ts.map +1 -0
  262. package/dist/extraction/syntax-tokens.js +381 -0
  263. package/dist/extraction/syntax-tokens.js.map +1 -0
  264. package/dist/extraction/tree-sitter-helpers.d.ts +28 -0
  265. package/dist/extraction/tree-sitter-helpers.d.ts.map +1 -0
  266. package/dist/extraction/tree-sitter-helpers.js +153 -0
  267. package/dist/extraction/tree-sitter-helpers.js.map +1 -0
  268. package/dist/extraction/tree-sitter-types.d.ts +279 -0
  269. package/dist/extraction/tree-sitter-types.d.ts.map +1 -0
  270. package/dist/extraction/tree-sitter-types.js +10 -0
  271. package/dist/extraction/tree-sitter-types.js.map +1 -0
  272. package/dist/extraction/tree-sitter.d.ts +766 -0
  273. package/dist/extraction/tree-sitter.d.ts.map +1 -0
  274. package/dist/extraction/tree-sitter.js +7138 -0
  275. package/dist/extraction/tree-sitter.js.map +1 -0
  276. package/dist/extraction/vue-extractor.d.ts +51 -0
  277. package/dist/extraction/vue-extractor.d.ts.map +1 -0
  278. package/dist/extraction/vue-extractor.js +254 -0
  279. package/dist/extraction/vue-extractor.js.map +1 -0
  280. package/dist/extraction/wasm/tree-sitter-arkts.wasm +0 -0
  281. package/dist/extraction/wasm/tree-sitter-c.wasm +0 -0
  282. package/dist/extraction/wasm/tree-sitter-c_sharp.wasm +0 -0
  283. package/dist/extraction/wasm/tree-sitter-cfml.wasm +0 -0
  284. package/dist/extraction/wasm/tree-sitter-cfquery.wasm +0 -0
  285. package/dist/extraction/wasm/tree-sitter-cfscript.wasm +0 -0
  286. package/dist/extraction/wasm/tree-sitter-cobol.wasm +0 -0
  287. package/dist/extraction/wasm/tree-sitter-cpp.wasm +0 -0
  288. package/dist/extraction/wasm/tree-sitter-dart.wasm +0 -0
  289. package/dist/extraction/wasm/tree-sitter-erlang.wasm +0 -0
  290. package/dist/extraction/wasm/tree-sitter-go.wasm +0 -0
  291. package/dist/extraction/wasm/tree-sitter-java.wasm +0 -0
  292. package/dist/extraction/wasm/tree-sitter-javascript.wasm +0 -0
  293. package/dist/extraction/wasm/tree-sitter-kotlin.wasm +0 -0
  294. package/dist/extraction/wasm/tree-sitter-lua.wasm +0 -0
  295. package/dist/extraction/wasm/tree-sitter-luau.wasm +0 -0
  296. package/dist/extraction/wasm/tree-sitter-nix.wasm +0 -0
  297. package/dist/extraction/wasm/tree-sitter-pascal.wasm +0 -0
  298. package/dist/extraction/wasm/tree-sitter-php.wasm +0 -0
  299. package/dist/extraction/wasm/tree-sitter-python.wasm +0 -0
  300. package/dist/extraction/wasm/tree-sitter-r.wasm +0 -0
  301. package/dist/extraction/wasm/tree-sitter-ruby.wasm +0 -0
  302. package/dist/extraction/wasm/tree-sitter-rust.wasm +0 -0
  303. package/dist/extraction/wasm/tree-sitter-scala.wasm +0 -0
  304. package/dist/extraction/wasm/tree-sitter-swift.wasm +0 -0
  305. package/dist/extraction/wasm/tree-sitter-terraform.wasm +0 -0
  306. package/dist/extraction/wasm/tree-sitter-tsx.wasm +0 -0
  307. package/dist/extraction/wasm/tree-sitter-typescript.wasm +0 -0
  308. package/dist/extraction/wasm/tree-sitter-vbnet.wasm +0 -0
  309. package/dist/extraction/wasm-runtime-flags.d.ts +53 -0
  310. package/dist/extraction/wasm-runtime-flags.d.ts.map +1 -0
  311. package/dist/extraction/wasm-runtime-flags.js +130 -0
  312. package/dist/extraction/wasm-runtime-flags.js.map +1 -0
  313. package/dist/graph/branch-guards.d.ts +248 -0
  314. package/dist/graph/branch-guards.d.ts.map +1 -0
  315. package/dist/graph/branch-guards.js +2231 -0
  316. package/dist/graph/branch-guards.js.map +1 -0
  317. package/dist/graph/dead-code.d.ts +251 -0
  318. package/dist/graph/dead-code.d.ts.map +1 -0
  319. package/dist/graph/dead-code.js +756 -0
  320. package/dist/graph/dead-code.js.map +1 -0
  321. package/dist/graph/dynamic-boundary-report.d.ts +121 -0
  322. package/dist/graph/dynamic-boundary-report.d.ts.map +1 -0
  323. package/dist/graph/dynamic-boundary-report.js +283 -0
  324. package/dist/graph/dynamic-boundary-report.js.map +1 -0
  325. package/dist/graph/index.d.ts +12 -0
  326. package/dist/graph/index.d.ts.map +1 -0
  327. package/dist/graph/index.js +28 -0
  328. package/dist/graph/index.js.map +1 -0
  329. package/dist/graph/named-symbol-flow.d.ts +125 -0
  330. package/dist/graph/named-symbol-flow.d.ts.map +1 -0
  331. package/dist/graph/named-symbol-flow.js +552 -0
  332. package/dist/graph/named-symbol-flow.js.map +1 -0
  333. package/dist/graph/queries.d.ts +106 -0
  334. package/dist/graph/queries.d.ts.map +1 -0
  335. package/dist/graph/queries.js +341 -0
  336. package/dist/graph/queries.js.map +1 -0
  337. package/dist/graph/symbol-lookup.d.ts +83 -0
  338. package/dist/graph/symbol-lookup.d.ts.map +1 -0
  339. package/dist/graph/symbol-lookup.js +181 -0
  340. package/dist/graph/symbol-lookup.js.map +1 -0
  341. package/dist/graph/traversal.d.ts +127 -0
  342. package/dist/graph/traversal.d.ts.map +1 -0
  343. package/dist/graph/traversal.js +599 -0
  344. package/dist/graph/traversal.js.map +1 -0
  345. package/dist/graph/type-hierarchy.d.ts +155 -0
  346. package/dist/graph/type-hierarchy.d.ts.map +1 -0
  347. package/dist/graph/type-hierarchy.js +382 -0
  348. package/dist/graph/type-hierarchy.js.map +1 -0
  349. package/dist/index.d.ts +874 -0
  350. package/dist/index.d.ts.map +1 -0
  351. package/dist/index.js +2005 -0
  352. package/dist/index.js.map +1 -0
  353. package/dist/installer/config-writer.d.ts +28 -0
  354. package/dist/installer/config-writer.d.ts.map +1 -0
  355. package/dist/installer/config-writer.js +91 -0
  356. package/dist/installer/config-writer.js.map +1 -0
  357. package/dist/installer/index.d.ts +143 -0
  358. package/dist/installer/index.d.ts.map +1 -0
  359. package/dist/installer/index.js +621 -0
  360. package/dist/installer/index.js.map +1 -0
  361. package/dist/installer/instructions-template.d.ts +41 -0
  362. package/dist/installer/instructions-template.d.ts.map +1 -0
  363. package/dist/installer/instructions-template.js +53 -0
  364. package/dist/installer/instructions-template.js.map +1 -0
  365. package/dist/installer/targets/antigravity.d.ts +57 -0
  366. package/dist/installer/targets/antigravity.d.ts.map +1 -0
  367. package/dist/installer/targets/antigravity.js +308 -0
  368. package/dist/installer/targets/antigravity.js.map +1 -0
  369. package/dist/installer/targets/claude.d.ts +65 -0
  370. package/dist/installer/targets/claude.d.ts.map +1 -0
  371. package/dist/installer/targets/claude.js +514 -0
  372. package/dist/installer/targets/claude.js.map +1 -0
  373. package/dist/installer/targets/codex.d.ts +33 -0
  374. package/dist/installer/targets/codex.d.ts.map +1 -0
  375. package/dist/installer/targets/codex.js +212 -0
  376. package/dist/installer/targets/codex.js.map +1 -0
  377. package/dist/installer/targets/copilot-cli.d.ts +32 -0
  378. package/dist/installer/targets/copilot-cli.d.ts.map +1 -0
  379. package/dist/installer/targets/copilot-cli.js +215 -0
  380. package/dist/installer/targets/copilot-cli.js.map +1 -0
  381. package/dist/installer/targets/copilot-jetbrains.d.ts +42 -0
  382. package/dist/installer/targets/copilot-jetbrains.d.ts.map +1 -0
  383. package/dist/installer/targets/copilot-jetbrains.js +238 -0
  384. package/dist/installer/targets/copilot-jetbrains.js.map +1 -0
  385. package/dist/installer/targets/copilot-vscode.d.ts +47 -0
  386. package/dist/installer/targets/copilot-vscode.d.ts.map +1 -0
  387. package/dist/installer/targets/copilot-vscode.js +219 -0
  388. package/dist/installer/targets/copilot-vscode.js.map +1 -0
  389. package/dist/installer/targets/cursor.d.ts +35 -0
  390. package/dist/installer/targets/cursor.d.ts.map +1 -0
  391. package/dist/installer/targets/cursor.js +254 -0
  392. package/dist/installer/targets/cursor.js.map +1 -0
  393. package/dist/installer/targets/gemini.d.ts +26 -0
  394. package/dist/installer/targets/gemini.d.ts.map +1 -0
  395. package/dist/installer/targets/gemini.js +165 -0
  396. package/dist/installer/targets/gemini.js.map +1 -0
  397. package/dist/installer/targets/hermes.d.ts +18 -0
  398. package/dist/installer/targets/hermes.d.ts.map +1 -0
  399. package/dist/installer/targets/hermes.js +359 -0
  400. package/dist/installer/targets/hermes.js.map +1 -0
  401. package/dist/installer/targets/kiro.d.ts +27 -0
  402. package/dist/installer/targets/kiro.d.ts.map +1 -0
  403. package/dist/installer/targets/kiro.js +178 -0
  404. package/dist/installer/targets/kiro.js.map +1 -0
  405. package/dist/installer/targets/opencode.d.ts +49 -0
  406. package/dist/installer/targets/opencode.d.ts.map +1 -0
  407. package/dist/installer/targets/opencode.js +339 -0
  408. package/dist/installer/targets/opencode.js.map +1 -0
  409. package/dist/installer/targets/registry.d.ts +35 -0
  410. package/dist/installer/targets/registry.d.ts.map +1 -0
  411. package/dist/installer/targets/registry.js +97 -0
  412. package/dist/installer/targets/registry.js.map +1 -0
  413. package/dist/installer/targets/shared.d.ts +101 -0
  414. package/dist/installer/targets/shared.d.ts.map +1 -0
  415. package/dist/installer/targets/shared.js +264 -0
  416. package/dist/installer/targets/shared.js.map +1 -0
  417. package/dist/installer/targets/toml.d.ts +53 -0
  418. package/dist/installer/targets/toml.d.ts.map +1 -0
  419. package/dist/installer/targets/toml.js +226 -0
  420. package/dist/installer/targets/toml.js.map +1 -0
  421. package/dist/installer/targets/types.d.ts +108 -0
  422. package/dist/installer/targets/types.d.ts.map +1 -0
  423. package/dist/installer/targets/types.js +16 -0
  424. package/dist/installer/targets/types.js.map +1 -0
  425. package/dist/mcp/daemon-manager.d.ts +42 -0
  426. package/dist/mcp/daemon-manager.d.ts.map +1 -0
  427. package/dist/mcp/daemon-manager.js +141 -0
  428. package/dist/mcp/daemon-manager.js.map +1 -0
  429. package/dist/mcp/daemon-paths.d.ts +81 -0
  430. package/dist/mcp/daemon-paths.d.ts.map +1 -0
  431. package/dist/mcp/daemon-paths.js +228 -0
  432. package/dist/mcp/daemon-paths.js.map +1 -0
  433. package/dist/mcp/daemon-registry.d.ts +57 -0
  434. package/dist/mcp/daemon-registry.d.ts.map +1 -0
  435. package/dist/mcp/daemon-registry.js +323 -0
  436. package/dist/mcp/daemon-registry.js.map +1 -0
  437. package/dist/mcp/daemon.d.ts +294 -0
  438. package/dist/mcp/daemon.d.ts.map +1 -0
  439. package/dist/mcp/daemon.js +897 -0
  440. package/dist/mcp/daemon.js.map +1 -0
  441. package/dist/mcp/dynamic-boundaries.d.ts +32 -0
  442. package/dist/mcp/dynamic-boundaries.d.ts.map +1 -0
  443. package/dist/mcp/dynamic-boundaries.js +323 -0
  444. package/dist/mcp/dynamic-boundaries.js.map +1 -0
  445. package/dist/mcp/early-ppid.d.ts +26 -0
  446. package/dist/mcp/early-ppid.d.ts.map +1 -0
  447. package/dist/mcp/early-ppid.js +29 -0
  448. package/dist/mcp/early-ppid.js.map +1 -0
  449. package/dist/mcp/engine.d.ts +133 -0
  450. package/dist/mcp/engine.d.ts.map +1 -0
  451. package/dist/mcp/engine.js +421 -0
  452. package/dist/mcp/engine.js.map +1 -0
  453. package/dist/mcp/explore-dedup.d.ts +140 -0
  454. package/dist/mcp/explore-dedup.d.ts.map +1 -0
  455. package/dist/mcp/explore-dedup.js +239 -0
  456. package/dist/mcp/explore-dedup.js.map +1 -0
  457. package/dist/mcp/explore-diagnostics.d.ts +289 -0
  458. package/dist/mcp/explore-diagnostics.d.ts.map +1 -0
  459. package/dist/mcp/explore-diagnostics.js +558 -0
  460. package/dist/mcp/explore-diagnostics.js.map +1 -0
  461. package/dist/mcp/explore-session-state.d.ts +217 -0
  462. package/dist/mcp/explore-session-state.d.ts.map +1 -0
  463. package/dist/mcp/explore-session-state.js +322 -0
  464. package/dist/mcp/explore-session-state.js.map +1 -0
  465. package/dist/mcp/index.d.ts +139 -0
  466. package/dist/mcp/index.d.ts.map +1 -0
  467. package/dist/mcp/index.js +636 -0
  468. package/dist/mcp/index.js.map +1 -0
  469. package/dist/mcp/liveness-watchdog.d.ts +35 -0
  470. package/dist/mcp/liveness-watchdog.d.ts.map +1 -0
  471. package/dist/mcp/liveness-watchdog.js +269 -0
  472. package/dist/mcp/liveness-watchdog.js.map +1 -0
  473. package/dist/mcp/ppid-watchdog.d.ts +62 -0
  474. package/dist/mcp/ppid-watchdog.d.ts.map +1 -0
  475. package/dist/mcp/ppid-watchdog.js +64 -0
  476. package/dist/mcp/ppid-watchdog.js.map +1 -0
  477. package/dist/mcp/proxy.d.ts +87 -0
  478. package/dist/mcp/proxy.d.ts.map +1 -0
  479. package/dist/mcp/proxy.js +672 -0
  480. package/dist/mcp/proxy.js.map +1 -0
  481. package/dist/mcp/query-pool.d.ts +108 -0
  482. package/dist/mcp/query-pool.d.ts.map +1 -0
  483. package/dist/mcp/query-pool.js +315 -0
  484. package/dist/mcp/query-pool.js.map +1 -0
  485. package/dist/mcp/query-worker.d.ts +24 -0
  486. package/dist/mcp/query-worker.d.ts.map +1 -0
  487. package/dist/mcp/query-worker.js +87 -0
  488. package/dist/mcp/query-worker.js.map +1 -0
  489. package/dist/mcp/server-instructions.d.ts +34 -0
  490. package/dist/mcp/server-instructions.d.ts.map +1 -0
  491. package/dist/mcp/server-instructions.js +113 -0
  492. package/dist/mcp/server-instructions.js.map +1 -0
  493. package/dist/mcp/session.d.ts +109 -0
  494. package/dist/mcp/session.d.ts.map +1 -0
  495. package/dist/mcp/session.js +380 -0
  496. package/dist/mcp/session.js.map +1 -0
  497. package/dist/mcp/startup-handshake.d.ts +44 -0
  498. package/dist/mcp/startup-handshake.d.ts.map +1 -0
  499. package/dist/mcp/startup-handshake.js +73 -0
  500. package/dist/mcp/startup-handshake.js.map +1 -0
  501. package/dist/mcp/stdin-teardown.d.ts +27 -0
  502. package/dist/mcp/stdin-teardown.d.ts.map +1 -0
  503. package/dist/mcp/stdin-teardown.js +49 -0
  504. package/dist/mcp/stdin-teardown.js.map +1 -0
  505. package/dist/mcp/tools.d.ts +936 -0
  506. package/dist/mcp/tools.d.ts.map +1 -0
  507. package/dist/mcp/tools.js +6611 -0
  508. package/dist/mcp/tools.js.map +1 -0
  509. package/dist/mcp/transport.d.ts +188 -0
  510. package/dist/mcp/transport.d.ts.map +1 -0
  511. package/dist/mcp/transport.js +377 -0
  512. package/dist/mcp/transport.js.map +1 -0
  513. package/dist/mcp/version.d.ts +19 -0
  514. package/dist/mcp/version.d.ts.map +1 -0
  515. package/dist/mcp/version.js +71 -0
  516. package/dist/mcp/version.js.map +1 -0
  517. package/dist/mcp/writer-lock.d.ts +47 -0
  518. package/dist/mcp/writer-lock.d.ts.map +1 -0
  519. package/dist/mcp/writer-lock.js +218 -0
  520. package/dist/mcp/writer-lock.js.map +1 -0
  521. package/dist/project-config.d.ts +117 -0
  522. package/dist/project-config.d.ts.map +1 -0
  523. package/dist/project-config.js +409 -0
  524. package/dist/project-config.js.map +1 -0
  525. package/dist/resolution/alias-binding.d.ts +56 -0
  526. package/dist/resolution/alias-binding.d.ts.map +1 -0
  527. package/dist/resolution/alias-binding.js +118 -0
  528. package/dist/resolution/alias-binding.js.map +1 -0
  529. package/dist/resolution/c-fnptr-synthesizer.d.ts +6 -0
  530. package/dist/resolution/c-fnptr-synthesizer.d.ts.map +1 -0
  531. package/dist/resolution/c-fnptr-synthesizer.js +1506 -0
  532. package/dist/resolution/c-fnptr-synthesizer.js.map +1 -0
  533. package/dist/resolution/callback-synthesizer.d.ts +78 -0
  534. package/dist/resolution/callback-synthesizer.d.ts.map +1 -0
  535. package/dist/resolution/callback-synthesizer.js +4105 -0
  536. package/dist/resolution/callback-synthesizer.js.map +1 -0
  537. package/dist/resolution/cooperative-yield.d.ts +40 -0
  538. package/dist/resolution/cooperative-yield.d.ts.map +1 -0
  539. package/dist/resolution/cooperative-yield.js +44 -0
  540. package/dist/resolution/cooperative-yield.js.map +1 -0
  541. package/dist/resolution/expo-router-synthesizer.d.ts +32 -0
  542. package/dist/resolution/expo-router-synthesizer.d.ts.map +1 -0
  543. package/dist/resolution/expo-router-synthesizer.js +189 -0
  544. package/dist/resolution/expo-router-synthesizer.js.map +1 -0
  545. package/dist/resolution/frameworks/astro.d.ts +9 -0
  546. package/dist/resolution/frameworks/astro.d.ts.map +1 -0
  547. package/dist/resolution/frameworks/astro.js +169 -0
  548. package/dist/resolution/frameworks/astro.js.map +1 -0
  549. package/dist/resolution/frameworks/cargo-workspace.d.ts +18 -0
  550. package/dist/resolution/frameworks/cargo-workspace.d.ts.map +1 -0
  551. package/dist/resolution/frameworks/cargo-workspace.js +225 -0
  552. package/dist/resolution/frameworks/cargo-workspace.js.map +1 -0
  553. package/dist/resolution/frameworks/cics.d.ts +20 -0
  554. package/dist/resolution/frameworks/cics.d.ts.map +1 -0
  555. package/dist/resolution/frameworks/cics.js +90 -0
  556. package/dist/resolution/frameworks/cics.js.map +1 -0
  557. package/dist/resolution/frameworks/csharp.d.ts +8 -0
  558. package/dist/resolution/frameworks/csharp.d.ts.map +1 -0
  559. package/dist/resolution/frameworks/csharp.js +335 -0
  560. package/dist/resolution/frameworks/csharp.js.map +1 -0
  561. package/dist/resolution/frameworks/drupal.d.ts +51 -0
  562. package/dist/resolution/frameworks/drupal.d.ts.map +1 -0
  563. package/dist/resolution/frameworks/drupal.js +367 -0
  564. package/dist/resolution/frameworks/drupal.js.map +1 -0
  565. package/dist/resolution/frameworks/expo-modules.d.ts +3 -0
  566. package/dist/resolution/frameworks/expo-modules.d.ts.map +1 -0
  567. package/dist/resolution/frameworks/expo-modules.js +148 -0
  568. package/dist/resolution/frameworks/expo-modules.js.map +1 -0
  569. package/dist/resolution/frameworks/expo-router.d.ts +189 -0
  570. package/dist/resolution/frameworks/expo-router.d.ts.map +1 -0
  571. package/dist/resolution/frameworks/expo-router.js +785 -0
  572. package/dist/resolution/frameworks/expo-router.js.map +1 -0
  573. package/dist/resolution/frameworks/express.d.ts +8 -0
  574. package/dist/resolution/frameworks/express.d.ts.map +1 -0
  575. package/dist/resolution/frameworks/express.js +540 -0
  576. package/dist/resolution/frameworks/express.js.map +1 -0
  577. package/dist/resolution/frameworks/fabric.d.ts +3 -0
  578. package/dist/resolution/frameworks/fabric.d.ts.map +1 -0
  579. package/dist/resolution/frameworks/fabric.js +354 -0
  580. package/dist/resolution/frameworks/fabric.js.map +1 -0
  581. package/dist/resolution/frameworks/go.d.ts +8 -0
  582. package/dist/resolution/frameworks/go.d.ts.map +1 -0
  583. package/dist/resolution/frameworks/go.js +184 -0
  584. package/dist/resolution/frameworks/go.js.map +1 -0
  585. package/dist/resolution/frameworks/goframe.d.ts +41 -0
  586. package/dist/resolution/frameworks/goframe.d.ts.map +1 -0
  587. package/dist/resolution/frameworks/goframe.js +112 -0
  588. package/dist/resolution/frameworks/goframe.js.map +1 -0
  589. package/dist/resolution/frameworks/index.d.ts +55 -0
  590. package/dist/resolution/frameworks/index.d.ts.map +1 -0
  591. package/dist/resolution/frameworks/index.js +203 -0
  592. package/dist/resolution/frameworks/index.js.map +1 -0
  593. package/dist/resolution/frameworks/java.d.ts +8 -0
  594. package/dist/resolution/frameworks/java.d.ts.map +1 -0
  595. package/dist/resolution/frameworks/java.js +539 -0
  596. package/dist/resolution/frameworks/java.js.map +1 -0
  597. package/dist/resolution/frameworks/laravel.d.ts +13 -0
  598. package/dist/resolution/frameworks/laravel.d.ts.map +1 -0
  599. package/dist/resolution/frameworks/laravel.js +257 -0
  600. package/dist/resolution/frameworks/laravel.js.map +1 -0
  601. package/dist/resolution/frameworks/nestjs.d.ts +26 -0
  602. package/dist/resolution/frameworks/nestjs.d.ts.map +1 -0
  603. package/dist/resolution/frameworks/nestjs.js +690 -0
  604. package/dist/resolution/frameworks/nestjs.js.map +1 -0
  605. package/dist/resolution/frameworks/nextjs.d.ts +76 -0
  606. package/dist/resolution/frameworks/nextjs.d.ts.map +1 -0
  607. package/dist/resolution/frameworks/nextjs.js +328 -0
  608. package/dist/resolution/frameworks/nextjs.js.map +1 -0
  609. package/dist/resolution/frameworks/object-literal.d.ts +32 -0
  610. package/dist/resolution/frameworks/object-literal.d.ts.map +1 -0
  611. package/dist/resolution/frameworks/object-literal.js +139 -0
  612. package/dist/resolution/frameworks/object-literal.js.map +1 -0
  613. package/dist/resolution/frameworks/package-deps.d.ts +14 -0
  614. package/dist/resolution/frameworks/package-deps.d.ts.map +1 -0
  615. package/dist/resolution/frameworks/package-deps.js +78 -0
  616. package/dist/resolution/frameworks/package-deps.js.map +1 -0
  617. package/dist/resolution/frameworks/play.d.ts +19 -0
  618. package/dist/resolution/frameworks/play.d.ts.map +1 -0
  619. package/dist/resolution/frameworks/play.js +111 -0
  620. package/dist/resolution/frameworks/play.js.map +1 -0
  621. package/dist/resolution/frameworks/python.d.ts +10 -0
  622. package/dist/resolution/frameworks/python.d.ts.map +1 -0
  623. package/dist/resolution/frameworks/python.js +566 -0
  624. package/dist/resolution/frameworks/python.js.map +1 -0
  625. package/dist/resolution/frameworks/react-native.d.ts +29 -0
  626. package/dist/resolution/frameworks/react-native.d.ts.map +1 -0
  627. package/dist/resolution/frameworks/react-native.js +549 -0
  628. package/dist/resolution/frameworks/react-native.js.map +1 -0
  629. package/dist/resolution/frameworks/react-router.d.ts +46 -0
  630. package/dist/resolution/frameworks/react-router.d.ts.map +1 -0
  631. package/dist/resolution/frameworks/react-router.js +187 -0
  632. package/dist/resolution/frameworks/react-router.js.map +1 -0
  633. package/dist/resolution/frameworks/react.d.ts +9 -0
  634. package/dist/resolution/frameworks/react.d.ts.map +1 -0
  635. package/dist/resolution/frameworks/react.js +257 -0
  636. package/dist/resolution/frameworks/react.js.map +1 -0
  637. package/dist/resolution/frameworks/ruby.d.ts +8 -0
  638. package/dist/resolution/frameworks/ruby.d.ts.map +1 -0
  639. package/dist/resolution/frameworks/ruby.js +302 -0
  640. package/dist/resolution/frameworks/ruby.js.map +1 -0
  641. package/dist/resolution/frameworks/rust.d.ts +8 -0
  642. package/dist/resolution/frameworks/rust.d.ts.map +1 -0
  643. package/dist/resolution/frameworks/rust.js +304 -0
  644. package/dist/resolution/frameworks/rust.js.map +1 -0
  645. package/dist/resolution/frameworks/svelte.d.ts +9 -0
  646. package/dist/resolution/frameworks/svelte.d.ts.map +1 -0
  647. package/dist/resolution/frameworks/svelte.js +258 -0
  648. package/dist/resolution/frameworks/svelte.js.map +1 -0
  649. package/dist/resolution/frameworks/sveltekit-router.d.ts +36 -0
  650. package/dist/resolution/frameworks/sveltekit-router.d.ts.map +1 -0
  651. package/dist/resolution/frameworks/sveltekit-router.js +156 -0
  652. package/dist/resolution/frameworks/sveltekit-router.js.map +1 -0
  653. package/dist/resolution/frameworks/swift-objc.d.ts +37 -0
  654. package/dist/resolution/frameworks/swift-objc.d.ts.map +1 -0
  655. package/dist/resolution/frameworks/swift-objc.js +252 -0
  656. package/dist/resolution/frameworks/swift-objc.js.map +1 -0
  657. package/dist/resolution/frameworks/swift.d.ts +10 -0
  658. package/dist/resolution/frameworks/swift.d.ts.map +1 -0
  659. package/dist/resolution/frameworks/swift.js +410 -0
  660. package/dist/resolution/frameworks/swift.js.map +1 -0
  661. package/dist/resolution/frameworks/tanstack-router.d.ts +84 -0
  662. package/dist/resolution/frameworks/tanstack-router.d.ts.map +1 -0
  663. package/dist/resolution/frameworks/tanstack-router.js +437 -0
  664. package/dist/resolution/frameworks/tanstack-router.js.map +1 -0
  665. package/dist/resolution/frameworks/terraform.d.ts +38 -0
  666. package/dist/resolution/frameworks/terraform.d.ts.map +1 -0
  667. package/dist/resolution/frameworks/terraform.js +277 -0
  668. package/dist/resolution/frameworks/terraform.js.map +1 -0
  669. package/dist/resolution/frameworks/vue-router.d.ts +82 -0
  670. package/dist/resolution/frameworks/vue-router.d.ts.map +1 -0
  671. package/dist/resolution/frameworks/vue-router.js +377 -0
  672. package/dist/resolution/frameworks/vue-router.js.map +1 -0
  673. package/dist/resolution/frameworks/vue.d.ts +9 -0
  674. package/dist/resolution/frameworks/vue.d.ts.map +1 -0
  675. package/dist/resolution/frameworks/vue.js +303 -0
  676. package/dist/resolution/frameworks/vue.js.map +1 -0
  677. package/dist/resolution/go-module.d.ts +26 -0
  678. package/dist/resolution/go-module.d.ts.map +1 -0
  679. package/dist/resolution/go-module.js +78 -0
  680. package/dist/resolution/go-module.js.map +1 -0
  681. package/dist/resolution/goframe-synthesizer.d.ts +29 -0
  682. package/dist/resolution/goframe-synthesizer.d.ts.map +1 -0
  683. package/dist/resolution/goframe-synthesizer.js +163 -0
  684. package/dist/resolution/goframe-synthesizer.js.map +1 -0
  685. package/dist/resolution/import-resolver.d.ts +122 -0
  686. package/dist/resolution/import-resolver.d.ts.map +1 -0
  687. package/dist/resolution/import-resolver.js +2490 -0
  688. package/dist/resolution/import-resolver.js.map +1 -0
  689. package/dist/resolution/index.d.ts +402 -0
  690. package/dist/resolution/index.d.ts.map +1 -0
  691. package/dist/resolution/index.js +2581 -0
  692. package/dist/resolution/index.js.map +1 -0
  693. package/dist/resolution/js-builtins.d.ts +11 -0
  694. package/dist/resolution/js-builtins.d.ts.map +1 -0
  695. package/dist/resolution/js-builtins.js +23 -0
  696. package/dist/resolution/js-builtins.js.map +1 -0
  697. package/dist/resolution/lru-cache.d.ts +24 -0
  698. package/dist/resolution/lru-cache.d.ts.map +1 -0
  699. package/dist/resolution/lru-cache.js +62 -0
  700. package/dist/resolution/lru-cache.js.map +1 -0
  701. package/dist/resolution/memory-budget.d.ts +48 -0
  702. package/dist/resolution/memory-budget.d.ts.map +1 -0
  703. package/dist/resolution/memory-budget.js +162 -0
  704. package/dist/resolution/memory-budget.js.map +1 -0
  705. package/dist/resolution/name-matcher.d.ts +196 -0
  706. package/dist/resolution/name-matcher.d.ts.map +1 -0
  707. package/dist/resolution/name-matcher.js +3484 -0
  708. package/dist/resolution/name-matcher.js.map +1 -0
  709. package/dist/resolution/next-router-synthesizer.d.ts +27 -0
  710. package/dist/resolution/next-router-synthesizer.d.ts.map +1 -0
  711. package/dist/resolution/next-router-synthesizer.js +113 -0
  712. package/dist/resolution/next-router-synthesizer.js.map +1 -0
  713. package/dist/resolution/path-aliases.d.ts +70 -0
  714. package/dist/resolution/path-aliases.d.ts.map +1 -0
  715. package/dist/resolution/path-aliases.js +346 -0
  716. package/dist/resolution/path-aliases.js.map +1 -0
  717. package/dist/resolution/react-router-synthesizer.d.ts +33 -0
  718. package/dist/resolution/react-router-synthesizer.d.ts.map +1 -0
  719. package/dist/resolution/react-router-synthesizer.js +126 -0
  720. package/dist/resolution/react-router-synthesizer.js.map +1 -0
  721. package/dist/resolution/resolver-pool.d.ts +106 -0
  722. package/dist/resolution/resolver-pool.d.ts.map +1 -0
  723. package/dist/resolution/resolver-pool.js +344 -0
  724. package/dist/resolution/resolver-pool.js.map +1 -0
  725. package/dist/resolution/resolver-worker.d.ts +17 -0
  726. package/dist/resolution/resolver-worker.d.ts.map +1 -0
  727. package/dist/resolution/resolver-worker.js +141 -0
  728. package/dist/resolution/resolver-worker.js.map +1 -0
  729. package/dist/resolution/strip-comments.d.ts +33 -0
  730. package/dist/resolution/strip-comments.d.ts.map +1 -0
  731. package/dist/resolution/strip-comments.js +550 -0
  732. package/dist/resolution/strip-comments.js.map +1 -0
  733. package/dist/resolution/sveltekit-synthesizer.d.ts +58 -0
  734. package/dist/resolution/sveltekit-synthesizer.d.ts.map +1 -0
  735. package/dist/resolution/sveltekit-synthesizer.js +173 -0
  736. package/dist/resolution/sveltekit-synthesizer.js.map +1 -0
  737. package/dist/resolution/swift-objc-bridge.d.ts +134 -0
  738. package/dist/resolution/swift-objc-bridge.d.ts.map +1 -0
  739. package/dist/resolution/swift-objc-bridge.js +256 -0
  740. package/dist/resolution/swift-objc-bridge.js.map +1 -0
  741. package/dist/resolution/synth-utils.d.ts +26 -0
  742. package/dist/resolution/synth-utils.d.ts.map +1 -0
  743. package/dist/resolution/synth-utils.js +75 -0
  744. package/dist/resolution/synth-utils.js.map +1 -0
  745. package/dist/resolution/tanstack-router-synthesizer.d.ts +31 -0
  746. package/dist/resolution/tanstack-router-synthesizer.d.ts.map +1 -0
  747. package/dist/resolution/tanstack-router-synthesizer.js +114 -0
  748. package/dist/resolution/tanstack-router-synthesizer.js.map +1 -0
  749. package/dist/resolution/tier-synthesizer.d.ts +48 -0
  750. package/dist/resolution/tier-synthesizer.d.ts.map +1 -0
  751. package/dist/resolution/tier-synthesizer.js +907 -0
  752. package/dist/resolution/tier-synthesizer.js.map +1 -0
  753. package/dist/resolution/types.d.ts +323 -0
  754. package/dist/resolution/types.d.ts.map +1 -0
  755. package/dist/resolution/types.js +58 -0
  756. package/dist/resolution/types.js.map +1 -0
  757. package/dist/resolution/vue-router-synthesizer.d.ts +30 -0
  758. package/dist/resolution/vue-router-synthesizer.d.ts.map +1 -0
  759. package/dist/resolution/vue-router-synthesizer.js +115 -0
  760. package/dist/resolution/vue-router-synthesizer.js.map +1 -0
  761. package/dist/resolution/workspace-packages.d.ts +58 -0
  762. package/dist/resolution/workspace-packages.d.ts.map +1 -0
  763. package/dist/resolution/workspace-packages.js +346 -0
  764. package/dist/resolution/workspace-packages.js.map +1 -0
  765. package/dist/search/identifier-segments.d.ts +70 -0
  766. package/dist/search/identifier-segments.d.ts.map +1 -0
  767. package/dist/search/identifier-segments.js +205 -0
  768. package/dist/search/identifier-segments.js.map +1 -0
  769. package/dist/search/query-parser.d.ts +57 -0
  770. package/dist/search/query-parser.d.ts.map +1 -0
  771. package/dist/search/query-parser.js +177 -0
  772. package/dist/search/query-parser.js.map +1 -0
  773. package/dist/search/query-paths.d.ts +57 -0
  774. package/dist/search/query-paths.d.ts.map +1 -0
  775. package/dist/search/query-paths.js +298 -0
  776. package/dist/search/query-paths.js.map +1 -0
  777. package/dist/search/query-utils.d.ts +102 -0
  778. package/dist/search/query-utils.d.ts.map +1 -0
  779. package/dist/search/query-utils.js +487 -0
  780. package/dist/search/query-utils.js.map +1 -0
  781. package/dist/sync/git-hooks.d.ts +45 -0
  782. package/dist/sync/git-hooks.d.ts.map +1 -0
  783. package/dist/sync/git-hooks.js +227 -0
  784. package/dist/sync/git-hooks.js.map +1 -0
  785. package/dist/sync/index.d.ts +19 -0
  786. package/dist/sync/index.d.ts.map +1 -0
  787. package/dist/sync/index.js +35 -0
  788. package/dist/sync/index.js.map +1 -0
  789. package/dist/sync/watch-policy.d.ts +48 -0
  790. package/dist/sync/watch-policy.d.ts.map +1 -0
  791. package/dist/sync/watch-policy.js +124 -0
  792. package/dist/sync/watch-policy.js.map +1 -0
  793. package/dist/sync/watcher.d.ts +402 -0
  794. package/dist/sync/watcher.d.ts.map +1 -0
  795. package/dist/sync/watcher.js +978 -0
  796. package/dist/sync/watcher.js.map +1 -0
  797. package/dist/sync/worktree.d.ts +63 -0
  798. package/dist/sync/worktree.d.ts.map +1 -0
  799. package/dist/sync/worktree.js +182 -0
  800. package/dist/sync/worktree.js.map +1 -0
  801. package/dist/telemetry/index.d.ts +145 -0
  802. package/dist/telemetry/index.d.ts.map +1 -0
  803. package/dist/telemetry/index.js +592 -0
  804. package/dist/telemetry/index.js.map +1 -0
  805. package/dist/types.d.ts +473 -0
  806. package/dist/types.d.ts.map +1 -0
  807. package/dist/types.js +118 -0
  808. package/dist/types.js.map +1 -0
  809. package/dist/ui/color.d.ts +21 -0
  810. package/dist/ui/color.d.ts.map +1 -0
  811. package/dist/ui/color.js +42 -0
  812. package/dist/ui/color.js.map +1 -0
  813. package/dist/ui/glyphs.d.ts +67 -0
  814. package/dist/ui/glyphs.d.ts.map +1 -0
  815. package/dist/ui/glyphs.js +125 -0
  816. package/dist/ui/glyphs.js.map +1 -0
  817. package/dist/ui/shimmer-progress.d.ts +11 -0
  818. package/dist/ui/shimmer-progress.d.ts.map +1 -0
  819. package/dist/ui/shimmer-progress.js +164 -0
  820. package/dist/ui/shimmer-progress.js.map +1 -0
  821. package/dist/ui/shimmer-worker.d.ts +2 -0
  822. package/dist/ui/shimmer-worker.d.ts.map +1 -0
  823. package/dist/ui/shimmer-worker.js +126 -0
  824. package/dist/ui/shimmer-worker.js.map +1 -0
  825. package/dist/ui/types.d.ts +15 -0
  826. package/dist/ui/types.d.ts.map +1 -0
  827. package/dist/ui/types.js +3 -0
  828. package/dist/ui/types.js.map +1 -0
  829. package/dist/ui-server/api/deadcode.d.ts +84 -0
  830. package/dist/ui-server/api/deadcode.d.ts.map +1 -0
  831. package/dist/ui-server/api/deadcode.js +136 -0
  832. package/dist/ui-server/api/deadcode.js.map +1 -0
  833. package/dist/ui-server/api/effects.d.ts +87 -0
  834. package/dist/ui-server/api/effects.d.ts.map +1 -0
  835. package/dist/ui-server/api/effects.js +499 -0
  836. package/dist/ui-server/api/effects.js.map +1 -0
  837. package/dist/ui-server/api/entrypoints.d.ts +86 -0
  838. package/dist/ui-server/api/entrypoints.d.ts.map +1 -0
  839. package/dist/ui-server/api/entrypoints.js +279 -0
  840. package/dist/ui-server/api/entrypoints.js.map +1 -0
  841. package/dist/ui-server/api/events.d.ts +183 -0
  842. package/dist/ui-server/api/events.d.ts.map +1 -0
  843. package/dist/ui-server/api/events.js +430 -0
  844. package/dist/ui-server/api/events.js.map +1 -0
  845. package/dist/ui-server/api/file.d.ts +66 -0
  846. package/dist/ui-server/api/file.d.ts.map +1 -0
  847. package/dist/ui-server/api/file.js +235 -0
  848. package/dist/ui-server/api/file.js.map +1 -0
  849. package/dist/ui-server/api/filecode.d.ts +126 -0
  850. package/dist/ui-server/api/filecode.d.ts.map +1 -0
  851. package/dist/ui-server/api/filecode.js +205 -0
  852. package/dist/ui-server/api/filecode.js.map +1 -0
  853. package/dist/ui-server/api/flow.d.ts +226 -0
  854. package/dist/ui-server/api/flow.d.ts.map +1 -0
  855. package/dist/ui-server/api/flow.js +611 -0
  856. package/dist/ui-server/api/flow.js.map +1 -0
  857. package/dist/ui-server/api/hierarchy.d.ts +81 -0
  858. package/dist/ui-server/api/hierarchy.d.ts.map +1 -0
  859. package/dist/ui-server/api/hierarchy.js +92 -0
  860. package/dist/ui-server/api/hierarchy.js.map +1 -0
  861. package/dist/ui-server/api/index.d.ts +90 -0
  862. package/dist/ui-server/api/index.d.ts.map +1 -0
  863. package/dist/ui-server/api/index.js +332 -0
  864. package/dist/ui-server/api/index.js.map +1 -0
  865. package/dist/ui-server/api/map.d.ts +238 -0
  866. package/dist/ui-server/api/map.d.ts.map +1 -0
  867. package/dist/ui-server/api/map.js +681 -0
  868. package/dist/ui-server/api/map.js.map +1 -0
  869. package/dist/ui-server/api/node.d.ts +81 -0
  870. package/dist/ui-server/api/node.d.ts.map +1 -0
  871. package/dist/ui-server/api/node.js +388 -0
  872. package/dist/ui-server/api/node.js.map +1 -0
  873. package/dist/ui-server/api/nodes.d.ts +25 -0
  874. package/dist/ui-server/api/nodes.d.ts.map +1 -0
  875. package/dist/ui-server/api/nodes.js +45 -0
  876. package/dist/ui-server/api/nodes.js.map +1 -0
  877. package/dist/ui-server/api/program.d.ts +139 -0
  878. package/dist/ui-server/api/program.d.ts.map +1 -0
  879. package/dist/ui-server/api/program.js +315 -0
  880. package/dist/ui-server/api/program.js.map +1 -0
  881. package/dist/ui-server/api/respond.d.ts +76 -0
  882. package/dist/ui-server/api/respond.d.ts.map +1 -0
  883. package/dist/ui-server/api/respond.js +186 -0
  884. package/dist/ui-server/api/respond.js.map +1 -0
  885. package/dist/ui-server/api/route-roots.d.ts +39 -0
  886. package/dist/ui-server/api/route-roots.d.ts.map +1 -0
  887. package/dist/ui-server/api/route-roots.js +96 -0
  888. package/dist/ui-server/api/route-roots.js.map +1 -0
  889. package/dist/ui-server/api/routes.d.ts +59 -0
  890. package/dist/ui-server/api/routes.d.ts.map +1 -0
  891. package/dist/ui-server/api/routes.js +112 -0
  892. package/dist/ui-server/api/routes.js.map +1 -0
  893. package/dist/ui-server/api/screens.d.ts +117 -0
  894. package/dist/ui-server/api/screens.d.ts.map +1 -0
  895. package/dist/ui-server/api/screens.js +611 -0
  896. package/dist/ui-server/api/screens.js.map +1 -0
  897. package/dist/ui-server/api/search.d.ts +29 -0
  898. package/dist/ui-server/api/search.d.ts.map +1 -0
  899. package/dist/ui-server/api/search.js +232 -0
  900. package/dist/ui-server/api/search.js.map +1 -0
  901. package/dist/ui-server/api/session.d.ts +52 -0
  902. package/dist/ui-server/api/session.d.ts.map +1 -0
  903. package/dist/ui-server/api/session.js +199 -0
  904. package/dist/ui-server/api/session.js.map +1 -0
  905. package/dist/ui-server/api/source.d.ts +200 -0
  906. package/dist/ui-server/api/source.d.ts.map +1 -0
  907. package/dist/ui-server/api/source.js +419 -0
  908. package/dist/ui-server/api/source.js.map +1 -0
  909. package/dist/ui-server/api/stats.d.ts +27 -0
  910. package/dist/ui-server/api/stats.d.ts.map +1 -0
  911. package/dist/ui-server/api/stats.js +164 -0
  912. package/dist/ui-server/api/stats.js.map +1 -0
  913. package/dist/ui-server/api/steps.d.ts +274 -0
  914. package/dist/ui-server/api/steps.d.ts.map +1 -0
  915. package/dist/ui-server/api/steps.js +1446 -0
  916. package/dist/ui-server/api/steps.js.map +1 -0
  917. package/dist/ui-server/api/trail-store.d.ts +142 -0
  918. package/dist/ui-server/api/trail-store.d.ts.map +1 -0
  919. package/dist/ui-server/api/trail-store.js +323 -0
  920. package/dist/ui-server/api/trail-store.js.map +1 -0
  921. package/dist/ui-server/api/trails.d.ts +163 -0
  922. package/dist/ui-server/api/trails.d.ts.map +1 -0
  923. package/dist/ui-server/api/trails.js +369 -0
  924. package/dist/ui-server/api/trails.js.map +1 -0
  925. package/dist/ui-server/api/when.d.ts +125 -0
  926. package/dist/ui-server/api/when.d.ts.map +1 -0
  927. package/dist/ui-server/api/when.js +251 -0
  928. package/dist/ui-server/api/when.js.map +1 -0
  929. package/dist/ui-server/api/wire.d.ts +179 -0
  930. package/dist/ui-server/api/wire.d.ts.map +1 -0
  931. package/dist/ui-server/api/wire.js +231 -0
  932. package/dist/ui-server/api/wire.js.map +1 -0
  933. package/dist/ui-server/assets.d.ts +40 -0
  934. package/dist/ui-server/assets.d.ts.map +1 -0
  935. package/dist/ui-server/assets.js +110 -0
  936. package/dist/ui-server/assets.js.map +1 -0
  937. package/dist/ui-server/constants.d.ts +32 -0
  938. package/dist/ui-server/constants.d.ts.map +1 -0
  939. package/dist/ui-server/constants.js +35 -0
  940. package/dist/ui-server/constants.js.map +1 -0
  941. package/dist/ui-server/highlight/index.d.ts +113 -0
  942. package/dist/ui-server/highlight/index.d.ts.map +1 -0
  943. package/dist/ui-server/highlight/index.js +307 -0
  944. package/dist/ui-server/highlight/index.js.map +1 -0
  945. package/dist/ui-server/highlight/languages.d.ts +36 -0
  946. package/dist/ui-server/highlight/languages.d.ts.map +1 -0
  947. package/dist/ui-server/highlight/languages.js +50 -0
  948. package/dist/ui-server/highlight/languages.js.map +1 -0
  949. package/dist/ui-server/index.d.ts +92 -0
  950. package/dist/ui-server/index.d.ts.map +1 -0
  951. package/dist/ui-server/index.js +399 -0
  952. package/dist/ui-server/index.js.map +1 -0
  953. package/dist/ui-server/open-browser.d.ts +31 -0
  954. package/dist/ui-server/open-browser.d.ts.map +1 -0
  955. package/dist/ui-server/open-browser.js +79 -0
  956. package/dist/ui-server/open-browser.js.map +1 -0
  957. package/dist/ui-server/security.d.ts +127 -0
  958. package/dist/ui-server/security.d.ts.map +1 -0
  959. package/dist/ui-server/security.js +332 -0
  960. package/dist/ui-server/security.js.map +1 -0
  961. package/dist/ui-server/static.d.ts +45 -0
  962. package/dist/ui-server/static.d.ts.map +1 -0
  963. package/dist/ui-server/static.js +165 -0
  964. package/dist/ui-server/static.js.map +1 -0
  965. package/dist/upgrade/index.d.ts +164 -0
  966. package/dist/upgrade/index.d.ts.map +1 -0
  967. package/dist/upgrade/index.js +649 -0
  968. package/dist/upgrade/index.js.map +1 -0
  969. package/dist/upgrade/remove-binary.d.ts +87 -0
  970. package/dist/upgrade/remove-binary.d.ts.map +1 -0
  971. package/dist/upgrade/remove-binary.js +289 -0
  972. package/dist/upgrade/remove-binary.js.map +1 -0
  973. package/dist/upgrade/update-check.d.ts +92 -0
  974. package/dist/upgrade/update-check.d.ts.map +1 -0
  975. package/dist/upgrade/update-check.js +258 -0
  976. package/dist/upgrade/update-check.js.map +1 -0
  977. package/dist/utils.d.ts +238 -0
  978. package/dist/utils.d.ts.map +1 -0
  979. package/dist/utils.js +601 -0
  980. package/dist/utils.js.map +1 -0
  981. package/dist/viewer/assets/archivo-latin-ext-wght-normal-C4zznr8T.woff2 +0 -0
  982. package/dist/viewer/assets/archivo-latin-wght-normal-E0tuGl4L.woff2 +0 -0
  983. package/dist/viewer/assets/archivo-vietnamese-wght-normal-XAtsl5Q_.woff2 +0 -0
  984. package/dist/viewer/assets/ibm-plex-mono-cyrillic-400-italic-2syK4fUT.woff +0 -0
  985. package/dist/viewer/assets/ibm-plex-mono-cyrillic-400-italic-CBJ8pzag.woff2 +0 -0
  986. package/dist/viewer/assets/ibm-plex-mono-cyrillic-400-normal-BSMlKf0J.woff2 +0 -0
  987. package/dist/viewer/assets/ibm-plex-mono-cyrillic-400-normal-CEL4l2ZJ.woff +0 -0
  988. package/dist/viewer/assets/ibm-plex-mono-cyrillic-500-normal-Ael50iVv.woff +0 -0
  989. package/dist/viewer/assets/ibm-plex-mono-cyrillic-500-normal-Bq9vWWag.woff2 +0 -0
  990. package/dist/viewer/assets/ibm-plex-mono-cyrillic-600-normal-CTOM6hUh.woff2 +0 -0
  991. package/dist/viewer/assets/ibm-plex-mono-cyrillic-600-normal-fLZuRloM.woff +0 -0
  992. package/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-400-italic-B4oTjJdl.woff +0 -0
  993. package/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-400-italic-CBjNughH.woff2 +0 -0
  994. package/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-400-normal-DMdlQ8Kv.woff +0 -0
  995. package/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-400-normal-xuaO2J-f.woff2 +0 -0
  996. package/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-500-normal-BIfNGwUT.woff +0 -0
  997. package/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-500-normal-BqneJy0T.woff2 +0 -0
  998. package/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-600-normal-9HEixskS.woff +0 -0
  999. package/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-600-normal-V-xxqcpd.woff2 +0 -0
  1000. package/dist/viewer/assets/ibm-plex-mono-latin-400-italic-66oory27.woff +0 -0
  1001. package/dist/viewer/assets/ibm-plex-mono-latin-400-italic-BqAiT5Ww.woff2 +0 -0
  1002. package/dist/viewer/assets/ibm-plex-mono-latin-400-normal-CvHOgSBP.woff +0 -0
  1003. package/dist/viewer/assets/ibm-plex-mono-latin-400-normal-DMJ8VG8y.woff2 +0 -0
  1004. package/dist/viewer/assets/ibm-plex-mono-latin-500-normal-CB9ihrfo.woff +0 -0
  1005. package/dist/viewer/assets/ibm-plex-mono-latin-500-normal-DSY6xOcd.woff2 +0 -0
  1006. package/dist/viewer/assets/ibm-plex-mono-latin-600-normal-BgSNZQsw.woff2 +0 -0
  1007. package/dist/viewer/assets/ibm-plex-mono-latin-600-normal-DWFSQ4vo.woff +0 -0
  1008. package/dist/viewer/assets/ibm-plex-mono-latin-ext-400-italic-B7_fu1kp.woff2 +0 -0
  1009. package/dist/viewer/assets/ibm-plex-mono-latin-ext-400-italic-Bg0ZHwF4.woff +0 -0
  1010. package/dist/viewer/assets/ibm-plex-mono-latin-ext-400-normal-BmRBH3aV.woff2 +0 -0
  1011. package/dist/viewer/assets/ibm-plex-mono-latin-ext-400-normal-D3D2R8hC.woff +0 -0
  1012. package/dist/viewer/assets/ibm-plex-mono-latin-ext-500-normal-CAhNIIs5.woff2 +0 -0
  1013. package/dist/viewer/assets/ibm-plex-mono-latin-ext-500-normal-CZ70TYgx.woff +0 -0
  1014. package/dist/viewer/assets/ibm-plex-mono-latin-ext-600-normal-D38SheWl.woff2 +0 -0
  1015. package/dist/viewer/assets/ibm-plex-mono-latin-ext-600-normal-DmB0ttJJ.woff +0 -0
  1016. package/dist/viewer/assets/ibm-plex-mono-vietnamese-400-italic-D6eaYXMU.woff +0 -0
  1017. package/dist/viewer/assets/ibm-plex-mono-vietnamese-400-italic-DRuN92E5.woff2 +0 -0
  1018. package/dist/viewer/assets/ibm-plex-mono-vietnamese-400-normal-BulugwFq.woff2 +0 -0
  1019. package/dist/viewer/assets/ibm-plex-mono-vietnamese-400-normal-DDuiU_S-.woff +0 -0
  1020. package/dist/viewer/assets/ibm-plex-mono-vietnamese-500-normal-C8zxqsMH.woff +0 -0
  1021. package/dist/viewer/assets/ibm-plex-mono-vietnamese-500-normal-DZ4AoWbu.woff2 +0 -0
  1022. package/dist/viewer/assets/ibm-plex-mono-vietnamese-600-normal-D2EvbN8M.woff2 +0 -0
  1023. package/dist/viewer/assets/ibm-plex-mono-vietnamese-600-normal-iLQfcSjf.woff +0 -0
  1024. package/dist/viewer/assets/index-2LG7iXtP.js +97 -0
  1025. package/dist/viewer/assets/index-AtMBttuU.css +1 -0
  1026. package/dist/viewer/index.html +16 -0
  1027. package/package.json +69 -0
  1028. package/scripts/add-lang/bench.sh +60 -0
  1029. package/scripts/add-lang/check-grammar.mjs +75 -0
  1030. package/scripts/add-lang/dump-ast.mjs +103 -0
  1031. package/scripts/add-lang/verify-extraction.mjs +70 -0
  1032. package/scripts/agent-eval/ab-adoption.sh +91 -0
  1033. package/scripts/agent-eval/ab-hook.sh +86 -0
  1034. package/scripts/agent-eval/ab-impl.sh +78 -0
  1035. package/scripts/agent-eval/ab-new-vs-baseline.sh +161 -0
  1036. package/scripts/agent-eval/ab-sufficiency.sh +78 -0
  1037. package/scripts/agent-eval/allocation-fixtures.json +344 -0
  1038. package/scripts/agent-eval/arms-F.sh +21 -0
  1039. package/scripts/agent-eval/arms-matrix.sh +37 -0
  1040. package/scripts/agent-eval/audit.sh +68 -0
  1041. package/scripts/agent-eval/bench-readme.sh +48 -0
  1042. package/scripts/agent-eval/bench-why-repo.sh +22 -0
  1043. package/scripts/agent-eval/block-read-hook.sh +19 -0
  1044. package/scripts/agent-eval/compare-arms.mjs +209 -0
  1045. package/scripts/agent-eval/diff-index-drift.mjs +102 -0
  1046. package/scripts/agent-eval/hook-settings.json +15 -0
  1047. package/scripts/agent-eval/itrun.sh +120 -0
  1048. package/scripts/agent-eval/no-cli-shim.sh +96 -0
  1049. package/scripts/agent-eval/offload-eval-3arm.sh +72 -0
  1050. package/scripts/agent-eval/offload-eval-cost.mjs +133 -0
  1051. package/scripts/agent-eval/offload-eval-effort.mjs +108 -0
  1052. package/scripts/agent-eval/offload-eval-frontload-matrix.sh +25 -0
  1053. package/scripts/agent-eval/offload-eval-frontload.sh +47 -0
  1054. package/scripts/agent-eval/offload-eval-ground-truth.json +18 -0
  1055. package/scripts/agent-eval/offload-eval-hook.mjs +84 -0
  1056. package/scripts/agent-eval/offload-eval-judge.mjs +103 -0
  1057. package/scripts/agent-eval/offload-eval-matrix.sh +20 -0
  1058. package/scripts/agent-eval/offload-eval-metrics.mjs +94 -0
  1059. package/scripts/agent-eval/offload-eval-refs1.sh +50 -0
  1060. package/scripts/agent-eval/offload-eval-setup.sh +24 -0
  1061. package/scripts/agent-eval/offload-eval-styles.sh +72 -0
  1062. package/scripts/agent-eval/offload-eval-summarize.mjs +68 -0
  1063. package/scripts/agent-eval/offload-eval.md +76 -0
  1064. package/scripts/agent-eval/parse-arms.mjs +116 -0
  1065. package/scripts/agent-eval/parse-bench-readme.mjs +238 -0
  1066. package/scripts/agent-eval/parse-run.mjs +1401 -0
  1067. package/scripts/agent-eval/parse-session.mjs +130 -0
  1068. package/scripts/agent-eval/probe-allocation.mjs +335 -0
  1069. package/scripts/agent-eval/probe-context.mjs +21 -0
  1070. package/scripts/agent-eval/probe-decl-only.mjs +198 -0
  1071. package/scripts/agent-eval/probe-explore.mjs +40 -0
  1072. package/scripts/agent-eval/probe-factory-closure.mjs +147 -0
  1073. package/scripts/agent-eval/probe-file-spend.mjs +195 -0
  1074. package/scripts/agent-eval/probe-named-symbol.mjs +163 -0
  1075. package/scripts/agent-eval/probe-node.mjs +20 -0
  1076. package/scripts/agent-eval/probe-suite-envelope.mjs +124 -0
  1077. package/scripts/agent-eval/probe-sweep.mjs +119 -0
  1078. package/scripts/agent-eval/probe-trace.mjs +20 -0
  1079. package/scripts/agent-eval/redirect-read-hook.sh +38 -0
  1080. package/scripts/agent-eval/repro-concurrent-explore.mjs +119 -0
  1081. package/scripts/agent-eval/repro-daemon-clients.mjs +125 -0
  1082. package/scripts/agent-eval/run-agent.sh +34 -0
  1083. package/scripts/agent-eval/run-all.sh +149 -0
  1084. package/scripts/agent-eval/run-arms.sh +56 -0
  1085. package/scripts/agent-eval/seq-matrix.mjs +137 -0
  1086. package/scripts/benchmarks/measure-index.cjs +128 -0
  1087. package/scripts/benchmarks/observe-index.py +91 -0
  1088. package/scripts/build-bundle.sh +154 -0
  1089. package/scripts/build-kernel.sh +87 -0
  1090. package/scripts/check-ui-build.mjs +157 -0
  1091. package/scripts/check-ui-package.mjs +192 -0
  1092. package/scripts/clean-remaining.mjs +243 -0
  1093. package/scripts/count-codegraph.mjs +26 -0
  1094. package/scripts/deep-clean.mjs +66 -0
  1095. package/scripts/dump-graph.mjs +57 -0
  1096. package/scripts/extract-release-notes.mjs +130 -0
  1097. package/scripts/final-codegraph-cleanup.mjs +57 -0
  1098. package/scripts/go-rebrand.mjs +114 -0
  1099. package/scripts/kernel-parity.mjs +283 -0
  1100. package/scripts/local-install.sh +41 -0
  1101. package/scripts/npm-sdk.js +75 -0
  1102. package/scripts/npm-shim.js +279 -0
  1103. package/scripts/pack-npm.sh +123 -0
  1104. package/scripts/prepare-release.mjs +270 -0
  1105. package/scripts/rebrand.mjs +129 -0
  1106. package/scripts/sync-ui-version.mjs +47 -0
  1107. package/scripts/try-repo.sh +112 -0
@@ -0,0 +1,2490 @@
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.isNixPathImportRef = isNixPathImportRef;
42
+ exports.clearImportResolverMemos = clearImportResolverMemos;
43
+ exports.resolveImportPath = resolveImportPath;
44
+ exports.clearCppIncludeDirCache = clearCppIncludeDirCache;
45
+ exports.loadCppIncludeDirs = loadCppIncludeDirs;
46
+ exports.isPhpIncludePathRef = isPhpIncludePathRef;
47
+ exports.isCobolCopybookRef = isCobolCopybookRef;
48
+ exports.extractImportMappings = extractImportMappings;
49
+ exports.clearImportMappingCache = clearImportMappingCache;
50
+ exports.extractReExports = extractReExports;
51
+ exports.resolveJvmImport = resolveJvmImport;
52
+ exports.resolvePhpImportedStaticCall = resolvePhpImportedStaticCall;
53
+ exports.resolveViaImport = resolveViaImport;
54
+ exports.isBoundToOutOfRepoImport = isBoundToOutOfRepoImport;
55
+ const fs = __importStar(require("fs"));
56
+ const path = __importStar(require("path"));
57
+ const path_aliases_1 = require("./path-aliases");
58
+ const alias_binding_1 = require("./alias-binding");
59
+ const workspace_packages_1 = require("./workspace-packages");
60
+ const name_matcher_1 = require("./name-matcher");
61
+ /**
62
+ * Extension resolution order by language
63
+ */
64
+ const EXTENSION_RESOLUTION = {
65
+ typescript: ['.ts', '.tsx', '.d.ts', '.js', '.jsx', '/index.ts', '/index.tsx', '/index.js'],
66
+ // ArkTS imports both `.ets` components and plain `.ts` logic modules —
67
+ // HarmonyOS projects are always a mix. `/Index.ets` (capital I) is ohpm's
68
+ // module-entry convention, hit when a bare workspace import ("data") is
69
+ // rewritten to the member's directory; lowercase variants for safety.
70
+ arkts: ['.ets', '.ts', '.d.ts', '.js', '/Index.ets', '/index.ets', '/index.ts', '/index.js'],
71
+ javascript: ['.js', '.jsx', '.mjs', '.cjs', '.xsjs', '.xsjslib', '/index.js', '/index.jsx'],
72
+ tsx: ['.tsx', '.ts', '.d.ts', '.js', '.jsx', '/index.tsx', '/index.ts', '/index.js'],
73
+ jsx: ['.jsx', '.js', '/index.jsx', '/index.js'],
74
+ // SFC consumers import plain TS/JS, sibling components, and barrels
75
+ // (`./lib` → `./lib/index.ts`). Without a list, relative imports from a
76
+ // `.svelte`/`.vue` file resolve to nothing, so barrel callers vanish (#629).
77
+ svelte: ['.ts', '.js', '.svelte', '.tsx', '.jsx', '/index.ts', '/index.js', '/index.svelte'],
78
+ vue: ['.ts', '.js', '.vue', '.tsx', '.jsx', '/index.ts', '/index.js', '/index.vue'],
79
+ astro: ['.ts', '.js', '.astro', '.tsx', '.jsx', '/index.ts', '/index.js', '/index.astro'],
80
+ python: ['.py', '/__init__.py'],
81
+ go: ['.go'],
82
+ rust: ['.rs', '/mod.rs'],
83
+ java: ['.java'],
84
+ c: ['.h', '.c'],
85
+ cpp: ['.h', '.hpp', '.hxx', '.cpp', '.cc', '.cxx'],
86
+ csharp: ['.cs'],
87
+ php: ['.php'],
88
+ ruby: ['.rb'],
89
+ objc: ['.h', '.m', '.mm'],
90
+ nix: ['.nix', '/default.nix'],
91
+ };
92
+ function isNixPathImportRef(ref) {
93
+ return (ref.language === 'nix' &&
94
+ ref.referenceKind === 'imports' &&
95
+ (ref.referenceName.startsWith('./') || ref.referenceName.startsWith('../')) &&
96
+ !/[\s{}()[\];"'<>$]/.test(ref.referenceName));
97
+ }
98
+ /**
99
+ * Resolve an import path to an actual file
100
+ */
101
+ // Per-context memos for the two hottest pure lookups on the resolution path:
102
+ // import-specifier → file resolution and exported-symbol lookup. Both are pure
103
+ // given a stable file set + node table, which is exactly the window between
104
+ // ReferenceResolver.clearCaches() calls — clearImportResolverMemos() is invoked
105
+ // there, so the staleness discipline matches the resolver's own caches.
106
+ const importPathMemos = new WeakMap();
107
+ const exportedSymbolMemos = new WeakMap();
108
+ const DEFAULT_BINDING_KINDS = new Set(['function', 'class', 'component', 'constant', 'variable']);
109
+ const DEFAULT_EXPORT_BINDING_RE = /^[ \t]*export\s+default\s+([A-Za-z_$][\w$]*)\s*;?[ \t]*$/m;
110
+ const JS_FAMILY_FILE = /\.(?:[cm]?[jt]sx?)$/;
111
+ /** The identifier `export default NAME` names in a JS-family file, or null. */
112
+ function defaultExportBinding(filePath, context) {
113
+ if (!JS_FAMILY_FILE.test(filePath))
114
+ return null;
115
+ const source = context.readFile(filePath);
116
+ if (!source || !source.includes('export default'))
117
+ return null;
118
+ return source.match(DEFAULT_EXPORT_BINDING_RE)?.[1] ?? null;
119
+ }
120
+ const fileExportIndexes = new WeakMap();
121
+ function getFileExportIndex(filePath, context) {
122
+ let perFile = fileExportIndexes.get(context);
123
+ if (!perFile) {
124
+ perFile = new Map();
125
+ fileExportIndexes.set(context, perFile);
126
+ }
127
+ let idx = perFile.get(filePath);
128
+ if (!idx) {
129
+ idx = { byName: new Map(), defaultComponent: undefined, defaultFnClass: undefined, defaultBinding: undefined };
130
+ const nodesInFile = context.getNodesInFile(filePath);
131
+ // Every declaration, exported or not: a local `export { impl as alias }`
132
+ // clause exports a declaration the extractor never flagged isExported.
133
+ const declared = new Map();
134
+ for (const n of nodesInFile) {
135
+ if (!declared.has(n.name))
136
+ declared.set(n.name, n);
137
+ if (!n.isExported)
138
+ continue;
139
+ if (!idx.byName.has(n.name))
140
+ idx.byName.set(n.name, n);
141
+ if (idx.defaultComponent === undefined && n.kind === 'component')
142
+ idx.defaultComponent = n;
143
+ if (idx.defaultFnClass === undefined && (n.kind === 'function' || n.kind === 'class'))
144
+ idx.defaultFnClass = n;
145
+ }
146
+ const bound = defaultExportBinding(filePath, context);
147
+ if (bound !== null) {
148
+ idx.defaultBinding = nodesInFile
149
+ .filter((n) => n.name === bound && DEFAULT_BINDING_KINDS.has(n.kind))
150
+ .sort((a, b) => a.startLine - b.startLine || a.startColumn - b.startColumn)[0];
151
+ }
152
+ // Bind names introduced by a local export clause to their declarations, so
153
+ // an importer asking for the renamed name gets the real symbol instead of
154
+ // falling through to the name-matcher (which cannot cross the rename).
155
+ const content = context.readFile(filePath);
156
+ if (content && content.includes('export')) {
157
+ for (const { exportedName, localName } of (0, alias_binding_1.extractLocalExportAliases)(content)) {
158
+ if (idx.byName.has(exportedName))
159
+ continue;
160
+ const decl = declared.get(localName);
161
+ if (decl)
162
+ idx.byName.set(exportedName, decl);
163
+ }
164
+ }
165
+ perFile.set(filePath, idx);
166
+ }
167
+ return idx;
168
+ }
169
+ /** Drop the per-context memo tables (see ReferenceResolver.clearCaches). */
170
+ function clearImportResolverMemos(context) {
171
+ importPathMemos.delete(context);
172
+ exportedSymbolMemos.delete(context);
173
+ fileExportIndexes.delete(context);
174
+ luaFileBasenameIndexes.delete(context);
175
+ cobolCopybookIndexes.delete(context);
176
+ }
177
+ function resolveImportPath(importPath, fromFile, language, context) {
178
+ let memo = importPathMemos.get(context);
179
+ if (!memo) {
180
+ memo = new Map();
181
+ importPathMemos.set(context, memo);
182
+ }
183
+ const key = `${language}\0${fromFile}\0${importPath}`;
184
+ const hit = memo.get(key);
185
+ if (hit !== undefined || memo.has(key))
186
+ return hit ?? null;
187
+ const resolved = resolveImportPathUncached(importPath, fromFile, language, context);
188
+ memo.set(key, resolved);
189
+ return resolved;
190
+ }
191
+ function resolveImportPathUncached(importPath, fromFile, language, context) {
192
+ // COBOL COPY/EXEC SQL INCLUDE names a copybook member, not a path — the
193
+ // compiler searches a library, so we match against indexed file basenames.
194
+ // Must run before isExternalImport: a bare member name would otherwise be
195
+ // misclassified as an external package.
196
+ if (language === 'cobol') {
197
+ return resolveCobolCopybook(importPath, fromFile, context);
198
+ }
199
+ // Skip external/npm packages — but pass the context so the
200
+ // bare-specifier heuristic can consult the project's tsconfig
201
+ // alias map first (custom prefixes like `@components/*` would
202
+ // otherwise be misclassified as npm).
203
+ if (isExternalImport(importPath, language, context)) {
204
+ return null;
205
+ }
206
+ const projectRoot = context.getProjectRoot();
207
+ const fromDir = path.dirname(path.join(projectRoot, fromFile));
208
+ // Handle relative imports
209
+ if (importPath.startsWith('.')) {
210
+ return resolveRelativeImport(importPath, fromDir, language, context);
211
+ }
212
+ // Handle absolute/aliased imports (like @/ or src/)
213
+ const aliased = resolveAliasedImport(importPath, projectRoot, language, context);
214
+ if (aliased)
215
+ return aliased;
216
+ // C/C++ include directory search: when neither relative nor aliased
217
+ // resolution found a match, search -I directories from
218
+ // compile_commands.json or heuristic probing.
219
+ if (language === 'c' || language === 'cpp') {
220
+ return resolveCppIncludePath(importPath, language, context);
221
+ }
222
+ return null;
223
+ }
224
+ /**
225
+ * COBOL copybook lookup: `COPY CVACT01Y` (or `EXEC SQL INCLUDE X`) names a
226
+ * library member resolved by the compiler's copybook search path, so we match
227
+ * the member against indexed file basenames, case-insensitively. `.cpy` wins
228
+ * over a same-named program; a same-directory hit wins within a tier. The
229
+ * stem index is built once per resolution context (a per-ref scan of every
230
+ * file node would go quadratic on copybook-heavy repos).
231
+ */
232
+ const cobolCopybookIndexes = new WeakMap();
233
+ /**
234
+ * Per-context basename → file-paths index for Lua/Luau require resolution
235
+ * (cobolCopybookIndexes pattern). resolveLuaRequire previously ran
236
+ * `getAllFiles().filter(endsWith)` FOUR times per require ref — ~7.5k string
237
+ * suffix scans each, measured at ~0.9ms/ref (2.7s combined on kong's 3k
238
+ * requires). Buckets preserve getAllFiles() iteration order so the per-suffix
239
+ * candidate list filters to exactly the array the full scan produced —
240
+ * identical matches, identical stable sort, identical winner.
241
+ */
242
+ const luaFileBasenameIndexes = new WeakMap();
243
+ function luaBasenameIndex(context) {
244
+ let index = luaFileBasenameIndexes.get(context);
245
+ if (!index) {
246
+ index = new Map();
247
+ for (const f of context.getAllFiles()) {
248
+ const base = f.split('/').pop() ?? '';
249
+ const paths = index.get(base);
250
+ if (paths)
251
+ paths.push(f);
252
+ else
253
+ index.set(base, [f]);
254
+ }
255
+ luaFileBasenameIndexes.set(context, index);
256
+ }
257
+ return index;
258
+ }
259
+ function resolveCobolCopybook(member, fromFile, context) {
260
+ let index = cobolCopybookIndexes.get(context);
261
+ if (!index) {
262
+ index = new Map();
263
+ for (const fileNode of context.getNodesByKind('file')) {
264
+ const normalized = fileNode.filePath.replace(/\\/g, '/');
265
+ const base = normalized.split('/').pop() ?? '';
266
+ const dot = base.lastIndexOf('.');
267
+ const stem = (dot > 0 ? base.slice(0, dot) : base).toLowerCase();
268
+ const paths = index.get(stem);
269
+ if (paths)
270
+ paths.push(fileNode.filePath);
271
+ else
272
+ index.set(stem, [fileNode.filePath]);
273
+ }
274
+ cobolCopybookIndexes.set(context, index);
275
+ }
276
+ const candidates = index.get(member.toLowerCase());
277
+ if (!candidates || candidates.length === 0)
278
+ return null;
279
+ const fromDir = fromFile.replace(/\\/g, '/').split('/').slice(0, -1).join('/');
280
+ let best = null;
281
+ let bestScore = -1;
282
+ for (const candidate of candidates) {
283
+ const normalized = candidate.replace(/\\/g, '/');
284
+ const ext = normalized.slice(normalized.lastIndexOf('.')).toLowerCase();
285
+ let score = 0;
286
+ if (ext === '.cpy')
287
+ score += 4;
288
+ else if (ext === '.cbl' || ext === '.cob' || ext === '.cobol')
289
+ score += 2;
290
+ if (normalized.split('/').slice(0, -1).join('/') === fromDir)
291
+ score += 1;
292
+ if (score > bestScore) {
293
+ bestScore = score;
294
+ best = candidate;
295
+ }
296
+ }
297
+ return best;
298
+ }
299
+ /**
300
+ * C and C++ standard library header names (without delimiters).
301
+ * Used by isExternalImport to filter system includes from resolution.
302
+ */
303
+ const C_CPP_STDLIB_HEADERS = new Set([
304
+ // C standard library headers
305
+ 'assert.h', 'complex.h', 'ctype.h', 'errno.h', 'fenv.h', 'float.h',
306
+ 'inttypes.h', 'iso646.h', 'limits.h', 'locale.h', 'math.h', 'setjmp.h',
307
+ 'signal.h', 'stdalign.h', 'stdarg.h', 'stdatomic.h', 'stdbool.h',
308
+ 'stddef.h', 'stdint.h', 'stdio.h', 'stdlib.h', 'stdnoreturn.h',
309
+ 'string.h', 'tgmath.h', 'threads.h', 'time.h', 'uchar.h', 'wchar.h',
310
+ 'wctype.h',
311
+ // C++ C-library wrappers (cname form)
312
+ 'cassert', 'ccomplex', 'cctype', 'cerrno', 'cfenv', 'cfloat',
313
+ 'cinttypes', 'ciso646', 'climits', 'clocale', 'cmath', 'csetjmp',
314
+ 'csignal', 'cstdalign', 'cstdarg', 'cstdbool', 'cstddef', 'cstdint',
315
+ 'cstdio', 'cstdlib', 'cstring', 'ctgmath', 'ctime', 'cuchar',
316
+ 'cwchar', 'cwctype',
317
+ // C++ STL headers
318
+ 'algorithm', 'any', 'array', 'atomic', 'barrier', 'bit', 'bitset',
319
+ 'charconv', 'chrono', 'codecvt', 'compare', 'complex', 'concepts',
320
+ 'condition_variable', 'coroutine', 'deque', 'exception', 'execution',
321
+ 'expected', 'filesystem', 'format', 'forward_list', 'fstream',
322
+ 'functional', 'future', 'generator', 'initializer_list', 'iomanip',
323
+ 'ios', 'iosfwd', 'iostream', 'istream', 'iterator', 'latch',
324
+ 'limits', 'list', 'locale', 'map', 'mdspan', 'memory', 'memory_resource',
325
+ 'mutex', 'new', 'numbers', 'numeric', 'optional', 'ostream', 'print',
326
+ 'queue', 'random', 'ranges', 'ratio', 'regex', 'scoped_allocator',
327
+ 'semaphore', 'set', 'shared_mutex', 'source_location', 'span',
328
+ 'spanstream', 'sstream', 'stack', 'stacktrace', 'stdexcept',
329
+ 'stdfloat', 'stop_token', 'streambuf', 'string', 'string_view',
330
+ 'strstream', 'syncstream', 'system_error', 'thread', 'tuple',
331
+ 'type_traits', 'typeindex', 'typeinfo', 'unordered_map',
332
+ 'unordered_set', 'utility', 'valarray', 'variant', 'vector',
333
+ 'version',
334
+ ]);
335
+ /**
336
+ * Languages whose imports are ES-module specifiers, extracted by
337
+ * `extractJSImports` and therefore classified by the same bare-specifier /
338
+ * alias / workspace rules. Svelte, Vue and Astro belong here: an SFC imports
339
+ * inside its `<script>` block (Astro: the `---` frontmatter) with exactly the
340
+ * same syntax, and leaving them out made `isExternalImport` answer "not
341
+ * external" for every npm specifier in an SFC.
342
+ */
343
+ const ESM_IMPORT_LANGUAGES = new Set([
344
+ 'typescript', 'tsx', 'javascript', 'jsx', 'arkts', 'svelte', 'vue', 'astro',
345
+ ]);
346
+ /** Rust path roots that always name a standard-library crate. */
347
+ const RUST_STDLIB_ROOTS = new Set(['std', 'core', 'alloc', 'proc_macro']);
348
+ /**
349
+ * Check if an import is external (npm package, etc.)
350
+ *
351
+ * `context` is consulted for project-defined path aliases
352
+ * (tsconfig/jsconfig `paths`). Without that check, custom prefixes
353
+ * like `@components/*` would fail the bare-specifier heuristic and
354
+ * be classified as external before alias resolution can run.
355
+ */
356
+ function isExternalImport(importPath, language, context) {
357
+ // Relative imports are not external
358
+ if (importPath.startsWith('.')) {
359
+ return false;
360
+ }
361
+ // Workspace-member imports (`@scope/ui`, `@scope/ui/widgets`) are LOCAL to
362
+ // a monorepo even though they look like bare npm specifiers. Consult the
363
+ // workspace map first so they aren't misclassified as external (#629). The
364
+ // map is null for single-package repos, so this is a no-op there.
365
+ const workspaces = context?.getWorkspacePackages?.();
366
+ if (workspaces && (0, workspace_packages_1.resolveWorkspaceImport)(importPath, workspaces)) {
367
+ return false;
368
+ }
369
+ // Common external patterns
370
+ if (ESM_IMPORT_LANGUAGES.has(language)) {
371
+ // Node built-ins
372
+ if (['fs', 'path', 'os', 'crypto', 'http', 'https', 'url', 'util', 'events', 'stream', 'child_process', 'buffer'].includes(importPath)) {
373
+ return true;
374
+ }
375
+ // Project-defined alias prefix? Treat as local.
376
+ const aliases = context?.getProjectAliases?.();
377
+ if (aliases) {
378
+ for (const pat of aliases.patterns) {
379
+ if (importPath.startsWith(pat.prefix))
380
+ return false;
381
+ }
382
+ }
383
+ // Scoped packages or bare specifiers that don't start with aliases
384
+ if (!importPath.startsWith('@/') && !importPath.startsWith('~/') && !importPath.startsWith('src/')) {
385
+ // Likely an npm package
386
+ return true;
387
+ }
388
+ }
389
+ if (language === 'python') {
390
+ // Standard library modules
391
+ const stdLibs = ['os', 'sys', 'json', 're', 'math', 'datetime', 'collections', 'typing', 'pathlib', 'logging'];
392
+ if (stdLibs.includes(importPath.split('.')[0])) {
393
+ return true;
394
+ }
395
+ }
396
+ if (language === 'go') {
397
+ // Relative imports (rare in idiomatic Go but the grammar allows them).
398
+ if (importPath.startsWith('.')) {
399
+ return false;
400
+ }
401
+ // In-module imports look like `<module-path>/sub/pkg` — local to
402
+ // this project. Without the module-path check we'd flag every
403
+ // cross-package call in a Go monorepo as external (issue #388).
404
+ const mod = context?.getGoModule?.();
405
+ if (mod && (importPath === mod.modulePath || importPath.startsWith(mod.modulePath + '/'))) {
406
+ return false;
407
+ }
408
+ // `internal/` packages stay local even when go.mod is missing —
409
+ // preserves the pre-#388 escape hatch for repos without a parsed module path.
410
+ if (importPath.includes('/internal/')) {
411
+ return false;
412
+ }
413
+ // Anything else is the Go standard library or a third-party module.
414
+ return true;
415
+ }
416
+ if (language === 'c' || language === 'cpp') {
417
+ // C/C++ standard library headers — both C-style (<stdio.h>) and
418
+ // C++-style (<cstdio>, <vector>) forms. Checked against the import
419
+ // path (which the extractor strips of <> or "" delimiters).
420
+ if (C_CPP_STDLIB_HEADERS.has(importPath))
421
+ return true;
422
+ // C++ headers without .h extension (e.g. "vector", "string")
423
+ const withoutExt = importPath.replace(/\.h$/, '');
424
+ if (C_CPP_STDLIB_HEADERS.has(withoutExt))
425
+ return true;
426
+ }
427
+ return false;
428
+ }
429
+ /**
430
+ * Resolve a relative import
431
+ */
432
+ function resolveRelativeImport(importPath, fromDir, language, context) {
433
+ const projectRoot = context.getProjectRoot();
434
+ const extensions = EXTENSION_RESOLUTION[language] || [];
435
+ // Python dotted-relative imports (`from .certs import x`, `from ..pkg.mod
436
+ // import y`): leading dots are PACKAGE levels (1 = current package), and the
437
+ // remainder is a dotted submodule path. `path.resolve(dir, '.certs')` would
438
+ // treat `.certs` as a literal hidden filename, so translate the Python form
439
+ // to a real filesystem-relative path before resolving.
440
+ if (language === 'python' && importPath.startsWith('.')) {
441
+ const dots = importPath.length - importPath.replace(/^\.+/, '').length;
442
+ const up = '../'.repeat(Math.max(0, dots - 1)); // 1 dot = current dir
443
+ const rest = importPath.slice(dots).replace(/\./g, '/'); // 'sub.mod' -> 'sub/mod'
444
+ const pyBase = path.resolve(fromDir, up + rest);
445
+ const pyRel = path.relative(projectRoot, pyBase).replace(/\\/g, '/');
446
+ for (const ext of extensions) {
447
+ if (context.fileExists(pyRel + ext))
448
+ return pyRel + ext;
449
+ }
450
+ if (pyRel && context.fileExists(pyRel))
451
+ return pyRel;
452
+ return null;
453
+ }
454
+ // Try the path as-is first
455
+ const basePath = path.resolve(fromDir, importPath);
456
+ const relativePath = path.relative(projectRoot, basePath).replace(/\\/g, '/');
457
+ // Try each extension
458
+ for (const ext of extensions) {
459
+ const candidatePath = relativePath + ext;
460
+ if (context.fileExists(candidatePath)) {
461
+ return candidatePath;
462
+ }
463
+ }
464
+ // Try without extension (might already have one)
465
+ if (context.fileExists(relativePath)) {
466
+ return relativePath;
467
+ }
468
+ return findSourceForEmittedSpecifier(relativePath, language, context);
469
+ }
470
+ /**
471
+ * TypeScript under `moduleResolution: node16 | nodenext | bundler` writes the
472
+ * EMITTED extension in the specifier (`import x from './util.js'` for
473
+ * `util.ts`, `.mjs` for `.mts`, `.cjs` for `.cts`), and the source file with that
474
+ * exact name never exists in the repo. Without this remap the import resolver
475
+ * returned null for every such import, so each imported name fell through to
476
+ * bare-name matching: a method wrapping the same-named helper it imports
477
+ * (`renderDockStyles() { return renderDockStyles() }`) resolved to ITSELF, and
478
+ * any repo-wide same-named symbol could win the cross-module edge.
479
+ */
480
+ const EMITTED_TO_SOURCE_EXTENSIONS = [
481
+ [/\.js$/, ['.ts', '.tsx', '.d.ts']],
482
+ [/\.jsx$/, ['.tsx']],
483
+ [/\.mjs$/, ['.mts', '.d.mts']],
484
+ [/\.cjs$/, ['.cts', '.d.cts']],
485
+ ];
486
+ function findSourceForEmittedSpecifier(relativePath, language, context) {
487
+ if (!EMITTED_SPECIFIER_LANGUAGES.has(language))
488
+ return null;
489
+ for (const [emitted, sources] of EMITTED_TO_SOURCE_EXTENSIONS) {
490
+ if (!emitted.test(relativePath))
491
+ continue;
492
+ const stem = relativePath.replace(emitted, '');
493
+ for (const ext of sources) {
494
+ const candidate = stem + ext;
495
+ if (context.fileExists(candidate))
496
+ return candidate;
497
+ }
498
+ return null;
499
+ }
500
+ return null;
501
+ }
502
+ /** Languages whose import specifiers can name the emitted `.js` of a `.ts` source. */
503
+ const EMITTED_SPECIFIER_LANGUAGES = new Set([
504
+ 'typescript', 'tsx', 'javascript', 'jsx', 'vue', 'svelte', 'astro', 'arkts',
505
+ ]);
506
+ /**
507
+ * Resolve an aliased/absolute import.
508
+ *
509
+ * Tries, in order:
510
+ * 1. Project-defined `compilerOptions.paths` (tsconfig/jsconfig).
511
+ * Each pattern can have multiple replacements; tried in tsconfig
512
+ * priority order with extension permutations.
513
+ * 2. The legacy hard-coded fallback list (`@/`, `~/`, `src/`, ...)
514
+ * for projects that have aliases but no tsconfig paths block.
515
+ * 3. Direct path lookup (with extensions).
516
+ */
517
+ function resolveAliasedImport(importPath, projectRoot, language, context) {
518
+ const extensions = EXTENSION_RESOLUTION[language] || [];
519
+ const tryWithExt = (basePath) => {
520
+ for (const ext of extensions) {
521
+ const candidate = basePath + ext;
522
+ if (context.fileExists(candidate))
523
+ return candidate;
524
+ }
525
+ if (context.fileExists(basePath))
526
+ return basePath;
527
+ return findSourceForEmittedSpecifier(basePath, language, context);
528
+ };
529
+ // 1. Project tsconfig/jsconfig paths.
530
+ const aliasMap = context.getProjectAliases?.();
531
+ if (aliasMap) {
532
+ const candidates = (0, path_aliases_1.applyAliases)(importPath, aliasMap, projectRoot);
533
+ for (const c of candidates) {
534
+ const hit = tryWithExt(c);
535
+ if (hit)
536
+ return hit;
537
+ }
538
+ }
539
+ // 1.5 Workspace packages (`@scope/ui/widgets` → `packages/ui/widgets`).
540
+ // Resolves a monorepo member import to the member's directory; the
541
+ // extension/index permutations below then find its barrel (#629).
542
+ const workspaces = context.getWorkspacePackages?.();
543
+ if (workspaces) {
544
+ const base = (0, workspace_packages_1.resolveWorkspaceImport)(importPath, workspaces);
545
+ if (base) {
546
+ const hit = tryWithExt(base);
547
+ if (hit)
548
+ return hit;
549
+ }
550
+ }
551
+ // 2. Hard-coded fallback list. Kept for projects that use these
552
+ // conventional aliases without declaring them in tsconfig.
553
+ const fallbackAliases = {
554
+ '@/': 'src/',
555
+ '~/': 'src/',
556
+ '@src/': 'src/',
557
+ 'src/': 'src/',
558
+ '@app/': 'app/',
559
+ 'app/': 'app/',
560
+ };
561
+ for (const [alias, replacement] of Object.entries(fallbackAliases)) {
562
+ if (importPath.startsWith(alias)) {
563
+ const hit = tryWithExt(importPath.replace(alias, replacement));
564
+ if (hit)
565
+ return hit;
566
+ }
567
+ }
568
+ // 3. Direct path.
569
+ return tryWithExt(importPath);
570
+ }
571
+ /**
572
+ * C/C++ include directory cache (keyed by project root).
573
+ * Loaded once per resolver instance, shared across calls.
574
+ */
575
+ const cppIncludeDirCache = new Map();
576
+ /**
577
+ * Clear the C/C++ include directory cache (call between indexing runs)
578
+ */
579
+ function clearCppIncludeDirCache() {
580
+ cppIncludeDirCache.clear();
581
+ }
582
+ /**
583
+ * Discover C/C++ include search directories for a project.
584
+ *
585
+ * Strategy:
586
+ * 1. Look for compile_commands.json (Clang compilation database) in the
587
+ * project root and common build subdirectories. Parse -I and -isystem
588
+ * flags from compiler commands.
589
+ * 2. If no compilation database is found, probe for common convention
590
+ * directories (include/, src/, lib/, api/) and top-level directories
591
+ * containing .h/.hpp files.
592
+ *
593
+ * Returns paths relative to projectRoot.
594
+ */
595
+ function loadCppIncludeDirs(projectRoot) {
596
+ const cached = cppIncludeDirCache.get(projectRoot);
597
+ if (cached !== undefined)
598
+ return cached;
599
+ const dirs = loadCppIncludeDirsFromCompileDB(projectRoot)
600
+ || loadCppIncludeDirsHeuristic(projectRoot);
601
+ cppIncludeDirCache.set(projectRoot, dirs);
602
+ return dirs;
603
+ }
604
+ /**
605
+ * Try to load include directories from compile_commands.json.
606
+ * Returns null if no compilation database is found (so the heuristic
607
+ * fallback can run). Returns an array (possibly empty) otherwise.
608
+ */
609
+ function loadCppIncludeDirsFromCompileDB(projectRoot) {
610
+ const candidates = [
611
+ path.join(projectRoot, 'compile_commands.json'),
612
+ path.join(projectRoot, 'build', 'compile_commands.json'),
613
+ path.join(projectRoot, 'cmake-build-debug', 'compile_commands.json'),
614
+ path.join(projectRoot, 'cmake-build-release', 'compile_commands.json'),
615
+ path.join(projectRoot, 'out', 'compile_commands.json'),
616
+ ];
617
+ let dbPath;
618
+ for (const c of candidates) {
619
+ try {
620
+ if (fs.existsSync(c)) {
621
+ dbPath = c;
622
+ break;
623
+ }
624
+ }
625
+ catch {
626
+ // ignore
627
+ }
628
+ }
629
+ if (!dbPath)
630
+ return null;
631
+ try {
632
+ const content = fs.readFileSync(dbPath, 'utf-8');
633
+ const entries = JSON.parse(content);
634
+ if (!Array.isArray(entries))
635
+ return null;
636
+ const dirSet = new Set();
637
+ for (const entry of entries) {
638
+ const dir = entry.directory || projectRoot;
639
+ const args = entry.arguments || (entry.command ? shlexSplit(entry.command) : []);
640
+ for (let i = 0; i < args.length; i++) {
641
+ const arg = args[i];
642
+ let includeDir;
643
+ // -I<dir> (no space)
644
+ if (arg.startsWith('-I') && arg.length > 2) {
645
+ includeDir = arg.substring(2);
646
+ }
647
+ // -isystem <dir> (space-separated)
648
+ else if ((arg === '-isystem' || arg === '-I') && i + 1 < args.length) {
649
+ includeDir = args[i + 1];
650
+ i++; // skip next arg
651
+ }
652
+ if (includeDir) {
653
+ // Normalize: resolve relative to the compilation directory
654
+ const absPath = path.isAbsolute(includeDir)
655
+ ? includeDir
656
+ : path.resolve(dir, includeDir);
657
+ const relPath = path.relative(projectRoot, absPath).replace(/\\/g, '/');
658
+ // Skip system directories and paths outside the project
659
+ // (relative paths starting with .. or absolute paths like
660
+ // /usr/include or C:\usr on Windows)
661
+ if (!relPath.startsWith('..') && relPath.length > 0 && !path.isAbsolute(relPath)) {
662
+ dirSet.add(relPath);
663
+ }
664
+ }
665
+ }
666
+ }
667
+ return Array.from(dirSet);
668
+ }
669
+ catch {
670
+ return null;
671
+ }
672
+ }
673
+ /**
674
+ * Minimal shlex-style split for compiler command strings.
675
+ * Handles double-quoted and single-quoted arguments.
676
+ */
677
+ function shlexSplit(cmd) {
678
+ const result = [];
679
+ let i = 0;
680
+ while (i < cmd.length) {
681
+ // Skip whitespace
682
+ while (i < cmd.length && /\s/.test(cmd[i]))
683
+ i++;
684
+ if (i >= cmd.length)
685
+ break;
686
+ const ch = cmd[i];
687
+ if (ch === '"') {
688
+ i++;
689
+ let arg = '';
690
+ while (i < cmd.length && cmd[i] !== '"') {
691
+ if (cmd[i] === '\\' && i + 1 < cmd.length) {
692
+ i++;
693
+ arg += cmd[i];
694
+ }
695
+ else {
696
+ arg += cmd[i];
697
+ }
698
+ i++;
699
+ }
700
+ i++; // closing quote
701
+ result.push(arg);
702
+ }
703
+ else if (ch === "'") {
704
+ i++;
705
+ let arg = '';
706
+ while (i < cmd.length && cmd[i] !== "'") {
707
+ arg += cmd[i];
708
+ i++;
709
+ }
710
+ i++; // closing quote
711
+ result.push(arg);
712
+ }
713
+ else {
714
+ let arg = '';
715
+ while (i < cmd.length && !/\s/.test(cmd[i])) {
716
+ arg += cmd[i];
717
+ i++;
718
+ }
719
+ result.push(arg);
720
+ }
721
+ }
722
+ return result;
723
+ }
724
+ /**
725
+ * Heuristic include directory discovery when no compile_commands.json exists.
726
+ * Checks common convention directories and scans top-level dirs for headers.
727
+ */
728
+ function loadCppIncludeDirsHeuristic(projectRoot) {
729
+ const dirs = [];
730
+ const conventionDirs = ['include', 'src', 'lib', 'api', 'inc'];
731
+ try {
732
+ const entries = fs.readdirSync(projectRoot, { withFileTypes: true });
733
+ for (const entry of entries) {
734
+ if (!entry.isDirectory())
735
+ continue;
736
+ const name = entry.name;
737
+ // Convention directories
738
+ if (conventionDirs.includes(name.toLowerCase())) {
739
+ dirs.push(name);
740
+ continue;
741
+ }
742
+ // Any top-level directory containing .h or .hpp files
743
+ try {
744
+ const subFiles = fs.readdirSync(path.join(projectRoot, name));
745
+ if (subFiles.some(f => /\.(h|hpp|hxx|hh)$/i.test(f))) {
746
+ dirs.push(name);
747
+ }
748
+ }
749
+ catch {
750
+ // ignore permission errors
751
+ }
752
+ }
753
+ }
754
+ catch {
755
+ // ignore
756
+ }
757
+ return dirs;
758
+ }
759
+ /**
760
+ * Resolve a C/C++ include path by searching include directories.
761
+ * Called as a fallback after relative and aliased resolution fail.
762
+ */
763
+ function resolveCppIncludePath(importPath, language, context) {
764
+ const includeDirs = context.getCppIncludeDirs?.() ?? [];
765
+ const extensions = EXTENSION_RESOLUTION[language] ?? [];
766
+ for (const dir of includeDirs) {
767
+ const normalizedDir = dir.replace(/\\/g, '/');
768
+ for (const ext of extensions) {
769
+ const candidate = normalizedDir + '/' + importPath + ext;
770
+ if (context.fileExists(candidate))
771
+ return candidate;
772
+ }
773
+ // Try as-is (already has extension)
774
+ const candidate = normalizedDir + '/' + importPath;
775
+ if (context.fileExists(candidate))
776
+ return candidate;
777
+ }
778
+ return null;
779
+ }
780
+ /**
781
+ * Is this reference a PHP include/require PATH (vs a namespace `use` symbol)?
782
+ *
783
+ * include/require emit a file path ("lib.php", "inc/db.php", "../x.php"),
784
+ * whereas namespace use is an FQN (App\Foo\Bar) or a bare class symbol
785
+ * (Closure). PHP identifiers contain neither '/' nor '.', so a slash or dot
786
+ * marks a path-shaped include. Such references resolve to files only — never
787
+ * to a same-named symbol — so callers must not fall back to the name-matcher.
788
+ */
789
+ function isPhpIncludePathRef(ref) {
790
+ return (ref.language === 'php' &&
791
+ ref.referenceKind === 'imports' &&
792
+ (ref.referenceName.includes('/') || ref.referenceName.includes('.')));
793
+ }
794
+ /**
795
+ * Is this a COBOL COPY / EXEC SQL INCLUDE copybook reference? These resolve
796
+ * to files only (or stay unresolved for compiler-supplied members) — never
797
+ * to a same-named symbol via the name-matcher.
798
+ */
799
+ function isCobolCopybookRef(ref) {
800
+ return ref.language === 'cobol' && ref.referenceKind === 'imports';
801
+ }
802
+ /**
803
+ * Resolve a PHP include/require path to a project-relative file path.
804
+ *
805
+ * PHP resolves includes relative to the including file's directory (the
806
+ * common case for procedural codebases); php.ini `include_path` is not
807
+ * modeled. Callers pass an already-extracted static literal path.
808
+ */
809
+ function resolvePhpIncludePath(includePath, fromFile, context) {
810
+ const projectRoot = context.getProjectRoot();
811
+ const fromDir = path.dirname(path.join(projectRoot, fromFile));
812
+ const basePath = path.resolve(fromDir, includePath);
813
+ const relativePath = path.relative(projectRoot, basePath).replace(/\\/g, '/');
814
+ if (context.fileExists(relativePath))
815
+ return relativePath;
816
+ // The literal may omit the .php extension (e.g. include "config").
817
+ for (const ext of EXTENSION_RESOLUTION.php ?? []) {
818
+ if (context.fileExists(relativePath + ext))
819
+ return relativePath + ext;
820
+ }
821
+ return null;
822
+ }
823
+ /**
824
+ * Extract import mappings from a file
825
+ */
826
+ function extractImportMappings(_filePath, content, language) {
827
+ const mappings = [];
828
+ if (language === 'typescript' || language === 'javascript' || language === 'tsx' || language === 'jsx' || language === 'arkts') {
829
+ mappings.push(...extractJSImports(content));
830
+ }
831
+ else if (language === 'svelte' || language === 'vue' || language === 'astro') {
832
+ // Svelte/Vue single-file components import via plain ES6 inside their
833
+ // `<script>` block (Astro: the `---` frontmatter). Without this, a
834
+ // `.svelte`/`.vue`/`.astro` consumer produces
835
+ // zero import mappings, so `resolveViaImport` can't run and a barrel
836
+ // import (`import { Foo } from './lib'`) falls back to name-matching —
837
+ // which silently fails whenever the re-export alias differs from the
838
+ // component's real name, yielding a false 0 callers (#629). The ES6
839
+ // import regex only matches `import … from '…'`, so running it over the
840
+ // whole SFC (markup + styles included) is safe.
841
+ mappings.push(...extractJSImports(content));
842
+ }
843
+ else if (language === 'python') {
844
+ mappings.push(...extractPythonImports(content));
845
+ }
846
+ else if (language === 'go') {
847
+ mappings.push(...extractGoImports(content));
848
+ }
849
+ else if (language === 'java' || language === 'kotlin') {
850
+ mappings.push(...extractJavaImports(content));
851
+ }
852
+ else if (language === 'php') {
853
+ mappings.push(...extractPHPImports(content));
854
+ }
855
+ else if (language === 'c' || language === 'cpp') {
856
+ mappings.push(...extractCppImports(content));
857
+ }
858
+ return mappings;
859
+ }
860
+ /**
861
+ * Extract JS/TS import mappings
862
+ */
863
+ function extractJSImports(content) {
864
+ const mappings = [];
865
+ // ES6 imports
866
+ const importRegex = /import\s+(?:(\w+)\s*,?\s*)?(?:\{([^}]+)\})?\s*(?:(\*)\s+as\s+(\w+))?\s*from\s*['"]([^'"]+)['"]/g;
867
+ let match;
868
+ while ((match = importRegex.exec(content)) !== null) {
869
+ const [, defaultImport, namedImports, star, namespaceAlias, source] = match;
870
+ // Default import
871
+ if (defaultImport) {
872
+ mappings.push({
873
+ localName: defaultImport,
874
+ exportedName: 'default',
875
+ source: source,
876
+ isDefault: true,
877
+ isNamespace: false,
878
+ });
879
+ }
880
+ // Named imports
881
+ if (namedImports) {
882
+ const names = namedImports.split(',').map((s) => s.trim());
883
+ for (const name of names) {
884
+ const aliasMatch = name.match(/(\w+)\s+as\s+(\w+)/);
885
+ if (aliasMatch) {
886
+ mappings.push({
887
+ localName: aliasMatch[2],
888
+ exportedName: aliasMatch[1],
889
+ source: source,
890
+ isDefault: false,
891
+ isNamespace: false,
892
+ });
893
+ }
894
+ else if (name) {
895
+ mappings.push({
896
+ localName: name,
897
+ exportedName: name,
898
+ source: source,
899
+ isDefault: false,
900
+ isNamespace: false,
901
+ });
902
+ }
903
+ }
904
+ }
905
+ // Namespace import
906
+ if (star && namespaceAlias) {
907
+ mappings.push({
908
+ localName: namespaceAlias,
909
+ exportedName: '*',
910
+ source: source,
911
+ isDefault: false,
912
+ isNamespace: true,
913
+ });
914
+ }
915
+ }
916
+ // Require statements
917
+ const requireRegex = /(?:const|let|var)\s+(?:(\w+)|{([^}]+)})\s*=\s*require\(['"]([^'"]+)['"]\)/g;
918
+ while ((match = requireRegex.exec(content)) !== null) {
919
+ const [, defaultName, destructured, source] = match;
920
+ if (defaultName) {
921
+ mappings.push({
922
+ localName: defaultName,
923
+ exportedName: 'default',
924
+ source: source,
925
+ isDefault: true,
926
+ isNamespace: false,
927
+ });
928
+ }
929
+ if (destructured) {
930
+ const names = destructured.split(',').map((s) => s.trim());
931
+ for (const name of names) {
932
+ const aliasMatch = name.match(/(\w+)\s*:\s*(\w+)/);
933
+ if (aliasMatch) {
934
+ mappings.push({
935
+ localName: aliasMatch[2],
936
+ exportedName: aliasMatch[1],
937
+ source: source,
938
+ isDefault: false,
939
+ isNamespace: false,
940
+ });
941
+ }
942
+ else if (name) {
943
+ mappings.push({
944
+ localName: name,
945
+ exportedName: name,
946
+ source: source,
947
+ isDefault: false,
948
+ isNamespace: false,
949
+ });
950
+ }
951
+ }
952
+ }
953
+ }
954
+ return mappings;
955
+ }
956
+ /**
957
+ * Extract Python import mappings
958
+ */
959
+ function extractPythonImports(content) {
960
+ const mappings = [];
961
+ // from X import Y
962
+ const fromImportRegex = /from\s+([\w.]+)\s+import\s+([^#\n]+)/g;
963
+ let match;
964
+ while ((match = fromImportRegex.exec(content)) !== null) {
965
+ const [, source, imports] = match;
966
+ const names = imports.split(',').map((s) => s.trim());
967
+ for (const name of names) {
968
+ const aliasMatch = name.match(/(\w+)\s+as\s+(\w+)/);
969
+ if (aliasMatch) {
970
+ mappings.push({
971
+ localName: aliasMatch[2],
972
+ exportedName: aliasMatch[1],
973
+ source: source,
974
+ isDefault: false,
975
+ isNamespace: false,
976
+ });
977
+ }
978
+ else if (name && name !== '*') {
979
+ mappings.push({
980
+ localName: name,
981
+ exportedName: name,
982
+ source: source,
983
+ isDefault: false,
984
+ isNamespace: false,
985
+ });
986
+ }
987
+ }
988
+ }
989
+ // import X
990
+ const importRegex = /^import\s+([\w.]+)(?:\s+as\s+(\w+))?/gm;
991
+ while ((match = importRegex.exec(content)) !== null) {
992
+ const [, source, alias] = match;
993
+ const localName = alias || source.split('.').pop();
994
+ mappings.push({
995
+ localName,
996
+ exportedName: '*',
997
+ source: source,
998
+ isDefault: false,
999
+ isNamespace: true,
1000
+ });
1001
+ }
1002
+ return mappings;
1003
+ }
1004
+ /**
1005
+ * Extract Go import mappings
1006
+ */
1007
+ function extractGoImports(content) {
1008
+ const mappings = [];
1009
+ // import "path" or import alias "path"
1010
+ const singleImportRegex = /import\s+(?:(\w+)\s+)?["']([^"']+)["']/g;
1011
+ let match;
1012
+ while ((match = singleImportRegex.exec(content)) !== null) {
1013
+ const [, alias, source] = match;
1014
+ const packageName = source.split('/').pop();
1015
+ mappings.push({
1016
+ localName: alias || packageName,
1017
+ exportedName: '*',
1018
+ source: source,
1019
+ isDefault: false,
1020
+ isNamespace: true,
1021
+ });
1022
+ }
1023
+ // import ( ... ) block
1024
+ const blockImportRegex = /import\s*\(\s*([^)]+)\s*\)/gs;
1025
+ while ((match = blockImportRegex.exec(content)) !== null) {
1026
+ const block = match[1];
1027
+ const lineRegex = /(?:(\w+)\s+)?["']([^"']+)["']/g;
1028
+ let lineMatch;
1029
+ while ((lineMatch = lineRegex.exec(block)) !== null) {
1030
+ const [, alias, source] = lineMatch;
1031
+ const packageName = source.split('/').pop();
1032
+ mappings.push({
1033
+ localName: alias || packageName,
1034
+ exportedName: '*',
1035
+ source: source,
1036
+ isDefault: false,
1037
+ isNamespace: true,
1038
+ });
1039
+ }
1040
+ }
1041
+ return mappings;
1042
+ }
1043
+ /**
1044
+ * Extract Java / Kotlin import mappings.
1045
+ *
1046
+ * Java/Kotlin imports carry the full qualified name of the imported
1047
+ * symbol — `import com.example.dao.converter.FooConverter;` — which is
1048
+ * exactly the disambiguation signal we need when two packages both
1049
+ * declare a `FooConverter`. Pre-#314 the resolver had no Java branch
1050
+ * here at all, so this mapping was empty and cross-module name
1051
+ * collisions were resolved by file-path proximity (often wrongly).
1052
+ *
1053
+ * `import static com.example.Foo.bar;` is parsed as a local-name `bar`
1054
+ * pointing at FQN `com.example.Foo.bar` so static-method call sites
1055
+ * (`bar(...)`) can resolve through the same import lookup.
1056
+ */
1057
+ function extractJavaImports(content) {
1058
+ const mappings = [];
1059
+ // Strip line and block comments so `// import foo;` doesn't false-match.
1060
+ const stripped = content
1061
+ .replace(/\/\*[\s\S]*?\*\//g, '')
1062
+ .replace(/\/\/[^\n]*/g, '');
1063
+ // `import [static] <fqn>[.*];`
1064
+ const re = /^\s*import\s+(static\s+)?([\w.]+(?:\.\*)?)\s*;/gm;
1065
+ let match;
1066
+ while ((match = re.exec(stripped)) !== null) {
1067
+ const fqn = match[2];
1068
+ // `import com.example.*;` — wildcard. We can't materialize a single
1069
+ // local name; skip and let name-matching handle members reachable
1070
+ // through the wildcard. (Future enhancement: enumerate package files.)
1071
+ if (fqn.endsWith('.*'))
1072
+ continue;
1073
+ const parts = fqn.split('.');
1074
+ const localName = parts[parts.length - 1];
1075
+ if (!localName)
1076
+ continue;
1077
+ mappings.push({
1078
+ localName,
1079
+ exportedName: localName,
1080
+ source: fqn,
1081
+ isDefault: false,
1082
+ isNamespace: false,
1083
+ });
1084
+ }
1085
+ return mappings;
1086
+ }
1087
+ /**
1088
+ * Extract PHP import mappings (use statements)
1089
+ */
1090
+ function extractPHPImports(content) {
1091
+ const mappings = [];
1092
+ // use Namespace\Class; or use Namespace\Class as Alias;
1093
+ const useRegex = /use\s+([\w\\]+)(?:\s+as\s+(\w+))?;/g;
1094
+ let match;
1095
+ while ((match = useRegex.exec(content)) !== null) {
1096
+ const [, fullPath, alias] = match;
1097
+ const className = fullPath.split('\\').pop();
1098
+ mappings.push({
1099
+ localName: alias || className,
1100
+ exportedName: className,
1101
+ source: fullPath,
1102
+ isDefault: false,
1103
+ isNamespace: false,
1104
+ });
1105
+ }
1106
+ return mappings;
1107
+ }
1108
+ /**
1109
+ * Extract C/C++ import mappings from #include directives.
1110
+ *
1111
+ * #include brings all symbols from the included header into scope
1112
+ * (namespace import), so each mapping uses isNamespace: true and
1113
+ * exportedName: '*'. The localName is set to the header's basename
1114
+ * without extension so that symbol references like `MyClass` can
1115
+ * match against any include that might provide it.
1116
+ */
1117
+ function extractCppImports(content) {
1118
+ const mappings = [];
1119
+ // Match both #include <...> and #include "..."
1120
+ const includeRegex = /^\s*#\s*include\s+[<"]([^>"]+)[>"]/gm;
1121
+ let match;
1122
+ while ((match = includeRegex.exec(content)) !== null) {
1123
+ const modulePath = match[1];
1124
+ // Basename without extension for localName matching
1125
+ const basename = modulePath.split('/').pop().replace(/\.(h|hpp|hxx|hh|inl|ipp|cxx|cc|cpp)$/, '');
1126
+ mappings.push({
1127
+ localName: basename || modulePath,
1128
+ exportedName: '*',
1129
+ source: modulePath,
1130
+ isDefault: false,
1131
+ isNamespace: true,
1132
+ });
1133
+ }
1134
+ return mappings;
1135
+ }
1136
+ // Cache import mappings per file to avoid re-reading and re-parsing
1137
+ const importMappingCache = new Map();
1138
+ /**
1139
+ * Clear the import mapping cache (call between indexing runs)
1140
+ */
1141
+ function clearImportMappingCache() {
1142
+ importMappingCache.clear();
1143
+ cppIncludeDirCache.clear();
1144
+ }
1145
+ /**
1146
+ * Strip JS line + block comments from `content` while preserving
1147
+ * string literals (so `"//"` inside a string stays intact). Used by
1148
+ * {@link extractReExports} so commented-out export-from statements
1149
+ * don't generate phantom re-export edges.
1150
+ *
1151
+ * Scanner is deliberately small: it only tracks the three contexts
1152
+ * relevant for JS/TS — single-quote string, double-quote string, and
1153
+ * template literal. Comment recognition is the JS spec subset, no
1154
+ * regex-literal awareness (which is fine for our use case: we don't
1155
+ * apply this to function bodies, only to top-level files).
1156
+ */
1157
+ function stripJsComments(content) {
1158
+ let out = '';
1159
+ let i = 0;
1160
+ let str = null;
1161
+ while (i < content.length) {
1162
+ const ch = content[i];
1163
+ if (str !== null) {
1164
+ out += ch;
1165
+ if (ch === '\\' && i + 1 < content.length) {
1166
+ out += content[i + 1];
1167
+ i += 2;
1168
+ continue;
1169
+ }
1170
+ if (ch === str)
1171
+ str = null;
1172
+ i++;
1173
+ continue;
1174
+ }
1175
+ if (ch === '"' || ch === "'" || ch === '`') {
1176
+ str = ch;
1177
+ out += ch;
1178
+ i++;
1179
+ continue;
1180
+ }
1181
+ if (ch === '/' && content[i + 1] === '/') {
1182
+ while (i < content.length && content[i] !== '\n')
1183
+ i++;
1184
+ continue;
1185
+ }
1186
+ if (ch === '/' && content[i + 1] === '*') {
1187
+ i += 2;
1188
+ while (i < content.length && !(content[i] === '*' && content[i + 1] === '/'))
1189
+ i++;
1190
+ i += 2;
1191
+ continue;
1192
+ }
1193
+ out += ch;
1194
+ i++;
1195
+ }
1196
+ return out;
1197
+ }
1198
+ /**
1199
+ * Extract JS/TS re-export declarations from `content`.
1200
+ *
1201
+ * Recognised forms:
1202
+ * export { foo } from './a';
1203
+ * export { foo as bar } from './a';
1204
+ * export * from './a';
1205
+ * export * as ns from './a'; (treated as wildcard for chasing)
1206
+ * export { default as Foo } from './a';
1207
+ *
1208
+ * The walker intentionally stays regex-based — the import-resolver
1209
+ * elsewhere in this file already chooses regex over a fresh
1210
+ * tree-sitter pass, and this function shares that trade-off. Errors
1211
+ * fall through silently; resolution simply skips the broken file.
1212
+ */
1213
+ function extractReExports(content, language) {
1214
+ if (language !== 'typescript' &&
1215
+ language !== 'javascript' &&
1216
+ language !== 'tsx' &&
1217
+ language !== 'jsx' &&
1218
+ language !== 'arkts') {
1219
+ return [];
1220
+ }
1221
+ const out = [];
1222
+ // Pre-strip block comments + line comments so a commented-out
1223
+ // `// export { x } from '...'` doesn't produce a phantom edge.
1224
+ // (Template literals are still a possible source of false positives;
1225
+ // a project that builds export statements as runtime strings is
1226
+ // out of scope.)
1227
+ const cleaned = stripJsComments(content);
1228
+ // Wildcard: `export * from '...'` or `export * as ns from '...'`
1229
+ const wildcardRe = /export\s*\*(?:\s+as\s+\w+)?\s*from\s*['"]([^'"]+)['"]/g;
1230
+ let m;
1231
+ while ((m = wildcardRe.exec(cleaned)) !== null) {
1232
+ out.push({ kind: 'wildcard', source: m[1] });
1233
+ }
1234
+ // Named: `export { a, b as c } from '...'`
1235
+ const namedRe = /export\s*\{([^}]+)\}\s*from\s*['"]([^'"]+)['"]/g;
1236
+ while ((m = namedRe.exec(cleaned)) !== null) {
1237
+ const inner = m[1];
1238
+ const source = m[2];
1239
+ for (const raw of inner.split(',')) {
1240
+ const item = raw.trim();
1241
+ if (!item)
1242
+ continue;
1243
+ const aliasMatch = item.match(/^(\w+)\s+as\s+(\w+)$/);
1244
+ if (aliasMatch) {
1245
+ out.push({
1246
+ kind: 'named',
1247
+ exportedName: aliasMatch[2],
1248
+ originalName: aliasMatch[1],
1249
+ source,
1250
+ });
1251
+ }
1252
+ else if (/^\w+$/.test(item)) {
1253
+ out.push({
1254
+ kind: 'named',
1255
+ exportedName: item,
1256
+ originalName: item,
1257
+ source,
1258
+ });
1259
+ }
1260
+ }
1261
+ }
1262
+ return out;
1263
+ }
1264
+ /**
1265
+ * Resolve a reference using import mappings
1266
+ */
1267
+ /**
1268
+ * JVM (Java / Kotlin) imports use fully-qualified names (`import
1269
+ * com.example.foo.Bar`) decoupled from filenames, so the JS/Python
1270
+ * style filesystem path lookup misses them whenever the file isn't
1271
+ * named after its primary symbol (Kotlin `Utils.kt` exporting `Bar`,
1272
+ * top-level fns, extension fns). Resolve them through the
1273
+ * `qualifiedName` index instead — populated by the package_header /
1274
+ * package_declaration namespace wrappers in the extractor.
1275
+ */
1276
+ function resolveJvmImport(ref, context) {
1277
+ if (ref.referenceKind !== 'imports')
1278
+ return null;
1279
+ if (ref.language !== 'java' && ref.language !== 'kotlin')
1280
+ return null;
1281
+ const fqn = ref.referenceName;
1282
+ const lastDot = fqn.lastIndexOf('.');
1283
+ if (lastDot <= 0)
1284
+ return null;
1285
+ const pkg = fqn.substring(0, lastDot);
1286
+ const sym = fqn.substring(lastDot + 1);
1287
+ // Wildcard imports (`com.example.*`) deliberately punt to name-matcher.
1288
+ if (sym === '*')
1289
+ return null;
1290
+ const candidates = context.getNodesByQualifiedName(`${pkg}::${sym}`);
1291
+ if (candidates.length === 0)
1292
+ return null;
1293
+ // Kotlin Multiplatform: an `expect` declaration and its `actual`s share one
1294
+ // FQN across source sets (commonMain / androidMain / appleMain). Taking the
1295
+ // first candidate let a single platform `actual` absorb every common-side
1296
+ // import, so the `expect` (the canonical API a commonMain file imports)
1297
+ // looked unused. Prefer the candidate CLOSEST to the importing file by
1298
+ // directory proximity — a commonMain import resolves to the commonMain
1299
+ // declaration — with the `expect` side as a tiebreak.
1300
+ const best = candidates.length === 1 ? candidates[0] : pickClosestJvmCandidate(candidates, ref.filePath);
1301
+ return {
1302
+ original: ref,
1303
+ targetNodeId: best.id,
1304
+ confidence: 0.95,
1305
+ resolvedBy: 'import',
1306
+ };
1307
+ }
1308
+ /**
1309
+ * Pick the same-FQN candidate closest to `fromPath` by shared directory
1310
+ * prefix, preferring an `expect` declaration on a tie. Used to keep a Kotlin
1311
+ * Multiplatform `expect`/`actual` import resolving within the importer's own
1312
+ * source set instead of an arbitrary platform `actual`.
1313
+ */
1314
+ function pickClosestJvmCandidate(candidates, fromPath) {
1315
+ const fromDirs = fromPath.split('/').slice(0, -1);
1316
+ const sharedPrefix = (p) => {
1317
+ const d = p.split('/').slice(0, -1);
1318
+ let shared = 0;
1319
+ for (let i = 0; i < Math.min(fromDirs.length, d.length); i++) {
1320
+ if (fromDirs[i] === d[i])
1321
+ shared++;
1322
+ else
1323
+ break;
1324
+ }
1325
+ return shared;
1326
+ };
1327
+ const isExpect = (n) => Array.isArray(n.decorators) && n.decorators.includes('expect');
1328
+ let best = candidates[0];
1329
+ let bestProx = sharedPrefix(best.filePath);
1330
+ for (let i = 1; i < candidates.length; i++) {
1331
+ const c = candidates[i];
1332
+ const prox = sharedPrefix(c.filePath);
1333
+ if (prox > bestProx || (prox === bestProx && isExpect(c) && !isExpect(best))) {
1334
+ best = c;
1335
+ bestProx = prox;
1336
+ }
1337
+ }
1338
+ return best;
1339
+ }
1340
+ /**
1341
+ * PHP scoped calls are encoded as "Alias.method" by both extractors. A use
1342
+ * mapping names a namespace, not a filesystem path, so resolve the receiver
1343
+ * through its localName and look up the method on that exact imported type.
1344
+ * undefined means this is not an imported static call; null means the import
1345
+ * owns the call but its method is unavailable, so name fallbacks must not guess.
1346
+ */
1347
+ function resolvePhpImportedStaticCall(ref, context) {
1348
+ if (ref.language !== 'php' || ref.referenceKind !== 'calls')
1349
+ return undefined;
1350
+ const call = /^(\w+)\.(\w+)$/.exec(ref.referenceName);
1351
+ if (!call)
1352
+ return undefined;
1353
+ const [, receiver, member] = call;
1354
+ const imp = context.getImportMappings(ref.filePath, ref.language)
1355
+ .find((i) => i.localName === receiver);
1356
+ if (!imp)
1357
+ return undefined;
1358
+ // PHP variables occupy a different namespace from class imports. Extraction
1359
+ // strips the leading "$" from "$Alias->method()" too; leave that receiver to
1360
+ // local type inference even when a class import has the same local name.
1361
+ const lines = context.getFileLines?.(ref.filePath) ?? context.readFile(ref.filePath)?.split('\n');
1362
+ const line = lines?.[ref.line - 1];
1363
+ if (line?.slice(ref.column).startsWith('$'))
1364
+ return undefined;
1365
+ const fqn = imp.source.replace(/^\\/, '');
1366
+ const separator = fqn.lastIndexOf('\\');
1367
+ const typeName = separator < 0
1368
+ ? fqn
1369
+ : `${fqn.slice(0, separator)}::${fqn.slice(separator + 1)}`;
1370
+ const owners = context.getNodesByQualifiedName(typeName)
1371
+ .filter((n) => n.language === 'php' && STATIC_MEMBER_CONTAINERS.has(n.kind));
1372
+ if (owners.length !== 1)
1373
+ return null;
1374
+ const owner = owners[0];
1375
+ const methods = context.getNodesByQualifiedName(`${owner.qualifiedName}::${member}`)
1376
+ .filter((n) => n.language === 'php' && n.kind === 'method' && n.filePath === owner.filePath);
1377
+ if (methods.length !== 1)
1378
+ return null;
1379
+ return { original: ref, targetNodeId: methods[0].id, confidence: 0.95, resolvedBy: 'import' };
1380
+ }
1381
+ function resolveViaImport(ref, context) {
1382
+ // C/C++ #include references — resolve directly to the included file
1383
+ // (file→file edge), bypassing symbol lookup. The extractor emits these
1384
+ // with `referenceKind: 'imports'` and `referenceName: <include path>`
1385
+ // (e.g. "uint256.h" or "common/args.h"). Without this branch the
1386
+ // include-dir scan path inside resolveImportPath never produces an
1387
+ // edge — resolveViaImport's symbol lookup below would search the
1388
+ // resolved file for a symbol named like the file extension and fail.
1389
+ if ((ref.language === 'c' || ref.language === 'cpp') && ref.referenceKind === 'imports') {
1390
+ // C/C++ quoted includes (`#include "X.h"`) resolve relative to the
1391
+ // INCLUDING file's own directory first (the C standard's quoted-include
1392
+ // search order). Prefer a same-directory header over an -I directory or a
1393
+ // same-named header on another platform (windows/code/RNCAsyncStorage.h vs
1394
+ // apple/.../RNCAsyncStorage.h) — the include-dir heuristic below would
1395
+ // otherwise pick an arbitrary same-named header, leaving the real local one
1396
+ // with no dependents.
1397
+ const slash = ref.filePath.lastIndexOf('/');
1398
+ const fromDir = slash >= 0 ? ref.filePath.slice(0, slash) : '';
1399
+ const siblingPath = path.posix.normalize(fromDir ? `${fromDir}/${ref.referenceName}` : ref.referenceName);
1400
+ const siblingBase = siblingPath.split('/').pop();
1401
+ const sibling = context
1402
+ .getNodesByName(siblingBase)
1403
+ .find((n) => n.kind === 'file' && n.filePath === siblingPath);
1404
+ if (sibling) {
1405
+ return { original: ref, targetNodeId: sibling.id, confidence: 0.92, resolvedBy: 'import' };
1406
+ }
1407
+ const resolvedPath = resolveImportPath(ref.referenceName, ref.filePath, ref.language, context);
1408
+ if (!resolvedPath)
1409
+ return null;
1410
+ const basename = resolvedPath.split('/').pop();
1411
+ const fileNodes = context.getNodesByName(basename).filter((n) => n.kind === 'file');
1412
+ const fileNode = fileNodes.find((n) => n.filePath === resolvedPath);
1413
+ if (fileNode) {
1414
+ return {
1415
+ original: ref,
1416
+ targetNodeId: fileNode.id,
1417
+ confidence: 0.9,
1418
+ resolvedBy: 'import',
1419
+ };
1420
+ }
1421
+ return null;
1422
+ }
1423
+ // COBOL COPY / EXEC SQL INCLUDE — resolve the copybook member to a
1424
+ // file→file edge, mirroring the C/C++ include branch above. A member that
1425
+ // matches no indexed file (compiler-supplied copybooks like SQLCA/DFHAID)
1426
+ // stays unresolved — callers must not fall back to the symbol name-matcher,
1427
+ // which would connect it to a same-named import symbol elsewhere.
1428
+ if (isCobolCopybookRef(ref)) {
1429
+ const resolvedPath = resolveImportPath(ref.referenceName, ref.filePath, ref.language, context);
1430
+ if (!resolvedPath)
1431
+ return null;
1432
+ const basename = resolvedPath.split('/').pop();
1433
+ const fileNode = context
1434
+ .getNodesByName(basename)
1435
+ .find((n) => n.kind === 'file' && n.filePath === resolvedPath);
1436
+ if (fileNode) {
1437
+ return {
1438
+ original: ref,
1439
+ targetNodeId: fileNode.id,
1440
+ confidence: 0.9,
1441
+ resolvedBy: 'import',
1442
+ };
1443
+ }
1444
+ return null;
1445
+ }
1446
+ // PHP include/require — resolve the static string path to a file→file
1447
+ // edge, mirroring the C/C++ branch above. Distinguish include PATHS from
1448
+ // namespace `use` symbols by shape: an include path contains a slash or a
1449
+ // file extension ("lib.php", "inc/db.php", "../x.php"), whereas a namespace
1450
+ // use is an FQN (App\Foo\Bar) or a bare class symbol (Closure) — PHP
1451
+ // identifiers contain neither '/' nor '.'. Only path-shaped references are
1452
+ // includes; symbol references fall through to the namespace resolution.
1453
+ if (isPhpIncludePathRef(ref)) {
1454
+ const resolvedPath = resolvePhpIncludePath(ref.referenceName, ref.filePath, context);
1455
+ if (resolvedPath) {
1456
+ const basename = resolvedPath.split('/').pop();
1457
+ const fileNode = context
1458
+ .getNodesByName(basename)
1459
+ .find((n) => n.kind === 'file' && n.filePath === resolvedPath);
1460
+ if (fileNode) {
1461
+ return {
1462
+ original: ref,
1463
+ targetNodeId: fileNode.id,
1464
+ confidence: 0.9,
1465
+ resolvedBy: 'import',
1466
+ };
1467
+ }
1468
+ }
1469
+ // A path-shaped include that doesn't resolve to a known project file is a
1470
+ // dead end. Return unresolved rather than falling through to the symbol
1471
+ // name-matcher, which would mis-connect e.g. "inc/db.php" to an unrelated
1472
+ // db.php elsewhere in the tree — a wrong edge is worse than a missing one.
1473
+ return null;
1474
+ }
1475
+ // Nix static project-path imports (`import ./x.nix`, `builtins.import ./dir`,
1476
+ // `import ./x.nix {}`) resolve to file nodes only. Do not resolve
1477
+ // angle-bracket channels, attribute expressions, variables, or other dynamic
1478
+ // expressions as project files.
1479
+ if (isNixPathImportRef(ref)) {
1480
+ const resolvedPath = resolveImportPath(ref.referenceName, ref.filePath, ref.language, context);
1481
+ if (!resolvedPath)
1482
+ return null;
1483
+ const basename = resolvedPath.split('/').pop();
1484
+ const fileNode = context
1485
+ .getNodesByName(basename)
1486
+ .find((n) => n.kind === 'file' && n.filePath === resolvedPath);
1487
+ if (fileNode) {
1488
+ return {
1489
+ original: ref,
1490
+ targetNodeId: fileNode.id,
1491
+ confidence: 0.9,
1492
+ resolvedBy: 'import',
1493
+ };
1494
+ }
1495
+ return null;
1496
+ }
1497
+ // Use cached import mappings (avoids re-reading and re-parsing per ref)
1498
+ const imports = context.getImportMappings(ref.filePath, ref.language);
1499
+ if (imports.length === 0 && !context.readFile(ref.filePath)) {
1500
+ return null;
1501
+ }
1502
+ // Go cross-package calls: `pkga.FuncX(...)` extracts to referenceName
1503
+ // `pkga.FuncX` and the import `github.com/example/myproject/pkga`
1504
+ // maps to a *package directory* containing one or more .go files.
1505
+ // The generic file-based lookup below can't follow that — issue #388.
1506
+ if (ref.language === 'go') {
1507
+ const goResult = resolveGoCrossPackageReference(ref, imports, context);
1508
+ if (goResult)
1509
+ return goResult;
1510
+ }
1511
+ // Java / Kotlin: imports are FQNs (`import com.example.Foo;`) — no
1512
+ // resolvable file path the JS/TS-style chain below could follow. Look
1513
+ // up the symbol by name and filter to the candidate whose file path
1514
+ // matches the imported FQN. This is the disambiguation signal that
1515
+ // breaks the same-name class collision the path-proximity matcher
1516
+ // can't resolve (issue #314).
1517
+ if (ref.language === 'java' || ref.language === 'kotlin') {
1518
+ const javaResult = resolveJavaImportedReference(ref, imports, context);
1519
+ if (javaResult)
1520
+ return javaResult;
1521
+ }
1522
+ // Python qualified access through an imported MODULE: `certs.where()` after
1523
+ // `from . import certs`, `mod.func()` after `import mod`. The receiver names a
1524
+ // submodule (a file), not a symbol, so the generic symbol lookup below would
1525
+ // search the *package* for `certs` instead of looking inside the module.
1526
+ if (ref.language === 'python') {
1527
+ const pyResult = resolvePythonModuleMember(ref, imports, context);
1528
+ if (pyResult)
1529
+ return pyResult;
1530
+ // Absolute dotted module import: `import conduit.apps.articles.signals`
1531
+ // (the standard Django AppConfig.ready() signal-registration pattern, and
1532
+ // any side-effect `import pkg.mod`). Map the dotted path to its file.
1533
+ const pyModResult = resolvePythonAbsoluteModule(ref, context);
1534
+ if (pyModResult)
1535
+ return pyModResult;
1536
+ }
1537
+ // Rust qualified path: resolve the module prefix of `crate::m::Item` /
1538
+ // `self::sub::Item` / `super::m::func` to a file, then find the leaf symbol in
1539
+ // it. Disambiguates common-name `pub use self::read::read` re-exports that
1540
+ // name-matching would land on the wrong same-named symbol.
1541
+ if (ref.language === 'rust' && ref.referenceName.includes('::')) {
1542
+ const rustResult = resolveRustPathReference(ref, context);
1543
+ if (rustResult)
1544
+ return rustResult;
1545
+ }
1546
+ // Lua / Luau `require(...)`: a dotted module path (`a.b.c` from
1547
+ // `require("a.b.c")`) or an instance-path leaf (`Signal` from
1548
+ // `require(script.Parent.Signal)`) — map it to a module file. There's no static
1549
+ // import statement, so the generic path-matcher can't bridge the dot↔slash /
1550
+ // leaf↔basename gap; resolve it explicitly to the module file.
1551
+ if ((ref.language === 'lua' || ref.language === 'luau') && ref.referenceKind === 'imports') {
1552
+ const luaResult = resolveLuaRequire(ref, context);
1553
+ if (luaResult)
1554
+ return luaResult;
1555
+ }
1556
+ // Whole-module / namespace imports → link the importing file to the module
1557
+ // file. Python `from . import certs` / `import mod`, and TS/JS `import * as ns
1558
+ // from './x'` (so a namespace touched only via a value-member read still
1559
+ // records the dependency). A named TS/JS import returns null here and falls
1560
+ // through to symbol resolution below.
1561
+ if (ref.language === 'python' ||
1562
+ ref.language === 'typescript' ||
1563
+ ref.language === 'tsx' ||
1564
+ ref.language === 'javascript' ||
1565
+ ref.language === 'jsx' ||
1566
+ ref.language === 'arkts') {
1567
+ const moduleFile = resolveModuleImportToFile(ref, imports, context);
1568
+ if (moduleFile)
1569
+ return moduleFile;
1570
+ }
1571
+ // Check if the reference name matches any import
1572
+ for (const imp of imports) {
1573
+ if (imp.localName === ref.referenceName || ref.referenceName.startsWith(imp.localName + '.')) {
1574
+ // Resolve the import path
1575
+ const resolvedPath = resolveImportPath(imp.source, ref.filePath, ref.language, context);
1576
+ if (resolvedPath) {
1577
+ const exportedName = imp.isDefault ? 'default' : imp.exportedName;
1578
+ const memberName = imp.isNamespace
1579
+ ? ref.referenceName.replace(imp.localName + '.', '')
1580
+ : null;
1581
+ const targetNode = findExportedSymbol(resolvedPath, { isDefault: imp.isDefault, isNamespace: imp.isNamespace, exportedName, memberName }, ref.language, context, new Set());
1582
+ if (targetNode) {
1583
+ // `Foo.bar()` / `Foo.CONST` — a NAMED (non-namespace) class import
1584
+ // accessed through a member. `findExportedSymbol` resolved `Foo` to
1585
+ // the class itself; descend into it so the reference links to the
1586
+ // member `bar`, not the class. Without this the edge points at the
1587
+ // class and `createEdges` then mis-promotes the call to an
1588
+ // `instantiates` edge, so the static method shows zero callers and a
1589
+ // hollow impact radius. (#825)
1590
+ if (!imp.isNamespace && ref.referenceName.startsWith(imp.localName + '.')) {
1591
+ const memberNode = resolveStaticMember(targetNode, ref, imp.localName, context);
1592
+ if (memberNode) {
1593
+ return {
1594
+ original: ref,
1595
+ targetNodeId: memberNode.id,
1596
+ confidence: 0.9,
1597
+ resolvedBy: 'import',
1598
+ };
1599
+ }
1600
+ // An imported object literal used as a namespace (#1573):
1601
+ // `api.call()` after `import { api } from './api'` where `api` is
1602
+ // `export const api = { call() {…} }`. Its members have bare
1603
+ // qualified names inside the constant's extent, so the
1604
+ // `Container::member` lookup above can't see them and the edge
1605
+ // landed on the constant — every cross-file caller of the method
1606
+ // went missing. Resolve the member by containment instead.
1607
+ if (targetNode.kind === 'constant' || targetNode.kind === 'variable') {
1608
+ const member = ref.referenceName.slice(imp.localName.length + 1).split('.')[0];
1609
+ if (member) {
1610
+ const literalMember = (0, name_matcher_1.resolveObjectLiteralMember)(targetNode, member, ref, context, 0.9, 'import');
1611
+ if (literalMember)
1612
+ return literalMember;
1613
+ const aliasMember = resolveObjectLiteralAlias(targetNode, member, ref, context);
1614
+ if (aliasMember)
1615
+ return aliasMember;
1616
+ }
1617
+ }
1618
+ // An imported VALUE (singleton constant / shared instance) called
1619
+ // through a member: `reproStore.notifyJoinGuildStatus()` after
1620
+ // `import { reproStore } from './store'`. findExportedSymbol
1621
+ // resolved the CONSTANT itself; linking the CALL there hides the
1622
+ // real callee — callers of the method miss every cross-file use
1623
+ // and the method can look unused (#1292). Infer the value's type
1624
+ // from its own declaration in the exporting file and resolve the
1625
+ // member on that type. resolveMethodOnType VALIDATES the type
1626
+ // declares the method, so a mis-inference falls through to the
1627
+ // constant edge below rather than fabricating a wrong one.
1628
+ const instanceMember = resolveImportedInstanceMember(targetNode, ref, imp.localName, context);
1629
+ if (instanceMember)
1630
+ return instanceMember;
1631
+ }
1632
+ return {
1633
+ original: ref,
1634
+ targetNodeId: targetNode.id,
1635
+ confidence: 0.9,
1636
+ resolvedBy: 'import',
1637
+ };
1638
+ }
1639
+ }
1640
+ }
1641
+ }
1642
+ return null;
1643
+ }
1644
+ /**
1645
+ * Resolve a Python qualified reference whose receiver is an imported MODULE:
1646
+ * `certs.where()` after `from . import certs`, `mod.func()` after `import mod`
1647
+ * or `from pkg import mod`. The receiver names a submodule (a file), not a
1648
+ * symbol, so the generic symbol lookup in `resolveViaImport` can't follow it —
1649
+ * it would search the *package* for `certs`/`mod` instead of looking inside the
1650
+ * module. This is the Python half of the cross-package qualified-call problem
1651
+ * (cf. `resolveGoCrossPackageReference` for Go's `pkg.Func`, issue #388).
1652
+ *
1653
+ * Builds the module's dotted import path from the binding — `from . import
1654
+ * certs` → `.certs`; `from pkg import mod` → `pkg.mod`; `import mod` → `mod` —
1655
+ * resolves it to the module file, and finds the member defined there. Returns
1656
+ * null when no module file exists at that path, so attribute access on an
1657
+ * imported *value* (`helper.attr` where `helper` is a function) falls through
1658
+ * to the other strategies untouched.
1659
+ */
1660
+ function resolvePythonModuleMember(ref, imports, context) {
1661
+ const dotIdx = ref.referenceName.indexOf('.');
1662
+ if (dotIdx <= 0)
1663
+ return null;
1664
+ const receiver = ref.referenceName.substring(0, dotIdx);
1665
+ // The immediate member of the module (first segment after the receiver).
1666
+ const member = ref.referenceName.substring(dotIdx + 1).split('.')[0];
1667
+ if (!member)
1668
+ return null;
1669
+ for (const imp of imports) {
1670
+ if (imp.localName !== receiver)
1671
+ continue;
1672
+ // `import mod` / `import numpy as np` bind the module at `source` itself;
1673
+ // `from . import certs` / `from pkg import mod` bind a SUBMODULE whose
1674
+ // dotted path is the source joined with the imported name.
1675
+ //
1676
+ // Join with the EXPORTED name, not the local one: under
1677
+ // `from pkg import mod as alias` the receiver is `alias` but the module on
1678
+ // disk is `pkg.mod`, and building `pkg.alias` looked for a file that does
1679
+ // not exist — so the aliased form dropped its `calls` edge while the plain
1680
+ // form (where the two names coincide) worked (#1626). For an unaliased
1681
+ // import the two are identical, so this changes nothing there.
1682
+ const moduleName = imp.exportedName === '*' ? imp.localName : imp.exportedName;
1683
+ const modulePath = imp.isNamespace
1684
+ ? imp.source
1685
+ : imp.source.endsWith('.')
1686
+ ? imp.source + moduleName
1687
+ : imp.source + '.' + moduleName;
1688
+ // resolveImportPath only maps RELATIVE dotted paths (`.mod`, `..pkg.mod`); an
1689
+ // ABSOLUTE package path (`pkg.module` from `from pkg import module`, or a bare
1690
+ // `import pkg.mod`) resolves to null there, so fall back to the dotted-module
1691
+ // file lookup — the same asymmetry resolveModuleImportToFile already handles
1692
+ // for the file→file import edge. Without this, a `module.func()` call after
1693
+ // `from pkg import module` dropped its `calls` edge even though the import
1694
+ // edge resolved (#578).
1695
+ let resolvedPath = resolveImportPath(modulePath, ref.filePath, ref.language, context);
1696
+ if (!resolvedPath) {
1697
+ resolvedPath = findPythonModuleFile(modulePath, context, ref.filePath)?.filePath ?? null;
1698
+ }
1699
+ if (!resolvedPath || resolvedPath === ref.filePath)
1700
+ continue;
1701
+ // Find the member as a top-level definition in the module file. Exclude
1702
+ // `method` so `mod.foo` never lands on a same-named class method.
1703
+ const target = context.getNodesInFile(resolvedPath).find((n) => n.name === member &&
1704
+ (n.kind === 'function' ||
1705
+ n.kind === 'class' ||
1706
+ n.kind === 'variable' ||
1707
+ n.kind === 'constant'));
1708
+ if (target) {
1709
+ return { original: ref, targetNodeId: target.id, confidence: 0.85, resolvedBy: 'import' };
1710
+ }
1711
+ }
1712
+ return null;
1713
+ }
1714
+ /**
1715
+ * Resolve a whole-MODULE import to that module's file (a file→file dependency).
1716
+ * The imported name is a module, not a symbol, so there's nothing to resolve to
1717
+ * — but importing a module IS a dependency on it. Covers:
1718
+ * - Python submodule imports — `from . import certs`, `from pkg import sub`;
1719
+ * - namespace imports — Python `import mod` / `import numpy as np`, and
1720
+ * TS/JS `import * as ns from './x'`.
1721
+ *
1722
+ * It is also the robust backstop for {@link resolvePythonModuleMember} and for
1723
+ * TS namespace usage: it records the dependency even when the used member is
1724
+ * re-exported elsewhere (requests' `certs.where`, re-exported from `certifi`),
1725
+ * the usage is module-level code that isn't extracted as a call, or a TS
1726
+ * namespace is touched only via a value-member read (`ns.SOME_CONST`).
1727
+ *
1728
+ * Only fires for dot-free `imports`-kind refs whose module path resolves to a
1729
+ * real file. A NAMED TS/JS import (`import { widget }`) is not a module, so it
1730
+ * returns null and normal symbol resolution handles it.
1731
+ */
1732
+ /**
1733
+ * Resolve a Lua/Luau `require(...)` to its module file. The reference name is
1734
+ * either a dotted module path (`telescope.config` → `telescope/config.lua`) or a
1735
+ * Roblox instance-path leaf (`Signal` from `require(script.Parent.Signal)` →
1736
+ * `Signal.luau`). We try `<path>.lua|.luau` and `<path>/init.lua|.luau`, matched
1737
+ * by path suffix (the module root — `lua/`, `src/`, … — is project-specific).
1738
+ * Among suffix matches, the one sharing the longest directory prefix with the
1739
+ * requiring file wins (instance-path requires resolve within the same package).
1740
+ */
1741
+ function resolveLuaRequire(ref, context) {
1742
+ const name = ref.referenceName;
1743
+ if (!name)
1744
+ return null;
1745
+ const base = name.includes('.') ? name.replace(/\./g, '/') : name;
1746
+ const suffixes = [`${base}.lua`, `${base}.luau`, `${base}/init.lua`, `${base}/init.luau`];
1747
+ const byBasename = luaBasenameIndex(context);
1748
+ const shared = (a, b) => {
1749
+ let i = 0;
1750
+ while (i < a.length && i < b.length && a[i] === b[i])
1751
+ i++;
1752
+ return i;
1753
+ };
1754
+ for (const suffix of suffixes) {
1755
+ // Only files sharing the suffix's basename can match — the bucket is in
1756
+ // getAllFiles() order, so this filter yields exactly what the full-list
1757
+ // scan did.
1758
+ const candidates = byBasename.get(suffix.split('/').pop() ?? '') ?? [];
1759
+ const matches = candidates.filter((f) => f === suffix || f.endsWith('/' + suffix));
1760
+ if (matches.length === 0)
1761
+ continue;
1762
+ matches.sort((x, y) => shared(y, ref.filePath) - shared(x, ref.filePath));
1763
+ const best = matches[0];
1764
+ if (best === ref.filePath)
1765
+ continue;
1766
+ const fileNode = context.getNodesInFile(best).find((n) => n.kind === 'file');
1767
+ if (fileNode) {
1768
+ // Confidence ≥ 0.9 so this deterministic path/suffix match wins over
1769
+ // name-matching, which otherwise resolves the require to the import node
1770
+ // itself (a same-name self-match).
1771
+ return { original: ref, targetNodeId: fileNode.id, confidence: 0.9, resolvedBy: 'import' };
1772
+ }
1773
+ }
1774
+ return null;
1775
+ }
1776
+ /**
1777
+ * `UploadApi.uploadARCapture()` where `UploadApi` is a NAMESPACE OBJECT — the
1778
+ * default-export façade most React Native API layers are written as:
1779
+ *
1780
+ * import { uploadARCapture } from './frames'
1781
+ * const UploadApi = { uploadARCapture, createFolder }
1782
+ * export default UploadApi
1783
+ *
1784
+ * The member is a shorthand (or `key: ident`) property whose value is a
1785
+ * binding of the object's file, not a function defined inside the literal,
1786
+ * so containment (`resolveObjectLiteralMember`) finds nothing and the call
1787
+ * landed on the constant — every cross-file caller of the API function went
1788
+ * missing. Read the literal's source, take the binding the member names, and
1789
+ * resolve it where the object's file would: a symbol declared there, else
1790
+ * through its own imports. Calls accept callable targets only.
1791
+ */
1792
+ function resolveObjectLiteralAlias(container, member, ref, context) {
1793
+ if (container.kind !== 'constant' && container.kind !== 'variable')
1794
+ return null;
1795
+ if (!JS_FAMILY_FILE.test(container.filePath))
1796
+ return null;
1797
+ if (!/^[A-Za-z_$][\w$]*$/.test(member))
1798
+ return null;
1799
+ const lines = context.getFileLines?.(container.filePath) ?? context.readFile(container.filePath)?.split('\n');
1800
+ if (!lines)
1801
+ return null;
1802
+ const extent = lines.slice(container.startLine - 1, container.endLine).join('\n');
1803
+ const brace = extent.indexOf('{');
1804
+ if (brace < 0)
1805
+ return null;
1806
+ const body = extent.slice(brace);
1807
+ const keyed = new RegExp(`[{,\\s]${member}\\s*:\\s*([A-Za-z_$][\\w$]*)\\s*[,}]`);
1808
+ const shorthand = new RegExp(`[{,\\s]${member}\\s*[,}]`);
1809
+ const k = body.match(keyed);
1810
+ const binding = k ? k[1] : shorthand.test(body) ? member : null;
1811
+ if (binding === null)
1812
+ return null;
1813
+ const callable = (n) => n.kind === 'function' || n.kind === 'method' || n.kind === 'class';
1814
+ const accepts = ref.referenceKind === 'calls'
1815
+ ? callable
1816
+ : (n) => callable(n) || n.kind === 'constant' || n.kind === 'variable' || n.kind === 'component';
1817
+ // Declared in the object's own file, outside the literal.
1818
+ const local = context
1819
+ .getNodesInFile(container.filePath)
1820
+ .filter((n) => n.name === binding && n.id !== container.id && accepts(n))
1821
+ .sort((a, b) => a.startLine - b.startLine || a.startColumn - b.startColumn)[0];
1822
+ if (local)
1823
+ return { original: ref, targetNodeId: local.id, confidence: 0.9, resolvedBy: 'import' };
1824
+ // Imported into the object's file.
1825
+ for (const imp of context.getImportMappings(container.filePath, container.language)) {
1826
+ if (imp.localName !== binding || imp.isNamespace)
1827
+ continue;
1828
+ const resolvedPath = resolveImportPath(imp.source, container.filePath, container.language, context);
1829
+ if (!resolvedPath)
1830
+ continue;
1831
+ const target = findExportedSymbol(resolvedPath, {
1832
+ isDefault: imp.isDefault,
1833
+ isNamespace: false,
1834
+ exportedName: imp.isDefault ? 'default' : imp.exportedName,
1835
+ memberName: null,
1836
+ }, container.language, context, new Set());
1837
+ if (target && accepts(target)) {
1838
+ return { original: ref, targetNodeId: target.id, confidence: 0.9, resolvedBy: 'import' };
1839
+ }
1840
+ }
1841
+ return null;
1842
+ }
1843
+ function resolveModuleImportToFile(ref, imports, context) {
1844
+ if (ref.referenceKind !== 'imports')
1845
+ return null;
1846
+ if (ref.referenceName.includes('.'))
1847
+ return null;
1848
+ for (const imp of imports) {
1849
+ if (imp.localName !== ref.referenceName)
1850
+ continue;
1851
+ let modulePath;
1852
+ if (imp.isNamespace || imp.isDefault) {
1853
+ // `import * as ns from './x'` (namespace) or `import x from './x'`
1854
+ // (default) — the dependency is on the MODULE FILE. A default import binds
1855
+ // a (possibly renamed) local to whatever the module's default export is
1856
+ // (`import articlesController from './article.controller'` ← `export
1857
+ // default router`), so the binding name can't be found as a symbol — link
1858
+ // the file the import resolves to instead. External modules don't resolve
1859
+ // (no file), so `import React from 'react'` creates no edge.
1860
+ modulePath = imp.source;
1861
+ }
1862
+ else if (ref.language === 'python') {
1863
+ // `from . import certs` — the imported NAME is a submodule of the source.
1864
+ // As in resolvePythonModuleMember, use the exported name so an alias
1865
+ // still links to the real module file (#1626).
1866
+ const moduleName = imp.exportedName === '*' ? imp.localName : imp.exportedName;
1867
+ modulePath = imp.source.endsWith('.')
1868
+ ? imp.source + moduleName
1869
+ : imp.source + '.' + moduleName;
1870
+ }
1871
+ else {
1872
+ // A named TS/JS import binds a symbol, not a module — leave it alone.
1873
+ continue;
1874
+ }
1875
+ const resolvedPath = resolveImportPath(modulePath, ref.filePath, ref.language, context);
1876
+ if (resolvedPath && resolvedPath !== ref.filePath) {
1877
+ const fileNode = context.getNodesInFile(resolvedPath).find((n) => n.kind === 'file');
1878
+ if (fileNode) {
1879
+ return { original: ref, targetNodeId: fileNode.id, confidence: 0.9, resolvedBy: 'import' };
1880
+ }
1881
+ }
1882
+ // Python absolute `from a.b import submodule` (a FastAPI router aggregator's
1883
+ // `from app.api.routes import authentication`): resolveImportPath only maps
1884
+ // RELATIVE dotted paths to a file, so resolve the absolute dotted module
1885
+ // directly to its file node.
1886
+ if (ref.language === 'python') {
1887
+ const modFile = findPythonModuleFile(modulePath, context, ref.filePath);
1888
+ if (modFile) {
1889
+ return { original: ref, targetNodeId: modFile.id, confidence: 0.9, resolvedBy: 'import' };
1890
+ }
1891
+ }
1892
+ }
1893
+ return null;
1894
+ }
1895
+ /**
1896
+ * Find the file node for a Python dotted module path `a.b.c` — a module file
1897
+ * ending in `a/b/c.py`, or a package `a/b/c/__init__.py` (suffix-matched, so a
1898
+ * package rooted under `src/` etc. still resolves). Returns null for
1899
+ * stdlib/external modules (no matching repo file node), so `import os` creates
1900
+ * no edge. Shared by absolute `import a.b.c` and absolute `from a.b import c`
1901
+ * (where `c` is a submodule) resolution.
1902
+ */
1903
+ function findPythonModuleFile(mod, context, excludeFilePath) {
1904
+ if (!mod || mod.startsWith('.'))
1905
+ return null; // relative imports handled elsewhere
1906
+ const rel = mod.replace(/\./g, '/');
1907
+ const lastSeg = mod.split('.').pop();
1908
+ const endsWith = (p, want) => p === want || p.endsWith('/' + want);
1909
+ const moduleFile = context
1910
+ .getNodesByName(`${lastSeg}.py`)
1911
+ .find((n) => n.kind === 'file' && n.filePath !== excludeFilePath && endsWith(n.filePath, `${rel}.py`));
1912
+ if (moduleFile)
1913
+ return moduleFile;
1914
+ const pkgFile = context
1915
+ .getNodesByName('__init__.py')
1916
+ .find((n) => n.kind === 'file' && n.filePath !== excludeFilePath && endsWith(n.filePath, `${rel}/__init__.py`));
1917
+ return pkgFile ?? null;
1918
+ }
1919
+ /**
1920
+ * Resolve a Python ABSOLUTE dotted module import (`import a.b.c`) to its file —
1921
+ * the Django `AppConfig.ready(): import myapp.signals` pattern and any
1922
+ * side-effect module import.
1923
+ */
1924
+ function resolvePythonAbsoluteModule(ref, context) {
1925
+ if (ref.referenceKind !== 'imports')
1926
+ return null;
1927
+ // Only a DOTTED `import a.b.c` ref carries its full module path. A bare leaf
1928
+ // (`from app.api.routes import authentication`) is ambiguous on its own — three
1929
+ // `authentication.py` files may exist — so leave it to resolveModuleImportToFile,
1930
+ // which uses the import's source (`app.api.routes`) to build the full path.
1931
+ if (!ref.referenceName.includes('.'))
1932
+ return null;
1933
+ const hit = findPythonModuleFile(ref.referenceName, context, ref.filePath);
1934
+ return hit ? { original: ref, targetNodeId: hit.id, confidence: 0.9, resolvedBy: 'import' } : null;
1935
+ }
1936
+ /**
1937
+ * Resolve a Rust qualified reference `A::B::C` by mapping the MODULE prefix
1938
+ * (`A::B`) to a file and finding the leaf symbol (`C`) in it. This is the Rust
1939
+ * analog of {@link resolvePythonModuleMember} / {@link resolveGoCrossPackageReference}
1940
+ * and the precise answer to common-name re-exports (`pub use self::read::read`)
1941
+ * that name-matching can't disambiguate. Returns null when the prefix isn't a
1942
+ * real module path (e.g. `Widget::new` — `Widget` is a struct, not a module),
1943
+ * so associated-function calls and enum-variant paths fall through untouched.
1944
+ */
1945
+ function resolveRustPathReference(ref, context) {
1946
+ const segments = ref.referenceName.split('::').filter((s) => s.length > 0);
1947
+ if (segments.length < 2)
1948
+ return null;
1949
+ const leaf = segments[segments.length - 1];
1950
+ const modSegs = segments.slice(0, -1);
1951
+ const file = resolveRustModuleFile(modSegs, ref.filePath, context);
1952
+ if (!file || file === ref.filePath)
1953
+ return null;
1954
+ const target = context.getNodesInFile(file).find((n) => n.name === leaf &&
1955
+ (n.kind === 'function' ||
1956
+ n.kind === 'struct' ||
1957
+ n.kind === 'union' ||
1958
+ n.kind === 'enum' ||
1959
+ n.kind === 'trait' ||
1960
+ n.kind === 'type_alias' ||
1961
+ n.kind === 'constant' ||
1962
+ n.kind === 'method' ||
1963
+ n.kind === 'class' ||
1964
+ n.kind === 'interface'));
1965
+ if (target) {
1966
+ return { original: ref, targetNodeId: target.id, confidence: 0.9, resolvedBy: 'import' };
1967
+ }
1968
+ return null;
1969
+ }
1970
+ /** The crate-root directory (holds `lib.rs`/`main.rs`), walking up from a file. */
1971
+ function rustCrateRootDir(fromFileAbs, context) {
1972
+ const projectRoot = context.getProjectRoot();
1973
+ const toRel = (p) => path.relative(projectRoot, p).replace(/\\/g, '/');
1974
+ let dir = path.dirname(fromFileAbs);
1975
+ for (let i = 0; i < 64; i++) {
1976
+ if (context.fileExists(toRel(path.join(dir, 'lib.rs'))) ||
1977
+ context.fileExists(toRel(path.join(dir, 'main.rs')))) {
1978
+ return dir;
1979
+ }
1980
+ const parent = path.dirname(dir);
1981
+ if (parent === dir)
1982
+ return null;
1983
+ dir = parent;
1984
+ }
1985
+ return null;
1986
+ }
1987
+ /** Directory under which the current file's module declares its SUBMODULES. */
1988
+ function rustSelfModuleDir(fromFileAbs) {
1989
+ const base = path.basename(fromFileAbs);
1990
+ const dir = path.dirname(fromFileAbs);
1991
+ // mod.rs / lib.rs / main.rs own their directory; `foo.rs`'s submodules live in `foo/`.
1992
+ if (base === 'mod.rs' || base === 'lib.rs' || base === 'main.rs')
1993
+ return dir;
1994
+ return path.join(dir, base.replace(/\.rs$/, ''));
1995
+ }
1996
+ /**
1997
+ * Resolve a Rust module path (segments WITHOUT the leaf symbol) to the file of
1998
+ * the last module segment — `crate::a::b` → `<crate>/a/b.rs` (or `.../b/mod.rs`).
1999
+ * Anchors on `crate` / `self` / `super`; a bare path is tried crate-relative.
2000
+ */
2001
+ function resolveRustModuleFile(segments, fromFile, context) {
2002
+ if (segments.length === 0)
2003
+ return null;
2004
+ const projectRoot = context.getProjectRoot();
2005
+ const fromAbs = path.join(projectRoot, fromFile);
2006
+ const toRel = (p) => path.relative(projectRoot, p).replace(/\\/g, '/');
2007
+ // Walk a sequence of module segments down from `startDir`, mapping each to a
2008
+ // `<seg>.rs` or `<seg>/mod.rs` file. Returns the leaf module's file, or null
2009
+ // if `startDir` is null or any segment has no file on disk.
2010
+ const resolveUnder = (startDir, rest) => {
2011
+ if (!startDir)
2012
+ return null;
2013
+ let dir = startDir;
2014
+ let targetFile = null;
2015
+ for (const seg of rest) {
2016
+ if (seg === 'self' || seg === 'crate' || seg === 'super')
2017
+ continue;
2018
+ const asFile = toRel(path.join(dir, seg + '.rs'));
2019
+ const asMod = toRel(path.join(dir, seg, 'mod.rs'));
2020
+ if (context.fileExists(asFile))
2021
+ targetFile = asFile;
2022
+ else if (context.fileExists(asMod))
2023
+ targetFile = asMod;
2024
+ else
2025
+ return null;
2026
+ dir = path.join(dir, seg);
2027
+ }
2028
+ return targetFile;
2029
+ };
2030
+ const first = segments[0];
2031
+ if (first === 'crate') {
2032
+ return resolveUnder(rustCrateRootDir(fromAbs, context), segments.slice(1));
2033
+ }
2034
+ if (first === 'self') {
2035
+ return resolveUnder(rustSelfModuleDir(fromAbs), segments.slice(1));
2036
+ }
2037
+ if (first === 'super') {
2038
+ let supers = 0;
2039
+ while (segments[supers] === 'super')
2040
+ supers++;
2041
+ let dir = rustSelfModuleDir(fromAbs);
2042
+ for (let s = 0; s < supers && dir; s++)
2043
+ dir = path.dirname(dir);
2044
+ return resolveUnder(dir, segments.slice(supers));
2045
+ }
2046
+ // Bare path. In expression position (`submodule::item()` — the router-assembly
2047
+ // and general cross-module-call pattern) the prefix is a SUBMODULE of the
2048
+ // current module, i.e. 2018 `self::`-relative — so try self-relative FIRST.
2049
+ // Fall back to crate-relative for 2015-edition / crate-root items. External
2050
+ // crate paths (`serde::de::Error`) miss both and fall through to name-matching.
2051
+ return (resolveUnder(rustSelfModuleDir(fromAbs), segments) ??
2052
+ resolveUnder(rustCrateRootDir(fromAbs, context), segments));
2053
+ }
2054
+ /**
2055
+ * Resolve a Java/Kotlin reference whose receiver is the simple name of
2056
+ * an imported FQN: `Foo.bar(...)` where `import com.example.Foo;`. The
2057
+ * imported FQN converts to a file-path suffix (`com/example/Foo.java`
2058
+ * or `.kt`) which uniquely identifies the right symbol when multiple
2059
+ * classes share the same simple name.
2060
+ *
2061
+ * Also handles bare references to the imported class itself
2062
+ * (`new Foo()` extraction emits `Foo` as a `references`/`instantiates`
2063
+ * ref) and `import static <Foo>.bar` style imports of a single member.
2064
+ */
2065
+ function resolveJavaImportedReference(ref, imports, context) {
2066
+ if (imports.length === 0)
2067
+ return null;
2068
+ const ext = ref.language === 'kotlin' ? '.kt' : '.java';
2069
+ for (const imp of imports) {
2070
+ const matchesBare = imp.localName === ref.referenceName;
2071
+ const matchesQualified = ref.referenceName.startsWith(imp.localName + '.');
2072
+ if (!matchesBare && !matchesQualified)
2073
+ continue;
2074
+ // Convert FQN to a file-path suffix. `com.example.Foo` ->
2075
+ // `com/example/Foo.java` (or `.kt`). The actual file may live
2076
+ // under any source root (`src/main/java/`, `src/`, etc.), so match
2077
+ // by suffix rather than exact path.
2078
+ const fqnPath = imp.source.replace(/\./g, '/') + ext;
2079
+ // Which symbol name to look up: the class itself, or a member.
2080
+ const memberName = matchesBare
2081
+ ? imp.localName
2082
+ : ref.referenceName.substring(imp.localName.length + 1);
2083
+ const candidates = context.getNodesByName(memberName);
2084
+ for (const node of candidates) {
2085
+ if (node.language !== ref.language)
2086
+ continue;
2087
+ const fp = node.filePath.replace(/\\/g, '/');
2088
+ if (fp.endsWith(fqnPath) || fp.endsWith('/' + fqnPath)) {
2089
+ return {
2090
+ original: ref,
2091
+ targetNodeId: node.id,
2092
+ confidence: 0.9,
2093
+ resolvedBy: 'import',
2094
+ };
2095
+ }
2096
+ }
2097
+ // `import static com.example.Foo.bar;` — the FQN's tail is the
2098
+ // member name, the part before is the owner class. Look up the
2099
+ // member named `<imp.localName>` (e.g. `bar`) and prefer the
2100
+ // candidate whose file matches the parent FQN's path.
2101
+ if (matchesBare) {
2102
+ const dot = imp.source.lastIndexOf('.');
2103
+ if (dot > 0) {
2104
+ const ownerFqn = imp.source.substring(0, dot);
2105
+ const ownerPath = ownerFqn.replace(/\./g, '/') + ext;
2106
+ for (const node of candidates) {
2107
+ if (node.language !== ref.language)
2108
+ continue;
2109
+ const fp = node.filePath.replace(/\\/g, '/');
2110
+ if (fp.endsWith(ownerPath) || fp.endsWith('/' + ownerPath)) {
2111
+ return {
2112
+ original: ref,
2113
+ targetNodeId: node.id,
2114
+ confidence: 0.9,
2115
+ resolvedBy: 'import',
2116
+ };
2117
+ }
2118
+ }
2119
+ }
2120
+ }
2121
+ }
2122
+ return null;
2123
+ }
2124
+ /**
2125
+ * Resolve a Go cross-package qualified reference (`pkga.FuncX`) by matching
2126
+ * the package alias against an in-module import, stripping the module prefix
2127
+ * to a project-relative directory, and locating the exported symbol in any
2128
+ * `.go` file under that directory. Returns `null` for stdlib / third-party
2129
+ * imports (no `go.mod`-relative match) so the rest of `resolveViaImport`
2130
+ * can still try the file-based path.
2131
+ */
2132
+ function resolveGoCrossPackageReference(ref, imports, context) {
2133
+ const mod = context.getGoModule?.();
2134
+ if (!mod)
2135
+ return null;
2136
+ // Qualified call: receiver before `.`, member after. A bare reference
2137
+ // (no dot) is a same-file/in-package call — handled elsewhere.
2138
+ const dotIdx = ref.referenceName.indexOf('.');
2139
+ if (dotIdx <= 0)
2140
+ return null;
2141
+ const receiver = ref.referenceName.substring(0, dotIdx);
2142
+ const memberName = ref.referenceName.substring(dotIdx + 1);
2143
+ if (!memberName)
2144
+ return null;
2145
+ for (const imp of imports) {
2146
+ if (imp.localName !== receiver)
2147
+ continue;
2148
+ // Only in-module imports map to a known directory.
2149
+ if (imp.source !== mod.modulePath && !imp.source.startsWith(mod.modulePath + '/')) {
2150
+ continue;
2151
+ }
2152
+ const pkgDir = imp.source === mod.modulePath
2153
+ ? ''
2154
+ : imp.source.substring(mod.modulePath.length + 1);
2155
+ // Look up the member by name and pick the candidate whose file lives
2156
+ // directly in the package directory. Match the immediate parent dir
2157
+ // exactly so a call to `pkga.FuncX` doesn't accidentally land on a
2158
+ // `FuncX` declared in `pkga/subpkg/`.
2159
+ const candidates = context.getNodesByName(memberName);
2160
+ for (const node of candidates) {
2161
+ if (node.language !== 'go')
2162
+ continue;
2163
+ if (!node.isExported)
2164
+ continue;
2165
+ const fp = node.filePath.replace(/\\/g, '/');
2166
+ const lastSlash = fp.lastIndexOf('/');
2167
+ const fileDir = lastSlash >= 0 ? fp.substring(0, lastSlash) : '';
2168
+ if (fileDir === pkgDir) {
2169
+ return {
2170
+ original: ref,
2171
+ targetNodeId: node.id,
2172
+ confidence: 0.9,
2173
+ resolvedBy: 'import',
2174
+ };
2175
+ }
2176
+ }
2177
+ }
2178
+ return null;
2179
+ }
2180
+ /** Recursive depth cap for re-export chain following. Real codebases
2181
+ * rarely chain barrels more than 2–3 deep; 8 is a generous safety
2182
+ * net that still bounds worst-case work. */
2183
+ const REEXPORT_MAX_DEPTH = 8;
2184
+ /**
2185
+ * Find an exported symbol in `filePath`, following `export { x } from
2186
+ * './other'` and `export * from './other'` chains until the original
2187
+ * declaration is reached. Cycle-safe via the `visited` set.
2188
+ *
2189
+ * Without this, every barrel-style import (`import { Foo } from
2190
+ * './index'` where `index.ts` only re-exports) used to resolve to
2191
+ * nothing — the existing code only looked for declarations IN the
2192
+ * resolved file, not declarations the file forwarded.
2193
+ */
2194
+ function findExportedSymbol(filePath, want, language, context, visited, depth = 0) {
2195
+ // Memoize fresh (top-level) lookups only: recursive re-export steps carry a
2196
+ // populated `visited` set, whose contents change the reachable answer.
2197
+ // Every ref to the same imported symbol repeats this exact walk, so the
2198
+ // top-level memo removes the re-export chase + per-file linear scans from
2199
+ // all but the first occurrence.
2200
+ if (depth === 0 && visited.size === 0) {
2201
+ let memo = exportedSymbolMemos.get(context);
2202
+ if (!memo) {
2203
+ memo = new Map();
2204
+ exportedSymbolMemos.set(context, memo);
2205
+ }
2206
+ const key = `${filePath}\0${want.isDefault ? 1 : 0}${want.isNamespace ? 1 : 0}\0${want.exportedName}\0${want.memberName ?? ''}\0${language}`;
2207
+ if (memo.has(key))
2208
+ return memo.get(key);
2209
+ const result = findExportedSymbolWalk(filePath, want, language, context, visited, depth);
2210
+ memo.set(key, result);
2211
+ return result;
2212
+ }
2213
+ return findExportedSymbolWalk(filePath, want, language, context, visited, depth);
2214
+ }
2215
+ function findExportedSymbolWalk(filePath, want, language, context, visited, depth) {
2216
+ if (depth > REEXPORT_MAX_DEPTH)
2217
+ return undefined;
2218
+ if (visited.has(filePath))
2219
+ return undefined;
2220
+ visited.add(filePath);
2221
+ const exportIndex = getFileExportIndex(filePath, context);
2222
+ // 1. Direct hit: the symbol is declared in this file.
2223
+ if (want.isDefault) {
2224
+ // Svelte/Vue single-file components ARE the module's default export,
2225
+ // but are extracted as kind 'component' (not function/class). Prefer
2226
+ // the component node; fall back to an exported function/class for the
2227
+ // `.ts`/`.tsx` `export default fn`/`class` case. Without the component
2228
+ // branch, an `export { default as X } from './X.svelte'` barrel never
2229
+ // resolves and the component shows a false 0 callers (#629).
2230
+ // A component file IS its default export; otherwise the statement that
2231
+ // names the binding beats the first-exported-function guess.
2232
+ const direct = exportIndex.defaultComponent ?? exportIndex.defaultBinding ?? exportIndex.defaultFnClass;
2233
+ if (direct)
2234
+ return direct;
2235
+ }
2236
+ else if (want.isNamespace && want.memberName) {
2237
+ const direct = exportIndex.byName.get(want.memberName);
2238
+ if (direct)
2239
+ return direct;
2240
+ }
2241
+ else {
2242
+ const direct = exportIndex.byName.get(want.exportedName);
2243
+ if (direct)
2244
+ return direct;
2245
+ }
2246
+ // 2. Re-export hit: the file forwards the symbol to another module.
2247
+ const reExports = context.getReExports?.(filePath, language) ?? [];
2248
+ if (reExports.length === 0)
2249
+ return undefined;
2250
+ // Look for explicit `export { want } from './other'` (with optional rename).
2251
+ const targetName = want.isDefault ? 'default' : want.exportedName;
2252
+ for (const rex of reExports) {
2253
+ if (rex.kind === 'named' && rex.exportedName === targetName) {
2254
+ const next = resolveImportPath(rex.source, filePath, language, context);
2255
+ if (!next)
2256
+ continue;
2257
+ // After rename: `export { foo as bar } from './x'` — to chase
2258
+ // `bar`, we look for `foo` in `./x`.
2259
+ const chained = findExportedSymbol(next, {
2260
+ isDefault: rex.originalName === 'default',
2261
+ isNamespace: false,
2262
+ exportedName: rex.originalName,
2263
+ memberName: null,
2264
+ }, language, context, visited, depth + 1);
2265
+ if (chained)
2266
+ return chained;
2267
+ }
2268
+ }
2269
+ // 3. Wildcard re-export: `export * from './other'` — try every
2270
+ // forwarding source. This is the barrel-of-barrels case.
2271
+ for (const rex of reExports) {
2272
+ if (rex.kind === 'wildcard') {
2273
+ const next = resolveImportPath(rex.source, filePath, language, context);
2274
+ if (!next)
2275
+ continue;
2276
+ const chained = findExportedSymbol(next, want, language, context, visited, depth + 1);
2277
+ if (chained)
2278
+ return chained;
2279
+ }
2280
+ }
2281
+ return undefined;
2282
+ }
2283
+ /** Node kinds that own static members reachable as `Container.member`. */
2284
+ const STATIC_MEMBER_CONTAINERS = new Set([
2285
+ 'class', 'struct', 'union', 'interface', 'enum', 'trait', 'protocol',
2286
+ ]);
2287
+ /**
2288
+ * Resolve `Container.member` — a static method/property access on a NAMED class
2289
+ * import (`import { Foo } …; Foo.bar()`) — to the member node, given the
2290
+ * already-resolved container class.
2291
+ *
2292
+ * Members carry a `Container::member` qualifiedName, so we look up
2293
+ * `${container.qualifiedName}::${member}` within the container's own file (the
2294
+ * file filter disambiguates same-named classes in other modules). Returns
2295
+ * undefined when the container isn't a member-owning kind or the member isn't
2296
+ * found, so the caller falls back to the container itself (prior behavior) —
2297
+ * languages whose members aren't `::`-qualified, and genuine class references,
2298
+ * are unaffected. See #825.
2299
+ */
2300
+ /**
2301
+ * Resolve a CALL through an imported value to the method on the value's own
2302
+ * type: `reproStore.notifyJoinGuildStatus()` where `reproStore` is
2303
+ * `export const reproStore = new ReproStore()` in the imported file (#1292).
2304
+ * The same-file form of this call already resolves via local-variable
2305
+ * receiver inference (#1108); this is the cross-file/import half. The type is
2306
+ * recovered from the VALUE'S OWN declaration lines in the exporting file
2307
+ * (initializer `= new T(...)` or a type annotation, per the shared #1108
2308
+ * pattern table), then the member is resolved AND VALIDATED on that type by
2309
+ * resolveMethodOnType — a failed inference or validation returns null so the
2310
+ * caller keeps its existing constant-edge behavior.
2311
+ */
2312
+ function resolveImportedInstanceMember(value, ref, localName, context) {
2313
+ if (ref.referenceKind !== 'calls')
2314
+ return null;
2315
+ if (value.kind !== 'constant' && value.kind !== 'variable')
2316
+ return null;
2317
+ const member = ref.referenceName.slice(localName.length + 1).split('.')[0];
2318
+ if (!member)
2319
+ return null;
2320
+ const source = context.readFile(value.filePath);
2321
+ if (!source)
2322
+ return null;
2323
+ // Only the value's own declaration lines — never the whole file, so a
2324
+ // same-named identifier elsewhere can't donate a type.
2325
+ const lines = source.split('\n');
2326
+ const declSlice = lines.slice(Math.max(0, value.startLine - 1), value.endLine).join('\n');
2327
+ const receiver = value.name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
2328
+ for (const pattern of (0, name_matcher_1.localReceiverTypePatterns)(value.language, receiver)) {
2329
+ const m = declSlice.match(pattern);
2330
+ if (!m || !m[1])
2331
+ continue;
2332
+ const typeName = (0, name_matcher_1.normalizeInferredTypeName)(m[1]);
2333
+ if (!typeName)
2334
+ continue;
2335
+ const resolved = (0, name_matcher_1.resolveMethodOnType)(typeName, member, ref, context, 0.85, 'instance-method');
2336
+ if (resolved)
2337
+ return resolved;
2338
+ }
2339
+ return null;
2340
+ }
2341
+ function resolveStaticMember(container, ref, localName, context) {
2342
+ if (!STATIC_MEMBER_CONTAINERS.has(container.kind))
2343
+ return undefined;
2344
+ // First segment after the receiver: `Foo.bar.baz` → `bar`.
2345
+ const member = ref.referenceName.slice(localName.length + 1).split('.')[0];
2346
+ if (!member)
2347
+ return undefined;
2348
+ const candidates = context
2349
+ .getNodesByQualifiedName(`${container.qualifiedName}::${member}`)
2350
+ .filter((n) => n.filePath === container.filePath);
2351
+ if (candidates.length === 0)
2352
+ return undefined;
2353
+ // When the reference is a call, prefer a callable member if several nodes
2354
+ // share the qualifiedName (e.g. a static property and a method).
2355
+ if (ref.referenceKind === 'calls') {
2356
+ const callable = candidates.find((n) => n.kind === 'method' || n.kind === 'function');
2357
+ if (callable)
2358
+ return callable;
2359
+ }
2360
+ return candidates[0];
2361
+ }
2362
+ /**
2363
+ * Rust `use` declarations, flattened to `localName → full path`.
2364
+ *
2365
+ * Rust is the one supported language with NO `ImportMapping` extraction (see
2366
+ * `extractImportMappings`), so this is the only channel that can tell whether
2367
+ * a bare type name in a Rust file was brought in by a `use`. Handles nested
2368
+ * groups (`use a::{b::C, d as E}`), globs (skipped — they bind no single
2369
+ * name), and `as` aliases.
2370
+ */
2371
+ function collectRustUseBindings(content) {
2372
+ const out = new Map();
2373
+ // Expand one level of `{...}` at a time so `a::{b::{C, D}, E}` flattens.
2374
+ const expand = (spec) => {
2375
+ const open = spec.indexOf('{');
2376
+ if (open === -1)
2377
+ return [spec.trim()];
2378
+ const prefix = spec.slice(0, open);
2379
+ let depth = 0;
2380
+ let close = -1;
2381
+ for (let i = open; i < spec.length; i++) {
2382
+ if (spec[i] === '{')
2383
+ depth++;
2384
+ else if (spec[i] === '}') {
2385
+ depth--;
2386
+ if (depth === 0) {
2387
+ close = i;
2388
+ break;
2389
+ }
2390
+ }
2391
+ }
2392
+ if (close === -1)
2393
+ return [];
2394
+ const suffix = spec.slice(close + 1);
2395
+ const inner = spec.slice(open + 1, close);
2396
+ const parts = [];
2397
+ let depth2 = 0;
2398
+ let start = 0;
2399
+ for (let i = 0; i <= inner.length; i++) {
2400
+ const ch = inner[i];
2401
+ if (ch === '{')
2402
+ depth2++;
2403
+ else if (ch === '}')
2404
+ depth2--;
2405
+ if (i === inner.length || (ch === ',' && depth2 === 0)) {
2406
+ const seg = inner.slice(start, i).trim();
2407
+ if (seg)
2408
+ parts.push(seg);
2409
+ start = i + 1;
2410
+ }
2411
+ }
2412
+ return parts.flatMap((p) => expand(prefix + p + suffix));
2413
+ };
2414
+ // `use` items end at the first `;`. Attributes/visibility (`pub use`) are
2415
+ // irrelevant to the binding itself.
2416
+ const useRe = /(^|\n)\s*(?:pub(?:\([^)]*\))?\s+)?use\s+([^;]+);/g;
2417
+ let m;
2418
+ while ((m = useRe.exec(content)) !== null) {
2419
+ for (const spec of expand(m[2].replace(/\s+/g, ' '))) {
2420
+ const aliasMatch = /^(.*?)\s+as\s+([A-Za-z_]\w*)$/.exec(spec);
2421
+ const rawPath = (aliasMatch ? aliasMatch[1] : spec).trim();
2422
+ if (!rawPath || rawPath.endsWith('*'))
2423
+ continue;
2424
+ const segments = rawPath.split('::').map((s) => s.trim()).filter(Boolean);
2425
+ const leaf = segments[segments.length - 1];
2426
+ if (!leaf)
2427
+ continue;
2428
+ const local = aliasMatch ? aliasMatch[2] : leaf;
2429
+ out.set(local, segments.join('::'));
2430
+ }
2431
+ }
2432
+ return out;
2433
+ }
2434
+ /**
2435
+ * Is `name`, as used in `ref`'s file, bound by an import whose module lives
2436
+ * OUTSIDE the repository?
2437
+ *
2438
+ * When it is, no in-repo node can be the referent: the symbol is defined in a
2439
+ * third-party crate/package, and any same-named local symbol the name-matcher
2440
+ * finds is a coincidence. Rust `use std::error::Error;` + `impl Error for
2441
+ * MapperError {}` bound to a local `MapperError::Error` variant, and once
2442
+ * non-type kinds were filtered out it simply moved to an unrelated local
2443
+ * `type Error` alias — restricting kinds alone RELOCATES the false edge
2444
+ * instead of removing it, so locality has to be checked too.
2445
+ *
2446
+ * Answers only when it can be CERTAIN, because a false "yes" deletes a real
2447
+ * edge. Two languages qualify, each with an oracle that cannot be wrong:
2448
+ *
2449
+ * - **Rust** — the `use` path is rooted at a standard-library crate
2450
+ * (`std`/`core`/`alloc`/`proc_macro`), which by definition ships outside
2451
+ * any repository. Deliberately NOT generalized to "the module path doesn't
2452
+ * resolve to a file": a crate can re-export another workspace crate's
2453
+ * modules (`pub use pupil_core::{ports, domain};`), so `crate::ports::X`
2454
+ * has no `src/ports/` directory to walk yet is entirely in-repo — that
2455
+ * generalization measured 13 real trait implementations deleted.
2456
+ * - **ES modules** — `isExternalImport`, which already accounts for tsconfig
2457
+ * path aliases and monorepo workspace packages.
2458
+ *
2459
+ * Everything else returns false and resolves exactly as before. JVM and Python
2460
+ * imports notably do NOT go through `resolveImportPath` (they have dedicated
2461
+ * FQN/module matchers), so there is no trustworthy oracle to consult here.
2462
+ */
2463
+ function isBoundToOutOfRepoImport(ref, context) {
2464
+ const name = ref.referenceName;
2465
+ if (name.includes('::') || name.includes('.'))
2466
+ return false; // qualified refs resolve by path
2467
+ if (ref.language === 'rust') {
2468
+ const content = context.readFile(ref.filePath);
2469
+ if (!content)
2470
+ return false;
2471
+ const usePath = collectRustUseBindings(content).get(name);
2472
+ if (!usePath)
2473
+ return false;
2474
+ const segments = usePath.split('::');
2475
+ if (segments.length < 2 || !RUST_STDLIB_ROOTS.has(segments[0]))
2476
+ return false;
2477
+ // 2015-edition crate-relative paths can shadow a stdlib root with a local
2478
+ // module of the same name — if the path walks to a real file, it's local.
2479
+ return resolveRustModuleFile(segments.slice(0, -1), ref.filePath, context) === null;
2480
+ }
2481
+ if (!ESM_IMPORT_LANGUAGES.has(ref.language))
2482
+ return false;
2483
+ for (const imp of context.getImportMappings(ref.filePath, ref.language)) {
2484
+ if (imp.localName !== name)
2485
+ continue;
2486
+ return isExternalImport(imp.source, ref.language, context);
2487
+ }
2488
+ return false;
2489
+ }
2490
+ //# sourceMappingURL=import-resolver.js.map