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
@@ -38,6 +38,10 @@ const GO_SCOPE_QUERY = `
38
38
  (method_declaration
39
39
  name: (field_identifier) @declaration.name) @declaration.method
40
40
 
41
+ ;; Declarations — interface methods
42
+ (method_elem
43
+ name: (field_identifier) @declaration.name) @declaration.method
44
+
41
45
  ;; Declarations — struct fields
42
46
  (struct_type
43
47
  (field_declaration_list
@@ -48,11 +52,15 @@ const GO_SCOPE_QUERY = `
48
52
  ;; Declarations — variables
49
53
  (var_declaration
50
54
  (var_spec
51
- name: (identifier) @declaration.name)) @declaration.variable
55
+ (identifier) @declaration.name)) @declaration.variable
56
+ (var_declaration
57
+ (var_spec_list
58
+ (var_spec
59
+ (identifier) @declaration.name))) @declaration.variable
52
60
 
53
61
  (const_declaration
54
62
  (const_spec
55
- name: (identifier) @declaration.name)) @declaration.const
63
+ (identifier) @declaration.name)) @declaration.const
56
64
 
57
65
  (short_var_declaration
58
66
  left: (expression_list (identifier) @declaration.name)) @declaration.variable
@@ -66,21 +74,21 @@ const GO_SCOPE_QUERY = `
66
74
  parameters: (parameter_list
67
75
  (parameter_declaration
68
76
  name: (identifier) @type-binding.name
69
- type: [(type_identifier) (qualified_type) (pointer_type) (slice_type) (map_type)] @type-binding.type))) @type-binding.parameter
77
+ type: [(type_identifier) (qualified_type) (pointer_type) (slice_type) (map_type) (channel_type) (array_type) (function_type) (interface_type) (generic_type)] @type-binding.type))) @type-binding.parameter
70
78
 
71
79
  (method_declaration
72
80
  name: (field_identifier) @_fn_name
73
81
  parameters: (parameter_list
74
82
  (parameter_declaration
75
83
  name: (identifier) @type-binding.name
76
- type: [(type_identifier) (qualified_type) (pointer_type) (slice_type) (map_type)] @type-binding.type))) @type-binding.parameter
84
+ type: [(type_identifier) (qualified_type) (pointer_type) (slice_type) (map_type) (channel_type) (array_type) (function_type) (interface_type) (generic_type)] @type-binding.type))) @type-binding.parameter
77
85
 
78
86
  ;; Type bindings — constructor-inferred (:= T{})
79
87
  (short_var_declaration
80
88
  left: (expression_list (identifier) @type-binding.name)
81
89
  right: (expression_list
82
90
  (composite_literal
83
- type: [(type_identifier) (qualified_type)] @type-binding.type))) @type-binding.constructor
91
+ type: [(type_identifier) (qualified_type) (generic_type)] @type-binding.type))) @type-binding.constructor
84
92
 
85
93
  ;; Type bindings — pointer constructor (:= &T{})
86
94
  (short_var_declaration
@@ -89,7 +97,7 @@ const GO_SCOPE_QUERY = `
89
97
  (unary_expression
90
98
  "&"
91
99
  operand: (composite_literal
92
- type: [(type_identifier) (qualified_type)] @type-binding.type)))) @type-binding.constructor
100
+ type: [(type_identifier) (qualified_type) (generic_type)] @type-binding.type)))) @type-binding.constructor
93
101
 
94
102
  ;; Type bindings — type assertion (:= s.(T))
