gitnexus 1.6.3-rc.2 → 1.6.3-rc.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.
@@ -6,7 +6,7 @@ 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, BindingRef, ImportEdge, TypeRef, Scope, ResolutionEvidence, Resolution, Reference, ReferenceIndex, LookupParams, RegistryContributor, } 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, ScopeTree, Callsite, } 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';
@@ -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,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AAM,yCAAyC,CAAC;AAChF,YAAY,EACV,OAAO,EACP,KAAK,EACL,SAAS,EACT,KAAK,EACL,OAAO,EACP,YAAY,EACZ,UAAU,EACV,UAAU,EACV,OAAO,EACP,KAAK,EACL,kBAAkB,EAClB,UAAU,EACV,SAAS,EACT,cAAc,EACd,YAAY,EACZ,mBAAmB,EACnB,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,SAAS,EACT,QAAQ,GACT,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AACnG,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,YAAY,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAG/E,OAAO,EACL,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,+CAA+C,CAAC;AACvD,YAAY,EAAE,sBAAsB,EAAE,MAAM,+CAA+C,CAAC"}
@@ -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;AA2BjG,8DAA8D;AAC9D,OAAO,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AACnG,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAGxE,yDAAyD;AACzD,OAAO,EACL,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,+CAA+C,CAAC"}
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,OAAO,EACL,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,+CAA+C,CAAC"}
@@ -42,6 +42,142 @@ export interface Capture {
42
42
  /** The captured source text. */
43
43
  readonly text: string;
44
44
  }
