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
@@ -0,0 +1,65 @@
1
+ /**
2
+ * C++ capture-time side-channel serialization (#1983).
3
+ *
4
+ * `emitCppScopeCaptures` populates several MODULE-LEVEL maps as a side effect
5
+ * that are NOT part of the returned `ParsedFile`'s scopes/defs:
6
+ *
7
+ * - `argInfoBySite` / `noAdlSites` (adl.ts)
8
+ * - `inlineNamespaceRangesByFile` (inline-namespaces.ts)
9
+ * - `fileLocalNames` / `anonymousNamespaceRangesByFile` (file-local-linkage.ts)
10
+ * - `dependentBasesByFile` / `dependentPackBaseClassesByFile` (two-phase-lookup.ts)
11
+ *
12
+ * On the worker path those maps are filled in the WORKER process and lost
13
+ * across the worker→main MessageChannel (and the disk-backed parsedfile-store),
14
+ * because scope-resolution reuses the serialized `ParsedFile` and SKIPS the
15
+ * main-thread re-extraction — the entire point of #1983 is to avoid a
16
+ * main-thread tree-sitter re-parse on huge `.h`/`.cpp` repos (the OOM).
17
+ *
18
+ * This module snapshots the per-file slice of those maps into a plain,
19
+ * JSON-serializable object (carried on `ParsedFile.captureSideChannel`) and
20
+ * restores it on the main thread WITHOUT any parse. It is the data-only
21
+ * replacement for the removed re-parse `replayCaptureSideChannel` hook.
22
+ *
23
+ * The derived state each `populateOwners` / `populateWorkspaceOwners` pass
24
+ * builds (resolved scope-id Sets, `dependentBaseNodeIds`, etc.) is recomputed
25
+ * on the main thread from these restored capture-time maps, so only the
26
+ * capture-time maps need to cross the boundary.
27
+ */
28
+ import type { ParsedFile } from '../../../../_shared/index.js';
29
+ import { type CppAdlSideChannel } from './adl.js';
30
+ import { type CppFileLocalSideChannel } from './file-local-linkage.js';
31
+ import { type CppTwoPhaseSideChannel } from './two-phase-lookup.js';
32
+ /**
33
+ * Plain JSON-serializable composite of every C++ capture-time side-channel
34
+ * slice for one file. Carried opaquely on `ParsedFile.captureSideChannel`.
35
+ */
36
+ export interface CppCaptureSideChannel {
37
+ /**
38
+ * Discriminant tag — the single generic `ParsedFile.captureSideChannel`
39
+ * field is shared with C (`{ kind: 'c' }`) and Kotlin (`{ kind: 'kotlin' }`).
40
+ * `applyCppCaptureSideChannel` checks this first so a foreign-language
41
+ * payload reaching the C++ apply (or vice-versa) is cleanly ignored. In
42
+ * practice apply only runs for the matching provider (one language per file),
43
+ * but the tag makes it robust and consistent with the C/Kotlin snapshots.
44
+ */
45
+ readonly kind: 'cpp';
46
+ readonly adl: CppAdlSideChannel;
47
+ /** Inline-namespace source-range keys recorded for this file. */
48
+ readonly inlineNamespaceRanges: readonly string[];
49
+ readonly fileLocal: CppFileLocalSideChannel;
50
+ readonly twoPhase: CppTwoPhaseSideChannel;
51
+ }
52
+ /**
53
+ * `LanguageProvider.collectCaptureSideChannel` implementation for C++.
54
+ * Returns `undefined` when this file recorded no side-channel state at all, so
55
+ * the produced `ParsedFile` carries the field only when there's data to ship.
56
+ */
57
+ export declare function collectCppCaptureSideChannel(filePath: string): CppCaptureSideChannel | undefined;
58
+ /**
59
+ * `ScopeResolver.applyCaptureSideChannel` implementation for C++. Reads the
60
+ * worker-serialized snapshot from `parsed.captureSideChannel` and writes it
61
+ * back into the module-level maps. Tolerant of `undefined` (file carried no
62
+ * data) and of an unexpected shape (defensive — never throws on a malformed
63
+ * snapshot). Does NO tree-sitter parse.
64
+ */
65
+ export declare function applyCppCaptureSideChannel(parsed: ParsedFile): void;
@@ -0,0 +1,78 @@
1
+ /**
2
+ * C++ capture-time side-channel serialization (#1983).
3
+ *
4
+ * `emitCppScopeCaptures` populates several MODULE-LEVEL maps as a side effect
5
+ * that are NOT part of the returned `ParsedFile`'s scopes/defs:
6
+ *
7
+ * - `argInfoBySite` / `noAdlSites` (adl.ts)
8
+ * - `inlineNamespaceRangesByFile` (inline-namespaces.ts)
9
+ * - `fileLocalNames` / `anonymousNamespaceRangesByFile` (file-local-linkage.ts)
10
+ * - `dependentBasesByFile` / `dependentPackBaseClassesByFile` (two-phase-lookup.ts)
11
+ *
12
+ * On the worker path those maps are filled in the WORKER process and lost
13
+ * across the worker→main MessageChannel (and the disk-backed parsedfile-store),
14
+ * because scope-resolution reuses the serialized `ParsedFile` and SKIPS the
15
+ * main-thread re-extraction — the entire point of #1983 is to avoid a
16
+ * main-thread tree-sitter re-parse on huge `.h`/`.cpp` repos (the OOM).
17
+ *
18
+ * This module snapshots the per-file slice of those maps into a plain,
19
+ * JSON-serializable object (carried on `ParsedFile.captureSideChannel`) and
20
+ * restores it on the main thread WITHOUT any parse. It is the data-only
21
+ * replacement for the removed re-parse `replayCaptureSideChannel` hook.
22
+ *
23
+ * The derived state each `populateOwners` / `populateWorkspaceOwners` pass
24
+ * builds (resolved scope-id Sets, `dependentBaseNodeIds`, etc.) is recomputed
25
+ * on the main thread from these restored capture-time maps, so only the
26
+ * capture-time maps need to cross the boundary.
27
+ */
28
+ import { collectCppAdlSideChannel, applyCppAdlSideChannel } from './adl.js';
29
+ import { collectCppInlineNamespaceSideChannel, applyCppInlineNamespaceSideChannel, } from './inline-namespaces.js';
30
+ import { collectCppFileLocalSideChannel, applyCppFileLocalSideChannel, } from './file-local-linkage.js';
31
+ import { collectCppTwoPhaseSideChannel, applyCppTwoPhaseSideChannel, } from './two-phase-lookup.js';
32
+ /**
33
+ * `LanguageProvider.collectCaptureSideChannel` implementation for C++.
34
+ * Returns `undefined` when this file recorded no side-channel state at all, so
35
+ * the produced `ParsedFile` carries the field only when there's data to ship.
36
+ */
37
+ export function collectCppCaptureSideChannel(filePath) {
38
+ const adl = collectCppAdlSideChannel(filePath);
39
+ const inlineNamespaceRanges = collectCppInlineNamespaceSideChannel(filePath);
40
+ const fileLocal = collectCppFileLocalSideChannel(filePath);
41
+ const twoPhase = collectCppTwoPhaseSideChannel(filePath);
42
+ const isEmpty = adl.argInfoBySite.length === 0 &&
43
+ adl.noAdlSites.length === 0 &&
44
+ inlineNamespaceRanges.length === 0 &&
45
+ fileLocal.fileLocalNames.length === 0 &&
46
+ fileLocal.anonymousNamespaceRanges.length === 0 &&
47
+ twoPhase.dependentBases.length === 0 &&
48
+ twoPhase.dependentPackBaseClasses.length === 0;
49
+ if (isEmpty)
50
+ return undefined;
51
+ return { kind: 'cpp', adl, inlineNamespaceRanges, fileLocal, twoPhase };
52
+ }
53
+ /**
54
+ * `ScopeResolver.applyCaptureSideChannel` implementation for C++. Reads the
55
+ * worker-serialized snapshot from `parsed.captureSideChannel` and writes it
56
+ * back into the module-level maps. Tolerant of `undefined` (file carried no
57
+ * data) and of an unexpected shape (defensive — never throws on a malformed
58
+ * snapshot). Does NO tree-sitter parse.
59
+ */
60
+ export function applyCppCaptureSideChannel(parsed) {
61
+ const data = parsed.captureSideChannel;
62
+ if (data === undefined || data === null || typeof data !== 'object')
63
+ return;
64
+ // Discriminant guard — the generic `captureSideChannel` field is shared
65
+ // with C (`{ kind: 'c' }`) and Kotlin (`{ kind: 'kotlin' }`); cleanly
66
+ // ignore a non-C++ payload rather than mis-applying it.
67
+ if (data.kind !== 'cpp')
68
+ return;
69
+ if (data.adl !== undefined)
70
+ applyCppAdlSideChannel(parsed.filePath, data.adl);
71
+ if (data.inlineNamespaceRanges !== undefined) {
72
+ applyCppInlineNamespaceSideChannel(parsed.filePath, data.inlineNamespaceRanges);
73
+ }
74
+ if (data.fileLocal !== undefined)
75
+ applyCppFileLocalSideChannel(parsed.filePath, data.fileLocal);
76
+ if (data.twoPhase !== undefined)
77
+ applyCppTwoPhaseSideChannel(parsed.filePath, data.twoPhase);
78
+ }
@@ -1,11 +1,12 @@
1
- import { findNodeAtRange, nodeToCapture, syntheticCapture, } from '../../utils/ast-helpers.js';
1
+ import { nodeIfType, nodeToCapture, syntheticCapture, } from '../../utils/ast-helpers.js';
2
2
  import { getCppParser, getCppScopeQuery } from './query.js';
