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,24 @@
1
+ /**
2
+ * `ReferenceSite` — a pre-resolution usage fact collected by `ScopeExtractor`
3
+ * (RFC §3.2 Phase 1; Ring 2 PKG #919).
4
+ *
5
+ * One record per `@reference.*` capture. The extractor records:
6
+ * - the name being referenced (method/field/class name),
7
+ * - the source range,
8
+ * - the innermost lexical scope containing the reference,
9
+ * - the reference kind (call, read, write, inherits, etc.),
10
+ * - optional call-form classification from `provider.classifyCallForm`,
11
+ * - optional explicit-receiver hint for dotted calls (`user.save()`),
12
+ * - optional arity for call sites.
13
+ *
14
+ * Reference sites are consumed by the resolution phase (RFC §3.2 Phase 4)
15
+ * which routes each through `Registry.lookup` / `resolveTypeRef` and
16
+ * emits the final `Reference` record into `ReferenceIndex`.
17
+ *
18
+ * **Pre-resolution only.** `ReferenceSite` intentionally carries no
19
+ * `toDef`, `confidence`, or `evidence`. Those are populated by the
20
+ * resolution step that reads this record and produces a `Reference`
21
+ * (defined in `./types.ts`).
22
+ */
23
+ export {};
24
+ //# sourceMappingURL=reference-site.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reference-site.js","sourceRoot":"","sources":["../../src/scope-resolution/reference-site.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * `ClassRegistry` — scope-aware lookup for class-like symbols
3
+ * (RFC §4.4; Ring 2 SHARED #917).
4
+ *
5
+ * Thin wrapper over `lookupCore`, specialized for class kinds:
6
+ *
7
+ * - `acceptedKinds` = Class / Interface / Enum / Struct / Union /
8
+ * Trait / TypeAlias / Typedef / Record / Delegate / Annotation /
9
+ * Template / Namespace.
10
+ * - `useReceiverTypeBinding` is **false** — classes are resolved by
11
+ * name through the lexical chain + global qualified fallback, not
12
+ * via a receiver type.
13
+ * - Arity filter is not applicable (classes are not called with
14
+ * argument counts at lookup time).
15
+ */
16
+ import type { Resolution, ScopeId } from '../types.js';
17
+ import { type RegistryContext } from './context.js';
18
+ export interface ClassRegistry {
19
+ /**
20
+ * Look up a class-like symbol by simple or dotted name anchored at
21
+ * `scope`. Returns a confidence-ranked `Resolution[]`; consume `[0]`
22
+ * for the best answer.
23
+ */
24
+ lookup(name: string, scope: ScopeId): readonly Resolution[];
25
+ }
26
+ export declare function buildClassRegistry(ctx: RegistryContext): ClassRegistry;
27
+ //# sourceMappingURL=class-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"class-registry.d.ts","sourceRoot":"","sources":["../../../src/scope-resolution/registries/class-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEvD,OAAO,EAAe,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AAEjE,MAAM,WAAW,aAAa;IAC5B;;;;OAIG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,SAAS,UAAU,EAAE,CAAC;CAC7D;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,eAAe,GAAG,aAAa,CAWtE"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * `ClassRegistry` — scope-aware lookup for class-like symbols
3
+ * (RFC §4.4; Ring 2 SHARED #917).
4
+ *
5
+ * Thin wrapper over `lookupCore`, specialized for class kinds:
6
+ *
7
+ * - `acceptedKinds` = Class / Interface / Enum / Struct / Union /
8
+ * Trait / TypeAlias / Typedef / Record / Delegate / Annotation /
9
+ * Template / Namespace.
10
+ * - `useReceiverTypeBinding` is **false** — classes are resolved by
11
+ * name through the lexical chain + global qualified fallback, not
12
+ * via a receiver type.
13
+ * - Arity filter is not applicable (classes are not called with
14
+ * argument counts at lookup time).
15
+ */
16
+ import { lookupCore } from './lookup-core.js';
17
+ import { CLASS_KINDS } from './context.js';
18
+ export function buildClassRegistry(ctx) {
19
+ const params = {
20
+ acceptedKinds: CLASS_KINDS,
21
+ useReceiverTypeBinding: false,
22
+ ownerScopedContributor: null,
23
+ };
24
+ return {
25
+ lookup(name, scope) {
26
+ return lookupCore(name, scope, params, ctx);
27
+ },
28
+ };
29
+ }
30
+ //# sourceMappingURL=class-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"class-registry.js","sourceRoot":"","sources":["../../../src/scope-resolution/registries/class-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,UAAU,EAAyB,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,WAAW,EAAwB,MAAM,cAAc,CAAC;AAWjE,MAAM,UAAU,kBAAkB,CAAC,GAAoB;IACrD,MAAM,MAAM,GAAqB;QAC/B,aAAa,EAAE,WAAW;QAC1B,sBAAsB,EAAE,KAAK;QAC7B,sBAAsB,EAAE,IAAI;KAC7B,CAAC;IACF,OAAO;QACL,MAAM,CAAC,IAAY,EAAE,KAAc;YACjC,OAAO,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC;QAC9C,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,69 @@
1
+ /**
2
+ * `RegistryContext` — the injected state required by the scope-aware
3
+ * registry lookups (RFC §4; Ring 2 SHARED #917).
4
+ *
5
+ * Bundles every Ring 2 index + every provider hook the 7-step algorithm
6
+ * might consult. Threaded through `lookupCore` and the three public
7
+ * registries unchanged; construction is the caller's responsibility
8
+ * (typically once per workspace-indexing pass in Ring 2 PKG).
9
+ *
10
+ * The design intent is **pure-logic in `gitnexus-shared`, data + hooks
11
+ * supplied by the caller**. Nothing here loads files, parses AST, or
12
+ * reaches into the CLI package.
13
+ */
14
+ import type { NodeLabel } from '../../graph/types.js';
15
+ import type { SymbolDefinition } from '../symbol-definition.js';
16
+ import type { Callsite, DefId } from '../types.js';
17
+ import type { DefIndex } from '../def-index.js';
18
+ import type { QualifiedNameIndex } from '../qualified-name-index.js';
19
+ import type { ModuleScopeIndex } from '../module-scope-index.js';
20
+ import type { ScopeTree } from '../scope-tree.js';
21
+ import type { MethodDispatchIndex } from '../method-dispatch-index.js';
22
+ export interface RegistryProviders {
23
+ /**
24
+ * Language-specific arity compatibility between a callsite and a candidate
25
+ * `def`. Mirrors `LanguageProvider.arityCompatibility` from #911. Optional:
26
+ * when absent, every candidate receives `'unknown'` (neutral signal).
27
+ */
28
+ arityCompatibility?(callsite: Callsite, def: SymbolDefinition): ArityVerdict;
29
+ }
30
+ export type ArityVerdict = 'compatible' | 'unknown' | 'incompatible';
31
+ /**
32
+ * Per-owner membership view plugged into `LookupParams.ownerScopedContributor`.
33
+ *
34
+ * When the caller knows a receiver is of type `Owner` (e.g., after
35
+ * resolving an explicit receiver or via `self`), it can supply the
36
+ * `Owner`'s own member bucket here. `lookupCore` treats hits from this
37
+ * contributor as `origin: 'local'` inside the owner's body scope —
38
+ * strongest-visibility evidence, unaffected by the scope-chain hop
39
+ * deduction that punishes outer-scope hits.
40
+ *
41
+ * Ring 1's `RegistryContributor = unknown` opaque placeholder is narrowed
42
+ * to this concrete shape here in Ring 2 SHARED (#917).
43
+ */
44
+ export interface OwnerScopedContributor {
45
+ /** The owner (class/struct/trait/interface) that bounds this view. */
46
+ readonly ownerDefId: DefId;
47
+ /**
48
+ * Methods / fields directly declared on the owner, keyed by simple name.
49
+ * Return empty array on miss; implementations should NOT walk the MRO —
50
+ * that's `MethodDispatchIndex`'s job, handled in the type-binding step.
51
+ */
52
+ byName(name: string): readonly SymbolDefinition[];
53
+ }
54
+ export interface RegistryContext {
55
+ readonly scopes: ScopeTree;
56
+ readonly defs: DefIndex;
57
+ readonly qualifiedNames: QualifiedNameIndex;
58
+ readonly moduleScopes: ModuleScopeIndex;
59
+ /**
60
+ * Method-dispatch index; required for method/field registries that
61
+ * honor `useReceiverTypeBinding`. Omit for class-only lookups.
62
+ */
63
+ readonly methodDispatch?: MethodDispatchIndex;
64
+ readonly providers: RegistryProviders;
65
+ }
66
+ export declare const CLASS_KINDS: readonly NodeLabel[];
67
+ export declare const METHOD_KINDS: readonly NodeLabel[];
68
+ export declare const FIELD_KINDS: readonly NodeLabel[];
69
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/scope-resolution/registries/context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAIvE,MAAM,WAAW,iBAAiB;IAChC;;;;OAIG;IACH,kBAAkB,CAAC,CAAC,QAAQ,EAAE,QAAQ,EAAE,GAAG,EAAE,gBAAgB,GAAG,YAAY,CAAC;CAC9E;AAED,MAAM,MAAM,YAAY,GAAG,YAAY,GAAG,SAAS,GAAG,cAAc,CAAC;AAIrE;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,sBAAsB;IACrC,sEAAsE;IACtE,QAAQ,CAAC,UAAU,EAAE,KAAK,CAAC;IAC3B;;;;OAIG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,gBAAgB,EAAE,CAAC;CACnD;AAID,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,cAAc,EAAE,kBAAkB,CAAC;IAC5C,QAAQ,CAAC,YAAY,EAAE,gBAAgB,CAAC;IACxC;;;OAGG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,mBAAmB,CAAC;IAC9C,QAAQ,CAAC,SAAS,EAAE,iBAAiB,CAAC;CACvC;AAOD,eAAO,MAAM,WAAW,EAAE,SAAS,SAAS,EAc1C,CAAC;AAEH,eAAO,MAAM,YAAY,EAAE,SAAS,SAAS,EAI3C,CAAC;AAEH,eAAO,MAAM,WAAW,EAAE,SAAS,SAAS,EAK1C,CAAC"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * `RegistryContext` — the injected state required by the scope-aware
3
+ * registry lookups (RFC §4; Ring 2 SHARED #917).
4
+ *
5
+ * Bundles every Ring 2 index + every provider hook the 7-step algorithm
6
+ * might consult. Threaded through `lookupCore` and the three public
7
+ * registries unchanged; construction is the caller's responsibility
8
+ * (typically once per workspace-indexing pass in Ring 2 PKG).
9
+ *
10
+ * The design intent is **pure-logic in `gitnexus-shared`, data + hooks
11
+ * supplied by the caller**. Nothing here loads files, parses AST, or
12
+ * reaches into the CLI package.
13
+ */
14
+ // ─── Per-kind default `acceptedKinds` sets ─────────────────────────────────
15
+ //
16
+ // Exported so the three public registries stay declarative (each one just
17
+ // points at the right constant + passes it to `lookupCore`).
18
+ export const CLASS_KINDS = Object.freeze([
19
+ 'Class',
20
+ 'Interface',
21
+ 'Enum',
22
+ 'Struct',
23
+ 'Union',
24
+ 'Trait',
25
+ 'TypeAlias',
26
+ 'Typedef',
27
+ 'Record',
28
+ 'Delegate',
29
+ 'Annotation',
30
+ 'Template',
31
+ 'Namespace',
32
+ ]);
33
+ export const METHOD_KINDS = Object.freeze([
34
+ 'Method',
35
+ 'Function',
36
+ 'Constructor',
37
+ ]);
38
+ export const FIELD_KINDS = Object.freeze([
39
+ 'Variable',
40
+ 'Property',
41
+ 'Const',
42
+ 'Static',
43
+ ]);
44
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/scope-resolution/registries/context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAiEH,8EAA8E;AAC9E,EAAE;AACF,0EAA0E;AAC1E,6DAA6D;AAE7D,MAAM,CAAC,MAAM,WAAW,GAAyB,MAAM,CAAC,MAAM,CAAC;IAC7D,OAAO;IACP,WAAW;IACX,MAAM;IACN,QAAQ;IACR,OAAO;IACP,OAAO;IACP,WAAW;IACX,SAAS;IACT,QAAQ;IACR,UAAU;IACV,YAAY;IACZ,UAAU;IACV,WAAW;CACZ,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,YAAY,GAAyB,MAAM,CAAC,MAAM,CAAC;IAC9D,QAAQ;IACR,UAAU;IACV,aAAa;CACd,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,WAAW,GAAyB,MAAM,CAAC,MAAM,CAAC;IAC7D,UAAU;IACV,UAAU;IACV,OAAO;IACP,QAAQ;CACT,CAAC,CAAC"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * `composeEvidence` — translate accumulated raw signals per candidate
3
+ * into a `ResolutionEvidence[]` using the authoritative `EvidenceWeights`
4
+ * map (RFC §4.3 + Appendix A; Ring 2 SHARED #917).
5
+ *
6
+ * Each `RawSignals` record describes what was observed about a candidate
7
+ * during the 7-step walk: where it was found, at what depth, whether
8
+ * anything corroborates it. This module turns those raw facts into the
9
+ * typed evidence list attached to the outgoing `Resolution`.
10
+ *
11
+ * **Every weight comes from `EvidenceWeights`.** No inline magic numbers.
12
+ * Extends issue #429 (centralize hardcoded confidence values).
13
+ *
14
+ * **Confidence compose rule.** Signals add; the sum is capped at 1.0 at
15
+ * the call site (inside `lookupCore`). This module only emits the list;
16
+ * it does NOT compute the capped sum so callers can inspect per-signal
17
+ * contributions for debugging.
18
+ */
19
+ import type { BindingRef, ResolutionEvidence } from '../types.js';
20
+ /**
21
+ * Raw signals observed for a single candidate during the 7-step walk.
22
+ * Optional fields encode "this signal did not fire"; presence encodes
23
+ * "emit an evidence record".
24
+ */
25
+ export interface RawSignals {
26
+ /** Visibility origin of the binding that produced this candidate. */
27
+ readonly origin?: BindingRef['origin'] | 'global-qualified' | 'global-name';
28
+ /** Depth at which the binding was found (hops up from start scope). */
29
+ readonly scopeChainDepth?: number;
30
+ /** `ImportEdge` that brought the name in; present when origin is a non-local. */
31
+ readonly viaUnlinkedImport?: boolean;
32
+ /** Set when the candidate came via the receiver's type-binding MRO walk. */
33
+ readonly typeBindingMroDepth?: number;
34
+ /** `def.ownerId === resolvedReceiver.def.nodeId`. */
35
+ readonly ownerMatch?: boolean;
36
+ /** Always fires for candidates that pass `acceptedKinds`; weight 0. */
37
+ readonly kindMatch: true;
38
+ readonly arityVerdict?: 'compatible' | 'unknown' | 'incompatible';
39
+ /** Candidate flows through a `kind: 'dynamic-unresolved'` ImportEdge. */
40
+ readonly dynamicUnresolved?: boolean;
41
+ }
42
+ /**
43
+ * Compose the raw signals into a stable `ResolutionEvidence[]` list.
44
+ *
45
+ * Emission order mirrors the `EvidenceWeights` layout: where-found →
46
+ * type-binding → corroborators → arity → degraded. Stable order makes
47
+ * the per-signal contributions easy to reason about in tests and in the
48
+ * shadow-mode parity dashboard.
49
+ */
50
+ export declare function composeEvidence(signals: RawSignals): readonly ResolutionEvidence[];
51
+ /**
52
+ * Sum evidence weights and clamp to `[0, 1]`. Separate from `composeEvidence`
53
+ * so tests and the parity dashboard can inspect the raw evidence list.
54
+ */
55
+ export declare function confidenceFromEvidence(evidence: readonly ResolutionEvidence[]): number;
56
+ //# sourceMappingURL=evidence.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evidence.d.ts","sourceRoot":"","sources":["../../../src/scope-resolution/registries/evidence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAGlE;;;;GAIG;AACH,MAAM,WAAW,UAAU;IAEzB,qEAAqE;IACrE,QAAQ,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC,QAAQ,CAAC,GAAG,kBAAkB,GAAG,aAAa,CAAC;IAC5E,uEAAuE;IACvE,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC,iFAAiF;IACjF,QAAQ,CAAC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAGrC,4EAA4E;IAC5E,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAGtC,qDAAqD;IACrD,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;IAC9B,uEAAuE;IACvE,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC;IAGzB,QAAQ,CAAC,YAAY,CAAC,EAAE,YAAY,GAAG,SAAS,GAAG,cAAc,CAAC;IAGlE,yEAAyE;IACzE,QAAQ,CAAC,iBAAiB,CAAC,EAAE,OAAO,CAAC;CACtC;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,UAAU,GAAG,SAAS,kBAAkB,EAAE,CA6ElF;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,SAAS,kBAAkB,EAAE,GAAG,MAAM,CAMtF"}
@@ -0,0 +1,150 @@
1
+ /**
2
+ * `composeEvidence` — translate accumulated raw signals per candidate
3
+ * into a `ResolutionEvidence[]` using the authoritative `EvidenceWeights`
4
+ * map (RFC §4.3 + Appendix A; Ring 2 SHARED #917).
5
+ *
6
+ * Each `RawSignals` record describes what was observed about a candidate
7
+ * during the 7-step walk: where it was found, at what depth, whether
8
+ * anything corroborates it. This module turns those raw facts into the
9
+ * typed evidence list attached to the outgoing `Resolution`.
10
+ *
11
+ * **Every weight comes from `EvidenceWeights`.** No inline magic numbers.
12
+ * Extends issue #429 (centralize hardcoded confidence values).
13
+ *
14
+ * **Confidence compose rule.** Signals add; the sum is capped at 1.0 at
15
+ * the call site (inside `lookupCore`). This module only emits the list;
16
+ * it does NOT compute the capped sum so callers can inspect per-signal
17
+ * contributions for debugging.
18
+ */
19
+ import { EvidenceWeights, typeBindingWeightAtDepth } from '../evidence-weights.js';
20
+ /**
21
+ * Compose the raw signals into a stable `ResolutionEvidence[]` list.
22
+ *
23
+ * Emission order mirrors the `EvidenceWeights` layout: where-found →
24
+ * type-binding → corroborators → arity → degraded. Stable order makes
25
+ * the per-signal contributions easy to reason about in tests and in the
26
+ * shadow-mode parity dashboard.
27
+ */
28
+ export function composeEvidence(signals) {
29
+ const out = [];
30
+ // ── Where-found visibility ─────────────────────────────────────────────
31
+ if (signals.origin !== undefined) {
32
+ const baseWeight = getOriginWeight(signals.origin);
33
+ const capped = signals.viaUnlinkedImport
34
+ ? baseWeight * EvidenceWeights.unlinkedImportMultiplier
35
+ : baseWeight;
36
+ const evidenceKind = whereFoundEvidenceKind(signals.origin);
37
+ out.push({
38
+ kind: evidenceKind,
39
+ weight: capped,
40
+ ...(signals.viaUnlinkedImport
41
+ ? { note: `via unresolved import (${EvidenceWeights.unlinkedImportMultiplier}× cap)` }
42
+ : {}),
43
+ });
44
+ }
45
+ // ── Scope-chain depth deduction (per-hop, only meaningful for lexical
46
+ // hits where scopeChainDepth ≥ 1). Depth 0 = no deduction; depth N ≥ 1
47
+ // emits a single `scope-chain` evidence with the accumulated penalty.
48
+ if (signals.scopeChainDepth !== undefined && signals.scopeChainDepth > 0) {
49
+ out.push({
50
+ kind: 'scope-chain',
51
+ weight: EvidenceWeights.scopeChainPerDepth * signals.scopeChainDepth,
52
+ note: `depth=${signals.scopeChainDepth}`,
53
+ });
54
+ }
55
+ // ── Type-binding / MRO path ────────────────────────────────────────────
56
+ if (signals.typeBindingMroDepth !== undefined) {
57
+ out.push({
58
+ kind: 'type-binding',
59
+ weight: typeBindingWeightAtDepth(signals.typeBindingMroDepth),
60
+ note: `mroDepth=${signals.typeBindingMroDepth}`,
61
+ });
62
+ }
63
+ // ── Owner match (explanatory for debug) ────────────────────────────────
64
+ if (signals.ownerMatch === true) {
65
+ out.push({
66
+ kind: 'owner-match',
67
+ weight: EvidenceWeights.ownerMatch,
68
+ });
69
+ }
70
+ // ── Kind match (always present; weight 0; retained for debuggability) ──
71
+ out.push({
72
+ kind: 'kind-match',
73
+ weight: EvidenceWeights.kindMatch,
74
+ });
75
+ // ── Arity ──────────────────────────────────────────────────────────────
76
+ if (signals.arityVerdict !== undefined) {
77
+ const weight = signals.arityVerdict === 'compatible'
78
+ ? EvidenceWeights.arityMatchCompatible
79
+ : signals.arityVerdict === 'incompatible'
80
+ ? EvidenceWeights.arityMatchIncompatible
81
+ : EvidenceWeights.arityMatchUnknown;
82
+ out.push({
83
+ kind: 'arity-match',
84
+ weight,
85
+ note: signals.arityVerdict,
86
+ });
87
+ }
88
+ // ── Dynamic-unresolved (degraded signal) ───────────────────────────────
89
+ if (signals.dynamicUnresolved === true) {
90
+ out.push({
91
+ kind: 'dynamic-import-unresolved',
92
+ weight: EvidenceWeights.dynamicImportUnresolved,
93
+ });
94
+ }
95
+ return out;
96
+ }
97
+ /**
98
+ * Sum evidence weights and clamp to `[0, 1]`. Separate from `composeEvidence`
99
+ * so tests and the parity dashboard can inspect the raw evidence list.
100
+ */
101
+ export function confidenceFromEvidence(evidence) {
102
+ let sum = 0;
103
+ for (const e of evidence)
104
+ sum += e.weight;
105
+ if (sum < 0)
106
+ return 0;
107
+ if (sum > 1)
108
+ return 1;
109
+ return sum;
110
+ }
111
+ // ─── Internal ───────────────────────────────────────────────────────────────
112
+ function getOriginWeight(origin) {
113
+ switch (origin) {
114
+ case 'local':
115
+ return EvidenceWeights.local;
116
+ case 'import':
117
+ return EvidenceWeights.import;
118
+ case 'reexport':
119
+ return EvidenceWeights.reexport;
120
+ case 'namespace':
121
+ return EvidenceWeights.namespace;
122
+ case 'wildcard':
123
+ return EvidenceWeights.wildcard;
124
+ case 'global-qualified':
125
+ return EvidenceWeights.globalQualified;
126
+ case 'global-name':
127
+ // Reserved for Ring 3 byName global index. `lookupCore` today only
128
+ // emits `'global-qualified'` (via `lookupQualified`, dotted-name
129
+ // fallback); no code path constructs `origin: 'global-name'` yet.
130
+ // Kept here so the Appendix A weight stays live and `composeEvidence`
131
+ // remains exhaustive over the origin union.
132
+ return EvidenceWeights.globalName;
133
+ }
134
+ }
135
+ function whereFoundEvidenceKind(origin) {
136
+ switch (origin) {
137
+ case 'local':
138
+ return 'local';
139
+ case 'import':
140
+ case 'reexport':
141
+ case 'namespace':
142
+ case 'wildcard':
143
+ return 'import';
144
+ case 'global-qualified':
145
+ return 'global-qualified';
146
+ case 'global-name':
147
+ return 'global-name';
148
+ }
149
+ }
150
+ //# sourceMappingURL=evidence.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evidence.js","sourceRoot":"","sources":["../../../src/scope-resolution/registries/evidence.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * `FieldRegistry` — scope-aware lookup for field / property / variable
3
+ * access (RFC §4.4; Ring 2 SHARED #917).
4
+ *
5
+ * Thin wrapper over `lookupCore`, specialized for data-member kinds:
6
+ *
7
+ * - `acceptedKinds` = Variable / Property / Const / Static.
8
+ * - `useReceiverTypeBinding` is **true** — fields are resolved against
9
+ * the receiver type's MRO first, then via the lexical chain for
10
+ * free variables.
11
+ * - `callsite` is not meaningful for field access (no arity), but the
12
+ * `explicitReceiver` and `ownerScopedContributor` knobs are.
13
+ */
14
+ import type { Resolution, ScopeId } from '../types.js';
15
+ import type { OwnerScopedContributor, RegistryContext } from './context.js';
16
+ export interface FieldLookupOptions {
17
+ readonly explicitReceiver?: {
18
+ readonly name: string;
19
+ };
20
+ readonly ownerScopedContributor?: OwnerScopedContributor;
21
+ }
22
+ export interface FieldRegistry {
23
+ lookup(name: string, scope: ScopeId, options?: FieldLookupOptions): readonly Resolution[];
24
+ }
25
+ export declare function buildFieldRegistry(ctx: RegistryContext): FieldRegistry;
26
+ //# sourceMappingURL=field-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field-registry.d.ts","sourceRoot":"","sources":["../../../src/scope-resolution/registries/field-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEvD,OAAO,KAAK,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAG5E,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,gBAAgB,CAAC,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IACtD,QAAQ,CAAC,sBAAsB,CAAC,EAAE,sBAAsB,CAAC;CAC1D;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,SAAS,UAAU,EAAE,CAAC;CAC3F;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,eAAe,GAAG,aAAa,CActE"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * `FieldRegistry` — scope-aware lookup for field / property / variable
3
+ * access (RFC §4.4; Ring 2 SHARED #917).
4
+ *
5
+ * Thin wrapper over `lookupCore`, specialized for data-member kinds:
6
+ *
7
+ * - `acceptedKinds` = Variable / Property / Const / Static.
8
+ * - `useReceiverTypeBinding` is **true** — fields are resolved against
9
+ * the receiver type's MRO first, then via the lexical chain for
10
+ * free variables.
11
+ * - `callsite` is not meaningful for field access (no arity), but the
12
+ * `explicitReceiver` and `ownerScopedContributor` knobs are.
13
+ */
14
+ import { lookupCore } from './lookup-core.js';
15
+ import { FIELD_KINDS } from './context.js';
16
+ export function buildFieldRegistry(ctx) {
17
+ return {
18
+ lookup(name, scope, options = {}) {
19
+ const params = {
20
+ acceptedKinds: FIELD_KINDS,
21
+ useReceiverTypeBinding: true,
22
+ ownerScopedContributor: options.ownerScopedContributor ?? null,
23
+ ...(options.explicitReceiver !== undefined
24
+ ? { explicitReceiver: options.explicitReceiver }
25
+ : {}),
26
+ };
27
+ return lookupCore(name, scope, params, ctx);
28
+ },
29
+ };
30
+ }
31
+ //# sourceMappingURL=field-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field-registry.js","sourceRoot":"","sources":["../../../src/scope-resolution/registries/field-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAAE,UAAU,EAAyB,MAAM,kBAAkB,CAAC;AAErE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAW3C,MAAM,UAAU,kBAAkB,CAAC,GAAoB;IACrD,OAAO;QACL,MAAM,CAAC,IAAY,EAAE,KAAc,EAAE,UAA8B,EAAE;YACnE,MAAM,MAAM,GAAqB;gBAC/B,aAAa,EAAE,WAAW;gBAC1B,sBAAsB,EAAE,IAAI;gBAC5B,sBAAsB,EAAE,OAAO,CAAC,sBAAsB,IAAI,IAAI;gBAC9D,GAAG,CAAC,OAAO,CAAC,gBAAgB,KAAK,SAAS;oBACxC,CAAC,CAAC,EAAE,gBAAgB,EAAE,OAAO,CAAC,gBAAgB,EAAE;oBAChD,CAAC,CAAC,EAAE,CAAC;aACR,CAAC;YACF,OAAO,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC;QAC9C,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,81 @@
1
+ /**
2
+ * `lookupCore` — the shared 7-step canonical resolution algorithm
3
+ * (RFC §4.2; Ring 2 SHARED #917).
4
+ *
5
+ * Pure function. Given a name, a starting scope, and per-kind parameters,
6
+ * walks lexical scopes + optional type-binding MRO + optional owner
7
+ * contributor + global qualified-name fallback, and returns a ranked
8
+ * `Resolution[]` with per-candidate evidence.
9
+ *
10
+ * All three public registries (`ClassRegistry` / `MethodRegistry` /
11
+ * `FieldRegistry`) dispatch into this function, differing only in the
12
+ * parameters they pass. The CHOICE of which steps fire is expressed
13
+ * through `LookupParams`, not through different algorithms per kind.
14
+ *
15
+ * ## Algorithm (RFC §4.2, verbatim names)
16
+ *
17
+ * **Step 1 — Lexical scope-chain walk.** From `startScope`, walk
18
+ * parent-ward. At each scope, consult `scope.bindings.get(name)`:
19
+ * - Filter candidates whose `def.type ∈ acceptedKinds`.
20
+ * - For each surviving candidate, record a raw signal with the
21
+ * binding's origin + the current scope-chain depth.
22
+ * - **Hard shadow.** If `bindings.get(name)` is non-empty (including
23
+ * non-kind-matching candidates), stop walking. The name is
24
+ * lexically bound here; outer scopes are not consulted.
25
+ *
26
+ * **Step 2 — Type-binding resolution.** When `useReceiverTypeBinding`
27
+ * is true, resolve the receiver's type at `startScope` (from
28
+ * `scope.typeBindings`), then walk the MRO via
29
+ * `MethodDispatchIndex.mroFor(ownerDefId)`. Membership per owner comes
30
+ * through `RegistryContext.methodDispatch` + owner lookups into
31
+ * `scope.ownedDefs`; each hit records a raw signal with the owner's
32
+ * MRO depth.
33
+ *
34
+ * **Step 3 — Owner-scoped contributor.** When
35
+ * `params.ownerScopedContributor` is present, merge its `byName(name)`
36
+ * hits with `origin: 'local'` (they are declared directly on the
37
+ * receiver). Distinct from Step 2 — Step 2 walks the MRO; Step 3 only
38
+ * looks at the directly-declared owner members.
39
+ *
40
+ * **Step 4 — Kind filter (emit `kind-match` evidence).** Already
41
+ * applied during Steps 1-3; this step just adds a `kind-match` signal
42
+ * at weight 0 to every candidate for debuggability (so the evidence
43
+ * array is self-describing).
44
+ *
45
+ * **Step 5 — Arity filter.** Call `providers.arityCompatibility(callsite,
46
+ * def)` per surviving candidate. Verdicts: `compatible` / `unknown` /
47
+ * `incompatible`. If at least one candidate is `compatible`, drop
48
+ * `incompatible` ones. Otherwise keep all (the penalty weight alone
49
+ * will rank them lower but they remain in the result).
50
+ *
51
+ * **Step 6 — Global fallback.** When Steps 1-3 produced **no**
52
+ * candidates and the name contains a `.`, consult the
53
+ * `QualifiedNameIndex` via `lookupQualified` — see §4.5. The `scope`
54
+ * argument is NOT passed here because global lookup is scope-agnostic.
55
+ *
56
+ * **Step 7 — Rank + tie-break.** Compose evidence, compute confidence
57
+ * (sum capped at 1.0), sort by the RFC Appendix B cascade.
58
+ *
59
+ * ## What this module does NOT do
60
+ *
61
+ * - No AST reads (pure data in, pure data out).
62
+ * - No `gitnexus/` imports.
63
+ * - No language switches. Language-specific behavior flows exclusively
64
+ * through `providers.*` and the `params` object.
65
+ * - No caching. Callers that want memoization can wrap this function.
66
+ */
67
+ import type { Callsite, LookupParams, Resolution, ScopeId } from '../types.js';
68
+ import type { OwnerScopedContributor, RegistryContext } from './context.js';
69
+ /** Extended `LookupParams` narrowing `ownerScopedContributor` to the concrete shape. */
70
+ export interface CoreLookupParams extends Omit<LookupParams, 'ownerScopedContributor'> {
71
+ readonly ownerScopedContributor: OwnerScopedContributor | null;
72
+ /** Call-site description forwarded to `arityCompatibility`. Optional — for non-call lookups. */
73
+ readonly callsite?: Callsite;
74
+ }
75
+ /**
76
+ * Run the 7-step lookup. Returns a non-empty `Resolution[]` when any
77
+ * candidate was found; an empty array otherwise. Callers consume `[0]`
78
+ * for the best answer and optionally inspect the rest for alternates.
79
+ */
80
+ export declare function lookupCore(name: string, startScope: ScopeId, params: CoreLookupParams, ctx: RegistryContext): readonly Resolution[];
81
+ //# sourceMappingURL=lookup-core.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lookup-core.d.ts","sourceRoot":"","sources":["../../../src/scope-resolution/registries/lookup-core.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiEG;AAIH,OAAO,KAAK,EAEV,QAAQ,EAER,YAAY,EACZ,UAAU,EAEV,OAAO,EACR,MAAM,aAAa,CAAC;AAKrB,OAAO,KAAK,EAAgB,sBAAsB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAI1F,wFAAwF;AACxF,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,YAAY,EAAE,wBAAwB,CAAC;IACpF,QAAQ,CAAC,sBAAsB,EAAE,sBAAsB,GAAG,IAAI,CAAC;IAC/D,gGAAgG;IAChG,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC;CAC9B;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CACxB,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,OAAO,EACnB,MAAM,EAAE,gBAAgB,EACxB,GAAG,EAAE,eAAe,GACnB,SAAS,UAAU,EAAE,CAwCvB"}