cgraphx 2.0.1 → 2.0.3

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 (701) hide show
  1. package/dist/.claude-template/FLOW-MAP.md +7 -5
  2. package/dist/.claude-template/commands/end.md +1 -1
  3. package/dist/.claude-template/skills/cgraphx-guide/SKILL.md +2 -1
  4. package/dist/.claude-template/skills/cgraphx-guide/how-to-use.html +4 -2
  5. package/dist/.claude-template/skills/cgraphx-guide/how-to-use.md +5 -2
  6. package/dist/.claude-template/skills/iboc-check/SKILL.md +116 -0
  7. package/dist/.claude-template/skills/iboc-check/filler-prompt.md +75 -0
  8. package/dist/.claude-template/skills/implementation/SKILL.md +7 -0
  9. package/dist/.claude-template/skills/init-project-guides/SKILL.md +1 -1
  10. package/dist/.claude-template/skills/run-api-test/references/db-verification.md +2 -2
  11. package/dist/.claude-template/skills/subagent-implement/SKILL.md +3 -2
  12. package/dist/.claude-template/skills/write-api/assets/template-request.bru +3 -3
  13. package/dist/.claude-template/skills/write-api/references/bru-format.md +6 -6
  14. package/dist/.claude-template/skills/write-delivery-guide/SKILL.md +97 -0
  15. package/dist/.claude-template/skills/write-delivery-guide/template-change-type.md +120 -0
  16. package/dist/.claude-template/skills/write-delivery-guide/template-multi-role-flow.md +148 -0
  17. package/dist/.claude-template/skills/write-unit-test-code/SKILL.md +23 -6
  18. package/dist/core/code/engine/cli/analyze-config.js +320 -0
  19. package/dist/core/code/engine/cli/analyze.js +1086 -0
  20. package/dist/core/code/engine/cli/cli-message.js +83 -0
  21. package/dist/core/code/engine/cli/detect-changes-format.js +58 -0
  22. package/dist/core/code/engine/cli/embedding-dims.js +43 -0
  23. package/dist/core/code/engine/cli/format-elapsed.js +12 -0
  24. package/dist/core/code/engine/cli/help-i18n.js +144 -0
  25. package/dist/core/code/engine/cli/i18n/en.js +110 -0
  26. package/dist/core/code/engine/cli/i18n/index.js +47 -0
  27. package/dist/core/code/engine/cli/i18n/resources.js +9 -0
  28. package/dist/core/code/engine/cli/i18n/zh-CN.js +110 -0
  29. package/dist/core/code/engine/cli/lazy-action.js +67 -0
  30. package/dist/core/code/engine/cli/optional-grammars.js +136 -0
  31. package/dist/core/code/engine/cli/resolve-invocation.js +76 -0
  32. package/dist/core/code/engine/cli/status.js +156 -0
  33. package/dist/core/code/engine/cli/tool.js +384 -0
  34. package/dist/core/code/engine/config/ignore-service.js +511 -0
  35. package/dist/core/code/engine/config/supported-languages.js +17 -0
  36. package/dist/core/code/engine/core/analysis-features.js +64 -0
  37. package/dist/core/code/engine/core/analyzer-identity.js +2171 -0
  38. package/dist/core/code/engine/core/git-staleness.js +180 -0
  39. package/dist/core/code/engine/core/graph/graph.js +180 -0
  40. package/dist/core/code/engine/core/graph/import-cycles.js +106 -0
  41. package/dist/core/code/engine/core/graph/types.js +2 -0
  42. package/dist/core/code/engine/core/index-freshness.js +12 -0
  43. package/dist/core/code/engine/core/ingestion/binding-accumulator.js +341 -0
  44. package/dist/core/code/engine/core/ingestion/call-extractors/configs/c-cpp.js +168 -0
  45. package/dist/core/code/engine/core/ingestion/call-extractors/configs/csharp.js +9 -0
  46. package/dist/core/code/engine/core/ingestion/call-extractors/configs/dart.js +8 -0
  47. package/dist/core/code/engine/core/ingestion/call-extractors/configs/go.js +8 -0
  48. package/dist/core/code/engine/core/ingestion/call-extractors/configs/jvm.js +54 -0
  49. package/dist/core/code/engine/core/ingestion/call-extractors/configs/php.js +8 -0
  50. package/dist/core/code/engine/core/ingestion/call-extractors/configs/python.js +8 -0
  51. package/dist/core/code/engine/core/ingestion/call-extractors/configs/ruby.js +8 -0
  52. package/dist/core/code/engine/core/ingestion/call-extractors/configs/rust.js +8 -0
  53. package/dist/core/code/engine/core/ingestion/call-extractors/configs/swift.js +8 -0
  54. package/dist/core/code/engine/core/ingestion/call-extractors/configs/typescript-javascript.js +11 -0
  55. package/dist/core/code/engine/core/ingestion/call-extractors/generic.js +62 -0
  56. package/dist/core/code/engine/core/ingestion/call-processor.js +503 -0
  57. package/dist/core/code/engine/core/ingestion/call-routing.js +98 -0
  58. package/dist/core/code/engine/core/ingestion/call-types.js +3 -0
  59. package/dist/core/code/engine/core/ingestion/cfg/callee-cell-format.js +45 -0
  60. package/dist/core/code/engine/core/ingestion/cfg/cfg-builder.js +202 -0
  61. package/dist/core/code/engine/core/ingestion/cfg/collect.js +81 -0
  62. package/dist/core/code/engine/core/ingestion/cfg/control-dependence.js +185 -0
  63. package/dist/core/code/engine/core/ingestion/cfg/control-flow-context.js +130 -0
  64. package/dist/core/code/engine/core/ingestion/cfg/emit.js +646 -0
  65. package/dist/core/code/engine/core/ingestion/cfg/post-dominators.js +182 -0
  66. package/dist/core/code/engine/core/ingestion/cfg/reaching-def-reason-codec.js +139 -0
  67. package/dist/core/code/engine/core/ingestion/cfg/reaching-defs-graph.js +322 -0
  68. package/dist/core/code/engine/core/ingestion/cfg/reaching-defs.js +792 -0
  69. package/dist/core/code/engine/core/ingestion/cfg/synthetic-escape.js +305 -0
  70. package/dist/core/code/engine/core/ingestion/cfg/traversal-result.js +6 -0
  71. package/dist/core/code/engine/core/ingestion/cfg/types.js +14 -0
  72. package/dist/core/code/engine/core/ingestion/cfg/visitors/c-cpp-harvest.js +545 -0
  73. package/dist/core/code/engine/core/ingestion/cfg/visitors/c-cpp.js +590 -0
  74. package/dist/core/code/engine/core/ingestion/cfg/visitors/call-site-harvest.js +356 -0
  75. package/dist/core/code/engine/core/ingestion/cfg/visitors/csharp-harvest.js +593 -0
  76. package/dist/core/code/engine/core/ingestion/cfg/visitors/csharp.js +871 -0
  77. package/dist/core/code/engine/core/ingestion/cfg/visitors/dart-harvest.js +874 -0
  78. package/dist/core/code/engine/core/ingestion/cfg/visitors/dart.js +840 -0
  79. package/dist/core/code/engine/core/ingestion/cfg/visitors/go-harvest.js +625 -0
  80. package/dist/core/code/engine/core/ingestion/cfg/visitors/go.js +642 -0
  81. package/dist/core/code/engine/core/ingestion/cfg/visitors/java-harvest.js +517 -0
  82. package/dist/core/code/engine/core/ingestion/cfg/visitors/java.js +816 -0
  83. package/dist/core/code/engine/core/ingestion/cfg/visitors/kotlin-harvest.js +723 -0
  84. package/dist/core/code/engine/core/ingestion/cfg/visitors/kotlin.js +813 -0
  85. package/dist/core/code/engine/core/ingestion/cfg/visitors/php-harvest.js +630 -0
  86. package/dist/core/code/engine/core/ingestion/cfg/visitors/php.js +725 -0
  87. package/dist/core/code/engine/core/ingestion/cfg/visitors/python-harvest.js +776 -0
  88. package/dist/core/code/engine/core/ingestion/cfg/visitors/python.js +562 -0
  89. package/dist/core/code/engine/core/ingestion/cfg/visitors/ruby-harvest.js +591 -0
  90. package/dist/core/code/engine/core/ingestion/cfg/visitors/ruby.js +760 -0
  91. package/dist/core/code/engine/core/ingestion/cfg/visitors/rust-harvest.js +877 -0
  92. package/dist/core/code/engine/core/ingestion/cfg/visitors/rust.js +562 -0
  93. package/dist/core/code/engine/core/ingestion/cfg/visitors/scope-tree-harvest.js +120 -0
  94. package/dist/core/code/engine/core/ingestion/cfg/visitors/swift-harvest.js +683 -0
  95. package/dist/core/code/engine/core/ingestion/cfg/visitors/swift.js +791 -0
  96. package/dist/core/code/engine/core/ingestion/cfg/visitors/typescript-harvest.js +1060 -0
  97. package/dist/core/code/engine/core/ingestion/cfg/visitors/typescript.js +587 -0
  98. package/dist/core/code/engine/core/ingestion/class-extractors/configs/c-cpp.js +77 -0
  99. package/dist/core/code/engine/core/ingestion/class-extractors/configs/csharp.js +24 -0
  100. package/dist/core/code/engine/core/ingestion/class-extractors/configs/dart.js +10 -0
  101. package/dist/core/code/engine/core/ingestion/class-extractors/configs/go.js +28 -0
  102. package/dist/core/code/engine/core/ingestion/class-extractors/configs/jvm.js +67 -0
  103. package/dist/core/code/engine/core/ingestion/class-extractors/configs/php.js +10 -0
  104. package/dist/core/code/engine/core/ingestion/class-extractors/configs/python.js +10 -0
  105. package/dist/core/code/engine/core/ingestion/class-extractors/configs/ruby.js +13 -0
  106. package/dist/core/code/engine/core/ingestion/class-extractors/configs/rust.js +10 -0
  107. package/dist/core/code/engine/core/ingestion/class-extractors/configs/swift.js +21 -0
  108. package/dist/core/code/engine/core/ingestion/class-extractors/configs/typescript-javascript.js +31 -0
  109. package/dist/core/code/engine/core/ingestion/class-extractors/generic.js +144 -0
  110. package/dist/core/code/engine/core/ingestion/class-types.js +2 -0
  111. package/dist/core/code/engine/core/ingestion/cluster-enricher.js +174 -0
  112. package/dist/core/code/engine/core/ingestion/community-processor.js +604 -0
  113. package/dist/core/code/engine/core/ingestion/constants.js +26 -0
  114. package/dist/core/code/engine/core/ingestion/cpp-ue-preprocessor.js +263 -0
  115. package/dist/core/code/engine/core/ingestion/csharp-namespace-gate.js +133 -0
  116. package/dist/core/code/engine/core/ingestion/di-extractors/index.js +38 -0
  117. package/dist/core/code/engine/core/ingestion/di-extractors/spring.js +310 -0
  118. package/dist/core/code/engine/core/ingestion/emit-references.js +244 -0
  119. package/dist/core/code/engine/core/ingestion/entry-point-scoring.js +201 -0
  120. package/dist/core/code/engine/core/ingestion/export-detection.js +244 -0
  121. package/dist/core/code/engine/core/ingestion/field-extractor.js +29 -0
  122. package/dist/core/code/engine/core/ingestion/field-extractors/configs/c-cpp.js +107 -0
  123. package/dist/core/code/engine/core/ingestion/field-extractors/configs/csharp.js +124 -0
  124. package/dist/core/code/engine/core/ingestion/field-extractors/configs/dart.js +99 -0
  125. package/dist/core/code/engine/core/ingestion/field-extractors/configs/go.js +102 -0
  126. package/dist/core/code/engine/core/ingestion/field-extractors/configs/helpers.js +198 -0
  127. package/dist/core/code/engine/core/ingestion/field-extractors/configs/jvm.js +172 -0
  128. package/dist/core/code/engine/core/ingestion/field-extractors/configs/php.js +67 -0
  129. package/dist/core/code/engine/core/ingestion/field-extractors/configs/python.js +94 -0
  130. package/dist/core/code/engine/core/ingestion/field-extractors/configs/ruby.js +79 -0
  131. package/dist/core/code/engine/core/ingestion/field-extractors/configs/rust.js +55 -0
  132. package/dist/core/code/engine/core/ingestion/field-extractors/configs/swift.js +93 -0
  133. package/dist/core/code/engine/core/ingestion/field-extractors/configs/typescript-javascript.js +59 -0
  134. package/dist/core/code/engine/core/ingestion/field-extractors/generic.js +147 -0
  135. package/dist/core/code/engine/core/ingestion/field-extractors/typescript.js +266 -0
  136. package/dist/core/code/engine/core/ingestion/field-types.js +3 -0
  137. package/dist/core/code/engine/core/ingestion/filesystem-walker.js +136 -0
  138. package/dist/core/code/engine/core/ingestion/finalize-orchestrator.js +159 -0
  139. package/dist/core/code/engine/core/ingestion/framework-detection.js +432 -0
  140. package/dist/core/code/engine/core/ingestion/frameworks/spring/analysis-features.js +38 -0
  141. package/dist/core/code/engine/core/ingestion/frameworks/spring/annotation-arguments.js +234 -0
  142. package/dist/core/code/engine/core/ingestion/frameworks/spring/aop-candidates.js +88 -0
  143. package/dist/core/code/engine/core/ingestion/frameworks/spring/aop.js +487 -0
  144. package/dist/core/code/engine/core/ingestion/frameworks/spring/auto-configuration.js +21 -0
  145. package/dist/core/code/engine/core/ingestion/frameworks/spring/bean-candidates.js +189 -0
  146. package/dist/core/code/engine/core/ingestion/frameworks/spring/bean-catalog.js +32 -0
  147. package/dist/core/code/engine/core/ingestion/frameworks/spring/bean-factories.js +73 -0
  148. package/dist/core/code/engine/core/ingestion/frameworks/spring/conditionals.js +323 -0
  149. package/dist/core/code/engine/core/ingestion/frameworks/spring/config-bindings.js +119 -0
  150. package/dist/core/code/engine/core/ingestion/frameworks/spring/di-metadata.js +385 -0
  151. package/dist/core/code/engine/core/ingestion/frameworks/spring/resource-injection.js +96 -0
  152. package/dist/core/code/engine/core/ingestion/import-resolvers/configs/c-cpp.js +17 -0
  153. package/dist/core/code/engine/core/ingestion/import-resolvers/configs/csharp.js +46 -0
  154. package/dist/core/code/engine/core/ingestion/import-resolvers/configs/dart.js +59 -0
  155. package/dist/core/code/engine/core/ingestion/import-resolvers/configs/go.js +30 -0
  156. package/dist/core/code/engine/core/ingestion/import-resolvers/configs/jvm.js +73 -0
  157. package/dist/core/code/engine/core/ingestion/import-resolvers/configs/php.js +19 -0
  158. package/dist/core/code/engine/core/ingestion/import-resolvers/configs/python.js +45 -0
  159. package/dist/core/code/engine/core/ingestion/import-resolvers/configs/ruby.js +20 -0
  160. package/dist/core/code/engine/core/ingestion/import-resolvers/configs/rust.js +58 -0
  161. package/dist/core/code/engine/core/ingestion/import-resolvers/configs/swift.js +94 -0
  162. package/dist/core/code/engine/core/ingestion/import-resolvers/configs/typescript-javascript.js +26 -0
  163. package/dist/core/code/engine/core/ingestion/import-resolvers/csharp.js +128 -0
  164. package/dist/core/code/engine/core/ingestion/import-resolvers/go.js +50 -0
  165. package/dist/core/code/engine/core/ingestion/import-resolvers/jvm.js +112 -0
  166. package/dist/core/code/engine/core/ingestion/import-resolvers/php.js +80 -0
  167. package/dist/core/code/engine/core/ingestion/import-resolvers/python.js +75 -0
  168. package/dist/core/code/engine/core/ingestion/import-resolvers/resolver-factory.js +36 -0
  169. package/dist/core/code/engine/core/ingestion/import-resolvers/ruby.js +20 -0
  170. package/dist/core/code/engine/core/ingestion/import-resolvers/rust.js +79 -0
  171. package/dist/core/code/engine/core/ingestion/import-resolvers/standard.js +180 -0
  172. package/dist/core/code/engine/core/ingestion/import-resolvers/types.js +7 -0
  173. package/dist/core/code/engine/core/ingestion/import-resolvers/utils.js +153 -0
  174. package/dist/core/code/engine/core/ingestion/import-target-adapter.js +99 -0
  175. package/dist/core/code/engine/core/ingestion/language-config.js +391 -0
  176. package/dist/core/code/engine/core/ingestion/language-provider.js +25 -0
  177. package/dist/core/code/engine/core/ingestion/languages/c/arity-metadata.js +98 -0
  178. package/dist/core/code/engine/core/ingestion/languages/c/arity.js +21 -0
  179. package/dist/core/code/engine/core/ingestion/languages/c/capture-side-channel.js +69 -0
  180. package/dist/core/code/engine/core/ingestion/languages/c/captures.js +189 -0
  181. package/dist/core/code/engine/core/ingestion/languages/c/header-scan.js +58 -0
  182. package/dist/core/code/engine/core/ingestion/languages/c/import-decomposer.js +68 -0
  183. package/dist/core/code/engine/core/ingestion/languages/c/import-target.js +103 -0
  184. package/dist/core/code/engine/core/ingestion/languages/c/index.js +33 -0
  185. package/dist/core/code/engine/core/ingestion/languages/c/interpret.js +53 -0
  186. package/dist/core/code/engine/core/ingestion/languages/c/merge-bindings.js +26 -0
  187. package/dist/core/code/engine/core/ingestion/languages/c/query.js +210 -0
  188. package/dist/core/code/engine/core/ingestion/languages/c/scope-resolver.js +112 -0
  189. package/dist/core/code/engine/core/ingestion/languages/c/simple-hooks.js +24 -0
  190. package/dist/core/code/engine/core/ingestion/languages/c/static-linkage.js +109 -0
  191. package/dist/core/code/engine/core/ingestion/languages/c-cpp.js +506 -0
  192. package/dist/core/code/engine/core/ingestion/languages/cpp/adl.js +804 -0
  193. package/dist/core/code/engine/core/ingestion/languages/cpp/arity-metadata.js +258 -0
  194. package/dist/core/code/engine/core/ingestion/languages/cpp/arity.js +37 -0
  195. package/dist/core/code/engine/core/ingestion/languages/cpp/capture-side-channel.js +89 -0
  196. package/dist/core/code/engine/core/ingestion/languages/cpp/captures.js +1975 -0
  197. package/dist/core/code/engine/core/ingestion/languages/cpp/constraint-extractor.js +311 -0
  198. package/dist/core/code/engine/core/ingestion/languages/cpp/constraint-filter.js +210 -0
  199. package/dist/core/code/engine/core/ingestion/languages/cpp/conversion-rank.js +163 -0
  200. package/dist/core/code/engine/core/ingestion/languages/cpp/file-local-linkage.js +327 -0
  201. package/dist/core/code/engine/core/ingestion/languages/cpp/header-scan.js +53 -0
  202. package/dist/core/code/engine/core/ingestion/languages/cpp/import-decomposer.js +134 -0
  203. package/dist/core/code/engine/core/ingestion/languages/cpp/import-target.js +16 -0
  204. package/dist/core/code/engine/core/ingestion/languages/cpp/index.js +33 -0
  205. package/dist/core/code/engine/core/ingestion/languages/cpp/inline-namespaces.js +379 -0
  206. package/dist/core/code/engine/core/ingestion/languages/cpp/interpret.js +239 -0
  207. package/dist/core/code/engine/core/ingestion/languages/cpp/member-lookup.js +470 -0
  208. package/dist/core/code/engine/core/ingestion/languages/cpp/merge-bindings.js +32 -0
  209. package/dist/core/code/engine/core/ingestion/languages/cpp/query.js +763 -0
  210. package/dist/core/code/engine/core/ingestion/languages/cpp/range-bindings.js +230 -0
  211. package/dist/core/code/engine/core/ingestion/languages/cpp/scope-resolver.js +354 -0
  212. package/dist/core/code/engine/core/ingestion/languages/cpp/simple-hooks.js +67 -0
  213. package/dist/core/code/engine/core/ingestion/languages/cpp/two-phase-lookup.js +348 -0
  214. package/dist/core/code/engine/core/ingestion/languages/cpp/type-classifier.js +56 -0
  215. package/dist/core/code/engine/core/ingestion/languages/cpp/user-defined-conversions.js +128 -0
  216. package/dist/core/code/engine/core/ingestion/languages/csharp/accessor-unwrap.js +67 -0
  217. package/dist/core/code/engine/core/ingestion/languages/csharp/arity-metadata.js +49 -0
  218. package/dist/core/code/engine/core/ingestion/languages/csharp/arity.js +40 -0
  219. package/dist/core/code/engine/core/ingestion/languages/csharp/cache-stats.js +32 -0
  220. package/dist/core/code/engine/core/ingestion/languages/csharp/captures.js +557 -0
  221. package/dist/core/code/engine/core/ingestion/languages/csharp/import-decomposer.js +96 -0
  222. package/dist/core/code/engine/core/ingestion/languages/csharp/import-target.js +176 -0
  223. package/dist/core/code/engine/core/ingestion/languages/csharp/index.js +95 -0
  224. package/dist/core/code/engine/core/ingestion/languages/csharp/interpret.js +150 -0
  225. package/dist/core/code/engine/core/ingestion/languages/csharp/merge-bindings.js +58 -0
  226. package/dist/core/code/engine/core/ingestion/languages/csharp/namespace-siblings.js +708 -0
  227. package/dist/core/code/engine/core/ingestion/languages/csharp/qualified-type-names.js +62 -0
  228. package/dist/core/code/engine/core/ingestion/languages/csharp/query.js +578 -0
  229. package/dist/core/code/engine/core/ingestion/languages/csharp/receiver-binding.js +142 -0
  230. package/dist/core/code/engine/core/ingestion/languages/csharp/resolution-config.js +18 -0
  231. package/dist/core/code/engine/core/ingestion/languages/csharp/scope-resolver.js +84 -0
  232. package/dist/core/code/engine/core/ingestion/languages/csharp/simple-hooks.js +81 -0
  233. package/dist/core/code/engine/core/ingestion/languages/csharp.js +204 -0
  234. package/dist/core/code/engine/core/ingestion/languages/dart/arity-metadata.js +38 -0
  235. package/dist/core/code/engine/core/ingestion/languages/dart/arity.js +34 -0
  236. package/dist/core/code/engine/core/ingestion/languages/dart/built-ins.js +37 -0
  237. package/dist/core/code/engine/core/ingestion/languages/dart/cache-stats.js +30 -0
  238. package/dist/core/code/engine/core/ingestion/languages/dart/captures.js +1096 -0
  239. package/dist/core/code/engine/core/ingestion/languages/dart/expand-wildcards.js +34 -0
  240. package/dist/core/code/engine/core/ingestion/languages/dart/extension-type-preprocess.js +33 -0
  241. package/dist/core/code/engine/core/ingestion/languages/dart/import-target.js +68 -0
  242. package/dist/core/code/engine/core/ingestion/languages/dart/index.js +45 -0
  243. package/dist/core/code/engine/core/ingestion/languages/dart/interpret.js +101 -0
  244. package/dist/core/code/engine/core/ingestion/languages/dart/merge-bindings.js +42 -0
  245. package/dist/core/code/engine/core/ingestion/languages/dart/query.js +246 -0
  246. package/dist/core/code/engine/core/ingestion/languages/dart/receiver-binding.js +90 -0
  247. package/dist/core/code/engine/core/ingestion/languages/dart/scope-resolver.js +197 -0
  248. package/dist/core/code/engine/core/ingestion/languages/dart/signature-bindings.js +54 -0
  249. package/dist/core/code/engine/core/ingestion/languages/dart/simple-hooks.js +61 -0
  250. package/dist/core/code/engine/core/ingestion/languages/dart.js +138 -0
  251. package/dist/core/code/engine/core/ingestion/languages/go/arity-metadata.js +71 -0
  252. package/dist/core/code/engine/core/ingestion/languages/go/arity.js +17 -0
  253. package/dist/core/code/engine/core/ingestion/languages/go/cache-stats.js +21 -0
  254. package/dist/core/code/engine/core/ingestion/languages/go/captures.js +492 -0
  255. package/dist/core/code/engine/core/ingestion/languages/go/expand-wildcards.js +97 -0
  256. package/dist/core/code/engine/core/ingestion/languages/go/generic-type-parameters.js +146 -0
  257. package/dist/core/code/engine/core/ingestion/languages/go/import-decomposer.js +47 -0
  258. package/dist/core/code/engine/core/ingestion/languages/go/import-target.js +70 -0
  259. package/dist/core/code/engine/core/ingestion/languages/go/index.js +39 -0
  260. package/dist/core/code/engine/core/ingestion/languages/go/interface-impls.js +955 -0
  261. package/dist/core/code/engine/core/ingestion/languages/go/interpret.js +177 -0
  262. package/dist/core/code/engine/core/ingestion/languages/go/merge-bindings.js +21 -0
  263. package/dist/core/code/engine/core/ingestion/languages/go/method-owners.js +131 -0
  264. package/dist/core/code/engine/core/ingestion/languages/go/namespace-mirror.js +56 -0
  265. package/dist/core/code/engine/core/ingestion/languages/go/package-clause.js +79 -0
  266. package/dist/core/code/engine/core/ingestion/languages/go/package-siblings.js +83 -0
  267. package/dist/core/code/engine/core/ingestion/languages/go/query.js +298 -0
  268. package/dist/core/code/engine/core/ingestion/languages/go/range-binding.js +127 -0
  269. package/dist/core/code/engine/core/ingestion/languages/go/receiver-binding.js +24 -0
  270. package/dist/core/code/engine/core/ingestion/languages/go/scope-resolver.js +75 -0
  271. package/dist/core/code/engine/core/ingestion/languages/go/simple-hooks.js +31 -0
  272. package/dist/core/code/engine/core/ingestion/languages/go/type-binding.js +279 -0
  273. package/dist/core/code/engine/core/ingestion/languages/go.js +160 -0
  274. package/dist/core/code/engine/core/ingestion/languages/index.js +66 -0
  275. package/dist/core/code/engine/core/ingestion/languages/java/analysis-features.js +16 -0
  276. package/dist/core/code/engine/core/ingestion/languages/java/arity-metadata.js +43 -0
  277. package/dist/core/code/engine/core/ingestion/languages/java/arity.js +27 -0
  278. package/dist/core/code/engine/core/ingestion/languages/java/cache-stats.js +32 -0
  279. package/dist/core/code/engine/core/ingestion/languages/java/capture-side-channel.js +123 -0
  280. package/dist/core/code/engine/core/ingestion/languages/java/captures.js +791 -0
  281. package/dist/core/code/engine/core/ingestion/languages/java/import-decomposer.js +88 -0
  282. package/dist/core/code/engine/core/ingestion/languages/java/import-target.js +103 -0
  283. package/dist/core/code/engine/core/ingestion/languages/java/index.js +43 -0
  284. package/dist/core/code/engine/core/ingestion/languages/java/interpret.js +146 -0
  285. package/dist/core/code/engine/core/ingestion/languages/java/merge-bindings.js +43 -0
  286. package/dist/core/code/engine/core/ingestion/languages/java/package-facts.js +16 -0
  287. package/dist/core/code/engine/core/ingestion/languages/java/package-siblings.js +11 -0
  288. package/dist/core/code/engine/core/ingestion/languages/java/query.js +319 -0
  289. package/dist/core/code/engine/core/ingestion/languages/java/receiver-binding.js +98 -0
  290. package/dist/core/code/engine/core/ingestion/languages/java/scope-resolver.js +213 -0
  291. package/dist/core/code/engine/core/ingestion/languages/java/simple-hooks.js +39 -0
  292. package/dist/core/code/engine/core/ingestion/languages/java/spring-aop.js +53 -0
  293. package/dist/core/code/engine/core/ingestion/languages/java/spring-bean-metadata.js +11 -0
  294. package/dist/core/code/engine/core/ingestion/languages/java/spring-conditionals.js +52 -0
  295. package/dist/core/code/engine/core/ingestion/languages/java/spring-config-bindings.js +222 -0
  296. package/dist/core/code/engine/core/ingestion/languages/java/spring-di.js +165 -0
  297. package/dist/core/code/engine/core/ingestion/languages/java.js +192 -0
  298. package/dist/core/code/engine/core/ingestion/languages/javascript/arity.js +15 -0
  299. package/dist/core/code/engine/core/ingestion/languages/javascript/captures.js +1122 -0
  300. package/dist/core/code/engine/core/ingestion/languages/javascript/import-target.js +56 -0
  301. package/dist/core/code/engine/core/ingestion/languages/javascript/index.js +109 -0
  302. package/dist/core/code/engine/core/ingestion/languages/javascript/interpret.js +45 -0
  303. package/dist/core/code/engine/core/ingestion/languages/javascript/merge-bindings.js +21 -0
  304. package/dist/core/code/engine/core/ingestion/languages/javascript/query.js +659 -0
  305. package/dist/core/code/engine/core/ingestion/languages/javascript/scope-resolver.js +78 -0
  306. package/dist/core/code/engine/core/ingestion/languages/javascript/simple-hooks.js +44 -0
  307. package/dist/core/code/engine/core/ingestion/languages/jvm/package-facts.js +46 -0
  308. package/dist/core/code/engine/core/ingestion/languages/jvm/package-siblings.js +200 -0
  309. package/dist/core/code/engine/core/ingestion/languages/kotlin/arity-metadata.js +23 -0
  310. package/dist/core/code/engine/core/ingestion/languages/kotlin/arity.js +18 -0
  311. package/dist/core/code/engine/core/ingestion/languages/kotlin/cache-stats.js +21 -0
  312. package/dist/core/code/engine/core/ingestion/languages/kotlin/capture-side-channel.js +160 -0
  313. package/dist/core/code/engine/core/ingestion/languages/kotlin/captures.js +1262 -0
  314. package/dist/core/code/engine/core/ingestion/languages/kotlin/companion-scopes.js +72 -0
  315. package/dist/core/code/engine/core/ingestion/languages/kotlin/import-decomposer.js +40 -0
  316. package/dist/core/code/engine/core/ingestion/languages/kotlin/import-target.js +135 -0
  317. package/dist/core/code/engine/core/ingestion/languages/kotlin/index.js +26 -0
  318. package/dist/core/code/engine/core/ingestion/languages/kotlin/interpret.js +75 -0
  319. package/dist/core/code/engine/core/ingestion/languages/kotlin/merge-bindings.js +28 -0
  320. package/dist/core/code/engine/core/ingestion/languages/kotlin/owners.js +134 -0
  321. package/dist/core/code/engine/core/ingestion/languages/kotlin/package-facts.js +16 -0
  322. package/dist/core/code/engine/core/ingestion/languages/kotlin/package-siblings.js +11 -0
  323. package/dist/core/code/engine/core/ingestion/languages/kotlin/query.js +243 -0
  324. package/dist/core/code/engine/core/ingestion/languages/kotlin/receiver-binding.js +103 -0
  325. package/dist/core/code/engine/core/ingestion/languages/kotlin/scope-resolver.js +207 -0
  326. package/dist/core/code/engine/core/ingestion/languages/kotlin/simple-hooks.js +42 -0
  327. package/dist/core/code/engine/core/ingestion/languages/kotlin/spring-aop.js +68 -0
  328. package/dist/core/code/engine/core/ingestion/languages/kotlin/spring-bean-metadata.js +11 -0
  329. package/dist/core/code/engine/core/ingestion/languages/kotlin/spring-conditionals.js +53 -0
  330. package/dist/core/code/engine/core/ingestion/languages/kotlin/spring-di.js +304 -0
  331. package/dist/core/code/engine/core/ingestion/languages/kotlin.js +189 -0
  332. package/dist/core/code/engine/core/ingestion/languages/php/arity-metadata.js +66 -0
  333. package/dist/core/code/engine/core/ingestion/languages/php/arity.js +43 -0
  334. package/dist/core/code/engine/core/ingestion/languages/php/cache-stats.js +32 -0
  335. package/dist/core/code/engine/core/ingestion/languages/php/captures.js +1166 -0
  336. package/dist/core/code/engine/core/ingestion/languages/php/import-decomposer.js +238 -0
  337. package/dist/core/code/engine/core/ingestion/languages/php/import-target.js +213 -0
  338. package/dist/core/code/engine/core/ingestion/languages/php/index.js +85 -0
  339. package/dist/core/code/engine/core/ingestion/languages/php/interpret.js +256 -0
  340. package/dist/core/code/engine/core/ingestion/languages/php/merge-bindings.js +50 -0
  341. package/dist/core/code/engine/core/ingestion/languages/php/namespace-siblings.js +353 -0
  342. package/dist/core/code/engine/core/ingestion/languages/php/query.js +391 -0
  343. package/dist/core/code/engine/core/ingestion/languages/php/receiver-binding.js +135 -0
  344. package/dist/core/code/engine/core/ingestion/languages/php/scope-resolver.js +361 -0
  345. package/dist/core/code/engine/core/ingestion/languages/php/simple-hooks.js +116 -0
  346. package/dist/core/code/engine/core/ingestion/languages/php.js +302 -0
  347. package/dist/core/code/engine/core/ingestion/languages/python/arity-metadata.js +49 -0
  348. package/dist/core/code/engine/core/ingestion/languages/python/arity.js +41 -0
  349. package/dist/core/code/engine/core/ingestion/languages/python/cache-stats.js +34 -0
  350. package/dist/core/code/engine/core/ingestion/languages/python/captures.js +299 -0
  351. package/dist/core/code/engine/core/ingestion/languages/python/depends-references.js +68 -0
  352. package/dist/core/code/engine/core/ingestion/languages/python/import-decomposer.js +115 -0
  353. package/dist/core/code/engine/core/ingestion/languages/python/import-target.js +440 -0
  354. package/dist/core/code/engine/core/ingestion/languages/python/index-stats.js +30 -0
  355. package/dist/core/code/engine/core/ingestion/languages/python/index.js +96 -0
  356. package/dist/core/code/engine/core/ingestion/languages/python/interpret.js +430 -0
  357. package/dist/core/code/engine/core/ingestion/languages/python/merge-bindings.js +47 -0
  358. package/dist/core/code/engine/core/ingestion/languages/python/query.js +323 -0
  359. package/dist/core/code/engine/core/ingestion/languages/python/receiver-binding.js +310 -0
  360. package/dist/core/code/engine/core/ingestion/languages/python/scope-resolver.js +80 -0
  361. package/dist/core/code/engine/core/ingestion/languages/python/simple-hooks.js +53 -0
  362. package/dist/core/code/engine/core/ingestion/languages/python.js +140 -0
  363. package/dist/core/code/engine/core/ingestion/languages/ruby/arity.js +41 -0
  364. package/dist/core/code/engine/core/ingestion/languages/ruby/cache-stats.js +21 -0
  365. package/dist/core/code/engine/core/ingestion/languages/ruby/captures.js +864 -0
  366. package/dist/core/code/engine/core/ingestion/languages/ruby/import-target.js +88 -0
  367. package/dist/core/code/engine/core/ingestion/languages/ruby/index.js +29 -0
  368. package/dist/core/code/engine/core/ingestion/languages/ruby/interpret.js +115 -0
  369. package/dist/core/code/engine/core/ingestion/languages/ruby/merge-bindings.js +21 -0
  370. package/dist/core/code/engine/core/ingestion/languages/ruby/query.js +349 -0
  371. package/dist/core/code/engine/core/ingestion/languages/ruby/receiver-binding.js +70 -0
  372. package/dist/core/code/engine/core/ingestion/languages/ruby/scope-resolver.js +263 -0
  373. package/dist/core/code/engine/core/ingestion/languages/ruby/simple-hooks.js +68 -0
  374. package/dist/core/code/engine/core/ingestion/languages/ruby.js +215 -0
  375. package/dist/core/code/engine/core/ingestion/languages/rust/arity.js +16 -0
  376. package/dist/core/code/engine/core/ingestion/languages/rust/cache-stats.js +21 -0
  377. package/dist/core/code/engine/core/ingestion/languages/rust/captures.js +304 -0
  378. package/dist/core/code/engine/core/ingestion/languages/rust/import-decomposer.js +167 -0
  379. package/dist/core/code/engine/core/ingestion/languages/rust/import-target.js +108 -0
  380. package/dist/core/code/engine/core/ingestion/languages/rust/index.js +29 -0
  381. package/dist/core/code/engine/core/ingestion/languages/rust/interpret.js +201 -0
  382. package/dist/core/code/engine/core/ingestion/languages/rust/merge-bindings.js +21 -0
  383. package/dist/core/code/engine/core/ingestion/languages/rust/method-owners.js +76 -0
  384. package/dist/core/code/engine/core/ingestion/languages/rust/module-path.js +222 -0
  385. package/dist/core/code/engine/core/ingestion/languages/rust/qualified-call.js +482 -0
  386. package/dist/core/code/engine/core/ingestion/languages/rust/query.js +280 -0
  387. package/dist/core/code/engine/core/ingestion/languages/rust/range-binding.js +687 -0
  388. package/dist/core/code/engine/core/ingestion/languages/rust/receiver-binding.js +148 -0
  389. package/dist/core/code/engine/core/ingestion/languages/rust/scope-resolver.js +151 -0
  390. package/dist/core/code/engine/core/ingestion/languages/rust/simple-hooks.js +32 -0
  391. package/dist/core/code/engine/core/ingestion/languages/rust.js +183 -0
  392. package/dist/core/code/engine/core/ingestion/languages/swift/arity-metadata.js +44 -0
  393. package/dist/core/code/engine/core/ingestion/languages/swift/arity.js +45 -0
  394. package/dist/core/code/engine/core/ingestion/languages/swift/base-type.js +30 -0
  395. package/dist/core/code/engine/core/ingestion/languages/swift/cache-stats.js +32 -0
  396. package/dist/core/code/engine/core/ingestion/languages/swift/captures.js +594 -0
  397. package/dist/core/code/engine/core/ingestion/languages/swift/conditional-directive-preprocess.js +256 -0
  398. package/dist/core/code/engine/core/ingestion/languages/swift/implicit-imports.js +60 -0
  399. package/dist/core/code/engine/core/ingestion/languages/swift/import-decomposer.js +87 -0
  400. package/dist/core/code/engine/core/ingestion/languages/swift/import-target.js +84 -0
  401. package/dist/core/code/engine/core/ingestion/languages/swift/index.js +56 -0
  402. package/dist/core/code/engine/core/ingestion/languages/swift/interpret.js +93 -0
  403. package/dist/core/code/engine/core/ingestion/languages/swift/merge-bindings.js +51 -0
  404. package/dist/core/code/engine/core/ingestion/languages/swift/query.js +226 -0
  405. package/dist/core/code/engine/core/ingestion/languages/swift/receiver-binding.js +169 -0
  406. package/dist/core/code/engine/core/ingestion/languages/swift/scope-resolver.js +192 -0
  407. package/dist/core/code/engine/core/ingestion/languages/swift/sibling-type-bindings.js +68 -0
  408. package/dist/core/code/engine/core/ingestion/languages/swift/signature-bindings.js +69 -0
  409. package/dist/core/code/engine/core/ingestion/languages/swift/simple-hooks.js +65 -0
  410. package/dist/core/code/engine/core/ingestion/languages/swift/target-grouping.js +97 -0
  411. package/dist/core/code/engine/core/ingestion/languages/swift/target-siblings.js +74 -0
  412. package/dist/core/code/engine/core/ingestion/languages/swift.js +246 -0
  413. package/dist/core/code/engine/core/ingestion/languages/typescript/arity-metadata.js +106 -0
  414. package/dist/core/code/engine/core/ingestion/languages/typescript/arity.js +57 -0
  415. package/dist/core/code/engine/core/ingestion/languages/typescript/array-callback.js +58 -0
  416. package/dist/core/code/engine/core/ingestion/languages/typescript/cache-stats.js +34 -0
  417. package/dist/core/code/engine/core/ingestion/languages/typescript/captures.js +956 -0
  418. package/dist/core/code/engine/core/ingestion/languages/typescript/cjs-export-assignment.js +535 -0
  419. package/dist/core/code/engine/core/ingestion/languages/typescript/cjs-module-exports.js +196 -0
  420. package/dist/core/code/engine/core/ingestion/languages/typescript/import-decomposer.js +374 -0
  421. package/dist/core/code/engine/core/ingestion/languages/typescript/import-target.js +65 -0
  422. package/dist/core/code/engine/core/ingestion/languages/typescript/index.js +108 -0
  423. package/dist/core/code/engine/core/ingestion/languages/typescript/interpret.js +344 -0
  424. package/dist/core/code/engine/core/ingestion/languages/typescript/merge-bindings.js +161 -0
  425. package/dist/core/code/engine/core/ingestion/languages/typescript/nuxt-auto-imports.js +325 -0
  426. package/dist/core/code/engine/core/ingestion/languages/typescript/query.js +1328 -0
  427. package/dist/core/code/engine/core/ingestion/languages/typescript/receiver-binding.js +201 -0
  428. package/dist/core/code/engine/core/ingestion/languages/typescript/scope-resolver.js +293 -0
  429. package/dist/core/code/engine/core/ingestion/languages/typescript/simple-hooks.js +139 -0
  430. package/dist/core/code/engine/core/ingestion/languages/typescript.js +455 -0
  431. package/dist/core/code/engine/core/ingestion/languages/vue/captures.js +70 -0
  432. package/dist/core/code/engine/core/ingestion/languages/vue/import-target.js +61 -0
  433. package/dist/core/code/engine/core/ingestion/languages/vue/index.js +55 -0
  434. package/dist/core/code/engine/core/ingestion/languages/vue/scope-resolver.js +295 -0
  435. package/dist/core/code/engine/core/ingestion/languages/vue.js +96 -0
  436. package/dist/core/code/engine/core/ingestion/local-symbol-pruner.js +68 -0
  437. package/dist/core/code/engine/core/ingestion/method-extractors/configs/c-cpp.js +387 -0
  438. package/dist/core/code/engine/core/ingestion/method-extractors/configs/csharp.js +290 -0
  439. package/dist/core/code/engine/core/ingestion/method-extractors/configs/dart.js +392 -0
  440. package/dist/core/code/engine/core/ingestion/method-extractors/configs/go.js +179 -0
  441. package/dist/core/code/engine/core/ingestion/method-extractors/configs/jvm.js +350 -0
  442. package/dist/core/code/engine/core/ingestion/method-extractors/configs/php.js +306 -0
  443. package/dist/core/code/engine/core/ingestion/method-extractors/configs/python.js +312 -0
  444. package/dist/core/code/engine/core/ingestion/method-extractors/configs/ruby.js +289 -0
  445. package/dist/core/code/engine/core/ingestion/method-extractors/configs/rust.js +198 -0
  446. package/dist/core/code/engine/core/ingestion/method-extractors/configs/swift.js +286 -0
  447. package/dist/core/code/engine/core/ingestion/method-extractors/configs/typescript-javascript.js +341 -0
  448. package/dist/core/code/engine/core/ingestion/method-extractors/generic.js +209 -0
  449. package/dist/core/code/engine/core/ingestion/method-types.js +3 -0
  450. package/dist/core/code/engine/core/ingestion/model/field-registry.js +41 -0
  451. package/dist/core/code/engine/core/ingestion/model/index.js +52 -0
  452. package/dist/core/code/engine/core/ingestion/model/method-registry.js +138 -0
  453. package/dist/core/code/engine/core/ingestion/model/owned-members-lookup.js +46 -0
  454. package/dist/core/code/engine/core/ingestion/model/registration-table.js +234 -0
  455. package/dist/core/code/engine/core/ingestion/model/resolve.js +183 -0
  456. package/dist/core/code/engine/core/ingestion/model/scope-resolution-indexes.js +43 -0
  457. package/dist/core/code/engine/core/ingestion/model/semantic-model.js +179 -0
  458. package/dist/core/code/engine/core/ingestion/model/symbol-table.js +216 -0
  459. package/dist/core/code/engine/core/ingestion/model/type-registry.js +84 -0
  460. package/dist/core/code/engine/core/ingestion/mro-processor.js +709 -0
  461. package/dist/core/code/engine/core/ingestion/parsing-processor.js +312 -0
  462. package/dist/core/code/engine/core/ingestion/pipeline-phases/communities.js +69 -0
  463. package/dist/core/code/engine/core/ingestion/pipeline-phases/cross-file.js +71 -0
  464. package/dist/core/code/engine/core/ingestion/pipeline-phases/di.js +338 -0
  465. package/dist/core/code/engine/core/ingestion/pipeline-phases/http-api-calls.js +312 -0
  466. package/dist/core/code/engine/core/ingestion/pipeline-phases/index.js +54 -0
  467. package/dist/core/code/engine/core/ingestion/pipeline-phases/mro.js +40 -0
  468. package/dist/core/code/engine/core/ingestion/pipeline-phases/orm.js +78 -0
  469. package/dist/core/code/engine/core/ingestion/pipeline-phases/parse-impl.js +1286 -0
  470. package/dist/core/code/engine/core/ingestion/pipeline-phases/parse.js +41 -0
  471. package/dist/core/code/engine/core/ingestion/pipeline-phases/processes.js +193 -0
  472. package/dist/core/code/engine/core/ingestion/pipeline-phases/prune-local-symbols.js +29 -0
  473. package/dist/core/code/engine/core/ingestion/pipeline-phases/registry.js +52 -0
  474. package/dist/core/code/engine/core/ingestion/pipeline-phases/routes.js +409 -0
  475. package/dist/core/code/engine/core/ingestion/pipeline-phases/rpc-edges.js +301 -0
  476. package/dist/core/code/engine/core/ingestion/pipeline-phases/runner.js +207 -0
  477. package/dist/core/code/engine/core/ingestion/pipeline-phases/scan.js +49 -0
  478. package/dist/core/code/engine/core/ingestion/pipeline-phases/spring-aop.js +442 -0
  479. package/dist/core/code/engine/core/ingestion/pipeline-phases/spring-auto-configuration.js +264 -0
  480. package/dist/core/code/engine/core/ingestion/pipeline-phases/spring-config.js +440 -0
  481. package/dist/core/code/engine/core/ingestion/pipeline-phases/structure.js +38 -0
  482. package/dist/core/code/engine/core/ingestion/pipeline-phases/tools.js +89 -0
  483. package/dist/core/code/engine/core/ingestion/pipeline-phases/types.js +40 -0
  484. package/dist/core/code/engine/core/ingestion/pipeline.js +152 -0
  485. package/dist/core/code/engine/core/ingestion/process-processor.js +325 -0
  486. package/dist/core/code/engine/core/ingestion/resolve-references.js +205 -0
  487. package/dist/core/code/engine/core/ingestion/route-extractors/constant-resolver.js +135 -0
  488. package/dist/core/code/engine/core/ingestion/route-extractors/django-root-discovery.js +221 -0
  489. package/dist/core/code/engine/core/ingestion/route-extractors/django.js +428 -0
  490. package/dist/core/code/engine/core/ingestion/route-extractors/expo.js +39 -0
  491. package/dist/core/code/engine/core/ingestion/route-extractors/fastapi-router-bindings.js +264 -0
  492. package/dist/core/code/engine/core/ingestion/route-extractors/laravel.js +501 -0
  493. package/dist/core/code/engine/core/ingestion/route-extractors/middleware.js +175 -0
  494. package/dist/core/code/engine/core/ingestion/route-extractors/nextjs.js +81 -0
  495. package/dist/core/code/engine/core/ingestion/route-extractors/php.js +25 -0
  496. package/dist/core/code/engine/core/ingestion/route-extractors/python-const-resolver.js +307 -0
  497. package/dist/core/code/engine/core/ingestion/route-extractors/response-shapes.js +299 -0
  498. package/dist/core/code/engine/core/ingestion/route-extractors/route-path.js +71 -0
  499. package/dist/core/code/engine/core/ingestion/route-extractors/spring-shared.js +310 -0
  500. package/dist/core/code/engine/core/ingestion/route-extractors/spring.js +441 -0
  501. package/dist/core/code/engine/core/ingestion/scope-extractor-bridge.js +60 -0
  502. package/dist/core/code/engine/core/ingestion/scope-extractor.js +1373 -0
  503. package/dist/core/code/engine/core/ingestion/scope-resolution/contract/scope-resolver.js +282 -0
  504. package/dist/core/code/engine/core/ingestion/scope-resolution/graph-bridge/callee-id-sink.js +72 -0
  505. package/dist/core/code/engine/core/ingestion/scope-resolution/graph-bridge/edges.js +194 -0
  506. package/dist/core/code/engine/core/ingestion/scope-resolution/graph-bridge/ids.js +472 -0
  507. package/dist/core/code/engine/core/ingestion/scope-resolution/graph-bridge/imports-to-edges.js +49 -0
  508. package/dist/core/code/engine/core/ingestion/scope-resolution/graph-bridge/method-dispatch.js +43 -0
  509. package/dist/core/code/engine/core/ingestion/scope-resolution/graph-bridge/node-lookup.js +274 -0
  510. package/dist/core/code/engine/core/ingestion/scope-resolution/graph-bridge/references-to-edges.js +93 -0
  511. package/dist/core/code/engine/core/ingestion/scope-resolution/passes/callable-value-flow.js +1240 -0
  512. package/dist/core/code/engine/core/ingestion/scope-resolution/passes/compound-receiver.js +1174 -0
  513. package/dist/core/code/engine/core/ingestion/scope-resolution/passes/free-call-fallback.js +873 -0
  514. package/dist/core/code/engine/core/ingestion/scope-resolution/passes/imported-return-types.js +226 -0
  515. package/dist/core/code/engine/core/ingestion/scope-resolution/passes/mro.js +107 -0
  516. package/dist/core/code/engine/core/ingestion/scope-resolution/passes/overload-narrowing.js +441 -0
  517. package/dist/core/code/engine/core/ingestion/scope-resolution/passes/property-dispatch.js +122 -0
  518. package/dist/core/code/engine/core/ingestion/scope-resolution/passes/receiver-bound-calls.js +1720 -0
  519. package/dist/core/code/engine/core/ingestion/scope-resolution/pipeline/phase.js +395 -0
  520. package/dist/core/code/engine/core/ingestion/scope-resolution/pipeline/reconcile-ownership.js +208 -0
  521. package/dist/core/code/engine/core/ingestion/scope-resolution/pipeline/registry.js +49 -0
  522. package/dist/core/code/engine/core/ingestion/scope-resolution/pipeline/run.js +632 -0
  523. package/dist/core/code/engine/core/ingestion/scope-resolution/pipeline/validate-bindings-immutability.js +112 -0
  524. package/dist/core/code/engine/core/ingestion/scope-resolution/resolution-outcome.js +41 -0
  525. package/dist/core/code/engine/core/ingestion/scope-resolution/scope/namespace-targets.js +81 -0
  526. package/dist/core/code/engine/core/ingestion/scope-resolution/scope/walkers.js +1835 -0
  527. package/dist/core/code/engine/core/ingestion/scope-resolution/unresolved-receivers.js +242 -0
  528. package/dist/core/code/engine/core/ingestion/scope-resolution/utils/definition-id.js +22 -0
  529. package/dist/core/code/engine/core/ingestion/scope-resolution/workspace-index.js +151 -0
  530. package/dist/core/code/engine/core/ingestion/structure-processor.js +40 -0
  531. package/dist/core/code/engine/core/ingestion/tree-sitter-queries.js +2244 -0
  532. package/dist/core/code/engine/core/ingestion/ts-js-hoc-utils.js +115 -0
  533. package/dist/core/code/engine/core/ingestion/type-env.js +1136 -0
  534. package/dist/core/code/engine/core/ingestion/type-extractors/c-cpp.js +555 -0
  535. package/dist/core/code/engine/core/ingestion/type-extractors/csharp.js +570 -0
  536. package/dist/core/code/engine/core/ingestion/type-extractors/dart.js +372 -0
  537. package/dist/core/code/engine/core/ingestion/type-extractors/go.js +508 -0
  538. package/dist/core/code/engine/core/ingestion/type-extractors/jvm.js +875 -0
  539. package/dist/core/code/engine/core/ingestion/type-extractors/php.js +537 -0
  540. package/dist/core/code/engine/core/ingestion/type-extractors/python.js +477 -0
  541. package/dist/core/code/engine/core/ingestion/type-extractors/ruby.js +380 -0
  542. package/dist/core/code/engine/core/ingestion/type-extractors/rust.js +502 -0
  543. package/dist/core/code/engine/core/ingestion/type-extractors/shared.js +843 -0
  544. package/dist/core/code/engine/core/ingestion/type-extractors/swift.js +490 -0
  545. package/dist/core/code/engine/core/ingestion/type-extractors/types.js +2 -0
  546. package/dist/core/code/engine/core/ingestion/type-extractors/typescript.js +690 -0
  547. package/dist/core/code/engine/core/ingestion/utils/ast-helpers.js +1693 -0
  548. package/dist/core/code/engine/core/ingestion/utils/call-analysis.js +779 -0
  549. package/dist/core/code/engine/core/ingestion/utils/callable-flow-captures.js +932 -0
  550. package/dist/core/code/engine/core/ingestion/utils/callable-labels.js +49 -0
  551. package/dist/core/code/engine/core/ingestion/utils/deferred-resolution-profile.js +151 -0
  552. package/dist/core/code/engine/core/ingestion/utils/effective-ram.js +67 -0
  553. package/dist/core/code/engine/core/ingestion/utils/env.js +60 -0
  554. package/dist/core/code/engine/core/ingestion/utils/event-loop.js +9 -0
  555. package/dist/core/code/engine/core/ingestion/utils/graph-sort.js +103 -0
  556. package/dist/core/code/engine/core/ingestion/utils/heap-probe.js +45 -0
  557. package/dist/core/code/engine/core/ingestion/utils/heritage-marker.js +47 -0
  558. package/dist/core/code/engine/core/ingestion/utils/line-base.js +24 -0
  559. package/dist/core/code/engine/core/ingestion/utils/max-file-size.js +59 -0
  560. package/dist/core/code/engine/core/ingestion/utils/method-props.js +198 -0
  561. package/dist/core/code/engine/core/ingestion/utils/qualified-name.js +73 -0
  562. package/dist/core/code/engine/core/ingestion/utils/receiver-chain-captures.js +60 -0
  563. package/dist/core/code/engine/core/ingestion/utils/receiver-chain-codec.js +188 -0
  564. package/dist/core/code/engine/core/ingestion/utils/scope-tree-walk.js +36 -0
  565. package/dist/core/code/engine/core/ingestion/utils/symbol-labels.js +48 -0
  566. package/dist/core/code/engine/core/ingestion/utils/template-arguments.js +187 -0
  567. package/dist/core/code/engine/core/ingestion/utils/type-parameters.js +209 -0
  568. package/dist/core/code/engine/core/ingestion/utils/verbose.js +6 -0
  569. package/dist/core/code/engine/core/ingestion/variable-extractors/configs/c-cpp.js +133 -0
  570. package/dist/core/code/engine/core/ingestion/variable-extractors/configs/csharp.js +66 -0
  571. package/dist/core/code/engine/core/ingestion/variable-extractors/configs/dart.js +111 -0
  572. package/dist/core/code/engine/core/ingestion/variable-extractors/configs/go.js +153 -0
  573. package/dist/core/code/engine/core/ingestion/variable-extractors/configs/jvm.js +145 -0
  574. package/dist/core/code/engine/core/ingestion/variable-extractors/configs/php.js +61 -0
  575. package/dist/core/code/engine/core/ingestion/variable-extractors/configs/python.js +104 -0
  576. package/dist/core/code/engine/core/ingestion/variable-extractors/configs/ruby.js +55 -0
  577. package/dist/core/code/engine/core/ingestion/variable-extractors/configs/rust.js +79 -0
  578. package/dist/core/code/engine/core/ingestion/variable-extractors/configs/swift.js +91 -0
  579. package/dist/core/code/engine/core/ingestion/variable-extractors/configs/typescript-javascript.js +86 -0
  580. package/dist/core/code/engine/core/ingestion/variable-extractors/generic.js +111 -0
  581. package/dist/core/code/engine/core/ingestion/variable-types.js +3 -0
  582. package/dist/core/code/engine/core/ingestion/vue-sfc-extractor.js +544 -0
  583. package/dist/core/code/engine/core/ingestion/workers/callable-id.js +122 -0
  584. package/dist/core/code/engine/core/ingestion/workers/clone-safety.js +470 -0
  585. package/dist/core/code/engine/core/ingestion/workers/parse-worker.js +2456 -0
  586. package/dist/core/code/engine/core/ingestion/workers/post-result.js +90 -0
  587. package/dist/core/code/engine/core/ingestion/workers/quarantine.js +41 -0
  588. package/dist/core/code/engine/core/ingestion/workers/result-merge.js +59 -0
  589. package/dist/core/code/engine/core/ingestion/workers/worker-pool.js +1725 -0
  590. package/dist/core/code/engine/core/ingestion/workspace-config.js +139 -0
  591. package/dist/core/code/engine/core/lbug/conn-lock.js +72 -0
  592. package/dist/core/code/engine/core/lbug/csv-generator.js +710 -0
  593. package/dist/core/code/engine/core/lbug/cypher-escape.js +24 -0
  594. package/dist/core/code/engine/core/lbug/extension-load-error.js +339 -0
  595. package/dist/core/code/engine/core/lbug/extension-loader.js +261 -0
  596. package/dist/core/code/engine/core/lbug/graph-emit-sink.js +584 -0
  597. package/dist/core/code/engine/core/lbug/lbug-adapter.js +2703 -0
  598. package/dist/core/code/engine/core/lbug/lbug-config.js +1029 -0
  599. package/dist/core/code/engine/core/lbug/native-check.js +435 -0
  600. package/dist/core/code/engine/core/lbug/pool-adapter.js +973 -0
  601. package/dist/core/code/engine/core/lbug/query-params.js +25 -0
  602. package/dist/core/code/engine/core/lbug/query-result-utils.js +31 -0
  603. package/dist/core/code/engine/core/lbug/rel-pair-routing.js +373 -0
  604. package/dist/core/code/engine/core/lbug/schema.js +771 -0
  605. package/dist/core/code/engine/core/lbug/shutdown-helpers.js +40 -0
  606. package/dist/core/code/engine/core/lbug/sidecar-recovery.js +716 -0
  607. package/dist/core/code/engine/core/lbug/stdio-capture.js +49 -0
  608. package/dist/core/code/engine/core/lbug/sync-csv-writer.js +115 -0
  609. package/dist/core/code/engine/core/lbug/wal-checkpoint-driver.js +215 -0
  610. package/dist/core/code/engine/core/lbug/wal-driver-state.js +28 -0
  611. package/dist/core/code/engine/core/logger.js +339 -0
  612. package/dist/core/code/engine/core/platform/capabilities.js +91 -0
  613. package/dist/core/code/engine/core/run-analyze.js +1098 -0
  614. package/dist/core/code/engine/core/tree-sitter/parser-loader.js +281 -0
  615. package/dist/core/code/engine/core/tree-sitter/safe-parse.js +258 -0
  616. package/dist/core/code/engine/core/tree-sitter/vendored-grammars.js +64 -0
  617. package/dist/core/code/engine/lib/utils.js +121 -0
  618. package/dist/core/code/engine/mcp/core/lbug-adapter.js +27 -0
  619. package/dist/core/code/engine/mcp/local/aop-metadata.js +230 -0
  620. package/dist/core/code/engine/mcp/local/bean-metadata.js +49 -0
  621. package/dist/core/code/engine/mcp/local/limits.js +15 -0
  622. package/dist/core/code/engine/mcp/local/line-display.js +6 -0
  623. package/dist/core/code/engine/mcp/local/local-backend.js +4142 -0
  624. package/dist/core/code/engine/storage/branch-index.js +72 -0
  625. package/dist/core/code/engine/storage/file-hash.js +95 -0
  626. package/dist/core/code/engine/storage/fs-atomic.js +34 -0
  627. package/dist/core/code/engine/storage/git.js +555 -0
  628. package/dist/core/code/engine/storage/index-lock.js +664 -0
  629. package/dist/core/code/engine/storage/parse-cache.js +650 -0
  630. package/dist/core/code/engine/storage/parsedfile-store.js +620 -0
  631. package/dist/core/code/engine/storage/repo-manager.js +1061 -0
  632. package/dist/core/code/engine/storage/scope-index-store.js +247 -0
  633. package/dist/core/code/engine/types/pipeline.js +2 -0
  634. package/dist/core/code/scripts/install-duckdb-extension.mjs +125 -0
  635. package/dist/core/code/scripts/resolve-analyze-cmd.cjs +346 -0
  636. package/dist/core/code/shared/graph/types.js +8 -0
  637. package/dist/core/code/shared/index.js +105 -0
  638. package/dist/core/code/shared/integrations/circuit-breaker.js +242 -0
  639. package/dist/core/code/shared/integrations/resilient-fetch.js +224 -0
  640. package/dist/core/code/shared/integrations/retry.js +70 -0
  641. package/dist/core/code/shared/integrations/understand-quickly.js +145 -0
  642. package/dist/core/code/shared/language-detection.js +162 -0
  643. package/dist/core/code/shared/languages.js +27 -0
  644. package/dist/core/code/shared/lbug/schema-constants.js +98 -0
  645. package/dist/core/code/shared/mro-strategy.js +2 -0
  646. package/dist/core/code/shared/pipeline.js +5 -0
  647. package/dist/core/code/shared/scope-resolution/callable-flow-site.js +11 -0
  648. package/dist/core/code/shared/scope-resolution/def-index.js +53 -0
  649. package/dist/core/code/shared/scope-resolution/evidence-weights.js +87 -0
  650. package/dist/core/code/shared/scope-resolution/finalize-algorithm.js +807 -0
  651. package/dist/core/code/shared/scope-resolution/language-classification.js +46 -0
  652. package/dist/core/code/shared/scope-resolution/method-dispatch-index.js +100 -0
  653. package/dist/core/code/shared/scope-resolution/module-scope-index.js +59 -0
  654. package/dist/core/code/shared/scope-resolution/origin-priority.js +23 -0
  655. package/dist/core/code/shared/scope-resolution/parsed-file.js +54 -0
  656. package/dist/core/code/shared/scope-resolution/position-index.js +136 -0
  657. package/dist/core/code/shared/scope-resolution/qualified-name-index.js +77 -0
  658. package/dist/core/code/shared/scope-resolution/reference-site.js +24 -0
  659. package/dist/core/code/shared/scope-resolution/registries/class-registry.js +32 -0
  660. package/dist/core/code/shared/scope-resolution/registries/context.js +52 -0
  661. package/dist/core/code/shared/scope-resolution/registries/evidence.js +152 -0
  662. package/dist/core/code/shared/scope-resolution/registries/field-registry.js +33 -0
  663. package/dist/core/code/shared/scope-resolution/registries/lookup-core.js +392 -0
  664. package/dist/core/code/shared/scope-resolution/registries/lookup-qualified.js +58 -0
  665. package/dist/core/code/shared/scope-resolution/registries/macro-registry.js +34 -0
  666. package/dist/core/code/shared/scope-resolution/registries/method-registry.js +34 -0
  667. package/dist/core/code/shared/scope-resolution/registries/tie-breaks.js +63 -0
  668. package/dist/core/code/shared/scope-resolution/resolve-type-ref.js +128 -0
  669. package/dist/core/code/shared/scope-resolution/scope-id.js +49 -0
  670. package/dist/core/code/shared/scope-resolution/scope-tree.js +225 -0
  671. package/dist/core/code/shared/scope-resolution/symbol-definition.js +12 -0
  672. package/dist/core/code/shared/scope-resolution/types.js +25 -0
  673. package/dist/core/code/shared/test-helpers.js +17 -0
  674. package/dist/core/code/vendor/leiden/index.cjs +355 -0
  675. package/dist/core/code/vendor/leiden/utils.cjs +419 -0
  676. package/dist/core/features/scanner.d.ts +2 -0
  677. package/dist/core/features/scanner.d.ts.map +1 -1
  678. package/dist/core/features/scanner.js +27 -6
  679. package/dist/core/features/scanner.js.map +1 -1
  680. package/dist/core/timeline/cli.d.ts.map +1 -1
  681. package/dist/core/timeline/cli.js +13 -6
  682. package/dist/core/timeline/cli.js.map +1 -1
  683. package/dist/core/timeline/debris.d.ts +20 -0
  684. package/dist/core/timeline/debris.d.ts.map +1 -0
  685. package/dist/core/timeline/debris.js +124 -0
  686. package/dist/core/timeline/debris.js.map +1 -0
  687. package/dist/core/timeline/hook-runner.d.ts.map +1 -1
  688. package/dist/core/timeline/hook-runner.js +3 -1
  689. package/dist/core/timeline/hook-runner.js.map +1 -1
  690. package/dist/core/timeline/hooks.d.ts.map +1 -1
  691. package/dist/core/timeline/hooks.js +13 -5
  692. package/dist/core/timeline/hooks.js.map +1 -1
  693. package/dist/core/timeline/installer.d.ts +2 -0
  694. package/dist/core/timeline/installer.d.ts.map +1 -1
  695. package/dist/core/timeline/installer.js +12 -0
  696. package/dist/core/timeline/installer.js.map +1 -1
  697. package/dist/core/timeline/project-root.d.ts +21 -0
  698. package/dist/core/timeline/project-root.d.ts.map +1 -0
  699. package/dist/core/timeline/project-root.js +83 -0
  700. package/dist/core/timeline/project-root.js.map +1 -0
  701. package/package.json +1 -1
