gitnexus 1.6.6-rc.99 → 1.6.6

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 (541) hide show
  1. package/README.md +122 -68
  2. package/dist/_shared/graph/types.d.ts +17 -1
  3. package/dist/_shared/graph/types.d.ts.map +1 -1
  4. package/dist/_shared/index.d.ts +3 -5
  5. package/dist/_shared/index.d.ts.map +1 -1
  6. package/dist/_shared/index.js +2 -4
  7. package/dist/_shared/index.js.map +1 -1
  8. package/dist/_shared/scope-resolution/module-scope-index.d.ts +1 -2
  9. package/dist/_shared/scope-resolution/module-scope-index.d.ts.map +1 -1
  10. package/dist/_shared/scope-resolution/module-scope-index.js +1 -2
  11. package/dist/_shared/scope-resolution/module-scope-index.js.map +1 -1
  12. package/dist/_shared/scope-resolution/parsed-file.d.ts +24 -0
  13. package/dist/_shared/scope-resolution/parsed-file.d.ts.map +1 -1
  14. package/dist/_shared/scope-resolution/reference-site.d.ts +13 -1
  15. package/dist/_shared/scope-resolution/reference-site.d.ts.map +1 -1
  16. package/dist/_shared/scope-resolution/registries/context.d.ts +1 -0
  17. package/dist/_shared/scope-resolution/registries/context.d.ts.map +1 -1
  18. package/dist/_shared/scope-resolution/registries/context.js +6 -0
  19. package/dist/_shared/scope-resolution/registries/context.js.map +1 -1
  20. package/dist/_shared/scope-resolution/registries/evidence.d.ts +2 -3
  21. package/dist/_shared/scope-resolution/registries/evidence.d.ts.map +1 -1
  22. package/dist/_shared/scope-resolution/registries/evidence.js +2 -3
  23. package/dist/_shared/scope-resolution/registries/evidence.js.map +1 -1
  24. package/dist/_shared/scope-resolution/registries/macro-registry.d.ts +29 -0
  25. package/dist/_shared/scope-resolution/registries/macro-registry.d.ts.map +1 -0
  26. package/dist/_shared/scope-resolution/registries/macro-registry.js +32 -0
  27. package/dist/_shared/scope-resolution/registries/macro-registry.js.map +1 -0
  28. package/dist/_shared/scope-resolution/symbol-definition.d.ts +9 -0
  29. package/dist/_shared/scope-resolution/symbol-definition.d.ts.map +1 -1
  30. package/dist/_shared/scope-resolution/types.d.ts +1 -1
  31. package/dist/_shared/scope-resolution/types.d.ts.map +1 -1
  32. package/dist/cli/ai-context.d.ts +35 -1
  33. package/dist/cli/ai-context.js +111 -12
  34. package/dist/cli/analyze-config.d.ts +92 -0
  35. package/dist/cli/analyze-config.js +364 -0
  36. package/dist/cli/analyze.d.ts +17 -1
  37. package/dist/cli/analyze.js +224 -71
  38. package/dist/cli/cli-message.d.ts +1 -1
  39. package/dist/cli/doctor.d.ts +18 -0
  40. package/dist/cli/doctor.js +32 -0
  41. package/dist/cli/i18n/en.d.ts +2 -2
  42. package/dist/cli/i18n/en.js +2 -2
  43. package/dist/cli/i18n/resources.d.ts +2 -2
  44. package/dist/cli/i18n/zh-CN.js +2 -2
  45. package/dist/cli/index.js +4 -2
  46. package/dist/cli/resolve-invocation.d.ts +21 -0
  47. package/dist/cli/resolve-invocation.js +68 -0
  48. package/dist/cli/setup.d.ts +33 -0
  49. package/dist/cli/setup.js +96 -35
  50. package/dist/cli/skill-gen.js +2 -2
  51. package/dist/cli/wiki.js +20 -4
  52. package/dist/core/embeddings/embedder.d.ts +1 -1
  53. package/dist/core/embeddings/embedder.js +14 -1
  54. package/dist/core/embeddings/runtime-support.d.ts +41 -0
  55. package/dist/core/embeddings/runtime-support.js +65 -0
  56. package/dist/core/group/extractors/grpc-patterns/proto.js +2 -1
  57. package/dist/core/group/extractors/http-patterns/java.js +15 -1
  58. package/dist/core/ingestion/call-processor.d.ts +57 -227
  59. package/dist/core/ingestion/call-processor.js +172 -2595
  60. package/dist/core/ingestion/call-routing.d.ts +6 -5
  61. package/dist/core/ingestion/call-routing.js +6 -6
  62. package/dist/core/ingestion/call-types.d.ts +0 -75
  63. package/dist/core/ingestion/class-extractors/configs/c-cpp.js +26 -1
  64. package/dist/core/ingestion/class-extractors/configs/ruby.js +3 -0
  65. package/dist/core/ingestion/class-extractors/generic.js +9 -11
  66. package/dist/core/ingestion/class-types.d.ts +23 -0
  67. package/dist/core/ingestion/cobol/cobol-preprocessor.d.ts +11 -0
  68. package/dist/core/ingestion/cobol/cobol-preprocessor.js +227 -73
  69. package/dist/core/ingestion/cobol-processor.d.ts +1 -0
  70. package/dist/core/ingestion/cobol-processor.js +51 -2
  71. package/dist/core/ingestion/emit-references.js +8 -2
  72. package/dist/core/ingestion/export-detection.d.ts +2 -1
  73. package/dist/core/ingestion/export-detection.js +2 -6
  74. package/dist/core/ingestion/field-extractors/configs/dart.d.ts +0 -6
  75. package/dist/core/ingestion/field-extractors/configs/dart.js +62 -44
  76. package/dist/core/ingestion/field-extractors/configs/go.d.ts +0 -9
  77. package/dist/core/ingestion/field-extractors/configs/go.js +40 -1
  78. package/dist/core/ingestion/field-extractors/configs/jvm.js +43 -4
  79. package/dist/core/ingestion/field-extractors/configs/php.js +1 -2
  80. package/dist/core/ingestion/field-extractors/configs/swift.d.ts +12 -1
  81. package/dist/core/ingestion/field-extractors/configs/swift.js +31 -6
  82. package/dist/core/ingestion/field-extractors/generic.d.ts +6 -0
  83. package/dist/core/ingestion/field-extractors/generic.js +5 -4
  84. package/dist/core/ingestion/field-extractors/typescript.js +0 -29
  85. package/dist/core/ingestion/filesystem-walker.d.ts +0 -9
  86. package/dist/core/ingestion/filesystem-walker.js +0 -11
  87. package/dist/core/ingestion/finalize-orchestrator.js +14 -2
  88. package/dist/core/ingestion/import-resolvers/configs/swift.d.ts +21 -0
  89. package/dist/core/ingestion/import-resolvers/configs/swift.js +72 -11
  90. package/dist/core/ingestion/import-resolvers/python.d.ts +1 -1
  91. package/dist/core/ingestion/import-resolvers/standard.d.ts +2 -2
  92. package/dist/core/ingestion/import-resolvers/standard.js +6 -5
  93. package/dist/core/ingestion/import-resolvers/utils.d.ts +2 -5
  94. package/dist/core/ingestion/import-resolvers/utils.js +1 -9
  95. package/dist/core/ingestion/language-provider.d.ts +39 -119
  96. package/dist/core/ingestion/language-provider.js +0 -2
  97. package/dist/core/ingestion/languages/c/capture-side-channel.d.ts +62 -0
  98. package/dist/core/ingestion/languages/c/capture-side-channel.js +65 -0
  99. package/dist/core/ingestion/languages/c/captures.js +41 -23
  100. package/dist/core/ingestion/languages/c/import-decomposer.d.ts +9 -0
  101. package/dist/core/ingestion/languages/c/import-decomposer.js +15 -0
  102. package/dist/core/ingestion/languages/c/import-target.js +52 -9
  103. package/dist/core/ingestion/languages/c/index.d.ts +2 -1
  104. package/dist/core/ingestion/languages/c/index.js +2 -1
  105. package/dist/core/ingestion/languages/c/query.js +15 -0
  106. package/dist/core/ingestion/languages/c/scope-resolver.js +47 -4
  107. package/dist/core/ingestion/languages/c/static-linkage.d.ts +8 -0
  108. package/dist/core/ingestion/languages/c/static-linkage.js +46 -1
  109. package/dist/core/ingestion/languages/c-cpp.js +16 -7
  110. package/dist/core/ingestion/languages/cobol/captures.js +25 -2
  111. package/dist/core/ingestion/languages/cpp/adl.d.ts +88 -4
  112. package/dist/core/ingestion/languages/cpp/adl.js +380 -160
  113. package/dist/core/ingestion/languages/cpp/arity-metadata.js +2 -8
  114. package/dist/core/ingestion/languages/cpp/capture-side-channel.d.ts +65 -0
  115. package/dist/core/ingestion/languages/cpp/capture-side-channel.js +78 -0
  116. package/dist/core/ingestion/languages/cpp/captures.js +162 -54
  117. package/dist/core/ingestion/languages/cpp/file-local-linkage.d.ts +18 -52
  118. package/dist/core/ingestion/languages/cpp/file-local-linkage.js +49 -1
  119. package/dist/core/ingestion/languages/cpp/import-decomposer.d.ts +7 -0
  120. package/dist/core/ingestion/languages/cpp/import-decomposer.js +12 -0
  121. package/dist/core/ingestion/languages/cpp/index.d.ts +1 -0
  122. package/dist/core/ingestion/languages/cpp/index.js +1 -0
  123. package/dist/core/ingestion/languages/cpp/inline-namespaces.d.ts +8 -0
  124. package/dist/core/ingestion/languages/cpp/inline-namespaces.js +21 -0
  125. package/dist/core/ingestion/languages/cpp/query.js +21 -0
  126. package/dist/core/ingestion/languages/cpp/range-bindings.js +20 -5
  127. package/dist/core/ingestion/languages/cpp/scope-resolver.js +52 -5
  128. package/dist/core/ingestion/languages/cpp/two-phase-lookup.d.ts +20 -0
  129. package/dist/core/ingestion/languages/cpp/two-phase-lookup.js +83 -3
  130. package/dist/core/ingestion/languages/csharp/captures.js +205 -41
  131. package/dist/core/ingestion/languages/csharp/index.d.ts +3 -4
  132. package/dist/core/ingestion/languages/csharp/index.js +3 -4
  133. package/dist/core/ingestion/languages/csharp/interpret.js +17 -3
  134. package/dist/core/ingestion/languages/csharp/namespace-siblings.d.ts +17 -7
  135. package/dist/core/ingestion/languages/csharp/namespace-siblings.js +129 -124
  136. package/dist/core/ingestion/languages/csharp/qualified-type-names.d.ts +14 -0
  137. package/dist/core/ingestion/languages/csharp/qualified-type-names.js +59 -0
  138. package/dist/core/ingestion/languages/csharp/query.js +13 -0
  139. package/dist/core/ingestion/languages/csharp/receiver-binding.js +10 -6
  140. package/dist/core/ingestion/languages/csharp/scope-resolver.js +8 -1
  141. package/dist/core/ingestion/languages/csharp.js +0 -5
  142. package/dist/core/ingestion/languages/dart/arity-metadata.d.ts +25 -0
  143. package/dist/core/ingestion/languages/dart/arity-metadata.js +35 -0
  144. package/dist/core/ingestion/languages/dart/arity.d.ts +19 -0
  145. package/dist/core/ingestion/languages/dart/arity.js +31 -0
  146. package/dist/core/ingestion/languages/dart/built-ins.d.ts +11 -0
  147. package/dist/core/ingestion/languages/dart/built-ins.js +34 -0
  148. package/dist/core/ingestion/languages/dart/cache-stats.d.ts +13 -0
  149. package/dist/core/ingestion/languages/dart/cache-stats.js +24 -0
  150. package/dist/core/ingestion/languages/dart/captures.d.ts +29 -0
  151. package/dist/core/ingestion/languages/dart/captures.js +445 -0
  152. package/dist/core/ingestion/languages/dart/expand-wildcards.d.ts +13 -0
  153. package/dist/core/ingestion/languages/dart/expand-wildcards.js +31 -0
  154. package/dist/core/ingestion/languages/dart/import-target.d.ts +15 -0
  155. package/dist/core/ingestion/languages/dart/import-target.js +65 -0
  156. package/dist/core/ingestion/languages/dart/index.d.ts +28 -0
  157. package/dist/core/ingestion/languages/dart/index.js +28 -0
  158. package/dist/core/ingestion/languages/dart/interpret.d.ts +24 -0
  159. package/dist/core/ingestion/languages/dart/interpret.js +95 -0
  160. package/dist/core/ingestion/languages/dart/merge-bindings.d.ts +10 -0
  161. package/dist/core/ingestion/languages/dart/merge-bindings.js +39 -0
  162. package/dist/core/ingestion/languages/dart/query.d.ts +26 -0
  163. package/dist/core/ingestion/languages/dart/query.js +142 -0
  164. package/dist/core/ingestion/languages/dart/receiver-binding.d.ts +24 -0
  165. package/dist/core/ingestion/languages/dart/receiver-binding.js +87 -0
  166. package/dist/core/ingestion/languages/dart/scope-resolver.d.ts +29 -0
  167. package/dist/core/ingestion/languages/dart/scope-resolver.js +194 -0
  168. package/dist/core/ingestion/languages/dart/signature-bindings.d.ts +23 -0
  169. package/dist/core/ingestion/languages/dart/signature-bindings.js +51 -0
  170. package/dist/core/ingestion/languages/dart/simple-hooks.d.ts +20 -0
  171. package/dist/core/ingestion/languages/dart/simple-hooks.js +47 -0
  172. package/dist/core/ingestion/languages/dart.d.ts +0 -1
  173. package/dist/core/ingestion/languages/dart.js +15 -29
  174. package/dist/core/ingestion/languages/go/arity-metadata.d.ts +1 -0
  175. package/dist/core/ingestion/languages/go/arity-metadata.js +31 -1
  176. package/dist/core/ingestion/languages/go/captures.js +162 -3
  177. package/dist/core/ingestion/languages/go/interface-impls.js +476 -50
  178. package/dist/core/ingestion/languages/go/interpret.js +21 -11
  179. package/dist/core/ingestion/languages/go/method-owners.js +20 -8
  180. package/dist/core/ingestion/languages/go/query.js +15 -7
  181. package/dist/core/ingestion/languages/go/range-binding.js +24 -9
  182. package/dist/core/ingestion/languages/go/receiver-binding.js +1 -1
  183. package/dist/core/ingestion/languages/go/scope-resolver.js +2 -2
  184. package/dist/core/ingestion/languages/go/simple-hooks.js +10 -5
  185. package/dist/core/ingestion/languages/go/type-binding.d.ts +1 -0
  186. package/dist/core/ingestion/languages/go/type-binding.js +40 -2
  187. package/dist/core/ingestion/languages/go.d.ts +0 -1
  188. package/dist/core/ingestion/languages/go.js +0 -5
  189. package/dist/core/ingestion/languages/index.d.ts +0 -5
  190. package/dist/core/ingestion/languages/index.js +0 -3
  191. package/dist/core/ingestion/languages/java/captures.js +252 -23
  192. package/dist/core/ingestion/languages/java/interpret.js +12 -6
  193. package/dist/core/ingestion/languages/java/package-siblings.js +18 -5
  194. package/dist/core/ingestion/languages/java/query.js +16 -1
  195. package/dist/core/ingestion/languages/java/scope-resolver.d.ts +2 -8
  196. package/dist/core/ingestion/languages/java/scope-resolver.js +2 -8
  197. package/dist/core/ingestion/languages/java.js +0 -5
  198. package/dist/core/ingestion/languages/javascript/captures.js +185 -11
  199. package/dist/core/ingestion/languages/javascript/query.js +107 -1
  200. package/dist/core/ingestion/languages/kotlin/capture-side-channel.d.ts +57 -0
  201. package/dist/core/ingestion/languages/kotlin/capture-side-channel.js +60 -0
  202. package/dist/core/ingestion/languages/kotlin/captures.js +213 -22
  203. package/dist/core/ingestion/languages/kotlin/companion-scopes.d.ts +7 -0
  204. package/dist/core/ingestion/languages/kotlin/companion-scopes.js +10 -0
  205. package/dist/core/ingestion/languages/kotlin/index.d.ts +1 -0
  206. package/dist/core/ingestion/languages/kotlin/index.js +1 -0
  207. package/dist/core/ingestion/languages/kotlin/query.js +30 -0
  208. package/dist/core/ingestion/languages/kotlin/scope-resolver.d.ts +5 -7
  209. package/dist/core/ingestion/languages/kotlin/scope-resolver.js +22 -7
  210. package/dist/core/ingestion/languages/kotlin.js +8 -5
  211. package/dist/core/ingestion/languages/php/captures.js +135 -19
  212. package/dist/core/ingestion/languages/php/import-decomposer.js +21 -63
  213. package/dist/core/ingestion/languages/php/index.d.ts +3 -4
  214. package/dist/core/ingestion/languages/php/index.js +3 -4
  215. package/dist/core/ingestion/languages/php/query.js +5 -0
  216. package/dist/core/ingestion/languages/php/receiver-binding.js +8 -4
  217. package/dist/core/ingestion/languages/php.js +0 -4
  218. package/dist/core/ingestion/languages/python/captures.js +128 -13
  219. package/dist/core/ingestion/languages/python/depends-references.js +1 -1
  220. package/dist/core/ingestion/languages/python/import-target.d.ts +4 -5
  221. package/dist/core/ingestion/languages/python/import-target.js +108 -16
  222. package/dist/core/ingestion/languages/python/index-stats.d.ts +18 -0
  223. package/dist/core/ingestion/languages/python/index-stats.js +25 -0
  224. package/dist/core/ingestion/languages/python/index.d.ts +3 -4
  225. package/dist/core/ingestion/languages/python/index.js +3 -4
  226. package/dist/core/ingestion/languages/python/query.js +17 -0
  227. package/dist/core/ingestion/languages/python/scope-resolver.js +7 -6
  228. package/dist/core/ingestion/languages/python.d.ts +0 -2
  229. package/dist/core/ingestion/languages/python.js +0 -7
  230. package/dist/core/ingestion/languages/ruby/captures.js +174 -31
  231. package/dist/core/ingestion/languages/ruby/import-target.js +2 -1
  232. package/dist/core/ingestion/languages/ruby/interpret.js +2 -1
  233. package/dist/core/ingestion/languages/ruby/query.js +10 -0
  234. package/dist/core/ingestion/languages/ruby/scope-resolver.js +61 -11
  235. package/dist/core/ingestion/languages/ruby.js +4 -53
  236. package/dist/core/ingestion/languages/rust/captures.js +95 -13
  237. package/dist/core/ingestion/languages/rust/query.js +64 -1
  238. package/dist/core/ingestion/languages/rust/range-binding.js +40 -12
  239. package/dist/core/ingestion/languages/rust/receiver-binding.js +9 -0
  240. package/dist/core/ingestion/languages/rust/scope-resolver.js +75 -1
  241. package/dist/core/ingestion/languages/rust.d.ts +0 -2
  242. package/dist/core/ingestion/languages/rust.js +0 -6
  243. package/dist/core/ingestion/languages/swift/arity-metadata.d.ts +24 -0
  244. package/dist/core/ingestion/languages/swift/arity-metadata.js +41 -0
  245. package/dist/core/ingestion/languages/swift/arity.d.ts +29 -0
  246. package/dist/core/ingestion/languages/swift/arity.js +42 -0
  247. package/dist/core/ingestion/languages/swift/base-type.d.ts +20 -0
  248. package/dist/core/ingestion/languages/swift/base-type.js +27 -0
  249. package/dist/core/ingestion/languages/swift/cache-stats.d.ts +15 -0
  250. package/dist/core/ingestion/languages/swift/cache-stats.js +26 -0
  251. package/dist/core/ingestion/languages/swift/captures.d.ts +35 -0
  252. package/dist/core/ingestion/languages/swift/captures.js +495 -0
  253. package/dist/core/ingestion/languages/swift/implicit-imports.d.ts +34 -0
  254. package/dist/core/ingestion/languages/swift/implicit-imports.js +57 -0
  255. package/dist/core/ingestion/languages/swift/import-decomposer.d.ts +24 -0
  256. package/dist/core/ingestion/languages/swift/import-decomposer.js +84 -0
  257. package/dist/core/ingestion/languages/swift/import-target.d.ts +33 -0
  258. package/dist/core/ingestion/languages/swift/import-target.js +81 -0
  259. package/dist/core/ingestion/languages/swift/index.d.ts +37 -0
  260. package/dist/core/ingestion/languages/swift/index.js +37 -0
  261. package/dist/core/ingestion/languages/swift/interpret.d.ts +15 -0
  262. package/dist/core/ingestion/languages/swift/interpret.js +89 -0
  263. package/dist/core/ingestion/languages/swift/merge-bindings.d.ts +20 -0
  264. package/dist/core/ingestion/languages/swift/merge-bindings.js +48 -0
  265. package/dist/core/ingestion/languages/swift/query.d.ts +46 -0
  266. package/dist/core/ingestion/languages/swift/query.js +194 -0
  267. package/dist/core/ingestion/languages/swift/receiver-binding.d.ts +40 -0
  268. package/dist/core/ingestion/languages/swift/receiver-binding.js +161 -0
  269. package/dist/core/ingestion/languages/swift/scope-resolver.d.ts +50 -0
  270. package/dist/core/ingestion/languages/swift/scope-resolver.js +189 -0
  271. package/dist/core/ingestion/languages/swift/sibling-type-bindings.d.ts +34 -0
  272. package/dist/core/ingestion/languages/swift/sibling-type-bindings.js +65 -0
  273. package/dist/core/ingestion/languages/swift/signature-bindings.d.ts +25 -0
  274. package/dist/core/ingestion/languages/swift/signature-bindings.js +66 -0
  275. package/dist/core/ingestion/languages/swift/simple-hooks.d.ts +37 -0
  276. package/dist/core/ingestion/languages/swift/simple-hooks.js +60 -0
  277. package/dist/core/ingestion/languages/swift/target-grouping.d.ts +51 -0
  278. package/dist/core/ingestion/languages/swift/target-grouping.js +93 -0
  279. package/dist/core/ingestion/languages/swift/target-siblings.d.ts +30 -0
  280. package/dist/core/ingestion/languages/swift/target-siblings.js +71 -0
  281. package/dist/core/ingestion/languages/swift.d.ts +0 -5
  282. package/dist/core/ingestion/languages/swift.js +11 -87
  283. package/dist/core/ingestion/languages/typescript/array-callback.d.ts +3 -29
  284. package/dist/core/ingestion/languages/typescript/array-callback.js +4 -43
  285. package/dist/core/ingestion/languages/typescript/captures.js +147 -17
  286. package/dist/core/ingestion/languages/typescript/index.d.ts +3 -4
  287. package/dist/core/ingestion/languages/typescript/index.js +3 -4
  288. package/dist/core/ingestion/languages/typescript/query.d.ts +2 -3
  289. package/dist/core/ingestion/languages/typescript/query.js +125 -4
  290. package/dist/core/ingestion/languages/typescript/receiver-binding.js +0 -1
  291. package/dist/core/ingestion/languages/typescript.d.ts +2 -3
  292. package/dist/core/ingestion/languages/typescript.js +46 -23
  293. package/dist/core/ingestion/languages/vue/captures.d.ts +46 -0
  294. package/dist/core/ingestion/languages/vue/captures.js +67 -0
  295. package/dist/core/ingestion/languages/vue/import-target.d.ts +27 -0
  296. package/dist/core/ingestion/languages/vue/import-target.js +58 -0
  297. package/dist/core/ingestion/languages/vue/index.d.ts +49 -0
  298. package/dist/core/ingestion/languages/vue/index.js +49 -0
  299. package/dist/core/ingestion/languages/vue/scope-resolver.d.ts +55 -0
  300. package/dist/core/ingestion/languages/vue/scope-resolver.js +292 -0
  301. package/dist/core/ingestion/languages/vue.js +12 -4
  302. package/dist/core/ingestion/local-symbol-pruner.d.ts +11 -0
  303. package/dist/core/ingestion/local-symbol-pruner.js +63 -0
  304. package/dist/core/ingestion/method-extractors/configs/dart.js +14 -1
  305. package/dist/core/ingestion/method-extractors/configs/jvm.js +37 -20
  306. package/dist/core/ingestion/method-extractors/configs/php.js +0 -1
  307. package/dist/core/ingestion/method-extractors/configs/swift.js +11 -4
  308. package/dist/core/ingestion/method-types.d.ts +2 -2
  309. package/dist/core/ingestion/model/index.d.ts +0 -3
  310. package/dist/core/ingestion/model/index.js +0 -8
  311. package/dist/core/ingestion/model/resolve.d.ts +7 -43
  312. package/dist/core/ingestion/model/resolve.js +7 -226
  313. package/dist/core/ingestion/model/scope-resolution-indexes.d.ts +46 -1
  314. package/dist/core/ingestion/model/semantic-model.d.ts +4 -6
  315. package/dist/core/ingestion/model/semantic-model.js +1 -1
  316. package/dist/core/ingestion/model/symbol-table.d.ts +3 -4
  317. package/dist/core/ingestion/model/symbol-table.js +3 -4
  318. package/dist/core/ingestion/parsing-processor.d.ts +30 -24
  319. package/dist/core/ingestion/parsing-processor.js +76 -640
  320. package/dist/core/ingestion/pipeline-phases/communities.d.ts +1 -1
  321. package/dist/core/ingestion/pipeline-phases/communities.js +5 -2
  322. package/dist/core/ingestion/pipeline-phases/cross-file.d.ts +9 -8
  323. package/dist/core/ingestion/pipeline-phases/cross-file.js +16 -12
  324. package/dist/core/ingestion/pipeline-phases/index.d.ts +1 -0
  325. package/dist/core/ingestion/pipeline-phases/index.js +1 -0
  326. package/dist/core/ingestion/pipeline-phases/mro.d.ts +1 -1
  327. package/dist/core/ingestion/pipeline-phases/mro.js +2 -2
  328. package/dist/core/ingestion/pipeline-phases/parse-impl.d.ts +44 -22
  329. package/dist/core/ingestion/pipeline-phases/parse-impl.js +426 -565
  330. package/dist/core/ingestion/pipeline-phases/parse.d.ts +13 -33
  331. package/dist/core/ingestion/pipeline-phases/parse.js +2 -2
  332. package/dist/core/ingestion/pipeline-phases/processes.d.ts +1 -1
  333. package/dist/core/ingestion/pipeline-phases/processes.js +5 -3
  334. package/dist/core/ingestion/pipeline-phases/prune-local-symbols.d.ts +14 -0
  335. package/dist/core/ingestion/pipeline-phases/prune-local-symbols.js +26 -0
  336. package/dist/core/ingestion/pipeline.d.ts +27 -19
  337. package/dist/core/ingestion/pipeline.js +4 -2
  338. package/dist/core/ingestion/resolve-references.js +15 -3
  339. package/dist/core/ingestion/route-extractors/laravel.d.ts +10 -0
  340. package/dist/core/ingestion/route-extractors/laravel.js +88 -9
  341. package/dist/core/ingestion/scope-extractor-bridge.d.ts +2 -1
  342. package/dist/core/ingestion/scope-extractor-bridge.js +2 -2
  343. package/dist/core/ingestion/scope-extractor.js +13 -0
  344. package/dist/core/ingestion/scope-resolution/contract/scope-resolver.d.ts +181 -15
  345. package/dist/core/ingestion/scope-resolution/contract/scope-resolver.js +21 -10
  346. package/dist/core/ingestion/scope-resolution/graph-bridge/edges.js +10 -2
  347. package/dist/core/ingestion/scope-resolution/graph-bridge/ids.d.ts +7 -1
  348. package/dist/core/ingestion/scope-resolution/graph-bridge/ids.js +58 -6
  349. package/dist/core/ingestion/scope-resolution/graph-bridge/node-lookup.js +24 -5
  350. package/dist/core/ingestion/scope-resolution/passes/free-call-fallback.d.ts +68 -1
  351. package/dist/core/ingestion/scope-resolution/passes/free-call-fallback.js +189 -29
  352. package/dist/core/ingestion/scope-resolution/passes/imported-return-types.js +21 -1
  353. package/dist/core/ingestion/scope-resolution/passes/receiver-bound-calls.js +1 -1
  354. package/dist/core/ingestion/scope-resolution/pipeline/phase.d.ts +8 -11
  355. package/dist/core/ingestion/scope-resolution/pipeline/phase.js +171 -50
  356. package/dist/core/ingestion/scope-resolution/pipeline/registry.d.ts +3 -4
  357. package/dist/core/ingestion/scope-resolution/pipeline/registry.js +9 -4
  358. package/dist/core/ingestion/scope-resolution/pipeline/run.d.ts +28 -5
  359. package/dist/core/ingestion/scope-resolution/pipeline/run.js +191 -24
  360. package/dist/core/ingestion/scope-resolution/pipeline/validate-bindings-immutability.js +31 -0
  361. package/dist/core/ingestion/scope-resolution/scope/walkers.d.ts +72 -0
  362. package/dist/core/ingestion/scope-resolution/scope/walkers.js +440 -39
  363. package/dist/core/ingestion/scope-resolution/workspace-index.d.ts +18 -2
  364. package/dist/core/ingestion/scope-resolution/workspace-index.js +94 -7
  365. package/dist/core/ingestion/tree-sitter-queries.d.ts +14 -14
  366. package/dist/core/ingestion/tree-sitter-queries.js +380 -158
  367. package/dist/core/ingestion/ts-js-hoc-utils.d.ts +12 -0
  368. package/dist/core/ingestion/ts-js-hoc-utils.js +105 -0
  369. package/dist/core/ingestion/type-env.d.ts +2 -1
  370. package/dist/core/ingestion/type-env.js +6 -8
  371. package/dist/core/ingestion/type-extractors/c-cpp.js +8 -10
  372. package/dist/core/ingestion/type-extractors/csharp.js +18 -34
  373. package/dist/core/ingestion/type-extractors/go.js +2 -10
  374. package/dist/core/ingestion/type-extractors/jvm.js +6 -5
  375. package/dist/core/ingestion/type-extractors/php.js +1 -1
  376. package/dist/core/ingestion/type-extractors/python.js +1 -1
  377. package/dist/core/ingestion/type-extractors/ruby.js +2 -2
  378. package/dist/core/ingestion/type-extractors/rust.js +0 -16
  379. package/dist/core/ingestion/type-extractors/shared.d.ts +2 -2
  380. package/dist/core/ingestion/type-extractors/shared.js +25 -11
  381. package/dist/core/ingestion/type-extractors/swift.js +5 -5
  382. package/dist/core/ingestion/type-extractors/types.d.ts +1 -1
  383. package/dist/core/ingestion/type-extractors/typescript.js +1 -1
  384. package/dist/core/ingestion/utils/ast-helpers.d.ts +119 -1
  385. package/dist/core/ingestion/utils/ast-helpers.js +260 -13
  386. package/dist/core/ingestion/utils/callable-labels.d.ts +13 -0
  387. package/dist/core/ingestion/utils/callable-labels.js +14 -0
  388. package/dist/core/ingestion/utils/deferred-resolution-profile.d.ts +10 -0
  389. package/dist/core/ingestion/utils/deferred-resolution-profile.js +30 -0
  390. package/dist/core/ingestion/utils/heap-probe.d.ts +20 -0
  391. package/dist/core/ingestion/utils/heap-probe.js +39 -0
  392. package/dist/core/ingestion/utils/heritage-marker.d.ts +33 -0
  393. package/dist/core/ingestion/utils/heritage-marker.js +41 -0
  394. package/dist/core/ingestion/utils/qualified-name.d.ts +37 -0
  395. package/dist/core/ingestion/utils/qualified-name.js +67 -0
  396. package/dist/core/ingestion/variable-extractors/configs/c-cpp.js +49 -0
  397. package/dist/core/ingestion/variable-extractors/configs/dart.js +76 -62
  398. package/dist/core/ingestion/variable-extractors/configs/go.js +74 -7
  399. package/dist/core/ingestion/variable-extractors/configs/jvm.js +35 -8
  400. package/dist/core/ingestion/variable-extractors/generic.js +40 -12
  401. package/dist/core/ingestion/variable-types.d.ts +9 -0
  402. package/dist/core/ingestion/vue-sfc-extractor.d.ts +97 -7
  403. package/dist/core/ingestion/vue-sfc-extractor.js +433 -11
  404. package/dist/core/ingestion/workers/parse-worker.d.ts +0 -11
  405. package/dist/core/ingestion/workers/parse-worker.js +358 -187
  406. package/dist/core/ingestion/workers/worker-pool.d.ts +78 -9
  407. package/dist/core/ingestion/workers/worker-pool.js +346 -49
  408. package/dist/core/lbug/csv-generator.js +20 -2
  409. package/dist/core/lbug/lbug-adapter.js +29 -10
  410. package/dist/core/lbug/native-check.js +17 -5
  411. package/dist/core/lbug/pool-adapter.d.ts +0 -19
  412. package/dist/core/lbug/pool-adapter.js +40 -77
  413. package/dist/core/lbug/query-result-utils.d.ts +19 -0
  414. package/dist/core/lbug/query-result-utils.js +28 -0
  415. package/dist/core/run-analyze.d.ts +9 -2
  416. package/dist/core/run-analyze.js +24 -3
  417. package/dist/core/tree-sitter/parser-loader.d.ts +13 -0
  418. package/dist/core/tree-sitter/parser-loader.js +4 -0
  419. package/dist/core/tree-sitter/safe-parse.d.ts +70 -3
  420. package/dist/core/tree-sitter/safe-parse.js +214 -11
  421. package/dist/core/wiki/generator.js +13 -5
  422. package/dist/core/wiki/graph-queries.d.ts +3 -0
  423. package/dist/core/wiki/graph-queries.js +9 -1
  424. package/dist/core/wiki/llm-client.d.ts +1 -1
  425. package/dist/core/wiki/llm-client.js +7 -2
  426. package/dist/core/wiki/local-cli-client.d.ts +2 -1
  427. package/dist/core/wiki/local-cli-client.js +62 -4
  428. package/dist/mcp/compatible-stdio-transport.d.ts +3 -0
  429. package/dist/mcp/compatible-stdio-transport.js +22 -0
  430. package/dist/mcp/core/embedder.d.ts +1 -1
  431. package/dist/mcp/core/embedder.js +13 -1
  432. package/dist/mcp/local/local-backend.d.ts +37 -5
  433. package/dist/mcp/local/local-backend.js +227 -129
  434. package/dist/mcp/resources.js +3 -3
  435. package/dist/mcp/server.js +9 -1
  436. package/dist/storage/git.d.ts +11 -0
  437. package/dist/storage/git.js +30 -0
  438. package/dist/storage/parse-cache.d.ts +23 -1
  439. package/dist/storage/parse-cache.js +138 -32
  440. package/dist/storage/parsedfile-store.d.ts +142 -0
  441. package/dist/storage/parsedfile-store.js +367 -0
  442. package/dist/storage/repo-manager.d.ts +2 -1
  443. package/dist/storage/scope-index-store.d.ts +114 -0
  444. package/dist/storage/scope-index-store.js +236 -0
  445. package/dist/types/pipeline.d.ts +6 -3
  446. package/hooks/antigravity/gitnexus-antigravity-hook.cjs +2 -1
  447. package/hooks/claude/gitnexus-hook.cjs +2 -1
  448. package/hooks/claude/resolve-analyze-cmd.cjs +323 -0
  449. package/package.json +4 -5
  450. package/scripts/bench-scope-resolution.ts +1 -3
  451. package/scripts/cross-platform-tests.ts +4 -1
  452. package/skills/gitnexus-cli.md +8 -6
  453. package/skills/gitnexus-debugging.md +15 -15
  454. package/skills/gitnexus-exploring.md +11 -11
  455. package/skills/gitnexus-guide.md +1 -1
  456. package/skills/gitnexus-impact-analysis.md +10 -10
  457. package/skills/gitnexus-pr-review.md +19 -19
  458. package/skills/gitnexus-refactoring.md +25 -25
  459. package/web/assets/{agent-BRX-afm3.js → agent-EkX7webX.js} +156 -131
  460. package/web/assets/{architectureDiagram-UL44E2DR-B1oYB8-c.js → architectureDiagram-UL44E2DR-BoczH8cv.js} +1 -1
  461. package/web/assets/{chunk-LCXTWHL2-SPC6pgWI.js → chunk-LCXTWHL2-By5HB3b-.js} +1 -1
  462. package/web/assets/{chunk-RG4AUYOV-DZXr4Yv3.js → chunk-RG4AUYOV-BQE_DkpL.js} +1 -1
  463. package/web/assets/{classDiagram-KGZ6W3CR-BqpOj8L9.js → classDiagram-KGZ6W3CR-Dj_02GUH.js} +1 -1
  464. package/web/assets/{classDiagram-v2-72OJOZXJ-FmElywK2.js → classDiagram-v2-72OJOZXJ-D-NArMpf.js} +1 -1
  465. package/web/assets/{diagram-3NCE3AQN-BWtJXMDq.js → diagram-3NCE3AQN-VXtXDO95.js} +1 -1
  466. package/web/assets/{diagram-GF46GFSD-Hh-fChxU.js → diagram-GF46GFSD-B1qab2Ah.js} +1 -1
  467. package/web/assets/{diagram-QXG6HAR7-DYeQHxGU.js → diagram-QXG6HAR7-BSCHGzzT.js} +1 -1
  468. package/web/assets/{diagram-WEQXMOUZ-DYGU4T0y.js → diagram-WEQXMOUZ-DHtknmNT.js} +1 -1
  469. package/web/assets/{erDiagram-L5TCEMPS-bN3wlP2A.js → erDiagram-L5TCEMPS-Db-IYTmm.js} +1 -1
  470. package/web/assets/{flowDiagram-H6V6AXG4-YACVtF3-.js → flowDiagram-H6V6AXG4-BHDoyVoW.js} +1 -1
  471. package/web/assets/{index-BhnAdWTt.js → index-BR0IhgbR.js} +10 -10
  472. package/web/assets/{infoDiagram-3YFTVSEB-BWBzD28-.js → infoDiagram-3YFTVSEB-6h8wbWEe.js} +1 -1
  473. package/web/assets/{ishikawaDiagram-BNXS4ZKH-B8qYT-j9.js → ishikawaDiagram-BNXS4ZKH-Dx2OkPk1.js} +1 -1
  474. package/web/assets/{kanban-definition-75IXJCU3-BeoPr5Tl.js → kanban-definition-75IXJCU3-CIIEZfqV.js} +1 -1
  475. package/web/assets/{mindmap-definition-2TDM6QVE-CdLLN_so.js → mindmap-definition-2TDM6QVE-DUAqydRq.js} +1 -1
  476. package/web/assets/{pieDiagram-CU6KROY3-DEd2a_k_.js → pieDiagram-CU6KROY3-BntYuYZa.js} +1 -1
  477. package/web/assets/{requirementDiagram-JXO7QTGE-QNeTo5C_.js → requirementDiagram-JXO7QTGE-QCD6I29n.js} +1 -1
  478. package/web/assets/{sequenceDiagram-VS2MUI6T-BHC7q7yJ.js → sequenceDiagram-VS2MUI6T-DScFwLz2.js} +1 -1
  479. package/web/assets/{stateDiagram-7D4R322I-KONnc2Px.js → stateDiagram-7D4R322I-AkRAm6Hl.js} +1 -1
  480. package/web/assets/{stateDiagram-v2-36443NZ5-C2QfuMlu.js → stateDiagram-v2-36443NZ5-BCK1vigR.js} +1 -1
  481. package/web/assets/{timeline-definition-O6YCAMPW-D4t4NJx1.js → timeline-definition-O6YCAMPW-BvpIVXjX.js} +1 -1
  482. package/web/assets/{vennDiagram-MWXL3ELB-6bctC9Yg.js → vennDiagram-MWXL3ELB-BYGWk6dK.js} +1 -1
  483. package/web/assets/{wardleyDiagram-CUQ6CDDI-BPZYNTvC.js → wardleyDiagram-CUQ6CDDI-Dk1z7H2T.js} +1 -1
  484. package/web/assets/{xychartDiagram-N2JHSOCM-lBI9O6DW.js → xychartDiagram-N2JHSOCM-2N6NCSWN.js} +1 -1
  485. package/web/index.html +1 -1
  486. package/dist/_shared/scope-resolution/shadow/aggregate.d.ts +0 -63
  487. package/dist/_shared/scope-resolution/shadow/aggregate.d.ts.map +0 -1
  488. package/dist/_shared/scope-resolution/shadow/aggregate.js +0 -122
  489. package/dist/_shared/scope-resolution/shadow/aggregate.js.map +0 -1
  490. package/dist/_shared/scope-resolution/shadow/diff.d.ts +0 -59
  491. package/dist/_shared/scope-resolution/shadow/diff.d.ts.map +0 -1
  492. package/dist/_shared/scope-resolution/shadow/diff.js +0 -79
  493. package/dist/_shared/scope-resolution/shadow/diff.js.map +0 -1
  494. package/dist/core/ingestion/ast-cache.d.ts +0 -26
  495. package/dist/core/ingestion/ast-cache.js +0 -48
  496. package/dist/core/ingestion/heritage-extractors/configs/go.d.ts +0 -13
  497. package/dist/core/ingestion/heritage-extractors/configs/go.js +0 -20
  498. package/dist/core/ingestion/heritage-extractors/configs/ruby.d.ts +0 -18
  499. package/dist/core/ingestion/heritage-extractors/configs/ruby.js +0 -65
  500. package/dist/core/ingestion/heritage-extractors/generic.d.ts +0 -23
  501. package/dist/core/ingestion/heritage-extractors/generic.js +0 -47
  502. package/dist/core/ingestion/heritage-processor.d.ts +0 -54
  503. package/dist/core/ingestion/heritage-processor.js +0 -367
  504. package/dist/core/ingestion/heritage-types.d.ts +0 -73
  505. package/dist/core/ingestion/heritage-types.js +0 -2
  506. package/dist/core/ingestion/import-processor.d.ts +0 -23
  507. package/dist/core/ingestion/import-processor.js +0 -377
  508. package/dist/core/ingestion/model/heritage-map.d.ts +0 -105
  509. package/dist/core/ingestion/model/heritage-map.js +0 -294
  510. package/dist/core/ingestion/model/resolution-context.d.ts +0 -93
  511. package/dist/core/ingestion/model/resolution-context.js +0 -337
  512. package/dist/core/ingestion/named-bindings/csharp.d.ts +0 -3
  513. package/dist/core/ingestion/named-bindings/csharp.js +0 -37
  514. package/dist/core/ingestion/named-bindings/java.d.ts +0 -3
  515. package/dist/core/ingestion/named-bindings/java.js +0 -29
  516. package/dist/core/ingestion/named-bindings/kotlin.d.ts +0 -3
  517. package/dist/core/ingestion/named-bindings/kotlin.js +0 -36
  518. package/dist/core/ingestion/named-bindings/php.d.ts +0 -3
  519. package/dist/core/ingestion/named-bindings/php.js +0 -61
  520. package/dist/core/ingestion/named-bindings/python.d.ts +0 -3
  521. package/dist/core/ingestion/named-bindings/python.js +0 -49
  522. package/dist/core/ingestion/named-bindings/rust.d.ts +0 -3
  523. package/dist/core/ingestion/named-bindings/rust.js +0 -66
  524. package/dist/core/ingestion/named-bindings/types.d.ts +0 -16
  525. package/dist/core/ingestion/named-bindings/types.js +0 -6
  526. package/dist/core/ingestion/named-bindings/typescript.d.ts +0 -3
  527. package/dist/core/ingestion/named-bindings/typescript.js +0 -58
  528. package/dist/core/ingestion/pipeline-phases/cross-file-impl.d.ts +0 -17
  529. package/dist/core/ingestion/pipeline-phases/cross-file-impl.js +0 -209
  530. package/dist/core/ingestion/pipeline-phases/orm-extraction.d.ts +0 -22
  531. package/dist/core/ingestion/pipeline-phases/orm-extraction.js +0 -92
  532. package/dist/core/ingestion/pipeline-phases/wildcard-synthesis.d.ts +0 -70
  533. package/dist/core/ingestion/pipeline-phases/wildcard-synthesis.js +0 -312
  534. package/dist/core/ingestion/registry-primary-flag.d.ts +0 -89
  535. package/dist/core/ingestion/registry-primary-flag.js +0 -122
  536. package/dist/core/ingestion/shadow-harness.d.ts +0 -113
  537. package/dist/core/ingestion/shadow-harness.js +0 -148
  538. package/dist/core/ingestion/utils/ruby-self-call.d.ts +0 -52
  539. package/dist/core/ingestion/utils/ruby-self-call.js +0 -59
  540. package/scripts/ci-list-migrated-languages.ts +0 -24
  541. package/scripts/run-parity.ts +0 -128
