gitnexus 1.6.3-rc.3 → 1.6.3-rc.31

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 (166) hide show
  1. package/dist/_shared/graph/types.d.ts +16 -0
  2. package/dist/_shared/graph/types.d.ts.map +1 -1
  3. package/dist/_shared/index.d.ts +41 -1
  4. package/dist/_shared/index.d.ts.map +1 -1
  5. package/dist/_shared/index.js +28 -0
  6. package/dist/_shared/index.js.map +1 -1
  7. package/dist/_shared/scope-resolution/def-index.d.ts +36 -0
  8. package/dist/_shared/scope-resolution/def-index.d.ts.map +1 -0
  9. package/dist/_shared/scope-resolution/def-index.js +51 -0
  10. package/dist/_shared/scope-resolution/def-index.js.map +1 -0
  11. package/dist/_shared/scope-resolution/finalize-algorithm.d.ts +139 -0
  12. package/dist/_shared/scope-resolution/finalize-algorithm.d.ts.map +1 -0
  13. package/dist/_shared/scope-resolution/finalize-algorithm.js +479 -0
  14. package/dist/_shared/scope-resolution/finalize-algorithm.js.map +1 -0
  15. package/dist/_shared/scope-resolution/method-dispatch-index.d.ts +80 -0
  16. package/dist/_shared/scope-resolution/method-dispatch-index.d.ts.map +1 -0
  17. package/dist/_shared/scope-resolution/method-dispatch-index.js +79 -0
  18. package/dist/_shared/scope-resolution/method-dispatch-index.js.map +1 -0
  19. package/dist/_shared/scope-resolution/module-scope-index.d.ts +46 -0
  20. package/dist/_shared/scope-resolution/module-scope-index.d.ts.map +1 -0
  21. package/dist/_shared/scope-resolution/module-scope-index.js +58 -0
  22. package/dist/_shared/scope-resolution/module-scope-index.js.map +1 -0
  23. package/dist/_shared/scope-resolution/parsed-file.d.ts +64 -0
  24. package/dist/_shared/scope-resolution/parsed-file.d.ts.map +1 -0
  25. package/dist/_shared/scope-resolution/parsed-file.js +42 -0
  26. package/dist/_shared/scope-resolution/parsed-file.js.map +1 -0
  27. package/dist/_shared/scope-resolution/position-index.d.ts +62 -0
  28. package/dist/_shared/scope-resolution/position-index.d.ts.map +1 -0
  29. package/dist/_shared/scope-resolution/position-index.js +134 -0
  30. package/dist/_shared/scope-resolution/position-index.js.map +1 -0
  31. package/dist/_shared/scope-resolution/qualified-name-index.d.ts +44 -0
  32. package/dist/_shared/scope-resolution/qualified-name-index.d.ts.map +1 -0
  33. package/dist/_shared/scope-resolution/qualified-name-index.js +75 -0
  34. package/dist/_shared/scope-resolution/qualified-name-index.js.map +1 -0
  35. package/dist/_shared/scope-resolution/reference-site.d.ts +67 -0
  36. package/dist/_shared/scope-resolution/reference-site.d.ts.map +1 -0
  37. package/dist/_shared/scope-resolution/reference-site.js +24 -0
  38. package/dist/_shared/scope-resolution/reference-site.js.map +1 -0
  39. package/dist/_shared/scope-resolution/registries/class-registry.d.ts +27 -0
  40. package/dist/_shared/scope-resolution/registries/class-registry.d.ts.map +1 -0
  41. package/dist/_shared/scope-resolution/registries/class-registry.js +30 -0
  42. package/dist/_shared/scope-resolution/registries/class-registry.js.map +1 -0
  43. package/dist/_shared/scope-resolution/registries/context.d.ts +69 -0
  44. package/dist/_shared/scope-resolution/registries/context.d.ts.map +1 -0
  45. package/dist/_shared/scope-resolution/registries/context.js +44 -0
  46. package/dist/_shared/scope-resolution/registries/context.js.map +1 -0
  47. package/dist/_shared/scope-resolution/registries/evidence.d.ts +56 -0
  48. package/dist/_shared/scope-resolution/registries/evidence.d.ts.map +1 -0
  49. package/dist/_shared/scope-resolution/registries/evidence.js +150 -0
  50. package/dist/_shared/scope-resolution/registries/evidence.js.map +1 -0
  51. package/dist/_shared/scope-resolution/registries/field-registry.d.ts +26 -0
  52. package/dist/_shared/scope-resolution/registries/field-registry.d.ts.map +1 -0
  53. package/dist/_shared/scope-resolution/registries/field-registry.js +31 -0
  54. package/dist/_shared/scope-resolution/registries/field-registry.js.map +1 -0
  55. package/dist/_shared/scope-resolution/registries/lookup-core.d.ts +81 -0
  56. package/dist/_shared/scope-resolution/registries/lookup-core.d.ts.map +1 -0
  57. package/dist/_shared/scope-resolution/registries/lookup-core.js +332 -0
  58. package/dist/_shared/scope-resolution/registries/lookup-core.js.map +1 -0
  59. package/dist/_shared/scope-resolution/registries/lookup-qualified.d.ts +33 -0
  60. package/dist/_shared/scope-resolution/registries/lookup-qualified.d.ts.map +1 -0
  61. package/dist/_shared/scope-resolution/registries/lookup-qualified.js +56 -0
  62. package/dist/_shared/scope-resolution/registries/lookup-qualified.js.map +1 -0
  63. package/dist/_shared/scope-resolution/registries/method-registry.d.ts +36 -0
  64. package/dist/_shared/scope-resolution/registries/method-registry.d.ts.map +1 -0
  65. package/dist/_shared/scope-resolution/registries/method-registry.js +32 -0
  66. package/dist/_shared/scope-resolution/registries/method-registry.js.map +1 -0
  67. package/dist/_shared/scope-resolution/registries/tie-breaks.d.ts +43 -0
  68. package/dist/_shared/scope-resolution/registries/tie-breaks.d.ts.map +1 -0
  69. package/dist/_shared/scope-resolution/registries/tie-breaks.js +60 -0
  70. package/dist/_shared/scope-resolution/registries/tie-breaks.js.map +1 -0
  71. package/dist/_shared/scope-resolution/resolve-type-ref.d.ts +53 -0
  72. package/dist/_shared/scope-resolution/resolve-type-ref.d.ts.map +1 -0
  73. package/dist/_shared/scope-resolution/resolve-type-ref.js +126 -0
  74. package/dist/_shared/scope-resolution/resolve-type-ref.js.map +1 -0
  75. package/dist/_shared/scope-resolution/scope-id.d.ts +43 -0
  76. package/dist/_shared/scope-resolution/scope-id.d.ts.map +1 -0
  77. package/dist/_shared/scope-resolution/scope-id.js +46 -0
  78. package/dist/_shared/scope-resolution/scope-id.js.map +1 -0
  79. package/dist/_shared/scope-resolution/scope-tree.d.ts +61 -0
  80. package/dist/_shared/scope-resolution/scope-tree.d.ts.map +1 -0
  81. package/dist/_shared/scope-resolution/scope-tree.js +186 -0
  82. package/dist/_shared/scope-resolution/scope-tree.js.map +1 -0
  83. package/dist/_shared/scope-resolution/shadow/aggregate.d.ts +63 -0
  84. package/dist/_shared/scope-resolution/shadow/aggregate.d.ts.map +1 -0
  85. package/dist/_shared/scope-resolution/shadow/aggregate.js +122 -0
  86. package/dist/_shared/scope-resolution/shadow/aggregate.js.map +1 -0
  87. package/dist/_shared/scope-resolution/shadow/diff.d.ts +59 -0
  88. package/dist/_shared/scope-resolution/shadow/diff.d.ts.map +1 -0
  89. package/dist/_shared/scope-resolution/shadow/diff.js +79 -0
  90. package/dist/_shared/scope-resolution/shadow/diff.js.map +1 -0
  91. package/dist/_shared/scope-resolution/types.d.ts +24 -4
  92. package/dist/_shared/scope-resolution/types.d.ts.map +1 -1
  93. package/dist/cli/ai-context.js +1 -1
  94. package/dist/cli/analyze.d.ts +15 -0
  95. package/dist/cli/analyze.js +22 -1
  96. package/dist/cli/clean.js +19 -1
  97. package/dist/cli/group.js +73 -0
  98. package/dist/cli/index.js +18 -0
  99. package/dist/cli/list.js +11 -1
  100. package/dist/cli/remove.d.ts +30 -0
  101. package/dist/cli/remove.js +99 -0
  102. package/dist/cli/tool.d.ts +5 -0
  103. package/dist/cli/tool.js +42 -0
  104. package/dist/core/embeddings/ast-utils.js +22 -22
  105. package/dist/core/embeddings/chunker.js +30 -25
  106. package/dist/core/embeddings/embedding-pipeline.d.ts +6 -0
  107. package/dist/core/embeddings/embedding-pipeline.js +15 -6
  108. package/dist/core/embeddings/text-generator.d.ts +1 -1
  109. package/dist/core/embeddings/text-generator.js +33 -24
  110. package/dist/core/embeddings/types.d.ts +43 -1
  111. package/dist/core/embeddings/types.js +101 -29
  112. package/dist/core/group/cross-impact.d.ts +41 -0
  113. package/dist/core/group/cross-impact.js +443 -0
  114. package/dist/core/group/extractors/http-patterns/php.js +126 -18
  115. package/dist/core/group/group-path-utils.d.ts +17 -0
  116. package/dist/core/group/group-path-utils.js +40 -0
  117. package/dist/core/group/resolve-at-member.d.ts +10 -0
  118. package/dist/core/group/resolve-at-member.js +31 -0
  119. package/dist/core/group/service.d.ts +9 -0
  120. package/dist/core/group/service.js +219 -20
  121. package/dist/core/group/types.d.ts +30 -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/finalize-orchestrator.d.ts +63 -0
  125. package/dist/core/ingestion/finalize-orchestrator.js +139 -0
  126. package/dist/core/ingestion/framework-detection.js +6 -2
  127. package/dist/core/ingestion/import-target-adapter.d.ts +73 -0
  128. package/dist/core/ingestion/import-target-adapter.js +95 -0
  129. package/dist/core/ingestion/language-provider.d.ts +24 -9
  130. package/dist/core/ingestion/model/scope-resolution-indexes.d.ts +59 -0
  131. package/dist/core/ingestion/model/scope-resolution-indexes.js +42 -0
  132. package/dist/core/ingestion/model/semantic-model.d.ts +25 -0
  133. package/dist/core/ingestion/model/semantic-model.js +16 -0
  134. package/dist/core/ingestion/parsing-processor.d.ts +9 -0
  135. package/dist/core/ingestion/parsing-processor.js +10 -0
  136. package/dist/core/ingestion/registry-primary-flag.d.ts +59 -0
  137. package/dist/core/ingestion/registry-primary-flag.js +78 -0
  138. package/dist/core/ingestion/scope-extractor-bridge.d.ts +32 -0
  139. package/dist/core/ingestion/scope-extractor-bridge.js +44 -0
  140. package/dist/core/ingestion/scope-extractor.d.ts +87 -0
  141. package/dist/core/ingestion/scope-extractor.js +603 -0
  142. package/dist/core/ingestion/shadow-harness.d.ts +113 -0
  143. package/dist/core/ingestion/shadow-harness.js +148 -0
  144. package/dist/core/ingestion/workers/parse-worker.d.ts +9 -0
  145. package/dist/core/ingestion/workers/parse-worker.js +20 -1
  146. package/dist/core/lbug/lbug-adapter.d.ts +12 -0
  147. package/dist/core/lbug/lbug-adapter.js +30 -0
  148. package/dist/core/lbug/pool-adapter.d.ts +17 -0
  149. package/dist/core/lbug/pool-adapter.js +21 -0
  150. package/dist/core/run-analyze.d.ts +21 -0
  151. package/dist/core/run-analyze.js +22 -16
  152. package/dist/core/search/bm25-index.d.ts +18 -0
  153. package/dist/core/search/bm25-index.js +125 -12
  154. package/dist/core/search/phase-timer.d.ts +72 -0
  155. package/dist/core/search/phase-timer.js +106 -0
  156. package/dist/mcp/local/local-backend.d.ts +18 -3
  157. package/dist/mcp/local/local-backend.js +227 -29
  158. package/dist/mcp/resources.d.ts +31 -0
  159. package/dist/mcp/resources.js +100 -17
  160. package/dist/mcp/tools.d.ts +4 -1
  161. package/dist/mcp/tools.js +75 -54
  162. package/dist/storage/git.d.ts +25 -0
  163. package/dist/storage/git.js +52 -0
  164. package/dist/storage/repo-manager.d.ts +203 -1
  165. package/dist/storage/repo-manager.js +355 -9
  166. package/package.json +4 -4
