Skip to content

armgit / Ix

Public Imported from GitHub
0

Understand any codebase instantly. System intelligence for codebases, built for humans and AI.

feat: generalize edge resolver to handle REFERENCES and EXTENDS alongside CALLS

Joseph Mikhail84161e668205
diff --git a/.claude/settings.json b/.claude/settings.json
index b6637478..b82e602c 100644
--- a/.claude/settings.json
+++ b/.claude/settings.json
@@ -10,5 +10,8 @@
"IX_ENDPOINT": "http://localhost:8090"
}
}
+ },
+ "permissions": {
+ "allow": ["Bash(*)", "Read(*)", "Edit(*)", "Write(*)"]
}
}
diff --git a/core-ingestion/dist/index.d.ts b/core-ingestion/dist/index.d.ts
index 9106e75c..62c9325f 100644
--- a/core-ingestion/dist/index.d.ts
+++ b/core-ingestion/dist/index.d.ts
@@ -30,28 +30,42 @@ export interface ResolvedCallEdge {
calleeQualifiedKey: string;
confidence: number;
}
+/** Generalised form of ResolvedCallEdge that covers any cross-file edge predicate. */
+export interface ResolvedEdge {
+ srcFilePath: string;
+ srcName: string;
+ dstFilePath: string;
+ dstName: string;
+ dstQualifiedKey: string;
+ predicate: string;
+ confidence: number;
+}
/**
- * Resolves CALLS relationships to their cross-file targets by building a
- * symbol table and import map over the full batch of parsed files.
+ * Resolves CALLS and EXTENDS relationships to their cross-file targets by
+ * building a symbol table and import map over the full batch of parsed files.
*
* Tiers (in priority order):
- * 0.9 — import-scoped: callee is in a file the caller explicitly imports
- * 0.5 — global fallback: callee exists in exactly one other file (unambiguous)
+ * 0.9 — import-scoped: dst is in a file the src explicitly imports
+ * 0.8 — transitive import-scoped: one re-export hop away
+ * 0.5 — global fallback: dst exists in exactly one other file (unambiguous)
*
- * Same-file calls (tier 0.95) are already handled correctly by buildPatch and
- * are not emitted here.
+ * Same-file edges are already handled correctly by buildPatch and are not
+ * emitted here.
*
* Import resolution handles:
* - Stem-based: './payments' → 'payments.ts'
* - Path-aliased: '@/lib/payments' → 'payments.ts' (last segment)
* - Directory index: './services' → 'services/index.ts'
* - Bare aliases: '@components' → 'components.ts' (strip leading non-word chars)
- * '~lib' → 'lib.ts'
- * - External bare: 'react' → unresolved (no match in batch)
+ * - Dotted paths: 'ix.memory.model.Edge' → stem 'Edge' → 'Edge.scala'
+ * (handles Scala/Java package imports where tree-sitter
+ * emits each identifier separately)
*
* Qualified-key resolution:
- * - Module-level function: calleeQualifiedKey === calleeName
- * - Unambiguous class method: calleeQualifiedKey === 'ClassName.method'
- * - Ambiguous (two classes define same method name): edge not emitted
+ * - Module-level function/class: dstQualifiedKey === dstName
+ * - Unambiguous class method: dstQualifiedKey === 'ClassName.method'
+ * - Ambiguous (two entities share the same plain name): edge not emitted
*/
+export declare function resolveEdges(results: FileParseResult[]): ResolvedEdge[];
+/** @deprecated Use resolveEdges instead. */
export declare function resolveCallEdges(results: FileParseResult[]): ResolvedCallEdge[];
diff --git a/core-ingestion/dist/index.js b/core-ingestion/dist/index.js
index fbd8a4c7..32c011f6 100644
--- a/core-ingestion/dist/index.js
+++ b/core-ingestion/dist/index.js
@@ -69,6 +69,33 @@ const DEFINITION_KIND_MAP = {
'definition.annotation': 'class',
'definition.constructor': 'method',
};
+// Primitive / built-in types to exclude from REFERENCES edges
+const TYPE_BUILTINS = new Set([
+ // TypeScript / JavaScript
+ 'string', 'number', 'boolean', 'void', 'null', 'undefined', 'any', 'never',
+ 'unknown', 'object', 'bigint', 'symbol',
+ // Java / Kotlin / Scala
+ 'String', 'Integer', 'Long', 'Double', 'Float', 'Boolean', 'Byte', 'Short',
+ 'Character', 'Object', 'Void', 'Int', 'Unit', 'Any', 'AnyVal', 'AnyRef',
+ 'Nothing', 'Null', 'Char', 'Number',
+ // C#
+ 'decimal',
+ // Python
+ 'int', 'str', 'float', 'bool', 'bytes', 'Optional', 'Union', 'List', 'Dict',
+ 'Set', 'Tuple', 'Type',
+ // Rust
+ 'i8', 'i16', 'i32', 'i64', 'i128', 'u8', 'u16', 'u32', 'u64', 'u128',
+ 'f32', 'f64', 'usize', 'isize',
+ // Go
+ 'int8', 'int16', 'int32', 'int64', 'uint8', 'uint16', 'uint32', 'uint64',
+ 'float32', 'float64', 'byte', 'rune', 'error',
+ // Common stdlib collections / wrappers
+ 'Array', 'Map', 'Seq', 'Vector', 'Option', 'Future', 'Promise', 'Result',
+ 'Either', 'Try', 'IO', 'Observable', 'Iterator', 'Iterable',
+ // C / C++
+ 'size_t', 'uint8_t', 'uint16_t', 'uint32_t', 'uint64_t', 'int8_t',
+ 'int16_t', 'int32_t', 'int64_t',
+]);
// Builtins to exclude from CALLS edges
const BUILTINS = new Set([
'print', 'println', 'len', 'range', 'int', 'str', 'float', 'list', 'dict',
@@ -132,6 +159,8 @@ export function parseFile(filePath, source) {
const classRanges = [];
// Track seen calls per enclosing scope to avoid duplicate CALLS edges
const seenCalls = new Map();
+ // Track seen type references per enclosing class/file to avoid duplicate REFERENCES edges
+ const seenRefs = new Map();
// --- First pass: collect definitions ---
for (const match of matches) {
// Definition captures: name + definition.*
@@ -191,7 +220,38 @@ export function parseFile(filePath, source) {
}
// --- Second pass: calls and imports ---
for (const match of matches) {
- // Import captures
+ // Full import statement captures (Scala: reconstructs dotted package paths)
+ const importStmt = match.captures.find((c) => c.name === 'import.stmt');
+ if (importStmt) {
+ const raw = importStmt.node.text.replace(/^import\s+/, '').trim();
+ const line = importStmt.node.startPosition.row + 1;
+ if (raw.endsWith('._')) {
+ // Wildcard: "ix.memory.model._" → package path "ix.memory.model"
+ const pkgPath = raw.slice(0, -2);
+ entities.push({ name: pkgPath, kind: 'module', lineStart: line, lineEnd: line, language });
+ relationships.push({ srcName: fileName, dstName: pkgPath, predicate: 'IMPORTS' });
+ }
+ else {
+ const braceIdx = raw.lastIndexOf('.{');
+ if (braceIdx !== -1) {
+ // Selective: "ix.memory.model.{NodeKind, GraphNode}"
+ const prefix = raw.slice(0, braceIdx);
+ const names = raw.slice(braceIdx + 2, -1).split(',').map((s) => s.trim()).filter(Boolean);
+ for (const name of names) {
+ const dstName = `${prefix}.${name}`;
+ entities.push({ name: dstName, kind: 'module', lineStart: line, lineEnd: line, language });
+ relationships.push({ srcName: fileName, dstName, predicate: 'IMPORTS' });
+ }
+ }
+ else {
+ // Simple: "ix.memory.model.NodeKind"
+ entities.push({ name: raw, kind: 'module', lineStart: line, lineEnd: line, language });
+ relationships.push({ srcName: fileName, dstName: raw, predicate: 'IMPORTS' });
+ }
+ }
+ continue;
+ }
+ // Import captures (JS/TS/Python path-based)
const importSource = match.captures.find((c) => c.name === 'import.source');
if (importSource) {
let importPath = importSource.node.text
@@ -223,16 +283,46 @@ export function parseFile(filePath, source) {
const callee = callName.node.text;
if (!callee || BUILTINS.has(callee) || callee.length <= 1)
continue;
- // Find enclosing function/method for the call
+ // Find enclosing function/method for the call; fall back to enclosing class
+ // (e.g. calls in val/lazy val body at class level) before falling back to file.
const callLine = callName.node.startPosition.row + 1;
- const caller = findEnclosingFunction(entities, callLine) ?? fileName;
+ const caller = findEnclosingFunction(entities, callLine)
+ ?? findEnclosing(classRanges, callLine, '')
+ ?? fileName;
const scope = caller;
if (!seenCalls.has(scope))
seenCalls.set(scope, new Set());
const seen = seenCalls.get(scope);
- if (!seen.has(callee)) {
- seen.add(callee);
- relationships.push({ srcName: caller, dstName: callee, predicate: 'CALLS' });
+ // If a _qualifier capture is present (field_expression / stable_identifier
+ // patterns like NodeKind.Decision), emit the fully qualified name so that
+ // resolution can use the qualifier to break ties between same-named symbols
+ // in different files (e.g. NodeKind.Decision vs SourceType.Decision).
+ const qualifierCapture = match.captures.find((c) => c.name === '_qualifier');
+ const effectiveCallee = qualifierCapture
+ ? `${qualifierCapture.node.text}.${callee}`
+ : callee;
+ if (!seen.has(effectiveCallee)) {
+ seen.add(effectiveCallee);
+ relationships.push({ srcName: caller, dstName: effectiveCallee, predicate: 'CALLS' });
+ }
+ continue;
+ }
+ // Type reference captures
+ const refType = match.captures.find((c) => c.name === 'reference.type');
+ if (refType) {
+ const typeName = refType.node.text;
+ if (!typeName || TYPE_BUILTINS.has(typeName) || typeName.length <= 1)
+ continue;
+ // Use the enclosing class as the src so the edge reads "ClassX REFERENCES TypeY".
+ // Fall back to the file name when no enclosing class is found (top-level usage).
+ const refLine = refType.node.startPosition.row + 1;
+ const src = findEnclosing(classRanges, refLine, typeName) ?? fileName;
+ if (!seenRefs.has(src))
+ seenRefs.set(src, new Set());
+ const seen = seenRefs.get(src);
+ if (!seen.has(typeName)) {
+ seen.add(typeName);
+ relationships.push({ srcName: src, dstName: typeName, predicate: 'REFERENCES' });
}
continue;
}
@@ -256,34 +346,36 @@ function qualifiedKey(e) {
* Callers must treat null as "do not emit" to avoid dangling nodeIds.
*/
function bestQKey(fileQKeys, filePath, plainName) {
- const qks = fileQKeys.get(filePath)?.get(plainName) ?? [];
+ const qks = [...new Set(fileQKeys.get(filePath)?.get(plainName) ?? [])];
return qks.length === 1 ? qks[0] : null;
}
/**
- * Resolves CALLS relationships to their cross-file targets by building a
- * symbol table and import map over the full batch of parsed files.
+ * Resolves CALLS and EXTENDS relationships to their cross-file targets by
+ * building a symbol table and import map over the full batch of parsed files.
*
* Tiers (in priority order):
- * 0.9 — import-scoped: callee is in a file the caller explicitly imports
- * 0.5 — global fallback: callee exists in exactly one other file (unambiguous)
+ * 0.9 — import-scoped: dst is in a file the src explicitly imports
+ * 0.8 — transitive import-scoped: one re-export hop away
+ * 0.5 — global fallback: dst exists in exactly one other file (unambiguous)
*
- * Same-file calls (tier 0.95) are already handled correctly by buildPatch and
- * are not emitted here.
+ * Same-file edges are already handled correctly by buildPatch and are not
+ * emitted here.
*
* Import resolution handles:
* - Stem-based: './payments' → 'payments.ts'
* - Path-aliased: '@/lib/payments' → 'payments.ts' (last segment)
* - Directory index: './services' → 'services/index.ts'
* - Bare aliases: '@components' → 'components.ts' (strip leading non-word chars)
- * '~lib' → 'lib.ts'
- * - External bare: 'react' → unresolved (no match in batch)
+ * - Dotted paths: 'ix.memory.model.Edge' → stem 'Edge' → 'Edge.scala'
+ * (handles Scala/Java package imports where tree-sitter
+ * emits each identifier separately)
*
* Qualified-key resolution:
- * - Module-level function: calleeQualifiedKey === calleeName
- * - Unambiguous class method: calleeQualifiedKey === 'ClassName.method'
- * - Ambiguous (two classes define same method name): edge not emitted
+ * - Module-level function/class: dstQualifiedKey === dstName
+ * - Unambiguous class method: dstQualifiedKey === 'ClassName.method'
+ * - Ambiguous (two entities share the same plain name): edge not emitted
*/
-export function resolveCallEdges(results) {
+export function resolveEdges(results) {
// fileQKeys: filePath → (plainName → qualifiedKeys[])
// Mirrors the entityQKey computation in buildPatch so nodeIds match exactly.
const fileQKeys = new Map();
@@ -306,8 +398,6 @@ export function resolveCallEdges(results) {
}
// stemToFiles: basename-without-extension → filePath[]
// Matches the last path segment of an import to files in the batch.
- // e.g. './payments' → modName 'payments' → 'payments.ts'
- // '@/lib/payments' → modName 'payments' → 'payments.ts'
const stemToFiles = new Map();
for (const r of results) {
const stem = nodePath.basename(r.filePath, nodePath.extname(r.filePath));
@@ -327,34 +417,77 @@ export function resolveCallEdges(results) {
dirToIndexFiles.set(dirName, list);
}
}
+ // packageToFiles: dotted package path → filePath[] (Scala/Java wildcard imports)
+ // e.g. "ix.memory.model" → all .scala files under .../ix/memory/model/
+ // Builds all suffix keys so that both "model" and "ix.memory.model" resolve.
+ const packageToFiles = new Map();
+ for (const r of results) {
+ const ext = nodePath.extname(r.filePath);
+ if (ext !== '.scala' && ext !== '.java')
+ continue;
+ const dir = nodePath.dirname(r.filePath);
+ const parts = dir.split(/[/\\]/);
+ // Cap at 8 segments to avoid noise from very shallow path components like "src", "main".
+ const maxDepth = Math.min(8, parts.length);
+ for (let i = parts.length - 1; i >= parts.length - maxDepth; i--) {
+ const pkg = parts.slice(i).join('.');
+ const list = packageToFiles.get(pkg) ?? [];
+ if (!list.includes(r.filePath))
+ list.push(r.filePath);
+ packageToFiles.set(pkg, list);
+ }
+ }
+ /** Resolve a module name to matching file paths in the batch. */
+ function modNameToFiles(modName, excludeFp) {
+ const fps = [];
+ // Strip leading non-word chars for bare aliases: '@components' → 'components'
+ const candidates = [modName];
+ const stripped = modName.replace(/^[^a-zA-Z0-9_]+/, '');
+ if (stripped && stripped !== modName)
+ candidates.push(stripped);
+ // Strip file extensions so "explain.js" resolves to the "explain" stem
+ // (TS/JS ESM imports use .js extensions that map to .ts source files)
+ const noExt = modName.replace(/\.(js|ts|mjs|cjs|jsx|tsx|py|scala|java)$/, '');
+ if (noExt !== modName && noExt && !candidates.includes(noExt))
+ candidates.push(noExt);
+ // For dotted paths (Scala/Java: 'ix.memory.model.Edge'), also try last segment
+ const lastDot = modName.lastIndexOf('.');
+ if (lastDot !== -1) {
+ const lastSegment = modName.slice(lastDot + 1);
+ if (lastSegment && !candidates.includes(lastSegment))
+ candidates.push(lastSegment);
+ }
+ for (const cand of candidates) {
+ for (const fp of stemToFiles.get(cand) ?? []) {
+ if (fp !== excludeFp)
+ fps.push(fp);
+ }
+ for (const fp of dirToIndexFiles.get(cand) ?? []) {
+ if (fp !== excludeFp)
+ fps.push(fp);
+ }
+ }
+ // Package-path wildcard resolution (Scala/Java): "ix.memory.model" → all files in that dir
+ for (const fp of packageToFiles.get(modName) ?? []) {
+ if (fp !== excludeFp && !fps.includes(fp))
+ fps.push(fp);
+ }
+ return fps;
+ }
const resolved = [];
for (const result of results) {
- const callerFilePath = result.filePath;
- const callerSymbols = fileHasSymbol.get(callerFilePath);
- // Build the set of file paths this caller explicitly imports.
- // For each IMPORTS edge, try the modName as-is, then with leading
- // non-word characters stripped (handles bare aliases: '@components' → 'components',
- // '~lib' → 'lib', '#utils' → 'utils').
+ const srcFilePath = result.filePath;
+ const srcSymbols = fileHasSymbol.get(srcFilePath);
+ // Build the set of file paths this file explicitly imports.
const importedFilePaths = new Set();
for (const rel of result.relationships) {
if (rel.predicate !== 'IMPORTS')
continue;
- const candidates = [rel.dstName];
- const stripped = rel.dstName.replace(/^[^a-zA-Z0-9_]+/, '');
- if (stripped && stripped !== rel.dstName)
- candidates.push(stripped);
- for (const modName of candidates) {
- for (const fp of stemToFiles.get(modName) ?? []) {
- if (fp !== callerFilePath)
- importedFilePaths.add(fp);
- }
- for (const fp of dirToIndexFiles.get(modName) ?? []) {
- if (fp !== callerFilePath)
- importedFilePaths.add(fp);
- }
+ for (const fp of modNameToFiles(rel.dstName, srcFilePath)) {
+ importedFilePaths.add(fp);
}
}
- // Build one-hop transitive import set: files imported by directly-imported files.
+ // Build one-hop transitive import set.
// Handles re-exports: baz.ts → index.ts (re-exports from bar.ts) → bar.ts
const transitiveFilePaths = new Set();
for (const fp of importedFilePaths) {
@@ -364,42 +497,76 @@ export function resolveCallEdges(results) {
for (const rel of fpResult.relationships) {
if (rel.predicate !== 'IMPORTS')
continue;
- const candidates = [rel.dstName];
- const stripped = rel.dstName.replace(/^[^a-zA-Z0-9_]+/, '');
- if (stripped && stripped !== rel.dstName)
- candidates.push(stripped);
- for (const modName of candidates) {
- for (const transitiveFp of stemToFiles.get(modName) ?? []) {
- if (transitiveFp !== callerFilePath && !importedFilePaths.has(transitiveFp))
- transitiveFilePaths.add(transitiveFp);
- }
- for (const transitiveFp of dirToIndexFiles.get(modName) ?? []) {
- if (transitiveFp !== callerFilePath && !importedFilePaths.has(transitiveFp))
- transitiveFilePaths.add(transitiveFp);
- }
+ for (const transitiveFp of modNameToFiles(rel.dstName, srcFilePath)) {
+ if (!importedFilePaths.has(transitiveFp))
+ transitiveFilePaths.add(transitiveFp);
}
}
}
for (const rel of result.relationships) {
- if (rel.predicate !== 'CALLS')
+ if (rel.predicate !== 'CALLS' && rel.predicate !== 'EXTENDS' && rel.predicate !== 'REFERENCES')
continue;
- const calleeName = rel.dstName;
- const callerName = rel.srcName;
+ const dstName = rel.dstName;
+ const srcName = rel.srcName;
+ // Tier 1b: qualifier-assisted (confidence 0.9 / 0.7)
+ // For dotted names like "NodeKind.Decision" (emitted by field_expression queries):
+ // find the file defining the qualifier, then check it also defines the member.
+ // This breaks ties where both NodeKind.Decision and SourceType.Decision exist.
+ const qualDot = dstName.lastIndexOf('.');
+ if (qualDot !== -1) {
+ const qualifierPart = dstName.slice(0, qualDot);
+ const memberPart = dstName.slice(qualDot + 1);
+ if (memberPart && qualifierPart) {
+ // Try import-scoped qualifier first
+ const qualImportMatches = [];
+ for (const fp of importedFilePaths) {
+ if (fileHasSymbol.get(fp)?.has(qualifierPart))
+ qualImportMatches.push(fp);
+ }
+ if (qualImportMatches.length === 1) {
+ const qfp = qualImportMatches[0];
+ if (fileHasSymbol.get(qfp)?.has(memberPart)) {
+ const dstQualifiedKey = bestQKey(fileQKeys, qfp, memberPart);
+ if (dstQualifiedKey !== null) {
+ // dstName must match rel.dstName so buildPatchWithResolution can look it up
+ resolved.push({ srcFilePath, srcName, dstFilePath: qfp, dstName, dstQualifiedKey, predicate: rel.predicate, confidence: 0.9 });
+ }
+ }
+ continue;
+ }
+ // Global qualifier fallback
+ const qualGlobalMatches = [];
+ for (const [fp, symbols] of fileHasSymbol) {
+ if (fp !== srcFilePath && symbols.has(qualifierPart))
+ qualGlobalMatches.push(fp);
+ }
+ if (qualGlobalMatches.length === 1) {
+ const qfp = qualGlobalMatches[0];
+ if (fileHasSymbol.get(qfp)?.has(memberPart)) {
+ const dstQualifiedKey = bestQKey(fileQKeys, qfp, memberPart);
+ if (dstQualifiedKey !== null) {
+ resolved.push({ srcFilePath, srcName, dstFilePath: qfp, dstName, dstQualifiedKey, predicate: rel.predicate, confidence: 0.7 });
+ }
+ }
+ }
+ continue; // qualified name exhausted — don't try bare-name tiers
+ }
+ }
// Tier 1: same-file — already correct in buildPatch, skip here
- if (callerSymbols.has(calleeName))
+ if (srcSymbols.has(dstName))
continue;
// Tier 2: import-scoped (confidence 0.9)
const importMatches = [];
for (const fp of importedFilePaths) {
- if (fileHasSymbol.get(fp)?.has(calleeName))
+ if (fileHasSymbol.get(fp)?.has(dstName))
importMatches.push(fp);
}
if (importMatches.length === 1) {
const fp = importMatches[0];
- const calleeQualifiedKey = bestQKey(fileQKeys, fp, calleeName);
- if (calleeQualifiedKey === null)
- continue; // ambiguous class methods — do not emit bad nodeId
- resolved.push({ callerFilePath, callerName, calleeFilePath: fp, calleeName, calleeQualifiedKey, confidence: 0.9 });
+ const dstQualifiedKey = bestQKey(fileQKeys, fp, dstName);
+ if (dstQualifiedKey === null)
+ continue; // ambiguous — do not emit bad nodeId
+ resolved.push({ srcFilePath, srcName, dstFilePath: fp, dstName, dstQualifiedKey, predicate: rel.predicate, confidence: 0.9 });
continue;
}
if (importMatches.length > 1)
@@ -407,15 +574,15 @@ export function resolveCallEdges(results) {
// Tier 2.5: transitive import-scoped (confidence 0.8) — one re-export hop away
const transitiveMatches = [];
for (const fp of transitiveFilePaths) {
- if (fileHasSymbol.get(fp)?.has(calleeName))
+ if (fileHasSymbol.get(fp)?.has(dstName))
transitiveMatches.push(fp);
}
if (transitiveMatches.length === 1) {
const fp = transitiveMatches[0];
- const calleeQualifiedKey = bestQKey(fileQKeys, fp, calleeName);
- if (calleeQualifiedKey === null)
+ const dstQualifiedKey = bestQKey(fileQKeys, fp, dstName);
+ if (dstQualifiedKey === null)
continue;
- resolved.push({ callerFilePath, callerName, calleeFilePath: fp, calleeName, calleeQualifiedKey, confidence: 0.8 });
+ resolved.push({ srcFilePath, srcName, dstFilePath: fp, dstName, dstQualifiedKey, predicate: rel.predicate, confidence: 0.8 });
continue;
}
if (transitiveMatches.length > 1)
@@ -423,21 +590,32 @@ export function resolveCallEdges(results) {
// Tier 3: global fallback (confidence 0.5) — exactly one other file defines it
const globalMatches = [];
for (const [fp, symbols] of fileHasSymbol) {
- if (fp !== callerFilePath && symbols.has(calleeName))
+ if (fp !== srcFilePath && symbols.has(dstName))
globalMatches.push(fp);
}
if (globalMatches.length === 1) {
const fp = globalMatches[0];
- const calleeQualifiedKey = bestQKey(fileQKeys, fp, calleeName);
- if (calleeQualifiedKey === null)
- continue; // ambiguous class methods — do not emit bad nodeId
- resolved.push({ callerFilePath, callerName, calleeFilePath: fp, calleeName, calleeQualifiedKey, confidence: 0.5 });
+ const dstQualifiedKey = bestQKey(fileQKeys, fp, dstName);
+ if (dstQualifiedKey === null)
+ continue; // ambiguous — do not emit bad nodeId
+ resolved.push({ srcFilePath, srcName, dstFilePath: fp, dstName, dstQualifiedKey, predicate: rel.predicate, confidence: 0.5 });
}
// 0 or >1 global matches — leave as dangling edge, do not emit
}
}
return resolved;
}
+/** @deprecated Use resolveEdges instead. */
+export function resolveCallEdges(results) {
+ return resolveEdges(results).map(e => ({
+ callerFilePath: e.srcFilePath,
+ callerName: e.srcName,
+ calleeFilePath: e.dstFilePath,
+ calleeName: e.dstName,
+ calleeQualifiedKey: e.dstQualifiedKey,
+ confidence: e.confidence,
+ }));
+}
// ---------------------------------------------------------------------------
// Helpers
// ---------------------------------------------------------------------------
diff --git a/core-ingestion/dist/patch-builder.d.ts b/core-ingestion/dist/patch-builder.d.ts
index 181f65c5..828bef1c 100644
--- a/core-ingestion/dist/patch-builder.d.ts
+++ b/core-ingestion/dist/patch-builder.d.ts
@@ -1,4 +1,4 @@
import type { GraphPatchPayload } from './types.js';
-import type { FileParseResult, ResolvedCallEdge } from './index.js';
+import type { FileParseResult, ResolvedEdge } from './index.js';
export declare function buildPatch(result: FileParseResult, sourceHash: string, previousSourceHash?: string): GraphPatchPayload;
-export declare function buildPatchWithResolution(result: FileParseResult, sourceHash: string, resolvedEdges: ResolvedCallEdge[], previousSourceHash?: string): GraphPatchPayload;
+export declare function buildPatchWithResolution(result: FileParseResult, sourceHash: string, resolvedEdges: ResolvedEdge[], previousSourceHash?: string): GraphPatchPayload;
diff --git a/core-ingestion/dist/patch-builder.js b/core-ingestion/dist/patch-builder.js
index d82474f5..7c3efb59 100644
--- a/core-ingestion/dist/patch-builder.js
+++ b/core-ingestion/dist/patch-builder.js
@@ -31,7 +31,17 @@ function sourceType(filePath) {
return 'code';
}
function extractorName() {
- return `tree-sitter/1.0`;
+ return `tree-sitter/1.7`;
+}
+/** Previous extractor versions — their patches are superseded when re-ingesting. */
+const PREVIOUS_EXTRACTORS = ['tree-sitter/1.6', 'tree-sitter/1.5', 'tree-sitter/1.4', 'tree-sitter/1.3', 'tree-sitter/1.2', 'tree-sitter/1.1'];
+/** Compute a patchId for a (filePath, sourceHash, extractorVersion) triple. */
+function computePatchId(filePath, sourceHash, extractor) {
+ return deterministicId(`${filePath}:${sourceHash}:${extractor}`);
+}
+/** Compute the legacy patchId (pre-1.1 scheme, no extractor suffix). */
+function legacyPatchId(filePath, sourceHash) {
+ return deterministicId(`${filePath}:${sourceHash}`);
}
// ---------------------------------------------------------------------------
// Build a GraphPatchPayload from a FileParseResult
@@ -117,12 +127,16 @@ export function buildPatch(result, sourceHash, previousSourceHash) {
confidence: null,
});
}
- // patchId is deterministic: same file + same content → same id across runs.
- // This makes repeated ingestion idempotent at the patch level.
- const patchId = deterministicId(`${filePath}:${sourceHash}`);
+ // patchId is deterministic: same file + same content + same extractor → same id.
+ const extractor = extractorName();
+ const patchId = computePatchId(filePath, sourceHash, extractor);
+ // When re-ingesting with new extractor version, replace the old patch so the
+ // server accepts the new ops rather than deduplicating on the old patchId.
const previousPatchId = previousSourceHash
- ? deterministicId(`${filePath}:${previousSourceHash}`)
- : undefined;
+ ? computePatchId(filePath, previousSourceHash, extractor)
+ : legacyPatchId(filePath, sourceHash);
+ // Also supersede any patches created by previous extractor versions for the same file+content.
+ const replaces = [previousPatchId, ...PREVIOUS_EXTRACTORS.map(prev => computePatchId(filePath, sourceHash, prev))];
return {
patchId,
actor: 'ix/ingestion',
@@ -130,12 +144,12 @@ export function buildPatch(result, sourceHash, previousSourceHash) {
source: {
uri: filePath,
sourceHash,
- extractor: extractorName(),
+ extractor,
sourceType: sourceType(filePath),
},
baseRev: 0,
ops,
- replaces: previousPatchId ? [previousPatchId] : [],
+ replaces,
intent: `Parsed ${nodePath.basename(filePath)}`,
};
}
@@ -144,13 +158,13 @@ export function buildPatch(result, sourceHash, previousSourceHash) {
// to the actual defining file for cross-file calls resolved by resolveCallEdges.
// ---------------------------------------------------------------------------
export function buildPatchWithResolution(result, sourceHash, resolvedEdges, previousSourceHash) {
- // Build lookup: calleeName → { calleeFilePath, calleeQualifiedKey }
- const callResolution = new Map();
+ // Build lookup: `${predicate}:${dstName}` → { dstFilePath, dstQualifiedKey }
+ const edgeResolution = new Map();
for (const edge of resolvedEdges) {
- if (edge.callerFilePath === result.filePath) {
- callResolution.set(edge.calleeName, {
- calleeFilePath: edge.calleeFilePath,
- calleeQualifiedKey: edge.calleeQualifiedKey,
+ if (edge.srcFilePath === result.filePath) {
+ edgeResolution.set(`${edge.predicate}:${edge.dstName}`, {
+ dstFilePath: edge.dstFilePath,
+ dstQualifiedKey: edge.dstQualifiedKey,
});
}
}
@@ -197,11 +211,12 @@ export function buildPatchWithResolution(result, sourceHash, resolvedEdges, prev
const dstKey = r.predicate === 'CONTAINS'
? resolveKey(r.dstName, r.srcName)
: resolveKey(r.dstName);
- // For CALLS edges with a cross-file resolution, use the callee file's nodeId
+ // For cross-file resolved edges (CALLS, EXTENDS), use the defining file's nodeId
let dstNodeId;
- if (r.predicate === 'CALLS' && callResolution.has(r.dstName)) {
- const { calleeFilePath, calleeQualifiedKey } = callResolution.get(r.dstName);
- dstNodeId = nodeId(calleeFilePath, calleeQualifiedKey);
+ const resolutionKey = `${r.predicate}:${r.dstName}`;
+ if (edgeResolution.has(resolutionKey)) {
+ const { dstFilePath, dstQualifiedKey } = edgeResolution.get(resolutionKey);
+ dstNodeId = nodeId(dstFilePath, dstQualifiedKey);
}
else {
dstNodeId = nodeId(filePath, dstKey);
@@ -225,10 +240,12 @@ export function buildPatchWithResolution(result, sourceHash, resolvedEdges, prev
confidence: null,
});
}
- const patchId = deterministicId(`${filePath}:${sourceHash}`);
+ const extractor = extractorName();
+ const patchId = computePatchId(filePath, sourceHash, extractor);
const previousPatchId = previousSourceHash
- ? deterministicId(`${filePath}:${previousSourceHash}`)
- : undefined;
+ ? computePatchId(filePath, previousSourceHash, extractor)
+ : legacyPatchId(filePath, sourceHash);
+ const replaces = [previousPatchId, ...PREVIOUS_EXTRACTORS.map(prev => computePatchId(filePath, sourceHash, prev))];
return {
patchId,
actor: 'ix/ingestion',
@@ -236,12 +253,12 @@ export function buildPatchWithResolution(result, sourceHash, resolvedEdges, prev
source: {
uri: filePath,
sourceHash,
- extractor: extractorName(),
+ extractor,
sourceType: sourceType(filePath),
},
baseRev: 0,
ops,
- replaces: previousPatchId ? [previousPatchId] : [],
+ replaces,
intent: `Parsed ${nodePath.basename(filePath)}`,
};
}
diff --git a/core-ingestion/dist/queries.d.ts b/core-ingestion/dist/queries.d.ts
index b220058f..a906b149 100644
--- a/core-ingestion/dist/queries.d.ts
+++ b/core-ingestion/dist/queries.d.ts
@@ -1,16 +1,16 @@
import { SupportedLanguages } from './languages.js';
-export declare const TYPESCRIPT_QUERIES = "\n(class_declaration\n name: (type_identifier) @name) @definition.class\n\n(interface_declaration\n name: (type_identifier) @name) @definition.interface\n\n(function_declaration\n name: (identifier) @name) @definition.function\n\n(method_definition\n name: (property_identifier) @name) @definition.method\n\n(lexical_declaration\n (variable_declarator\n name: (identifier) @name\n value: (arrow_function))) @definition.function\n\n(lexical_declaration\n (variable_declarator\n name: (identifier) @name\n value: (function_expression))) @definition.function\n\n(export_statement\n declaration: (lexical_declaration\n (variable_declarator\n name: (identifier) @name\n value: (arrow_function)))) @definition.function\n\n(export_statement\n declaration: (lexical_declaration\n (variable_declarator\n name: (identifier) @name\n value: (function_expression)))) @definition.function\n\n(import_statement\n source: (string) @import.source) @import\n\n; Re-export statements: export { X } from './y'\n(export_statement\n source: (string) @import.source) @import\n\n; Dynamic import with string literal: import('./foo') or await import('./foo')\n(call_expression\n function: (import)\n arguments: (arguments (string) @import.source)) @import\n\n(call_expression\n function: (identifier) @call.name) @call\n\n(call_expression\n function: (member_expression\n property: (property_identifier) @call.name)) @call\n\n; Constructor calls: new Foo()\n(new_expression\n constructor: (identifier) @call.name) @call\n\n; Heritage queries - class extends\n(class_declaration\n name: (type_identifier) @heritage.class\n (class_heritage\n (extends_clause\n value: (identifier) @heritage.extends))) @heritage\n\n; Heritage queries - class implements interface\n(class_declaration\n name: (type_identifier) @heritage.class\n (class_heritage\n (implements_clause\n (type_identifier) @heritage.implements))) @heritage.impl\n";
+export declare const TYPESCRIPT_QUERIES = "\n(class_declaration\n name: (type_identifier) @name) @definition.class\n\n(interface_declaration\n name: (type_identifier) @name) @definition.interface\n\n(function_declaration\n name: (identifier) @name) @definition.function\n\n(method_definition\n name: (property_identifier) @name) @definition.method\n\n(lexical_declaration\n (variable_declarator\n name: (identifier) @name\n value: (arrow_function))) @definition.function\n\n(lexical_declaration\n (variable_declarator\n name: (identifier) @name\n value: (function_expression))) @definition.function\n\n(export_statement\n declaration: (lexical_declaration\n (variable_declarator\n name: (identifier) @name\n value: (arrow_function)))) @definition.function\n\n(export_statement\n declaration: (lexical_declaration\n (variable_declarator\n name: (identifier) @name\n value: (function_expression)))) @definition.function\n\n(import_statement\n source: (string) @import.source) @import\n\n; Re-export statements: export { X } from './y'\n(export_statement\n source: (string) @import.source) @import\n\n; Dynamic import with string literal: import('./foo') or await import('./foo')\n(call_expression\n function: (import)\n arguments: (arguments (string) @import.source)) @import\n\n(call_expression\n function: (identifier) @call.name) @call\n\n(call_expression\n function: (member_expression\n property: (property_identifier) @call.name)) @call\n\n; Constructor calls: new Foo()\n(new_expression\n constructor: (identifier) @call.name) @call\n\n; Heritage queries - class extends\n(class_declaration\n name: (type_identifier) @heritage.class\n (class_heritage\n (extends_clause\n value: (identifier) @heritage.extends))) @heritage\n\n; Heritage queries - class implements interface\n(class_declaration\n name: (type_identifier) @heritage.class\n (class_heritage\n (implements_clause\n (type_identifier) @heritage.implements))) @heritage.impl\n\n; Heritage queries - interface extends interface\n(interface_declaration\n name: (type_identifier) @heritage.class\n (extends_type_clause\n (type_identifier) @heritage.extends)) @heritage\n\n; Type references \u2014 captures types used in annotations/parameters/return types\n(type_annotation (type_identifier) @reference.type)\n";
export declare const JAVASCRIPT_QUERIES = "\n(class_declaration\n name: (identifier) @name) @definition.class\n\n(function_declaration\n name: (identifier) @name) @definition.function\n\n(method_definition\n name: (property_identifier) @name) @definition.method\n\n(lexical_declaration\n (variable_declarator\n name: (identifier) @name\n value: (arrow_function))) @definition.function\n\n(lexical_declaration\n (variable_declarator\n name: (identifier) @name\n value: (function_expression))) @definition.function\n\n(export_statement\n declaration: (lexical_declaration\n (variable_declarator\n name: (identifier) @name\n value: (arrow_function)))) @definition.function\n\n(export_statement\n declaration: (lexical_declaration\n (variable_declarator\n name: (identifier) @name\n value: (function_expression)))) @definition.function\n\n(import_statement\n source: (string) @import.source) @import\n\n; Re-export statements: export { X } from './y'\n(export_statement\n source: (string) @import.source) @import\n\n; Dynamic import with string literal: import('./foo') or await import('./foo')\n(call_expression\n function: (import)\n arguments: (arguments (string) @import.source)) @import\n\n(call_expression\n function: (identifier) @call.name) @call\n\n(call_expression\n function: (member_expression\n property: (property_identifier) @call.name)) @call\n\n; Constructor calls: new Foo()\n(new_expression\n constructor: (identifier) @call.name) @call\n\n; Heritage queries - class extends (JavaScript uses different AST than TypeScript)\n; In tree-sitter-javascript, class_heritage directly contains the parent identifier\n(class_declaration\n name: (identifier) @heritage.class\n (class_heritage\n (identifier) @heritage.extends)) @heritage\n";
-export declare const PYTHON_QUERIES = "\n(class_definition\n name: (identifier) @name) @definition.class\n\n(function_definition\n name: (identifier) @name) @definition.function\n\n(import_statement\n name: (dotted_name) @import.source) @import\n\n(import_from_statement\n module_name: (dotted_name) @import.source) @import\n\n(import_from_statement\n module_name: (relative_import) @import.source) @import\n\n; from . import utils / from .models import User \u2014 also capture the imported symbol names\n(import_from_statement\n module_name: (relative_import)\n name: (dotted_name (identifier) @import.name)) @import.names\n\n(call\n function: (identifier) @call.name) @call\n\n(call\n function: (attribute\n attribute: (identifier) @call.name)) @call\n\n; Heritage queries - Python class inheritance\n(class_definition\n name: (identifier) @heritage.class\n superclasses: (argument_list\n (identifier) @heritage.extends)) @heritage\n";
-export declare const JAVA_QUERIES = "\n; Classes, Interfaces, Enums, Annotations\n(class_declaration name: (identifier) @name) @definition.class\n(interface_declaration name: (identifier) @name) @definition.interface\n(enum_declaration name: (identifier) @name) @definition.enum\n(annotation_type_declaration name: (identifier) @name) @definition.annotation\n\n; Methods & Constructors\n(method_declaration name: (identifier) @name) @definition.method\n(constructor_declaration name: (identifier) @name) @definition.constructor\n\n; Imports - capture any import declaration child as source\n(import_declaration (_) @import.source) @import\n\n; Calls\n(method_invocation name: (identifier) @call.name) @call\n(method_invocation object: (_) name: (identifier) @call.name) @call\n\n; Constructor calls: new Foo()\n(object_creation_expression type: (type_identifier) @call.name) @call\n\n; Heritage - extends class\n(class_declaration name: (identifier) @heritage.class\n (superclass (type_identifier) @heritage.extends)) @heritage\n\n; Heritage - implements interfaces\n(class_declaration name: (identifier) @heritage.class\n (super_interfaces (type_list (type_identifier) @heritage.implements))) @heritage.impl\n";
-export declare const C_QUERIES = "\n; Functions (direct declarator)\n(function_definition declarator: (function_declarator declarator: (identifier) @name)) @definition.function\n(declaration declarator: (function_declarator declarator: (identifier) @name)) @definition.function\n\n; Functions returning pointers (pointer_declarator wraps function_declarator)\n(function_definition declarator: (pointer_declarator declarator: (function_declarator declarator: (identifier) @name))) @definition.function\n(declaration declarator: (pointer_declarator declarator: (function_declarator declarator: (identifier) @name))) @definition.function\n\n; Functions returning double pointers (nested pointer_declarator)\n(function_definition declarator: (pointer_declarator declarator: (pointer_declarator declarator: (function_declarator declarator: (identifier) @name)))) @definition.function\n\n; Structs, Unions, Enums, Typedefs\n(struct_specifier name: (type_identifier) @name) @definition.struct\n(union_specifier name: (type_identifier) @name) @definition.union\n(enum_specifier name: (type_identifier) @name) @definition.enum\n(type_definition declarator: (type_identifier) @name) @definition.typedef\n\n; Macros\n(preproc_function_def name: (identifier) @name) @definition.macro\n(preproc_def name: (identifier) @name) @definition.macro\n\n; Includes\n(preproc_include path: (_) @import.source) @import\n\n; Calls\n(call_expression function: (identifier) @call.name) @call\n(call_expression function: (field_expression field: (field_identifier) @call.name)) @call\n";
-export declare const GO_QUERIES = "\n; Functions & Methods\n(function_declaration name: (identifier) @name) @definition.function\n(method_declaration name: (field_identifier) @name) @definition.method\n\n; Types\n(type_declaration (type_spec name: (type_identifier) @name type: (struct_type))) @definition.struct\n(type_declaration (type_spec name: (type_identifier) @name type: (interface_type))) @definition.interface\n\n; Imports\n(import_declaration (import_spec path: (interpreted_string_literal) @import.source)) @import\n(import_declaration (import_spec_list (import_spec path: (interpreted_string_literal) @import.source))) @import\n\n; Struct embedding (anonymous fields = inheritance)\n(type_declaration\n (type_spec\n name: (type_identifier) @heritage.class\n type: (struct_type\n (field_declaration_list\n (field_declaration\n type: (type_identifier) @heritage.extends))))) @definition.struct\n\n; Calls\n(call_expression function: (identifier) @call.name) @call\n(call_expression function: (selector_expression field: (field_identifier) @call.name)) @call\n\n; Struct literal construction: User{Name: \"Alice\"}\n(composite_literal type: (type_identifier) @call.name) @call\n";
-export declare const CPP_QUERIES = "\n; Classes, Structs, Namespaces\n(class_specifier name: (type_identifier) @name) @definition.class\n(struct_specifier name: (type_identifier) @name) @definition.struct\n(namespace_definition name: (namespace_identifier) @name) @definition.namespace\n(enum_specifier name: (type_identifier) @name) @definition.enum\n\n; Typedefs and unions (common in C-style headers and mixed C/C++ code)\n(type_definition declarator: (type_identifier) @name) @definition.typedef\n(union_specifier name: (type_identifier) @name) @definition.union\n\n; Macros\n(preproc_function_def name: (identifier) @name) @definition.macro\n(preproc_def name: (identifier) @name) @definition.macro\n\n; Functions & Methods (direct declarator)\n(function_definition declarator: (function_declarator declarator: (identifier) @name)) @definition.function\n(function_definition declarator: (function_declarator declarator: (qualified_identifier name: (identifier) @name))) @definition.method\n\n; Functions/methods returning pointers (pointer_declarator wraps function_declarator)\n(function_definition declarator: (pointer_declarator declarator: (function_declarator declarator: (identifier) @name))) @definition.function\n(function_definition declarator: (pointer_declarator declarator: (function_declarator declarator: (qualified_identifier name: (identifier) @name)))) @definition.method\n\n; Functions/methods returning double pointers (nested pointer_declarator)\n(function_definition declarator: (pointer_declarator declarator: (pointer_declarator declarator: (function_declarator declarator: (identifier) @name)))) @definition.function\n(function_definition declarator: (pointer_declarator declarator: (pointer_declarator declarator: (function_declarator declarator: (qualified_identifier name: (identifier) @name))))) @definition.method\n\n; Functions/methods returning references (reference_declarator wraps function_declarator)\n(function_definition declarator: (reference_declarator (function_declarator declarator: (identifier) @name))) @definition.function\n(function_definition declarator: (reference_declarator (function_declarator declarator: (qualified_identifier name: (identifier) @name)))) @definition.method\n\n; Destructors (destructor_name is distinct from identifier in tree-sitter-cpp)\n(function_definition declarator: (function_declarator declarator: (qualified_identifier name: (destructor_name) @name))) @definition.method\n\n; Function declarations / prototypes (common in headers)\n(declaration declarator: (function_declarator declarator: (identifier) @name)) @definition.function\n(declaration declarator: (pointer_declarator declarator: (function_declarator declarator: (identifier) @name))) @definition.function\n\n; Inline class method declarations (inside class body, no body: void Foo();)\n(field_declaration declarator: (function_declarator declarator: (identifier) @name)) @definition.method\n\n; Inline class method definitions (inside class body, with body: void Foo() { ... })\n(field_declaration_list\n (function_definition\n declarator: (function_declarator\n declarator: [(field_identifier) (identifier) (operator_name) (destructor_name)] @name)) @definition.method)\n\n; Templates\n(template_declaration (class_specifier name: (type_identifier) @name)) @definition.template\n(template_declaration (function_definition declarator: (function_declarator declarator: (identifier) @name))) @definition.template\n\n; Includes\n(preproc_include path: (_) @import.source) @import\n\n; Calls\n(call_expression function: (identifier) @call.name) @call\n(call_expression function: (field_expression field: (field_identifier) @call.name)) @call\n(call_expression function: (qualified_identifier name: (identifier) @call.name)) @call\n(call_expression function: (template_function name: (identifier) @call.name)) @call\n\n; Constructor calls: new User()\n(new_expression type: (type_identifier) @call.name) @call\n\n; Heritage\n(class_specifier name: (type_identifier) @heritage.class\n (base_class_clause (type_identifier) @heritage.extends)) @heritage\n(class_specifier name: (type_identifier) @heritage.class\n (base_class_clause (access_specifier) (type_identifier) @heritage.extends)) @heritage\n";
-export declare const CSHARP_QUERIES = "\n; Types\n(class_declaration name: (identifier) @name) @definition.class\n(interface_declaration name: (identifier) @name) @definition.interface\n(struct_declaration name: (identifier) @name) @definition.struct\n(enum_declaration name: (identifier) @name) @definition.enum\n(record_declaration name: (identifier) @name) @definition.record\n(delegate_declaration name: (identifier) @name) @definition.delegate\n\n; Namespaces (block form and C# 10+ file-scoped form)\n(namespace_declaration name: (identifier) @name) @definition.namespace\n(namespace_declaration name: (qualified_name) @name) @definition.namespace\n(file_scoped_namespace_declaration name: (identifier) @name) @definition.namespace\n(file_scoped_namespace_declaration name: (qualified_name) @name) @definition.namespace\n\n; Methods & Properties\n(method_declaration name: (identifier) @name) @definition.method\n(local_function_statement name: (identifier) @name) @definition.function\n(constructor_declaration name: (identifier) @name) @definition.constructor\n(property_declaration name: (identifier) @name) @definition.property\n\n; Primary constructors (C# 12): class User(string name, int age) { }\n(class_declaration name: (identifier) @name (parameter_list) @definition.constructor)\n(record_declaration name: (identifier) @name (parameter_list) @definition.constructor)\n\n; Using\n(using_directive (qualified_name) @import.source) @import\n(using_directive (identifier) @import.source) @import\n\n; Calls\n(invocation_expression function: (identifier) @call.name) @call\n(invocation_expression function: (member_access_expression name: (identifier) @call.name)) @call\n\n; Null-conditional method calls: user?.Save()\n; Parses as: invocation_expression \u2192 conditional_access_expression \u2192 member_binding_expression \u2192 identifier\n(invocation_expression\n function: (conditional_access_expression\n (member_binding_expression\n (identifier) @call.name))) @call\n\n; Constructor calls: new Foo() and new Foo { Props }\n(object_creation_expression type: (identifier) @call.name) @call\n\n; Target-typed new (C# 9): User u = new(\"x\", 5)\n(variable_declaration type: (identifier) @call.name (variable_declarator (implicit_object_creation_expression) @call))\n\n; Heritage\n(class_declaration name: (identifier) @heritage.class\n (base_list (identifier) @heritage.extends)) @heritage\n(class_declaration name: (identifier) @heritage.class\n (base_list (generic_name (identifier) @heritage.extends))) @heritage\n";
-export declare const RUST_QUERIES = "\n; Functions & Items\n(function_item name: (identifier) @name) @definition.function\n(struct_item name: (type_identifier) @name) @definition.struct\n(enum_item name: (type_identifier) @name) @definition.enum\n(trait_item name: (type_identifier) @name) @definition.trait\n(impl_item type: (type_identifier) @name !trait) @definition.impl\n(impl_item type: (generic_type type: (type_identifier) @name) !trait) @definition.impl\n(mod_item name: (identifier) @name) @definition.module\n\n; Type aliases, const, static, macros\n(type_item name: (type_identifier) @name) @definition.type\n(const_item name: (identifier) @name) @definition.const\n(static_item name: (identifier) @name) @definition.static\n(macro_definition name: (identifier) @name) @definition.macro\n\n; Use statements\n(use_declaration argument: (_) @import.source) @import\n\n; Calls\n(call_expression function: (identifier) @call.name) @call\n(call_expression function: (field_expression field: (field_identifier) @call.name)) @call\n(call_expression function: (scoped_identifier name: (identifier) @call.name)) @call\n(call_expression function: (generic_function function: (identifier) @call.name)) @call\n\n; Struct literal construction: User { name: value }\n(struct_expression name: (type_identifier) @call.name) @call\n\n; Heritage (trait implementation) \u2014 all combinations of concrete/generic trait \u00D7 concrete/generic type\n(impl_item trait: (type_identifier) @heritage.trait type: (type_identifier) @heritage.class) @heritage\n(impl_item trait: (generic_type type: (type_identifier) @heritage.trait) type: (type_identifier) @heritage.class) @heritage\n(impl_item trait: (type_identifier) @heritage.trait type: (generic_type type: (type_identifier) @heritage.class)) @heritage\n(impl_item trait: (generic_type type: (type_identifier) @heritage.trait) type: (generic_type type: (type_identifier) @heritage.class)) @heritage\n";
-export declare const PHP_QUERIES = "\n; \u2500\u2500 Namespace \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(namespace_definition\n name: (namespace_name) @name) @definition.namespace\n\n; \u2500\u2500 Classes \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(class_declaration\n name: (name) @name) @definition.class\n\n; \u2500\u2500 Interfaces \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(interface_declaration\n name: (name) @name) @definition.interface\n\n; \u2500\u2500 Traits \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(trait_declaration\n name: (name) @name) @definition.trait\n\n; \u2500\u2500 Enums (PHP 8.1) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(enum_declaration\n name: (name) @name) @definition.enum\n\n; \u2500\u2500 Top-level functions \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(function_definition\n name: (name) @name) @definition.function\n\n; \u2500\u2500 Methods (including constructors) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(method_declaration\n name: (name) @name) @definition.method\n\n; \u2500\u2500 Class properties (including Eloquent $fillable, $casts, etc.) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(property_declaration\n (property_element\n (variable_name\n (name) @name))) @definition.property\n\n; \u2500\u2500 Imports: use statements \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n; Simple: use App\\Models\\User;\n(namespace_use_declaration\n (namespace_use_clause\n (qualified_name) @import.source)) @import\n\n; \u2500\u2500 Function/method calls \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n; Regular function call: foo()\n(function_call_expression\n function: (name) @call.name) @call\n\n; Method call: $obj->method()\n(member_call_expression\n name: (name) @call.name) @call\n\n; Nullsafe method call: $obj?->method()\n(nullsafe_member_call_expression\n name: (name) @call.name) @call\n\n; Static call: Foo::bar() (php_only uses scoped_call_expression)\n(scoped_call_expression\n name: (name) @call.name) @call\n\n; Constructor call: new User()\n(object_creation_expression (name) @call.name) @call\n\n; \u2500\u2500 Heritage: extends \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(class_declaration\n name: (name) @heritage.class\n (base_clause\n [(name) (qualified_name)] @heritage.extends)) @heritage\n\n; \u2500\u2500 Heritage: implements \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(class_declaration\n name: (name) @heritage.class\n (class_interface_clause\n [(name) (qualified_name)] @heritage.implements)) @heritage.impl\n\n; \u2500\u2500 Heritage: use trait (must capture enclosing class name) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(class_declaration\n name: (name) @heritage.class\n body: (declaration_list\n (use_declaration\n [(name) (qualified_name)] @heritage.trait))) @heritage\n";
+export declare const PYTHON_QUERIES = "\n(class_definition\n name: (identifier) @name) @definition.class\n\n(function_definition\n name: (identifier) @name) @definition.function\n\n(import_statement\n name: (dotted_name) @import.source) @import\n\n(import_from_statement\n module_name: (dotted_name) @import.source) @import\n\n(import_from_statement\n module_name: (relative_import) @import.source) @import\n\n; from . import utils / from .models import User \u2014 also capture the imported symbol names\n(import_from_statement\n module_name: (relative_import)\n name: (dotted_name (identifier) @import.name)) @import.names\n\n(call\n function: (identifier) @call.name) @call\n\n(call\n function: (attribute\n attribute: (identifier) @call.name)) @call\n\n; Heritage queries - Python class inheritance\n(class_definition\n name: (identifier) @heritage.class\n superclasses: (argument_list\n (identifier) @heritage.extends)) @heritage\n\n; Type references \u2014 captures types used in type annotations / hints\n(typed_parameter type: (identifier) @reference.type)\n(typed_default_parameter type: (identifier) @reference.type)\n";
+export declare const JAVA_QUERIES = "\n; Classes, Interfaces, Enums, Annotations\n(class_declaration name: (identifier) @name) @definition.class\n(interface_declaration name: (identifier) @name) @definition.interface\n(enum_declaration name: (identifier) @name) @definition.enum\n(annotation_type_declaration name: (identifier) @name) @definition.annotation\n\n; Methods & Constructors\n(method_declaration name: (identifier) @name) @definition.method\n(constructor_declaration name: (identifier) @name) @definition.constructor\n\n; Imports - capture any import declaration child as source\n(import_declaration (_) @import.source) @import\n\n; Calls\n(method_invocation name: (identifier) @call.name) @call\n(method_invocation object: (_) name: (identifier) @call.name) @call\n\n; Constructor calls: new Foo()\n(object_creation_expression type: (type_identifier) @call.name) @call\n\n; Heritage - extends class\n(class_declaration name: (identifier) @heritage.class\n (superclass (type_identifier) @heritage.extends)) @heritage\n\n; Heritage - implements interfaces\n(class_declaration name: (identifier) @heritage.class\n (super_interfaces (type_list (type_identifier) @heritage.implements))) @heritage.impl\n\n; Type references \u2014 captures types used in field/param/return-type positions\n(field_declaration type: (type_identifier) @reference.type)\n(formal_parameter type: (type_identifier) @reference.type)\n(local_variable_declaration type: (type_identifier) @reference.type)\n(method_declaration type: (type_identifier) @reference.type)\n";
+export declare const C_QUERIES = "\n; Functions (direct declarator)\n(function_definition declarator: (function_declarator declarator: (identifier) @name)) @definition.function\n(declaration declarator: (function_declarator declarator: (identifier) @name)) @definition.function\n\n; Functions returning pointers (pointer_declarator wraps function_declarator)\n(function_definition declarator: (pointer_declarator declarator: (function_declarator declarator: (identifier) @name))) @definition.function\n(declaration declarator: (pointer_declarator declarator: (function_declarator declarator: (identifier) @name))) @definition.function\n\n; Functions returning double pointers (nested pointer_declarator)\n(function_definition declarator: (pointer_declarator declarator: (pointer_declarator declarator: (function_declarator declarator: (identifier) @name)))) @definition.function\n\n; Structs, Unions, Enums, Typedefs\n(struct_specifier name: (type_identifier) @name) @definition.struct\n(union_specifier name: (type_identifier) @name) @definition.union\n(enum_specifier name: (type_identifier) @name) @definition.enum\n(type_definition declarator: (type_identifier) @name) @definition.typedef\n\n; Macros\n(preproc_function_def name: (identifier) @name) @definition.macro\n(preproc_def name: (identifier) @name) @definition.macro\n\n; Includes\n(preproc_include path: (_) @import.source) @import\n\n; Calls\n(call_expression function: (identifier) @call.name) @call\n(call_expression function: (field_expression field: (field_identifier) @call.name)) @call\n\n; Type references \u2014 captures types used in declaration/parameter positions\n(declaration type: (type_identifier) @reference.type)\n(parameter_declaration type: (type_identifier) @reference.type)\n";
+export declare const GO_QUERIES = "\n; Functions & Methods\n(function_declaration name: (identifier) @name) @definition.function\n(method_declaration name: (field_identifier) @name) @definition.method\n\n; Types\n(type_declaration (type_spec name: (type_identifier) @name type: (struct_type))) @definition.struct\n(type_declaration (type_spec name: (type_identifier) @name type: (interface_type))) @definition.interface\n\n; Imports\n(import_declaration (import_spec path: (interpreted_string_literal) @import.source)) @import\n(import_declaration (import_spec_list (import_spec path: (interpreted_string_literal) @import.source))) @import\n\n; Struct embedding (anonymous fields = inheritance)\n(type_declaration\n (type_spec\n name: (type_identifier) @heritage.class\n type: (struct_type\n (field_declaration_list\n (field_declaration\n type: (type_identifier) @heritage.extends))))) @definition.struct\n\n; Calls\n(call_expression function: (identifier) @call.name) @call\n(call_expression function: (selector_expression field: (field_identifier) @call.name)) @call\n\n; Struct literal construction: User{Name: \"Alice\"}\n(composite_literal type: (type_identifier) @call.name) @call\n\n; Type references \u2014 captures types used in field/param/return-type positions\n(field_declaration type: (type_identifier) @reference.type)\n(parameter_declaration type: (type_identifier) @reference.type)\n(result type: (type_identifier) @reference.type)\n";
+export declare const CPP_QUERIES = "\n; Classes, Structs, Namespaces\n(class_specifier name: (type_identifier) @name) @definition.class\n(struct_specifier name: (type_identifier) @name) @definition.struct\n(namespace_definition name: (namespace_identifier) @name) @definition.namespace\n(enum_specifier name: (type_identifier) @name) @definition.enum\n\n; Typedefs and unions (common in C-style headers and mixed C/C++ code)\n(type_definition declarator: (type_identifier) @name) @definition.typedef\n(union_specifier name: (type_identifier) @name) @definition.union\n\n; Macros\n(preproc_function_def name: (identifier) @name) @definition.macro\n(preproc_def name: (identifier) @name) @definition.macro\n\n; Functions & Methods (direct declarator)\n(function_definition declarator: (function_declarator declarator: (identifier) @name)) @definition.function\n(function_definition declarator: (function_declarator declarator: (qualified_identifier name: (identifier) @name))) @definition.method\n\n; Functions/methods returning pointers (pointer_declarator wraps function_declarator)\n(function_definition declarator: (pointer_declarator declarator: (function_declarator declarator: (identifier) @name))) @definition.function\n(function_definition declarator: (pointer_declarator declarator: (function_declarator declarator: (qualified_identifier name: (identifier) @name)))) @definition.method\n\n; Functions/methods returning double pointers (nested pointer_declarator)\n(function_definition declarator: (pointer_declarator declarator: (pointer_declarator declarator: (function_declarator declarator: (identifier) @name)))) @definition.function\n(function_definition declarator: (pointer_declarator declarator: (pointer_declarator declarator: (function_declarator declarator: (qualified_identifier name: (identifier) @name))))) @definition.method\n\n; Functions/methods returning references (reference_declarator wraps function_declarator)\n(function_definition declarator: (reference_declarator (function_declarator declarator: (identifier) @name))) @definition.function\n(function_definition declarator: (reference_declarator (function_declarator declarator: (qualified_identifier name: (identifier) @name)))) @definition.method\n\n; Destructors (destructor_name is distinct from identifier in tree-sitter-cpp)\n(function_definition declarator: (function_declarator declarator: (qualified_identifier name: (destructor_name) @name))) @definition.method\n\n; Function declarations / prototypes (common in headers)\n(declaration declarator: (function_declarator declarator: (identifier) @name)) @definition.function\n(declaration declarator: (pointer_declarator declarator: (function_declarator declarator: (identifier) @name))) @definition.function\n\n; Inline class method declarations (inside class body, no body: void Foo();)\n(field_declaration declarator: (function_declarator declarator: (identifier) @name)) @definition.method\n\n; Inline class method definitions (inside class body, with body: void Foo() { ... })\n(field_declaration_list\n (function_definition\n declarator: (function_declarator\n declarator: [(field_identifier) (identifier) (operator_name) (destructor_name)] @name)) @definition.method)\n\n; Templates\n(template_declaration (class_specifier name: (type_identifier) @name)) @definition.template\n(template_declaration (function_definition declarator: (function_declarator declarator: (identifier) @name))) @definition.template\n\n; Includes\n(preproc_include path: (_) @import.source) @import\n\n; Calls\n(call_expression function: (identifier) @call.name) @call\n(call_expression function: (field_expression field: (field_identifier) @call.name)) @call\n(call_expression function: (qualified_identifier name: (identifier) @call.name)) @call\n(call_expression function: (template_function name: (identifier) @call.name)) @call\n\n; Constructor calls: new User()\n(new_expression type: (type_identifier) @call.name) @call\n\n; Heritage\n(class_specifier name: (type_identifier) @heritage.class\n (base_class_clause (type_identifier) @heritage.extends)) @heritage\n(class_specifier name: (type_identifier) @heritage.class\n (base_class_clause (access_specifier) (type_identifier) @heritage.extends)) @heritage\n\n; Type references \u2014 captures types used in declaration/parameter positions\n(declaration type: (type_identifier) @reference.type)\n(parameter_declaration type: (type_identifier) @reference.type)\n";
+export declare const CSHARP_QUERIES = "\n; Types\n(class_declaration name: (identifier) @name) @definition.class\n(interface_declaration name: (identifier) @name) @definition.interface\n(struct_declaration name: (identifier) @name) @definition.struct\n(enum_declaration name: (identifier) @name) @definition.enum\n(record_declaration name: (identifier) @name) @definition.record\n(delegate_declaration name: (identifier) @name) @definition.delegate\n\n; Namespaces (block form and C# 10+ file-scoped form)\n(namespace_declaration name: (identifier) @name) @definition.namespace\n(namespace_declaration name: (qualified_name) @name) @definition.namespace\n(file_scoped_namespace_declaration name: (identifier) @name) @definition.namespace\n(file_scoped_namespace_declaration name: (qualified_name) @name) @definition.namespace\n\n; Methods & Properties\n(method_declaration name: (identifier) @name) @definition.method\n(local_function_statement name: (identifier) @name) @definition.function\n(constructor_declaration name: (identifier) @name) @definition.constructor\n(property_declaration name: (identifier) @name) @definition.property\n\n; Primary constructors (C# 12): class User(string name, int age) { }\n(class_declaration name: (identifier) @name (parameter_list) @definition.constructor)\n(record_declaration name: (identifier) @name (parameter_list) @definition.constructor)\n\n; Using\n(using_directive (qualified_name) @import.source) @import\n(using_directive (identifier) @import.source) @import\n\n; Calls\n(invocation_expression function: (identifier) @call.name) @call\n(invocation_expression function: (member_access_expression name: (identifier) @call.name)) @call\n\n; Null-conditional method calls: user?.Save()\n; Parses as: invocation_expression \u2192 conditional_access_expression \u2192 member_binding_expression \u2192 identifier\n(invocation_expression\n function: (conditional_access_expression\n (member_binding_expression\n (identifier) @call.name))) @call\n\n; Constructor calls: new Foo() and new Foo { Props }\n(object_creation_expression type: (identifier) @call.name) @call\n\n; Target-typed new (C# 9): User u = new(\"x\", 5)\n(variable_declaration type: (identifier) @call.name (variable_declarator (implicit_object_creation_expression) @call))\n\n; Heritage\n(class_declaration name: (identifier) @heritage.class\n (base_list (identifier) @heritage.extends)) @heritage\n(class_declaration name: (identifier) @heritage.class\n (base_list (generic_name (identifier) @heritage.extends))) @heritage\n\n; Type references \u2014 captures types used in field/param/return-type positions\n(parameter type: (identifier) @reference.type)\n(variable_declaration type: (identifier) @reference.type)\n(field_declaration type: (identifier) @reference.type)\n(method_declaration return_type: (identifier) @reference.type)\n";
+export declare const RUST_QUERIES = "\n; Functions & Items\n(function_item name: (identifier) @name) @definition.function\n(struct_item name: (type_identifier) @name) @definition.struct\n(enum_item name: (type_identifier) @name) @definition.enum\n(trait_item name: (type_identifier) @name) @definition.trait\n(impl_item type: (type_identifier) @name !trait) @definition.impl\n(impl_item type: (generic_type type: (type_identifier) @name) !trait) @definition.impl\n(mod_item name: (identifier) @name) @definition.module\n\n; Type aliases, const, static, macros\n(type_item name: (type_identifier) @name) @definition.type\n(const_item name: (identifier) @name) @definition.const\n(static_item name: (identifier) @name) @definition.static\n(macro_definition name: (identifier) @name) @definition.macro\n\n; Use statements\n(use_declaration argument: (_) @import.source) @import\n\n; Calls\n(call_expression function: (identifier) @call.name) @call\n(call_expression function: (field_expression field: (field_identifier) @call.name)) @call\n(call_expression function: (scoped_identifier name: (identifier) @call.name)) @call\n(call_expression function: (generic_function function: (identifier) @call.name)) @call\n\n; Struct literal construction: User { name: value }\n(struct_expression name: (type_identifier) @call.name) @call\n\n; Type references \u2014 captures types used in field/param/return-type positions\n(field_declaration type: (type_identifier) @reference.type)\n(parameter pattern: (_) type: (type_identifier) @reference.type)\n(function_item return_type: (type_identifier) @reference.type)\n\n; Heritage (trait implementation) \u2014 all combinations of concrete/generic trait \u00D7 concrete/generic type\n(impl_item trait: (type_identifier) @heritage.trait type: (type_identifier) @heritage.class) @heritage\n(impl_item trait: (generic_type type: (type_identifier) @heritage.trait) type: (type_identifier) @heritage.class) @heritage\n(impl_item trait: (type_identifier) @heritage.trait type: (generic_type type: (type_identifier) @heritage.class)) @heritage\n(impl_item trait: (generic_type type: (type_identifier) @heritage.trait) type: (generic_type type: (type_identifier) @heritage.class)) @heritage\n";
+export declare const PHP_QUERIES = "\n; \u2500\u2500 Namespace \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(namespace_definition\n name: (namespace_name) @name) @definition.namespace\n\n; \u2500\u2500 Classes \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(class_declaration\n name: (name) @name) @definition.class\n\n; \u2500\u2500 Interfaces \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(interface_declaration\n name: (name) @name) @definition.interface\n\n; \u2500\u2500 Traits \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(trait_declaration\n name: (name) @name) @definition.trait\n\n; \u2500\u2500 Enums (PHP 8.1) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(enum_declaration\n name: (name) @name) @definition.enum\n\n; \u2500\u2500 Top-level functions \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(function_definition\n name: (name) @name) @definition.function\n\n; \u2500\u2500 Methods (including constructors) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(method_declaration\n name: (name) @name) @definition.method\n\n; \u2500\u2500 Class properties (including Eloquent $fillable, $casts, etc.) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(property_declaration\n (property_element\n (variable_name\n (name) @name))) @definition.property\n\n; \u2500\u2500 Imports: use statements \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n; Simple: use App\\Models\\User;\n(namespace_use_declaration\n (namespace_use_clause\n (qualified_name) @import.source)) @import\n\n; \u2500\u2500 Function/method calls \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n; Regular function call: foo()\n(function_call_expression\n function: (name) @call.name) @call\n\n; Method call: $obj->method()\n(member_call_expression\n name: (name) @call.name) @call\n\n; Nullsafe method call: $obj?->method()\n(nullsafe_member_call_expression\n name: (name) @call.name) @call\n\n; Static call: Foo::bar() (php_only uses scoped_call_expression)\n(scoped_call_expression\n name: (name) @call.name) @call\n\n; Constructor call: new User()\n(object_creation_expression (name) @call.name) @call\n\n; \u2500\u2500 Heritage: extends \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(class_declaration\n name: (name) @heritage.class\n (base_clause\n [(name) (qualified_name)] @heritage.extends)) @heritage\n\n; \u2500\u2500 Heritage: implements \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(class_declaration\n name: (name) @heritage.class\n (class_interface_clause\n [(name) (qualified_name)] @heritage.implements)) @heritage.impl\n\n; \u2500\u2500 Heritage: use trait (must capture enclosing class name) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(class_declaration\n name: (name) @heritage.class\n body: (declaration_list\n (use_declaration\n [(name) (qualified_name)] @heritage.trait))) @heritage\n\n; \u2500\u2500 Type references \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(named_type (name) @reference.type)\n";
export declare const RUBY_QUERIES = "\n; \u2500\u2500 Modules \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(module\n name: (constant) @name) @definition.module\n\n; \u2500\u2500 Classes \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(class\n name: (constant) @name) @definition.class\n\n; \u2500\u2500 Instance methods \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(method\n name: (identifier) @name) @definition.method\n\n; \u2500\u2500 Singleton (class-level) methods \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(singleton_method\n name: (identifier) @name) @definition.method\n\n; \u2500\u2500 Require / require_relative \u2192 IMPORTS \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n; Capture the string argument so the second pass emits an IMPORTS edge.\n(call\n method: (identifier) @_req\n arguments: (argument_list\n (string (string_content) @import.source))\n (#match? @_req \"^require\")) @import\n\n; \u2500\u2500 All other calls \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(call\n method: (identifier) @call.name) @call\n\n; \u2500\u2500 Bare calls without parens (identifiers at statement level are method calls) \u2500\n; NOTE: This may over-capture variable reads as calls (e.g. 'result' at\n; statement level). Ruby's grammar makes bare identifiers ambiguous \u2014 they\n; could be local variables or zero-arity method calls. Post-processing via\n; the BUILTINS set suppresses most false positives.\n(body_statement\n (identifier) @call.name @call)\n\n; \u2500\u2500 Heritage: class < SuperClass \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(class\n name: (constant) @heritage.class\n superclass: (superclass\n (constant) @heritage.extends)) @heritage\n";
-export declare const KOTLIN_QUERIES = "\n; \u2500\u2500 Interfaces \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n; tree-sitter-kotlin (fwcd) has no interface_declaration node type.\n; Interfaces are class_declaration nodes with an anonymous \"interface\" keyword child.\n(class_declaration\n \"interface\"\n (type_identifier) @name) @definition.interface\n\n; \u2500\u2500 Classes (regular, data, sealed, enum) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n; All have the anonymous \"class\" keyword child. enum class has both\n; \"enum\" and \"class\" children \u2014 the \"class\" child still matches.\n(class_declaration\n \"class\"\n (type_identifier) @name) @definition.class\n\n; \u2500\u2500 Object declarations (Kotlin singletons) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(object_declaration\n (type_identifier) @name) @definition.class\n\n; \u2500\u2500 Companion objects (named only) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(companion_object\n (type_identifier) @name) @definition.class\n\n; \u2500\u2500 Functions (top-level, member, extension) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(function_declaration\n (simple_identifier) @name) @definition.function\n\n; \u2500\u2500 Properties \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(property_declaration\n (variable_declaration\n (simple_identifier) @name)) @definition.property\n\n; \u2500\u2500 Enum entries \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(enum_entry\n (simple_identifier) @name) @definition.enum\n\n; \u2500\u2500 Type aliases \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(type_alias\n (type_identifier) @name) @definition.type\n\n; \u2500\u2500 Imports \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(import_header\n (identifier) @import.source) @import\n\n; \u2500\u2500 Function calls (direct) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(call_expression\n (simple_identifier) @call.name) @call\n\n; \u2500\u2500 Method calls (via navigation: obj.method()) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(call_expression\n (navigation_expression\n (navigation_suffix\n (simple_identifier) @call.name))) @call\n\n; \u2500\u2500 Constructor invocations \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(constructor_invocation\n (user_type\n (type_identifier) @call.name)) @call\n\n; \u2500\u2500 Infix function calls (e.g., a to b, x until y) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(infix_expression\n (simple_identifier) @call.name) @call\n\n; \u2500\u2500 Heritage: extends / implements via delegation_specifier \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n; Interface implementation (bare user_type): class Foo : Bar\n(class_declaration\n (type_identifier) @heritage.class\n (delegation_specifier\n (user_type (type_identifier) @heritage.extends))) @heritage\n\n; Class extension (constructor_invocation): class Foo : Bar()\n(class_declaration\n (type_identifier) @heritage.class\n (delegation_specifier\n (constructor_invocation\n (user_type (type_identifier) @heritage.extends)))) @heritage\n";
-export declare const SWIFT_QUERIES = "\n; Classes\n(class_declaration \"class\" name: (type_identifier) @name) @definition.class\n\n; Structs\n(class_declaration \"struct\" name: (type_identifier) @name) @definition.struct\n\n; Enums\n(class_declaration \"enum\" name: (type_identifier) @name) @definition.enum\n\n; Extensions (mapped to class \u2014 no dedicated label in schema)\n(class_declaration \"extension\" name: (user_type (type_identifier) @name)) @definition.class\n\n; Actors\n(class_declaration \"actor\" name: (type_identifier) @name) @definition.class\n\n; Protocols (mapped to interface)\n(protocol_declaration name: (type_identifier) @name) @definition.interface\n\n; Type aliases\n(typealias_declaration name: (type_identifier) @name) @definition.type\n\n; Functions (top-level and methods)\n(function_declaration name: (simple_identifier) @name) @definition.function\n\n; Protocol method declarations\n(protocol_function_declaration name: (simple_identifier) @name) @definition.method\n\n; Initializers \u2014 \"init\" is the canonical name; line offset tracked via definition node\n(init_declaration \"init\" @name) @definition.constructor\n\n; Properties (stored and computed)\n(property_declaration (pattern (simple_identifier) @name)) @definition.property\n\n; Imports\n(import_declaration (identifier (simple_identifier) @import.source)) @import\n\n; Calls - direct function calls\n(call_expression (simple_identifier) @call.name) @call\n\n; Calls - member/navigation calls (obj.method())\n(call_expression (navigation_expression (navigation_suffix (simple_identifier) @call.name))) @call\n\n; Heritage - class/struct/enum inheritance and protocol conformance\n(class_declaration name: (type_identifier) @heritage.class\n (inheritance_specifier inherits_from: (user_type (type_identifier) @heritage.extends))) @heritage\n\n; Heritage - protocol inheritance\n(protocol_declaration name: (type_identifier) @heritage.class\n (inheritance_specifier inherits_from: (user_type (type_identifier) @heritage.extends))) @heritage\n\n; Heritage - extension protocol conformance (e.g. extension Foo: SomeProtocol)\n; Extensions wrap the name in user_type unlike class/struct/enum declarations\n(class_declaration \"extension\" name: (user_type (type_identifier) @heritage.class)\n (inheritance_specifier inherits_from: (user_type (type_identifier) @heritage.extends))) @heritage\n";
-export declare const SCALA_QUERIES = "\n; \u2500\u2500 Classes (class, case class, abstract class, sealed class) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(class_definition\n name: (identifier) @name) @definition.class\n\n; \u2500\u2500 Traits (mapped to interface) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(trait_definition\n name: (identifier) @name) @definition.interface\n\n; \u2500\u2500 Object definitions (companion objects, case objects, singletons) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(object_definition\n name: (identifier) @name) @definition.class\n\n; \u2500\u2500 Function / method definitions \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(function_definition\n name: (identifier) @name) @definition.function\n\n; \u2500\u2500 Abstract method declarations (in traits / abstract classes) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(function_declaration\n name: (identifier) @name) @definition.method\n\n; \u2500\u2500 Type aliases \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(type_definition\n name: (type_identifier) @name) @definition.type\n\n; \u2500\u2500 Imports: simple path segments (import a.b.C \u2192 captures a, b, C) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(import_declaration\n (identifier) @import.source) @import\n\n; \u2500\u2500 Imports: selective { X, Y } (import a.b.{C, D}) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(import_declaration\n (namespace_selectors\n (identifier) @import.source)) @import\n\n; \u2500\u2500 Calls: direct function call \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(call_expression\n function: (identifier) @call.name) @call\n\n; \u2500\u2500 Calls: method call (obj.method()) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(call_expression\n function: (field_expression\n field: (identifier) @call.name)) @call\n\n; \u2500\u2500 Constructor: new Foo() \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(instance_expression\n (type_identifier) @call.name) @call\n\n; \u2500\u2500 Heritage: class / object extends and with \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(class_definition\n name: (identifier) @heritage.class\n extend: (extends_clause\n (type_identifier) @heritage.extends)) @heritage\n\n(trait_definition\n name: (identifier) @heritage.class\n extend: (extends_clause\n (type_identifier) @heritage.extends)) @heritage\n\n(object_definition\n name: (identifier) @heritage.class\n extend: (extends_clause\n (type_identifier) @heritage.extends)) @heritage\n";
+export declare const KOTLIN_QUERIES = "\n; \u2500\u2500 Interfaces \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n; tree-sitter-kotlin (fwcd) has no interface_declaration node type.\n; Interfaces are class_declaration nodes with an anonymous \"interface\" keyword child.\n(class_declaration\n \"interface\"\n (type_identifier) @name) @definition.interface\n\n; \u2500\u2500 Classes (regular, data, sealed, enum) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n; All have the anonymous \"class\" keyword child. enum class has both\n; \"enum\" and \"class\" children \u2014 the \"class\" child still matches.\n(class_declaration\n \"class\"\n (type_identifier) @name) @definition.class\n\n; \u2500\u2500 Object declarations (Kotlin singletons) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(object_declaration\n (type_identifier) @name) @definition.class\n\n; \u2500\u2500 Companion objects (named only) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(companion_object\n (type_identifier) @name) @definition.class\n\n; \u2500\u2500 Functions (top-level, member, extension) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(function_declaration\n (simple_identifier) @name) @definition.function\n\n; \u2500\u2500 Properties \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(property_declaration\n (variable_declaration\n (simple_identifier) @name)) @definition.property\n\n; \u2500\u2500 Enum entries \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(enum_entry\n (simple_identifier) @name) @definition.enum\n\n; \u2500\u2500 Type aliases \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(type_alias\n (type_identifier) @name) @definition.type\n\n; \u2500\u2500 Imports \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(import_header\n (identifier) @import.source) @import\n\n; \u2500\u2500 Function calls (direct) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(call_expression\n (simple_identifier) @call.name) @call\n\n; \u2500\u2500 Method calls (via navigation: obj.method()) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(call_expression\n (navigation_expression\n (navigation_suffix\n (simple_identifier) @call.name))) @call\n\n; \u2500\u2500 Constructor invocations \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(constructor_invocation\n (user_type\n (type_identifier) @call.name)) @call\n\n; \u2500\u2500 Infix function calls (e.g., a to b, x until y) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(infix_expression\n (simple_identifier) @call.name) @call\n\n; \u2500\u2500 Heritage: extends / implements via delegation_specifier \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n; Interface implementation (bare user_type): class Foo : Bar\n(class_declaration\n (type_identifier) @heritage.class\n (delegation_specifier\n (user_type (type_identifier) @heritage.extends))) @heritage\n\n; Class extension (constructor_invocation): class Foo : Bar()\n(class_declaration\n (type_identifier) @heritage.class\n (delegation_specifier\n (constructor_invocation\n (user_type (type_identifier) @heritage.extends)))) @heritage\n\n; \u2500\u2500 Type references \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(type_reference (user_type (type_identifier) @reference.type))\n";
+export declare const SWIFT_QUERIES = "\n; Classes\n(class_declaration \"class\" name: (type_identifier) @name) @definition.class\n\n; Structs\n(class_declaration \"struct\" name: (type_identifier) @name) @definition.struct\n\n; Enums\n(class_declaration \"enum\" name: (type_identifier) @name) @definition.enum\n\n; Extensions (mapped to class \u2014 no dedicated label in schema)\n(class_declaration \"extension\" name: (user_type (type_identifier) @name)) @definition.class\n\n; Actors\n(class_declaration \"actor\" name: (type_identifier) @name) @definition.class\n\n; Protocols (mapped to interface)\n(protocol_declaration name: (type_identifier) @name) @definition.interface\n\n; Type aliases\n(typealias_declaration name: (type_identifier) @name) @definition.type\n\n; Functions (top-level and methods)\n(function_declaration name: (simple_identifier) @name) @definition.function\n\n; Protocol method declarations\n(protocol_function_declaration name: (simple_identifier) @name) @definition.method\n\n; Initializers \u2014 \"init\" is the canonical name; line offset tracked via definition node\n(init_declaration \"init\" @name) @definition.constructor\n\n; Properties (stored and computed)\n(property_declaration (pattern (simple_identifier) @name)) @definition.property\n\n; Imports\n(import_declaration (identifier (simple_identifier) @import.source)) @import\n\n; Calls - direct function calls\n(call_expression (simple_identifier) @call.name) @call\n\n; Calls - member/navigation calls (obj.method())\n(call_expression (navigation_expression (navigation_suffix (simple_identifier) @call.name))) @call\n\n; Heritage - class/struct/enum inheritance and protocol conformance\n(class_declaration name: (type_identifier) @heritage.class\n (inheritance_specifier inherits_from: (user_type (type_identifier) @heritage.extends))) @heritage\n\n; Heritage - protocol inheritance\n(protocol_declaration name: (type_identifier) @heritage.class\n (inheritance_specifier inherits_from: (user_type (type_identifier) @heritage.extends))) @heritage\n\n; Heritage - extension protocol conformance (e.g. extension Foo: SomeProtocol)\n; Extensions wrap the name in user_type unlike class/struct/enum declarations\n(class_declaration \"extension\" name: (user_type (type_identifier) @heritage.class)\n (inheritance_specifier inherits_from: (user_type (type_identifier) @heritage.extends))) @heritage\n\n; Type references \u2014 captures types used in annotations/parameters/return types\n(type_annotation (user_type (type_identifier) @reference.type))\n";
+export declare const SCALA_QUERIES = "\n; \u2500\u2500 Classes (class, case class, abstract class, sealed class) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(class_definition\n name: (identifier) @name) @definition.class\n\n; \u2500\u2500 Traits (mapped to interface) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(trait_definition\n name: (identifier) @name) @definition.interface\n\n; \u2500\u2500 Object definitions (companion objects, case objects, singletons) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(object_definition\n name: (identifier) @name) @definition.class\n\n; \u2500\u2500 Function / method definitions \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(function_definition\n name: (identifier) @name) @definition.function\n\n; \u2500\u2500 Abstract method declarations (in traits / abstract classes) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(function_declaration\n name: (identifier) @name) @definition.method\n\n; \u2500\u2500 Type aliases \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(type_definition\n name: (type_identifier) @name) @definition.type\n\n; \u2500\u2500 Imports: capture full declaration for dotted-path reconstruction \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n; Handles: import ix.memory.model._ (wildcard)\n; import ix.memory.model.{NodeKind, GraphNode} (selective)\n; import ix.memory.model.NodeKind (simple)\n(import_declaration) @import.stmt\n\n; \u2500\u2500 Calls: direct function call \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(call_expression\n function: (identifier) @call.name) @call\n\n; \u2500\u2500 Calls: method call (obj.method()) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(call_expression\n function: (field_expression\n field: (identifier) @call.name)) @call\n\n; \u2500\u2500 Constructor: new Foo() \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(instance_expression\n (type_identifier) @call.name) @call\n\n; \u2500\u2500 Heritage: class / object extends and with \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(class_definition\n name: (identifier) @heritage.class\n extend: (extends_clause\n (type_identifier) @heritage.extends)) @heritage\n\n(trait_definition\n name: (identifier) @heritage.class\n extend: (extends_clause\n (type_identifier) @heritage.extends)) @heritage\n\n(object_definition\n name: (identifier) @heritage.class\n extend: (extends_clause\n (type_identifier) @heritage.extends)) @heritage\n\n; \u2500\u2500 Type references \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n; Case class parameter types: case class Foo(x: NodeKind)\n(class_parameter (type_identifier) @reference.type)\n; Method parameter types: def foo(x: NodeKind)\n(parameter (type_identifier) @reference.type)\n; Val/var type annotations: val x: NodeKind = ...\n(val_definition (type_identifier) @reference.type)\n(var_definition (type_identifier) @reference.type)\n; Return type annotations: def foo(): NodeKind = ...\n; (type_identifier is a direct child of function_definition, no named field)\n(function_definition (type_identifier) @reference.type)\n; Generic type arguments: Map[NodeId, NodeKind], Option[NodeKind], Set[NodeKind], etc.\n(generic_type (type_arguments (type_identifier) @reference.type))\n\n; \u2500\u2500 Qualified singleton / companion-object member access \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n; Two grammar shapes arise in practice:\n; expression context: NodeKind.Class \u2192 field_expression\n; pattern context: case Some(NodeKind.Class) => \u2026 \u2192 stable_identifier\n; Both shapes are captured below. The (#match? ^[A-Z]) predicates restrict to\n; UpperCamelCase identifiers (Scala convention for case objects / companion\n; object members), filtering out lowercase method / field names.\n\n; Expression: val x = NodeKind.Decision\n(field_expression\n value: (identifier) @_qualifier\n field: (identifier) @call.name\n (#match? @_qualifier \"^[A-Z]\")\n (#match? @call.name \"^[A-Z]\"))\n\n; Pattern: case Some(NodeKind.Class) | Some(NodeKind.Trait) => \u2026\n(stable_identifier\n (identifier) @_qualifier\n \".\"\n (identifier) @call.name\n (#match? @_qualifier \"^[A-Z]\")\n (#match? @call.name \"^[A-Z]\"))\n";
export declare const LANGUAGE_QUERIES: Record<SupportedLanguages, string>;
diff --git a/core-ingestion/dist/queries.js b/core-ingestion/dist/queries.js
index 88a48de9..01127c87 100644
--- a/core-ingestion/dist/queries.js
+++ b/core-ingestion/dist/queries.js
@@ -78,6 +78,15 @@ export const TYPESCRIPT_QUERIES = `
(class_heritage
(implements_clause
(type_identifier) @heritage.implements))) @heritage.impl
+
+; Heritage queries - interface extends interface
+(interface_declaration
+ name: (type_identifier) @heritage.class
+ (extends_type_clause
+ (type_identifier) @heritage.extends)) @heritage
+
+; Type references — captures types used in annotations/parameters/return types
+(type_annotation (type_identifier) @reference.type)
`;
// JavaScript queries - works with tree-sitter-javascript
export const JAVASCRIPT_QUERIES = `
@@ -176,6 +185,10 @@ export const PYTHON_QUERIES = `
name: (identifier) @heritage.class
superclasses: (argument_list
(identifier) @heritage.extends)) @heritage
+
+; Type references — captures types used in type annotations / hints
+(typed_parameter type: (identifier) @reference.type)
+(typed_default_parameter type: (identifier) @reference.type)
`;
// Java queries - works with tree-sitter-java
export const JAVA_QUERIES = `
@@ -206,6 +219,12 @@ export const JAVA_QUERIES = `
; Heritage - implements interfaces
(class_declaration name: (identifier) @heritage.class
(super_interfaces (type_list (type_identifier) @heritage.implements))) @heritage.impl
+
+; Type references — captures types used in field/param/return-type positions
+(field_declaration type: (type_identifier) @reference.type)
+(formal_parameter type: (type_identifier) @reference.type)
+(local_variable_declaration type: (type_identifier) @reference.type)
+(method_declaration type: (type_identifier) @reference.type)
`;
// C queries - works with tree-sitter-c
export const C_QUERIES = `
@@ -236,6 +255,10 @@ export const C_QUERIES = `
; Calls
(call_expression function: (identifier) @call.name) @call
(call_expression function: (field_expression field: (field_identifier) @call.name)) @call
+
+; Type references — captures types used in declaration/parameter positions
+(declaration type: (type_identifier) @reference.type)
+(parameter_declaration type: (type_identifier) @reference.type)
`;
// Go queries - works with tree-sitter-go
export const GO_QUERIES = `
@@ -266,6 +289,11 @@ export const GO_QUERIES = `
; Struct literal construction: User{Name: "Alice"}
(composite_literal type: (type_identifier) @call.name) @call
+
+; Type references — captures types used in field/param/return-type positions
+(field_declaration type: (type_identifier) @reference.type)
+(parameter_declaration type: (type_identifier) @reference.type)
+(result type: (type_identifier) @reference.type)
`;
// C++ queries - works with tree-sitter-cpp
export const CPP_QUERIES = `
@@ -336,6 +364,10 @@ export const CPP_QUERIES = `
(base_class_clause (type_identifier) @heritage.extends)) @heritage
(class_specifier name: (type_identifier) @heritage.class
(base_class_clause (access_specifier) (type_identifier) @heritage.extends)) @heritage
+
+; Type references — captures types used in declaration/parameter positions
+(declaration type: (type_identifier) @reference.type)
+(parameter_declaration type: (type_identifier) @reference.type)
`;
// C# queries - works with tree-sitter-c-sharp
export const CSHARP_QUERIES = `
@@ -389,6 +421,12 @@ export const CSHARP_QUERIES = `
(base_list (identifier) @heritage.extends)) @heritage
(class_declaration name: (identifier) @heritage.class
(base_list (generic_name (identifier) @heritage.extends))) @heritage
+
+; Type references — captures types used in field/param/return-type positions
+(parameter type: (identifier) @reference.type)
+(variable_declaration type: (identifier) @reference.type)
+(field_declaration type: (identifier) @reference.type)
+(method_declaration return_type: (identifier) @reference.type)
`;
// Rust queries - works with tree-sitter-rust
export const RUST_QUERIES = `
@@ -419,6 +457,11 @@ export const RUST_QUERIES = `
; Struct literal construction: User { name: value }
(struct_expression name: (type_identifier) @call.name) @call
+; Type references — captures types used in field/param/return-type positions
+(field_declaration type: (type_identifier) @reference.type)
+(parameter pattern: (_) type: (type_identifier) @reference.type)
+(function_item return_type: (type_identifier) @reference.type)
+
; Heritage (trait implementation) — all combinations of concrete/generic trait × concrete/generic type
(impl_item trait: (type_identifier) @heritage.trait type: (type_identifier) @heritage.class) @heritage
(impl_item trait: (generic_type type: (type_identifier) @heritage.trait) type: (type_identifier) @heritage.class) @heritage
@@ -505,6 +548,9 @@ export const PHP_QUERIES = `
body: (declaration_list
(use_declaration
[(name) (qualified_name)] @heritage.trait))) @heritage
+
+; ── Type references ───────────────────────────────────────────────────────────
+(named_type (name) @reference.type)
`;
// Ruby queries - works with tree-sitter-ruby
export const RUBY_QUERIES = `
@@ -628,6 +674,9 @@ export const KOTLIN_QUERIES = `
(delegation_specifier
(constructor_invocation
(user_type (type_identifier) @heritage.extends)))) @heritage
+
+; ── Type references ───────────────────────────────────────────────────────────
+(type_reference (user_type (type_identifier) @reference.type))
`;
// Swift queries - works with tree-sitter-swift
export const SWIFT_QUERIES = `
@@ -685,6 +734,9 @@ export const SWIFT_QUERIES = `
; Extensions wrap the name in user_type unlike class/struct/enum declarations
(class_declaration "extension" name: (user_type (type_identifier) @heritage.class)
(inheritance_specifier inherits_from: (user_type (type_identifier) @heritage.extends))) @heritage
+
+; Type references — captures types used in annotations/parameters/return types
+(type_annotation (user_type (type_identifier) @reference.type))
`;
// Scala queries - works with tree-sitter-scala
export const SCALA_QUERIES = `
@@ -712,14 +764,11 @@ export const SCALA_QUERIES = `
(type_definition
name: (type_identifier) @name) @definition.type
-; ── Imports: simple path segments (import a.b.C → captures a, b, C) ─────────
-(import_declaration
- (identifier) @import.source) @import
-
-; ── Imports: selective { X, Y } (import a.b.{C, D}) ─────────────────────────
-(import_declaration
- (namespace_selectors
- (identifier) @import.source)) @import
+; ── Imports: capture full declaration for dotted-path reconstruction ─────────
+; Handles: import ix.memory.model._ (wildcard)
+; import ix.memory.model.{NodeKind, GraphNode} (selective)
+; import ix.memory.model.NodeKind (simple)
+(import_declaration) @import.stmt
; ── Calls: direct function call ──────────────────────────────────────────────
(call_expression
@@ -749,6 +798,43 @@ export const SCALA_QUERIES = `
name: (identifier) @heritage.class
extend: (extends_clause
(type_identifier) @heritage.extends)) @heritage
+
+; ── Type references ───────────────────────────────────────────────────────────
+; Case class parameter types: case class Foo(x: NodeKind)
+(class_parameter (type_identifier) @reference.type)
+; Method parameter types: def foo(x: NodeKind)
+(parameter (type_identifier) @reference.type)
+; Val/var type annotations: val x: NodeKind = ...
+(val_definition (type_identifier) @reference.type)
+(var_definition (type_identifier) @reference.type)
+; Return type annotations: def foo(): NodeKind = ...
+; (type_identifier is a direct child of function_definition, no named field)
+(function_definition (type_identifier) @reference.type)
+; Generic type arguments: Map[NodeId, NodeKind], Option[NodeKind], Set[NodeKind], etc.
+(generic_type (type_arguments (type_identifier) @reference.type))
+
+; ── Qualified singleton / companion-object member access ──────────────────────
+; Two grammar shapes arise in practice:
+; expression context: NodeKind.Class → field_expression
+; pattern context: case Some(NodeKind.Class) => … → stable_identifier
+; Both shapes are captured below. The (#match? ^[A-Z]) predicates restrict to
+; UpperCamelCase identifiers (Scala convention for case objects / companion
+; object members), filtering out lowercase method / field names.
+
+; Expression: val x = NodeKind.Decision
+(field_expression
+ value: (identifier) @_qualifier
+ field: (identifier) @call.name
+ (#match? @_qualifier "^[A-Z]")
+ (#match? @call.name "^[A-Z]"))
+
+; Pattern: case Some(NodeKind.Class) | Some(NodeKind.Trait) => …
+(stable_identifier
+ (identifier) @_qualifier
+ "."
+ (identifier) @call.name
+ (#match? @_qualifier "^[A-Z]")
+ (#match? @call.name "^[A-Z]"))
`;
export const LANGUAGE_QUERIES = {
[SupportedLanguages.TypeScript]: TYPESCRIPT_QUERIES,
diff --git a/core-ingestion/src/index.ts b/core-ingestion/src/index.ts
index 7206a549..ba79c442 100644
--- a/core-ingestion/src/index.ts
+++ b/core-ingestion/src/index.ts
@@ -101,6 +101,34 @@ const DEFINITION_KIND_MAP: Record<string, string> = {
'definition.constructor':'method',
};
+// Primitive / built-in types to exclude from REFERENCES edges
+const TYPE_BUILTINS = new Set([
+ // TypeScript / JavaScript
+ 'string', 'number', 'boolean', 'void', 'null', 'undefined', 'any', 'never',
+ 'unknown', 'object', 'bigint', 'symbol',
+ // Java / Kotlin / Scala
+ 'String', 'Integer', 'Long', 'Double', 'Float', 'Boolean', 'Byte', 'Short',
+ 'Character', 'Object', 'Void', 'Int', 'Unit', 'Any', 'AnyVal', 'AnyRef',
+ 'Nothing', 'Null', 'Char', 'Number',
+ // C#
+ 'decimal',
+ // Python
+ 'int', 'str', 'float', 'bool', 'bytes', 'Optional', 'Union', 'List', 'Dict',
+ 'Set', 'Tuple', 'Type',
+ // Rust
+ 'i8', 'i16', 'i32', 'i64', 'i128', 'u8', 'u16', 'u32', 'u64', 'u128',
+ 'f32', 'f64', 'usize', 'isize',
+ // Go
+ 'int8', 'int16', 'int32', 'int64', 'uint8', 'uint16', 'uint32', 'uint64',
+ 'float32', 'float64', 'byte', 'rune', 'error',
+ // Common stdlib collections / wrappers
+ 'Array', 'Map', 'Seq', 'Vector', 'Option', 'Future', 'Promise', 'Result',
+ 'Either', 'Try', 'IO', 'Observable', 'Iterator', 'Iterable',
+ // C / C++
+ 'size_t', 'uint8_t', 'uint16_t', 'uint32_t', 'uint64_t', 'int8_t',
+ 'int16_t', 'int32_t', 'int64_t',
+]);
+
// Builtins to exclude from CALLS edges
const BUILTINS = new Set([
'print', 'println', 'len', 'range', 'int', 'str', 'float', 'list', 'dict',
@@ -170,6 +198,8 @@ export function parseFile(filePath: string, source: string): FileParseResult | n
const classRanges: Array<{ name: string; start: number; end: number }> = [];
// Track seen calls per enclosing scope to avoid duplicate CALLS edges
const seenCalls = new Map<string, Set<string>>();
+ // Track seen type references per enclosing class/file to avoid duplicate REFERENCES edges
+ const seenRefs = new Map<string, Set<string>>();
// --- First pass: collect definitions ---
for (const match of matches) {
@@ -245,7 +275,37 @@ export function parseFile(filePath: string, source: string): FileParseResult | n
// --- Second pass: calls and imports ---
for (const match of matches) {
- // Import captures
+ // Full import statement captures (Scala: reconstructs dotted package paths)
+ const importStmt = match.captures.find((c: any) => c.name === 'import.stmt');
+ if (importStmt) {
+ const raw = importStmt.node.text.replace(/^import\s+/, '').trim();
+ const line = importStmt.node.startPosition.row + 1;
+ if (raw.endsWith('._')) {
+ // Wildcard: "ix.memory.model._" → package path "ix.memory.model"
+ const pkgPath = raw.slice(0, -2);
+ entities.push({ name: pkgPath, kind: 'module', lineStart: line, lineEnd: line, language });
+ relationships.push({ srcName: fileName, dstName: pkgPath, predicate: 'IMPORTS' });
+ } else {
+ const braceIdx = raw.lastIndexOf('.{');
+ if (braceIdx !== -1) {
+ // Selective: "ix.memory.model.{NodeKind, GraphNode}"
+ const prefix = raw.slice(0, braceIdx);
+ const names = raw.slice(braceIdx + 2, -1).split(',').map((s: string) => s.trim()).filter(Boolean);
+ for (const name of names) {
+ const dstName = `${prefix}.${name}`;
+ entities.push({ name: dstName, kind: 'module', lineStart: line, lineEnd: line, language });
+ relationships.push({ srcName: fileName, dstName, predicate: 'IMPORTS' });
+ }
+ } else {
+ // Simple: "ix.memory.model.NodeKind"
+ entities.push({ name: raw, kind: 'module', lineStart: line, lineEnd: line, language });
+ relationships.push({ srcName: fileName, dstName: raw, predicate: 'IMPORTS' });
+ }
+ }
+ continue;
+ }
+
+ // Import captures (JS/TS/Python path-based)
const importSource = match.captures.find((c: any) => c.name === 'import.source');
if (importSource) {
let importPath = importSource.node.text
@@ -278,16 +338,49 @@ export function parseFile(filePath: string, source: string): FileParseResult | n
const callee = callName.node.text;
if (!callee || BUILTINS.has(callee) || callee.length <= 1) continue;
- // Find enclosing function/method for the call
+ // Find enclosing function/method for the call; fall back to enclosing class
+ // (e.g. calls in val/lazy val body at class level) before falling back to file.
const callLine = callName.node.startPosition.row + 1;
- const caller = findEnclosingFunction(entities, callLine) ?? fileName;
+ const caller = findEnclosingFunction(entities, callLine)
+ ?? findEnclosing(classRanges, callLine, '')
+ ?? fileName;
const scope = caller;
if (!seenCalls.has(scope)) seenCalls.set(scope, new Set());
const seen = seenCalls.get(scope)!;
- if (!seen.has(callee)) {
- seen.add(callee);
- relationships.push({ srcName: caller, dstName: callee, predicate: 'CALLS' });
+
+ // If a _qualifier capture is present (field_expression / stable_identifier
+ // patterns like NodeKind.Decision), emit the fully qualified name so that
+ // resolution can use the qualifier to break ties between same-named symbols
+ // in different files (e.g. NodeKind.Decision vs SourceType.Decision).
+ const qualifierCapture = match.captures.find((c: any) => c.name === '_qualifier');
+ const effectiveCallee = qualifierCapture
+ ? `${qualifierCapture.node.text}.${callee}`
+ : callee;
+
+ if (!seen.has(effectiveCallee)) {
+ seen.add(effectiveCallee);
+ relationships.push({ srcName: caller, dstName: effectiveCallee, predicate: 'CALLS' });
+ }
+ continue;
+ }
+
+ // Type reference captures
+ const refType = match.captures.find((c: any) => c.name === 'reference.type');
+ if (refType) {
+ const typeName = refType.node.text;
+ if (!typeName || TYPE_BUILTINS.has(typeName) || typeName.length <= 1) continue;
+
+ // Use the enclosing class as the src so the edge reads "ClassX REFERENCES TypeY".
+ // Fall back to the file name when no enclosing class is found (top-level usage).
+ const refLine = refType.node.startPosition.row + 1;
+ const src = findEnclosing(classRanges, refLine, typeName) ?? fileName;
+
+ if (!seenRefs.has(src)) seenRefs.set(src, new Set());
+ const seen = seenRefs.get(src)!;
+ if (!seen.has(typeName)) {
+ seen.add(typeName);
+ relationships.push({ srcName: src, dstName: typeName, predicate: 'REFERENCES' });
}
continue;
}
@@ -314,6 +407,17 @@ export interface ResolvedCallEdge {
confidence: number; // 0.9 import-scoped | 0.5 global
}
+/** Generalised form of ResolvedCallEdge that covers any cross-file edge predicate. */
+export interface ResolvedEdge {
+ srcFilePath: string;
+ srcName: string;
+ dstFilePath: string; // file where the destination symbol is actually defined
+ dstName: string; // plain name as it appears in the relationship
+ dstQualifiedKey: string; // qualified key used for nodeId in the defining file
+ predicate: string; // "CALLS" | "EXTENDS"
+ confidence: number; // 0.9 import-scoped | 0.8 transitive | 0.5 global
+}
+
// ---------------------------------------------------------------------------
// resolveCallEdges helpers
// ---------------------------------------------------------------------------
@@ -333,35 +437,37 @@ function bestQKey(
filePath: string,
plainName: string,
): string | null {
- const qks = fileQKeys.get(filePath)?.get(plainName) ?? [];
+ const qks = [...new Set(fileQKeys.get(filePath)?.get(plainName) ?? [])];
return qks.length === 1 ? qks[0] : null;
}
/**
- * Resolves CALLS relationships to their cross-file targets by building a
- * symbol table and import map over the full batch of parsed files.
+ * Resolves CALLS and EXTENDS relationships to their cross-file targets by
+ * building a symbol table and import map over the full batch of parsed files.
*
* Tiers (in priority order):
- * 0.9 — import-scoped: callee is in a file the caller explicitly imports
- * 0.5 — global fallback: callee exists in exactly one other file (unambiguous)
+ * 0.9 — import-scoped: dst is in a file the src explicitly imports
+ * 0.8 — transitive import-scoped: one re-export hop away
+ * 0.5 — global fallback: dst exists in exactly one other file (unambiguous)
*
- * Same-file calls (tier 0.95) are already handled correctly by buildPatch and
- * are not emitted here.
+ * Same-file edges are already handled correctly by buildPatch and are not
+ * emitted here.
*
* Import resolution handles:
* - Stem-based: './payments' → 'payments.ts'
* - Path-aliased: '@/lib/payments' → 'payments.ts' (last segment)
* - Directory index: './services' → 'services/index.ts'
* - Bare aliases: '@components' → 'components.ts' (strip leading non-word chars)
- * '~lib' → 'lib.ts'
- * - External bare: 'react' → unresolved (no match in batch)
+ * - Dotted paths: 'ix.memory.model.Edge' → stem 'Edge' → 'Edge.scala'
+ * (handles Scala/Java package imports where tree-sitter
+ * emits each identifier separately)
*
* Qualified-key resolution:
- * - Module-level function: calleeQualifiedKey === calleeName
- * - Unambiguous class method: calleeQualifiedKey === 'ClassName.method'
- * - Ambiguous (two classes define same method name): edge not emitted
+ * - Module-level function/class: dstQualifiedKey === dstName
+ * - Unambiguous class method: dstQualifiedKey === 'ClassName.method'
+ * - Ambiguous (two entities share the same plain name): edge not emitted
*/
-export function resolveCallEdges(results: FileParseResult[]): ResolvedCallEdge[] {
+export function resolveEdges(results: FileParseResult[]): ResolvedEdge[] {
// fileQKeys: filePath → (plainName → qualifiedKeys[])
// Mirrors the entityQKey computation in buildPatch so nodeIds match exactly.
const fileQKeys = new Map<string, Map<string, string[]>>();
@@ -385,8 +491,6 @@ export function resolveCallEdges(results: FileParseResult[]): ResolvedCallEdge[]
// stemToFiles: basename-without-extension → filePath[]
// Matches the last path segment of an import to files in the batch.
- // e.g. './payments' → modName 'payments' → 'payments.ts'
- // '@/lib/payments' → modName 'payments' → 'payments.ts'
const stemToFiles = new Map<string, string[]>();
for (const r of results) {
const stem = nodePath.basename(r.filePath, nodePath.extname(r.filePath));
@@ -408,33 +512,73 @@ export function resolveCallEdges(results: FileParseResult[]): ResolvedCallEdge[]
}
}
- const resolved: ResolvedCallEdge[] = [];
+ // packageToFiles: dotted package path → filePath[] (Scala/Java wildcard imports)
+ // e.g. "ix.memory.model" → all .scala files under .../ix/memory/model/
+ // Builds all suffix keys so that both "model" and "ix.memory.model" resolve.
+ const packageToFiles = new Map<string, string[]>();
+ for (const r of results) {
+ const ext = nodePath.extname(r.filePath);
+ if (ext !== '.scala' && ext !== '.java') continue;
+ const dir = nodePath.dirname(r.filePath);
+ const parts = dir.split(/[/\\]/);
+ // Cap at 8 segments to avoid noise from very shallow path components like "src", "main".
+ const maxDepth = Math.min(8, parts.length);
+ for (let i = parts.length - 1; i >= parts.length - maxDepth; i--) {
+ const pkg = parts.slice(i).join('.');
+ const list = packageToFiles.get(pkg) ?? [];
+ if (!list.includes(r.filePath)) list.push(r.filePath);
+ packageToFiles.set(pkg, list);
+ }
+ }
+
+ /** Resolve a module name to matching file paths in the batch. */
+ function modNameToFiles(modName: string, excludeFp: string): string[] {
+ const fps: string[] = [];
+ // Strip leading non-word chars for bare aliases: '@components' → 'components'
+ const candidates = [modName];
+ const stripped = modName.replace(/^[^a-zA-Z0-9_]+/, '');
+ if (stripped && stripped !== modName) candidates.push(stripped);
+ // Strip file extensions so "explain.js" resolves to the "explain" stem
+ // (TS/JS ESM imports use .js extensions that map to .ts source files)
+ const noExt = modName.replace(/\.(js|ts|mjs|cjs|jsx|tsx|py|scala|java)$/, '');
+ if (noExt !== modName && noExt && !candidates.includes(noExt)) candidates.push(noExt);
+ // For dotted paths (Scala/Java: 'ix.memory.model.Edge'), also try last segment
+ const lastDot = modName.lastIndexOf('.');
+ if (lastDot !== -1) {
+ const lastSegment = modName.slice(lastDot + 1);
+ if (lastSegment && !candidates.includes(lastSegment)) candidates.push(lastSegment);
+ }
+ for (const cand of candidates) {
+ for (const fp of stemToFiles.get(cand) ?? []) {
+ if (fp !== excludeFp) fps.push(fp);
+ }
+ for (const fp of dirToIndexFiles.get(cand) ?? []) {
+ if (fp !== excludeFp) fps.push(fp);
+ }
+ }
+ // Package-path wildcard resolution (Scala/Java): "ix.memory.model" → all files in that dir
+ for (const fp of packageToFiles.get(modName) ?? []) {
+ if (fp !== excludeFp && !fps.includes(fp)) fps.push(fp);
+ }
+ return fps;
+ }
+
+ const resolved: ResolvedEdge[] = [];
for (const result of results) {
- const callerFilePath = result.filePath;
- const callerSymbols = fileHasSymbol.get(callerFilePath)!;
+ const srcFilePath = result.filePath;
+ const srcSymbols = fileHasSymbol.get(srcFilePath)!;
- // Build the set of file paths this caller explicitly imports.
- // For each IMPORTS edge, try the modName as-is, then with leading
- // non-word characters stripped (handles bare aliases: '@components' → 'components',
- // '~lib' → 'lib', '#utils' → 'utils').
+ // Build the set of file paths this file explicitly imports.
const importedFilePaths = new Set<string>();
for (const rel of result.relationships) {
if (rel.predicate !== 'IMPORTS') continue;
- const candidates = [rel.dstName];
- const stripped = rel.dstName.replace(/^[^a-zA-Z0-9_]+/, '');
- if (stripped && stripped !== rel.dstName) candidates.push(stripped);
- for (const modName of candidates) {
- for (const fp of stemToFiles.get(modName) ?? []) {
- if (fp !== callerFilePath) importedFilePaths.add(fp);
- }
- for (const fp of dirToIndexFiles.get(modName) ?? []) {
- if (fp !== callerFilePath) importedFilePaths.add(fp);
- }
+ for (const fp of modNameToFiles(rel.dstName, srcFilePath)) {
+ importedFilePaths.add(fp);
}
}
- // Build one-hop transitive import set: files imported by directly-imported files.
+ // Build one-hop transitive import set.
// Handles re-exports: baz.ts → index.ts (re-exports from bar.ts) → bar.ts
const transitiveFilePaths = new Set<string>();
for (const fp of importedFilePaths) {
@@ -442,41 +586,74 @@ export function resolveCallEdges(results: FileParseResult[]): ResolvedCallEdge[]
if (!fpResult) continue;
for (const rel of fpResult.relationships) {
if (rel.predicate !== 'IMPORTS') continue;
- const candidates = [rel.dstName];
- const stripped = rel.dstName.replace(/^[^a-zA-Z0-9_]+/, '');
- if (stripped && stripped !== rel.dstName) candidates.push(stripped);
- for (const modName of candidates) {
- for (const transitiveFp of stemToFiles.get(modName) ?? []) {
- if (transitiveFp !== callerFilePath && !importedFilePaths.has(transitiveFp))
- transitiveFilePaths.add(transitiveFp);
- }
- for (const transitiveFp of dirToIndexFiles.get(modName) ?? []) {
- if (transitiveFp !== callerFilePath && !importedFilePaths.has(transitiveFp))
- transitiveFilePaths.add(transitiveFp);
- }
+ for (const transitiveFp of modNameToFiles(rel.dstName, srcFilePath)) {
+ if (!importedFilePaths.has(transitiveFp)) transitiveFilePaths.add(transitiveFp);
}
}
}
for (const rel of result.relationships) {
- if (rel.predicate !== 'CALLS') continue;
- const calleeName = rel.dstName;
- const callerName = rel.srcName;
+ if (rel.predicate !== 'CALLS' && rel.predicate !== 'EXTENDS' && rel.predicate !== 'REFERENCES') continue;
+ const dstName = rel.dstName;
+ const srcName = rel.srcName;
+
+ // Tier 1b: qualifier-assisted (confidence 0.9 / 0.7)
+ // For dotted names like "NodeKind.Decision" (emitted by field_expression queries):
+ // find the file defining the qualifier, then check it also defines the member.
+ // This breaks ties where both NodeKind.Decision and SourceType.Decision exist.
+ const qualDot = dstName.lastIndexOf('.');
+ if (qualDot !== -1) {
+ const qualifierPart = dstName.slice(0, qualDot);
+ const memberPart = dstName.slice(qualDot + 1);
+ if (memberPart && qualifierPart) {
+ // Try import-scoped qualifier first
+ const qualImportMatches: string[] = [];
+ for (const fp of importedFilePaths) {
+ if (fileHasSymbol.get(fp)?.has(qualifierPart)) qualImportMatches.push(fp);
+ }
+ if (qualImportMatches.length === 1) {
+ const qfp = qualImportMatches[0];
+ if (fileHasSymbol.get(qfp)?.has(memberPart)) {
+ const dstQualifiedKey = bestQKey(fileQKeys, qfp, memberPart);
+ if (dstQualifiedKey !== null) {
+ // dstName must match rel.dstName so buildPatchWithResolution can look it up
+ resolved.push({ srcFilePath, srcName, dstFilePath: qfp, dstName, dstQualifiedKey, predicate: rel.predicate, confidence: 0.9 });
+ }
+ }
+ continue;
+ }
+ // Global qualifier fallback
+ const qualGlobalMatches: string[] = [];
+ for (const [fp, symbols] of fileHasSymbol) {
+ if (fp !== srcFilePath && symbols.has(qualifierPart)) qualGlobalMatches.push(fp);
+ }
+ if (qualGlobalMatches.length === 1) {
+ const qfp = qualGlobalMatches[0];
+ if (fileHasSymbol.get(qfp)?.has(memberPart)) {
+ const dstQualifiedKey = bestQKey(fileQKeys, qfp, memberPart);
+ if (dstQualifiedKey !== null) {
+ resolved.push({ srcFilePath, srcName, dstFilePath: qfp, dstName, dstQualifiedKey, predicate: rel.predicate, confidence: 0.7 });
+ }
+ }
+ }
+ continue; // qualified name exhausted — don't try bare-name tiers
+ }
+ }
// Tier 1: same-file — already correct in buildPatch, skip here
- if (callerSymbols.has(calleeName)) continue;
+ if (srcSymbols.has(dstName)) continue;
// Tier 2: import-scoped (confidence 0.9)
const importMatches: string[] = [];
for (const fp of importedFilePaths) {
- if (fileHasSymbol.get(fp)?.has(calleeName)) importMatches.push(fp);
+ if (fileHasSymbol.get(fp)?.has(dstName)) importMatches.push(fp);
}
if (importMatches.length === 1) {
const fp = importMatches[0];
- const calleeQualifiedKey = bestQKey(fileQKeys, fp, calleeName);
- if (calleeQualifiedKey === null) continue; // ambiguous class methods — do not emit bad nodeId
- resolved.push({ callerFilePath, callerName, calleeFilePath: fp, calleeName, calleeQualifiedKey, confidence: 0.9 });
+ const dstQualifiedKey = bestQKey(fileQKeys, fp, dstName);
+ if (dstQualifiedKey === null) continue; // ambiguous — do not emit bad nodeId
+ resolved.push({ srcFilePath, srcName, dstFilePath: fp, dstName, dstQualifiedKey, predicate: rel.predicate, confidence: 0.9 });
continue;
}
if (importMatches.length > 1) continue; // ambiguous file — do not emit
@@ -484,14 +661,14 @@ export function resolveCallEdges(results: FileParseResult[]): ResolvedCallEdge[]
// Tier 2.5: transitive import-scoped (confidence 0.8) — one re-export hop away
const transitiveMatches: string[] = [];
for (const fp of transitiveFilePaths) {
- if (fileHasSymbol.get(fp)?.has(calleeName)) transitiveMatches.push(fp);
+ if (fileHasSymbol.get(fp)?.has(dstName)) transitiveMatches.push(fp);
}
if (transitiveMatches.length === 1) {
const fp = transitiveMatches[0];
- const calleeQualifiedKey = bestQKey(fileQKeys, fp, calleeName);
- if (calleeQualifiedKey === null) continue;
- resolved.push({ callerFilePath, callerName, calleeFilePath: fp, calleeName, calleeQualifiedKey, confidence: 0.8 });
+ const dstQualifiedKey = bestQKey(fileQKeys, fp, dstName);
+ if (dstQualifiedKey === null) continue;
+ resolved.push({ srcFilePath, srcName, dstFilePath: fp, dstName, dstQualifiedKey, predicate: rel.predicate, confidence: 0.8 });
continue;
}
if (transitiveMatches.length > 1) continue; // ambiguous — do not emit
@@ -499,14 +676,14 @@ export function resolveCallEdges(results: FileParseResult[]): ResolvedCallEdge[]
// Tier 3: global fallback (confidence 0.5) — exactly one other file defines it
const globalMatches: string[] = [];
for (const [fp, symbols] of fileHasSymbol) {
- if (fp !== callerFilePath && symbols.has(calleeName)) globalMatches.push(fp);
+ if (fp !== srcFilePath && symbols.has(dstName)) globalMatches.push(fp);
}
if (globalMatches.length === 1) {
const fp = globalMatches[0];
- const calleeQualifiedKey = bestQKey(fileQKeys, fp, calleeName);
- if (calleeQualifiedKey === null) continue; // ambiguous class methods — do not emit bad nodeId
- resolved.push({ callerFilePath, callerName, calleeFilePath: fp, calleeName, calleeQualifiedKey, confidence: 0.5 });
+ const dstQualifiedKey = bestQKey(fileQKeys, fp, dstName);
+ if (dstQualifiedKey === null) continue; // ambiguous — do not emit bad nodeId
+ resolved.push({ srcFilePath, srcName, dstFilePath: fp, dstName, dstQualifiedKey, predicate: rel.predicate, confidence: 0.5 });
}
// 0 or >1 global matches — leave as dangling edge, do not emit
}
@@ -515,6 +692,18 @@ export function resolveCallEdges(results: FileParseResult[]): ResolvedCallEdge[]
return resolved;
}
+/** @deprecated Use resolveEdges instead. */
+export function resolveCallEdges(results: FileParseResult[]): ResolvedCallEdge[] {
+ return resolveEdges(results).map(e => ({
+ callerFilePath: e.srcFilePath,
+ callerName: e.srcName,
+ calleeFilePath: e.dstFilePath,
+ calleeName: e.dstName,
+ calleeQualifiedKey: e.dstQualifiedKey,
+ confidence: e.confidence,
+ }));
+}
+
// ---------------------------------------------------------------------------
// Helpers
// ---------------------------------------------------------------------------
diff --git a/core-ingestion/src/patch-builder.ts b/core-ingestion/src/patch-builder.ts
index d7a63644..3722f20b 100644
--- a/core-ingestion/src/patch-builder.ts
+++ b/core-ingestion/src/patch-builder.ts
@@ -1,7 +1,7 @@
import * as crypto from 'node:crypto';
import * as nodePath from 'node:path';
import type { GraphPatchPayload, PatchOp } from './types.js';
-import type { FileParseResult, ParsedEntity, ResolvedCallEdge } from './index.js';
+import type { FileParseResult, ParsedEntity, ResolvedEdge } from './index.js';
// ---------------------------------------------------------------------------
// Deterministic UUID from a string (matches existing CLI convention)
@@ -38,7 +38,20 @@ function sourceType(filePath: string): string {
}
function extractorName(): string {
- return `tree-sitter/1.0`;
+ return `tree-sitter/1.7`;
+}
+
+/** Previous extractor versions — their patches are superseded when re-ingesting. */
+const PREVIOUS_EXTRACTORS = ['tree-sitter/1.6', 'tree-sitter/1.5', 'tree-sitter/1.4', 'tree-sitter/1.3', 'tree-sitter/1.2', 'tree-sitter/1.1'];
+
+/** Compute a patchId for a (filePath, sourceHash, extractorVersion) triple. */
+function computePatchId(filePath: string, sourceHash: string, extractor: string): string {
+ return deterministicId(`${filePath}:${sourceHash}:${extractor}`);
+}
+
+/** Compute the legacy patchId (pre-1.1 scheme, no extractor suffix). */
+function legacyPatchId(filePath: string, sourceHash: string): string {
+ return deterministicId(`${filePath}:${sourceHash}`);
}
// ---------------------------------------------------------------------------
@@ -136,12 +149,16 @@ export function buildPatch(
});
}
- // patchId is deterministic: same file + same content → same id across runs.
- // This makes repeated ingestion idempotent at the patch level.
- const patchId = deterministicId(`${filePath}:${sourceHash}`);
+ // patchId is deterministic: same file + same content + same extractor → same id.
+ const extractor = extractorName();
+ const patchId = computePatchId(filePath, sourceHash, extractor);
+ // When re-ingesting with new extractor version, replace the old patch so the
+ // server accepts the new ops rather than deduplicating on the old patchId.
const previousPatchId = previousSourceHash
- ? deterministicId(`${filePath}:${previousSourceHash}`)
- : undefined;
+ ? computePatchId(filePath, previousSourceHash, extractor)
+ : legacyPatchId(filePath, sourceHash);
+ // Also supersede any patches created by previous extractor versions for the same file+content.
+ const replaces = [previousPatchId, ...PREVIOUS_EXTRACTORS.map(prev => computePatchId(filePath, sourceHash, prev))];
return {
patchId,
@@ -150,12 +167,12 @@ export function buildPatch(
source: {
uri: filePath,
sourceHash,
- extractor: extractorName(),
+ extractor,
sourceType: sourceType(filePath),
},
baseRev: 0,
ops,
- replaces: previousPatchId ? [previousPatchId] : [],
+ replaces,
intent: `Parsed ${nodePath.basename(filePath)}`,
};
}
@@ -168,16 +185,16 @@ export function buildPatch(
export function buildPatchWithResolution(
result: FileParseResult,
sourceHash: string,
- resolvedEdges: ResolvedCallEdge[],
+ resolvedEdges: ResolvedEdge[],
previousSourceHash?: string,
): GraphPatchPayload {
- // Build lookup: calleeName → { calleeFilePath, calleeQualifiedKey }
- const callResolution = new Map<string, { calleeFilePath: string; calleeQualifiedKey: string }>();
+ // Build lookup: `${predicate}:${dstName}` → { dstFilePath, dstQualifiedKey }
+ const edgeResolution = new Map<string, { dstFilePath: string; dstQualifiedKey: string }>();
for (const edge of resolvedEdges) {
- if (edge.callerFilePath === result.filePath) {
- callResolution.set(edge.calleeName, {
- calleeFilePath: edge.calleeFilePath,
- calleeQualifiedKey: edge.calleeQualifiedKey,
+ if (edge.srcFilePath === result.filePath) {
+ edgeResolution.set(`${edge.predicate}:${edge.dstName}`, {
+ dstFilePath: edge.dstFilePath,
+ dstQualifiedKey: edge.dstQualifiedKey,
});
}
}
@@ -229,11 +246,12 @@ export function buildPatchWithResolution(
? resolveKey(r.dstName, r.srcName)
: resolveKey(r.dstName);
- // For CALLS edges with a cross-file resolution, use the callee file's nodeId
+ // For cross-file resolved edges (CALLS, EXTENDS), use the defining file's nodeId
let dstNodeId: string;
- if (r.predicate === 'CALLS' && callResolution.has(r.dstName)) {
- const { calleeFilePath, calleeQualifiedKey } = callResolution.get(r.dstName)!;
- dstNodeId = nodeId(calleeFilePath, calleeQualifiedKey);
+ const resolutionKey = `${r.predicate}:${r.dstName}`;
+ if (edgeResolution.has(resolutionKey)) {
+ const { dstFilePath, dstQualifiedKey } = edgeResolution.get(resolutionKey)!;
+ dstNodeId = nodeId(dstFilePath, dstQualifiedKey);
} else {
dstNodeId = nodeId(filePath, dstKey);
}
@@ -259,10 +277,12 @@ export function buildPatchWithResolution(
});
}
- const patchId = deterministicId(`${filePath}:${sourceHash}`);
+ const extractor = extractorName();
+ const patchId = computePatchId(filePath, sourceHash, extractor);
const previousPatchId = previousSourceHash
- ? deterministicId(`${filePath}:${previousSourceHash}`)
- : undefined;
+ ? computePatchId(filePath, previousSourceHash, extractor)
+ : legacyPatchId(filePath, sourceHash);
+ const replaces = [previousPatchId, ...PREVIOUS_EXTRACTORS.map(prev => computePatchId(filePath, sourceHash, prev))];
return {
patchId,
@@ -271,12 +291,12 @@ export function buildPatchWithResolution(
source: {
uri: filePath,
sourceHash,
- extractor: extractorName(),
+ extractor,
sourceType: sourceType(filePath),
},
baseRev: 0,
ops,
- replaces: previousPatchId ? [previousPatchId] : [],
+ replaces,
intent: `Parsed ${nodePath.basename(filePath)}`,
};
}
diff --git a/core-ingestion/src/queries.ts b/core-ingestion/src/queries.ts
index af4b73ee..b99ceea5 100644
--- a/core-ingestion/src/queries.ts
+++ b/core-ingestion/src/queries.ts
@@ -80,6 +80,15 @@ export const TYPESCRIPT_QUERIES = `
(class_heritage
(implements_clause
(type_identifier) @heritage.implements))) @heritage.impl
+
+; Heritage queries - interface extends interface
+(interface_declaration
+ name: (type_identifier) @heritage.class
+ (extends_type_clause
+ (type_identifier) @heritage.extends)) @heritage
+
+; Type references — captures types used in annotations/parameters/return types
+(type_annotation (type_identifier) @reference.type)
`;
// JavaScript queries - works with tree-sitter-javascript
@@ -180,6 +189,10 @@ export const PYTHON_QUERIES = `
name: (identifier) @heritage.class
superclasses: (argument_list
(identifier) @heritage.extends)) @heritage
+
+; Type references — captures types used in type annotations / hints
+(typed_parameter type: (identifier) @reference.type)
+(typed_default_parameter type: (identifier) @reference.type)
`;
// Java queries - works with tree-sitter-java
@@ -211,6 +224,12 @@ export const JAVA_QUERIES = `
; Heritage - implements interfaces
(class_declaration name: (identifier) @heritage.class
(super_interfaces (type_list (type_identifier) @heritage.implements))) @heritage.impl
+
+; Type references — captures types used in field/param/return-type positions
+(field_declaration type: (type_identifier) @reference.type)
+(formal_parameter type: (type_identifier) @reference.type)
+(local_variable_declaration type: (type_identifier) @reference.type)
+(method_declaration type: (type_identifier) @reference.type)
`;
// C queries - works with tree-sitter-c
@@ -242,6 +261,10 @@ export const C_QUERIES = `
; Calls
(call_expression function: (identifier) @call.name) @call
(call_expression function: (field_expression field: (field_identifier) @call.name)) @call
+
+; Type references — captures types used in declaration/parameter positions
+(declaration type: (type_identifier) @reference.type)
+(parameter_declaration type: (type_identifier) @reference.type)
`;
// Go queries - works with tree-sitter-go
@@ -273,6 +296,11 @@ export const GO_QUERIES = `
; Struct literal construction: User{Name: "Alice"}
(composite_literal type: (type_identifier) @call.name) @call
+
+; Type references — captures types used in field/param/return-type positions
+(field_declaration type: (type_identifier) @reference.type)
+(parameter_declaration type: (type_identifier) @reference.type)
+(result type: (type_identifier) @reference.type)
`;
// C++ queries - works with tree-sitter-cpp
@@ -344,6 +372,10 @@ export const CPP_QUERIES = `
(base_class_clause (type_identifier) @heritage.extends)) @heritage
(class_specifier name: (type_identifier) @heritage.class
(base_class_clause (access_specifier) (type_identifier) @heritage.extends)) @heritage
+
+; Type references — captures types used in declaration/parameter positions
+(declaration type: (type_identifier) @reference.type)
+(parameter_declaration type: (type_identifier) @reference.type)
`;
// C# queries - works with tree-sitter-c-sharp
@@ -398,6 +430,12 @@ export const CSHARP_QUERIES = `
(base_list (identifier) @heritage.extends)) @heritage
(class_declaration name: (identifier) @heritage.class
(base_list (generic_name (identifier) @heritage.extends))) @heritage
+
+; Type references — captures types used in field/param/return-type positions
+(parameter type: (identifier) @reference.type)
+(variable_declaration type: (identifier) @reference.type)
+(field_declaration type: (identifier) @reference.type)
+(method_declaration return_type: (identifier) @reference.type)
`;
// Rust queries - works with tree-sitter-rust
@@ -429,6 +467,11 @@ export const RUST_QUERIES = `
; Struct literal construction: User { name: value }
(struct_expression name: (type_identifier) @call.name) @call
+; Type references — captures types used in field/param/return-type positions
+(field_declaration type: (type_identifier) @reference.type)
+(parameter pattern: (_) type: (type_identifier) @reference.type)
+(function_item return_type: (type_identifier) @reference.type)
+
; Heritage (trait implementation) — all combinations of concrete/generic trait × concrete/generic type
(impl_item trait: (type_identifier) @heritage.trait type: (type_identifier) @heritage.class) @heritage
(impl_item trait: (generic_type type: (type_identifier) @heritage.trait) type: (type_identifier) @heritage.class) @heritage
@@ -516,6 +559,9 @@ export const PHP_QUERIES = `
body: (declaration_list
(use_declaration
[(name) (qualified_name)] @heritage.trait))) @heritage
+
+; ── Type references ───────────────────────────────────────────────────────────
+(named_type (name) @reference.type)
`;
// Ruby queries - works with tree-sitter-ruby
@@ -641,6 +687,9 @@ export const KOTLIN_QUERIES = `
(delegation_specifier
(constructor_invocation
(user_type (type_identifier) @heritage.extends)))) @heritage
+
+; ── Type references ───────────────────────────────────────────────────────────
+(type_reference (user_type (type_identifier) @reference.type))
`;
// Swift queries - works with tree-sitter-swift
@@ -699,6 +748,9 @@ export const SWIFT_QUERIES = `
; Extensions wrap the name in user_type unlike class/struct/enum declarations
(class_declaration "extension" name: (user_type (type_identifier) @heritage.class)
(inheritance_specifier inherits_from: (user_type (type_identifier) @heritage.extends))) @heritage
+
+; Type references — captures types used in annotations/parameters/return types
+(type_annotation (user_type (type_identifier) @reference.type))
`;
// Scala queries - works with tree-sitter-scala
@@ -727,14 +779,11 @@ export const SCALA_QUERIES = `
(type_definition
name: (type_identifier) @name) @definition.type
-; ── Imports: simple path segments (import a.b.C → captures a, b, C) ─────────
-(import_declaration
- (identifier) @import.source) @import
-
-; ── Imports: selective { X, Y } (import a.b.{C, D}) ─────────────────────────
-(import_declaration
- (namespace_selectors
- (identifier) @import.source)) @import
+; ── Imports: capture full declaration for dotted-path reconstruction ─────────
+; Handles: import ix.memory.model._ (wildcard)
+; import ix.memory.model.{NodeKind, GraphNode} (selective)
+; import ix.memory.model.NodeKind (simple)
+(import_declaration) @import.stmt
; ── Calls: direct function call ──────────────────────────────────────────────
(call_expression
@@ -764,6 +813,43 @@ export const SCALA_QUERIES = `
name: (identifier) @heritage.class
extend: (extends_clause
(type_identifier) @heritage.extends)) @heritage
+
+; ── Type references ───────────────────────────────────────────────────────────
+; Case class parameter types: case class Foo(x: NodeKind)
+(class_parameter (type_identifier) @reference.type)
+; Method parameter types: def foo(x: NodeKind)
+(parameter (type_identifier) @reference.type)
+; Val/var type annotations: val x: NodeKind = ...
+(val_definition (type_identifier) @reference.type)
+(var_definition (type_identifier) @reference.type)
+; Return type annotations: def foo(): NodeKind = ...
+; (type_identifier is a direct child of function_definition, no named field)
+(function_definition (type_identifier) @reference.type)
+; Generic type arguments: Map[NodeId, NodeKind], Option[NodeKind], Set[NodeKind], etc.
+(generic_type (type_arguments (type_identifier) @reference.type))
+
+; ── Qualified singleton / companion-object member access ──────────────────────
+; Two grammar shapes arise in practice:
+; expression context: NodeKind.Class → field_expression
+; pattern context: case Some(NodeKind.Class) => … → stable_identifier
+; Both shapes are captured below. The (#match? ^[A-Z]) predicates restrict to
+; UpperCamelCase identifiers (Scala convention for case objects / companion
+; object members), filtering out lowercase method / field names.
+
+; Expression: val x = NodeKind.Decision
+(field_expression
+ value: (identifier) @_qualifier
+ field: (identifier) @call.name
+ (#match? @_qualifier "^[A-Z]")
+ (#match? @call.name "^[A-Z]"))
+
+; Pattern: case Some(NodeKind.Class) | Some(NodeKind.Trait) => …
+(stable_identifier
+ (identifier) @_qualifier
+ "."
+ (identifier) @call.name
+ (#match? @_qualifier "^[A-Z]")
+ (#match? @call.name "^[A-Z]"))
`;
export const LANGUAGE_QUERIES: Record<SupportedLanguages, string> = {
diff --git a/ix-cli/src/cli/commands/depends.ts b/ix-cli/src/cli/commands/depends.ts
index 2bf57d57..5e9ae1c7 100644
--- a/ix-cli/src/cli/commands/depends.ts
+++ b/ix-cli/src/cli/commands/depends.ts
@@ -55,15 +55,22 @@ export async function buildDependencyTree(
]);
const children: DependencyNode[] = [];
+ // Track IDs added at this level to suppress same-level duplicates from
+ // multiple edge types (e.g. a node that both EXTENDS and REFERENCES the
+ // root would otherwise appear twice, the second time as a spurious cycle).
+ const levelSeen = new Set<string>();
const processNodes = async (nodes: any[], relation: "called_by" | "imported_by" | "referenced_by" | "extended_by" | "implemented_by", sourceEdge: "CALLS" | "IMPORTS" | "REFERENCES" | "EXTENDS" | "IMPLEMENTS") => {
for (const n of nodes) {
if (nodesVisited >= maxNodes) { truncated = true; break; }
+ // Skip if already emitted at this level via a different edge type.
+ if (levelSeen.has(n.id)) continue;
const name = n.name || n.attrs?.name || "";
const resolved = !!name && !isRawId(name);
const isCycle = visited.has(n.id);
nodesVisited++;
+ levelSeen.add(n.id);
visited.add(n.id);
const child: DependencyNode = {
@@ -139,13 +146,15 @@ export function registerDependsCommand(program: Command): void {
.option("--path <path>", "Prefer symbols from files matching this path substring")
.option("--pick <n>", "Pick Nth candidate from ambiguous results (1-based)")
.option("--depth <n>", "Limit traversal depth (default: full tree)")
+ .option("--all", "Remove the 200-node cap and show the complete tree")
.option("--format <fmt>", "Output format (text|json)", "text")
.addHelpText("after", `\nExamples:
ix depends verify_token
ix depends pickBest --format json
ix depends AuthProvider --depth 2
- ix depends parser.py --kind file`)
- .action(async (symbol: string, opts: { kind?: string; path?: string; pick?: string; depth?: string; format: string }) => {
+ ix depends parser.py --kind file
+ ix depends NodeKind --pick 1 --all`)
+ .action(async (symbol: string, opts: { kind?: string; path?: string; pick?: string; depth?: string; all?: boolean; format: string }) => {
const client = new IxClient(getEndpoint());
// Validate --pick
@@ -162,9 +171,10 @@ export function registerDependsCommand(program: Command): void {
if (!target) return;
const maxDepth = opts.depth ? parseInt(opts.depth, 10) : DEFAULT_MAX_DEPTH;
+ const maxNodes = opts.all ? Infinity : MAX_NODES;
const { tree, truncated, nodesVisited, maxDepthReached } = await buildDependencyTree(
- client, target.id, { maxDepth },
+ client, target.id, { maxDepth, maxNodes },
);
// ── JSON output ──────────────────────────────────────────────
diff --git a/ix-cli/src/cli/commands/ingest.ts b/ix-cli/src/cli/commands/ingest.ts
index 5d4a4171..86a290bf 100644
--- a/ix-cli/src/cli/commands/ingest.ts
+++ b/ix-cli/src/cli/commands/ingest.ts
@@ -94,7 +94,7 @@ async function ingestFiles(
path: string,
opts: { recursive?: boolean; force?: boolean; format: string; root?: string }
): Promise<void> {
- const [{ parseFile, resolveCallEdges, isGrammarSupported }, { buildPatchWithResolution }] = await loadIngestionModules();
+ const [{ parseFile, resolveEdges, isGrammarSupported }, { buildPatchWithResolution }] = await loadIngestionModules();
const resolvedPath = nodePath.isAbsolute(path)
? path
: nodePath.resolve(resolveWorkspaceRoot(opts.root), path);
@@ -158,13 +158,14 @@ async function ingestFiles(
entitiesParsed += parsed.entities.length;
const previousHash = knownHashes.get(filePath);
parsedFiles.push({ filePath, parsed, hash, previousHash: previousHash !== hash ? previousHash : undefined });
- } catch {
+ } catch (err) {
parseErrors++;
+ process.stderr.write(`\n [parse error] ${filePath}: ${err}\n`);
}
}
- // Phase 2: cross-file CALLS resolution over the full batch
- const resolvedEdges = resolveCallEdges(parsedFiles.map(f => f.parsed));
+ // Phase 2: cross-file CALLS + EXTENDS resolution over the full batch
+ const resolvedEdges = resolveEdges(parsedFiles.map(f => f.parsed));
// Phase 3: build and commit patches
for (const { parsed, hash, previousHash } of parsedFiles) {
@@ -173,8 +174,9 @@ async function ingestFiles(
const result = await client.commitPatch(patch);
if (result.rev > latestRev) latestRev = result.rev;
patchesApplied++;
- } catch {
+ } catch (err) {
parseErrors++;
+ process.stderr.write(`\n [commit error] ${parsed.filePath}: ${err}\n`);
}
}
} finally {
diff --git a/ix-cli/src/cli/commands/ingestion-loader.ts b/ix-cli/src/cli/commands/ingestion-loader.ts
index 14088c5a..80a5c290 100644
--- a/ix-cli/src/cli/commands/ingestion-loader.ts
+++ b/ix-cli/src/cli/commands/ingestion-loader.ts
@@ -3,7 +3,7 @@ import { fileURLToPath, pathToFileURL } from "node:url";
type IngestionModule = {
parseFile: (filePath: string, source: string) => any;
- resolveCallEdges: (results: any[]) => any[];
+ resolveEdges: (results: any[]) => any[];
isGrammarSupported: (filePath: string) => boolean;
};