@@ -25,17 +25,16 @@
25
25
  * `runYourLangScopeResolution(input) = runScopeResolution(input, yourScopeResolver)`.
26
26
  * 3. Register the provider in
27
27
  * `gitnexus/src/core/ingestion/scope-resolution/pipeline/registry.ts`
28
- * (the `SCOPE_RESOLVERS` map).
29
- * 4. Add `SupportedLanguages.YourLang` to `MIGRATED_LANGUAGES` in
30
- * `registry-primary-flag.ts`.
31
- * 5. Verify the resolver integration test at
32
- * `gitnexus/test/integration/resolvers/<lang>.test.ts` passes
33
- * under both `REGISTRY_PRIMARY_<LANG>=0` (legacy) and `=1`
34
- * (registry-primary). The CI parity gate enforces this.
28
+ * (the `SCOPE_RESOLVERS` map). That registration is all it takes — the
29
+ * `scopeResolutionPhase` runs every registered resolver.
30
+ * 4. Verify the resolver integration test at
31
+ * `gitnexus/test/integration/resolvers/<lang>.test.ts` passes (it runs
32
+ * in the standard test suite). Scope-resolution is the only resolution
33
+ * path the legacy call-resolution DAG was removed in RING4-1 #942.
35
34
  *
36
35
  * No new pipeline phase, no orchestrator copy-paste, no workflow