@@ -61,5 +61,21 @@ export interface GraphRelationship {
61
61
  confidence: number;
62
62
  reason: string;
63
63
  step?: number;
64
+ /**
65
+ * Per-signal evidence trace for edges emitted by the scope-based
66
+ * resolution pipeline (RFC #909 Ring 2 PKG #925). Populated by
67
+ * `emit-references.ts` when draining `ReferenceIndex` into the graph
68
+ * so downstream query / audit tools can inspect *why* a given edge
69
+ * was emitted with its confidence value.
70
+ *
71
+ * Optional and additive — every existing edge emitter ignores this
72
+ * field, and every existing query continues to work whether or not
73
+ * an edge carries it.
74
+ */
75
+ evidence?: readonly {
76
+ readonly kind: string;
77
+ readonly weight: number;
78
+ readonly note?: string;
79
+ }[];
64
80
  }
65
81
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/graph/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD,MAAM,MAAM,SAAS,GACjB,SAAS,GACT,SAAS,GACT,QAAQ,GACR,QAAQ,GACR,MAAM,GACN,OAAO,GACP,UAAU,GACV,QAAQ,GACR,UAAU,GACV,WAAW,GACX,MAAM,GACN,WAAW,GACX,QAAQ,GACR,MAAM,GACN,aAAa,GACb,WAAW,GACX,SAAS,GAET,QAAQ,GACR,OAAO,GACP,SAAS,GACT,OAAO,GACP,WAAW,GACX,OAAO,GACP,MAAM,GACN,WAAW,GACX,OAAO,GACP,QAAQ,GACR,UAAU,GACV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E,MAAM,CAAC;IACjB,IAAI,EAAE,gBAAgB,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,EAAE,SAAS;QAClB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;KACxB,EAAE,CAAC;CACL"}
@@ -6,10 +6,50 @@ export { getLanguageFromFilename, getSyntaxLanguageFromFilename } from './langua
6
6
  export type { MroStrategy } from './mro-strategy.js';
