gitnexus 1.6.2-rc.9 → 1.6.2

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 (220) hide show
  1. package/dist/_shared/lbug/schema-constants.d.ts +1 -1
  2. package/dist/_shared/lbug/schema-constants.d.ts.map +1 -1
  3. package/dist/_shared/lbug/schema-constants.js +1 -0
  4. package/dist/_shared/lbug/schema-constants.js.map +1 -1
  5. package/dist/_shared/mro-strategy.d.ts +38 -16
  6. package/dist/_shared/mro-strategy.d.ts.map +1 -1
  7. package/dist/cli/ai-context.js +0 -58
  8. package/dist/cli/analyze.js +3 -0
  9. package/dist/core/embeddings/ast-utils.d.ts +22 -0
  10. package/dist/core/embeddings/ast-utils.js +105 -0
  11. package/dist/core/embeddings/character-chunk.d.ts +12 -0
  12. package/dist/core/embeddings/character-chunk.js +43 -0
  13. package/dist/core/embeddings/chunker.d.ts +14 -0
  14. package/dist/core/embeddings/chunker.js +234 -0
  15. package/dist/core/embeddings/embedding-pipeline.d.ts +20 -24
  16. package/dist/core/embeddings/embedding-pipeline.js +176 -107
  17. package/dist/core/embeddings/line-index.d.ts +7 -0
  18. package/dist/core/embeddings/line-index.js +42 -0
  19. package/dist/core/embeddings/server-mapping.d.ts +15 -0
  20. package/dist/core/embeddings/server-mapping.js +33 -0
  21. package/dist/core/embeddings/structural-extractor.d.ts +15 -0
  22. package/dist/core/embeddings/structural-extractor.js +58 -0
  23. package/dist/core/embeddings/text-generator.d.ts +20 -13
  24. package/dist/core/embeddings/text-generator.js +151 -119
  25. package/dist/core/embeddings/types.d.ts +81 -3
  26. package/dist/core/embeddings/types.js +105 -3
  27. package/dist/core/group/extractors/http-patterns/node.js +130 -0
  28. package/dist/core/ingestion/call-extractors/configs/c-cpp.d.ts +3 -0
  29. package/dist/core/ingestion/call-extractors/configs/c-cpp.js +8 -0
  30. package/dist/core/ingestion/call-extractors/configs/csharp.d.ts +2 -0
  31. package/dist/core/ingestion/call-extractors/configs/csharp.js +6 -0
  32. package/dist/core/ingestion/call-extractors/configs/dart.d.ts +2 -0
  33. package/dist/core/ingestion/call-extractors/configs/dart.js +5 -0
  34. package/dist/core/ingestion/call-extractors/configs/go.d.ts +2 -0
  35. package/dist/core/ingestion/call-extractors/configs/go.js +5 -0
  36. package/dist/core/ingestion/call-extractors/configs/jvm.d.ts +3 -0
  37. package/dist/core/ingestion/call-extractors/configs/jvm.js +51 -0
  38. package/dist/core/ingestion/call-extractors/configs/php.d.ts +2 -0
  39. package/dist/core/ingestion/call-extractors/configs/php.js +5 -0
  40. package/dist/core/ingestion/call-extractors/configs/python.d.ts +2 -0
  41. package/dist/core/ingestion/call-extractors/configs/python.js +5 -0
  42. package/dist/core/ingestion/call-extractors/configs/ruby.d.ts +2 -0
  43. package/dist/core/ingestion/call-extractors/configs/ruby.js +5 -0
  44. package/dist/core/ingestion/call-extractors/configs/rust.d.ts +2 -0
  45. package/dist/core/ingestion/call-extractors/configs/rust.js +5 -0
  46. package/dist/core/ingestion/call-extractors/configs/swift.d.ts +2 -0
  47. package/dist/core/ingestion/call-extractors/configs/swift.js +5 -0
  48. package/dist/core/ingestion/call-extractors/configs/typescript-javascript.d.ts +3 -0
  49. package/dist/core/ingestion/call-extractors/configs/typescript-javascript.js +8 -0
  50. package/dist/core/ingestion/call-extractors/generic.d.ts +5 -0
  51. package/dist/core/ingestion/call-extractors/generic.js +59 -0
  52. package/dist/core/ingestion/call-processor.d.ts +2 -4
  53. package/dist/core/ingestion/call-processor.js +221 -89
  54. package/dist/core/ingestion/call-routing.d.ts +8 -12
  55. package/dist/core/ingestion/call-routing.js +13 -34
  56. package/dist/core/ingestion/call-types.d.ts +135 -0
  57. package/dist/core/ingestion/call-types.js +2 -0
  58. package/dist/core/ingestion/class-extractors/configs/c-cpp.d.ts +3 -0
  59. package/dist/core/ingestion/class-extractors/configs/c-cpp.js +11 -0
  60. package/dist/core/ingestion/class-extractors/configs/csharp.d.ts +2 -0
  61. package/dist/core/ingestion/class-extractors/configs/csharp.js +21 -0
  62. package/dist/core/ingestion/class-extractors/configs/dart.d.ts +2 -0
  63. package/dist/core/ingestion/class-extractors/configs/dart.js +7 -0
  64. package/dist/core/ingestion/class-extractors/configs/go.d.ts +2 -0
  65. package/dist/core/ingestion/class-extractors/configs/go.js +20 -0
  66. package/dist/core/ingestion/class-extractors/configs/jvm.d.ts +3 -0
  67. package/dist/core/ingestion/class-extractors/configs/jvm.js +35 -0
  68. package/dist/core/ingestion/class-extractors/configs/php.d.ts +2 -0
  69. package/dist/core/ingestion/class-extractors/configs/php.js +7 -0
  70. package/dist/core/ingestion/class-extractors/configs/python.d.ts +2 -0
  71. package/dist/core/ingestion/class-extractors/configs/python.js +7 -0
  72. package/dist/core/ingestion/class-extractors/configs/ruby.d.ts +2 -0
  73. package/dist/core/ingestion/class-extractors/configs/ruby.js +7 -0
  74. package/dist/core/ingestion/class-extractors/configs/rust.d.ts +2 -0
  75. package/dist/core/ingestion/class-extractors/configs/rust.js +7 -0
  76. package/dist/core/ingestion/class-extractors/configs/swift.d.ts +2 -0
  77. package/dist/core/ingestion/class-extractors/configs/swift.js +18 -0
  78. package/dist/core/ingestion/class-extractors/configs/typescript-javascript.d.ts +4 -0
  79. package/dist/core/ingestion/class-extractors/configs/typescript-javascript.js +28 -0
  80. package/dist/core/ingestion/field-types.d.ts +1 -1
  81. package/dist/core/ingestion/heritage-extractors/configs/go.d.ts +13 -0
  82. package/dist/core/ingestion/heritage-extractors/configs/go.js +20 -0
  83. package/dist/core/ingestion/heritage-extractors/configs/ruby.d.ts +18 -0
  84. package/dist/core/ingestion/heritage-extractors/configs/ruby.js +65 -0
  85. package/dist/core/ingestion/heritage-extractors/generic.d.ts +23 -0
  86. package/dist/core/ingestion/heritage-extractors/generic.js +47 -0
  87. package/dist/core/ingestion/heritage-processor.d.ts +9 -0
  88. package/dist/core/ingestion/heritage-processor.js +120 -85
  89. package/dist/core/ingestion/heritage-types.d.ts +73 -0
  90. package/dist/core/ingestion/heritage-types.js +2 -0
  91. package/dist/core/ingestion/import-resolvers/configs/c-cpp.d.ts +7 -0
  92. package/dist/core/ingestion/import-resolvers/configs/c-cpp.js +14 -0
  93. package/dist/core/ingestion/import-resolvers/configs/csharp.d.ts +8 -0
  94. package/dist/core/ingestion/import-resolvers/configs/csharp.js +27 -0
  95. package/dist/core/ingestion/import-resolvers/configs/dart.d.ts +17 -0
  96. package/dist/core/ingestion/import-resolvers/{dart.js → configs/dart.js} +26 -16
  97. package/dist/core/ingestion/import-resolvers/configs/go.d.ts +8 -0
  98. package/dist/core/ingestion/import-resolvers/configs/go.js +26 -0
  99. package/dist/core/ingestion/import-resolvers/configs/jvm.d.ts +13 -0
  100. package/dist/core/ingestion/import-resolvers/configs/jvm.js +68 -0
  101. package/dist/core/ingestion/import-resolvers/configs/php.d.ts +8 -0
  102. package/dist/core/ingestion/import-resolvers/configs/php.js +15 -0
  103. package/dist/core/ingestion/import-resolvers/configs/python.d.ts +12 -0
  104. package/dist/core/ingestion/import-resolvers/configs/python.js +41 -0
  105. package/dist/core/ingestion/import-resolvers/configs/ruby.d.ts +8 -0
  106. package/dist/core/ingestion/import-resolvers/configs/ruby.js +16 -0
  107. package/dist/core/ingestion/import-resolvers/configs/rust.d.ts +8 -0
  108. package/dist/core/ingestion/import-resolvers/configs/rust.js +54 -0
  109. package/dist/core/ingestion/import-resolvers/configs/swift.d.ts +8 -0
  110. package/dist/core/ingestion/import-resolvers/{swift.js → configs/swift.js} +10 -5
  111. package/dist/core/ingestion/import-resolvers/configs/typescript-javascript.d.ts +9 -0
  112. package/dist/core/ingestion/import-resolvers/configs/typescript-javascript.js +23 -0
  113. package/dist/core/ingestion/import-resolvers/csharp.d.ts +4 -5
  114. package/dist/core/ingestion/import-resolvers/csharp.js +4 -20
  115. package/dist/core/ingestion/import-resolvers/go.d.ts +4 -5
  116. package/dist/core/ingestion/import-resolvers/go.js +4 -19
  117. package/dist/core/ingestion/import-resolvers/jvm.d.ts +5 -10
  118. package/dist/core/ingestion/import-resolvers/jvm.js +5 -58
  119. package/dist/core/ingestion/import-resolvers/php.d.ts +4 -5
  120. package/dist/core/ingestion/import-resolvers/php.js +4 -7
  121. package/dist/core/ingestion/import-resolvers/python.d.ts +3 -6
  122. package/dist/core/ingestion/import-resolvers/python.js +3 -18
  123. package/dist/core/ingestion/import-resolvers/resolver-factory.d.ts +24 -0
  124. package/dist/core/ingestion/import-resolvers/resolver-factory.js +33 -0
  125. package/dist/core/ingestion/import-resolvers/ruby.d.ts +4 -5
  126. package/dist/core/ingestion/import-resolvers/ruby.js +4 -7
  127. package/dist/core/ingestion/import-resolvers/rust.d.ts +4 -5
  128. package/dist/core/ingestion/import-resolvers/rust.js +4 -47
  129. package/dist/core/ingestion/import-resolvers/standard.d.ts +3 -9
  130. package/dist/core/ingestion/import-resolvers/standard.js +7 -8
  131. package/dist/core/ingestion/import-resolvers/types.d.ts +24 -0
  132. package/dist/core/ingestion/language-provider.d.ts +80 -0
  133. package/dist/core/ingestion/languages/c-cpp.js +18 -12
  134. package/dist/core/ingestion/languages/csharp.js +13 -21
  135. package/dist/core/ingestion/languages/dart.js +13 -7
  136. package/dist/core/ingestion/languages/go.js +14 -20
  137. package/dist/core/ingestion/languages/java.js +13 -18
  138. package/dist/core/ingestion/languages/kotlin.js +13 -13
  139. package/dist/core/ingestion/languages/php.js +13 -7
  140. package/dist/core/ingestion/languages/python.js +13 -7
  141. package/dist/core/ingestion/languages/ruby.js +103 -22
  142. package/dist/core/ingestion/languages/rust.js +13 -7
  143. package/dist/core/ingestion/languages/swift.js +13 -18
  144. package/dist/core/ingestion/languages/typescript.js +18 -23
  145. package/dist/core/ingestion/languages/vue.js +13 -17
  146. package/dist/core/ingestion/model/heritage-map.d.ts +35 -0
  147. package/dist/core/ingestion/model/heritage-map.js +110 -9
  148. package/dist/core/ingestion/model/index.d.ts +2 -2
  149. package/dist/core/ingestion/model/index.js +1 -1
  150. package/dist/core/ingestion/model/resolve.d.ts +33 -28
  151. package/dist/core/ingestion/model/resolve.js +111 -27
  152. package/dist/core/ingestion/parsing-processor.d.ts +1 -2
  153. package/dist/core/ingestion/pipeline-phases/parse-impl.d.ts +1 -0
  154. package/dist/core/ingestion/pipeline-phases/parse-impl.js +9 -3
  155. package/dist/core/ingestion/pipeline-phases/parse.d.ts +7 -0
  156. package/dist/core/ingestion/pipeline.d.ts +11 -0
  157. package/dist/core/ingestion/pipeline.js +9 -2
  158. package/dist/core/ingestion/tree-sitter-queries.d.ts +11 -11
  159. package/dist/core/ingestion/tree-sitter-queries.js +81 -0
  160. package/dist/core/ingestion/type-env.d.ts +1 -1
  161. package/dist/core/ingestion/utils/ast-helpers.d.ts +1 -1
  162. package/dist/core/ingestion/utils/ast-helpers.js +22 -2
  163. package/dist/core/ingestion/utils/ruby-self-call.d.ts +52 -0
  164. package/dist/core/ingestion/utils/ruby-self-call.js +59 -0
  165. package/dist/core/ingestion/variable-extractors/configs/c-cpp.d.ts +3 -0
  166. package/dist/core/ingestion/variable-extractors/configs/c-cpp.js +81 -0
  167. package/dist/core/ingestion/variable-extractors/configs/csharp.d.ts +9 -0
  168. package/dist/core/ingestion/variable-extractors/configs/csharp.js +63 -0
  169. package/dist/core/ingestion/variable-extractors/configs/dart.d.ts +2 -0
  170. package/dist/core/ingestion/variable-extractors/configs/dart.js +94 -0
  171. package/dist/core/ingestion/variable-extractors/configs/go.d.ts +2 -0
  172. package/dist/core/ingestion/variable-extractors/configs/go.js +83 -0
  173. package/dist/core/ingestion/variable-extractors/configs/jvm.d.ts +18 -0
  174. package/dist/core/ingestion/variable-extractors/configs/jvm.js +115 -0
  175. package/dist/core/ingestion/variable-extractors/configs/php.d.ts +14 -0
  176. package/dist/core/ingestion/variable-extractors/configs/php.js +58 -0
  177. package/dist/core/ingestion/variable-extractors/configs/python.d.ts +2 -0
  178. package/dist/core/ingestion/variable-extractors/configs/python.js +101 -0
  179. package/dist/core/ingestion/variable-extractors/configs/ruby.d.ts +11 -0
  180. package/dist/core/ingestion/variable-extractors/configs/ruby.js +52 -0
  181. package/dist/core/ingestion/variable-extractors/configs/rust.d.ts +2 -0
  182. package/dist/core/ingestion/variable-extractors/configs/rust.js +76 -0
  183. package/dist/core/ingestion/variable-extractors/configs/swift.d.ts +2 -0
  184. package/dist/core/ingestion/variable-extractors/configs/swift.js +88 -0
  185. package/dist/core/ingestion/variable-extractors/configs/typescript-javascript.d.ts +3 -0
  186. package/dist/core/ingestion/variable-extractors/configs/typescript-javascript.js +83 -0
  187. package/dist/core/ingestion/variable-extractors/generic.d.ts +5 -0
  188. package/dist/core/ingestion/variable-extractors/generic.js +80 -0
  189. package/dist/core/ingestion/variable-types.d.ts +82 -0
  190. package/dist/core/ingestion/variable-types.js +2 -0
  191. package/dist/core/ingestion/workers/parse-worker.js +244 -217
  192. package/dist/core/ingestion/workers/worker-pool.js +3 -0
  193. package/dist/core/lbug/csv-generator.js +1 -0
  194. package/dist/core/lbug/lbug-adapter.d.ts +4 -5
  195. package/dist/core/lbug/lbug-adapter.js +38 -14
  196. package/dist/core/lbug/schema.d.ts +2 -1
  197. package/dist/core/lbug/schema.js +10 -1
  198. package/dist/core/run-analyze.js +6 -7
  199. package/dist/core/tree-sitter/parser-loader.d.ts +3 -0
  200. package/dist/core/tree-sitter/parser-loader.js +17 -8
  201. package/dist/mcp/local/local-backend.js +29 -19
  202. package/dist/server/api.js +2 -0
  203. package/dist/types/pipeline.d.ts +6 -0
  204. package/package.json +8 -7
  205. package/scripts/build-tree-sitter-proto.cjs +82 -0
  206. package/vendor/node_modules/node-addon-api/node_addon_api.Makefile +6 -0
  207. package/vendor/node_modules/node-addon-api/node_addon_api.target.mk +104 -0
  208. package/vendor/node_modules/node-addon-api/node_addon_api_except.target.mk +108 -0
  209. package/vendor/node_modules/node-addon-api/node_addon_api_except_all.target.mk +104 -0
  210. package/vendor/node_modules/node-addon-api/node_addon_api_maybe.target.mk +104 -0
  211. package/vendor/tree-sitter-proto/package.json +1 -7
  212. package/dist/core/ingestion/call-sites/extract-language-call-site.d.ts +0 -10
  213. package/dist/core/ingestion/call-sites/extract-language-call-site.js +0 -22
  214. package/dist/core/ingestion/call-sites/java.d.ts +0 -9
  215. package/dist/core/ingestion/call-sites/java.js +0 -30
  216. package/dist/core/ingestion/import-resolvers/dart.d.ts +0 -7
  217. package/dist/core/ingestion/import-resolvers/swift.d.ts +0 -7
  218. package/dist/core/ingestion/import-resolvers/vue.d.ts +0 -8
  219. package/dist/core/ingestion/import-resolvers/vue.js +0 -9
  220. package/scripts/preinstall-cleanup.cjs +0 -34