3
3
  import { getTreeSitterBufferSize } from '../../constants.js';
4
4
  import { parseSourceSafe } from '../../../tree-sitter/safe-parse.js';
5
+ import { normalizeQualifiedName } from '../../utils/qualified-name.js';
5
6
  import { splitCppInclude, splitCppUsingDecl } from './import-decomposer.js';
6
7
  import { classifyCppParameterType, computeCppDeclarationArity, computeCppCallArity, } from './arity-metadata.js';
7
8
  import { markCppAnonymousNamespaceRange, markFileLocal } from './file-local-linkage.js';
8
- import { markCppDependentBase } from './two-phase-lookup.js';
9
+ import { markCppDependentBase, markCppDependentPackBase } from './two-phase-lookup.js';
9
10
  import { markCppAdlSiteArgs, markCppAdlSiteNoAdl } from './adl.js';
10
11
  import { markCppInlineNamespaceRange } from './inline-namespaces.js';
11
12
  import { extractCppTemplateConstraints } from './constraint-extractor.js';
@@ -18,23 +19,34 @@ export function emitCppScopeCaptures(sourceText, filePath, cachedTree) {
18
19
  }
19
20
  const rawMatches = getCppScopeQuery().matches(tree.rootNode);
20
21
  const out = [];
21
- // Track ranges where typedef-struct was captured as @declaration.struct
22
+ // Track ranges where typedef-struct/enum was captured as its concrete type
22
23
  // so we can suppress the duplicate @declaration.typedef match.