7
7
  export type { PipelinePhase, PipelineProgress } from './pipeline.js';
8
8
  export type { SymbolDefinition } from './scope-resolution/symbol-definition.js';
9
- export type { ScopeId, DefId, ScopeKind, Range, Capture, CaptureMatch, BindingRef, ImportEdge, TypeRef, Scope, ResolutionEvidence, Resolution, Reference, ReferenceIndex, LookupParams, RegistryContributor, ParsedImport, ParsedTypeBinding, WorkspaceIndex, ScopeTree, Callsite, } from './scope-resolution/types.js';
9
+ export type { ScopeId, DefId, ScopeKind, Range, Capture, CaptureMatch, BindingRef, ImportEdge, TypeRef, Scope, ResolutionEvidence, Resolution, Reference, ReferenceIndex, LookupParams, RegistryContributor, ParsedImport, ParsedTypeBinding, WorkspaceIndex, Callsite, ScopeLookup, } from './scope-resolution/types.js';
10
10
  export { EvidenceWeights, typeBindingWeightAtDepth } from './scope-resolution/evidence-weights.js';
11
11
  export { ORIGIN_PRIORITY } from './scope-resolution/origin-priority.js';
12
12
  export type { OriginForTieBreak } from './scope-resolution/origin-priority.js';
