gitnexus 1.6.3-rc.8 → 1.6.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 (285) hide show
  1. package/README.md +21 -5
  2. package/dist/_shared/graph/types.d.ts +16 -0
  3. package/dist/_shared/graph/types.d.ts.map +1 -1
  4. package/dist/_shared/index.d.ts +20 -2
  5. package/dist/_shared/index.d.ts.map +1 -1
  6. package/dist/_shared/index.js +11 -0
  7. package/dist/_shared/index.js.map +1 -1
  8. package/dist/_shared/scope-resolution/def-index.js +2 -2
  9. package/dist/_shared/scope-resolution/def-index.js.map +1 -1
  10. package/dist/_shared/scope-resolution/method-dispatch-index.d.ts +8 -0
  11. package/dist/_shared/scope-resolution/method-dispatch-index.d.ts.map +1 -1
  12. package/dist/_shared/scope-resolution/method-dispatch-index.js +2 -2
  13. package/dist/_shared/scope-resolution/method-dispatch-index.js.map +1 -1
  14. package/dist/_shared/scope-resolution/module-scope-index.d.ts +8 -0
  15. package/dist/_shared/scope-resolution/module-scope-index.d.ts.map +1 -1
  16. package/dist/_shared/scope-resolution/module-scope-index.js +10 -2
  17. package/dist/_shared/scope-resolution/module-scope-index.js.map +1 -1
  18. package/dist/_shared/scope-resolution/parsed-file.d.ts +76 -0
  19. package/dist/_shared/scope-resolution/parsed-file.d.ts.map +1 -0
  20. package/dist/_shared/scope-resolution/parsed-file.js +54 -0
  21. package/dist/_shared/scope-resolution/parsed-file.js.map +1 -0
  22. package/dist/_shared/scope-resolution/position-index.d.ts +12 -0
  23. package/dist/_shared/scope-resolution/position-index.d.ts.map +1 -1
  24. package/dist/_shared/scope-resolution/position-index.js +2 -2
  25. package/dist/_shared/scope-resolution/position-index.js.map +1 -1
  26. package/dist/_shared/scope-resolution/qualified-name-index.js +2 -2
  27. package/dist/_shared/scope-resolution/qualified-name-index.js.map +1 -1
  28. package/dist/_shared/scope-resolution/reference-site.d.ts +75 -0
  29. package/dist/_shared/scope-resolution/reference-site.d.ts.map +1 -0
  30. package/dist/_shared/scope-resolution/reference-site.js +24 -0
  31. package/dist/_shared/scope-resolution/reference-site.js.map +1 -0
  32. package/dist/_shared/scope-resolution/registries/class-registry.d.ts +27 -0
  33. package/dist/_shared/scope-resolution/registries/class-registry.d.ts.map +1 -0
  34. package/dist/_shared/scope-resolution/registries/class-registry.js +30 -0
  35. package/dist/_shared/scope-resolution/registries/class-registry.js.map +1 -0
  36. package/dist/_shared/scope-resolution/registries/context.d.ts +69 -0
  37. package/dist/_shared/scope-resolution/registries/context.d.ts.map +1 -0
  38. package/dist/_shared/scope-resolution/registries/context.js +44 -0
  39. package/dist/_shared/scope-resolution/registries/context.js.map +1 -0
  40. package/dist/_shared/scope-resolution/registries/evidence.d.ts +56 -0
  41. package/dist/_shared/scope-resolution/registries/evidence.d.ts.map +1 -0
  42. package/dist/_shared/scope-resolution/registries/evidence.js +150 -0
  43. package/dist/_shared/scope-resolution/registries/evidence.js.map +1 -0
  44. package/dist/_shared/scope-resolution/registries/field-registry.d.ts +26 -0
  45. package/dist/_shared/scope-resolution/registries/field-registry.d.ts.map +1 -0
  46. package/dist/_shared/scope-resolution/registries/field-registry.js +31 -0
  47. package/dist/_shared/scope-resolution/registries/field-registry.js.map +1 -0
  48. package/dist/_shared/scope-resolution/registries/lookup-core.d.ts +81 -0
  49. package/dist/_shared/scope-resolution/registries/lookup-core.d.ts.map +1 -0
  50. package/dist/_shared/scope-resolution/registries/lookup-core.js +332 -0
  51. package/dist/_shared/scope-resolution/registries/lookup-core.js.map +1 -0
  52. package/dist/_shared/scope-resolution/registries/lookup-qualified.d.ts +33 -0
  53. package/dist/_shared/scope-resolution/registries/lookup-qualified.d.ts.map +1 -0
  54. package/dist/_shared/scope-resolution/registries/lookup-qualified.js +56 -0
  55. package/dist/_shared/scope-resolution/registries/lookup-qualified.js.map +1 -0
  56. package/dist/_shared/scope-resolution/registries/method-registry.d.ts +36 -0
  57. package/dist/_shared/scope-resolution/registries/method-registry.d.ts.map +1 -0
  58. package/dist/_shared/scope-resolution/registries/method-registry.js +32 -0
  59. package/dist/_shared/scope-resolution/registries/method-registry.js.map +1 -0
  60. package/dist/_shared/scope-resolution/registries/tie-breaks.d.ts +43 -0
  61. package/dist/_shared/scope-resolution/registries/tie-breaks.d.ts.map +1 -0
  62. package/dist/_shared/scope-resolution/registries/tie-breaks.js +60 -0
  63. package/dist/_shared/scope-resolution/registries/tie-breaks.js.map +1 -0
  64. package/dist/_shared/scope-resolution/resolve-type-ref.d.ts +1 -10
  65. package/dist/_shared/scope-resolution/resolve-type-ref.d.ts.map +1 -1
  66. package/dist/_shared/scope-resolution/resolve-type-ref.js +6 -0
  67. package/dist/_shared/scope-resolution/resolve-type-ref.js.map +1 -1
  68. package/dist/_shared/scope-resolution/scope-tree.d.ts +4 -4
  69. package/dist/_shared/scope-resolution/scope-tree.d.ts.map +1 -1
  70. package/dist/_shared/scope-resolution/scope-tree.js +3 -2
  71. package/dist/_shared/scope-resolution/scope-tree.js.map +1 -1
  72. package/dist/_shared/scope-resolution/shadow/aggregate.d.ts +6 -2
  73. package/dist/_shared/scope-resolution/shadow/aggregate.d.ts.map +1 -1
  74. package/dist/_shared/scope-resolution/shadow/aggregate.js +5 -0
  75. package/dist/_shared/scope-resolution/shadow/aggregate.js.map +1 -1
  76. package/dist/_shared/scope-resolution/types.d.ts +11 -0
  77. package/dist/_shared/scope-resolution/types.d.ts.map +1 -1
  78. package/dist/cli/ai-context.js +35 -4
  79. package/dist/cli/analyze.d.ts +27 -0
  80. package/dist/cli/analyze.js +31 -1
  81. package/dist/cli/clean.js +19 -1
  82. package/dist/cli/group.js +73 -0
  83. package/dist/cli/index-repo.js +8 -1
  84. package/dist/cli/index.js +26 -1
  85. package/dist/cli/list.js +11 -1
  86. package/dist/cli/remove.d.ts +30 -0
  87. package/dist/cli/remove.js +99 -0
  88. package/dist/cli/setup.js +185 -57
  89. package/dist/cli/tool.d.ts +5 -0
  90. package/dist/cli/tool.js +42 -0
  91. package/dist/config/ignore-service.d.ts +9 -0
  92. package/dist/config/ignore-service.js +80 -13
  93. package/dist/core/embedding-mode.d.ts +30 -0
  94. package/dist/core/embedding-mode.js +30 -0
  95. package/dist/core/embeddings/ast-utils.js +22 -22
  96. package/dist/core/embeddings/chunker.js +30 -25
  97. package/dist/core/embeddings/embedding-pipeline.d.ts +6 -0
  98. package/dist/core/embeddings/embedding-pipeline.js +15 -6
  99. package/dist/core/embeddings/text-generator.d.ts +1 -1
  100. package/dist/core/embeddings/text-generator.js +33 -24
  101. package/dist/core/embeddings/types.d.ts +43 -1
  102. package/dist/core/embeddings/types.js +101 -29
  103. package/dist/core/git-staleness.d.ts +18 -0
  104. package/dist/core/git-staleness.js +108 -0
  105. package/dist/core/graph/graph.js +115 -20
  106. package/dist/core/graph/types.d.ts +12 -1
  107. package/dist/core/group/config-parser.d.ts +4 -0
  108. package/dist/core/group/config-parser.js +18 -1
  109. package/dist/core/group/cross-impact.d.ts +41 -0
  110. package/dist/core/group/cross-impact.js +441 -0
  111. package/dist/core/group/extractors/http-patterns/php.js +126 -18
  112. package/dist/core/group/group-path-utils.d.ts +17 -0
  113. package/dist/core/group/group-path-utils.js +40 -0
  114. package/dist/core/group/resolve-at-member.d.ts +10 -0
  115. package/dist/core/group/resolve-at-member.js +31 -0
  116. package/dist/core/group/service.d.ts +9 -0
  117. package/dist/core/group/service.js +259 -25
  118. package/dist/core/group/types.d.ts +30 -0
  119. package/dist/core/ingestion/ast-cache.d.ts +16 -1
  120. package/dist/core/ingestion/ast-cache.js +14 -2
  121. package/dist/core/ingestion/call-processor.js +9 -0
  122. package/dist/core/ingestion/emit-references.d.ts +88 -0
  123. package/dist/core/ingestion/emit-references.js +229 -0
  124. package/dist/core/ingestion/filesystem-walker.js +6 -4
  125. package/dist/core/ingestion/finalize-orchestrator.d.ts +63 -0
  126. package/dist/core/ingestion/finalize-orchestrator.js +139 -0
  127. package/dist/core/ingestion/framework-detection.js +6 -2
  128. package/dist/core/ingestion/import-processor.js +4 -0
  129. package/dist/core/ingestion/import-resolvers/python.js +9 -6
  130. package/dist/core/ingestion/import-target-adapter.d.ts +73 -0
  131. package/dist/core/ingestion/import-target-adapter.js +95 -0
  132. package/dist/core/ingestion/language-provider.d.ts +36 -33
  133. package/dist/core/ingestion/languages/csharp/accessor-unwrap.d.ts +21 -0
  134. package/dist/core/ingestion/languages/csharp/accessor-unwrap.js +56 -0
  135. package/dist/core/ingestion/languages/csharp/arity-metadata.d.ts +26 -0
  136. package/dist/core/ingestion/languages/csharp/arity-metadata.js +46 -0
  137. package/dist/core/ingestion/languages/csharp/arity.d.ts +23 -0
  138. package/dist/core/ingestion/languages/csharp/arity.js +37 -0
  139. package/dist/core/ingestion/languages/csharp/cache-stats.d.ts +15 -0
  140. package/dist/core/ingestion/languages/csharp/cache-stats.js +26 -0
  141. package/dist/core/ingestion/languages/csharp/captures.d.ts +19 -0
  142. package/dist/core/ingestion/languages/csharp/captures.js +249 -0
  143. package/dist/core/ingestion/languages/csharp/import-decomposer.d.ts +19 -0
  144. package/dist/core/ingestion/languages/csharp/import-decomposer.js +93 -0
  145. package/dist/core/ingestion/languages/csharp/import-target.d.ts +25 -0
  146. package/dist/core/ingestion/languages/csharp/import-target.js +123 -0
  147. package/dist/core/ingestion/languages/csharp/index.d.ts +82 -0
  148. package/dist/core/ingestion/languages/csharp/index.js +82 -0
  149. package/dist/core/ingestion/languages/csharp/interpret.d.ts +15 -0
  150. package/dist/core/ingestion/languages/csharp/interpret.js +132 -0
  151. package/dist/core/ingestion/languages/csharp/merge-bindings.d.ts +27 -0
  152. package/dist/core/ingestion/languages/csharp/merge-bindings.js +55 -0
  153. package/dist/core/ingestion/languages/csharp/namespace-siblings.d.ts +50 -0
  154. package/dist/core/ingestion/languages/csharp/namespace-siblings.js +374 -0
  155. package/dist/core/ingestion/languages/csharp/query.d.ts +35 -0
  156. package/dist/core/ingestion/languages/csharp/query.js +515 -0
  157. package/dist/core/ingestion/languages/csharp/receiver-binding.d.ts +31 -0
  158. package/dist/core/ingestion/languages/csharp/receiver-binding.js +135 -0
  159. package/dist/core/ingestion/languages/csharp/scope-resolver.d.ts +10 -0
  160. package/dist/core/ingestion/languages/csharp/scope-resolver.js +63 -0
  161. package/dist/core/ingestion/languages/csharp/simple-hooks.d.ts +53 -0
  162. package/dist/core/ingestion/languages/csharp/simple-hooks.js +76 -0
  163. package/dist/core/ingestion/languages/csharp.js +14 -0
  164. package/dist/core/ingestion/languages/python/arity-metadata.d.ts +24 -0
  165. package/dist/core/ingestion/languages/python/arity-metadata.js +45 -0
  166. package/dist/core/ingestion/languages/python/arity.d.ts +22 -0
  167. package/dist/core/ingestion/languages/python/arity.js +38 -0
  168. package/dist/core/ingestion/languages/python/cache-stats.d.ts +17 -0
  169. package/dist/core/ingestion/languages/python/cache-stats.js +28 -0
  170. package/dist/core/ingestion/languages/python/captures.d.ts +19 -0
  171. package/dist/core/ingestion/languages/python/captures.js +106 -0
  172. package/dist/core/ingestion/languages/python/import-decomposer.d.ts +15 -0
  173. package/dist/core/ingestion/languages/python/import-decomposer.js +112 -0
  174. package/dist/core/ingestion/languages/python/import-target.d.ts +21 -0
  175. package/dist/core/ingestion/languages/python/import-target.js +99 -0
  176. package/dist/core/ingestion/languages/python/index.d.ts +80 -0
  177. package/dist/core/ingestion/languages/python/index.js +80 -0
  178. package/dist/core/ingestion/languages/python/interpret.d.ts +15 -0
  179. package/dist/core/ingestion/languages/python/interpret.js +191 -0
  180. package/dist/core/ingestion/languages/python/merge-bindings.d.ts +16 -0
  181. package/dist/core/ingestion/languages/python/merge-bindings.js +44 -0
  182. package/dist/core/ingestion/languages/python/query.d.ts +9 -0
  183. package/dist/core/ingestion/languages/python/query.js +267 -0
  184. package/dist/core/ingestion/languages/python/receiver-binding.d.ts +21 -0
  185. package/dist/core/ingestion/languages/python/receiver-binding.js +116 -0
  186. package/dist/core/ingestion/languages/python/scope-resolver.d.ts +16 -0
  187. package/dist/core/ingestion/languages/python/scope-resolver.js +53 -0
  188. package/dist/core/ingestion/languages/python/simple-hooks.d.ts +23 -0
  189. package/dist/core/ingestion/languages/python/simple-hooks.js +35 -0
  190. package/dist/core/ingestion/languages/python.js +14 -0
  191. package/dist/core/ingestion/model/method-registry.d.ts +9 -0
  192. package/dist/core/ingestion/model/method-registry.js +4 -0
  193. package/dist/core/ingestion/model/scope-resolution-indexes.d.ts +59 -0
  194. package/dist/core/ingestion/model/scope-resolution-indexes.js +42 -0
  195. package/dist/core/ingestion/model/semantic-model.d.ts +64 -0
  196. package/dist/core/ingestion/model/semantic-model.js +55 -0
  197. package/dist/core/ingestion/mro-processor.js +38 -22
  198. package/dist/core/ingestion/parsing-processor.d.ts +18 -1
  199. package/dist/core/ingestion/parsing-processor.js +45 -11
  200. package/dist/core/ingestion/pipeline-phases/index.d.ts +1 -0
  201. package/dist/core/ingestion/pipeline-phases/index.js +1 -0
  202. package/dist/core/ingestion/pipeline-phases/parse-impl.d.ts +10 -0
  203. package/dist/core/ingestion/pipeline-phases/parse-impl.js +17 -2
  204. package/dist/core/ingestion/pipeline-phases/parse.d.ts +18 -0
  205. package/dist/core/ingestion/pipeline.js +2 -1
  206. package/dist/core/ingestion/registry-primary-flag.d.ts +86 -0
  207. package/dist/core/ingestion/registry-primary-flag.js +111 -0
  208. package/dist/core/ingestion/resolve-references.d.ts +63 -0
  209. package/dist/core/ingestion/resolve-references.js +175 -0
  210. package/dist/core/ingestion/scope-extractor-bridge.d.ts +32 -0
  211. package/dist/core/ingestion/scope-extractor-bridge.js +44 -0
  212. package/dist/core/ingestion/scope-extractor.d.ts +86 -0
  213. package/dist/core/ingestion/scope-extractor.js +758 -0
  214. package/dist/core/ingestion/scope-resolution/contract/scope-resolver.d.ts +372 -0
  215. package/dist/core/ingestion/scope-resolution/contract/scope-resolver.js +212 -0
  216. package/dist/core/ingestion/scope-resolution/graph-bridge/edges.d.ts +43 -0
  217. package/dist/core/ingestion/scope-resolution/graph-bridge/edges.js +79 -0
  218. package/dist/core/ingestion/scope-resolution/graph-bridge/ids.d.ts +57 -0
  219. package/dist/core/ingestion/scope-resolution/graph-bridge/ids.js +112 -0
  220. package/dist/core/ingestion/scope-resolution/graph-bridge/imports-to-edges.d.ts +17 -0
  221. package/dist/core/ingestion/scope-resolution/graph-bridge/imports-to-edges.js +46 -0
  222. package/dist/core/ingestion/scope-resolution/graph-bridge/method-dispatch.d.ts +19 -0
  223. package/dist/core/ingestion/scope-resolution/graph-bridge/method-dispatch.js +30 -0
  224. package/dist/core/ingestion/scope-resolution/graph-bridge/node-lookup.d.ts +37 -0
  225. package/dist/core/ingestion/scope-resolution/graph-bridge/node-lookup.js +113 -0
  226. package/dist/core/ingestion/scope-resolution/graph-bridge/references-to-edges.d.ts +38 -0
  227. package/dist/core/ingestion/scope-resolution/graph-bridge/references-to-edges.js +73 -0
  228. package/dist/core/ingestion/scope-resolution/passes/compound-receiver.d.ts +42 -0
  229. package/dist/core/ingestion/scope-resolution/passes/compound-receiver.js +198 -0
  230. package/dist/core/ingestion/scope-resolution/passes/free-call-fallback.d.ts +27 -0
  231. package/dist/core/ingestion/scope-resolution/passes/free-call-fallback.js +131 -0
  232. package/dist/core/ingestion/scope-resolution/passes/imported-return-types.d.ts +48 -0
  233. package/dist/core/ingestion/scope-resolution/passes/imported-return-types.js +130 -0
  234. package/dist/core/ingestion/scope-resolution/passes/mro.d.ts +42 -0
  235. package/dist/core/ingestion/scope-resolution/passes/mro.js +99 -0
  236. package/dist/core/ingestion/scope-resolution/passes/overload-narrowing.d.ts +26 -0
  237. package/dist/core/ingestion/scope-resolution/passes/overload-narrowing.js +61 -0
  238. package/dist/core/ingestion/scope-resolution/passes/receiver-bound-calls.d.ts +46 -0
  239. package/dist/core/ingestion/scope-resolution/passes/receiver-bound-calls.js +327 -0
  240. package/dist/core/ingestion/scope-resolution/pipeline/phase.d.ts +47 -0
  241. package/dist/core/ingestion/scope-resolution/pipeline/phase.js +130 -0
  242. package/dist/core/ingestion/scope-resolution/pipeline/reconcile-ownership.d.ts +68 -0
  243. package/dist/core/ingestion/scope-resolution/pipeline/reconcile-ownership.js +125 -0
  244. package/dist/core/ingestion/scope-resolution/pipeline/registry.d.ts +17 -0
  245. package/dist/core/ingestion/scope-resolution/pipeline/registry.js +21 -0
  246. package/dist/core/ingestion/scope-resolution/pipeline/run.d.ts +66 -0
  247. package/dist/core/ingestion/scope-resolution/pipeline/run.js +157 -0
  248. package/dist/core/ingestion/scope-resolution/scope/namespace-targets.d.ts +36 -0
  249. package/dist/core/ingestion/scope-resolution/scope/namespace-targets.js +52 -0
  250. package/dist/core/ingestion/scope-resolution/scope/walkers.d.ts +127 -0
  251. package/dist/core/ingestion/scope-resolution/scope/walkers.js +349 -0
  252. package/dist/core/ingestion/scope-resolution/workspace-index.d.ts +52 -0
  253. package/dist/core/ingestion/scope-resolution/workspace-index.js +61 -0
  254. package/dist/core/ingestion/shadow-harness.d.ts +113 -0
  255. package/dist/core/ingestion/shadow-harness.js +148 -0
  256. package/dist/core/ingestion/utils/ast-helpers.d.ts +19 -1
  257. package/dist/core/ingestion/utils/ast-helpers.js +70 -0
  258. package/dist/core/ingestion/utils/max-file-size.d.ts +20 -0
  259. package/dist/core/ingestion/utils/max-file-size.js +52 -0
  260. package/dist/core/ingestion/workers/parse-worker.d.ts +9 -0
  261. package/dist/core/ingestion/workers/parse-worker.js +57 -21
  262. package/dist/core/lbug/lbug-adapter.d.ts +22 -2
  263. package/dist/core/lbug/lbug-adapter.js +58 -14
  264. package/dist/core/lbug/pool-adapter.d.ts +17 -0
  265. package/dist/core/lbug/pool-adapter.js +24 -14
  266. package/dist/core/run-analyze.d.ts +32 -0
  267. package/dist/core/run-analyze.js +74 -19
  268. package/dist/core/search/bm25-index.d.ts +18 -0
  269. package/dist/core/search/bm25-index.js +125 -12
  270. package/dist/core/tree-sitter/parser-loader.js +6 -1
  271. package/dist/mcp/local/local-backend.d.ts +67 -3
  272. package/dist/mcp/local/local-backend.js +296 -34
  273. package/dist/mcp/resources.d.ts +31 -0
  274. package/dist/mcp/resources.js +100 -17
  275. package/dist/mcp/tools.d.ts +4 -1
  276. package/dist/mcp/tools.js +75 -54
  277. package/dist/server/api.js +6 -2
  278. package/dist/storage/git.d.ts +49 -0
  279. package/dist/storage/git.js +111 -0
  280. package/dist/storage/repo-manager.d.ts +246 -1
  281. package/dist/storage/repo-manager.js +391 -9
  282. package/package.json +7 -6
  283. package/scripts/bench-scope-resolution.ts +134 -0
  284. package/scripts/ci-list-migrated-languages.ts +24 -0
  285. package/skills/gitnexus-cli.md +1 -0