37
- * change. The generic `scopeResolutionPhase` and the CI parity
38
- * workflow auto-discover everything via `MIGRATED_LANGUAGES`.
36
+ * change. The generic `scopeResolutionPhase` auto-discovers everything via
37
+ * the `SCOPE_RESOLVERS` map.
39
38
  *
40
39
  * ## ScopeResolver vs LanguageProvider
41
40
  *
@@ -139,7 +138,19 @@
139
138
  * once per workspace at resolve time), and merging would create a
140
139
  * god-interface that complicates future migrations.
141
140
  *
142
- * - **I8 — Two-channel binding lifecycle.**
141
+ * - **I8 — Binding-channel lifecycle.** Post-finalize binding lookup
142
+ * fans across several channels (`lookupBindingsAt` /
143
+ * `findReceiverTypeBinding` consult them in precedence order):
144
+ * `indexes.bindings` (frozen finalize output), `Scope.bindings`
145
+ * (lexical local, first-tier shadowing), `indexes.bindingAugmentations`
146
+ * (per-scope append-only), `indexes.workspaceFqnBindings` +
147
+ * `indexes.workspaceTypeBindings` (scope-independent / global, consulted
148
+ * unconditionally), and `indexes.namespaceFqnBindings` +
149
+ * `indexes.namespaceTypeBindings` (per-namespace, consulted only for the
150
+ * namespaces in `indexes.accessibleNamespacesByScope` for the caller's
151
+ * module). All but `indexes.bindings` are mutable post-finalize and
152
+ * populated by hooks; only `indexes.bindings` is frozen.
153
+ *
143
154
  * `indexes.bindings` is the **finalize-output channel**. After