@@ -0,0 +1,135 @@
1
+ /**
2
+ * Types for the language-agnostic call extraction pipeline.
3
+ *
4
+ * Mirrors method-types.ts / field-types.ts: defines the domain interfaces
5
+ * consumed by createCallExtractor() and the per-language configs.
6
+ */
7
+ import type { SupportedLanguages } from '../../_shared/index.js';
8
+ import type { SyntaxNode } from './utils/ast-helpers.js';
9
+ import type { MixedChainStep } from './utils/call-analysis.js';
10
+ /**
11
+ * Per-node call extraction result. The parse worker enriches this with
12
+ * file-level context (filePath, sourceId, TypeEnv lookups, arg types) to
13
+ * produce the final `ExtractedCall` that enters the resolution pipeline.
14
+ */
15
+ export interface ExtractedCallSite {
16
+ calledName: string;
17
+ callForm?: 'free' | 'member' | 'constructor';
18
+ receiverName?: string;
19
+ argCount?: number;
20
+ /** Unified mixed chain for complex receivers (field + call chains). */
21
+ receiverMixedChain?: MixedChainStep[];
22
+ /** When true, the type-as-receiver heuristic applies: if receiverName
23
+ * starts with an uppercase letter and has no TypeEnv binding, treat it
24
+ * as a type name (e.g. Java `User::getName`). */
25
+ typeAsReceiverHeuristic?: boolean;
26
+ }
27
+ export interface CallExtractor {
28
+ readonly language: SupportedLanguages;
29
+ /**
30
+ * Extract a call site from captured AST nodes.
31
+ *
32
+ * @param callNode The @call capture (call_expression, method_invocation, …)
33
+ * @param callNameNode The @call.name capture (identifier inside the call).
34
+ * May be undefined when the call shape has no name capture
35
+ * (e.g. Java method_reference via `::`).
36
+ * @returns Extracted call site, or null when no call can be derived.
37
+ */
38
+ extract(callNode: SyntaxNode, callNameNode: SyntaxNode | undefined): ExtractedCallSite | null;
39
+ }
40
+ export interface CallExtractionConfig {
41
+ language: SupportedLanguages;
42
+ /**
43
+ * Language-specific call site extraction. Called **before** the generic
44
+ * path. If it returns non-null, the generic `inferCallForm` /
45
+ * `extractReceiverName` path is skipped entirely.
46
+ *
47
+ * Use this for call shapes that don't follow the standard `@call` /
48
+ * `@call.name` pattern (e.g. Java `method_reference` via `::`).
49
+ */
50
+ extractLanguageCallSite?: (callNode: SyntaxNode) => ExtractedCallSite | null;
51
+ /**
52
+ * Whether the type-as-receiver heuristic applies for this language.
53
+ * When true and the receiver name starts with an uppercase letter,
54
+ * the receiver is treated as a type name when no TypeEnv binding exists.
55
+ *
56
+ * Applies to JVM and C# languages where `Type.method()` and `Type::method`
57
+ * are common patterns.
58
+ */
59
+ typeAsReceiverHeuristic?: boolean;
60
+ }
61
+ /**
62
+ * DAG stage 3 output: call record with receiver type and source discriminant.
63
+ *
64
+ * `receiverTypeName` is resolved via TypeEnv → constructor-map → class-as-receiver →
65
+ * mixed-chain, or synthesized by `inferImplicitReceiver`. `receiverSource` tags
66
+ * which path won and drives MRO strategy selection in stage 4.
67
+ *
68
+ * Invariants:
69
+ * - `receiverSource` MUST match how `receiverTypeName` was resolved; every
70
+ * discriminant must have a live reader and writer.
71
+ * - `hint` is opaque to shared stages; only the same provider's `selectDispatch` reads it.
72
+ *
73
+ * @see language-provider.ts § inferImplicitReceiver, selectDispatch
74
+ */
75
+ export interface ReceiverEnriched {
76
+ readonly calledName: string;
77
+ readonly callForm: 'free' | 'member' | 'constructor' | undefined;
78
+ readonly receiverName: string | undefined;
79
+ readonly receiverTypeName: string | undefined;
80
+ readonly receiverSource: 'none' | 'typed-binding' | 'constructor-map' | 'class-as-receiver' | 'mixed-chain' | 'implicit-self';
81
+ /** Free-form hint from the provider hook; opaque to shared stages. */
82
+ readonly hint?: string;
83
+ }
84
+ /**
85
+ * Provider hook output for `LanguageProvider.inferImplicitReceiver` (DAG stage 3).
86
+ *
87
+ * Overlay applied to `ReceiverEnriched` when an implicit receiver is synthesized.
88
+ * Ruby example: bare `serialize` inside `Account#call_serialize` →
89
+ * `{ callForm: 'member', receiverName: 'self', receiverTypeName: 'Account',
90
+ * receiverSource: 'implicit-self', hint: 'instance' }`
91
+ *
92
+ * Invariants:
93
+ * - `receiverSource` is always `'implicit-self'` — the only variant this type produces.
94
+ * - `callForm` is always `'member'` — the rewrite converts bare-call to method invocation.
95
+ * - `hint` is opaque to shared stages; consumed by the same language's `selectDispatch`.
96
+ */
97
+ export interface ImplicitReceiverOverride {
98
+ readonly callForm: 'free' | 'member' | 'constructor';
99
+ readonly receiverName: string;
100
+ readonly receiverTypeName: string;
101
+ readonly receiverSource: Extract<ReceiverEnriched['receiverSource'], 'implicit-self'>;
102
+ /** Free-form language tag (e.g. Ruby sets 'singleton' for `def self.foo`
103
+ * method bodies). Consumed by the same language's `selectDispatch` hook. */
104
+ readonly hint?: string;
105
+ }
106
+ /**
107
+ * DAG stage 4 output: dispatch strategy for resolving the target method.
108
+ *
109
+ * Encodes which resolver branch to try first and an optional fallback.
110
+ * Stage 5 delegates to `resolveMemberCall`, `resolveFreeCall`, or
111
+ * `resolveStaticCall` based on `primary`.
112
+ *
113
+ * - `primary`: `'owner-scoped'` = MRO walk, `'free'` = arity-tiered global lookup,
114
+ * `'constructor'` = type instantiation.
115
+ * - `fallback`: Only `'free-arity-narrowed'` exists; used by Ruby implicit-self
116
+ * to degrade to arity-tiered free lookup when the MRO walk misses.
117
+ * - `ancestryView`: Ruby `'ruby-mixin'` only. `'singleton'` walks extend providers
118
+ * only; a miss NEVER falls through to file-scoped lookup (enforced in
119
+ * resolveCallTarget). `'instance'` is the default.
120
+ *
121
+ * Common patterns:
122
+ * - `{primary: 'constructor'}` — constructor call
123
+ * - `{primary: 'owner-scoped'}` — member call with known type
124
+ * - `{primary: 'owner-scoped', fallback: 'free-arity-narrowed', ancestryView: 'instance'}` — Ruby implicit-self
125
+ * - `{primary: 'owner-scoped', ancestryView: 'singleton'}` — Ruby class-method call
126
+ *
127
+ * @see language-provider.ts § selectDispatch
128
+ * @see call-processor.ts § defaultDispatchDecision, resolveCallTarget
129
+ */
130
+ export interface DispatchDecision {
131
+ readonly primary: 'owner-scoped' | 'free' | 'constructor';
132
+ readonly fallback?: 'free-arity-narrowed';
133
+ readonly ancestryView?: 'instance' | 'singleton';
134
+ readonly hint?: string;
135
+ }
@@ -0,0 +1,2 @@
1
+ // gitnexus/src/core/ingestion/call-types.ts
2
+ export {};
@@ -0,0 +1,3 @@
1
+ import type { ClassExtractionConfig } from '../../class-types.js';
2
+ export declare const cClassConfig: ClassExtractionConfig;
3
+ export declare const cppClassConfig: ClassExtractionConfig;
@@ -0,0 +1,11 @@
1
+ // gitnexus/src/core/ingestion/class-extractors/configs/c-cpp.ts
2
+ import { SupportedLanguages } from '../../../../_shared/index.js';
3
+ export const cClassConfig = {
4
+ language: SupportedLanguages.C,
5
+ typeDeclarationNodes: ['struct_specifier', 'enum_specifier'],
6
+ };
7
+ export const cppClassConfig = {
8
+ language: SupportedLanguages.CPlusPlus,
9
+ typeDeclarationNodes: ['class_specifier', 'struct_specifier', 'enum_specifier'],
10
+ ancestorScopeNodeTypes: ['namespace_definition', 'class_specifier', 'struct_specifier'],
11
+ };
@@ -0,0 +1,2 @@
1
+ import type { ClassExtractionConfig } from '../../class-types.js';
2
+ export declare const csharpClassConfig: ClassExtractionConfig;
@@ -0,0 +1,21 @@
1
+ // gitnexus/src/core/ingestion/class-extractors/configs/csharp.ts
2
+ import { SupportedLanguages } from '../../../../_shared/index.js';
3
+ export const csharpClassConfig = {
4
+ language: SupportedLanguages.CSharp,
5
+ typeDeclarationNodes: [
6
+ 'class_declaration',
7
+ 'interface_declaration',
8
+ 'struct_declaration',
9
+ 'enum_declaration',
10
+ 'record_declaration',
11
+ ],
12
+ fileScopeNodeTypes: ['file_scoped_namespace_declaration'],
13
+ ancestorScopeNodeTypes: [
14
+ 'namespace_declaration',
15
+ 'class_declaration',
16
+ 'interface_declaration',
17
+ 'struct_declaration',
18
+ 'enum_declaration',
19
+ 'record_declaration',
20
+ ],
21
+ };
@@ -0,0 +1,2 @@
1
+ import type { ClassExtractionConfig } from '../../class-types.js';
2
+ export declare const dartClassConfig: ClassExtractionConfig;
@@ -0,0 +1,7 @@
1
+ // gitnexus/src/core/ingestion/class-extractors/configs/dart.ts
2
+ import { SupportedLanguages } from '../../../../_shared/index.js';
3
+ export const dartClassConfig = {
4
+ language: SupportedLanguages.Dart,
5
+ typeDeclarationNodes: ['class_definition', 'extension_declaration', 'enum_declaration'],
6
+ ancestorScopeNodeTypes: ['class_definition', 'extension_declaration', 'enum_declaration'],
7
+ };
@@ -0,0 +1,2 @@
1
+ import type { ClassExtractionConfig } from '../../class-types.js';
2
+ export declare const goClassConfig: ClassExtractionConfig;
@@ -0,0 +1,20 @@
1
+ // gitnexus/src/core/ingestion/class-extractors/configs/go.ts
2
+ import { SupportedLanguages } from '../../../../_shared/index.js';
3
+ export const goClassConfig = {
4
+ language: SupportedLanguages.Go,
5
+ typeDeclarationNodes: ['type_declaration'],
6
+ fileScopeNodeTypes: ['package_clause'],
7
+ extractName(node) {
8
+ const typeSpec = node.namedChildren.find((child) => child.type === 'type_spec');
9
+ return typeSpec?.childForFieldName('name')?.text;
10
+ },
11
+ extractType(node) {
12
+ const typeSpec = node.namedChildren.find((child) => child.type === 'type_spec');
13
+ const typeNode = typeSpec?.childForFieldName('type');
14
+ if (typeNode?.type === 'struct_type')
15
+ return 'Struct';
16
+ if (typeNode?.type === 'interface_type')
17
+ return 'Interface';
18
+ return undefined;
19
+ },
20
+ };
@@ -0,0 +1,3 @@
1
+ import type { ClassExtractionConfig } from '../../class-types.js';
2
+ export declare const javaClassConfig: ClassExtractionConfig;
3
+ export declare const kotlinClassConfig: ClassExtractionConfig;
@@ -0,0 +1,35 @@
1
+ // gitnexus/src/core/ingestion/class-extractors/configs/jvm.ts
2
+ import { SupportedLanguages } from '../../../../_shared/index.js';
3
+ // ---------------------------------------------------------------------------
4
+ // Java
5
+ // ---------------------------------------------------------------------------
6
+ export const javaClassConfig = {
7
+ language: SupportedLanguages.Java,
8
+ typeDeclarationNodes: [
9
+ 'class_declaration',
10
+ 'interface_declaration',
11
+ 'enum_declaration',
12
+ 'record_declaration',
13
+ ],
14
+ fileScopeNodeTypes: ['package_declaration'],
15
+ ancestorScopeNodeTypes: [
16
+ 'class_declaration',
17
+ 'interface_declaration',
18
+ 'enum_declaration',
19
+ 'record_declaration',
20
+ ],
21
+ };
22
+ // ---------------------------------------------------------------------------
23
+ // Kotlin
24
+ // ---------------------------------------------------------------------------
25
+ export const kotlinClassConfig = {
26
+ language: SupportedLanguages.Kotlin,
27
+ typeDeclarationNodes: ['class_declaration', 'object_declaration', 'companion_object'],
28
+ fileScopeNodeTypes: ['package_header'],
29
+ ancestorScopeNodeTypes: ['class_declaration', 'object_declaration', 'companion_object'],
30
+ extractType(node) {
31
+ if (node.type !== 'class_declaration')
32
+ return undefined;
33
+ return node.children.some((child) => child?.text === 'interface') ? 'Interface' : 'Class';
34
+ },
35
+ };
@@ -0,0 +1,2 @@
1
+ import type { ClassExtractionConfig } from '../../class-types.js';
2
+ export declare const phpClassConfig: ClassExtractionConfig;
@@ -0,0 +1,7 @@
1
+ // gitnexus/src/core/ingestion/class-extractors/configs/php.ts
2
+ import { SupportedLanguages } from '../../../../_shared/index.js';
3
+ export const phpClassConfig = {
4
+ language: SupportedLanguages.PHP,
5
+ typeDeclarationNodes: ['class_declaration', 'interface_declaration', 'enum_declaration'],
6
+ ancestorScopeNodeTypes: ['namespace_definition'],
7
+ };
@@ -0,0 +1,2 @@
1
+ import type { ClassExtractionConfig } from '../../class-types.js';
2
+ export declare const pythonClassConfig: ClassExtractionConfig;
@@ -0,0 +1,7 @@
1
+ // gitnexus/src/core/ingestion/class-extractors/configs/python.ts
2
+ import { SupportedLanguages } from '../../../../_shared/index.js';
3
+ export const pythonClassConfig = {
4
+ language: SupportedLanguages.Python,
5
+ typeDeclarationNodes: ['class_definition'],
6
+ ancestorScopeNodeTypes: ['class_definition'],
7
+ };
@@ -0,0 +1,2 @@
1
+ import type { ClassExtractionConfig } from '../../class-types.js';
2
+ export declare const rubyClassConfig: ClassExtractionConfig;
@@ -0,0 +1,7 @@
1
+ // gitnexus/src/core/ingestion/class-extractors/configs/ruby.ts
2
+ import { SupportedLanguages } from '../../../../_shared/index.js';
3
+ export const rubyClassConfig = {
4
+ language: SupportedLanguages.Ruby,
5
+ typeDeclarationNodes: ['class'],
6
+ ancestorScopeNodeTypes: ['module', 'class'],
7
+ };
@@ -0,0 +1,2 @@
1
+ import type { ClassExtractionConfig } from '../../class-types.js';
2
+ export declare const rustClassConfig: ClassExtractionConfig;
@@ -0,0 +1,7 @@
1
+ // gitnexus/src/core/ingestion/class-extractors/configs/rust.ts
2
+ import { SupportedLanguages } from '../../../../_shared/index.js';
3
+ export const rustClassConfig = {
4
+ language: SupportedLanguages.Rust,
5
+ typeDeclarationNodes: ['struct_item', 'enum_item'],
6
+ ancestorScopeNodeTypes: ['mod_item', 'struct_item', 'enum_item'],
7
+ };
@@ -0,0 +1,2 @@
1
+ import type { ClassExtractionConfig } from '../../class-types.js';
2
+ export declare const swiftClassConfig: ClassExtractionConfig;
@@ -0,0 +1,18 @@
1
+ // gitnexus/src/core/ingestion/class-extractors/configs/swift.ts
2
+ import { SupportedLanguages } from '../../../../_shared/index.js';
3
+ export const swiftClassConfig = {
4
+ language: SupportedLanguages.Swift,
5
+ typeDeclarationNodes: ['class_declaration', 'protocol_declaration'],
6
+ ancestorScopeNodeTypes: ['class_declaration', 'protocol_declaration'],
7
+ extractType(node) {
8
+ if (node.type === 'protocol_declaration')
9
+ return 'Interface';
10
+ if (node.type !== 'class_declaration')
11
+ return undefined;
12
+ if (node.children.some((child) => child?.text === 'struct'))
13
+ return 'Struct';
14
+ if (node.children.some((child) => child?.text === 'enum'))
15
+ return 'Enum';
16
+ return 'Class';
17
+ },
18
+ };
@@ -0,0 +1,4 @@
1
+ import type { ClassExtractionConfig } from '../../class-types.js';
2
+ export declare const typescriptClassConfig: ClassExtractionConfig;
3
+ export declare const javascriptClassConfig: ClassExtractionConfig;
4
+ export declare const vueClassConfig: ClassExtractionConfig;
@@ -0,0 +1,28 @@
1
+ // gitnexus/src/core/ingestion/class-extractors/configs/typescript-javascript.ts
2
+ import { SupportedLanguages } from '../../../../_shared/index.js';
3
+ const shared = {
4
+ typeDeclarationNodes: [
5
+ 'class_declaration',
6
+ 'abstract_class_declaration',
7
+ 'interface_declaration',
8
+ 'enum_declaration',
9
+ ],
10
+ ancestorScopeNodeTypes: [
11
+ 'class_declaration',
12
+ 'abstract_class_declaration',
13
+ 'interface_declaration',
14
+ 'enum_declaration',
15
+ ],
16
+ };
17
+ export const typescriptClassConfig = {
18
+ ...shared,
19
+ language: SupportedLanguages.TypeScript,
20
+ };
21
+ export const javascriptClassConfig = {
22
+ ...shared,
23
+ language: SupportedLanguages.JavaScript,
24
+ };
25
+ export const vueClassConfig = {
26
+ ...shared,
27
+ language: SupportedLanguages.Vue,
28
+ };
@@ -1,5 +1,5 @@
1
1
  import type { TypeEnvironment } from './type-env.js';