45
+ /**
46
+ * A grouping of `Capture`s that came from a single query match (e.g., one
47
+ * `@import.statement` match carries `@import.source`, `@import.name`,
48
+ * `@import.alias?` as child captures). Keyed by capture name for O(1)
49
+ * child access.
50
+ */
51
+ export type CaptureMatch = Readonly<Record<string, Capture>>;
52
+ /**
53
+ * Provider-interpreted raw import, consumed by finalize (Phase 2) to produce
54
+ * linked `ImportEdge[]`. The provider's `interpretImport` hook turns a
55
+ * `CaptureMatch` for an `@import.statement` into one of these; the central
56
+ * finalize algorithm resolves `targetRaw` to a concrete file via
57
+ * `resolveImportTarget` and materializes the final `ImportEdge`.
58
+ *
59
+ * Discriminated union — each variant carries only the fields that make sense
60
+ * for its kind. Invalid shapes (e.g., a `namespace` import with an alias-like
61
+ * `importedName` mismatch) are compile errors, not latent bugs. `'wildcard-
62
+ * expanded'` is deliberately NOT a variant: that kind is finalize output only,
63
+ * produced when `expandsWildcardTo` materializes a wildcard against target
64
+ * exports — a provider must never emit it at parse time.
65
+ */
66
+ export type ParsedImport =
67
+ /**
68
+ * Per-name import without rename.
69
+ *
70
+ * Examples:
71
+ * - Python `from foo import X` → `{ kind: 'named', localName: 'X', importedName: 'X', targetRaw: 'foo' }`
72
+ * - TS `import { X } from './foo'` → `{ kind: 'named', localName: 'X', importedName: 'X', targetRaw: './foo' }`
73
+ * - Java `import foo.bar.X` → `{ kind: 'named', localName: 'X', importedName: 'X', targetRaw: 'foo.bar' }`
74
+ */
75
+ {
76
+ readonly kind: 'named';
77
+ readonly localName: string;
78
+ readonly importedName: string;
79
+ readonly targetRaw: string;
80
+ }
81
+ /**
82
+ * Per-name import with rename.
83
+ *
84
+ * Examples:
85
+ * - Python `from foo import X as Y` → `{ kind: 'alias', localName: 'Y', importedName: 'X', alias: 'Y', targetRaw: 'foo' }`
86
+ * - TS `import { X as Y } from './foo'` → `{ kind: 'alias', localName: 'Y', importedName: 'X', alias: 'Y', targetRaw: './foo' }`
87
+ */
88
+ | {
89
+ readonly kind: 'alias';
90
+ readonly localName: string;
91
+ readonly importedName: string;
92
+ readonly alias: string;
93
+ readonly targetRaw: string;
94
+ }
95
+ /**
96
+ * Qualified module handle, with or without rename. `importedName` is the
97
+ * module being aliased; `localName` is the scope-visible handle (often the
98
+ * same unless renamed).
99
+ *
100
+ * Examples:
101
+ * - Python `import numpy` → `{ kind: 'namespace', localName: 'numpy', importedName: 'numpy', targetRaw: 'numpy' }`
102
+ * - Python `import numpy as np` → `{ kind: 'namespace', localName: 'np', importedName: 'numpy', targetRaw: 'numpy' }`
103
+ * - TS `import * as np from 'numpy'` → `{ kind: 'namespace', localName: 'np', importedName: 'numpy', targetRaw: 'numpy' }`
104
+ * - Go `import foo "pkg/bar"` → `{ kind: 'namespace', localName: 'foo', importedName: 'bar', targetRaw: 'pkg/bar' }`
105
+ */
106
+ | {
107
+ readonly kind: 'namespace';
108
+ /** Scope-visible handle (e.g. `np` in `import numpy as np`; `numpy` when unaliased). */
109
+ readonly localName: string;
110
+ /** Module being aliased (e.g. `numpy` in `import numpy as np`). */
111
+ readonly importedName: string;
112
+ readonly targetRaw: string;
113
+ }
114
+ /**
115
+ * Syntactically-detectable parse-time re-export. Finalize may still produce
116
+ * `ImportEdge { kind: 'reexport', transitiveVia }` when flattening chains;
117
+ * this variant preserves the *parse-time* signal so finalize doesn't have
118
+ * to re-derive it from scratch.
119
+ *
120
+ * Examples:
121
+ * - TS `export { X } from './y'` → `{ kind: 'reexport', localName: 'X', importedName: 'X', targetRaw: './y' }`
122
+ * - TS `export { X as Y } from './y'` → `{ kind: 'reexport', localName: 'Y', importedName: 'X', alias: 'Y', targetRaw: './y' }`
123
+ * - Rust `pub use foo::bar` → `{ kind: 'reexport', localName: 'bar', importedName: 'bar', targetRaw: 'foo' }`
124
+ */
125
+ | {
126
+ readonly kind: 'reexport';
127
+ /** Name as re-exported in the current module. */
128
+ readonly localName: string;
129
+ /** Name in the source module. */
130
+ readonly importedName: string;
131
+ readonly targetRaw: string;
132
+ /** Set when the re-export renames the symbol (e.g. `export { X as Y } from './y'`). */
133
+ readonly alias?: string;
134
+ }
135
+ /**
136
+ * Runtime-computed target — the import path is not a static literal at
137
+ * parse time. Providers SHOULD emit the unresolvable expression's source
138
+ * text as `targetRaw` to aid diagnostics; `null` only when no string form
139
+ * exists.
140
+ *
141
+ * Examples:
142
+ * - JS `await import(expr)` → `{ kind: 'dynamic-unresolved', localName: '', targetRaw: 'expr' }`
143
+ * - Python `importlib.import_module(f'pkg.{name}')` → `{ kind: 'dynamic-unresolved', localName: '', targetRaw: "f'pkg.{name}'" }`
144
+ */
145
+ | {
146
+ readonly kind: 'dynamic-unresolved';
147
+ readonly localName: string;
148
+ /** Source text of the unresolved expression when available; `null` otherwise. */
149
+ readonly targetRaw: string | null;
150
+ };
151
+ /**
152
+ * Provider-interpreted type binding. The provider's `interpretTypeBinding`
153
+ * hook turns a `CaptureMatch` (e.g., `@type-binding.parameter`) into one of
154
+ * these; the central extractor attaches the resulting `TypeRef` to the
155
+ * appropriate scope's `typeBindings` map.
156
+ */
157
+ export interface ParsedTypeBinding {
158
+ /** The name being bound (parameter name, `self`, assignment LHS, …). */
159
+ readonly boundName: string;
160
+ /** The raw type name as written in source (`'User'`, `'models.User'`, …). */
161
+ readonly rawTypeName: string;
162
+ readonly source: TypeRef['source'];
163
+ }
164
+ /**
165
+ * Cross-file workspace index consumed by finalize-phase hooks
166
+ * (`resolveImportTarget`, `expandsWildcardTo`). Opaque placeholder in Ring 1;
167
+ * concretely typed in Ring 2 SHARED (#915).
168
+ */
169
+ export type WorkspaceIndex = unknown;
170
+ /**
171
+ * Scope tree handle consumed by parse-phase hooks (`bindingScopeFor`,
172
+ * `importOwningScope`) to navigate the in-progress scope tree. Opaque
173
+ * placeholder in Ring 1; concretely typed in Ring 2 SHARED (#912).
174
+ */
175
+ export type ScopeTree = unknown;
176
+ /** Call-site description passed to `arityCompatibility`. */
177
+ export interface Callsite {
178
+ /** Number of arguments at the call site. */
179
+ readonly arity: number;
180
+ }
45
181
  /**
46
182
  * A cross-file import edge attached to a module/namespace scope.
47
183
  *
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/scope-resolution/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAI/D,4FAA4F;AAC5F,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC;AAE7B,0DAA0D;AAC1D,MAAM,MAAM,KAAK,GAAG,MAAM,CAAC;AAE3B,2DAA2D;AAC3D,MAAM,MAAM,SAAS,GACjB,QAAQ,GACR,WAAW,GACX,OAAO,GACP,UAAU,GACV,OAAO,GACP,YAAY,CAAC;AAIjB,qFAAqF;AACrF,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,OAAO;IACt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AE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CACvD"}
@@ -8,7 +8,7 @@
8
8
  * The providers table in `languages/index.ts` uses `satisfies Record<SupportedLanguages, LanguageProvider>`
9
9
  * so adding a language to the enum without creating a provider is a compiler error.
10
10
  */