@@ -0,0 +1,82 @@
1
+ /**
2
+ * C# scope-resolution hooks (RFC #909 Ring 3, RFC §5).
3
+ *
4
+ * Public API barrel. Consumers should import from this file rather than
5
+ * the individual modules.
6
+ *
7
+ * Module layout (each file is a single concern):
8
+ *
9
+ * - `query.ts` — tree-sitter query + lazy parser/query singletons
10
+ * - `captures.ts` — `emitCsharpScopeCaptures` orchestrator
11
+ * - `import-decomposer.ts` — each `using` → ParsedImport-shaped captures
12
+ * - `interpret.ts` — capture-match → `ParsedImport` / `ParsedTypeBinding`
13
+ * - `simple-hooks.ts` — small/no-op hooks made explicit
14
+ * - `receiver-binding.ts` — synthesize `this`/`base` type-bindings on
15
+ * instance-method entry
16
+ * - `merge-bindings.ts` — C# `using` precedence
17
+ * - `arity.ts` — C# arity compatibility (`params`, default values)
18
+ * - `arity-metadata.ts` — synthesize arity metadata from declarations
19
+ * - `accessor-unwrap.ts` — `.Values` / `.Keys` receiver-type unwrap for
20
+ * `Dictionary<K,V>` chains
21
+ * - `namespace-siblings.ts` — AST-driven cross-file implicit-namespace
22
+ * visibility (file/namespace attribution, no
23
+ * regex; reuses orchestrator's treeCache)
24
+ * - `import-target.ts` — `(ParsedImport, WorkspaceIndex) → file path` adapter
25
+ * - `scope-resolver.ts` — `ScopeResolver` registered in `SCOPE_RESOLVERS`
26
+ * - `cache-stats.ts` — PROF_SCOPE_RESOLUTION cache hit/miss counters
27
+ *
28
+ * ## Known limitations
29
+ *
30
+ * The C# registry-primary path intentionally does NOT resolve the
31
+ * following. Each is a conscious trade-off at migration time.
32
+ *
33
+ * 1. **csproj-driven namespace resolution** — the legacy path
34
+ * consults `csharpConfigs` (the parsed .csproj workspace) to map
35
+ * `using X.Y;` back to the exact files declaring `namespace X.Y`.
36
+ * The scope-resolver contract passes only `allFilePaths`, so we
37
+ * fall back to suffix matching on `.cs` files. Unit 7's parity
38
+ * gate flags any divergence.
39
+ * 2. **Multi-file namespace expansion** — a single `using X.Y;` in
40
+ * the legacy path can emit multiple IMPORTS edges (every file
41
+ * declaring that namespace). The scope-resolver contract returns
42
+ * a single target, so we pick the first match; partial-class
43
+ * aggregation runs at graph-bridge time.
44
+ * 3. **Overload resolution by parameter type** — arity narrowing is
45
+ * wired (`arity.ts` + `arity-metadata.ts`), but type-based
46
+ * disambiguation (`F(int)` vs `F(string)` at a call with a typed
47
+ * argument) is left to the registry's type-binding layer.
48
+ * 4. **Generic type parameter resolution** — `List<User>` binds the
49
+ * bound name to `User` via the single-arg-generic stripper;
50
+ * nested generics (`Dictionary<K, List<V>>`) fall through the
51
+ * receiver-type heuristic.
52
+ * 5. **`dynamic` typed expressions** — runtime dispatch through
53
+ * `dynamic` is not followed.
54
+ * 6. **Preprocessor-conditional code** — `#if DEBUG` blocks parse
55
+ * as usual; branch selection is ignored, so both arms contribute
56
+ * bindings.
57
+ * 7. **Global using propagation across files** — treated as a
58
+ * file-scoped using for the declaring file. Unit 7 parity gate
59
+ * will flag cases where this matters.
60
+ * 8. **Expression-bodied `=>` members** — handled by the method
61
+ * extractor, but receiver synthesis for `=> this.Field` shortcuts
62
+ * follows the same path as block-bodied methods.
63
+ * 9. **Multi-namespace file attribution** — when a single file
64
+ * declares two namespaces (rare), all top-level classes are
65
+ * attributed to the first declared namespace via a `first-wins`
66
+ * rule in `namespace-siblings.ts`. Namespace detection itself is
67
+ * AST-driven (tree-sitter), so `global using static`, aliased
68
+ * `using static X = Y.Z;`, attributes, and preprocessor-gated
69
+ * declarations are all recognized correctly.
70
+ *
71
+ * Shadow-harness corpus parity is the authoritative signal for which
72
+ * of these matter in practice. The CI parity gate blocks any PR that
73
+ * regresses either the legacy or registry-primary run of
74
+ * `test/integration/resolvers/csharp.test.ts`.
75
+ */
76
+ export { emitCsharpScopeCaptures } from './captures.js';
77
+ export { getCsharpCaptureCacheStats, resetCsharpCaptureCacheStats } from './cache-stats.js';
78
+ export { interpretCsharpImport, interpretCsharpTypeBinding } from './interpret.js';
79
+ export { csharpMergeBindings } from './merge-bindings.js';
80
+ export { csharpArityCompatibility } from './arity.js';
81
+ export { resolveCsharpImportTarget } from './import-target.js';
82
+ export { csharpBindingScopeFor, csharpImportOwningScope, csharpReceiverBinding, } from './simple-hooks.js';
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Capture-match → semantic-shape interpreters for C#.
3
+ *
4
+ * - `interpretCsharpImport` → `ParsedImport`
5
+ * - `interpretCsharpTypeBinding` → `ParsedTypeBinding`
6
+ *
7
+ * The using-directive matches arrive pre-decomposed by
8
+ * `emitCsharpScopeCaptures` (one import per match, with synthesized
9
+ * `@import.kind/source/name/alias` markers). Type-binding matches arrive
10
+ * from the raw query captures — each `@type-binding.*` anchor carries
11
+ * `@type-binding.name` + `@type-binding.type`.
12
+ */
13
+ import type { CaptureMatch, ParsedImport, ParsedTypeBinding } from '../../../../_shared/index.js';
14
+ export declare function interpretCsharpImport(captures: CaptureMatch): ParsedImport | null;
15
+ export declare function interpretCsharpTypeBinding(captures: CaptureMatch): ParsedTypeBinding | null;
@@ -0,0 +1,132 @@
1
+ /**
2
+ * Capture-match → semantic-shape interpreters for C#.
3
+ *
4
+ * - `interpretCsharpImport` → `ParsedImport`
5
+ * - `interpretCsharpTypeBinding` → `ParsedTypeBinding`
6
+ *
7
+ * The using-directive matches arrive pre-decomposed by
8
+ * `emitCsharpScopeCaptures` (one import per match, with synthesized
9
+ * `@import.kind/source/name/alias` markers). Type-binding matches arrive
10
+ * from the raw query captures — each `@type-binding.*` anchor carries
11
+ * `@type-binding.name` + `@type-binding.type`.
12
+ */
13
+ // ─── interpretImport ──────────────────────────────────────────────────────
14
+ export function interpretCsharpImport(captures) {
15
+ const kindCap = captures['@import.kind'];
16
+ const sourceCap = captures['@import.source'];
17
+ const nameCap = captures['@import.name'];
18
+ const aliasCap = captures['@import.alias'];
19
+ const kind = kindCap?.text;
20
+ if (kind === undefined || sourceCap === undefined)
21
+ return null;
22
+ switch (kind) {
23
+ case 'namespace': {
24
+ // `using System;` / `using System.Collections.Generic;`
25
+ // Bind the last segment as the local name so `Generic.Foo`-style
26
+ // qualifier references resolve. Full path is the resolution target.
27
+ return {
28
+ kind: 'namespace',
29
+ localName: nameCap?.text ?? sourceCap.text.split('.').pop() ?? sourceCap.text,
30
+ importedName: sourceCap.text,
31
+ targetRaw: sourceCap.text,
32
+ };
33
+ }
34
+ case 'alias': {
35
+ // `using Dict = System.Collections.Generic.Dictionary<string, int>;`
36
+ // The decomposer already stripped generic args from source.
37
+ if (aliasCap === undefined)
38
+ return null;
39
+ const importedName = sourceCap.text.split('.').pop() ?? sourceCap.text;
40
+ return {
41
+ kind: 'alias',
42
+ localName: aliasCap.text,
43
+ importedName,
44
+ alias: aliasCap.text,
45
+ targetRaw: sourceCap.text,
46
+ };
47
+ }
48
+ case 'static': {
49
+ // `using static System.Math;` — brings static members of Math into
50
+ // unqualified scope. Semantically closest to a wildcard, but we
51
+ // map to `namespace` here so finalize emits the File→File IMPORTS
52
+ // edge without requiring `expandsWildcardTo` (which would list
53
+ // every exported member). Static-member unqualified-access is a
54
+ // deferred limitation; the usual cross-file lookup via
55
+ // namespace-siblings covers `Target.Member` calls.
56
+ const lastSegment = sourceCap.text.split('.').pop() ?? sourceCap.text;
57
+ return {
58
+ kind: 'namespace',
59
+ localName: lastSegment,
60
+ importedName: sourceCap.text,
61
+ targetRaw: sourceCap.text,
62
+ };
63
+ }
64
+ default:
65
+ return null;
66
+ }
67
+ }
68
+ // ─── interpretTypeBinding ─────────────────────────────────────────────────
69
+ export function interpretCsharpTypeBinding(captures) {
70
+ const nameCap = captures['@type-binding.name'];
71
+ const typeCap = captures['@type-binding.type'];
72
+ if (nameCap === undefined || typeCap === undefined)
73
+ return null;
74
+ // Strip nullable suffix (`User?` → `User`), single-arg generic wrapper
75
+ // (`List<User>` → `User`), and qualifier (`System.User` → `User`) so
76
+ // receiver-typed resolution treats these identically.
77
+ const rawType = stripQualifier(stripGeneric(stripNullable(typeCap.text.trim())));
78
+ // Anchor captures distinguish the source of the binding. Order
79
+ // matters: more-specific anchors take precedence.
80
+ let source = 'parameter-annotation';
81
+ if (captures['@type-binding.self'] !== undefined)
82
+ source = 'self';
83
+ else if (captures['@type-binding.constructor'] !== undefined)
84
+ source = 'constructor-inferred';
85
+ else if (captures['@type-binding.annotation'] !== undefined)
86
+ source = 'annotation';
87
+ else if (captures['@type-binding.alias'] !== undefined)
88
+ source = 'assignment-inferred';
89
+ else if (captures['@type-binding.return'] !== undefined)
90
+ source = 'return-annotation';
91
+ return { boundName: nameCap.text, rawTypeName: rawType, source };
92
+ }
93
+ /** Member accesses we want to preserve through qualifier stripping.
94
+ * Dictionary/collection views (`data.Values`, `data.Keys`) survive
95
+ * so the compound-receiver pass can unwrap the receiver's generic
96
+ * type (Dictionary<K,V>) based on the suffix. */
97
+ const COLLECTION_ACCESSOR_SUFFIXES = new Set(['Values', 'Keys']);
98
+ /** `User?` → `User`. */
99
+ function stripNullable(text) {
100
+ if (text.endsWith('?'))
101
+ return text.slice(0, -1).trim();
102
+ return text;
103
+ }
104
+ /**
105
+ * Unwrap a single-arg generic collection wrapper — `List<User>`,
106
+ * `IEnumerable<User>`, `Task<User>` — to its element type. Mirrors
107
+ * Python's `stripGeneric` behavior so for-loop and chain propagation
108
+ * work on the element type.
109
+ *
110
+ * Multi-arg generics (`Dictionary<string, User>`, `Func<int, User>`)
111
+ * are left alone — element semantics aren't unambiguous.
112
+ */
113
+ function stripGeneric(text) {
114
+ const single = text.match(/^(?:[A-Za-z_][A-Za-z0-9_.]*\.)?(?:List|IList|IEnumerable|ICollection|IReadOnlyList|IReadOnlyCollection|HashSet|ISet|Task|ValueTask|Nullable|IAsyncEnumerable)<([^,<>]+)>$/);
115
+ if (single !== null)
116
+ return single[1].trim();
117
+ return text;
118
+ }
119
+ /** `System.Collections.User` → `User`. Preserves dotted paths whose
120
+ * final segment is a known Dictionary/collection accessor (`.Values`,
121
+ * `.Keys`, `.Count`, etc.) so downstream resolvers can unwrap the
122
+ * receiver's generic type based on the suffix — `data.Values` →
123
+ * element type of `data`'s Dictionary<K,V>. */
124
+ function stripQualifier(text) {
125
+ const lastDot = text.lastIndexOf('.');
126
+ if (lastDot === -1)
127
+ return text;
128
+ const tail = text.slice(lastDot + 1);
129
+ if (COLLECTION_ACCESSOR_SUFFIXES.has(tail))
130
+ return text;
131
+ return tail;
132
+ }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * C# shadowing precedence for the `mergeBindings` hook.
3
+ *
4
+ * Tier ranking (lower wins in shadowing):
5
+ *
6
+ * - 0: `local` — a class member, method, local variable, or parameter
7
+ * declared in this scope.
8
+ * - 1: `import` / `namespace` / `reexport` — `using System;`,
9
+ * `using System.Collections.Generic;`, `using Alias = Foo;`.
10
+ * All three using flavors that introduce a name at this scope
11
+ * tier together; the compiler resolves ambiguity by requiring
12
+ * an explicit qualifier when two `using`s collide, but for
13
+ * receiver-typed dispatch we treat them as equivalent tiers.
14
+ * - 2: `wildcard` — `using static System.Math;` brings static
15
+ * members in; any local or `using` with the same simple name
16
+ * shadows.
17
+ *
18
+ * Explicit interface implementations (`void IFoo.Bar() { }`) bind under
19
+ * the qualified name in the extractor layer, so they never collide with
20
+ * a plain `Bar` at this layer.
21
+ *
22
+ * Within a surviving tier we de-dup by `DefId`, last-write-wins so a
23
+ * `using` re-declared further down the file cleanly replaces the
24
+ * earlier binding.
25
+ */
26
+ import type { BindingRef } from '../../../../_shared/index.js';
27
+ export declare function csharpMergeBindings(bindings: readonly BindingRef[]): readonly BindingRef[];
@@ -0,0 +1,55 @@
1
+ /**
2
+ * C# shadowing precedence for the `mergeBindings` hook.
3
+ *
4
+ * Tier ranking (lower wins in shadowing):
5
+ *
6
+ * - 0: `local` — a class member, method, local variable, or parameter
7
+ * declared in this scope.
8
+ * - 1: `import` / `namespace` / `reexport` — `using System;`,
9
+ * `using System.Collections.Generic;`, `using Alias = Foo;`.
10
+ * All three using flavors that introduce a name at this scope
11
+ * tier together; the compiler resolves ambiguity by requiring
12
+ * an explicit qualifier when two `using`s collide, but for
13
+ * receiver-typed dispatch we treat them as equivalent tiers.
14
+ * - 2: `wildcard` — `using static System.Math;` brings static
15
+ * members in; any local or `using` with the same simple name
16
+ * shadows.
17
+ *
18
+ * Explicit interface implementations (`void IFoo.Bar() { }`) bind under
19
+ * the qualified name in the extractor layer, so they never collide with
20
+ * a plain `Bar` at this layer.
21
+ *
22
+ * Within a surviving tier we de-dup by `DefId`, last-write-wins so a
23
+ * `using` re-declared further down the file cleanly replaces the
24
+ * earlier binding.
25
+ */
26
+ const TIER_LOCAL = 0;
27
+ const TIER_IMPORT = 1;
28
+ const TIER_WILDCARD = 2;
29
+ const TIER_UNKNOWN = 3;
30
+ function tierOf(b) {
31
+ switch (b.origin) {
32
+ case 'local':
33
+ return TIER_LOCAL;
34
+ case 'reexport':
35
+ case 'import':
36
+ case 'namespace':
37
+ return TIER_IMPORT;
38
+ case 'wildcard':
39
+ return TIER_WILDCARD;
40
+ default:
41
+ return TIER_UNKNOWN;
42
+ }
43
+ }
44
+ export function csharpMergeBindings(bindings) {
45
+ if (bindings.length === 0)
46
+ return bindings;
47
+ let bestTier = Number.POSITIVE_INFINITY;
48
+ for (const b of bindings)
49
+ bestTier = Math.min(bestTier, tierOf(b));
50
+ const survivors = bindings.filter((b) => tierOf(b) === bestTier);
51
+ const seen = new Map();
52
+ for (const b of survivors)
53
+ seen.set(b.def.nodeId, b);
54
+ return [...seen.values()];
55
+ }
@@ -0,0 +1,50 @@
1
+ /**
2
+ * C# same-namespace cross-file visibility.
3
+ *
4
+ * C# makes every type declared in `namespace X` visible to every other
5
+ * file that also declares `namespace X`, without any explicit `using`
6
+ * directive. Python has no equivalent — every cross-file reference
7
+ * needs an explicit import — so this is a C#-specific pass.
8
+ *
9
+ * Without this: `Service.cs` (namespace `FieldTypes`) can't see
10
+ * `User` declared in `Models.cs` (same namespace), so `user.Address`
11
+ * field-chain resolution fails at `findClassBindingInScope('User')`
12
+ * in the Service.cs scope chain.
13
+ *
14
+ * Implementation: after the finalize pass populates `indexes.bindings`
15
+ * (from explicit `using` directives), walk each file's tree-sitter
16
+ * AST for `namespace_declaration` / `file_scoped_namespace_declaration`
17
+ * and `using_directive` nodes. The orchestrator hands us its
18
+ * `treeCache` so files already parsed by `extractParsedFile` are
19
+ * re-used instead of re-parsed — `ParsedFile`'s underlying tree is
20
+ * the single source of truth. Group classes by namespace, and inject
21
+ * cross-file sibling classes into each Namespace scope's finalized
22
+ * bindings with `origin: 'namespace'` — a tier below `local` so a
23
+ * local declaration still shadows a cross-file sibling with the same
24
+ * name.
25
+ *
26
+ * The tree-sitter walk is authoritative: it sees `global using static`,
27
+ * aliased `using static X = Y.Z;`, attributed namespace declarations,
28
+ * and preprocessor-guarded declarations correctly because the
29
+ * tree-sitter grammar parses them as real nodes (not textual
30
+ * coincidences).
31
+ */
32
+ import type { ParsedFile } from '../../../../_shared/index.js';
33
+ import type { ScopeResolutionIndexes } from '../../model/scope-resolution-indexes.js';
34
+ /** Content + (optional) pre-parsed tree-sitter trees keyed by filePath.
35
+ * The orchestrator builds `fileContents` from the pipeline's file list;
36
+ * `treeCache` is the same `scopeTreeCache` already populated by the
37
+ * parse phase, so cache hits avoid a second `parser.parse()`. */
38
+ export interface CsharpSiblingInputs {
39
+ readonly fileContents: ReadonlyMap<string, string>;
40
+ readonly treeCache?: {
41
+ get(filePath: string): unknown;
42
+ };
43
+ }
44
+ /**
45
+ * Mutate `indexes.bindings` in-place, adding cross-file sibling class
46
+ * defs to each Namespace scope. Class-like defs (Class / Interface /
47
+ * Struct / Record / Enum) are visible cross-file; method / field
48
+ * members are not.
49
+ */
50
+ export declare function populateCsharpNamespaceSiblings(parsedFiles: readonly ParsedFile[], indexes: ScopeResolutionIndexes, inputs: CsharpSiblingInputs): void;