2
- import type { SymbolTableReader } from './model/symbol-table.js';
2
+ import type { SymbolTableReader } from './model/index.js';
3
3
  import { SupportedLanguages } from '../../_shared/index.js';
4
4
  /**
5
5
  * Visibility levels used across all supported languages.
@@ -0,0 +1,13 @@
1
+ import type { HeritageExtractionConfig } from '../../heritage-types.js';
2
+ /**
3
+ * Go heritage extraction config.
4
+ *
5
+ * Go struct embedding: the tree-sitter query matches ALL field_declarations
6
+ * with type_identifier, but only anonymous fields (no name) are embedded.
7
+ * Named fields like `Breed string` also match — skip them.
8
+ *
9
+ * The shouldSkipExtends hook checks if the extends node's parent is a
10
+ * field_declaration with a named field child, indicating a regular
11
+ * (non-embedded) field that should not produce a heritage record.
12
+ */
13
+ export declare const goHeritageConfig: HeritageExtractionConfig;
@@ -0,0 +1,20 @@
1
+ // gitnexus/src/core/ingestion/heritage-extractors/configs/go.ts
2
+ import { SupportedLanguages } from '../../../../_shared/index.js';
3
+ /**
4
+ * Go heritage extraction config.
5
+ *
6
+ * Go struct embedding: the tree-sitter query matches ALL field_declarations
7
+ * with type_identifier, but only anonymous fields (no name) are embedded.
8
+ * Named fields like `Breed string` also match — skip them.
9
+ *
10
+ * The shouldSkipExtends hook checks if the extends node's parent is a
11
+ * field_declaration with a named field child, indicating a regular
12
+ * (non-embedded) field that should not produce a heritage record.
13
+ */
14
+ export const goHeritageConfig = {
15
+ language: SupportedLanguages.Go,
16
+ shouldSkipExtends(extendsNode) {
17
+ const fieldDecl = extendsNode.parent;
18
+ return fieldDecl?.type === 'field_declaration' && fieldDecl.childForFieldName?.('name') != null;
19
+ },
20
+ };
@@ -0,0 +1,18 @@
1
+ import type { HeritageExtractionConfig } from '../../heritage-types.js';
2
+ /**
3
+ * Ruby heritage extraction config.
4
+ *
5
+ * Ruby expresses inheritance in two ways, and only one of them has
6
+ * dedicated tree-sitter heritage captures:
7
+ *
8
+ * 1. Class inheritance (`class A < B`) produces standard
9
+ * `@heritage.extends` captures and flows through the generic
10
+ * capture-based `extract` hook (not defined here — the factory
11
+ * handles it).
12
+ * 2. Mixin calls (`include`/`extend`/`prepend`) have no dedicated
13
+ * heritage captures; they surface as ordinary call sites. The
14
+ * `callBasedHeritage` hook below intercepts them before the call
15
+ * router, absorbing the mixin routing logic that previously lived
16
+ * in call-routing.ts (routeRubyCall).
17
+ */
18
+ export declare const rubyHeritageConfig: HeritageExtractionConfig;
@@ -0,0 +1,65 @@
1
+ // gitnexus/src/core/ingestion/heritage-extractors/configs/ruby.ts
2
+ import { SupportedLanguages } from '../../../../_shared/index.js';
3
+ /**
4
+ * Maximum parent depth for enclosing class/module walk.
5
+ * Prevents runaway walks on malformed/deeply-nested ASTs.
6
+ */
7
+ const MAX_PARENT_DEPTH = 50;
8
+ /**
9
+ * Walk up the AST from a call node to find the enclosing class or module name.
10
+ * Ruby include/extend/prepend calls must be inside a class or module body.
11
+ */
12
+ function findEnclosingClassName(callNode) {
13
+ let current = callNode.parent;
14
+ let depth = 0;
15
+ while (current && ++depth <= MAX_PARENT_DEPTH) {
16
+ if (current.type === 'class' || current.type === 'module') {
17
+ const nameNode = current.childForFieldName?.('name');
18
+ if (nameNode)
19
+ return nameNode.text;
20
+ }
21
+ current = current.parent;
22
+ }
23
+ return null;
24
+ }
25
+ /** Ruby heritage call names that express mixin inclusion. */
26
+ const RUBY_HERITAGE_CALL_NAMES = new Set(['include', 'extend', 'prepend']);
27
+ /**
28
+ * Ruby heritage extraction config.
29
+ *
30
+ * Ruby expresses inheritance in two ways, and only one of them has
31
+ * dedicated tree-sitter heritage captures:
32
+ *
33
+ * 1. Class inheritance (`class A < B`) produces standard
34
+ * `@heritage.extends` captures and flows through the generic
35
+ * capture-based `extract` hook (not defined here — the factory
36
+ * handles it).
37
+ * 2. Mixin calls (`include`/`extend`/`prepend`) have no dedicated
38
+ * heritage captures; they surface as ordinary call sites. The
39
+ * `callBasedHeritage` hook below intercepts them before the call
40
+ * router, absorbing the mixin routing logic that previously lived
41
+ * in call-routing.ts (routeRubyCall).
42
+ */
43
+ export const rubyHeritageConfig = {
44
+ language: SupportedLanguages.Ruby,
45
+ callBasedHeritage: {
46
+ callNames: RUBY_HERITAGE_CALL_NAMES,
47
+ extract(calledName, callNode, _filePath) {
48
+ const enclosingClass = findEnclosingClassName(callNode);
49
+ if (!enclosingClass)
50
+ return [];
51
+ const results = [];
52
+ const argList = callNode.childForFieldName?.('arguments');
53
+ for (const arg of argList?.children ?? []) {
54
+ if (arg.type === 'constant' || arg.type === 'scope_resolution') {
55
+ results.push({
56
+ className: enclosingClass,
57
+ parentName: arg.text,
58
+ kind: calledName, // 'include' | 'extend' | 'prepend'
59
+ });
60
+ }
61
+ }
62
+ return results;
63
+ },
64
+ },
65
+ };
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Generic table-driven heritage extractor factory.
3
+ *
4
+ * Follows the same config+factory pattern as method-extractors/generic.ts,
5
+ * field-extractors/generic.ts, call-extractors/generic.ts, and
6
+ * variable-extractors/generic.ts.
7
+ *
8
+ * Languages with custom extraction hooks (Go: shouldSkipExtends, Ruby:
9
+ * callBasedHeritage) pass a full HeritageExtractionConfig. Languages
10
+ * that use the default capture-based extraction can pass just the
11
+ * SupportedLanguages enum value — no per-language config file needed.
12
+ */
13
+ import type { SupportedLanguages } from '../../../_shared/index.js';
14
+ import type { HeritageExtractionConfig, HeritageExtractor } from '../heritage-types.js';
15
+ /**
16
+ * Create a HeritageExtractor from a declarative config or a language enum.
17
+ *
18
+ * When a full HeritageExtractionConfig is provided, custom hooks
19
+ * (shouldSkipExtends, callBasedHeritage) drive the extraction.
20
+ * When only a SupportedLanguages value is provided, the factory produces
21
+ * a default extractor that handles the standard @heritage.* captures.
22
+ */
23
+ export declare function createHeritageExtractor(config: HeritageExtractionConfig | SupportedLanguages): HeritageExtractor;
@@ -0,0 +1,47 @@
1
+ // gitnexus/src/core/ingestion/heritage-extractors/generic.ts
2
+ /**
3
+ * Create a HeritageExtractor from a declarative config or a language enum.
4
+ *
5
+ * When a full HeritageExtractionConfig is provided, custom hooks
6
+ * (shouldSkipExtends, callBasedHeritage) drive the extraction.
7
+ * When only a SupportedLanguages value is provided, the factory produces
8
+ * a default extractor that handles the standard @heritage.* captures.
9
+ */
10
+ export function createHeritageExtractor(config) {
11
+ const actualConfig = typeof config === 'string' ? { language: config } : config;
12
+ const callNameSet = actualConfig.callBasedHeritage?.callNames;
13
+ return {
14
+ language: actualConfig.language,
15
+ extract(captureMap, context) {
16
+ const classNode = captureMap['heritage.class'];
17
+ if (!classNode)
18
+ return [];
19
+ const className = classNode.text;
20
+ const results = [];
21
+ const extendsNode = captureMap['heritage.extends'];
22
+ if (extendsNode) {
23
+ if (!actualConfig.shouldSkipExtends?.(extendsNode)) {
24
+ results.push({ className, parentName: extendsNode.text, kind: 'extends' });
25
+ }
26
+ }
27
+ const implementsNode = captureMap['heritage.implements'];
28
+ if (implementsNode) {
29
+ results.push({ className, parentName: implementsNode.text, kind: 'implements' });
30
+ }
31
+ const traitNode = captureMap['heritage.trait'];
32
+ if (traitNode) {
33
+ results.push({ className, parentName: traitNode.text, kind: 'trait-impl' });
34
+ }
35
+ return results;
36
+ },
37
+ ...(callNameSet
38
+ ? {
39
+ extractFromCall(calledName, callNode, context) {
40
+ if (!callNameSet.has(calledName))
41
+ return null;
42
+ return actualConfig.callBasedHeritage.extract(calledName, callNode, context.filePath);
43
+ },
44
+ }
45
+ : {}),
46
+ };
47
+ }
@@ -38,6 +38,15 @@ export declare const processHeritageFromExtracted: (graph: KnowledgeGraph, extra
38
38
  * {@link ExtractedHeritage} rows without mutating the graph. Used on the
39
39
  * sequential pipeline path so `buildHeritageMap(..., ctx)` can run before
40
40
  * `processCalls` (worker path defers calls until heritage from all chunks exists).
41
+ *
42
+ * This prepass extracts BOTH capture-based heritage (`@heritage.*` — extends /
43
+ * implements / trait-impl) AND call-based heritage (`@call.name` routed through
44
+ * `heritageExtractor.extractFromCall` — Ruby `include` / `extend` / `prepend`).
45
+ * Without the second pass, sequential-mode `sequentialHeritageMap` would not
46
+ * know about Ruby mixin ancestry before `processCalls` resolves calls against
47
+ * it, silently dropping mixed-in methods from the graph. This function stays
48
+ * read-only — `processCalls` still owns emission of heritage graph edges via
49
+ * its `rubyHeritage` return path.
41
50
  */
42
51
  export declare function extractExtractedHeritageFromFiles(files: {
43
52
  path: string;