11
- import type { SupportedLanguages, MroStrategy } from '../../_shared/index.js';
11
+ import type { SupportedLanguages, MroStrategy, Capture, CaptureMatch, BindingRef, TypeRef, Scope, ScopeId, ScopeKind, ScopeTree, ParsedImport, ParsedTypeBinding, SymbolDefinition, Callsite, WorkspaceIndex } from '../../_shared/index.js';
12
12
  import type { LanguageTypeConfig } from './type-extractors/types.js';
13
13
  import type { CallRouter } from './call-routing.js';
14
14
  import type { CallExtractor, DispatchDecision, ImplicitReceiverOverride, ReceiverEnriched } from './call-types.js';
@@ -222,6 +222,177 @@ interface LanguageProviderConfig {
222
222
  /** Built-in/stdlib names that should be filtered from the call graph for this language.
223
223
  * Default: undefined (no language-specific filtering). */
224
224
  readonly builtInNames?: ReadonlySet<string>;
225
+ /**
226
+ * Emit scope captures from raw source. Tree-sitter-based providers run a
227
+ * `scopes.scm` query; standalone providers (COBOL) emit captures from a
228
+ * regex tagger. The return shape is parser-agnostic: the central
229
+ * `ScopeExtractor` consumes `Capture[]` without knowing which parser
230
+ * produced them.
231
+ *
232
+ * Required for any provider participating in scope-based resolution.
233
+ * Providers that have not yet migrated continue to run through the legacy
234
+ * DAG path (feature-flagged per `REGISTRY_PRIMARY_<LANG>`).
235
+ *
236
+ * Default: undefined (language continues to use legacy DAG).
237
+ */
238
+ readonly emitScopeCaptures?: (sourceText: string, filePath: string) => Promise<readonly Capture[]>;
239
+ /**
240
+ * Interpret a raw `@import.statement` capture group into a `ParsedImport`.
241
+ * The central finalize algorithm resolves `ParsedImport.targetRaw` to a
242
+ * concrete file via `resolveImportTarget` and materializes the final
243
+ * `ImportEdge` with `targetModuleScope` / `targetDefId` filled in.
244
+ *
245
+ * Required when `emitScopeCaptures` is implemented.
246
+ */
247
+ readonly interpretImport?: (captures: CaptureMatch) => ParsedImport | null;
248
+ /**
249
+ * What is the implicit receiver on a Function scope? For instance methods
250
+ * this is `self`/`this`; for standalone functions it is `null`. Consulted
251
+ * by `Registry.lookup` Step 2 via the `resolveTypeRef` helper.
252
+ *
253
+ * Required for any language with method dispatch (OO semantics).
254
+ *
255
+ * Default: undefined (treated as `null` — no implicit receiver).
256
+ */
257
+ readonly receiverBinding?: (functionScope: Scope) => TypeRef | null;
258
+ /**
259
+ * Interpret a raw type-binding capture (parameter annotation, `self`,
260
+ * assignment with constructor RHS, …) into a `ParsedTypeBinding`. The
261
+ * central extractor attaches the resulting `TypeRef` to the appropriate
262
+ * scope's `typeBindings` map.
263
+ *
264
+ * Default: undefined (falls back to `{ boundName: captures.name, rawTypeName: captures.type, source: 'annotation' }`).
265
+ */
266
+ readonly interpretTypeBinding?: (captures: CaptureMatch) => ParsedTypeBinding | null;
267
+ /**
268
+ * Override the `ScopeKind` assigned to a scope capture. Use when the
269
+ * capture name alone can't resolve the kind (e.g., tree-sitter captures
270
+ * a `block` that is semantically an `Expression` in this language).
271
+ *
272
+ * Default: undefined (the central extractor uses the capture name's
273
+ * suffix — `@scope.function` → `'Function'`, etc.).
274
+ */
275
+ readonly resolveScopeKind?: (captures: CaptureMatch) => ScopeKind | null;
276
+ /**
277
+ * Should this scope capture materialize as a real `Scope` node? Return
278
+ * `false` to skip scope creation while still emitting declarations that
279
+ * would have gone inside (they attach to the enclosing real scope).
280
+ *
281
+ * Example: Python `if`/`for`/`while` bodies capture as `@scope.block` but
282
+ * Python has no block scope — hook returns `false` and child declarations
283
+ * lift to the enclosing function/module.
284
+ *
285
+ * Default: undefined (treated as `true` — always create).
286
+ */
287
+ readonly shouldCreateScope?: (captures: CaptureMatch) => boolean;
288
+ /**
289
+ * Override where a declaration's name becomes visible. By default the name
290
+ * is bound in the innermost enclosing scope; return a different `ScopeId`
291
+ * to hoist it (JS `var` → enclosing function scope; Ruby `def` inside
292
+ * `begin` → enclosing class scope).
293
+ *
294
+ * Return `null` to delegate to the central default (innermost enclosing
295
+ * scope). This matches the `X | null` convention used by the other optional
296
+ * hooks and supports partial overrides — e.g., a JS provider can return a
297
+ * hoisted scope for `var` declarations and `null` for `let`/`const`, without
298
+ * re-implementing the default lookup.
299
+ *
300
+ * **Purity:** must be a pure function of its inputs — same parameters must
301
+ * yield the same `ScopeId` (or `null`) across invocations. No closure over
302
+ * mutable state. Required so scope-tree construction stays deterministic
303
+ * across re-parses.
304
+ *
305
+ * Default: undefined (the central extractor uses `innermostScope.id`).
306
+ */
307
+ readonly bindingScopeFor?: (declCapture: CaptureMatch, innermostScope: Scope, scopeTree: ScopeTree) => ScopeId | null;
308
+ /**
309
+ * Resolve a `ParsedImport.targetRaw` expression to a concrete file path in
310
+ * the workspace. Language-specific resolution: Python relative imports,
311
+ * JS package.json + node_modules, Go module paths, Java classpath,
312
+ * COBOL COPY paths. Ports today's per-language import resolver.
313
+ *
314
+ * Required when `emitScopeCaptures` is implemented. Ring 2 PKG #922
315
+ * provides the adapter that bridges today's resolver shape to this hook.
316
+ */
317
+ readonly resolveImportTarget?: (parsedImport: ParsedImport, workspaceIndex: WorkspaceIndex) => string | null;
318
+ /**
319
+ * Enumerate the exported names of a file — used by the finalize algorithm
320
+ * to expand `import * from M` into individual `BindingRef`s with
321
+ * `origin: 'wildcard'`.
322
+ *
323
+ * Default: undefined (central finalize walks the target file's
324
+ * `ExportMap.keys()`).
325
+ */
326
+ readonly expandsWildcardTo?: (targetFile: string, workspaceIndex: WorkspaceIndex) => readonly string[];
327
+ /**
328
+ * Decide the scope to which a `ParsedImport` attaches. Most languages
329
+ * attach imports to the nearest enclosing `Module`/`Namespace` scope
330
+ * (the default); some languages allow local imports (Python function-local
331
+ * `from x import Y`, Rust fn-local `use`, TS dynamic `import()`) — return
332
+ * a `Function`/`Block` scope id instead.
333
+ *
334
+ * Return `null` to delegate to the central default (nearest enclosing
335
+ * `Module`/`Namespace`). This matches the `X | null` convention used by
336
+ * the other optional hooks and supports partial overrides — a provider
337
+ * that handles only specific import forms non-standardly can `return null`
338
+ * for the common cases and let the central walk handle them.
339
+ *
340
+ * **Purity:** must be a pure function of its inputs — same parameters must
341
+ * yield the same `ScopeId` (or `null`) across invocations. No closure over
342
+ * mutable state. Required so scope-tree construction stays deterministic
343
+ * across re-parses.
344
+ *
345
+ * Default: undefined (central finalize walks to the nearest enclosing
346
+ * `Module` or `Namespace` scope).
347
+ */
348
+ readonly importOwningScope?: (parsedImport: ParsedImport, innermostScope: Scope, scopeTree: ScopeTree) => ScopeId | null;
349
+ /**
350
+ * Merge local declarations and imported bindings for a single (scope, name)
351
+ * during finalize materialization of a scope's binding table. Language-
352
+ * specific precedence: Python local hides import; TypeScript namespace
353
+ * merging keeps both; Ruby constant resolution has its own rules.
354
+ *
355
+ * Default: undefined (central finalize uses local-first-then-imports,
356
+ * deduping by `DefId`).
357
+ */
358
+ readonly mergeBindings?: (scope: Scope, bindings: readonly BindingRef[]) => readonly BindingRef[];
359
+ /**
360
+ * Classify a `@reference.call` capture as free / member / constructor /
361
+ * index. Preferred path is declarative via capture sub-tags
362
+ * (`@reference.call.free`, etc.); this hook handles the languages where
363
+ * call form can't be decided statically (Ruby bare `foo(x)` is free-or-
364
+ * member until resolved).
365
+ *
366
+ * Default: undefined (central extractor reads capture sub-tag if present;
367
+ * else treats as `'free'`).
368
+ */
369
+ readonly classifyCallForm?: (captures: CaptureMatch, enclosingScope: Scope) => 'free' | 'member' | 'constructor' | 'index';
370
+ /**
371
+ * Does a binding at this scope shadow bindings of the same name in outer
372
+ * scopes? Default: any binding shadows (standard lexical scoping). Return
373
+ * `false` for transparent-scope edge cases (Python `from x import *`
374
+ * contexts, JS `var` hoisting quirks, COBOL PARAGRAPH transparency).
375
+ *
376
+ * Consulted by `Registry.lookup` Step 1 and by `resolveTypeRef` for
377
+ * shadowing decisions during the lexical chain walk.
378
+ *
379
+ * Default: undefined (treated as `true` — any binding shadows).
380
+ */
381
+ readonly shouldShadow?: (scope: Scope, bindings: readonly BindingRef[]) => boolean;
382
+ /**
383
+ * Is this callable definition compatible with the given call-site arity?
384
+ * Language-specific rules: Python `*args`/`**kwargs`/defaults, JS default
385
+ * params + rest, Kotlin vararg + defaults, Ruby optional/splat/block, Go
386
+ * straight counts, Rust no-variadic-no-defaults.
387
+ *
388
+ * `'incompatible'` is a soft penalty (−0.15 per EvidenceWeights) and is
389
+ * filtered only when at least one `'compatible'` candidate exists;
390
+ * otherwise the incompatible candidate is kept with the penalty so the
391
+ * call-site still links to a best-guess target.
392
+ *
393
+ * Default: undefined (treated as `'unknown'` — no signal either way).
394
+ */
395
+ readonly arityCompatibility?: (def: SymbolDefinition, callsite: Callsite) => 'compatible' | 'unknown' | 'incompatible';
225
396
  }
226
397
  /** Runtime type — same as LanguageProviderConfig but with defaults guaranteed present. */
227
398
  export interface LanguageProvider extends Omit<LanguageProviderConfig, 'importSemantics' | 'heritageDefaultEdge' | 'mroStrategy'> {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gitnexus",
3
- "version": "1.6.3-rc.2",
3
+ "version": "1.6.3-rc.3",
4
4
  "description": "Graph-powered code intelligence for AI agents. Index any codebase, query via MCP or CLI.",
5
5
  "author": "Abhigyan Patwari",
6
6
  "license": "PolyForm-Noncommercial-1.0.0",