144
155
  * `finalizeScopeModel` returns, its inner `BindingRef[]` arrays
145
156
  * are deep-frozen by `materializeBindings` and MUST NOT be
@@ -391,13 +402,88 @@ export interface ScopeResolver {
391
402
  * `include`/`extend`/`prepend`) use this hook to emit IMPLEMENTS edges
392
403
  * from parsed import or reference data.
393
404
  *
394
- * Receives the graph (writable), parsedFiles, and nodeLookup — same
395
- * surface as `buildMro`. Must be idempotent (the orchestrator may call
396
- * it more than once during re-resolution).
405
+ * Receives the graph (writable), parsedFiles, nodeLookup, and the finalized
406
+ * `ScopeResolutionIndexes` the same scope/import/def model
407
+ * `preEmitInheritanceEdges` resolves against, and already a first-class part
408
+ * of this contract (the structure/binding hooks below take it too), so the
409
+ * trailing `scopes` parameter is not a new type dependency here. It is
410
+ * appended and optional so implementations that don't need scope-aware
411
+ * resolution keep their narrower signature.
412
+ *
413
+ * `scopes` has exactly ONE consumer: the Rust resolver — see
414
+ * `emitRustTraitImplEdges` in languages/rust/scope-resolver.ts — which
415
+ * resolves `impl T for S` trait/struct names through the scope chain +
416
+ * import-aware disambiguation (refusing ambiguous matches) instead of a
417
+ * global last-write-wins simple-name index (#1951). Other implementations
418
+ * (e.g. Ruby `include`/`extend`/`prepend`) ignore it and keep the 3-arg
419
+ * shape. Must be idempotent (the orchestrator may call it more than once
420
+ * during re-resolution).
397
421
  *
398
422
  * Default: undefined (no extra heritage edges needed).
399
423
  */
400
- readonly emitHeritageEdges?: (graph: KnowledgeGraph, parsedFiles: readonly ParsedFile[], nodeLookup: GraphNodeLookup) => void;
424
+ readonly emitHeritageEdges?: (graph: KnowledgeGraph, parsedFiles: readonly ParsedFile[], nodeLookup: GraphNodeLookup, scopes?: ScopeResolutionIndexes) => void;
425
+ /**
426
+ * Optional hook to emit IMPORTS edges that no syntactic import
427
+ * statement produces. Some languages grant files implicit visibility
428
+ * of one another within a compilation unit (e.g. every file in a
429
+ * build target sees its siblings' top-level declarations without an
430
+ * explicit import). The generic import pipeline only emits File→File
431
+ * IMPORTS edges from finalized `ImportEdge`s, so a language with this
432
+ * implicit-visibility rule has no edge to emit through that path.
433
+ *
434
+ * Runs immediately after `emitHeritageEdges` (so it shares the same
435
+ * pre-MRO surface: writable graph, parsedFiles, nodeLookup). Must be
436
+ * idempotent — the orchestrator may invoke it more than once during
437
+ * re-resolution. Implementations dedup their own emissions.
438
+ *
439
+ * `resolutionConfig` is the opaque per-workspace value returned by
440
+ * `loadResolutionConfig` (same channel threaded into `resolveImportTarget`).
441
+ * Swift uses it to group same-module files by the SPM target subtree;
442
+ * languages that don't need per-workspace config ignore the trailing
443
+ * parameter (it is optional so existing impls keep compiling).
444
+ *
445
+ * Default: undefined (cross-file visibility requires an explicit
446
+ * import; the finalized-ImportEdge pipeline covers it).
447
+ */
448
+ readonly emitImplicitImportEdges?: (graph: KnowledgeGraph, parsedFiles: readonly ParsedFile[], nodeLookup: GraphNodeLookup, resolutionConfig?: unknown) => void;
449
+ /**
450
+ * Restore capture-time per-file side-channel state that `emitScopeCaptures`
451
+ * produces as a side effect into module-level maps, NOT onto the returned
452
+ * `ParsedFile`. Such state never crosses the worker boundary: in worker-mode
453
+ * parses `emitScopeCaptures` runs inside the worker, so its module-level
454
+ * marks are populated in the WORKER process. The main thread then reuses the
455
+ * serialized `ParsedFile` (see `RunScopeResolutionInput.preExtractedParsedFiles`)
456
+ * and skips `extractParsedFile`, so those marks would otherwise be missing in
457
+ * the main process where resolution consumes them.
458
+ *
459
+ * This hook reads the worker-serialized snapshot from
460
+ * `parsed.captureSideChannel` (produced by the matching
461
+ * `LanguageProvider.collectCaptureSideChannel` hook in the worker) and writes
462
+ * it back into the module maps. It does NO tree-sitter parse and needs no
463
+ * source `content` — that is the whole point of #1983 (the prior re-parse
464
+ * replay re-introduced the main-thread tree-sitter OOM on huge `.h`/`.cpp`
465
+ * repos and was replaced by this data-only restore).
466
+ *
467
+ * C++ is the only language with this pattern today: `emitCppScopeCaptures`
468
+ * records ADL call-site arg shapes, inline-/anonymous-namespace ranges,
469
+ * dependent-base names, and file-local linkage into module maps that
470
+ * `populateOwners` and the ADL / two-phase-lookup passes read on the main
471
+ * thread. Without this restore, all of that is empty on the worker path and
472
+ * advanced C++ resolution (ADL / SFINAE-adjacent / inline-namespace) silently
473
+ * produces zero edges.
474
+ *
475
+ * Called by `runScopeResolution` ONLY for pre-extracted files (the worker
476
+ * already populated the marks in-process for freshly extracted files, so the
477
+ * fresh-extract leg never calls this). Runs BEFORE `populateOwners(parsed)`
478
+ * so the resolved-range Sets it repopulates are visible to that hook.
479
+ *
480
+ * Languages whose `emitScopeCaptures` is pure (the contract default — see
481
+ * `scope-extractor.ts`) leave this undefined; the restore is a no-op for them.
482
+ *
483
+ * @param parsed The pre-extracted ParsedFile being reused. Its
484
+ * `captureSideChannel` carries the worker-computed data.
485
+ */
486
+ readonly applyCaptureSideChannel?: (parsed: ParsedFile) => void;
401
487
  /**
402
488
  * Mutate `parsed.localDefs[i].ownerId` to point at the structural
403
489
  * owner. Python's rule: methods (Function defs whose parent scope
@@ -503,6 +589,15 @@ export interface ScopeResolver {
503
589
  * but is too loose as a default for strict module systems.
504
590
  */
505
591
  readonly allowGlobalFreeCallFallback?: boolean;
592
+ /**
593
+ * When true, a constructor-form call `Type(...)` links to the Class def
594
+ * itself rather than its explicit Constructor def. Default
595
+ * (undefined/false) targets the explicit Constructor when one exists,
596
+ * else falls back to the Class. Languages whose call graph models
597
+ * `Type(...)` as a reference to the type (not its initializer) — e.g.
598
+ * Swift — opt in.
599
+ */
600
+ readonly constructorCallTargetsClass?: boolean;
506
601
  /**
507
602
  * Optional per-slot conversion-rank function for overload resolution.
508
603
  * When provided, `narrowOverloadCandidates` uses ranked scoring as a
@@ -670,6 +765,12 @@ export interface ScopeResolver {
670
765
  readonly treeCache?: {
671
766
  get(filePath: string): unknown;
672
767
  };
768
+ /** Opaque per-workspace value from `loadResolutionConfig` (same
769
+ * channel threaded into `resolveImportTarget`). Swift uses it to
770
+ * group same-module siblings by the SPM target subtree; languages
771
+ * that don't need per-workspace config ignore it. Optional so
772
+ * existing impls keep compiling. */
773
+ readonly resolutionConfig?: unknown;
673
774
  }) => void;