13
13
  export { LanguageClassifications, isProductionLanguage, } from './scope-resolution/language-classification.js';
14
14
  export type { LanguageClassification } from './scope-resolution/language-classification.js';
15
+ export { buildDefIndex } from './scope-resolution/def-index.js';
16
+ export type { DefIndex } from './scope-resolution/def-index.js';
17
+ export { buildModuleScopeIndex } from './scope-resolution/module-scope-index.js';
18
+ export type { ModuleScopeIndex, ModuleScopeEntry } from './scope-resolution/module-scope-index.js';
19
+ export { buildQualifiedNameIndex } from './scope-resolution/qualified-name-index.js';
20
+ export type { QualifiedNameIndex } from './scope-resolution/qualified-name-index.js';
21
+ export { resolveTypeRef } from './scope-resolution/resolve-type-ref.js';
22
+ export type { ResolveTypeRefContext } from './scope-resolution/resolve-type-ref.js';
23
+ export type { ParsedFile } from './scope-resolution/parsed-file.js';
24
+ export type { ReferenceSite, ReferenceKind, CallForm } from './scope-resolution/reference-site.js';
25
+ export { buildMethodDispatchIndex } from './scope-resolution/method-dispatch-index.js';
26
+ export type { MethodDispatchIndex, MethodDispatchInput, } from './scope-resolution/method-dispatch-index.js';
27
+ export { finalize } from './scope-resolution/finalize-algorithm.js';
28
+ export type { FinalizeInput, FinalizeFile, FinalizeHooks, FinalizeOutput, FinalizedScc, FinalizeStats, } from './scope-resolution/finalize-algorithm.js';
29
+ export { buildClassRegistry } from './scope-resolution/registries/class-registry.js';
30
+ export type { ClassRegistry } from './scope-resolution/registries/class-registry.js';
31
+ export { buildMethodRegistry } from './scope-resolution/registries/method-registry.js';
32
+ export type { MethodRegistry, MethodLookupOptions, } from './scope-resolution/registries/method-registry.js';
33
+ export { buildFieldRegistry } from './scope-resolution/registries/field-registry.js';
34
+ export type { FieldRegistry, FieldLookupOptions, } from './scope-resolution/registries/field-registry.js';
35
+ export { lookupCore } from './scope-resolution/registries/lookup-core.js';
36
+ export type { CoreLookupParams } from './scope-resolution/registries/lookup-core.js';
37
+ export { lookupQualified } from './scope-resolution/registries/lookup-qualified.js';
38
+ export type { LookupQualifiedParams } from './scope-resolution/registries/lookup-qualified.js';
39
+ export { composeEvidence, confidenceFromEvidence } from './scope-resolution/registries/evidence.js';
40
+ export type { RawSignals } from './scope-resolution/registries/evidence.js';
41
+ export { compareByConfidenceWithTiebreaks, CONFIDENCE_EPSILON, } from './scope-resolution/registries/tie-breaks.js';
42
+ export type { TieBreakKey } from './scope-resolution/registries/tie-breaks.js';
43
+ export { CLASS_KINDS, METHOD_KINDS, FIELD_KINDS } from './scope-resolution/registries/context.js';
44
+ export type { RegistryContext, RegistryProviders, OwnerScopedContributor, ArityVerdict, } from './scope-resolution/registries/context.js';
45
+ export { makeScopeId, clearScopeIdInternPool } from './scope-resolution/scope-id.js';
46
+ export type { ScopeIdInput } from './scope-resolution/scope-id.js';
47
+ export { buildScopeTree, ScopeTreeInvariantError } from './scope-resolution/scope-tree.js';
48
+ export type { ScopeTree } from './scope-resolution/scope-tree.js';
49
+ export { buildPositionIndex } from './scope-resolution/position-index.js';
50
+ export type { PositionIndex } from './scope-resolution/position-index.js';
51
+ export { diffResolutions } from './scope-resolution/shadow/diff.js';
52
+ export type { ShadowAgreement, ShadowCallsite, ShadowDiff, } from './scope-resolution/shadow/diff.js';
53
+ export { aggregateDiffs } from './scope-resolution/shadow/aggregate.js';
54
+ export type { LanguageParityRow, ShadowParityReport } from './scope-resolution/shadow/aggregate.js';
15
55
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,SAAS,EACT,cAAc,EACd,gBAAgB,EAChB,SAAS,EACT,iBAAiB,GAClB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,WAAW,EACX,cAAc,EACd,SAAS,EACT,oBAAoB,GACrB,MAAM,4BAA4B,CAAC;AACpC,YAAY,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAGzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,6BAA6B,EAAE,MAAM,yBAAyB,CAAC;AACjG,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AA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AACnE,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAC3F,YAAY,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAC1E,YAAY,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAG1E,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,YAAY,EACV,eAAe,EACf,cAAc,EACd,UAAU,GACX,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AACxE,YAAY,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC"}
@@ -8,4 +8,32 @@ export { EvidenceWeights, typeBindingWeightAtDepth } from './scope-resolution/ev
8
8
  export { ORIGIN_PRIORITY } from './scope-resolution/origin-priority.js';