95
103
  (short_var_declaration
@@ -164,7 +172,7 @@ const GO_SCOPE_QUERY = `
164
172
 
165
173
  ;; References — constructor calls (T{})
166
174
  (composite_literal
167
- type: [(type_identifier) (qualified_type)] @reference.name) @reference.call.constructor
175
+ type: [(type_identifier) (qualified_type) (generic_type)] @reference.name) @reference.call.constructor
168
176
 
169
177
  ;; References — field reads
170
178
  (selector_expression
@@ -1,6 +1,7 @@
1
1
  import { getGoParser } from './query.js';
2
2
  import { getTreeSitterBufferSize } from '../../constants.js';
3
- import { parseSourceSafe } from '../../../tree-sitter/safe-parse.js';
3
+ import { parseSourceSafe, ParseTimeoutError } from '../../../tree-sitter/safe-parse.js';
4
+ import { logger } from '../../../logger.js';
4
5
  export function populateGoRangeBindings(parsedFiles, _indexes, ctx) {
5
6
  const parser = getGoParser();
6
7
  for (const parsed of parsedFiles) {
@@ -8,10 +9,24 @@ export function populateGoRangeBindings(parsedFiles, _indexes, ctx) {
8
9
  if (sourceText === undefined)
9
10
  continue;
10
11
  const cachedTree = ctx.treeCache?.get(parsed.filePath);
11
- const tree = cachedTree ??
12
- parseSourceSafe(parser, sourceText, undefined, {
13
- bufferSize: getTreeSitterBufferSize(sourceText),
14
- });
12
+ let tree;
13
+ if (cachedTree !== undefined) {
14
+ tree = cachedTree;
15
+ }
16
+ else {
17
+ try {
18
+ tree = parseSourceSafe(parser, sourceText, undefined, {
19
+ bufferSize: getTreeSitterBufferSize(sourceText),
20
+ });
21
+ }
22
+ catch (err) {
23
+ if (err instanceof ParseTimeoutError) {
24
+ logger.warn({ file: parsed.filePath }, 'go range-binding: parse timed out, skipping file');
25
+ continue;
26
+ }
27
+ throw err;
28
+ }
29
+ }
15
30
  const moduleScope = parsed.scopes.find((s) => s.kind === 'Module');
16
31
  if (moduleScope === undefined)
17
32
  continue;
@@ -39,9 +54,10 @@ export function populateGoRangeBindings(parsedFiles, _indexes, ctx) {
39
54
  continue;
40
55
  // Resolve range expression type
41
56
  let elementType = null;
57
+ const functionScope = findEnclosingFunctionScope(rangeNode, scopeMap);
42
58
  if (rangeExpr.type === 'identifier') {
43
- // Look up the identifier's type in scope typeBindings (V1: module scope only)
44
- const binding = moduleScope.typeBindings.get(rangeExpr.text);
59
+ const binding = functionScope?.typeBindings.get(rangeExpr.text) ??
60
+ moduleScope.typeBindings.get(rangeExpr.text);
45
61
  if (binding !== null && binding !== undefined) {
46
62
  elementType = extractElementType(binding);
47
63
  }
@@ -62,7 +78,6 @@ export function populateGoRangeBindings(parsedFiles, _indexes, ctx) {
62
78
  }
63
79
  if (elementType !== null && valueVar !== null) {
64
80
  // Inject type binding for the range variable onto the enclosing function scope
65
- const functionScope = findEnclosingFunctionScope(rangeNode, scopeMap);
66
81
  const targetScope = functionScope ?? moduleScope;
67
82
  const mutable = targetScope.typeBindings;
68
83
  mutable.set(valueVar, {
@@ -96,7 +111,7 @@ function findEnclosingFunctionScope(node, scopeMap) {
96
111
  // same line/column as the tree-sitter node.
97
112
  for (const scope of scopeMap.values()) {
98
113
  if (scope.kind === 'Function' &&
99
- scope.range.startLine === current.startPosition.row &&
114
+ scope.range.startLine === current.startPosition.row + 1 &&
100
115
  scope.range.startCol === current.startPosition.column) {
101
116
  return scope;
102
117
  }
@@ -12,7 +12,7 @@ export function synthesizeGoReceiverBinding(fnNode) {
12
12
  const typeNode = param.childForFieldName('type');
13
13
  if (nameNode === null || typeNode === null)
14
14
  return null;
15
- const typeName = typeNode.text.replace(/^\*/, '');
15
+ const typeName = typeNode.text;
16
16
  return {
17
17
  '@type-binding.self': syntheticCapture('@type-binding.self', fnNode, nameNode.text),
18
18
  '@type-binding.name': syntheticCapture('@type-binding.name', nameNode, nameNode.text),
@@ -26,8 +26,8 @@ export const goScopeResolver = {
26
26
  allowGlobalFreeCallFallback: true,
27
27
  populateNamespaceSiblings: populateGoPackageSiblings,
28
28
  mirrorNamespaceTypeBindings: mirrorGoNamespaceTypeBindings,
29
- // Staged/V2: registered but not yet wired in run.ts — method-name-only
30
- // matching produces false IMPLEMENTS edges; awaits signature-level comparison.
29
+ // Go has structural interfaces: implementations are inferred by signature,
30
+ // then fed into generic MRO/interface-dispatch.
31
31
  detectInterfaceImplementations: detectGoInterfaceImplementations,
32
32
  populateRangeBindings: populateGoRangeBindings,
33
33
  };
@@ -1,8 +1,9 @@
1
1
  export function goBindingScopeFor(decl, innermost, _tree) {
2
- // Keep self typeBindings in the method's Function scope (prevent
3
- // auto-hoist to Module) so populateGoOwners can match Method defs
4
- // to their receiver types by inspecting each Function scope.
5
- if (decl['@type-binding.self'] !== undefined) {
2
+ // Keep receiver and parameter typeBindings in the function scope
3
+ // (prevent auto-hoist to Module). Parameters are local variables:
4
+ // hoisting `repo Repository` from one function to module scope can
5
+ // pollute another function's local receiver resolution.
6
+ if (decl['@type-binding.self'] !== undefined || decl['@type-binding.parameter'] !== undefined) {
6
7
  return innermost.id;
7
8
  }
8
9
  return null; // default auto-hoist for other bindings
@@ -15,7 +16,11 @@ export function goReceiverBinding(functionScope) {
15
16
  return null;
16
17
  for (const binding of functionScope.typeBindings.values()) {
17
18
  if (binding.source === 'self')
18
- return binding;
19
+ return normalizeGoSelfTypeRef(binding);
19
20
  }
20
21
  return null;
21
22
  }
23
+ function normalizeGoSelfTypeRef(binding) {
24
+ const rawName = binding.rawName.replace(/^\*+/, '').trim();
25
+ return rawName === binding.rawName ? binding : { ...binding, rawName };
26
+ }
@@ -1,3 +1,4 @@
1
1
  import type { CaptureMatch } from '../../../../_shared/index.js';
2
2
  import { type SyntaxNode } from '../../utils/ast-helpers.js';
3
3
  export declare function synthesizeGoTypeBindings(rootNode: SyntaxNode): CaptureMatch[];
4
+ export declare function extractSimpleTypeNameText(node: SyntaxNode): string;
@@ -1,6 +1,28 @@
1
1
  import { syntheticCapture } from '../../utils/ast-helpers.js';
2
+ const COMPOSITE_LITERAL_TYPE_NODE_TYPES = new Set([
3
+ 'type_identifier',
4
+ 'qualified_type',
5
+ 'generic_type',
6
+ ]);
2
7
  export function synthesizeGoTypeBindings(rootNode) {
3
8
  const out = [];
9
+ for (const node of rootNode.descendantsOfType('var_spec')) {
10
+ const name = node.childForFieldName('name');
11
+ const value = node.childForFieldName('value');
12
+ if (name?.type !== 'identifier' || value === null)
13
+ continue;
14
+ const rhsExpr = value.namedChildren[0];
15
+ if (rhsExpr === undefined)
16
+ continue;
17
+ const typeNode = extractCompositeLiteralTypeNode(rhsExpr);
18
+ if (typeNode === null)
19
+ continue;
20
+ out.push({
21
+ '@type-binding.constructor': syntheticCapture('@type-binding.constructor', node, node.text),
22
+ '@type-binding.name': syntheticCapture('@type-binding.name', name, name.text),
23
+ '@type-binding.type': syntheticCapture('@type-binding.type', typeNode, extractSimpleTypeNameText(typeNode)),
24
+ });
25
+ }
4
26
  for (const node of rootNode.descendantsOfType('short_var_declaration')) {
5
27
  const right = node.childForFieldName('right');
6
28
  if (right === null)
@@ -189,18 +211,34 @@ function synthesizeElementAccessBindings(rootNode, out) {
189
211
  }
190
212
  }
191
213
  }
192
- function extractSimpleTypeNameText(node) {
214
+ export function extractSimpleTypeNameText(node) {
193
215
  if (node.type === 'qualified_type') {
194
216
  const parts = node.text.split('.');
195
217
  return parts[parts.length - 1] ?? node.text;
196
218
  }
219
+ if (node.type === 'generic_type') {
220
+ const base = node.childForFieldName('type');
221
+ return base === null ? node.text : extractSimpleTypeNameText(base);
222
+ }
197
223
  return node.text;
198
224
  }
199
225
  /** Extract the type/signature node from a RHS expression. */
226
+ function extractCompositeLiteralTypeNode(expr) {
227
+ if (expr.type === 'composite_literal') {
228
+ return (expr.childForFieldName('type') ??
229
+ expr.namedChildren.find((c) => COMPOSITE_LITERAL_TYPE_NODE_TYPES.has(c.type)) ??
230
+ null);
231
+ }
232
+ if (expr.type === 'unary_expression') {
233
+ const operand = expr.childForFieldName('operand');
234
+ return operand === null ? null : extractCompositeLiteralTypeNode(operand);
235
+ }
236
+ return null;
237
+ }
200
238
  function extractTypeNode(expr) {
201
239
  if (expr.type === 'composite_literal') {
202
240
  return (expr.childForFieldName('type') ??
203
- expr.namedChildren.find((c) => ['type_identifier', 'qualified_type'].includes(c.type)) ??
241
+ expr.namedChildren.find((c) => COMPOSITE_LITERAL_TYPE_NODE_TYPES.has(c.type)) ??
204
242
  null);
205
243
  }
206
244
  if (expr.type === 'unary_expression') {
@@ -5,7 +5,6 @@
5
5
  * LanguageProvider, following the Strategy pattern used by the pipeline.
6
6
  *
7
7
  * Key Go traits:
8
- * - importSemantics: 'wildcard-leaf' (Go imports entire packages)
9
8
  * - callRouter: present (Go method calls may need routing)
10
9
  */
11
10
  export declare const goProvider: import("../language-provider.js").LanguageProvider;
@@ -5,7 +5,6 @@
5
5
  * LanguageProvider, following the Strategy pattern used by the pipeline.
6
6
  *
7
7
  * Key Go traits:
8
- * - importSemantics: 'wildcard-leaf' (Go imports entire packages)
9
8
  * - callRouter: present (Go method calls may need routing)
10
9
  */
11
10
  import { SupportedLanguages } from '../../../_shared/index.js';
@@ -25,8 +24,6 @@ import { createVariableExtractor } from '../variable-extractors/generic.js';
25
24
  import { goVariableConfig } from '../variable-extractors/configs/go.js';
26
25
  import { createCallExtractor } from '../call-extractors/generic.js';
27
26
  import { goCallConfig } from '../call-extractors/configs/go.js';
28
- import { createHeritageExtractor } from '../heritage-extractors/generic.js';
29
- import { goHeritageConfig } from '../heritage-extractors/configs/go.js';
30
27
  import { emitGoScopeCaptures, goArityCompatibility, goBindingScopeFor, goImportOwningScope, goReceiverBinding, interpretGoImport, interpretGoTypeBinding, } from './go/index.js';
31
28
  const GO_BUILT_INS = new Set([
32
29
  // built-in functions
@@ -123,13 +120,11 @@ export const goProvider = defineLanguage({
123
120
  typeConfig: goConfig,
124
121
  exportChecker: goExportChecker,
125
122
  importResolver: createImportResolver(goImportConfig),
126
- importSemantics: 'wildcard-leaf',
127
123
  callExtractor: createCallExtractor(goCallConfig),
128
124
  fieldExtractor: createFieldExtractor(goFieldConfig),
129
125
  methodExtractor: createMethodExtractor(goMethodConfig),
130
126
  variableExtractor: createVariableExtractor(goVariableConfig),
131
127
  classExtractor: createClassExtractor(goClassConfig),
132
- heritageExtractor: createHeritageExtractor(goHeritageConfig),
133
128
  builtInNames: GO_BUILT_INS,
134
129
  // ── RFC #909 Ring 3: scope-based resolution hooks ──────────
135
130
  emitScopeCaptures: emitGoScopeCaptures,
@@ -32,8 +32,3 @@ export declare function getProvider(language: SupportedLanguages): LanguageProvi
32
32
  /** Look up a language provider from a file path by extension.
33
33
  * Returns null if the file extension is not recognized. */
34
34
  export declare function getProviderForFile(filePath: string): LanguageProvider | null;
35
- /** Pre-computed list of providers that have implicit import wiring (e.g., Swift).
36
- * Built once at module load — avoids iterating all 13 providers per call. */
37
- export declare const providersWithImplicitWiring: (LanguageProvider & {
38
- implicitImportWirer: NonNullable<LanguageProvider["implicitImportWirer"]>;
39
- })[];
@@ -61,6 +61,3 @@ export function getProviderForFile(filePath) {
61
61
  const basename = filePath.slice(filePath.lastIndexOf('/') + 1);
62
62
  return extensionMap.get(ext) ?? extensionMap.get(basename) ?? null;
63
63
  }
64
- /** Pre-computed list of providers that have implicit import wiring (e.g., Swift).
65
- * Built once at module load — avoids iterating all 13 providers per call. */
66
- export const providersWithImplicitWiring = Object.values(providers).filter((p) => p.implicitImportWirer != null);
@@ -13,7 +13,7 @@
13
13
  *
14
14
  * Pure given the input source text. No I/O, no globals consulted.
15
15
  */
16
- import { findNodeAtRange, nodeToCapture, syntheticCapture } from '../../utils/ast-helpers.js';
16
+ import { nodeIfType, nodeToCapture, syntheticCapture } from '../../utils/ast-helpers.js';
17
17
  import { splitImportDeclaration } from './import-decomposer.js';
18
18
  import { computeJavaArityMetadata } from './arity-metadata.js';
19
19
  import { synthesizeJavaReceiverBinding } from './receiver-binding.js';
@@ -54,16 +54,26 @@ export function emitJavaScopeCaptures(sourceText, _filePath, cachedTree) {
54
54
  const out = [];
55
55
  for (const m of rawMatches) {
56
56
  const grouped = {};
57
+ // Parallel tag -> captured SyntaxNode map. The tree-sitter query already
58
+ // hands us each matched node as `c.node`, so anchors resolve via a
59
+ // type-guarded lookup (`nodeIfType`) instead of re-deriving them with
60
+ // `findNodeAtRange(tree.rootNode, ...)` per match — the
61
+ // O(matches × rootChildren) root-walk fixed for go #1848 / python #1918 /
62
+ // rust/csharp #1915, mirrored here for java (#1951). Every Java scope-query
63
+ // anchor below captures directly ON the node the old root-walk re-derived
64
+ // (verified against JAVA_SCOPE_QUERY in query.ts), so the type check is exact.
65
+ const nodeMap = {};
57
66
  for (const c of m.captures) {
58
67
  const tag = '@' + c.name;
59
68
  grouped[tag] = nodeToCapture(tag, c.node);
69
+ nodeMap[tag] = c.node;
60
70
  }
61
71
  if (Object.keys(grouped).length === 0)
62
72
  continue;
63
- // Decompose each `import_declaration`.
73
+ // Decompose each `import_declaration`. `@import.statement` is captured
74
+ // directly on the `import_declaration` node.
64
75
  if (grouped['@import.statement'] !== undefined) {
65
- const stmtCapture = grouped['@import.statement'];
66
- const stmtNode = findNodeAtRange(tree.rootNode, stmtCapture.range, 'import_declaration');
76
+ const stmtNode = nodeIfType(nodeMap['@import.statement'], 'import_declaration');
67
77
  if (stmtNode !== null) {
68
78
  const decomposed = splitImportDeclaration(stmtNode);
69
79
  if (decomposed !== null) {
@@ -86,9 +96,9 @@ export function emitJavaScopeCaptures(sourceText, _filePath, cachedTree) {
86
96
  continue;
87
97
  }
88
98
  // Filter read.member when it's a child of method_invocation or assignment.
99
+ // `@reference.read.member` is captured directly on the `field_access` node.
89
100
  if (grouped['@reference.read.member'] !== undefined) {
90
- const anchor = grouped['@reference.read.member'];
91
- const memberNode = findNodeAtRange(tree.rootNode, anchor.range, 'field_access');
101
+ const memberNode = nodeIfType(nodeMap['@reference.read.member'], 'field_access');
92
102
  if (memberNode === null || !shouldEmitReadMember(memberNode)) {
93
103
  continue;
94
104
  }
@@ -97,8 +107,8 @@ export function emitJavaScopeCaptures(sourceText, _filePath, cachedTree) {
97
107
  // instance method-like.
98
108
  if (grouped['@scope.function'] !== undefined) {
99
109
  out.push(grouped);
100
- const anchor = grouped['@scope.function'];
101
- const fnNode = findFunctionNode(tree.rootNode, anchor.range);
110
+ // `@scope.function` is captured directly on the method/constructor node.
111
+ const fnNode = findFunctionNode(nodeMap['@scope.function']);
102
112
  if (fnNode !== null) {
103
113
  for (const synth of synthesizeJavaReceiverBinding(fnNode)) {
104
114
  out.push(synth);
@@ -109,8 +119,9 @@ export function emitJavaScopeCaptures(sourceText, _filePath, cachedTree) {
109
119
  // Synthesize arity metadata on function-like declarations.
110
120
  const declTag = FUNCTION_DECL_TAGS.find((t) => grouped[t] !== undefined);
111
121
  if (declTag !== undefined) {
112
- const anchor = grouped[declTag];
113
- const fnNode = findFunctionNode(tree.rootNode, anchor.range);
122
+ // FUNCTION_DECL_TAGS (@declaration.method/.constructor) are captured
123
+ // directly on the method/constructor node.
124
+ const fnNode = findFunctionNode(nodeMap[declTag]);
114
125
  if (fnNode !== null) {
115
126
  const arity = computeJavaArityMetadata(fnNode);
116
127
  if (arity.parameterCount !== undefined) {
@@ -127,14 +138,18 @@ export function emitJavaScopeCaptures(sourceText, _filePath, cachedTree) {
127
138
  // Synthesize `@reference.arity` on every callsite.
128
139
  const callTag = ['@reference.call.free', '@reference.call.member', '@reference.call.constructor'].find((t) => grouped[t] !== undefined);
129
140
  if (callTag !== undefined && grouped['@reference.arity'] === undefined) {
130
- const anchor = grouped[callTag];
131
- const callNode = findNodeAtRange(tree.rootNode, anchor.range, 'method_invocation') ??
132
- findNodeAtRange(tree.rootNode, anchor.range, 'object_creation_expression');
141
+ // @reference.call.free/.member are captured on the `method_invocation`;
142
+ // @reference.call.constructor on the `object_creation_expression`. The
143
+ // captured node IS the call node the old findNodeAtRange re-derived.
144
+ const callNode = nodeIfType(nodeMap[callTag], 'method_invocation', 'object_creation_expression');
133
145
  if (callNode !== null) {
134
146
  const argList = callNode.childForFieldName('arguments');
147
+ // Exclude interleaved comments — tree-sitter-java emits `block_comment` /
148
+ // `line_comment` as named children of argument_list, which would inflate
149
+ // arity (and arity feeds call-processor symbol-ID generation). #1920
135
150
  const args = argList === null
136
151
  ? []
137
- : argList.namedChildren.filter((c) => c !== null && c.type !== 'comment');
152
+ : argList.namedChildren.filter((c) => c !== null && c.type !== 'block_comment' && c.type !== 'line_comment');
138
153
  grouped['@reference.arity'] = syntheticCapture('@reference.arity', callNode, String(args.length));
139
154
  const argTypes = args.map((arg) => inferArgType(arg));
140
155
  grouped['@reference.parameter-types'] = syntheticCapture('@reference.parameter-types', callNode, JSON.stringify(argTypes));
@@ -146,7 +161,217 @@ export function emitJavaScopeCaptures(sourceText, _filePath, cachedTree) {
146
161
  }
147
162
  out.push(grouped);
148
163
  }
149
- return resolveVarTypeBindings(out);
164
+ return [
165
+ ...resolveVarTypeBindings(out),
166
+ ...synthesizeJavaInheritanceReferences(tree.rootNode),
167
+ ...synthesizeJavaExplicitConstructorReferences(tree.rootNode),
168
+ ];
169
+ }
170
+ /**
171
+ * Synthesize `@reference.call.constructor` captures for explicit constructor
172
+ * invocations — `super(...)` and `this(...)` (F38 #1928). tree-sitter-java
173
+ * models these as `explicit_constructor_invocation` nodes, which the scope
174
+ * query does not match, so the chained-constructor CALLS edges (subclass ctor →
175
+ * superclass ctor; ctor → sibling overload) were silently dropped.
176
+ *
177
+ * The grammar gives no constructor *name* at the call site (the child is a bare
178
+ * `(super)` / `(this)` token), so the target name is resolved structurally:
179
+ * - `this(...)` → the enclosing type's own simple name (constructor symbols
180
+ * are keyed by the declaring class name).
181
+ * - `super(...)` → the enclosing class's superclass simple-name tail (reusing
182
+ * `javaBaseLookupNameNode` so qualified/generic supers reduce
183
+ * to the bare class name, matching the EXTENDS synth). An
184
+ * implicit `Object` super (no `superclass` field) has no
185
+ * in-graph symbol, so it is skipped rather than emitting a
186
+ * dangling reference.
187
+ * Arity is attached so overloaded constructors disambiguate downstream, mirroring
188
+ * the call-site arity synthesized for `new X(...)`.
189
+ */
190
+ function synthesizeJavaExplicitConstructorReferences(root) {
191
+ const out = [];
192
+ const stack = [root];
193
+ while (stack.length > 0) {
194
+ const node = stack.pop();
195
+ if (node.type === 'explicit_constructor_invocation') {
196
+ emitJavaExplicitConstructorRef(out, node);
197
+ }
198
+ for (let i = 0; i < node.namedChildCount; i++) {
199
+ const child = node.namedChild(i);
200
+ if (child !== null)
201
+ stack.push(child);
202
+ }
203
+ }
204
+ return out;
205
+ }
206
+ const TYPE_DECL_NODE_TYPES = new Set([
207
+ 'class_declaration',
208
+ 'enum_declaration',
209
+ 'record_declaration',
210
+ ]);
211
+ function emitJavaExplicitConstructorRef(out, node) {
212
+ const ctor = node.childForFieldName('constructor');
213
+ if (ctor === null)
214
+ return;
215
+ const enclosingType = findEnclosingTypeDeclaration(node);
216
+ if (enclosingType === null)
217
+ return;
218
+ let targetNameNode = null;
219
+ if (ctor.type === 'this') {
220
+ targetNameNode = enclosingType.childForFieldName('name');
221
+ }
222
+ else if (ctor.type === 'super') {
223
+ // Only class_declaration carries a `superclass` field; enum/record cannot
224
+ // declare an explicit superclass, so `super(...)` there has no resolvable
225
+ // target symbol.
226
+ const superclass = enclosingType.childForFieldName('superclass');
227
+ if (superclass === null)
228
+ return;
229
+ for (const base of superclass.namedChildren) {
230
+ if (base === null)
231
+ continue;
232
+ const nameNode = javaBaseLookupNameNode(base);
233
+ if (nameNode !== null) {
234
+ targetNameNode = nameNode;
235
+ break;
236
+ }
237
+ }
238
+ }
239
+ if (targetNameNode === null)
240
+ return;
241
+ const argList = node.childForFieldName('arguments');
242
+ const args = argList === null
243
+ ? []
244
+ : argList.namedChildren.filter((c) => c !== null && c.type !== 'block_comment' && c.type !== 'line_comment');
245
+ out.push({
246
+ '@reference.call.constructor': nodeToCapture('@reference.call.constructor', node),
247
+ '@reference.name': nodeToCapture('@reference.name', targetNameNode),
248
+ '@reference.arity': syntheticCapture('@reference.arity', node, String(args.length)),
249
+ });
250
+ }
251
+ function findEnclosingTypeDeclaration(node) {
252
+ let cur = node.parent;
253
+ while (cur !== null) {
254
+ if (TYPE_DECL_NODE_TYPES.has(cur.type))
255
+ return cur;
256
+ cur = cur.parent;
257
+ }
258
+ return null;
259
+ }
260
+ /**
261
+ * Synthesize `@reference.inherits` captures from Java class heritage so the
262
+ * registry-primary scope-resolution path emits EXTENDS / IMPLEMENTS edges
263
+ * (mirrors C++ `emitCppInheritanceCaptures`). Without this, Java inheritance
264
+ * edges came only from the legacy heritage-capture leg (removed in #942), which
265
+ * is dropped for registry-primary languages in the worker pipeline (issue #1951).
266
+ *
267
+ * Scope covers `class_declaration` (`superclass` extends + `interfaces`
268
+ * implements clauses) AND `interface_declaration` (`extends_interfaces` →
269
+ * interface-to-interface EXTENDS), matching the legacy Java heritage query
270
+ * (tree-sitter-queries.ts), which has a dedicated `interface_declaration
271
+ * (extends_interfaces (type_list …))` arm. Without the interface arm the
272
+ * registry-primary synth silently dropped every `interface IA extends IB`
273
+ * edge while the legacy leg emitted it — the exact =0/=N parity break #1951
274
+ * targets. Enum/record heritage stays unemitted (no legacy arm). Generic
275
+ * bases (`extends Box<T>`, `implements IFoo<T>`) ARE emitted here: the legacy
276
+ * heritage query was widened to capture the inner `type_identifier` of a
277
+ * `generic_type` (tree-sitter-queries.ts), so both paths now agree on SIMPLE
278
+ * (unqualified) generic bases — the more-correct behavior, consistent with
279
+ * C#/Rust (#1951). Qualified bases (`a.b.Base`, `a.b.Box<T>`, `a.b.IFoo<T>`) are
280
+ * ALSO now at parity (#1956 tri-review U2): the synth resolves them by their
281
+ * `scoped_type_identifier` tail, and the legacy heritage query was widened
282
+ * with matching `scoped_type_identifier` arms (plain + generic-wrapped). The
283
+ * EXTENDS-vs-IMPLEMENTS split is decided downstream from the resolved target's
284
+ * symbol kind (`preEmitInheritanceEdges`): a superclass resolves to a class
285
+ * (EXTENDS), an implemented interface resolves to an interface (IMPLEMENTS).
286
+ * An `interface IA extends IB` base resolves to an Interface too, so it is
287
+ * emitted as IMPLEMENTS — matching the legacy `interface_declaration` arm,
288
+ * which tagged the bases as implements (`kind: 'implements'`) and likewise
289
+ * resolves them as interfaces. The synth therefore does not need to know the
290
+ * declaration's own kind; it only emits inherits sites and lets the resolved
291
+ * target decide the edge type.
292
+ * Base names are normalized to their bare simple identifier (`Box<T>` → `Box`,
293
+ * `java.io.Serializable` → `Serializable`) to match the V1 simple-name
294
+ * `findClassBindingInScope` contract.
295
+ */
296
+ function synthesizeJavaInheritanceReferences(root) {
297
+ const out = [];
298
+ const stack = [root];
299
+ while (stack.length > 0) {
300
+ const node = stack.pop();
301
+ if (node.type === 'class_declaration') {
302
+ const superclass = node.childForFieldName('superclass');
303
+ if (superclass !== null) {
304
+ for (const base of superclass.namedChildren)
305
+ emitJavaInheritanceBase(out, base);
306
+ }
307
+ const interfaces = node.childForFieldName('interfaces');
308
+ if (interfaces !== null) {
309
+ for (const typeList of interfaces.namedChildren) {
310
+ if (typeList === null || typeList.type !== 'type_list')
311
+ continue;
312
+ for (const base of typeList.namedChildren)
313
+ emitJavaInheritanceBase(out, base);
314
+ }
315
+ }
316
+ }
317
+ else if (node.type === 'interface_declaration') {
318
+ // `interface IA extends IB, IC<T>` — the `extends_interfaces` clause is
319
+ // NOT exposed via a tree-sitter field (unlike a class's `superclass` /
320
+ // `interfaces`), so scan named children for it. It wraps a `type_list`
321
+ // whose bases reuse `javaBaseLookupNameNode` (handles type_identifier /
322
+ // generic_type / scoped_type_identifier). These resolve to Interface
323
+ // targets, so `preEmitInheritanceEdges` emits them as IMPLEMENTS, at
324
+ // parity with the legacy `interface_declaration` implements arm.
325
+ for (let i = 0; i < node.namedChildCount; i++) {
326
+ const extendsInterfaces = node.namedChild(i);
327
+ if (extendsInterfaces === null || extendsInterfaces.type !== 'extends_interfaces')
328
+ continue;
329
+ for (const typeList of extendsInterfaces.namedChildren) {
330
+ if (typeList === null || typeList.type !== 'type_list')
331
+ continue;
332
+ for (const base of typeList.namedChildren)
333
+ emitJavaInheritanceBase(out, base);
334
+ }
335
+ }
336
+ }
337
+ // Named children only: every type/heritage node we care about is named,
338
+ // so skipping unnamed punctuation tokens keeps the walk single-pass and
339
+ // lighter on large files.
340
+ for (let i = 0; i < node.namedChildCount; i++) {
341
+ const child = node.namedChild(i);
342
+ if (child !== null)
343
+ stack.push(child);
344
+ }
345
+ }
346
+ return out;
347
+ }
348
+ function emitJavaInheritanceBase(out, base) {
349
+ if (base === null)
350
+ return;
351
+ const nameNode = javaBaseLookupNameNode(base);
352
+ if (nameNode === null)
353
+ return;
354
+ out.push({
355
+ '@reference.inherits': nodeToCapture('@reference.inherits', base),
356
+ '@reference.name': nodeToCapture('@reference.name', nameNode),
357
+ });
358
+ }
359
+ /** Resolve a Java base-type node to its bare simple-name identifier node. */
360
+ function javaBaseLookupNameNode(node) {
361
+ switch (node.type) {
362
+ case 'type_identifier':
363
+ return node;
364
+ case 'scoped_type_identifier':
365
+ // `java.io.Serializable` → trailing `type_identifier` (`Serializable`).
366
+ return node.lastNamedChild;
367
+ case 'generic_type': {
368
+ // `Box<String>` → recurse into the base type (`Box`).
369
+ const first = node.firstNamedChild;
370
+ return first === null ? null : javaBaseLookupNameNode(first);
371
+ }
372
+ default:
373
+ return null;
374
+ }
150
375
  }
151
376
  function resolveVarTypeBindings(matches) {
152
377
  const returnTypes = new Map();
@@ -286,12 +511,16 @@ function inferArgType(argNode) {
286
511
  return '';
287
512
  }
288
513
  }
289
- /** Find the first Java function-like node at the given range. */
290
- function findFunctionNode(rootNode, range) {
291
- for (const nodeType of FUNCTION_NODE_TYPES) {
292
- const n = findNodeAtRange(rootNode, range, nodeType);
293
- if (n !== null)
294
- return n;
295
- }
296
- return null;
514
+ /**
515
+ * Resolve a Java function-like node from a query-captured node.
516
+ *
517
+ * The `@scope.function` / `@declaration.method` / `@declaration.constructor`
518
+ * anchors all capture directly on the `method_declaration` /
519
+ * `constructor_declaration` node (per JAVA_SCOPE_QUERY), so this is a type
520
+ * guard against `FUNCTION_NODE_TYPES` — the threaded-node equivalent of the
521
+ * old `findNodeAtRange(tree.rootNode, range, type)` root-walk, minus the
522
+ * O(matches × rootChildren) traversal.
523
+ */
524
+ function findFunctionNode(node) {
525
+ return nodeIfType(node, ...FUNCTION_NODE_TYPES);
297
526
  }