674
775
  /**
675
776
  * Whether the compound-receiver resolver should walk up from a
@@ -705,9 +806,16 @@ export interface ScopeResolver {
705
806
  * `NewUser → User` mirrored from the target package). Runs after
706
807
  * `populateNamespaceSiblings` and before `propagateImportedReturnTypes`
707
808
  * so the SCC-ordered pass sees the mirrored bindings.
809
+ *
810
+ * `resolutionConfig` is the opaque per-workspace value returned by
811
+ * `loadResolutionConfig` (same channel threaded into `resolveImportTarget`).
812
+ * Swift uses it to group same-module sibling files by the SPM target
813
+ * subtree; languages that don't need per-workspace config ignore the
814
+ * trailing parameter (it is optional so existing impls keep compiling).
815
+ *
708
816
  * Default: undefined (no namespace typeBinding mirroring).
709
817
  */
710
- readonly mirrorNamespaceTypeBindings?: (parsedFiles: readonly ParsedFile[], indexes: ScopeResolutionIndexes, workspaceIndex: import('../../scope-resolution/workspace-index.js').WorkspaceResolutionIndex) => void;
818
+ readonly mirrorNamespaceTypeBindings?: (parsedFiles: readonly ParsedFile[], indexes: ScopeResolutionIndexes, workspaceIndex: import('../../scope-resolution/workspace-index.js').WorkspaceResolutionIndex, resolutionConfig?: unknown) => void;
711
819
  /**
712
820
  * Optional: bind for-range loop variables to their element/value types.
713
821
  * Languages like Go need to resolve `for _, v := range m` where `m` is
@@ -722,6 +830,64 @@ export interface ScopeResolver {
722
830
  get(filePath: string): unknown;
723
831
  };
724
832
  }) => void;
833
+ /**
834
+ * Optional hook to expand the set of file paths handed to the scope-
835
+ * resolution run for this language.
836
+ *
837
+ * Called once per language with:
838
+ * - `primaryFilePaths` — files whose `getLanguageFromFilename` === this
839
+ * resolver's `language` (e.g. all `.vue` files).
840
+ * - `preExtractedByPath` — ParsedFile cache from the parse phase.
841
+ * - `entryFileContents` — raw source text of the primary files.
842
+ * - `allScannedPaths` — complete set of paths in the repository.
843
+ * - `resolutionConfig` — language-specific config (tsconfig paths, …).
844
+ *
845
+ * Return value: the full set of paths to include in the scope-resolution
846
+ * run. May be a superset of `primaryFilePaths`.
847
+ *
848
+ * Vue uses this hook to collect the transitive TS/JS import closure of
849
+ * every `.vue` file so that cross-file imports (`import { fn } from './api'`)
850
+ * resolve correctly within a single Vue scope-resolution pass.
851
+ *
852
+ * This hook keeps language-specific scope-context policy inside the language
853
+ * module, preventing shared pipeline code (`phase.ts`) from naming individual
854
+ * languages.
855
+ *
856
+ * Default: undefined (use only `primaryFilePaths`).
857
+ */
858
+ readonly collectScopeContextPaths?: (options: {
859
+ readonly primaryFilePaths: readonly string[];
860
+ readonly preExtractedByPath: ReadonlyMap<string, import('../../../../_shared/index.js').ParsedFile>;
861
+ readonly entryFileContents: ReadonlyMap<string, string>;
862
+ readonly allScannedPaths: ReadonlySet<string>;
863
+ readonly resolutionConfig: unknown;
864
+ }) => Set<string>;
865
+ /**
866
+ * Optional post-resolution hook for emitting language-specific graph edges
867
+ * that cannot be derived from scope captures or import resolution alone.
868
+ *
869
+ * Runs AFTER all standard edge-emission passes (receiver-bound CALLS,
870
+ * free-call fallback, references-via-lookup, and import edges). Receives
871
+ * the fully-resolved graph, all ParsedFiles, the node lookup, the finalized
872
+ * scope indexes, and the raw file-content map.
873
+ *
874
+ * Vue uses this hook to emit:
875
+ * - `CALLS` (`vue-template-component`) for PascalCase component elements
876
+ * - `BINDS_EVENT_HANDLER` for `@event="handler"` on component elements
877
+ * - `EMITS_EVENT` for `emit('eventName', …)` calls in script blocks
878
+ * - `ACCESSES` (`vue-template-attribute`) for `:prop="var"` bindings
879
+ *
880
+ * Unlike `emitImplicitImportEdges` and `emitHeritageEdges` (which run
881
+ * before MRO construction), this hook runs last, after the full graph is
882
+ * populated, so it can safely query node existence and resolved import
883
+ * targets via `indexes.imports`.
884
+ *
885
+ * Default: undefined (no supplementary edges needed).
886
+ */
887
+ readonly emitPostResolutionEdges?: (graph: KnowledgeGraph, parsedFiles: readonly ParsedFile[], nodeLookup: GraphNodeLookup, indexes: ScopeResolutionIndexes, ctx: {
888
+ readonly fileContents: ReadonlyMap<string, string>;
889
+ readonly resolutionConfig?: unknown;
890
+ }) => void;
725
891
  /**
726
892
  * Optional post-resolution pass: emit CALLS edges for member-call sites
727
893
  * whose receiver cannot be typed by the scope chain (no `TypeRef`).
@@ -25,17 +25,16 @@
25
25
  * `runYourLangScopeResolution(input) = runScopeResolution(input, yourScopeResolver)`.
26
26
  * 3. Register the provider in
27
27
  * `gitnexus/src/core/ingestion/scope-resolution/pipeline/registry.ts`
28
- * (the `SCOPE_RESOLVERS` map).
29
- * 4. Add `SupportedLanguages.YourLang` to `MIGRATED_LANGUAGES` in
30
- * `registry-primary-flag.ts`.
31
- * 5. Verify the resolver integration test at
32
- * `gitnexus/test/integration/resolvers/<lang>.test.ts` passes
33
- * under both `REGISTRY_PRIMARY_<LANG>=0` (legacy) and `=1`
34
- * (registry-primary). The CI parity gate enforces this.
28
+ * (the `SCOPE_RESOLVERS` map). That registration is all it takes — the
29
+ * `scopeResolutionPhase` runs every registered resolver.
30
+ * 4. Verify the resolver integration test at
31
+ * `gitnexus/test/integration/resolvers/<lang>.test.ts` passes (it runs
32
+ * in the standard test suite). Scope-resolution is the only resolution
33
+ * path the legacy call-resolution DAG was removed in RING4-1 #942.
35
34
  *
36
35
  * No new pipeline phase, no orchestrator copy-paste, no workflow
37
- * change. The generic `scopeResolutionPhase` and the CI parity
38
- * workflow auto-discover everything via `MIGRATED_LANGUAGES`.
36
+ * change. The generic `scopeResolutionPhase` auto-discovers everything via
37
+ * the `SCOPE_RESOLVERS` map.
39
38
  *
40
39
  * ## ScopeResolver vs LanguageProvider
41
40
  *
@@ -139,7 +138,19 @@
139
138
  * once per workspace at resolve time), and merging would create a
140
139
  * god-interface that complicates future migrations.
141
140
  *
142
- * - **I8 — Two-channel binding lifecycle.**
141
+ * - **I8 — Binding-channel lifecycle.** Post-finalize binding lookup
142
+ * fans across several channels (`lookupBindingsAt` /
143
+ * `findReceiverTypeBinding` consult them in precedence order):
144
+ * `indexes.bindings` (frozen finalize output), `Scope.bindings`
145
+ * (lexical local, first-tier shadowing), `indexes.bindingAugmentations`
146
+ * (per-scope append-only), `indexes.workspaceFqnBindings` +
147
+ * `indexes.workspaceTypeBindings` (scope-independent / global, consulted
148
+ * unconditionally), and `indexes.namespaceFqnBindings` +
149
+ * `indexes.namespaceTypeBindings` (per-namespace, consulted only for the
150
+ * namespaces in `indexes.accessibleNamespacesByScope` for the caller's
151
+ * module). All but `indexes.bindings` are mutable post-finalize and
152
+ * populated by hooks; only `indexes.bindings` is frozen.
153
+ *
143
154
  * `indexes.bindings` is the **finalize-output channel**. After
144
155
  * `finalizeScopeModel` returns, its inner `BindingRef[]` arrays
145
156
  * are deep-frozen by `materializeBindings` and MUST NOT be
@@ -31,6 +31,11 @@ export function mapReferenceKindToEdgeType(kind) {
31
31
  return 'EXTENDS';
32
32
  case 'type-reference':
33
33
  return 'USES';
34
+ // Macro invocations resolve to a `Macro` node (never a function), so
35
+ // they emit `USES` — kept out of the `CALLS` keyspace which denotes
36
+ // function/method dispatch (#1934 review).
37
+ case 'macro':
38
+ return 'USES';
34
39
  case 'import-use':
35
40
  return undefined;
36
41
  default:
@@ -47,7 +52,10 @@ export function mapReferenceKindToEdgeType(kind) {
47
52
  * double-emit a resolution one of them already produced.
48
53
  */