9
9
  // Language classification (RFC §6.1 Ring 3/4 governance)
10
10
  export { LanguageClassifications, isProductionLanguage, } from './scope-resolution/language-classification.js';
11
+ // Core indexes over per-file artifacts (RFC §3.1; Ring 2 SHARED #913)
12
+ export { buildDefIndex } from './scope-resolution/def-index.js';
13
+ export { buildModuleScopeIndex } from './scope-resolution/module-scope-index.js';
14
+ export { buildQualifiedNameIndex } from './scope-resolution/qualified-name-index.js';
15
+ // Strict type-reference resolver (RFC §4.6; Ring 2 SHARED #916)
16
+ // `ScopeLookup` is defined in `./scope-resolution/types.js` and exported
17
+ // from the type-export block above — not from this module.
18
+ export { resolveTypeRef } from './scope-resolution/resolve-type-ref.js';
19
+ // Method-dispatch materialized view over HeritageMap (RFC §3.1; Ring 2 SHARED #914)
20
+ export { buildMethodDispatchIndex } from './scope-resolution/method-dispatch-index.js';
21
+ // SCC-aware cross-file finalize (RFC §3.2 Phase 2; Ring 2 SHARED #915)
22
+ export { finalize } from './scope-resolution/finalize-algorithm.js';
23
+ // Scope-aware registries + 7-step lookup (RFC §4; Ring 2 SHARED #917)
24
+ export { buildClassRegistry } from './scope-resolution/registries/class-registry.js';
25
+ export { buildMethodRegistry } from './scope-resolution/registries/method-registry.js';
26
+ export { buildFieldRegistry } from './scope-resolution/registries/field-registry.js';
27
+ export { lookupCore } from './scope-resolution/registries/lookup-core.js';
28
+ export { lookupQualified } from './scope-resolution/registries/lookup-qualified.js';
29
+ export { composeEvidence, confidenceFromEvidence } from './scope-resolution/registries/evidence.js';
30
+ export { compareByConfidenceWithTiebreaks, CONFIDENCE_EPSILON, } from './scope-resolution/registries/tie-breaks.js';
31
+ export { CLASS_KINDS, METHOD_KINDS, FIELD_KINDS } from './scope-resolution/registries/context.js';
32
+ // Scope tree spine + position lookup (RFC §2.2 + §3.1; Ring 2 SHARED #912)
33
+ export { makeScopeId, clearScopeIdInternPool } from './scope-resolution/scope-id.js';
34
+ export { buildScopeTree, ScopeTreeInvariantError } from './scope-resolution/scope-tree.js';
35
+ export { buildPositionIndex } from './scope-resolution/position-index.js';
36
+ // Shadow-mode diff + aggregation (RFC §6.3; Ring 2 SHARED #918)
37
+ export { diffResolutions } from './scope-resolution/shadow/diff.js';
38
+ export { aggregateDiffs } from './scope-resolution/shadow/aggregate.js';
11
39
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AASA,mBAAmB;AACnB,OAAO,EACL,WAAW,EACX,cAAc,EACd,SAAS,EACT,oBAAoB,GACrB,MAAM,4BAA4B,CAAC;AAGpC,mBAAmB;AACnB,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,6BAA6B,EAAE,MAAM,yBAAyB,CAAC;AAiCjG,8DAA8D;AAC9D,OAAO,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AACnG,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAGxE,yDAAyD;AACzD,O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AAE,MAAM,mDAAmD,CAAC;AAEpF,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,2CAA2C,CAAC;AAEpG,OAAO,EACL,gCAAgC,EAChC,kBAAkB,GACnB,MAAM,6CAA6C,CAAC;AAErD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AAQlG,2EAA2E;AAC3E,OAAO,EAAE,WAAW,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAErF,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAE3F,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAG1E,gEAAgE;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAMpE,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * `DefIndex` — O(1) `DefId → SymbolDefinition` materialization.
3
+ *
4
+ * The global "what is this id?" lookup. Every per-kind registry (ClassRegistry,
5
+ * MethodRegistry, FieldRegistry) returns `DefId[]` and resolves them back to
6
+ * full `SymbolDefinition` records through this index — one central hash map,
7
+ * one allocation per def.
8
+ *
9
+ * Part of RFC #909 Ring 2 SHARED — #913.
10
+ *
11
+ * Consumed by: #917 (`Registry.lookup` implementations), #915 (SCC finalize).
12
+ */
13
+ import type { SymbolDefinition } from './symbol-definition.js';
14
+ import type { DefId } from './types.js';
15
+ export interface DefIndex {
16
+ readonly byId: ReadonlyMap<DefId, SymbolDefinition>;
17
+ readonly size: number;
18
+ get(id: DefId): SymbolDefinition | undefined;
19
+ has(id: DefId): boolean;
20
+ }
21
+ /**
22
+ * Build a `DefIndex` from a flat list of `SymbolDefinition` records.
23
+ *
24
+ * **Collision policy: first-write-wins.** `DefId` is meant to be unique
25
+ * (`nodeId` is the stable graph identifier), so a collision indicates an
26
+ * upstream bug — most likely the same symbol parsed twice or a duplicate
27
+ * commit into the pipeline. Rather than silently overwriting with a later
28
+ * definition that may be partial or wrong, the first record wins and
29
+ * subsequent records for the same id are dropped. Pipeline bugs surface
30
+ * later as `has(id) === true` but the def looking older than expected,
31
+ * which is easier to debug than a silent overwrite.
32
+ *
33
+ * Pure function — safe to call repeatedly; no side effects.
34
+ */
35
+ export declare function buildDefIndex(defs: readonly SymbolDefinition[]): DefIndex;
36
+ //# sourceMappingURL=def-index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"def-index.d.ts","sourceRoot":"","sources":["../../src/scope-resolution/def-index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC;IACpD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,GAAG,CAAC,EAAE,EAAE,KAAK,GAAG,gBAAgB,GAAG,SAAS,CAAC;IAC7C,GAAG,CAAC,EAAE,EAAE,KAAK,GAAG,OAAO,CAAC;CACzB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,SAAS,gBAAgB,EAAE,GAAG,QAAQ,CAOzE"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * `DefIndex` — O(1) `DefId → SymbolDefinition` materialization.
3
+ *
4
+ * The global "what is this id?" lookup. Every per-kind registry (ClassRegistry,
5
+ * MethodRegistry, FieldRegistry) returns `DefId[]` and resolves them back to
6
+ * full `SymbolDefinition` records through this index — one central hash map,
7
+ * one allocation per def.
8
+ *
9
+ * Part of RFC #909 Ring 2 SHARED — #913.
10
+ *
11
+ * Consumed by: #917 (`Registry.lookup` implementations), #915 (SCC finalize).
12
+ */
13
+ /**
14
+ * Build a `DefIndex` from a flat list of `SymbolDefinition` records.
15
+ *
16
+ * **Collision policy: first-write-wins.** `DefId` is meant to be unique
17
+ * (`nodeId` is the stable graph identifier), so a collision indicates an
18
+ * upstream bug — most likely the same symbol parsed twice or a duplicate
19
+ * commit into the pipeline. Rather than silently overwriting with a later
20
+ * definition that may be partial or wrong, the first record wins and
21
+ * subsequent records for the same id are dropped. Pipeline bugs surface
22
+ * later as `has(id) === true` but the def looking older than expected,
23
+ * which is easier to debug than a silent overwrite.
24
+ *
25
+ * Pure function — safe to call repeatedly; no side effects.
26
+ */
27
+ export function buildDefIndex(defs) {
28
+ const byId = new Map();
29
+ for (const def of defs) {
30
+ if (byId.has(def.nodeId))
31
+ continue; // first-write-wins
32
+ byId.set(def.nodeId, def);
33
+ }
34
+ return wrapIndex(byId);
35
+ }
36
+ // ─── Internal ───────────────────────────────────────────────────────────────
37
+ function wrapIndex(byId) {
38
+ return {
39
+ byId,
40
+ get size() {
41
+ return byId.size;
42
+ },
43
+ get(id) {
44
+ return byId.get(id);
45
+ },
46
+ has(id) {
47
+ return byId.has(id);
48
+ },
49
+ };
50
+ }
51
+ //# sourceMappingURL=def-index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"def-index.js","sourceRoot":"","sources":["../../src/scope-resolution/def-index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAYH;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,aAAa,CAAC,IAAiC;IAC7D,MAAM,IAAI,GAAG,IAAI,GAAG,EAA2B,CAAC;IAChD,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC;YAAE,SAAS,CAAC,mBAAmB;QACvD,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5B,CAAC;IACD,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC;AAED,+EAA+E;AAE/E,SAAS,SAAS,CAAC,IAAkC;IACnD,OAAO;QACL,IAAI;QACJ,IAAI,IAAI;YACN,OAAO,IAAI,CAAC,IAAI,CAAC;QACnB,CAAC;QACD,GAAG,CAAC,EAAS;YACX,OAAO,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACtB,CAAC;QACD,GAAG,CAAC,EAAS;YACX,OAAO,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACtB,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,139 @@
1
+ /**
2
+ * `finalize` — cross-file finalize algorithm for the SemanticModel
3
+ * (RFC §3.2 Phase 2; Ring 2 SHARED #915).
4
+ *
5
+ * Pure logic that takes per-file parse output (`ParsedImport[]` +
6
+ * `SymbolDefinition[]`) and returns:
7
+ *
8
+ * - Linked `ImportEdge[]` per module scope, with `targetModuleScope` and
9
+ * `targetDefId` filled where resolvable; edges that could not be
10
+ * resolved within the hard fixpoint cap are marked
11
+ * `linkStatus: 'unresolved'`.
12
+ * - Materialized `bindings` per module scope — local defs merged with
13
+ * imported / wildcard-expanded / re-exported names via the provider's
14
+ * `mergeBindings` precedence.
15
+ * - The SCC condensation of the import graph, exposed so disjoint SCCs
16
+ * can be processed in parallel by callers that want that.
17
+ *
18
+ * The algorithm is **SCC-aware**: it runs Tarjan SCC over the file-level
19
+ * import graph, processes SCCs in reverse-topological order (leaves
20
+ * first), and within each SCC runs a bounded fixpoint link pass capped at
21
+ * `N = |edges in SCC|`. Cyclic imports finalize without hanging; malformed
22
+ * inputs are bounded by the cap.
23
+ *
24
+ * **No language-specific logic.** Target resolution, wildcard expansion,
25
+ * and binding precedence all go through caller-supplied hooks
26
+ * (`resolveImportTarget`, `expandsWildcardTo`, `mergeBindings`) that
27
+ * match the LanguageProvider surface from #911.
28
+ *
29
+ * **Dynamic imports rule.** `kind === 'dynamic-unresolved'` passes through
30
+ * as an `ImportEdge { kind: 'dynamic-unresolved', targetFile: null }`
31
+ * with no `BindingRef`. They are parse-time signals, not linkable targets.
32
+ */
33
+ import type { SymbolDefinition } from './symbol-definition.js';
34
+ import type { BindingRef, ImportEdge, ParsedImport, ScopeId, WorkspaceIndex } from './types.js';
35
+ /** Per-file input for the finalize pass. */
36
+ export interface FinalizeFile {
37
+ readonly filePath: string;
38
+ /** The module scope id for this file; owns the finalized imports + bindings. */
39
+ readonly moduleScope: ScopeId;
40
+ readonly parsedImports: readonly ParsedImport[];
41
+ /**
42
+ * Defs exported from this file — the "what other files can import by name"
43
+ * surface. Typically those with `isExported: true` (the module's own
44
+ * declarations) plus, for multi-hop re-export chains, the re-exported
45
+ * names the parser chose to surface here.
46
+ *
47
+ * **Multi-hop re-export contract.** `finalize` resolves an edge
48
+ * `A → B (importedName: 'X')` by looking up `X` in `B.localDefs`. If B
49
+ * only has `export { X } from './C'` and the parser *does not* include
50
+ * `X` in `B.localDefs`, A's edge hits the fixpoint cap and is marked
51
+ * `linkStatus: 'unresolved'`. The fixpoint does NOT mutate `localDefs`
52
+ * across iterations — it is static input.
53
+ *
54
+ * Parsers that want multi-hop re-export chains to settle end-to-end must
55
+ * include re-exported names in the intermediate file's `localDefs` (with
56
+ * the original `DefId` of the source symbol). This keeps the algorithm
57
+ * O(1) per lookup and avoids graph-crawl during finalize.
58
+ */
59
+ readonly localDefs: readonly SymbolDefinition[];
60
+ }
61
+ /** Input to `finalize`. */
62
+ export interface FinalizeInput {
63
+ readonly files: readonly FinalizeFile[];
64
+ /** Opaque workspace context forwarded to provider hooks. */
65
+ readonly workspaceIndex: WorkspaceIndex;
66
+ }
67
+ /**
68
+ * Provider-supplied hooks. Mirror the optional LanguageProvider scope-
69
+ * resolution hooks declared in #911; `finalize` calls them pure-ly and
70
+ * expects pure answers.
71
+ */
72
+ export interface FinalizeHooks {
73
+ /**
74
+ * Resolve a raw import target to the concrete file path that owns it.
75
+ * Return `null` when no target file is resolvable (e.g., `np.foo` when
76
+ * `numpy` is external to the workspace).
77
+ */
78
+ resolveImportTarget(targetRaw: string, fromFile: string, workspaceIndex: WorkspaceIndex): string | null;
79
+ /**
80
+ * For a wildcard `import * from M`, return the names visible in the
81
+ * exporting module scope `M`. The finalize pass looks each name up in
82
+ * `M`'s local defs to produce a concrete `BindingRef`; names with no
83
+ * matching export are dropped.
84
+ */
85
+ expandsWildcardTo(targetModuleScope: ScopeId, workspaceIndex: WorkspaceIndex): readonly string[];
86
+ /**
87
+ * Merge `incoming` bindings into `existing` for a given name. Called
88
+ * once per name at each scope. Typical rules:
89
+ * - Python: local > imported > wildcard (last-write-wins within tier).
90
+ * - Rust: explicit `use` > glob; `pub use` overrides.
91
+ * Return value replaces the bucket entirely — no implicit append.
92
+ */
93
+ mergeBindings(existing: readonly BindingRef[], incoming: readonly BindingRef[], scope: ScopeId): readonly BindingRef[];
94
+ }
95
+ /** One SCC in the file-level import graph. */
96
+ export interface FinalizedScc {
97
+ readonly files: readonly string[];
98
+ /** True iff this SCC has ≥ 2 files OR a single file that self-imports. */
99
+ readonly isCycle: boolean;
100
+ }
101
+ /**
102
+ * Counters reported by `finalize`.
103
+ *
104
+ * **Counting granularity** — all edge counters are **per-`ParsedImport`**,
105
+ * not per-materialized-`ImportEdge`. A single `wildcard` ParsedImport that
106
+ * expands to N exports counts as one linked edge in these stats; the
107
+ * materialized output (`FinalizeOutput.imports`) will have N edges for
108
+ * that input. `dynamic-unresolved` ParsedImports count as linked (they
109
+ * pass through with no `linkStatus`), so `linkedEdges` ≠ "has a
110
+ * BindingRef" — use the `bindings` map for that.
111
+ *
112
+ * In other words: `totalEdges === input.parsedImports.length` summed
113
+ * across files, and `linkedEdges + unresolvedEdges === totalEdges`.
114
+ */
115
+ export interface FinalizeStats {
116
+ readonly totalFiles: number;
117
+ /** Total `ParsedImport` records seen across all files. */
118
+ readonly totalEdges: number;
119
+ /**
120
+ * `ParsedImport`s whose finalized edge does NOT carry
121
+ * `linkStatus: 'unresolved'`. Includes `dynamic-unresolved` pass-throughs.
122
+ */
123
+ readonly linkedEdges: number;
124
+ /** `ParsedImport`s whose finalized edge carries `linkStatus: 'unresolved'`. */
125
+ readonly unresolvedEdges: number;
126
+ readonly sccCount: number;
127
+ readonly largestSccSize: number;
128
+ }
129
+ export interface FinalizeOutput {
130
+ /** Linked `ImportEdge[]` per module scope, in original input order. */
131
+ readonly imports: ReadonlyMap<ScopeId, readonly ImportEdge[]>;
132
+ /** Materialized bindings per module scope. */
133
+ readonly bindings: ReadonlyMap<ScopeId, ReadonlyMap<string, readonly BindingRef[]>>;
134
+ /** SCCs in reverse-topological order (leaves first). */
135
+ readonly sccs: readonly FinalizedScc[];
136
+ readonly stats: FinalizeStats;
137
+ }
138
+ export declare function finalize(input: FinalizeInput, hooks: FinalizeHooks): FinalizeOutput;
139
+ //# sourceMappingURL=finalize-algorithm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"finalize-algorithm.d.ts","sourceRoot":"","sources":["../../src/scope-resolution/finalize-algorithm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAIhG,4CAA4C;AAC5C,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,gFAAgF;IAChF,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,aAAa,EAAE,SAAS,YAAY,EAAE,CAAC;IAChD;;;;;;;;;;;;;;;;;OAiBG;IACH,QAAQ,CAAC,SAAS,EAAE,SAAS,gBAAgB,EAAE,CAAC;CACjD;AAED,2BAA2B;AAC3B,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,EAAE,SAAS,YAAY,EAAE,CAAC;IACxC,4DAA4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