@@ -0,0 +1,956 @@
1
+ "use strict";
2
+ /**
3
+ * `emitScopeCaptures` for TypeScript.
4
+ *
5
+ * Drives the TypeScript scope query against tree-sitter-typescript and groups
6
+ * raw matches into `CaptureMatch[]` for the central extractor. Layers
7
+ * synthesized streams on top:
8
+ *
9
+ * 1. **Import decomposition** — each `import_statement` / re-export is
10
+ * re-emitted with `@import.kind/source/name/alias/typeOnly` markers so
11
+ * `interpretTsImport` can recover the `ParsedImport` shape without
12
+ * re-parsing raw text (see `import-decomposer.ts`). Unit 2 adds this;
13
+ * until then, raw `@import.statement` matches flow through as-is.
14
+ * 2. **Dynamic imports** — `import('./m')` is re-emitted as a
15
+ * decomposed `@import.statement` with `@import.kind=dynamic` so the
16
+ * central extractor treats it uniformly with static imports.
17
+ * 3. **Function-decl arity metadata** (Unit 5) — `@declaration.parameter-count`
18
+ * / `@declaration.required-parameter-count` / `@declaration.parameter-types`
19
+ * synthesized onto function-like declarations so the registry can narrow
20
+ * overloads.
21
+ * 4. **Callsite arity metadata** (Unit 5) — `@reference.arity` /
22
+ * `@reference.parameter-types` on every callsite.
23
+ * 5. **Receiver-binding synthesis** (Unit 3) — `this` type anchors on
24
+ * instance methods, with arrow-function lexical-this walk-up.
25
+ *
26
+ * Pure given the input source text. No I/O, no globals consulted.
27
+ */
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.TS_CLASS_FIELD_DEFINITION_TYPES = exports.FUNCTION_NODE_TYPES = void 0;
30
+ exports.isStaticClassFieldBinding = isStaticClassFieldBinding;
31
+ exports.emitTsScopeCaptures = emitTsScopeCaptures;
32
+ const ast_helpers_js_1 = require("../../utils/ast-helpers.js");
33
+ const import_decomposer_js_1 = require("./import-decomposer.js");
34
+ const query_js_1 = require("./query.js");
35
+ const cache_stats_js_1 = require("./cache-stats.js");
36
+ const receiver_binding_js_1 = require("./receiver-binding.js");
37
+ const arity_metadata_js_1 = require("./arity-metadata.js");
38
+ const array_callback_js_1 = require("./array-callback.js");
39
+ const cjs_export_assignment_js_1 = require("./cjs-export-assignment.js");
40
+ const helpers_js_1 = require("../../field-extractors/configs/helpers.js");
41
+ const constants_js_1 = require("../../constants.js");
42
+ const safe_parse_js_1 = require("../../../tree-sitter/safe-parse.js");
43
+ const callable_flow_captures_js_1 = require("../../utils/callable-flow-captures.js");
44
+ const cjs_module_exports_js_1 = require("./cjs-module-exports.js");
45
+ const receiver_chain_captures_js_1 = require("../../utils/receiver-chain-captures.js");
46
+ const ts_js_hoc_utils_js_1 = require("../../ts-js-hoc-utils.js");
47
+ /** tree-sitter-typescript node types for function-like scopes that may
48
+ * carry a synthesized `this` binding. Kept in sync with the
49
+ * `@scope.function` patterns in `query.ts`. */
50
+ exports.FUNCTION_NODE_TYPES = [
51
+ 'method_definition',
52
+ 'method_signature',
53
+ 'abstract_method_signature',
54
+ 'arrow_function',
55
+ 'function_expression',
56
+ 'function_declaration',
57
+ 'generator_function_declaration',
58
+ // The EXPRESSION form (`const g = function* () {}`). Both queries capture it
59
+ // as `@scope.function`, and both `this`-boundary lists already carry it, but
60
+ // this list did not — so callable-flow synthesis and the body-block filter
61
+ // treated a generator expression as a non-function.
62
+ //
63
+ // Measured: adding it changes no graph output today. A generator-expression
64
+ // binding still emits a `Const` node rather than a `Function` one, so the
65
+ // call never resolves either way — that label comes from the definition
66
+ // rules, not from here, and closing it is a separate change. This entry is
67
+ // list consistency, enforced by
68
+ // `test/unit/ts-js-function-node-type-lists.test.ts`.
69
+ 'generator_function',
70
+ 'function_signature',
71
+ ];
72
+ /** Nodes whose `statement_block` child is their BODY, not a nested block.
73
+ * Such a block duplicates the enclosing Function scope — see the emit-side
74
+ * filter in `emitTsScopeCaptures`. */
75
+ const FUNCTION_BODY_OWNER_TYPES = new Set(exports.FUNCTION_NODE_TYPES);
76
+ /** Direct-child node types that create a BINDING in their enclosing block.
77
+ * `variable_declaration` (`var`) is deliberately absent: it hoists past the
78
+ * block to the function, so a block containing only `var` binds nothing. */
79
+ const BLOCK_BINDING_CHILD_TYPES = new Set([
80
+ 'lexical_declaration',
81
+ 'class_declaration',
82
+ 'function_declaration',
83
+ 'generator_function_declaration',
84
+ ]);
85
+ /** True when `block` directly declares a name, i.e. it is a real environment
86
+ * record rather than punctuation. A block that binds nothing is transparent to
87
+ * every scope-chain walk — a lookup finds nothing in it and continues to the
88
+ * parent — so emitting a scope for it costs tree size and walk depth and buys
89
+ * exactly nothing. Only DIRECT children count: a declaration in a nested block
90
+ * belongs to that block, which gets its own scope by the same rule. */
91
+ const blockDeclaresBinding = (block) => {
92
+ for (let i = 0; i < block.namedChildCount; i++) {
93
+ const child = block.namedChild(i);
94
+ if (child !== null && BLOCK_BINDING_CHILD_TYPES.has(child.type))
95
+ return true;
96
+ }
97
+ return false;
98
+ };
99
+ /** Declaration anchors that carry function-like arity metadata. */
100
+ const FUNCTION_DECL_TAGS = ['@declaration.method', '@declaration.function'];
101
+ /** Callsite anchors that should carry `@reference.arity` + param types. */
102
+ const CALL_TAGS = [
103
+ '@reference.call.free',
104
+ '@reference.call.member',
105
+ '@reference.call.constructor',
106
+ ];
107
+ const TS_CALLABLE_CAPTURE_OPTIONS = {
108
+ functionNodeTypes: new Set(exports.FUNCTION_NODE_TYPES),
109
+ callNodeTypes: new Set(['call_expression']),
110
+ parameterListNodeTypes: new Set(['formal_parameters', 'arguments']),
111
+ parameterNodeTypes: new Set([
112
+ 'required_parameter',
113
+ 'optional_parameter',
114
+ 'rest_pattern',
115
+ 'identifier',
116
+ ]),
117
+ bindingNodeTypes: new Set(['variable_declarator']),
118
+ assignmentNodeTypes: new Set(['assignment_expression', 'augmented_assignment_expression']),
119
+ identifierNodeTypes: new Set([
120
+ 'identifier',
121
+ 'property_identifier',
122
+ 'shorthand_property_identifier_pattern',
123
+ 'private_property_identifier',
124
+ ]),
125
+ };
126
+ function pickFirstCapture(grouped, tags) {
127
+ for (const tag of tags) {
128
+ const cap = grouped[tag];
129
+ if (cap !== undefined)
130
+ return cap;
131
+ }
132
+ return undefined;
133
+ }
134
+ function pickFirstNode(grouped, tags) {
135
+ for (const tag of tags) {
136
+ const node = grouped[tag];
137
+ if (node !== undefined)
138
+ return node;
139
+ }
140
+ return undefined;
141
+ }
142
+ /**
143
+ * Drop `@reference.read.member` matches whose underlying `member_expression`
144
+ * is NOT actually a read context:
145
+ *
146
+ * 1. The member_expression is the `function:` of a `call_expression`
147
+ * (it's a call, already captured as `@reference.call.member`).
148
+ * 2. The member_expression is the `constructor:` of a `new_expression`
149
+ * (already captured as `@reference.call.constructor.qualified`).
150
+ * 3. The member_expression is the `left:` of an `assignment_expression` /
151
+ * `augmented_assignment_expression` (it's a write, already captured
152
+ * as `@reference.write.member`).
153
+ * 4. The member_expression is the `function:` of an `await_expression`
154
+ * being called (handled by the member-call capture).
155
+ * 5. The member_expression is the `name:` of a `jsx_self_closing_element`
156
+ * or `jsx_opening_element` (it's a JSX component invocation, already
157
+ * captured as `@reference.call.member` by the TSX-only query suffix).
158
+ * Without this filter, `<Foo.Bar />` would emit a phantom ACCESSES
159
+ * edge to `Foo.Bar` IN ADDITION to the CALLS edge.
160
+ *
161
+ * Returns `true` when the capture should be kept as a read reference,
162
+ * `false` when it should be dropped.
163
+ */
164
+ function shouldEmitReadMember(memberNode) {
165
+ const parent = memberNode.parent;
166
+ if (parent === null)
167
+ return true;
168
+ switch (parent.type) {
169
+ case 'call_expression':
170
+ return parent.childForFieldName('function')?.id !== memberNode.id;
171
+ case 'new_expression':
172
+ return parent.childForFieldName('constructor')?.id !== memberNode.id;
173
+ case 'assignment_expression':
174
+ case 'augmented_assignment_expression':
175
+ return parent.childForFieldName('left')?.id !== memberNode.id;
176
+ case 'jsx_self_closing_element':
177
+ case 'jsx_opening_element':
178
+ return parent.childForFieldName('name')?.id !== memberNode.id;
179
+ default:
180
+ return true;
181
+ }
182
+ }
183
+ /**
184
+ * Is this `(this)` node the `this` of a STATIC method?
185
+ *
186
+ * `this` in a static method is the class object, so `this.x = new Y()` there
187
+ * assigns a STATIC property and must never type the instance field of the same
188
+ * name (#2807). Every other context that rebinds `this` is excluded
189
+ * structurally, by the query's `class_body → method_definition →
190
+ * statement_block → expression_statement` nesting; `static` is the one
191
+ * constraint tree-sitter cannot carry, because it is an ANONYMOUS token with no
192
+ * field name and patterns cannot negate one.
193
+ *
194
+ * The caller only reaches here for a capture the query already pinned inside a
195
+ * class method, so the `method_definition` lookup is a short walk. Detection is
196
+ * the shared `hasKeyword`, which is what the TypeScript METHOD EXTRACTOR already
197
+ * uses to decide the same question — matching on child TEXT, and skipping the
198
+ * `name` field so a method literally called `static()` is not misread.
199
+ *
200
+ * Text, not node type: `static` reaches the tree as an anonymous token in some
201
+ * grammar versions and as a keyword node in others (see `isStaticMember` in
202
+ * `receiver-binding.ts`), so a `child.type === 'static'` test silently stops
203
+ * firing on a grammar bump and every static `this.x = new Y()` starts typing the
204
+ * instance field of that name. `hasKeyword` scans the whole `method_definition`
205
+ * rather than stopping at the name, which is safe here because a
206
+ * `method_definition`'s own children are its modifiers, name, parameters and
207
+ * body — a mention of `static` inside the BODY is a descendant of the body node,
208
+ * never a direct child.
209
+ */
210
+ function isStaticMethodThis(thisNode) {
211
+ const method = findSelfOrAncestorOfType(thisNode, 'method_definition');
212
+ if (method === null)
213
+ return false;
214
+ return (0, helpers_js_1.hasKeyword)(method, 'static');
215
+ }
216
+ /** The class-field declaration node a field `@type-binding.*` match anchors on
217
+ * in TypeScript/TSX. JavaScript spells the same construct `field_definition`
218
+ * and passes its own set in — the predicate below is shared because both
219
+ * grammars carry `static` identically, but each language must NAME its own
220
+ * node type. Listing both here made `field_definition` a dead literal in the
221
+ * typescript grammar, which `grammar-literal-validation` fails on: the gate
222
+ * checks every literal against the grammar of the FILE it appears in, and a
223
+ * node type that is dead there is exactly how a guard silently stops firing. */
224
+ exports.TS_CLASS_FIELD_DEFINITION_TYPES = new Set([
225
+ 'public_field_definition',
226
+ ]);
227
+ /**
228
+ * Is this type-binding anchored on a **`static`** class field?
229
+ *
230
+ * A static member belongs to the CLASS OBJECT; an instance field belongs to
231
+ * instances. JavaScript and TypeScript keep the two in separate namespaces, so
232
+ * one class may legally declare both under one name:
233
+ *
234
+ * class Host {
235
+ * p = new Right();
236
+ * static p = new Wrong(); // legal — a different member
237
+ * hit() { return this.p.hit(); } // `this.p` is Right
238
+ * }
239
+ *
240
+ * Both field patterns anchor their binding on the same CLASS scope with the
241
+ * same `constructor-inferred` source, and `scope-extractor` breaks a
242
+ * same-strength tie with `>=` — last match wins. So the static field silently
243
+ * RETYPED the instance field of that name and `this.p.hit()` resolved to
244
+ * `Wrong.hit`: not a missing edge but a wrong one, the failure mode
245
+ * `scope-resolution/passes/compound-receiver.ts` exists to avoid. The scope
246
+ * tree has one `typeBindings` map per scope with no static/instance split, so a
247
+ * static field cannot be recorded separately — it is dropped instead.
248
+ *
249
+ * WHAT THAT COSTS, MEASURED rather than assumed (#2807 review, S7). An earlier
250
+ * version of this comment called the cost "a missed edge beats a wrong one".
251
+ * Only half of that is true, and the false half is the one that matters:
252
+ *
253
+ * shape with the drop without it
254
+ * -------------------------- ---------------- ----------------
255
+ * `this.p` (instance twin) Right ✓ Wrong ✗
256
+ * `Host.p` (static twin) Right ✗ WRONG Wrong ✓
257
+ * `Host.q` (static, no twin) — none, missed Wrong ✓
258
+ *
259
+ * For a class declaring BOTH twins the wrong edge does not disappear, it MOVES:
260
+ * `Host.p` now reads the INSTANCE twin's binding, because that is what is left
261
+ * in the map under that name. Only the no-twin case — the common static shape —
262
+ * is a true missed edge.
263
+ *
264
+ * The trade is still the right one, since `this.p` is overwhelmingly the more
265
+ * common access and a `Host.p` static chain is the cheaper place to be wrong.
266
+ * It is recorded here as a wrong edge rather than described as a missing one so
267
+ * that the next person weighing it is weighing the real thing. Closing it
268
+ * properly needs a static/instance split that the shared receiver fold cannot
269
+ * express today — `foldReceiverChain` in
270
+ * `scope-resolution/passes/compound-receiver.ts` explicitly discards whether a
271
+ * chain's base was a class reference or a value — so it is a separate change
272
+ * with a `SCHEMA_BUMP`, not a tweak here. Both shapes are pinned by rows in
273
+ * `test/integration/resolvers/inferred-field-receiver-matrix.test.ts`
274
+ * (`static-read-of-a-same-name-twin-picks-up-the-instance-type`,
275
+ * `static-read-without-a-twin-loses-its-type`), so the cost moves visibly.
276
+ *
277
+ * Sibling of {@link isStaticMethodThis}, which drops the ASSIGNMENT form
278
+ * (`this.x = new Y()` inside a static method). Together they cover both ways a
279
+ * static member can reach the field-typing path. This is an emit-side filter
280
+ * for the same reason that one is: `static` is an ANONYMOUS token on the
281
+ * declaration node, and a tree-sitter pattern cannot negate one.
282
+ *
283
+ * Detection is the shared `hasKeyword` — matching on child TEXT, never
284
+ * `child.type === 'static'`, because the token reaches the tree as an anonymous
285
+ * token in some grammar versions and a keyword node in others (see
286
+ * `isStaticMember` in `receiver-binding.ts`); a node-type test silently stops
287
+ * firing on a grammar bump and every static field starts retyping its instance
288
+ * twin again. Verified against both grammars in use here: `static` is an
289
+ * anonymous direct child of the caller's field-definition node —
290
+ * `public_field_definition` in TypeScript, `field_definition` in JavaScript —
291
+ * ahead of the name. Each language passes its OWN node-type set rather than the
292
+ * predicate holding both: a literal is only valid in the grammar of the file it
293
+ * appears in, and `grammar-literal-validation` fails a dead one.
294
+ *
295
+ * One deliberate over-fire: `hasKeyword` skips the node's `name` FIELD, and the
296
+ * JavaScript grammar names a field's name `property:`, not `name:` — so the
297
+ * legal-but-rare JavaScript field literally called `static`
298
+ * (`class C { static = new Right(); }`) reads as static and goes untyped. That
299
+ * is a declined binding, the safe direction of the same trade.
300
+ */
301
+ function isStaticClassFieldBinding(anchorNode, fieldDefinitionTypes) {
302
+ if (anchorNode === undefined)
303
+ return false;
304
+ if (!fieldDefinitionTypes.has(anchorNode.type))
305
+ return false;
306
+ return (0, helpers_js_1.hasKeyword)(anchorNode, 'static');
307
+ }
308
+ /** Walks the parent chain from `node` (inclusive), returning the first node
309
+ * whose type matches, or null. Faster than `findNodeAtRange` when the caller
310
+ * already holds the anchor node — avoids re-scanning the tree from the root. */
311
+ function findSelfOrAncestorOfType(node, type) {
312
+ if (node === undefined)
313
+ return null;
314
+ let current = node;
315
+ while (current !== null) {
316
+ if (current.type === type)
317
+ return current;
318
+ current = current.parent;
319
+ }
320
+ return null;
321
+ }
322
+ /** Walks the parent chain from `node` (inclusive), returning the first node
323
+ * whose type is in the set, or null. Plural form of {@link findSelfOrAncestorOfType}. */
324
+ function findSelfOrAncestorOfTypes(node, types) {
325
+ if (node === undefined)
326
+ return null;
327
+ let current = node;
328
+ while (current !== null) {
329
+ if (types.includes(current.type))
330
+ return current;
331
+ current = current.parent;
332
+ }
333
+ return null;
334
+ }
335
+ function emitTsScopeCaptures(sourceText, filePath, cachedTree) {
336
+ // Reuse a pre-parsed Tree when the caller passes one via `cachedTree`; a
337
+ // miss re-parses. (The cache is currently always empty — its only producer,
338
+ // the sequential parser, was removed — so this re-parses in practice.) The
339
+ // cachedTree parameter is typed `unknown` at the LanguageProvider contract
340
+ // layer; cast here at the use site.
341
+ //
342
+ // Grammar selection: `.tsx` files are parsed with the TSX grammar,
343
+ // `.ts` files with the TypeScript grammar. The two grammars have
344
+ // separate node-type id spaces, so a Query compiled against one
345
+ // cannot match a Tree produced by the other. We validate the cached
346
+ // tree's grammar against the file extension and fall back to a
347
+ // fresh parse if they disagree (e.g. a worker-mode parse landed
348
+ // with the wrong grammar pinned).
349
+ let tree = cachedTree;
350
+ if (tree !== undefined && !(0, query_js_1.tsCachedTreeMatchesGrammar)(tree, filePath)) {
351
+ tree = undefined;
352
+ }
353
+ if (tree === undefined) {
354
+ tree = (0, safe_parse_js_1.parseSourceSafe)((0, query_js_1.getTsParser)(filePath), sourceText, undefined, {
355
+ bufferSize: (0, constants_js_1.getTreeSitterBufferSize)(sourceText),
356
+ });
357
+ (0, cache_stats_js_1.recordCacheMiss)();
358
+ }
359
+ else {
360
+ (0, cache_stats_js_1.recordCacheHit)();
361
+ }
362
+ const rawMatches = (0, query_js_1.getTsScopeQuery)(filePath).matches(tree.rootNode);
363
+ const out = [];
364
+ for (const m of rawMatches) {
365
+ // Group captures by their tag name. Tree-sitter strips the leading
366
+ // `@`; we put it back so the central extractor's prefix lookups
367
+ // (`@scope.`, `@declaration.`, …) work.
368
+ const grouped = {};
369
+ const groupedNodes = {};
370
+ for (const c of m.captures) {
371
+ const tag = '@' + c.name;
372
+ grouped[tag] = (0, ast_helpers_js_1.nodeToCapture)(tag, c.node);
373
+ groupedNodes[tag] = c.node;
374
+ }
375
+ if (Object.keys(grouped).length === 0)
376
+ continue;
377
+ // Decompose each `import_statement` / re-export `export_statement`
378
+ // so `interpretTsImport` sees the kind/source/name/alias markers
379
+ // it consumes. The raw query anchor carries only @import.statement.
380
+ // Side-effect imports emit a non-binding marker so finalize can keep
381
+ // the file-level dependency.
382
+ if (grouped['@import.statement'] !== undefined) {
383
+ const stmtCapture = grouped['@import.statement'];
384
+ const stmtNode = findSelfOrAncestorOfTypes(groupedNodes['@import.statement'], [
385
+ 'import_statement',
386
+ 'export_statement',
387
+ ]) ??
388
+ (0, ast_helpers_js_1.findNodeAtRange)(tree.rootNode, stmtCapture.range, 'import_statement') ??
389
+ (0, ast_helpers_js_1.findNodeAtRange)(tree.rootNode, stmtCapture.range, 'export_statement');
390
+ if (stmtNode !== null) {
391
+ const decomposed = (0, import_decomposer_js_1.splitImportStatement)(stmtNode);
392
+ for (const d of decomposed)
393
+ out.push(d);
394
+ }
395
+ // If decomposition yielded nothing (malformed/bare anchor), drop
396
+ // the match. Emitting a bare
397
+ // @import.statement without kind/source would confuse the
398
+ // central extractor.
399
+ continue;
400
+ }
401
+ // Dynamic imports — decompose via the same path. `@import.dynamic`
402
+ // is anchored on a `call_expression`, which the decomposer's
403
+ // `splitDynamicImport` branch consumes.
404
+ if (grouped['@import.dynamic'] !== undefined) {
405
+ const dynCapture = grouped['@import.dynamic'];
406
+ const callNode = findSelfOrAncestorOfType(groupedNodes['@import.dynamic'], 'call_expression') ??
407
+ (0, ast_helpers_js_1.findNodeAtRange)(tree.rootNode, dynCapture.range, 'call_expression');
408
+ if (callNode !== null) {
409
+ const decomposed = (0, import_decomposer_js_1.splitImportStatement)(callNode);
410
+ for (const d of decomposed)
411
+ out.push(d);
412
+ }
413
+ continue;
414
+ }
415
+ // A `statement_block` that IS a function body adds nothing: the enclosing
416
+ // Function scope already provides that environment record, so emitting one
417
+ // here just puts a redundant level inside EVERY function for every
418
+ // scope-chain walk to step through. Measured on a 762-file TypeScript
419
+ // corpus, keeping them cost ~6% of total analyze wall time; dropping them
420
+ // keeps the block scopes that matter (if/else/for/while/try/bare blocks,
421
+ // where `let`/`const` genuinely shadow) at no measurable cost.
422
+ //
423
+ // Semantically safe: nothing can be declared between a function and its
424
+ // own body, so a binding in either resolves identically.
425
+ if (grouped['@scope.block'] !== undefined) {
426
+ const blockNode = groupedNodes['@scope.block'];
427
+ const parentType = blockNode?.parent?.type;
428
+ if (parentType !== undefined && FUNCTION_BODY_OWNER_TYPES.has(parentType))
429
+ continue;
430
+ if (blockNode === undefined || !blockDeclaresBinding(blockNode))
431
+ continue;
432
+ }
433
+ // Filter out `@reference.read.member` matches whose AST parent tells
434
+ // us they are actually calls / writes / constructor invocations. The
435
+ // tree-sitter pattern is context-free and matches every member_expression;
436
+ // we rely on this emit-side filter so the query stays simple.
437
+ if (grouped['@reference.read.member'] !== undefined) {
438
+ const anchor = grouped['@reference.read.member'];
439
+ const memberNode = findSelfOrAncestorOfType(groupedNodes['@reference.read.member'], 'member_expression') ??
440
+ (0, ast_helpers_js_1.findNodeAtRange)(tree.rootNode, anchor.range, 'member_expression');
441
+ if (memberNode === null || !shouldEmitReadMember(memberNode)) {
442
+ continue;
443
+ }
444
+ }
445
+ // `this.<field> = new …` inside a STATIC method types a static property,
446
+ // not the instance field of the same name (#2807). Every other `this`-
447
+ // rebinding context is already excluded by the pattern's nesting — see the
448
+ // note on it in `query.ts`; `static` is an anonymous token, so no pattern
449
+ // can negate it and the last case is dropped here.
450
+ const thisFieldNode = groupedNodes['@type-binding.this-field'];
451
+ if (thisFieldNode !== undefined && isStaticMethodThis(thisFieldNode)) {
452
+ continue;
453
+ }
454
+ // …and a `static` FIELD is a member of the class object, not of instances,
455
+ // so it must not type the instance field of the same name either — see
456
+ // `isStaticClassFieldBinding`. Both class-field anchors are tested: the
457
+ // initializer form (`static p = new Wrong()`, `@type-binding.constructor`)
458
+ // and the annotated form (`static p: Wrong`, `@type-binding.annotation`),
459
+ // which collide on the Class scope the same way. The predicate self-gates on
460
+ // the anchor's node type, so the local `variable_declarator` patterns that
461
+ // share these tags are untouched.
462
+ if (isStaticClassFieldBinding(groupedNodes['@type-binding.constructor'], exports.TS_CLASS_FIELD_DEFINITION_TYPES) ||
463
+ isStaticClassFieldBinding(groupedNodes['@type-binding.annotation'], exports.TS_CLASS_FIELD_DEFINITION_TYPES)) {
464
+ continue;
465
+ }
466
+ // #1876: drop @declaration.function for array higher-order-method
467
+ // callbacks (`const x = arr.map(a => …)`). The HOC-wrapped-arrow
468
+ // pattern matches them, but the binding holds a value, not a callable.
469
+ // The binding keeps its separate @declaration.const / .variable match,
470
+ // and the arrow's own @scope.function match (a different pattern) is
471
+ // untouched, so inner-call attribution falls through to the enclosing
472
+ // scope instead of a phantom Function.
473
+ const fnDeclAnchor = grouped['@declaration.function'];
474
+ if (fnDeclAnchor !== undefined) {
475
+ const arrowNode = findFunctionNode(tree.rootNode, fnDeclAnchor.range, groupedNodes['@declaration.function']);
476
+ if (arrowNode !== null && (0, array_callback_js_1.isArrayMethodCallbackArrow)(arrowNode)) {
477
+ continue;
478
+ }
479
+ if (arrowNode !== null && (0, ts_js_hoc_utils_js_1.isBlockedDefaultExportHoc)(arrowNode)) {
480
+ continue;
481
+ }
482
+ // #2723: a CJS export assignment must not register a SECOND module-scope
483
+ // declaration for a name the file already declares lexically — the name
484
+ // would become ambiguous and the resolver would drop the intra-module
485
+ // edge that resolved before #2723.
486
+ if (arrowNode !== null && (0, cjs_export_assignment_js_1.isShadowedCjsExportAssignment)(arrowNode, tree.rootNode)) {
487
+ continue;
488
+ }
489
+ // #2723 follow-up: the member-assignment rule matches ANY identifier
490
+ // receiver so an `exports` alias can be recognised. A receiver that is
491
+ // not the exports object declares nothing at module scope — drop it, or
492
+ // every `obj.handler = fn` would bind `handler` as a module symbol.
493
+ if (arrowNode !== null && (0, cjs_export_assignment_js_1.isUnexportedMemberAssignmentValue)(arrowNode, tree.rootNode)) {
494
+ continue;
495
+ }
496
+ // A `this.X = fn` declares a module symbol ONLY at the top level of a
497
+ // CommonJS file, where `this` is `module.exports`. Inside a function it
498
+ // is an instance member (a Method with an owner, no module binding), and
499
+ // in ESM top-level `this` is undefined and exports nothing.
500
+ if (arrowNode !== null && (0, cjs_export_assignment_js_1.isUndeclarableThisMemberValue)(arrowNode, tree.rootNode)) {
501
+ continue;
502
+ }
503
+ }
504
+ if (fnDeclAnchor !== undefined) {
505
+ const fnNode = findFunctionNode(tree.rootNode, fnDeclAnchor.range, groupedNodes['@declaration.function']);
506
+ if (fnNode !== null && (0, ts_js_hoc_utils_js_1.isDefaultExportHocFunctionNode)(fnNode)) {
507
+ grouped['@declaration.name'] = (0, ast_helpers_js_1.syntheticCapture)('@declaration.name', fnNode, (0, ts_js_hoc_utils_js_1.deriveDefaultExportHocName)(filePath));
508
+ }
509
+ }
510
+ // Synthesize arity metadata on function-like declaration anchors
511
+ // before pushing the match. The registry uses these to narrow
512
+ // overloads — TypeScript supports overload signatures via
513
+ // function_signature, so `parameterTypes` is populated when
514
+ // available.
515
+ const declAnchor = pickFirstCapture(grouped, FUNCTION_DECL_TAGS);
516
+ const declAnchorNode = pickFirstNode(groupedNodes, FUNCTION_DECL_TAGS);
517
+ if (declAnchor !== undefined) {
518
+ const fnNode = findFunctionNode(tree.rootNode, declAnchor.range, declAnchorNode);
519
+ if (fnNode !== null) {
520
+ const arity = (0, arity_metadata_js_1.computeTsArityMetadata)(fnNode);
521
+ if (arity.parameterCount !== undefined) {
522
+ grouped['@declaration.parameter-count'] = (0, ast_helpers_js_1.syntheticCapture)('@declaration.parameter-count', fnNode, String(arity.parameterCount));
523
+ }
524
+ if (arity.requiredParameterCount !== undefined) {
525
+ grouped['@declaration.required-parameter-count'] = (0, ast_helpers_js_1.syntheticCapture)('@declaration.required-parameter-count', fnNode, String(arity.requiredParameterCount));
526
+ }
527
+ if (arity.parameterTypes !== undefined) {
528
+ grouped['@declaration.parameter-types'] = (0, ast_helpers_js_1.syntheticCapture)('@declaration.parameter-types', fnNode, JSON.stringify(arity.parameterTypes));
529
+ }
530
+ }
531
+ }
532
+ // Synthesize `@reference.arity` on every callsite so the registry's
533
+ // arity filter can narrow overloads. Count the `argument` named
534
+ // children of the backing `arguments` node. TypeScript constructor
535
+ // calls use `new_expression`; regular calls use `call_expression`.
536
+ //
537
+ // JSX call anchors (`jsx_self_closing_element` / `jsx_opening_element`
538
+ // captured by the TSX-only suffix in `query.ts`) intentionally do NOT carry
539
+ // arity metadata. A JSX component used as a call argument (e.g.
540
+ // `render(<Foo .../>)`) is itself a @reference.call.* anchor; without a guard
541
+ // the ascent below would climb from it into the enclosing call_expression and
542
+ // mis-attribute that call's arity to the component. The early guard skips
543
+ // arity synthesis for JSX anchors — restoring the pre-#1951 range-based
544
+ // behavior (the old findNodeAtRange found no call_expression at the JSX
545
+ // element's range). The guard lives here, not inside findSelfOrAncestorOfTypes
546
+ // (shared with the import-statement and function-scope ascents). This is
547
+ // acceptable for React: components are virtually never overloaded in the
548
+ // current GitNexus graph model, so name-only dispatch matches the single
549
+ // component definition. A future props-arity-aware synthesizer would count
550
+ // `jsx_attribute` children of the opening tag instead of `arguments`.
551
+ const callAnchor = pickFirstCapture(grouped, CALL_TAGS);
552
+ const callAnchorNode = pickFirstNode(groupedNodes, CALL_TAGS);
553
+ const anchorIsJsxElement = callAnchorNode?.type === 'jsx_self_closing_element' ||
554
+ callAnchorNode?.type === 'jsx_opening_element';
555
+ if (callAnchor !== undefined &&
556
+ grouped['@reference.arity'] === undefined &&
557
+ !anchorIsJsxElement) {
558
+ const callNode = findSelfOrAncestorOfTypes(callAnchorNode, ['call_expression', 'new_expression']) ??
559
+ (0, ast_helpers_js_1.findNodeAtRange)(tree.rootNode, callAnchor.range, 'call_expression') ??
560
+ (0, ast_helpers_js_1.findNodeAtRange)(tree.rootNode, callAnchor.range, 'new_expression');
561
+ if (callNode !== null) {
562
+ const argList = callNode.childForFieldName('arguments');
563
+ const args = argList === null
564
+ ? []
565
+ : argList.namedChildren.filter((c) => c !== null && c.type !== 'comment');
566
+ grouped['@reference.arity'] = (0, ast_helpers_js_1.syntheticCapture)('@reference.arity', callNode, String(args.length));
567
+ const argTypes = args.map((arg) => inferArgType(arg));
568
+ grouped['@reference.parameter-types'] = (0, ast_helpers_js_1.syntheticCapture)('@reference.parameter-types', callNode, JSON.stringify(argTypes));
569
+ }
570
+ }
571
+ // Structural receiver chain for a call whose receiver is itself an
572
+ // expression, so resolution can type it by folding over structure
573
+ // instead of re-parsing the receiver's source text. Self-gating: a
574
+ // non-call match, an absent receiver, or a chain with no nameable base
575
+ // all leave `grouped` untouched.
576
+ (0, receiver_chain_captures_js_1.synthesizeReceiverChainCapture)(grouped, groupedNodes['@reference.receiver']);
577
+ out.push(grouped);
578
+ // Synthesize `this` receiver type-bindings on every function-like
579
+ // scope that is structurally a class member. `receiver-binding.ts`
580
+ // handles the walk-up (method, method_signature, abstract
581
+ // signature, arrow/function-expression assigned to a class field).
582
+ // Arrow functions nested inside method bodies rely on scope-chain
583
+ // lookup instead of synthesis — covered by `tsReceiverBinding`.
584
+ const scopeFnAnchor = grouped['@scope.function'];
585
+ if (scopeFnAnchor !== undefined) {
586
+ const fnNode = findFunctionNode(tree.rootNode, scopeFnAnchor.range, groupedNodes['@scope.function']);
587
+ if (fnNode !== null) {
588
+ const synth = (0, receiver_binding_js_1.synthesizeTsReceiverBinding)(fnNode);
589
+ if (synth !== null)
590
+ out.push(synth);
591
+ }
592
+ }
593
+ }
594
+ // Synthesize object-destructuring type bindings. The tree-sitter query
595
+ // alone can't express "give me the field NAME and the RHS identifier
596
+ // together" in a way that produces usable @type-binding.name /
597
+ // @type-binding.type captures, so we walk `variable_declarator` nodes
598
+ // whose `name:` is an `object_pattern` and synthesize per-field
599
+ // bindings keyed to the receiver-path `rhsName.fieldName`. The
600
+ // compound-receiver resolver's Case 3b then walks that path when the
601
+ // destructured local is used as a receiver (e.g. `address.save()`).
602
+ synthesizeDestructuringBindings(tree.rootNode, out);
603
+ synthesizeForOfMapTupleBindings(tree.rootNode, out);
604
+ synthesizeInstanceofNarrowings(tree.rootNode, out);
605
+ synthesizeTsInheritanceReferences(tree.rootNode, out);
606
+ out.push(...(0, callable_flow_captures_js_1.synthesizeCallableFlowCaptures)(tree.rootNode, TS_CALLABLE_CAPTURE_OPTIONS));
607
+ // CommonJS module-export declarations (#2723). Shared with the JavaScript
608
+ // emitter: a `.ts` file in a CommonJS package uses the same forms, and
609
+ // without this the default-export NODE was emitted with nothing declaring it
610
+ // — the "found, zero callers" state this work exists to remove (#2729 F7).
611
+ (0, cjs_module_exports_js_1.synthesizeCjsModuleExports)(tree.rootNode, filePath, out);
612
+ return out;
613
+ }
614
+ /**
615
+ * Synthesize `@reference.inherits` captures from TypeScript class heritage so
616
+ * the registry-primary scope-resolution path emits EXTENDS / IMPLEMENTS edges
617
+ * (mirrors C# `synthesizeCsharpInheritanceReferences` / JS
618
+ * `synthesizeJsInheritanceReferences`). Without this, TS inheritance edges came
619
+ * only from the legacy heritage-capture leg (removed in #942), which the worker
620
+ * pipeline drops for registry-primary languages — yielding 0 inheritance edges
621
+ * in worker mode (issue #1951).
622
+ *
623
+ * Scope is intentionally limited to a `class_declaration`'s `class_heritage`
624
+ * `extends_clause` value + `implements_clause` types, matching the legacy
625
+ * TypeScript heritage query's class scope (TYPESCRIPT_QUERIES). Generic
626
+ * bases agree across both paths: `extends Base<T>` is captured by the legacy
627
+ * `extends_clause value: (identifier)` already (the `type_arguments` are a
628
+ * sibling field), and `implements IFoo<T>` is captured by a legacy clause
629
+ * widened to read the `generic_type`'s `name:` identifier — so the registry
630
+ * path keeps parity on SIMPLE (unqualified) generic bases too (#1951).
631
+ * Qualified bases (`ns.Base`, `ns.Base<T>`, `ns.IFoo<T>`) are ALSO now at parity
632
+ * (#1956 tri-review U2): the synth resolves them by their member_expression /
633
+ * nested_type_identifier tail, and the legacy heritage query was widened with
634
+ * matching arms (member_expression for extends, nested_type_identifier plain +
635
+ * generic-wrapped for implements).
636
+ *
637
+ * `interface_declaration` and `abstract_class_declaration` heritage IS emitted
638
+ * (#2842 review; both were silently skipped before, so `interface B extends A`
639
+ * and `abstract class X implements I` produced no edge and every dispatch walk
640
+ * dead-ended on a bodiless declaration). They reach their bases by different
641
+ * shapes: an abstract class carries the same `class_heritage` child a concrete
642
+ * one does, while an interface's bases hang off `extends_type_clause` directly. The EXTENDS-vs-IMPLEMENTS split is decided downstream from the
643
+ * resolved target's symbol kind in `preEmitInheritanceEdges` (class-extends →
644
+ * EXTENDS, implements-interface / interface-target → IMPLEMENTS), so all bases
645
+ * are emitted with the same `inherits` kind here. The base lookup name is
646
+ * normalized to its bare simple identifier (`BaseModel<string>` → `BaseModel`,
647
+ * `models.Base` → `Base`) so `findClassBindingInScope` resolves it.
648
+ */
649
+ function synthesizeTsInheritanceReferences(root, out) {
650
+ const stack = [root];
651
+ for (;;) {
652
+ const node = stack.pop();
653
+ if (node === undefined)
654
+ break;
655
+ for (const child of node.namedChildren) {
656
+ if (child !== null)
657
+ stack.push(child);
658
+ }
659
+ // `interface B extends A, C` hangs its bases off an `extends_type_clause`
660
+ // DIRECTLY on the interface — there is no `class_heritage` wrapper, so the
661
+ // class path below cannot reach them (#2842 review). The clause's `type`
662
+ // field is `multiple: true`, so `childForFieldName('type')` would silently
663
+ // return only `A` and drop `C`; iterate the named children instead.
664
+ if (node.type === 'interface_declaration') {
665
+ for (const child of node.namedChildren) {
666
+ if (child === null || child.type !== 'extends_type_clause')
667
+ continue;
668
+ for (const base of child.namedChildren) {
669
+ emitTsInheritanceBase(base, out);
670
+ }
671
+ }
672
+ continue;
673
+ }
674
+ // `abstract class X implements I` carries an identical `class_heritage`
675
+ // child, so the existing body handles it once the node type is admitted.
676
+ // Omitting it severed the only link between an interface and the concrete
677
+ // classes below an abstract base — a whole subtree, not a leaf.
678
+ if (node.type !== 'class_declaration' && node.type !== 'abstract_class_declaration')
679
+ continue;
680
+ // Find the `class_heritage` child (holds extends / implements clauses).
681
+ let heritage = null;
682
+ for (const child of node.namedChildren) {
683
+ if (child !== null && child.type === 'class_heritage') {
684
+ heritage = child;
685
+ break;
686
+ }
687
+ }
688
+ if (heritage === null)
689
+ continue;
690
+ for (const clause of heritage.namedChildren) {
691
+ if (clause === null)
692
+ continue;
693
+ if (clause.type === 'extends_clause') {
694
+ // `extends Foo` / `extends Foo<T>` — the base is the `value:` field
695
+ // (an identifier; generics live in a sibling `type_arguments`).
696
+ const value = clause.childForFieldName('value') ?? clause.firstNamedChild;
697
+ emitTsInheritanceBase(value, out);
698
+ }
699
+ else if (clause.type === 'implements_clause') {
700
+ // `implements IFoo, IBar<T>` — each base type is a direct named child.
701
+ for (const base of clause.namedChildren) {
702
+ emitTsInheritanceBase(base, out);
703
+ }
704
+ }
705
+ }
706
+ }
707
+ }
708
+ /** Emit one `@reference.inherits` match for a TS heritage base, normalizing
709
+ * the lookup name to its bare simple identifier. No-ops on null / non-type
710
+ * nodes or when the bare name can't be derived. */
711
+ function emitTsInheritanceBase(base, out) {
712
+ if (base === null)
713
+ return;
714
+ const nameNode = terminalTsTypeNameNode(base);
715
+ if (nameNode === null)
716
+ return;
717
+ out.push({
718
+ '@reference.inherits': (0, ast_helpers_js_1.nodeToCapture)('@reference.inherits', base),
719
+ '@reference.name': (0, ast_helpers_js_1.nodeToCapture)('@reference.name', nameNode),
720
+ });
721
+ }
722
+ /** Resolve a TypeScript heritage base node to its bare simple-identifier node.
723
+ * `Foo` → `Foo`, `Foo<T>` (generic_type) → `Foo`, `models.Base`
724
+ * (nested_type_identifier / member_expression) → `Base`. Mirrors C#'s
725
+ * `terminalTypeNameNode`; returns null when no leaf identifier is reachable. */
726
+ function terminalTsTypeNameNode(node) {
727
+ switch (node.type) {
728
+ case 'identifier':
729
+ case 'type_identifier':
730
+ // `extends ns.Base` parses as a member_expression whose tail is a
731
+ // `property_identifier` (not a type_identifier) — treat it as a leaf name.
732
+ case 'property_identifier':
733
+ return node;
734
+ case 'generic_type': {
735
+ // generic_type has a `name:` field (type_identifier / nested_type_identifier);
736
+ // recurse to strip the type_arguments and reach the bare base identifier.
737
+ const name = node.childForFieldName('name') ?? node.firstNamedChild;
738
+ return name === null ? null : terminalTsTypeNameNode(name);
739
+ }
740
+ case 'nested_type_identifier':
741
+ case 'member_expression': {
742
+ // Qualified `A.B.Base` → tail identifier `Base`.
743
+ const tail = node.lastNamedChild;
744
+ return tail === null ? null : terminalTsTypeNameNode(tail);
745
+ }
746
+ default:
747
+ return null;
748
+ }
749
+ }
750
+ /**
751
+ * Walk the AST and synthesize type-binding captures for object
752
+ * destructuring of the form `const { field } = rhs` or
753
+ * `const { field: alias } = rhs`. Pushes one synthetic CaptureMatch
754
+ * per destructured identifier with:
755
+ *
756
+ * - `@type-binding.name` → the local identifier
757
+ * - `@type-binding.type` → the compound path `rhs.field`
758
+ * - `@type-binding.destructured` anchor
759
+ *
760
+ * Only fires when the RHS is a bare identifier — more complex RHS
761
+ * shapes (call_expression, member_expression) resolve via the normal
762
+ * type-alias + chain-follow paths on the RHS first, then the field
763
+ * walk catches the destructured identifier on a second fixpoint pass.
764
+ * Left as a follow-up optimization.
765
+ */
766
+ function synthesizeDestructuringBindings(root, out) {
767
+ const stack = [root];
768
+ for (;;) {
769
+ const node = stack.pop();
770
+ if (node === undefined)
771
+ break;
772
+ for (const child of node.namedChildren) {
773
+ if (child !== null)
774
+ stack.push(child);
775
+ }
776
+ if (node.type !== 'variable_declarator')
777
+ continue;
778
+ const nameNode = node.childForFieldName('name');
779
+ const valueNode = node.childForFieldName('value');
780
+ if (nameNode === null || valueNode === null)
781
+ continue;
782
+ if (nameNode.type !== 'object_pattern')
783
+ continue;
784
+ if (valueNode.type !== 'identifier')
785
+ continue;
786
+ const rhsName = valueNode.text;
787
+ for (const fieldNode of nameNode.namedChildren) {
788
+ if (fieldNode === null)
789
+ continue;
790
+ if (fieldNode.type === 'shorthand_property_identifier_pattern') {
791
+ // `const { address } = user`
792
+ const localName = fieldNode.text;
793
+ out.push({
794
+ '@type-binding.name': (0, ast_helpers_js_1.syntheticCapture)('@type-binding.name', fieldNode, localName),
795
+ '@type-binding.type': (0, ast_helpers_js_1.syntheticCapture)('@type-binding.type', fieldNode, `${rhsName}.${localName}`),
796
+ '@type-binding.destructured': (0, ast_helpers_js_1.syntheticCapture)('@type-binding.destructured', fieldNode, fieldNode.text),
797
+ });
798
+ }
799
+ else if (fieldNode.type === 'pair_pattern') {
800
+ // `const { address: addr } = user`
801
+ const key = fieldNode.childForFieldName('key');
802
+ const value = fieldNode.childForFieldName('value');
803
+ if (key === null || value === null)
804
+ continue;
805
+ if (value.type !== 'identifier')
806
+ continue;
807
+ const fieldName = key.text;
808
+ const localName = value.text;
809
+ out.push({
810
+ '@type-binding.name': (0, ast_helpers_js_1.syntheticCapture)('@type-binding.name', value, localName),
811
+ '@type-binding.type': (0, ast_helpers_js_1.syntheticCapture)('@type-binding.type', fieldNode, `${rhsName}.${fieldName}`),
812
+ '@type-binding.destructured': (0, ast_helpers_js_1.syntheticCapture)('@type-binding.destructured', fieldNode, fieldNode.text),
813
+ });
814
+ }
815
+ }
816
+ }
817
+ }
818
+ /**
819
+ * `for (const [k, v] of mapId)` over a `Map<K,V>` — synthesize per-slot
820
+ * type bindings so `v` resolves like a `Map` iterator tuple element.
821
+ * Uses sentinel `__MAP_TUPLE_i__:rhs` consumed by compound-receiver.
822
+ */
823
+ function synthesizeForOfMapTupleBindings(root, out) {
824
+ const stack = [root];
825
+ for (;;) {
826
+ const node = stack.pop();
827
+ if (node === undefined)
828
+ break;
829
+ for (const child of node.namedChildren) {
830
+ if (child !== null)
831
+ stack.push(child);
832
+ }
833
+ if (node.type !== 'for_in_statement')
834
+ continue;
835
+ const left = node.childForFieldName('left');
836
+ const right = node.childForFieldName('right');
837
+ if (left === null || right === null)
838
+ continue;
839
+ if (left.type !== 'array_pattern' || right.type !== 'identifier')
840
+ continue;
841
+ const rhs = right.text;
842
+ let slot = 0;
843
+ for (const child of left.namedChildren) {
844
+ if (child === null || child.type !== 'identifier')
845
+ continue;
846
+ const localName = child.text;
847
+ out.push({
848
+ '@type-binding.name': (0, ast_helpers_js_1.syntheticCapture)('@type-binding.name', child, localName),
849
+ '@type-binding.type': (0, ast_helpers_js_1.syntheticCapture)('@type-binding.type', child, `__MAP_TUPLE_${slot}__:${rhs}`),
850
+ '@type-binding.map-tuple-entry': (0, ast_helpers_js_1.syntheticCapture)('@type-binding.map-tuple-entry', child, String(slot)),
851
+ });
852
+ slot++;
853
+ }
854
+ }
855
+ }
856
+ /**
857
+ * `if (x instanceof User) { x.save() }` — synthesize a `User` type binding
858
+ * for `x` anchored in the consequence block so scope-chain lookup inside
859
+ * the then-branch sees the narrowed type.
860
+ *
861
+ * **Known limitation:** the LHS must be a bare `identifier` and the RHS
862
+ * an `identifier`/`type_identifier`. Member-expression LHS such as
863
+ * `if (user.address instanceof Address)` is intentionally NOT synthesized
864
+ * — narrowing a property-access target requires a stable storage key
865
+ * the binding layer can hold, which member chains don't supply. Field-
866
+ * type resolution covers the common case for those receivers via
867
+ * declared types instead.
868
+ */
869
+ function synthesizeInstanceofNarrowings(root, out) {
870
+ const stack = [root];
871
+ for (;;) {
872
+ const node = stack.pop();
873
+ if (node === undefined)
874
+ break;
875
+ for (const child of node.namedChildren) {
876
+ if (child !== null)
877
+ stack.push(child);
878
+ }
879
+ if (node.type !== 'if_statement')
880
+ continue;
881
+ const cond = node.childForFieldName('condition');
882
+ if (cond === null)
883
+ continue;
884
+ const inner = cond.type === 'parenthesized_expression' ? cond.namedChildren[0] : cond;
885
+ if (inner === null || inner.type !== 'binary_expression')
886
+ continue;
887
+ const op = inner.childForFieldName('operator');
888
+ const left = inner.childForFieldName('left');
889
+ const right = inner.childForFieldName('right');
890
+ if (op === null || left === null || right === null)
891
+ continue;
892
+ if (op.type !== 'instanceof')
893
+ continue;
894
+ if (left.type !== 'identifier')
895
+ continue;
896
+ if (right.type !== 'identifier' && right.type !== 'type_identifier')
897
+ continue;
898
+ const varName = left.text;
899
+ const typeName = right.text;
900
+ const cons = node.childForFieldName('consequence');
901
+ if (cons === null)
902
+ continue;
903
+ out.push({
904
+ '@type-binding.name': (0, ast_helpers_js_1.syntheticCapture)('@type-binding.name', cons, varName),
905
+ '@type-binding.type': (0, ast_helpers_js_1.syntheticCapture)('@type-binding.type', right, typeName),
906
+ '@type-binding.instanceof-narrow': (0, ast_helpers_js_1.syntheticCapture)('@type-binding.instanceof-narrow', cons, '1'),
907
+ });
908
+ }
909
+ }
910
+ /** Infer a TypeScript argument expression's static type from literal
911
+ * shapes. Returns `''` when the arg has no statically-derivable type
912
+ * (identifiers, member accesses, etc.) — consumers treat unknown as
913
+ * any-match during overload narrowing. */
914
+ function inferArgType(argNode) {
915
+ switch (argNode.type) {
916
+ case 'number':
917
+ return 'number';
918
+ case 'string':
919
+ case 'template_string':
920
+ return 'string';
921
+ case 'true':
922
+ case 'false':
923
+ return 'boolean';
924
+ case 'null':
925
+ return 'null';
926
+ case 'undefined':
927
+ return 'undefined';
928
+ case 'array':
929
+ return 'Array';
930
+ case 'object':
931
+ return 'object';
932
+ case 'regex':
933
+ return 'RegExp';
934
+ case 'new_expression': {
935
+ const ctor = argNode.childForFieldName('constructor');
936
+ return ctor?.text ?? '';
937
+ }
938
+ default:
939
+ return '';
940
+ }
941
+ }
942
+ /** Find the first TypeScript function-like node at the given range.
943
+ * The `@scope.function` anchor range covers the whole node, but the
944
+ * tag alone doesn't identify which node type among the many TS
945
+ * function-likes. */
946
+ function findFunctionNode(rootNode, range, anchorNode) {
947
+ const fromAnchor = findSelfOrAncestorOfTypes(anchorNode, exports.FUNCTION_NODE_TYPES);
948
+ if (fromAnchor !== null)
949
+ return fromAnchor;
950
+ for (const nodeType of exports.FUNCTION_NODE_TYPES) {
951
+ const n = (0, ast_helpers_js_1.findNodeAtRange)(rootNode, range, nodeType);
952
+ if (n !== null)
953
+ return n;
954
+ }
955
+ return null;
956
+ }