49
54
  export function tryEmitEdge(graph, scopes, nodeLookup, site, targetDef, reason, seen, confidence = 0.85, collapseByCallerTarget = false) {
50
- const callerGraphId = resolveCallerGraphId(site.inScope, scopes, nodeLookup);
55
+ // Inheritance edges are emitted directly by `preEmitInheritanceEdges` (which
56
+ // owns the enclosing-class caller and the EXTENDS-vs-IMPLEMENTS type), so this
57
+ // generic bridge derives caller + edge type purely from the site.
58
+ const callerGraphId = resolveCallerGraphId(site.inScope, scopes, nodeLookup, site.atRange);
51
59
  const targetGraphId = resolveDefGraphId(targetDef.filePath, targetDef, nodeLookup);
52
60
  const edgeType = mapReferenceKindToEdgeType(site.kind);
53
61
  if (callerGraphId === undefined)
@@ -91,7 +99,7 @@ export function tryEmitEdge(graph, scopes, nodeLookup, site, targetDef, reason,
91
99
  * flag honoring, edge-type mapping, caller-id resolution.
92
100
  */
93
101
  export function tryEmitEdgeWithExplicitTargetId(graph, scopes, nodeLookup, site, targetGraphId, reason, seen, confidence = 0.85, collapseByCallerTarget = false) {
94
- const callerGraphId = resolveCallerGraphId(site.inScope, scopes, nodeLookup);
102
+ const callerGraphId = resolveCallerGraphId(site.inScope, scopes, nodeLookup, site.atRange);
95
103
  const edgeType = mapReferenceKindToEdgeType(site.kind);
96
104
  if (callerGraphId === undefined)
97
105
  return false;
@@ -41,8 +41,11 @@ export declare function resolveDefGraphId(filePath: string, def: {
41
41
  type?: NodeLabel;
42
42
  parameterTypes?: readonly string[];
43
43
  parameterTypeClasses?: readonly ParameterTypeClass[];
44
+ parameterCount?: number;
44
45
  templateArguments?: readonly string[];
45
46
  templateConstraints?: unknown;
47
+ /** #1982 bridge-held namespace path; see `SymbolDefinition.namespacePrefix`. */
48
+ namespacePrefix?: string;
46
49
  }, nodeLookup: GraphNodeLookup): string | undefined;
47
50
  /** Derive the simple (unqualified) name of a def from its `qualifiedName`. */
48
51
  export declare function simpleQualifiedName(def: SymbolDefinition): string | undefined;
@@ -57,4 +60,7 @@ export declare function simpleQualifiedName(def: SymbolDefinition): string | und
57
60
  * edge source. Matches legacy DAG behavior where module-level CALLS
58
61
  * edges originate from the file symbol.
59
62
  */
60
- export declare function resolveCallerGraphId(startScope: ScopeId, scopes: ScopeResolutionIndexes, nodeLookup: GraphNodeLookup): string | undefined;
63
+ export declare function resolveCallerGraphId(startScope: ScopeId, scopes: ScopeResolutionIndexes, nodeLookup: GraphNodeLookup, atRange?: {
64
+ startLine: number;
65
+ startCol: number;
66
+ }): string | undefined;
@@ -18,6 +18,7 @@
18
18
  */
19
19
  import { generateId } from '../../../../lib/utils.js';
20
20
  import { qualifiedKey, simpleKey } from '../graph-bridge/node-lookup.js';
21
+ import { isOverloadableCallable } from '../../utils/callable-labels.js';
21
22
  import { templateConstraintsIdTag } from '../../utils/template-arguments.js';
22
23
  import { parameterShapeIdTag } from '../../utils/method-props.js';
23
24
  /**
@@ -48,6 +49,31 @@ function isCallerAnchorLabel(label) {
48
49
  label === 'Struct' ||
49
50
  label === 'Enum');
50
51
  }
52
+ function rangeContainsPoint(range, at) {
53
+ if (at.startLine < range.startLine || at.startLine > range.endLine)
54
+ return false;
55
+ if (at.startLine === range.startLine && at.startCol < range.startCol)
56
+ return false;
57
+ if (at.startLine === range.endLine && at.startCol > range.endCol)
58
+ return false;
59
+ return true;
60
+ }
61
+ /** Pick the callable that owns `atRange` when multiple overloads share a class scope. */
62
+ function pickCallerCallableDef(scope, scopes, atRange) {
63
+ if (atRange !== undefined) {
64
+ for (const childId of scopes.scopeTree.getChildren(scope.id)) {
65
+ const child = scopes.scopeTree.getScope(childId);
66
+ if (child === undefined || child.kind !== 'Function')
67
+ continue;
68
+ if (!rangeContainsPoint(child.range, atRange))
69
+ continue;
70
+ const childCallable = child.ownedDefs.find((d) => d.type === 'Function' || d.type === 'Method' || d.type === 'Constructor');
71
+ if (childCallable !== undefined)
72
+ return childCallable;
73
+ }
74
+ }
75
+ return scope.ownedDefs.find((d) => d.type === 'Function' || d.type === 'Method' || d.type === 'Constructor');
76
+ }
51
77
  /**
52
78
  * Look up a `SymbolDefinition` in the graph node lookup.
53
79
  *
@@ -83,7 +109,7 @@ export function resolveDefGraphId(filePath, def, nodeLookup) {
83
109
  if (cHit !== undefined)
84
110
  return cHit;
85
111
  }
86
- if ((def.type === 'Function' || def.type === 'Method') &&
112
+ if (isOverloadableCallable(def.type) &&
87
113
  def.parameterTypes !== undefined &&
88
114
  def.parameterTypeClasses !== undefined) {
89
115
  const shapeTag = parameterShapeIdTag(def.parameterTypes, def.parameterTypeClasses);
@@ -96,8 +122,12 @@ export function resolveDefGraphId(filePath, def, nodeLookup) {
96
122
  }
97
123
  // Overload disambiguation: when the def carries parameter types,
98
124
  // try the parameter-typed key first so same-name same-arity
99
- // overloads route to their distinct graph nodes.
100
- if ((def.type === 'Function' || def.type === 'Method') &&
125
+ // overloads route to their distinct graph nodes. Constructors are
126
+ // included so a C# `: this(int)` / `: base(int)` chain, a Java
127
+ // `this(int)`/`super(int)` chain, or `new Foo(int)` resolves to the
128
+ // matching ctor overload instead of first-wins collapsing onto
129
+ // another `Foo` ctor (a self-loop) — #1928 F38 / #2046.
130
+ if (isOverloadableCallable(def.type) &&
101
131
  def.parameterTypes !== undefined &&
102
132
  def.parameterTypes.length > 0) {
103
133
  const pKey = qualifiedKey(filePath, def.type, `${qn}~${def.parameterTypes.join(',')}`);
@@ -105,6 +135,16 @@ export function resolveDefGraphId(filePath, def, nodeLookup) {
105
135
  if (pHit !== undefined)
106
136
  return pHit;
107
137
  }
138
+ // Arity-disambiguating key (see node-lookup.ts): route a same-name overload
139
+ // to the structure node with the matching parameter count. Critical for a
140
+ // zero-arg overload (no parameterTypes) that would otherwise collapse onto a
141
+ // sibling overload via the source-order-dependent qualified key.
142
+ if (isOverloadableCallable(def.type) && def.parameterCount !== undefined) {
143
+ const aKey = qualifiedKey(filePath, def.type, `${qn}#${def.parameterCount}`);
144
+ const aHit = nodeLookup.get(aKey);
145
+ if (aHit !== undefined)
146
+ return aHit;
147
+ }
108
148
  if ((def.type === 'Class' ||
109
149
  def.type === 'Struct' ||
110
150
  def.type === 'Interface' ||
@@ -120,6 +160,18 @@ export function resolveDefGraphId(filePath, def, nodeLookup) {
120
160
  const qualifiedHit = nodeLookup.get(qualifiedKey(filePath, def.type, qn));
121
161
  if (qualifiedHit !== undefined)
122
162
  return qualifiedHit;
163
+ // #1982: some scope-extractors qualify a type by its enclosing CLASS chain
164
+ // (`A.Inner`) but drop the enclosing NAMESPACE, while the structure-phase
165
+ // node is keyed by the full path (`NS.A.Inner`). Retry with the
166
+ // namespace-prefixed key (tagged by `tagNamespacePrefixes`) BEFORE the
167
+ // simple-name fallback, so same-tail nested bases don't collapse across
168
+ // sibling namespace members via `simpleKey`.
169
+ const nsPrefix = def.namespacePrefix;
170
+ if (nsPrefix !== undefined && nsPrefix.length > 0) {
171
+ const nsHit = nodeLookup.get(qualifiedKey(filePath, def.type, `${nsPrefix}.${qn}`));
172
+ if (nsHit !== undefined)
173
+ return nsHit;
174
+ }
123
175
  }
124
176
  const simpleName = qn.lastIndexOf('.') === -1 ? qn : qn.slice(qn.lastIndexOf('.') + 1);
125
177
  return nodeLookup.get(simpleKey(filePath, simpleName));
@@ -143,7 +195,7 @@ export function simpleQualifiedName(def) {
143
195
  * edge source. Matches legacy DAG behavior where module-level CALLS
144
196
  * edges originate from the file symbol.
145
197
  */
146
- export function resolveCallerGraphId(startScope, scopes, nodeLookup) {
198
+ export function resolveCallerGraphId(startScope, scopes, nodeLookup, atRange) {
147
199
  let current = startScope;
148
200
  const visited = new Set();
149
201
  let lastFilePath;
@@ -158,9 +210,9 @@ export function resolveCallerGraphId(startScope, scopes, nodeLookup) {
158
210
  // Prefer Function/Method/Constructor anchors; fall back to
159
211
  // Class/Interface/Struct/Enum. Variable/Property are NOT valid
160
212
  // caller anchors — see `isCallerAnchorLabel` for why.
161
- const fnDef = scope.ownedDefs.find((d) => d.type === 'Function' || d.type === 'Method' || d.type === 'Constructor');
213
+ const fnDef = pickCallerCallableDef(scope, scopes, atRange);
162
214
  if (fnDef !== undefined) {
163
- const id = resolveDefGraphId(scope.filePath, fnDef, nodeLookup);
215
+ const id = resolveDefGraphId(fnDef.filePath, fnDef, nodeLookup);
164
216
  if (id !== undefined)
165
217
  return id;
166
218
  }
@@ -17,6 +17,7 @@
17
17
  * `SymbolDefinition.nodeId` values into the legacy graph-node ID
18
18
  * format that downstream consumers (queries, edges, MCP) expect.
19
19
  */
20
+ import { isOverloadableCallable } from '../../utils/callable-labels.js';
20
21
  import { templateConstraintsIdTag } from '../../utils/template-arguments.js';
21
22
  import { parameterShapeIdTag } from '../../utils/method-props.js';
22
23
  /**
@@ -87,18 +88,31 @@ export function buildGraphNodeLookup(graph) {
87
88
  // a parameter-types-suffixed key so resolveDefGraphId can find
88
89
  // the right overload by matching its def's parameterTypes.
89
90
  const pTypes = props.parameterTypes;
90
- if (pTypes !== undefined &&
91
- pTypes.length > 0 &&
92
- (node.label === 'Function' || node.label === 'Method')) {
91
+ if (pTypes !== undefined && pTypes.length > 0 && isOverloadableCallable(node.label)) {
93
92
  const pKey = qualifiedKey(props.filePath, node.label, `${keyQualified}~${pTypes.join(',')}`);
94
93
  // Each overload is unique — set unconditionally.
95
94
  if (!lookup.has(pKey))
96
95
  lookup.set(pKey, node.id);
97
96
  }
97
+ // Arity-disambiguating key: include the parameter count so two same-name
98
+ // overloads of DIFFERENT arity route to distinct graph nodes even when the
99
+ // shorter overload carries no parameter types (e.g. a Kotlin zero-arg
100
+ // secondary constructor vs a 2-arg one — both share the qualified key, whose
101
+ // first-write-wins assignment is source-order-dependent). The structure-phase
102
+ // node id encodes `#<arity>`; this mirrors it in the lookup keyspace so
103
+ // resolveDefGraphId can match by the def's own parameterCount. Same-arity
104
+ // overloads collapse onto one arity key (first-write-wins) — identical to the
105
+ // pre-existing qualified-key behavior, so no regression there.
106
+ const pCount = props.parameterCount;
107
+ if (pCount !== undefined && isOverloadableCallable(node.label)) {
108
+ const aKey = qualifiedKey(props.filePath, node.label, `${keyQualified}#${pCount}`);
109
+ if (!lookup.has(aKey))
110
+ lookup.set(aKey, node.id);
111
+ }
98
112
  const pClasses = props
99
113
  .parameterTypeClasses;
100
114
  const shapeTag = parameterShapeIdTag(pTypes, pClasses);
101
- if (shapeTag !== '' && (node.label === 'Function' || node.label === 'Method')) {
115
+ if (shapeTag !== '' && isOverloadableCallable(node.label)) {
102
116
  const shapeKey = qualifiedKey(props.filePath, node.label, `${keyQualified}${shapeTag}`);
103
117
  if (!lookup.has(shapeKey))
104
118
  lookup.set(shapeKey, node.id);
@@ -159,5 +173,10 @@ export function isLinkableLabel(label) {
159
173
  // `Variable` def for `export const fooService = {...}` to the canonical
160
174
  // `Const:filePath:name` graph node id, against which object-literal
161
175
  // method symbols register their `ownerId` (PR #1718 / issue #1358).
162
- label === 'Const');
176
+ label === 'Const' ||
177
+ // Macro nodes are linkable so a macro invocation (`log!(…)`) resolved
178
+ // via `MacroRegistry` can bridge its scope-resolution `Macro` def to
179
+ // the legacy `@definition.macro` graph node and emit the `USES` edge
180
+ // (Rust #1934 F72; also covers C/C++ `#define` macro defs).
181
+ label === 'Macro');
163
182
  }
@@ -16,7 +16,7 @@
16
16
  * Generic; promoted from `languages/python/scope-resolver.ts` per the scope-resolution
17
17
  * generalization plan.
18
18
  */
19
- import type { ParsedFile, Reference, ScopeId, SymbolDefinition } from '../../../../_shared/index.js';
19
+ import type { ParameterTypeClass, ParsedFile, Reference, ScopeId, SymbolDefinition } from '../../../../_shared/index.js';
20
20
  import type { KnowledgeGraph } from '../../../graph/types.js';
21
21
  import type { ScopeResolutionIndexes } from '../../model/scope-resolution-indexes.js';
22
22
  import type { SemanticModel } from '../../model/semantic-model.js';
@@ -29,6 +29,9 @@ export declare function emitFreeCallFallback(graph: KnowledgeGraph, scopes: Scop
29
29
  readonly bySourceScope: ReadonlyMap<ScopeId, readonly Reference[]>;
30
30
  }, handledSites: Set<string>, model: SemanticModel, workspaceIndex: WorkspaceResolutionIndex, options?: {
31
31
  readonly allowGlobalFallback?: boolean;
32
+ /** When true, `Type(...)` constructor calls link to the Class def
33
+ * itself rather than its explicit Constructor. Swift opts in. */
34
+ readonly constructorCallTargetsClass?: boolean;
32
35
  readonly isFileLocalDef?: (def: SymbolDefinition) => boolean;
33
36
  readonly isCallableVisibleFromCaller?: (ctx: {
34
37
  readonly callerParsed: ParsedFile;
@@ -54,6 +57,70 @@ export declare function emitFreeCallFallback(graph: KnowledgeGraph, scopes: Scop
54
57
  readonly constraintCompatibility?: ScopeResolver['constraintCompatibility'];
55
58
  readonly recordResolutionOutcome?: ResolutionOutcomeRecorder;
56
59
  }): number;
60
+ /**
61
+ * Build a `simpleName -> callable defs` index from `scopes.defs` once per
62
+ * pass. Mirrors the filter the old per-site scan applied: Function /
63
+ * Method / Constructor, keyed by the last `.`-segment of `qualifiedName`
64
+ * (falling back to the qualifiedName itself when undotted). Used by
65
+ * `pickUniqueGlobalCallable` so every free-call fallback site is O(1)
66
+ * instead of O(|defs|).
67
+ *
68
+ * Exported for unit testing — language-agnostic logic, exercised via synthetic
69
+ * stubs in `pick-unique-global-callable.test.ts`.
70
+ */
71
+ export declare function buildGlobalCallableIndex(scopes: ScopeResolutionIndexes): ReadonlyMap<string, readonly SymbolDefinition[]>;
72
+ /**
73
+ * Build a `simpleName -> class-like defs` index from `scopes.defs` once per
74
+ * pass — the structural sibling of `buildGlobalCallableIndex`, consumed by
75
+ * `pickUniqueGlobalClass` so constructor-form fallback is O(1)-per-site
76
+ * instead of O(|defs|).
77
+ *
78
+ * **Kind filter (KTD5 — KEEP `'Interface'`):** the set is
79
+ * `Class | Struct | Interface`, matching the idiomatic class-like set used
80
+ * elsewhere in the scope-resolution bridge (`graph-bridge/ids.ts`,
81
+ * `node-lookup.ts`). This is a behavior-PRESERVING perf refactor for all 8
82
+ * `allowGlobalFreeCallFallback` languages — the previous per-site scan used
83
+ * exactly this filter. Excluding Swift `protocol` (`Interface`) defs because
84
+ * protocols aren't instantiable is a *separate* Swift-semantics question with
85
+ * its own test; dropping `Interface` here would be a deliberate
86
+ * behavior-changing edit, not part of U5.
87
+ *
88
+ * Bucket insertion order follows `defs.byId.values()` iteration order, so the
89
+ * downstream "keep first" / ambiguity ordering in `pickUniqueGlobalClass` is
90
+ * byte-identical to the old linear scan (equivalence verified).
91
+ *
92
+ * Exported for unit testing — language-agnostic logic, exercised via synthetic
93
+ * stubs in `pick-unique-global-class.test.ts`.
94
+ */
95
+ export declare function buildGlobalClassIndex(scopes: ScopeResolutionIndexes): ReadonlyMap<string, readonly SymbolDefinition[]>;
96
+ /**
97
+ * Resolve a free (unqualified, receiver-less) call to a globally-unique
98
+ * callable def by simple name. See the in-body comments for the narrowing
99
+ * order. Exported for unit testing — the `scopeDefsCache` equivalence is
100
+ * exercised via synthetic stubs in `pick-unique-global-callable.test.ts`.
101
+ */
102
+ export declare function pickUniqueGlobalCallable(name: string, model: SemanticModel, globalCallablesBySimpleName: ReadonlyMap<string, readonly SymbolDefinition[]>, callerFilePath: string, isFileLocalDef?: (def: SymbolDefinition) => boolean, callArity?: number, isCallerVisible?: (candidate: SymbolDefinition) => boolean, callArgTypes?: readonly string[], callArgTypeClasses?: readonly ParameterTypeClass[], conversionRankFn?: ConversionRankFn, scopeDefsCache?: Map<string, readonly SymbolDefinition[]>): SymbolDefinition | undefined;
103
+ /** Find a unique workspace-wide class-like def by simple name, for a
104
+ * constructor-form call `Type(...)` whose type lives outside the call
105
+ * site's lexical bindings (a sibling/imported file). Returns the def
106
+ * only when all matches share ONE qualified name — i.e. they are
107
+ * fragments of a single logical type (partial classes / extensions
108
+ * that re-key onto the same type), which resolve to the same graph
109
+ * node. Genuinely distinct types with the same simple name are
110
+ * ambiguous and leave the call unresolved rather than guessing. Gated
111
+ * by the caller on `allowGlobalFallback`, mirroring
112
+ * `pickUniqueGlobalCallable`.
113
+ *
114
+ * Consumes the once-built `buildGlobalClassIndex` (`simpleName ->
115
+ * class-like defs`) so each call site is O(1) rather than O(|defs|).
116
+ * The index's `Class | Struct | Interface` kind filter is intentionally
117
+ * KEPT (KTD5) — see `buildGlobalClassIndex` for why dropping `Interface`
118
+ * would be a separate, behavior-changing Swift-semantics edit.
119
+ *
120
+ * Exported for unit testing — language-agnostic logic, exercised via
121
+ * synthetic stubs in `pick-unique-global-class.test.ts`. The production
122
+ * call site is the constructor-form fallback in `emitFreeCallFallback`. */
123
+ export declare function pickUniqueGlobalClass(name: string, index: ReadonlyMap<string, readonly SymbolDefinition[]>): SymbolDefinition | undefined;
57
124
  /** Walk up from the call-site scope to the enclosing class scope,
58
125
  * pick a method member by name with overload narrowing on arity +
59
126
  * argument types. Returns undefined if there's no enclosing class,