23
- const structTypedefRanges = new Set();
24
+ const concreteTypedefRanges = new Set();
24
25
  for (const m of rawMatches) {
25
26
  const grouped = {};
27
+ // Parallel tag -> captured SyntaxNode map. The tree-sitter query already
28
+ // hands us each matched node as `c.node`, so anchors resolve via a
29
+ // type-guarded lookup (`nodeIfType`) instead of re-deriving them with
30
+ // `findNodeAtRange(tree.rootNode, ...)` per match — the
31
+ // O(matches × rootChildren) root-walk fixed for go #1848 / python #1918 /
32
+ // rust/csharp #1915 / java, mirrored here for C++ (#1951). Each C++
33
+ // scope-query anchor used below captures directly ON the node the old
34
+ // root-walk re-derived (verified against CPP_SCOPE_QUERY in query.ts and a
35
+ // real-parse AST probe), so the type check is exact.
36
+ const nodeMap = {};
26
37
  for (const c of m.captures) {
27
38
  const tag = '@' + c.name;
28
39
  if (tag.startsWith('@_'))
29
40
  continue;
30
41
  grouped[tag] = nodeToCapture(tag, c.node);
42
+ nodeMap[tag] = c.node;
31
43
  }
32
44
  if (Object.keys(grouped).length === 0)
33
45
  continue;
34
46
  // ── Handle #include statements ──────────────────────────────────
47
+ // `@import.statement` is captured directly on the `preproc_include` node.
35
48
  if (grouped['@import.statement'] !== undefined) {
36
- const anchor = grouped['@import.statement'];
37
- const includeNode = findNodeAtRange(tree.rootNode, anchor.range, 'preproc_include');
49
+ const includeNode = nodeIfType(nodeMap['@import.statement'], 'preproc_include');
38
50
  if (includeNode !== null) {
39
51
  const split = splitCppInclude(includeNode);
40
52
  if (split !== null) {
@@ -44,9 +56,9 @@ export function emitCppScopeCaptures(sourceText, filePath, cachedTree) {
44
56
  }
45
57
  }
46
58
  // ── Handle using declarations (using namespace / using name) ────
59
+ // `@import.using-decl` is captured directly on the `using_declaration` node.
47
60
  if (grouped['@import.using-decl'] !== undefined) {
48
- const anchor = grouped['@import.using-decl'];
49
- const usingNode = findNodeAtRange(tree.rootNode, anchor.range, 'using_declaration');
61
+ const usingNode = nodeIfType(nodeMap['@import.using-decl'], 'using_declaration');
50
62
  if (usingNode !== null) {
51
63
  const split = splitCppUsingDecl(usingNode);
52
64
  if (split !== null) {
@@ -55,26 +67,30 @@ export function emitCppScopeCaptures(sourceText, filePath, cachedTree) {
55
67
  }
56
68
  }
57
69
  }
58
- // ── Track typedef-struct ranges ─────────────────────────────────
59
- const structAnchor = grouped['@declaration.struct'] ?? grouped['@declaration.class'];
60
- if (structAnchor !== undefined) {
61
- const r = structAnchor.range;
62
- structTypedefRanges.add(`${r.startLine}:${r.startCol}:${r.endLine}:${r.endCol}`);
70
+ // ── Track concrete typedef ranges ───────────────────────────────
71
+ const concreteTypeAnchor = grouped['@declaration.struct'] ??
72
+ grouped['@declaration.class'] ??
73
+ grouped['@declaration.enum'];
74
+ if (concreteTypeAnchor !== undefined) {
75
+ const r = concreteTypeAnchor.range;
76
+ concreteTypedefRanges.add(`${r.startLine}:${r.startCol}:${r.endLine}:${r.endCol}`);
63
77
  }
64
78
  // Suppress @declaration.typedef if the same range was already captured
65
79
  const typedefAnchor = grouped['@declaration.typedef'];
66
80
  if (typedefAnchor !== undefined) {
67
81
  const r = typedefAnchor.range;
68
82
  const key = `${r.startLine}:${r.startCol}:${r.endLine}:${r.endCol}`;
69
- if (structTypedefRanges.has(key))
83
+ if (concreteTypedefRanges.has(key))
70
84
  continue;
71
85
  }
72
86
  // ── Enrich function/method declarations with arity metadata ─────
73
- const declAnchor = grouped['@declaration.function'] ?? grouped['@declaration.method'];
74
- if (declAnchor !== undefined) {
75
- const fnNode = findNodeAtRange(tree.rootNode, declAnchor.range, 'function_definition') ??
76
- findNodeAtRange(tree.rootNode, declAnchor.range, 'declaration') ??
77
- findNodeAtRange(tree.rootNode, declAnchor.range, 'field_declaration');
87
+ // `@declaration.function` / `@declaration.method` capture directly on the
88
+ // `function_definition` (definitions/templates), `declaration` (free/
89
+ // constructor prototypes), or `field_declaration` (class-body method
90
+ // prototypes) node — the node the old findNodeAtRange re-derived.
91
+ const declAnchorNode = nodeMap['@declaration.function'] ?? nodeMap['@declaration.method'];
92
+ if (declAnchorNode !== undefined) {
93
+ const fnNode = nodeIfType(declAnchorNode, 'function_definition', 'declaration', 'field_declaration');
78
94
  if (fnNode !== null) {
79
95
  const arity = computeCppDeclarationArity(fnNode);
80
96
  if (arity.parameterCount !== undefined) {
@@ -126,9 +142,9 @@ export function emitCppScopeCaptures(sourceText, filePath, cachedTree) {
126
142
  }
127
143
  }
128
144
  // ── Detect static variables (file-local linkage) ────────────────
129
- const varDeclAnchor = grouped['@declaration.variable'];
130
- if (varDeclAnchor !== undefined) {
131
- const varNode = findNodeAtRange(tree.rootNode, varDeclAnchor.range, 'declaration');
145
+ // `@declaration.variable` is captured directly on the `declaration` node.
146
+ if (grouped['@declaration.variable'] !== undefined) {
147
+ const varNode = nodeIfType(nodeMap['@declaration.variable'], 'declaration');
132
148
  if (varNode !== null) {
133
149
  if (hasStaticStorageClass(varNode) || isInsideAnonymousNamespace(varNode)) {
134
150
  const nameText = grouped['@declaration.name']?.text;
@@ -139,20 +155,28 @@ export function emitCppScopeCaptures(sourceText, filePath, cachedTree) {
139
155
  }
140
156
  }
141
157
  // ── Enrich call references with arity ───────────────────────────
158
+ // `@reference.call.free` / `.member` capture on the `call_expression` (plain
159
+ // / member / template calls) or on the `binary_expression` (the operator-call
160
+ // patterns: `a + b`, `lhs << rhs`); `@reference.call.qualified` always on the
161
+ // `call_expression`. The captured node IS the node the old findNodeAtRange
162
+ // re-derived (verified against CPP_SCOPE_QUERY + a real-parse probe).
142
163
  const callAnchor = grouped['@reference.call.free'] ??
143
164
  grouped['@reference.call.member'] ??
144
165
  grouped['@reference.call.qualified'];
166
+ const callAnchorNode = nodeMap['@reference.call.free'] ??
167
+ nodeMap['@reference.call.member'] ??
168
+ nodeMap['@reference.call.qualified'];
145
169
  const operatorAnchor = grouped['@reference.operator'];
146
170
  if (operatorAnchor !== undefined) {
147
- const operatorNode = callAnchor !== undefined
148
- ? findNodeAtRange(tree.rootNode, callAnchor.range, 'binary_expression')
149
- : null;
171
+ // When `@reference.operator` fires, the co-captured call anchor is the
172
+ // enclosing `binary_expression` itself, so a type guard reproduces the
173
+ // old findNodeAtRange(callAnchor.range, 'binary_expression').
174
+ const operatorNode = callAnchorNode !== undefined ? nodeIfType(callAnchorNode, 'binary_expression') : null;
150
175
  if (operatorNode !== null && isPrimitiveOnlyBinaryOperator(operatorNode))
151
176
  continue;
152
177
  }
153
- if (callAnchor !== undefined && grouped['@reference.arity'] === undefined) {
154
- const callNode = findNodeAtRange(tree.rootNode, callAnchor.range, 'call_expression') ??
155
- findNodeAtRange(tree.rootNode, callAnchor.range, 'binary_expression');
178
+ if (callAnchorNode !== undefined && grouped['@reference.arity'] === undefined) {
179
+ const callNode = nodeIfType(callAnchorNode, 'call_expression', 'binary_expression');
156
180
  if (callNode?.type === 'call_expression') {
157
181
  grouped['@reference.arity'] = syntheticCapture('@reference.arity', callNode, String(computeCppCallArity(callNode)));
158
182
  }
@@ -161,22 +185,32 @@ export function emitCppScopeCaptures(sourceText, filePath, cachedTree) {
161
185
  }
162
186
  }
163
187
  if (operatorAnchor !== undefined && grouped['@reference.name'] === undefined) {
164
- grouped['@reference.name'] = syntheticCapture('@reference.name', findNodeAtRange(tree.rootNode, operatorAnchor.range, operatorAnchor.text) ?? tree.rootNode, `operator${operatorAnchor.text}`);
188
+ // The old code did `findNodeAtRange(tree.rootNode, operatorAnchor.range,
189
+ // operatorAnchor.text)`, searching for a node of type `+` / `<<` at the
190
+ // operator-token range. That token is an UNNAMED grammar node, and
191
+ // findNodeAtRange only descends `namedChild`ren, so the search NEVER hit
192
+ // and ALWAYS fell back to `tree.rootNode`. Use `tree.rootNode` directly to
193
+ // preserve the exact synthetic-capture range while dropping the root-walk.
194
+ grouped['@reference.name'] = syntheticCapture('@reference.name', tree.rootNode, `operator${operatorAnchor.text}`);
165
195
  }
166
196
  // ── Enrich constructor calls (new Foo()) with arity ─────────────
197
+ // `@reference.call.constructor` is captured directly on the `new_expression`.
167
198
  const ctorCallAnchor = grouped['@reference.call.constructor'];
199
+ const ctorCallAnchorNode = nodeMap['@reference.call.constructor'];
168
200
  if (ctorCallAnchor !== undefined && grouped['@reference.arity'] === undefined) {
169
- const newNode = findNodeAtRange(tree.rootNode, ctorCallAnchor.range, 'new_expression');
201
+ const newNode = nodeIfType(ctorCallAnchorNode, 'new_expression');
170
202
  if (newNode !== null) {
171
203
  grouped['@reference.arity'] = syntheticCapture('@reference.arity', newNode, String(computeCppCallArity(newNode)));
172
204
  }
173
205
  }
174
206
  // ── Synthesize argument types for overload narrowing ────────────
207
+ // The any-call anchor is either the call/operator anchor (`call_expression`
208
+ // / `binary_expression`) or the constructor anchor (`new_expression`); the
209
+ // captured node IS what the old findNodeAtRange re-derived.
175
210
  const anyCallAnchor = callAnchor ?? ctorCallAnchor;
211
+ const anyCallAnchorNode = callAnchorNode ?? ctorCallAnchorNode;
176
212
  if (anyCallAnchor !== undefined && grouped['@reference.parameter-types'] === undefined) {
177
- const cNode = findNodeAtRange(tree.rootNode, anyCallAnchor.range, 'call_expression') ??
178
- findNodeAtRange(tree.rootNode, anyCallAnchor.range, 'new_expression') ??
179
- findNodeAtRange(tree.rootNode, anyCallAnchor.range, 'binary_expression');
213
+ const cNode = nodeIfType(anyCallAnchorNode, 'call_expression', 'new_expression', 'binary_expression');
180
214
  if (cNode !== null) {
181
215
  const argTypes = cNode.type === 'binary_expression'
182
216
  ? inferCppBinaryOperatorArgTypes(cNode, grouped['@reference.call.free'] !== undefined)
@@ -201,9 +235,11 @@ export function emitCppScopeCaptures(sourceText, filePath, cachedTree) {
201
235
  // `@declaration.namespace` fires only for NAMED namespaces (the query
202
236
  // requires a `name: (namespace_identifier)` child). Use the unconditional
203
237
  // `@scope.namespace` capture so the anonymous-namespace branch also runs.
204
- const namespaceScopeAnchor = grouped['@declaration.namespace'] ?? grouped['@scope.namespace'];
205
- if (namespaceScopeAnchor !== undefined) {
206
- const nsNode = findNodeAtRange(tree.rootNode, namespaceScopeAnchor.range, 'namespace_definition');
238
+ // `@declaration.namespace` and `@scope.namespace` both capture directly on
239
+ // the `namespace_definition` node.
240
+ const namespaceScopeAnchorNode = nodeMap['@declaration.namespace'] ?? nodeMap['@scope.namespace'];
241
+ if (namespaceScopeAnchorNode !== undefined) {
242
+ const nsNode = nodeIfType(namespaceScopeAnchorNode, 'namespace_definition');
207
243
  if (nsNode !== null) {
208
244
  // Range coords stored in the shared Range shape use 1-based
209
245
  // line numbers (see `ast-helpers.ts` rangeForNode where
@@ -232,7 +268,11 @@ export function emitCppScopeCaptures(sourceText, filePath, cachedTree) {
232
268
  // qualified `Ns::f(s)` and member `obj.f(s)` calls bypass the
233
269
  // free-call fallback entirely (handled by receiver-bound-calls).
234
270
  if (grouped['@reference.call.free'] !== undefined) {
235
- const freeCallNode = findNodeAtRange(tree.rootNode, grouped['@reference.call.free'].range, 'call_expression');
271
+ // `@reference.call.free` captures on a `call_expression` (plain/template
272
+ // free call) or a `binary_expression` (the `lhs << rhs` operator-call
273
+ // pattern). The old findNodeAtRange filtered to `call_expression`, so the
274
+ // `binary_expression` case yields null here — `nodeIfType` matches exactly.
275
+ const freeCallNode = nodeIfType(nodeMap['@reference.call.free'], 'call_expression');
236
276
  if (freeCallNode !== null) {
237
277
  const adlAnchorRange = grouped['@reference.call.free'].range;
238
278
  if (isParenthesizedFunctionCall(freeCallNode)) {
@@ -254,7 +294,8 @@ export function emitCppScopeCaptures(sourceText, filePath, cachedTree) {
254
294
  if (grouped['@type-binding.assignment'] !== undefined &&
255
295
  grouped['@type-binding.type']?.text === 'auto') {
256
296
  const anchor = grouped['@type-binding.assignment'];
257
- const declNode = findNodeAtRange(tree.rootNode, anchor.range, 'declaration');
297
+ // `@type-binding.assignment` is captured directly on the `declaration` node.
298
+ const declNode = nodeIfType(nodeMap['@type-binding.assignment'], 'declaration');
258
299
  if (declNode !== null) {
259
300
  const declarator = declNode.childForFieldName('declarator');
260
301
  if (declarator?.type === 'init_declarator') {
@@ -303,7 +344,7 @@ export function emitCppScopeCaptures(sourceText, filePath, cachedTree) {
303
344
  // captures consumed by the registry-primary graph bridge. The lookup name
304
345
  // is normalized to the bare class name so `Base<T>` / `outer::v1::Base<T>`
305
346
  // resolve through V1's simple-name `findClassBindingInScope('Base')`.
306
- emitCppInheritanceCaptures(tree.rootNode, out);
347
+ emitCppInheritanceCaptures(tree.rootNode, out, filePath);
307
348
  // ── Detect dependent-base relationships for two-phase template lookup ──
308
349
  // Walk the tree once, finding every `template_declaration` whose
309
350
  // child is a class/struct definition with a `base_class_clause` whose
@@ -351,7 +392,7 @@ function isCppUnsupportedReturnTypeDeclarator(funcDeclarator) {
351
392
  * here instead of introducing a C++-only name-resolution lane in shared
352
393
  * ingestion infrastructure.
353
394
  */
354
- function emitCppInheritanceCaptures(root, out) {
395
+ function emitCppInheritanceCaptures(root, out, filePath) {
355
396
  const stack = [root];
356
397
  while (stack.length > 0) {
357
398
  const node = stack.pop();
@@ -359,12 +400,27 @@ function emitCppInheritanceCaptures(root, out) {
359
400
  const baseClause = findChildOfType(node, ['base_class_clause']);
360
401
  if (baseClause !== null) {
361
402
  for (const base of iterBaseClasses(baseClause)) {
362
- const baseName = extractBaseLookupName(base);
403
+ if (base.isPackExpansion) {
404
+ markClassWithPackExpandedBase(filePath, node);
405
+ continue;
406
+ }
407
+ const baseName = extractBaseLookupName(base.node);
363
408
  if (baseName.length === 0)
364
409
  continue;
410
+ // Preserve the qualified form (`Other::Inner`, template-stripped) when the
411
+ // source wrote one, so a same-tail nested base resolves to the matching
412
+ // qualified node instead of the first-inserted same-tail one (#1982). The
413
+ // bare `@reference.name` stays the V1 simple-name contract; the qualifier
414
+ // is an additive sidecar resolution tries first (see resolveInheritanceBaseInScope).
415
+ const qualifiedBaseName = extractQualifiedBaseName(base.node);
365
416
  out.push({
366
- '@reference.inherits': nodeToCapture('@reference.inherits', base),
367
- '@reference.name': syntheticCapture('@reference.name', base, baseName),
417
+ '@reference.inherits': nodeToCapture('@reference.inherits', base.node),
418
+ '@reference.name': syntheticCapture('@reference.name', base.node, baseName),
419
+ ...(qualifiedBaseName.length > 0 && qualifiedBaseName !== baseName
420
+ ? {
421
+ '@reference.qualified-name': syntheticCapture('@reference.qualified-name', base.node, qualifiedBaseName),
422
+ }
423
+ : {}),
368
424
  });
369
425
  }
370
426
  }
@@ -404,9 +460,12 @@ function detectCppDependentBases(root, filePath) {
404
460
  const baseClause = findChildOfType(classNode, ['base_class_clause']);
405
461
  if (baseClause !== null) {
406
462
  for (const base of iterBaseClasses(baseClause)) {
407
- if (isBaseDependent(base, params)) {
408
- const baseName = extractBaseLookupName(base);
409
- const baseQualifier = extractBaseLookupQualifier(base);
463
+ if (base.isPackExpansion || isBaseDependent(base.node, params)) {
464
+ if (base.isPackExpansion) {
465
+ markClassWithPackExpandedBase(filePath, classNode);
466
+ }
467
+ const baseName = extractBaseLookupName(base.node);
468
+ const baseQualifier = extractBaseLookupQualifier(base.node);
410
469
  if (baseName !== '') {
411
470
  markCppDependentBase(filePath, className, baseName, baseQualifier);
412
471
  }
@@ -457,6 +516,11 @@ function collectTemplateParameterNames(templateDecl) {
457
516
  }
458
517
  return names;
459
518
  }
519
+ function markClassWithPackExpandedBase(filePath, classNode) {
520
+ const className = getTypeIdentifierName(classNode);
521
+ if (className !== '')
522
+ markCppDependentPackBase(filePath, className);
523
+ }
460
524
  /** Yield each base-class entry from a `base_class_clause`. */
461
525
  function* iterBaseClasses(baseClause) {
462
526
  for (let i = 0; i < baseClause.childCount; i++) {
@@ -468,10 +532,24 @@ function* iterBaseClasses(baseClause) {
468
532
  if (child.type === 'type_identifier' ||
469
533
  child.type === 'template_type' ||
470
534
  child.type === 'qualified_identifier') {
471
- yield child;
535
+ yield { node: child, isPackExpansion: isFollowedByPackExpansion(baseClause, i) };
472
536
  }
473
537
  }
474
538
  }
539
+ function isFollowedByPackExpansion(baseClause, childIndex) {
540
+ for (let i = childIndex + 1; i < baseClause.childCount; i++) {
541
+ const sibling = baseClause.child(i);
542
+ if (sibling === null)
543
+ continue;
544
+ if (sibling.type === '...' || (!sibling.isNamed && sibling.text === '...'))
545
+ return true;
546
+ if (sibling.type === ',' || sibling.type === 'access_specifier')
547
+ return false;
548
+ if (sibling.isNamed)
549
+ return false;
550
+ }
551
+ return false;
552
+ }
475
553
  /**
476
554
  * A base is dependent when:
477
555
  * - it's a `template_type` and its argument list contains a
@@ -564,6 +642,40 @@ function extractBaseLookupName(baseNode) {
564
642
  }
565
643
  return '';
566
644
  }
645
+ /**
646
+ * Like `extractBaseLookupName` but PRESERVES the namespace/class qualifier
647
+ * (`Other::Inner`, `ns::v1::Base`) while stripping template arguments
648
+ * (`ns::Base<T>` → `ns::Base`). Returns `''` for shapes it can't qualify, and
649
+ * returns the bare name unchanged for an unqualified base (the emit site then
650
+ * skips the sidecar capture). Powers `@reference.qualified-name` so #1982
651
+ * resolution can pick the matching same-tail nested base via the full-path
652
+ * QualifiedNameIndex instead of the first-inserted same-tail sibling.
653
+ */
654
+ function extractQualifiedBaseName(baseNode) {
655
+ if (baseNode.type === 'template_type') {
656
+ const nameNode = baseNode.childForFieldName('name');
657
+ return nameNode !== null ? extractQualifiedBaseName(nameNode) : '';
658
+ }
659
+ if (baseNode.type === 'qualified_identifier') {
660
+ // No template args anywhere → the raw text already IS the qualified name.
661
+ if (!baseNode.text.includes('<'))
662
+ return baseNode.text;
663
+ // Template args present: reconstruct scope::name, recursing to strip them.
664
+ const scopeNode = baseNode.childForFieldName('scope');
665
+ const nameNode = baseNode.childForFieldName('name');
666
+ const left = scopeNode !== null ? extractQualifiedBaseName(scopeNode) : '';
667
+ const right = nameNode !== null ? extractQualifiedBaseName(nameNode) : '';
668
+ if (left.length > 0 && right.length > 0)
669
+ return `${left}::${right}`;
670
+ return right.length > 0 ? right : left;
671
+ }
672
+ if (baseNode.type === 'namespace_identifier' ||
673
+ baseNode.type === 'type_identifier' ||
674
+ baseNode.type === 'identifier') {
675
+ return baseNode.text;
676
+ }
677
+ return '';
678
+ }
567
679
  /** Extract the syntactic namespace qualifier from a base class node.
568
680
  * For `detail::Inner<T>`, returns `'detail'`.
569
681
  * For unqualified bases (`Inner<T>`, `Base<int>`), returns `''`.
@@ -1225,7 +1337,7 @@ function lookupAdlIdentifierType(identNode) {
1225
1337
  inner = next;
1226
1338
  continue;
1227
1339
  }
1228
- if (inner.type === 'reference_declarator' || inner.type === 'rvalue_reference_declarator') {
1340
+ if (inner.type === 'reference_declarator') {
1229
1341
  // reference_declarator has a single child (the inner declarator).
1230
1342
  let next = null;
1231
1343
  for (let j = 0; j < inner.namedChildCount; j++) {
@@ -1362,7 +1474,7 @@ function extractAdlTypeNamespace(typeNode) {
1362
1474
  if (typeNode.type === 'qualified_identifier') {
1363
1475
  const scope = typeNode.childForFieldName('scope');
1364
1476
  if (scope !== null)
1365
- return normalizeCppNamespaceQName(scope.text);
1477
+ return normalizeQualifiedName(scope.text);
1366
1478
  return extractNamespaceFromQualifiedText(typeNode.text);
1367
1479
  }
1368
1480
  return '';
@@ -1430,16 +1542,12 @@ function findTemplateTypeNode(typeNode) {
1430
1542
  }
1431
1543
  return null;
1432
1544
  }
1433
- function normalizeCppNamespaceQName(text) {
1434
- const normalized = text.replace(/^::/, '').replace(/::$/, '').replace(/::/g, '.');
1435
- return normalized;
1436
- }
1437
1545
  function extractNamespaceFromQualifiedText(text) {
1438
1546
  const cleaned = text.replace(/\s+/g, '');
1439
1547
  const idx = cleaned.lastIndexOf('::');
1440
1548
  if (idx <= 0)
1441
1549
  return '';
1442
- return normalizeCppNamespaceQName(cleaned.slice(0, idx));
1550
+ return normalizeQualifiedName(cleaned.slice(0, idx));
1443
1551
  }
1444
1552
  /**
1445
1553
  * Walk a declarator node chain, unwrapping pointer/reference/function/
@@ -16,6 +16,24 @@ export declare function markCppAnonymousNamespaceRange(filePath: string, range:
16
16
  * the cross-file unqualified-lookup exclusion that applies to ordinary
17
17
  * named namespaces. */
18
18
  export declare function isCppAnonymousNamespaceScope(scopeId: ScopeId): boolean;
19
+ /**
20
+ * Plain-data, JSON-serializable snapshot of the per-file capture-time
21
+ * file-local-linkage state. Carried on `ParsedFile.captureSideChannel` across
22
+ * the worker→main boundary (#1983). The derived sets (`nonGloballyVisibleNodeIds`,
23
+ * `anonymousNamespaceScopeIds`) are recomputed by `populateCppNonGloballyVisible`
24
+ * / `populateCppAnonymousNamespaceScopes` during `populateOwners`, so only the
25
+ * two capture-time maps cross the boundary.
26
+ */
27
+ export interface CppFileLocalSideChannel {
28
+ /** File-local symbol names (static / anonymous-namespace) in this file. */
29
+ readonly fileLocalNames: readonly string[];
30
+ /** Anonymous-namespace source-range keys recorded for this file. */
31
+ readonly anonymousNamespaceRanges: readonly string[];
32
+ }
33
+ /** Snapshot this file's file-local-linkage capture state for the side-channel. */
34
+ export declare function collectCppFileLocalSideChannel(filePath: string): CppFileLocalSideChannel;
35
+ /** Restore this file's file-local-linkage capture state from the side-channel. */
36
+ export declare function applyCppFileLocalSideChannel(filePath: string, data: CppFileLocalSideChannel): void;
19
37
  /** Clear tracked file-local names (call at start of each resolution pass). */
20
38
  export declare function clearFileLocalNames(): void;
21
39
  /** Resolve recorded anonymous-namespace source ranges to `ScopeId`s.
@@ -62,57 +80,5 @@ export declare function populateCppNonGloballyVisible(parsed: {
62
80
  * workspace registry walk.
63
81
  */
64
82
  export declare function isCppDefGloballyVisible(filePath: string, nodeId: string): boolean;
65
- /**
66
- * Return the names visible through a C++ wildcard import (`#include` or
67
- * `using namespace`).
68
- *
69
- * ## Contract
70
- *
71
- * C++ unqualified name lookup only sees names at the importer's enclosing
72
- * scope. Class members and namespace-nested symbols are NOT visible by
73
- * unqualified lookup from a free function in an including TU — they must
74
- * be reached via `Class::method`, `ns::name`, or a working `using`
75
- * declaration. The filter below enforces that contract for header
76
- * propagation: only defs whose nearest enclosing scope is the header's
77
- * `Module` scope are emitted as wildcard-binding names.
78
- *
79
- * ## Why scope-aware and not predicate-on-qualifiedName
80
- *
81
- * A naive `def.qualifiedName.indexOf('.') === -1` check is unreliable
82
- * because `populateClassOwnedMembers`
83
- * (`gitnexus/src/core/ingestion/scope-resolution/scope/walkers.ts`)
84
- * only dot-qualifies `qualifiedName` for `Class` scopes. Namespace-nested
85
- * defs (`namespace ns { void foo(); }`) arrive in `localDefs` with
86
- * `qualifiedName === 'foo'` and `ownerId === undefined`, indistinguishable
87
- * from a top-level free function. The structural truth lives in
88
- * `Scope.ownedDefs`: each scope lists what it structurally owns; the
89
- * Module scope owns only top-level symbols. We look the def up by
90
- * `nodeId` against the scope tree to identify its owning kind.
91
- *
92
- * ## `localDefs` consumer survey (recorded for future maintainers)
93
- *
94
- * Other consumers of `ParsedFile.localDefs` were audited at the time
95
- * this filter was introduced (see PR #1520 / plan
96
- * `docs/plans/2026-05-12-002-fix-cpp-resolver-followups-plan.md`):
97
- *
98
- * - `finalize-orchestrator.ts:113,163` — flattens defs into a workspace
99
- * registry keyed by `ownerId` + `qualifiedName`; class-owned and
100
- * namespace-owned symbols are registered under their owner, not as
101
- * unqualified names. Not a leak surface.
102
- * - `csharp/namespace-siblings.ts:307`, `go/expand-wildcards.ts:86`,
103
- * `php/scope-resolver.ts:141,151`, `c/static-linkage.ts:51` — other
104
- * languages' own wildcard / sibling expansions. Each owns its own
105
- * visibility contract.
106
- * - `receiver-bound-calls.ts:99`, `reconcile-ownership.ts:66,119`,
107
- * `mro.ts:61` — keyed by `ownerId` for member lookup, never used
108
- * as unqualified bindings.
109
- * - `go/interface-impls.ts:40,53`, `go/package-siblings.ts:41` — Go-
110
- * specific, sibling-package scoped.
111
- *
112
- * No other consumer treats `localDefs` as a flat unqualified-binding
113
- * set the way this function did before the fix. If a future consumer
114
- * does, mirror this filter or harden registration so class/namespace
115
- * members never enter `localDefs` unqualified.
116
- */
117
83
  export declare function expandCppWildcardNames(targetModuleScope: ScopeId, parsedFiles: readonly ParsedFile[]): readonly string[];
118
84
  export {};