Understand any codebase instantly. System intelligence for codebases, built for humans and AI.
TypeScript aiai-memoryclaude-codeclicode-analysiscode-mappingcode-memorycodebase-understandingcodexdeveloper-toolsllmopenclawpersistent-memoryprogram-analysissoftware-architecturesystem-intelligencesystem-mapping
fix: restore cats traverse in ArangoClient.query and untrack stale dist/
Tanner Kocherd5e6557f9b69
diff --git a/core-ingestion/dist/index.d.ts b/core-ingestion/dist/index.d.tsdeleted file mode 100644index 9eab1f0d..00000000--- a/core-ingestion/dist/index.d.ts+++ /dev/null@@ -1,103 +0,0 @@-import { SupportedLanguages } from './languages.js';-import type { RoleClassification } from './role-classifier.js';-export interface ParsedEntity {- name: string;- kind: string;- lineStart: number;- lineEnd: number;- language: string;- /** Direct enclosing class/interface/trait, if any (undefined for file-level entities). */- container?: string;-}-/** A semantic code span extracted from the AST. The primary LLM retrieval unit. */-export interface ParsedChunk {- /** Semantic name of the chunk (function/class/trait name), or null for file_body. */- name: string | null;- /** Chunk kind: "function" | "method" | "class" | "interface" | "trait" | "module_block" | "file_body" */- chunkKind: string;- lineStart: number;- lineEnd: number;- startByte: number;- endByte: number;- /** SHA-256 of the chunk source text for change detection and stable identity. */- contentHash: string;- language: string;- /** Name of the directly enclosing class/trait/interface, if any. */- container?: string;-}-export interface ParsedRelationship {- srcName: string;- dstName: string;- predicate: string;-}-export interface FileParseResult {- filePath: string;- language: SupportedLanguages;- entities: ParsedEntity[];- chunks: ParsedChunk[];- relationships: ParsedRelationship[];- fileRole: RoleClassification;-}-/** Returns true if a grammar is installed for the given file's language. */-export declare function isGrammarSupported(filePath: string): boolean;-export declare function parseFile(filePath: string, source: string, opts?: {- emitChunks?: boolean;-}): FileParseResult | null;-export interface ResolvedCallEdge {- callerFilePath: string;- callerName: string;- calleeFilePath: string;- calleeName: string;- 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 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: 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 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)- * - 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/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[], stats?: {- importLookups: number;- transitiveLookups: number;- globalFallbacks: number;- globalCandidateTotal: number;- resolvedImport: number;- resolvedTransitive: number;- resolvedGlobal: number;- resolvedQualifier: number;- skippedSameFile: number;- skippedAmbiguous: number;-}): 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.jsdeleted file mode 100644index dabe5504..00000000--- a/core-ingestion/dist/index.js+++ /dev/null@@ -1,1066 +0,0 @@-import * as nodePath from 'node:path';-import * as crypto from 'node:crypto';-import { createRequire } from 'node:module';-// @ts-ignore — tree-sitter has no bundled types-import Parser from 'tree-sitter';-// @ts-ignore-import JavaScript from 'tree-sitter-javascript';-// @ts-ignore-import TypeScript from 'tree-sitter-typescript';-// @ts-ignore-import Python from 'tree-sitter-python';-// @ts-ignore-import Java from 'tree-sitter-java';-// @ts-ignore-import C from 'tree-sitter-c';-// @ts-ignore-import CPP from 'tree-sitter-cpp';-// @ts-ignore-import CSharp from 'tree-sitter-c-sharp';-// @ts-ignore-import Go from 'tree-sitter-go';-// @ts-ignore-import Rust from 'tree-sitter-rust';-// @ts-ignore-import Ruby from 'tree-sitter-ruby';-// @ts-ignore-import PHP from 'tree-sitter-php';-// @ts-ignore-import Scala from 'tree-sitter-scala';-const _require = createRequire(import.meta.url);-function tryLoadGrammar(pkg) {- try {- return _require(pkg);- }- catch {- return null;- }-}-const Kotlin = tryLoadGrammar('tree-sitter-kotlin');-const Swift = tryLoadGrammar('tree-sitter-swift');-import { SupportedLanguages, languageFromPath } from './languages.js';-import { LANGUAGE_QUERIES } from './queries.js';-import { classifyFileRole } from './role-classifier.js';-// ----------------------------------------------------------------------------// Language → grammar map-// ----------------------------------------------------------------------------const GRAMMAR_MAP = {- [SupportedLanguages.JavaScript]: JavaScript,- [SupportedLanguages.TypeScript]: TypeScript.typescript,- [SupportedLanguages.Python]: Python,- [SupportedLanguages.Java]: Java,- [SupportedLanguages.C]: C,- [SupportedLanguages.CPlusPlus]: CPP,- [SupportedLanguages.CSharp]: CSharp,- [SupportedLanguages.Go]: Go,- [SupportedLanguages.Rust]: Rust,- [SupportedLanguages.Ruby]: Ruby,- [SupportedLanguages.PHP]: PHP.php_only,- [SupportedLanguages.Scala]: Scala,- ...(Kotlin ? { [SupportedLanguages.Kotlin]: Kotlin } : {}),- ...(Swift ? { [SupportedLanguages.Swift]: Swift } : {}),-};-// Capture key prefix → NodeKind string-const DEFINITION_KIND_MAP = {- 'definition.class': 'class',- 'definition.interface': 'interface',- 'definition.function': 'function',- 'definition.method': 'method',- 'definition.struct': 'class',- 'definition.enum': 'class',- 'definition.trait': 'trait',- 'definition.module': 'module',- 'definition.namespace': 'module',- 'definition.impl': 'class',- 'definition.type': 'class',- 'definition.property': 'function',- 'definition.const': 'function',- 'definition.static': 'function',- 'definition.macro': 'function',- 'definition.union': 'class',- 'definition.typedef': 'class',- 'definition.template': 'class',- 'definition.record': 'class',- 'definition.delegate': 'class',- '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 — split by language family to avoid-// suppressing valid method names in other languages (e.g. `filter` is a Python-// builtin but also a common ORM method; `warn`/`error` are JS console methods-// but also valid Python logging method names).-// Keywords and pseudo-variables that are never valid call targets in any language.-const SHARED_BUILTINS = new Set([- 'if', 'for', 'while', 'return', 'new', 'this', 'self',- 'undefined', 'null', 'true', 'false',- 'println', // Scala/Java/Kotlin/Rust standard-output builtin — noise in any language-]);-// Python-specific builtins (bare function calls like `len(x)`, `range(n)`, etc.)-const PYTHON_BUILTINS = new Set([- ...SHARED_BUILTINS,- 'print', 'len', 'range', 'int', 'str', 'float', 'list', 'dict',- 'set', 'tuple', 'type', 'isinstance', 'super', 'property', 'enumerate',- 'zip', 'map', 'filter', 'sorted', 'any', 'all', 'min', 'max', 'sum',- 'open', 'repr', 'abs', 'round', 'hash', 'id', 'callable', 'iter', 'next',- 'vars', 'dir', 'getattr', 'setattr', 'hasattr', 'delattr',-]);-// JavaScript/TypeScript-specific builtins-const JS_BUILTINS = new Set([- ...SHARED_BUILTINS,- 'console', 'log', 'warn', 'error', 'debug', 'info',- 'module', 'exports',- 'Promise', 'Array', 'Object', 'String', 'Number', 'Boolean', 'JSON',- 'Math', 'Date', 'Error', 'Map', 'Set', 'Symbol',- 'setTimeout', 'setInterval', 'clearTimeout', 'clearInterval',- 'process', 'Buffer', 'global', 'window', 'document',- 'require', 'fetch', 'parseInt', 'parseFloat', 'isNaN', 'isFinite',-]);-// Per-language BUILTINS lookup — falls back to shared for languages without a-// specific set (e.g. Java, Go, Rust) so they only skip obvious non-calls.-function builtinsForLanguage(lang) {- switch (lang) {- case SupportedLanguages.Python:- return PYTHON_BUILTINS;- case SupportedLanguages.JavaScript:- case SupportedLanguages.TypeScript:- return JS_BUILTINS;- default:- return SHARED_BUILTINS;- }-}-/** Returns true if a grammar is installed for the given file's language. */-export function isGrammarSupported(filePath) {- const language = languageFromPath(filePath);- if (!language)- return false;- if (filePath.endsWith('.tsx'))- return true; // TSX uses TypeScript.tsx, always available- return GRAMMAR_MAP[language] !== undefined;-}-// ----------------------------------------------------------------------------// Parser instance (reused across calls)-// ----------------------------------------------------------------------------let _parser = null;-const _queryCache = new Map();-function getParser() {- if (!_parser)- _parser = new Parser();- return _parser;-}-function getCachedQuery(language, grammar, querySource) {- const cached = _queryCache.get(language);- if (cached && cached.grammar === grammar)- return cached.query;- const query = new Parser.Query(grammar, querySource);- _queryCache.set(language, { grammar, query });- return query;-}-// ----------------------------------------------------------------------------// Rust: cfg macro unwrapping-// ----------------------------------------------------------------------------/**- * Blanks out feature-gating macro wrappers in Rust source so that the items- * inside become visible to tree-sitter as top-level declarations.- *- * Replaces `cfg_rt! { ... }` (and similar) with the body contents in-place,- * preserving every character position and line number so that entity line- * numbers remain accurate.- */-function unwrapRustCfgMacros(source) {- const re = /\bcfg_(?:rt_multi_thread|not_rt|rt|io|time|sync|net|fs|process|signal)!\s*\{/g;- const chars = source.split('');- let m;- while ((m = re.exec(source)) !== null) {- const openBrace = m.index + m[0].length - 1; // position of the `{`- // Find matching closing brace by counting depth- let depth = 0;- let closeBrace = -1;- for (let i = openBrace; i < source.length; i++) {- if (source[i] === '{')- depth++;- else if (source[i] === '}') {- depth--;- if (depth === 0) {- closeBrace = i;- break;- }- }- }- if (closeBrace === -1)- continue;- // Blank out everything from start of macro name up to and including `{`- for (let i = m.index; i <= openBrace; i++) {- if (chars[i] !== '\n')- chars[i] = ' ';- }- // Blank out the matching closing `}`- chars[closeBrace] = ' ';- }- return chars.join('');-}-// ----------------------------------------------------------------------------// Main parse function-// ----------------------------------------------------------------------------export function parseFile(filePath, source, opts) {- const language = languageFromPath(filePath);- if (!language)- return null;- // TypeScript TSX uses a separate grammar- const isTsx = filePath.endsWith('.tsx');- const grammar = isTsx ? TypeScript.tsx : GRAMMAR_MAP[language];- if (!grammar)- return null;- const queries = LANGUAGE_QUERIES[language];- if (!queries)- return null;- try {- const parser = getParser();- parser.setLanguage(grammar);- // tree-sitter-java cannot parse array-type annotations on varargs params- // (e.g. `@Nullable Object @Nullable ... args`). The second annotation causes- // error recovery to truncate the enclosing class_declaration, orphaning all- // subsequent methods. Strip any @Annotation immediately before `...` in-memory- // so the class body parses correctly.- let parseSource = language === SupportedLanguages.Java- ? source.replace(/@\w+\s*(?=\.\.\.)/g, '')- : source;- // Rust: unwrap feature-gating macros (cfg_rt! { ... }, cfg_io! { ... }, etc.)- // These macros are transparent pass-throughs — their bodies contain normal items- // that tree-sitter cannot see because they are parsed as raw token_tree nodes.- // We blank out the macro call and matching closing brace in-place (preserving- // character positions and line numbers) so the inner items become top-level.- if (language === SupportedLanguages.Rust) {- parseSource = unwrapRustCfgMacros(parseSource);- }- const tree = parser.parse(parseSource, undefined, { bufferSize: parseSource.length + 1 });- const cacheKey = isTsx ? 'tsx' : language;- const query = getCachedQuery(cacheKey, grammar, queries);- const matches = query.matches(tree.rootNode);- const fileName = nodePath.basename(filePath);- let sourceLineCount = 1;- for (let i = 0; i < source.length; i++) {- if (source.charCodeAt(i) === 10)- sourceLineCount++;- }- const entities = [- { name: fileName, kind: 'file', lineStart: 1, lineEnd: sourceLineCount, language },- ];- const chunks = [];- const relationships = [];- const pendingChunks = [];- // Track class ranges for containment: [name, startLine, endLine]- 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();- // Python: map function name → (param name → declared type) for typed-parameter qualifier substitution- const paramTypeMap = new Map();- // Python: map function name → (variable name → assigned type) for untyped-param qualifier substitution- const assignTypeMap = new Map();- // --- First pass: collect definitions ---- for (const match of matches) {- // Definition captures: name + definition.*- const defCapture = match.captures.find((c) => c.name.startsWith('definition.'));- const nameCapture = match.captures.find((c) => c.name === 'name');- if (defCapture) {- const kind = DEFINITION_KIND_MAP[defCapture.name] ?? 'function';- const name = nameCapture?.node.text- ?? (defCapture.name === 'definition.constructor' ? 'init' : '');- if (!name || name.length === 0)- continue;- const defNode = defCapture.node;- const lineStart = defNode.startPosition.row + 1;- const lineEnd = defNode.endPosition.row + 1;- const startByte = defNode.startIndex;- const endByte = defNode.endIndex;- // Containment: file CONTAINS or class CONTAINS.- // For Go methods the receiver type IS the container — methods are defined- // outside the struct body so findEnclosing() always returns null for them.- // The receiver.type capture (emitted by the Go method queries) overrides this.- const enclosing = findEnclosing(classRanges, lineStart, name);- const receiverCapture = match.captures.find((c) => c.name === 'receiver.type');- // heritageClassCapture is set by the Go interface method query, where @heritage.class- // captures the interface name and serves as the container (like receiver.type for structs).- const heritageClassCapture = match.captures.find((c) => c.name === 'heritage.class');- const effectiveContainer = (receiverCapture && kind === 'method')- ? receiverCapture.node.text- : (heritageClassCapture && kind === 'method')- ? heritageClassCapture.node.text- : (enclosing ?? undefined);- entities.push({- name,- kind,- lineStart,- lineEnd,- language,- container: effectiveContainer,- });- pendingChunks.push({- name,- chunkKind: kind,- lineStart,- lineEnd,- startByte,- endByte,- language,- container: enclosing ?? undefined,- });- if (kind === 'class' || kind === 'interface' || kind === 'trait') {- classRanges.push({ name, start: lineStart, end: lineEnd });- }- if (effectiveContainer) {- relationships.push({ srcName: effectiveContainer, dstName: name, predicate: 'CONTAINS' });- }- else {- relationships.push({ srcName: fileName, dstName: name, predicate: 'CONTAINS' });- }- continue;- }- // Heritage: EXTENDS- const heritageClass = match.captures.find((c) => c.name === 'heritage.class');- const heritageExtends = match.captures.find((c) => c.name === 'heritage.extends' || c.name === 'heritage.trait');- if (heritageClass && heritageExtends) {- relationships.push({- srcName: heritageClass.node.text,- dstName: heritageExtends.node.text,- predicate: 'EXTENDS',- });- continue;- }- // Heritage: IMPLEMENTS (separate edge type, use EXTENDS for simplicity)- const heritageImpl = match.captures.find((c) => c.name === 'heritage.implements');- if (heritageClass && heritageImpl) {- relationships.push({- srcName: heritageClass.node.text,- dstName: heritageImpl.node.text,- predicate: 'EXTENDS',- });- continue;- }- // Python typed parameters: build paramTypeMap for qualifier substitution in the second pass.- // Maps function name → (param name → declared type) so that e.g. `query: Query` lets us- // rewrite `query.filter(...)` → `Query.filter` when building effectiveCallee.- if (language === SupportedLanguages.Python) {- const typedParamScope = match.captures.find((c) => c.name === '_typed_param_scope');- const typedParamName = match.captures.find((c) => c.name === '_typed_param_name');- const typedParamType = match.captures.find((c) => c.name === '_typed_param_type');- if (typedParamScope && typedParamName && typedParamType) {- const funcName = typedParamScope.node.childForFieldName?.('name')?.text;- if (funcName) {- if (!paramTypeMap.has(funcName))- paramTypeMap.set(funcName, new Map());- paramTypeMap.get(funcName).set(typedParamName.node.text, typedParamType.node.text);- }- continue;- }- // Assignment tracking: x = SomeClass() or x = Model.objects.method()- const assignScope = match.captures.find((c) => c.name === '_assign_scope');- const assignLhs = match.captures.find((c) => c.name === '_assign_lhs');- const assignRhsType = match.captures.find((c) => c.name === '_assign_rhs_type');- if (assignScope && assignLhs && assignRhsType) {- // Only track PascalCase RHS names (constructors by convention).- // Lowercase function calls like `select(...)` or `create_engine(...)` are skipped- // to avoid cross-module false edges (e.g. orm.query → select.where in SQLAlchemy).- const rhsName = assignRhsType.node.text;- if (/^[A-Z]/.test(rhsName)) {- const funcName = assignScope.node.childForFieldName?.('name')?.text;- if (funcName) {- if (!assignTypeMap.has(funcName))- assignTypeMap.set(funcName, new Map());- assignTypeMap.get(funcName).set(assignLhs.node.text, rhsName);- }- }- continue;- }- }- }- // --- Second pass: calls and imports ---- for (const match of matches) {- // 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- .replace(/^["'`]|["'`]$/g, '') // strip quotes- .replace(/\\\\/g, '/'); // normalise backslashes- if (importPath.length > 0 && importPath !== '*') {- const rawMod = importPath.split('/').filter((s) => s !== '*').pop() ?? importPath;- const modName = rawMod.replace(/^\.+/, ''); // strip leading dots: '.models' → 'models'- if (!modName)- continue; // skip bare '.' relative imports- entities.push({ name: modName, kind: 'module', lineStart: importSource.node.startPosition.row + 1, lineEnd: importSource.node.startPosition.row + 1, language });- relationships.push({ srcName: fileName, dstName: modName, predicate: 'IMPORTS' });- }- continue;- }- // Import name captures (e.g. from . import utils — the symbol name, not the module path)- const importName = match.captures.find((c) => c.name === 'import.name');- if (importName) {- const name = importName.node.text;- if (name && name !== '*' && name.length > 1) {- entities.push({ name, kind: 'module', lineStart: importName.node.startPosition.row + 1, lineEnd: importName.node.startPosition.row + 1, language });- relationships.push({ srcName: fileName, dstName: name, predicate: 'IMPORTS' });- }- continue;- }- // Call captures- const callName = match.captures.find((c) => c.name === 'call.name');- if (callName) {- const callee = callName.node.text;- if (!callee || callee.length <= 1)- continue;- // If a _qualifier capture is present (field_expression / stable_identifier- // patterns like NodeKind.Decision, or Python attribute calls like- // Session.execute), emit the fully qualified name so that resolution can use- // the qualifier to break ties between same-named symbols in different files.- // BUILTINS filtering is skipped for attribute calls: method names like- // `filter` or `map` are Python builtins when called bare, but are valid- // user-defined method calls when invoked as `query.filter(...)`.- const qualifierCapture = match.captures.find((c) => c.name === '_qualifier');- if (builtinsForLanguage(language).has(callee) && !qualifierCapture)- continue;- // 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)- ?? findEnclosing(classRanges, callLine, '')- ?? fileName;- const scope = caller;- if (!seenCalls.has(scope))- seenCalls.set(scope, new Set());- const seen = seenCalls.get(scope);- const effectiveCallee = (() => {- if (!qualifierCapture)- return callee;- let qualifier = qualifierCapture.node.text;- // Python: 'self'/'cls' always refers to the enclosing class — substitute it- // so the edge reads 'Query.filter' instead of 'self.filter', enabling- // same-file resolution without type inference.- if (language === SupportedLanguages.Python && (qualifier === 'self' || qualifier === 'cls')) {- const enclosingClass = findEnclosing(classRanges, callLine, '');- if (enclosingClass)- qualifier = enclosingClass;- }- else if (qualifier === 'this') {- // JS/TS: 'this' inside a class method refers to the enclosing class.- // Substitute so e.g. `this.save()` → `Document.save` instead of `this.save`.- const enclosingClass = findEnclosing(classRanges, callLine, '');- if (enclosingClass)- qualifier = enclosingClass;- }- else if (language === SupportedLanguages.Python) {- // Typed-parameter substitution: if the qualifier is a param with a declared type,- // use the type name so e.g. `query.filter(...)` → `Query.filter`.- // Also check assignTypeMap for variables assigned from constructor/ORM calls.- const funcName = findEnclosingFunction(entities, callLine);- if (funcName) {- const typeForParam = paramTypeMap.get(funcName)?.get(qualifier);- const typeForAssign = assignTypeMap.get(funcName)?.get(qualifier);- if (typeForParam)- qualifier = typeForParam;- else if (typeForAssign)- qualifier = typeForAssign;- }- }- return `${qualifier}.${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;- }- }- if (opts?.emitChunks !== false) {- for (const pendingChunk of pendingChunks) {- const chunkText = source.slice(pendingChunk.startByte, pendingChunk.endByte);- const contentHash = crypto.createHash('sha256').update(chunkText).digest('hex').slice(0, 16);- chunks.push({- ...pendingChunk,- contentHash,- });- }- // Fallback: if no semantic chunks found, emit one file_body chunk covering the whole file- if (chunks.length === 0) {- const contentHash = crypto.createHash('sha256').update(source).digest('hex').slice(0, 16);- chunks.push({- name: null,- chunkKind: 'file_body',- lineStart: 1,- lineEnd: sourceLineCount,- startByte: 0,- endByte: source.length,- contentHash,- language,- });- }- }- return { filePath, language, entities, chunks, relationships, fileRole: classifyFileRole(filePath, source) };- }- catch {- return null;- }-}-// ----------------------------------------------------------------------------// resolveCallEdges helpers-// ----------------------------------------------------------------------------/** Build the qualified key for an entity (mirrors buildPatch's entityQKey logic). */-function qualifiedKey(e) {- return e.container ? `${e.container}.${e.name}` : e.name;-}-/**- * Given a file's qualified-key map and a plain callee name, return the single- * unambiguous qualified key, or null if the name maps to 0 or >1 entities.- * Callers must treat null as "do not emit" to avoid dangling nodeIds.- */-function bestQKey(fileQKeys, filePath, plainName) {- const qks = [...new Set(fileQKeys.get(filePath)?.get(plainName) ?? [])];- return qks.length === 1 ? qks[0] : null;-}-/**- * 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: 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 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)- * - 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/class: dstQualifiedKey === dstName- * - Unambiguous class method: dstQualifiedKey === 'ClassName.method'- * - Ambiguous (two entities share the same plain name): edge not emitted- */-export function resolveEdges(results, stats) {- // Provide a default no-op stats bag when caller passes none (backward compat).- if (!stats)- stats = {- importLookups: 0, transitiveLookups: 0, globalFallbacks: 0,- globalCandidateTotal: 0, resolvedImport: 0, resolvedTransitive: 0,- resolvedGlobal: 0, resolvedQualifier: 0, skippedSameFile: 0, skippedAmbiguous: 0,- };- // fileQKeys: filePath → (plainName → qualifiedKeys[])- // Mirrors the entityQKey computation in buildPatch so nodeIds match exactly.- const fileQKeys = new Map();- for (const r of results) {- const qkMap = new Map();- for (const e of r.entities) {- if (e.kind === 'file' || e.kind === 'module')- continue;- const qk = qualifiedKey(e);- const list = qkMap.get(e.name) ?? [];- list.push(qk);- qkMap.set(e.name, list);- }- fileQKeys.set(r.filePath, qkMap);- }- // fileHasSymbol: filePath → Set<plainName> (fast membership check)- const fileHasSymbol = new Map();- for (const [fp, qkMap] of fileQKeys) {- fileHasSymbol.set(fp, new Set(qkMap.keys()));- }- // resultsByPath: O(1) lookup replacing results.find() in transitive import loop- const resultsByPath = new Map(results.map(r => [r.filePath, r]));- // symbolToFiles: plainName → filePath[] — replaces O(F) full-scan in tier-3 and qualifier fallback- const symbolToFiles = new Map();- for (const [fp, symbols] of fileHasSymbol) {- for (const sym of symbols) {- const list = symbolToFiles.get(sym) ?? [];- list.push(fp);- symbolToFiles.set(sym, list);- }- }- // fileLanguage: filePath → SupportedLanguages (fast language lookup without re-calling languageFromPath)- const fileLanguage = new Map();- for (const r of results) {- fileLanguage.set(r.filePath, r.language);- }- // stemToFiles: basename-without-extension → filePath[]- // Matches the last path segment of an import to files in the batch.- const stemToFiles = new Map();- for (const r of results) {- const stem = nodePath.basename(r.filePath, nodePath.extname(r.filePath));- const list = stemToFiles.get(stem) ?? [];- list.push(r.filePath);- stemToFiles.set(stem, list);- }- // dirToIndexFiles: directory basename → filePath[] for 'index.*' files- // Handles directory imports: './services' → 'services/index.ts'- const dirToIndexFiles = new Map();- for (const r of results) {- const stem = nodePath.basename(r.filePath, nodePath.extname(r.filePath));- if (stem === 'index') {- const dirName = nodePath.basename(nodePath.dirname(r.filePath));- const list = dirToIndexFiles.get(dirName) ?? [];- list.push(r.filePath);- 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);- }- }- // goPkgDirToFiles: Go package directory name → filePath[]- // In Go, the last segment of an import path IS the package directory name.- // e.g. import "go.etcd.io/etcd/server/etcdserver" is stripped to modName "etcdserver"- // by the import processor; this index maps that name to all .go files in- // any directory named "etcdserver" within the ingested batch.- const goPkgDirToFiles = new Map();- for (const r of results) {- if (nodePath.extname(r.filePath) !== '.go')- continue;- const dirName = nodePath.basename(nodePath.dirname(r.filePath));- const list = goPkgDirToFiles.get(dirName) ?? [];- if (!list.includes(r.filePath))- list.push(r.filePath);- goPkgDirToFiles.set(dirName, list);- }- // ── Helpers ────────────────────────────────────────────────────────- /** 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|c|cc|cpp|cxx|h|hh|hpp|hxx)$/, '');- 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);- }- // Go package directory resolution: "etcdserver" → all .go files in .../etcdserver/- // The last segment of a Go import path is the package directory name, not a file stem.- for (const fp of goPkgDirToFiles.get(modName) ?? []) {- if (fp !== excludeFp && !fps.includes(fp))- fps.push(fp);- }- return fps;- }- function tokenizeSymbolParts(value) {- return value- .replace(/([a-z\d])([A-Z])/g, '$1 $2')- .replace(/[^a-zA-Z0-9]+/g, ' ')- .toLowerCase()- .split(/\s+/)- .filter(Boolean);- }- const GENERIC_RESOLUTION_TOKENS = new Set([- 'run', 'job', 'file', 'files', 'table', 'tables', 'output', 'outputs',- 'input', 'inputs', 'background',- ]);- function candidateStem(filePath) {- return nodePath.basename(filePath, nodePath.extname(filePath)).toLowerCase();- }- function pickCallerAlignedCandidate(matches, srcName, dstName) {- if (matches.length === 0)- return null;- const srcTokens = new Set(tokenizeSymbolParts(srcName).filter(token => !GENERIC_RESOLUTION_TOKENS.has(token)));- const overlapScores = matches.map(fp => {- const qKeys = fileQKeys.get(fp)?.get(dstName) ?? [];- const candidateTokens = new Set(tokenizeSymbolParts(candidateStem(fp)));- for (const qKey of qKeys) {- for (const token of tokenizeSymbolParts(qKey))- candidateTokens.add(token);- }- let overlap = 0;- for (const token of candidateTokens) {- if (!GENERIC_RESOLUTION_TOKENS.has(token) && srcTokens.has(token))- overlap++;- }- return { fp, overlap };- });- const maxOverlap = Math.max(...overlapScores.map(x => x.overlap));- if (maxOverlap <= 0)- return null;- const bestMatches = overlapScores.filter(x => x.overlap === maxOverlap);- return {- chosen: bestMatches.length === 1 ? bestMatches[0].fp : null,- best: bestMatches,- };- }- function narrowCCandidates(matches, srcFilePath, srcLanguage, srcName, dstName) {- if (matches.length <= 1)- return matches;- // C# partial class narrowing: multiple files may define the same class via- // partial class (e.g. JsonReader.cs + JsonReader.Async.cs both define JsonReader).- // Prefer the canonical file whose stem exactly matches the destination class name- // over variant files that have additional dot-segments in the stem.- if (srcLanguage === SupportedLanguages.CSharp) {- const dstNameLower = dstName.toLowerCase();- const canonicalMatches = matches.filter(fp => candidateStem(fp) === dstNameLower);- if (canonicalMatches.length === 1)- return canonicalMatches;- }- if (srcLanguage !== SupportedLanguages.C && srcLanguage !== SupportedLanguages.CPlusPlus)- return matches;- let narrowed = matches;- const implExts = ['.c', '.cpp', '.cc', '.cxx'];- const implMatches = narrowed.filter(fp => implExts.some(ext => fp.endsWith(ext)));- if (implMatches.length === 1)- narrowed = implMatches;- if (narrowed.length <= 1)- return narrowed;- const srcParts = srcFilePath.replace(/\\/g, '/').split('/');- const withProximity = narrowed.map(fp => {- const fpParts = fp.replace(/\\/g, '/').split('/');- let common = 0;- while (common < srcParts.length && common < fpParts.length && srcParts[common] === fpParts[common]) {- common++;- }- return { fp, common };- });- const maxCommon = Math.max(...withProximity.map(x => x.common));- const proximityMatches = withProximity.filter(x => x.common === maxCommon).map(x => x.fp);- if (proximityMatches.length === 1)- return proximityMatches;- const callerAligned = pickCallerAlignedCandidate(narrowed, srcName, dstName);- if (callerAligned?.chosen)- return [callerAligned.chosen];- const callerAlignedCandidates = pickCallerAlignedCandidate(matches, srcName, dstName);- if (callerAlignedCandidates?.best) {- const implAlignedMatches = callerAlignedCandidates.best- .map(match => match.fp)- .filter(fp => ['.c', '.cpp', '.cc', '.cxx'].some(ext => fp.endsWith(ext)));- if (implAlignedMatches.length === 1)- return implAlignedMatches;- }- return narrowed;- }- // ── Main resolution loop ───────────────────────────────────────────- const resolved = [];- for (const result of results) {- const srcFilePath = result.filePath;- const srcLanguage = result.language;- 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;- for (const fp of modNameToFiles(rel.dstName, srcFilePath)) {- importedFilePaths.add(fp);- }- }- // 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) {- const fpResult = resultsByPath.get(fp);- if (!fpResult)- continue;- for (const rel of fpResult.relationships) {- if (rel.predicate !== 'IMPORTS')- continue;- 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' && rel.predicate !== 'EXTENDS' && rel.predicate !== 'REFERENCES' && rel.predicate !== 'IMPORTS')- continue;- // Resolve Scala/Java dotted class imports (e.g. "ix.memory.model.ClaimId")- // to the actual indexed entity node in the defining file.- // Uses package-path lookup: extract package ("ix.memory.model") and entity- // name ("ClaimId"), find files registered under that package, then find- // the one that defines the entity.- if (rel.predicate === 'IMPORTS') {- if (result.language !== SupportedLanguages.Scala && result.language !== SupportedLanguages.Java)- continue;- const dstName = rel.dstName;- const lastDot = dstName.lastIndexOf('.');- if (lastDot === -1)- continue; // not a dotted class import- const entityName = dstName.slice(lastDot + 1);- if (!entityName || entityName === '_')- continue; // wildcard import- const pkgPath = dstName.slice(0, lastDot); // e.g. "ix.memory.model"- // Find files in the declared package that define this entity- const pkgFiles = packageToFiles.get(pkgPath) ?? [];- const matchFiles = pkgFiles.filter(fp => fp !== srcFilePath && fileHasSymbol.get(fp)?.has(entityName));- if (matchFiles.length !== 1)- continue; // ambiguous or not found- const fp = matchFiles[0];- const dstQualifiedKey = bestQKey(fileQKeys, fp, entityName);- if (dstQualifiedKey === null)- continue;- resolved.push({ srcFilePath, srcName: rel.srcName, dstFilePath: fp, dstName, dstQualifiedKey, predicate: 'IMPORTS', confidence: 0.9 });- 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 = [];- 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 — use symbolToFiles index instead of full scan- const qualGlobalMatches = (symbolToFiles.get(qualifierPart) ?? []).filter(fp => fp !== srcFilePath);- 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 (srcSymbols.has(dstName))- continue;- // Tier 2: import-scoped (confidence 0.9)- const importMatches = [];- for (const fp of importedFilePaths) {- if (fileHasSymbol.get(fp)?.has(dstName))- importMatches.push(fp);- }- const narrowedImportMatches = narrowCCandidates(importMatches, srcFilePath, srcLanguage, srcName, dstName);- if (narrowedImportMatches.length === 1) {- const fp = narrowedImportMatches[0];- 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;- }- // 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(dstName))- transitiveMatches.push(fp);- }- const narrowedTransitiveMatches = narrowCCandidates(transitiveMatches, srcFilePath, srcLanguage, srcName, dstName);- if (narrowedTransitiveMatches.length === 1) {- const fp = narrowedTransitiveMatches[0];- 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;- }- // Tier 3: global fallback (confidence 0.5) — uses inverted symbol index- // instead of scanning all files.- stats.globalFallbacks++;- const candidates = symbolToFiles.get(dstName) ?? [];- let globalMatches = candidates.filter(fp => fp !== srcFilePath && fileLanguage.get(fp) === srcLanguage);- const importHint = pickCallerAlignedCandidate(importMatches, srcName, dstName)?.chosen- ?? pickCallerAlignedCandidate(transitiveMatches, srcName, dstName)?.chosen;- if (importHint) {- const hintedStem = candidateStem(importHint);- const stemMatches = globalMatches.filter(fp => candidateStem(fp) === hintedStem);- if (stemMatches.length > 0)- globalMatches = stemMatches;- }- stats.globalCandidateTotal += globalMatches.length;- const resolvedMatches = narrowCCandidates(globalMatches, srcFilePath, srcLanguage, srcName, dstName);- if (resolvedMatches.length === 1) {- const fp = resolvedMatches[0];- 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 });- stats.resolvedGlobal++;- continue;- }- if (narrowedImportMatches.length > 1 || narrowedTransitiveMatches.length > 1 || resolvedMatches.length > 1) {- stats.skippedAmbiguous++;- }- // 0 or >1 matches after all tiers — 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-// ----------------------------------------------------------------------------function findEnclosing(ranges, line, excludeName) {- // Find the innermost class/interface that contains this line- let best = null;- for (const r of ranges) {- if (r.name === excludeName)- continue;- if (line >= r.start && line <= r.end) {- if (!best || (r.end - r.start) < (best.end - best.start)) {- best = r;- }- }- }- return best?.name ?? null;-}-function findEnclosingFunction(entities, line) {- let best = null;- for (const e of entities) {- if (e.kind !== 'function' && e.kind !== 'method')- continue;- if (line >= e.lineStart && line <= e.lineEnd) {- if (!best || (e.lineEnd - e.lineStart) < (best.lineEnd - best.lineStart)) {- best = e;- }- }- }- return best ? (best.container ? `${best.container}.${best.name}` : best.name) : null;-}diff --git a/core-ingestion/dist/languages.d.ts b/core-ingestion/dist/languages.d.tsdeleted file mode 100644index 009cf3cd..00000000--- a/core-ingestion/dist/languages.d.ts+++ /dev/null@@ -1,17 +0,0 @@-export declare enum SupportedLanguages {- JavaScript = "javascript",- TypeScript = "typescript",- Python = "python",- Java = "java",- C = "c",- CPlusPlus = "cpp",- CSharp = "csharp",- Go = "go",- Ruby = "ruby",- Rust = "rust",- PHP = "php",- Kotlin = "kotlin",- Swift = "swift",- Scala = "scala"-}-export declare function languageFromPath(filePath: string): SupportedLanguages | null;diff --git a/core-ingestion/dist/languages.js b/core-ingestion/dist/languages.jsdeleted file mode 100644index ae45ad26..00000000--- a/core-ingestion/dist/languages.js+++ /dev/null@@ -1,47 +0,0 @@-export var SupportedLanguages;-(function (SupportedLanguages) {- SupportedLanguages["JavaScript"] = "javascript";- SupportedLanguages["TypeScript"] = "typescript";- SupportedLanguages["Python"] = "python";- SupportedLanguages["Java"] = "java";- SupportedLanguages["C"] = "c";- SupportedLanguages["CPlusPlus"] = "cpp";- SupportedLanguages["CSharp"] = "csharp";- SupportedLanguages["Go"] = "go";- SupportedLanguages["Ruby"] = "ruby";- SupportedLanguages["Rust"] = "rust";- SupportedLanguages["PHP"] = "php";- SupportedLanguages["Kotlin"] = "kotlin";- SupportedLanguages["Swift"] = "swift";- SupportedLanguages["Scala"] = "scala";-})(SupportedLanguages || (SupportedLanguages = {}));-const EXT_MAP = {- '.ts': SupportedLanguages.TypeScript,- '.tsx': SupportedLanguages.TypeScript,- '.js': SupportedLanguages.JavaScript,- '.jsx': SupportedLanguages.JavaScript,- '.mjs': SupportedLanguages.JavaScript,- '.cjs': SupportedLanguages.JavaScript,- '.py': SupportedLanguages.Python,- '.java': SupportedLanguages.Java,- '.c': SupportedLanguages.C,- '.h': SupportedLanguages.C,- '.cpp': SupportedLanguages.CPlusPlus,- '.cc': SupportedLanguages.CPlusPlus,- '.cxx': SupportedLanguages.CPlusPlus,- '.hpp': SupportedLanguages.CPlusPlus,- '.cs': SupportedLanguages.CSharp,- '.go': SupportedLanguages.Go,- '.rb': SupportedLanguages.Ruby,- '.rs': SupportedLanguages.Rust,- '.php': SupportedLanguages.PHP,- '.kt': SupportedLanguages.Kotlin,- '.kts': SupportedLanguages.Kotlin,- '.swift': SupportedLanguages.Swift,- '.scala': SupportedLanguages.Scala,- '.sc': SupportedLanguages.Scala,-};-export function languageFromPath(filePath) {- const ext = filePath.slice(filePath.lastIndexOf('.')).toLowerCase();- return EXT_MAP[ext] ?? null;-}diff --git a/core-ingestion/dist/patch-builder.d.ts b/core-ingestion/dist/patch-builder.d.tsdeleted file mode 100644index f7511c4b..00000000--- a/core-ingestion/dist/patch-builder.d.ts+++ /dev/null@@ -1,9 +0,0 @@-import type { GraphPatchPayload } from './types.js';-import type { FileParseResult, ResolvedEdge } from './index.js';-export declare function extractorName(): string;-/** Previous extractor versions — their patches are superseded when re-ingesting. */-export declare const PREVIOUS_EXTRACTORS: string[];-export declare function buildPatch(result: FileParseResult, sourceHash: string, previousSourceHash?: string): GraphPatchPayload;-export declare function buildPatchWithResolution(result: FileParseResult, sourceHash: string, resolvedEdges: ResolvedEdge[], previousSourceHash?: string, opts?: {- emitClaims?: boolean;-}): GraphPatchPayload;diff --git a/core-ingestion/dist/patch-builder.js b/core-ingestion/dist/patch-builder.jsdeleted file mode 100644index 0fc438dd..00000000--- a/core-ingestion/dist/patch-builder.js+++ /dev/null@@ -1,417 +0,0 @@-import * as crypto from 'node:crypto';-import * as nodePath from 'node:path';-// ----------------------------------------------------------------------------// Deterministic UUID from a string (matches existing CLI convention)-// ----------------------------------------------------------------------------function deterministicId(input) {- const hash = crypto.createHash('sha256').update(input).digest('hex');- return [- hash.slice(0, 8),- hash.slice(8, 12),- hash.slice(12, 16),- hash.slice(16, 20),- hash.slice(20, 32),- ].join('-');-}-function normalizePath(filePath) {- return filePath.replace(/\\/g, '/').toLowerCase();-}-function nodeId(filePath, name) {- return deterministicId(`${normalizePath(filePath)}:${name}`);-}-function edgeId(filePath, src, dst, predicate) {- return deterministicId(`${normalizePath(filePath)}:${src}:${dst}:${predicate}`);-}-/** Deterministic ID for a chunk — keyed on file + kind + name + start line to survive minor edits. */-function chunkId(filePath, chunkKind, name, startLine) {- return deterministicId(`${normalizePath(filePath)}:chunk:${chunkKind}:${name ?? 'file_body'}:${startLine}`);-}-// ----------------------------------------------------------------------------// Source type from file extension-// ----------------------------------------------------------------------------function sourceType(filePath) {- const ext = filePath.slice(filePath.lastIndexOf('.')).toLowerCase();- if (['.json', '.yaml', '.yml', '.toml', '.ini', '.conf', '.env'].includes(ext))- return 'config';- if (['.md', '.mdx', '.rst', '.txt'].includes(ext))- return 'doc';- return 'code';-}-export function extractorName() {- return `tree-sitter/1.18`;-}-/** Previous extractor versions — their patches are superseded when re-ingesting. */-export const PREVIOUS_EXTRACTORS = ['tree-sitter/1.17', 'tree-sitter/1.16', 'tree-sitter/1.15', 'tree-sitter/1.14', 'tree-sitter/1.13', 'tree-sitter/1.12', 'tree-sitter/1.11', 'tree-sitter/1.10', 'tree-sitter/1.9', 'tree-sitter/1.8', 'tree-sitter/1.7', '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(`${normalizePath(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-// ----------------------------------------------------------------------------export function buildPatch(result, sourceHash, previousSourceHash) {- const { filePath, entities, chunks, relationships } = result;- const ops = [];- // Build a qualified-key map so that same-named entities in different- // enclosing classes within the same file get distinct nodeIds.- // e.g. ClassA.update vs ClassB.update instead of both being "update".- const entityQKey = new Map();- for (const e of entities) {- entityQKey.set(e, e.container ? `${e.container}.${e.name}` : e.name);- }- // Reverse lookup: plain name → list of qualified keys (for edge resolution).- const nameToQKeys = new Map();- for (const [e, qk] of entityQKey) {- const list = nameToQKeys.get(e.name) ?? [];- list.push(qk);- nameToQKeys.set(e.name, list);- }- // Resolve a relationship endpoint to the best qualified key.- // For unambiguous names (appear once), returns the single qualified key.- // For ambiguous names (appear multiple times), falls back to the plain name- // so that the edge still points to *something* deterministic.- function resolveKey(name, container) {- const rawKeys = nameToQKeys.get(name);- if (!rawKeys)- return name;- // Deduplicate: @overload in Python (and similar patterns in other languages)- // produces multiple definitions with identical qualified keys. A Set collapses- // these so we don't mistake three `Session.execute` overloads for ambiguity.- const keys = [...new Set(rawKeys)];- if (keys.length === 1)- return keys[0];- // More than one distinct entity with this name — try to pick by container- if (container) {- const qualified = `${container}.${name}`;- if (keys.includes(qualified))- return qualified;- }- // Ambiguous: return plain name so we don't silently drop the edge- return name;- }- // UpsertNode for each entity (deduplicated by id — last occurrence wins)- const seenNodeIds = new Set();- for (const e of entities) {- const qk = entityQKey.get(e);- const id = nodeId(filePath, qk);- if (!seenNodeIds.has(id)) {- seenNodeIds.add(id);- const roleAttrs = e.kind === 'file'- ? { role: result.fileRole.role, role_confidence: result.fileRole.role_confidence, role_signals: result.fileRole.role_signals }- : { role: result.fileRole.role, role_source: 'inherited_from_file' };- ops.push({- type: 'UpsertNode',- id,- kind: e.kind,- name: e.name,- attrs: {- line_start: e.lineStart,- line_end: e.lineEnd,- language: e.language,- ...roleAttrs,- },- });- }- }- // UpsertNode + edges for each chunk- const fileNodeId = nodeId(filePath, entities.find(e => e.kind === 'file')?.name ?? filePath);- for (const chunk of chunks) {- const cid = chunkId(filePath, chunk.chunkKind, chunk.name, chunk.lineStart);- const chunkName = chunk.name ?? `file_body:${chunk.lineStart}`;- ops.push({- type: 'UpsertNode',- id: cid,- kind: 'chunk',- name: chunkName,- attrs: {- file_uri: filePath,- language: chunk.language,- chunk_kind: chunk.chunkKind,- start_line: chunk.lineStart,- end_line: chunk.lineEnd,- start_byte: chunk.startByte,- end_byte: chunk.endByte,- content_hash: chunk.contentHash,- parser_version: extractorName(),- },- });- // File -[CONTAINS]-> Chunk- ops.push({- type: 'UpsertEdge',- id: edgeId(filePath, 'file', chunkName, 'CONTAINS_CHUNK'),- src: fileNodeId,- dst: cid,- predicate: 'CONTAINS_CHUNK',- attrs: {},- });- // Chunk -[DEFINES]-> Symbol (only for named chunks)- if (chunk.name !== null) {- const symbolKey = chunk.container ? `${chunk.container}.${chunk.name}` : chunk.name;- const symbolNid = nodeId(filePath, symbolKey);- ops.push({- type: 'UpsertEdge',- id: edgeId(filePath, chunkName, symbolKey, 'DEFINES'),- src: cid,- dst: symbolNid,- predicate: 'DEFINES',- attrs: {},- });- }- }- // NEXT edges for source-order chunk adjacency- for (let i = 0; i + 1 < chunks.length; i++) {- const a = chunks[i];- const b = chunks[i + 1];- // Only link top-level chunks (no container) to avoid intra-class ordering noise- if (a.container == null && b.container == null) {- const aid = chunkId(filePath, a.chunkKind, a.name, a.lineStart);- const bid = chunkId(filePath, b.chunkKind, b.name, b.lineStart);- const aName = a.name ?? `file_body:${a.lineStart}`;- const bName = b.name ?? `file_body:${b.lineStart}`;- ops.push({- type: 'UpsertEdge',- id: edgeId(filePath, aName, bName, 'NEXT'),- src: aid,- dst: bid,- predicate: 'NEXT',- attrs: {},- });- }- }- // UpsertEdge for each relationship- for (const r of relationships) {- // For CONTAINS edges, srcName is the container of dstName — use that to disambiguate.- const srcKey = resolveKey(r.srcName);- const dstKey = r.predicate === 'CONTAINS'- ? resolveKey(r.dstName, r.srcName)- : resolveKey(r.dstName);- ops.push({- type: 'UpsertEdge',- id: edgeId(filePath, srcKey, dstKey, r.predicate),- src: nodeId(filePath, srcKey),- dst: nodeId(filePath, dstKey),- predicate: r.predicate,- attrs: {},- });- }- // AssertClaim for each relationship (feeds the confidence/conflict engine)- for (const r of relationships) {- const srcKey = resolveKey(r.srcName);- ops.push({- type: 'AssertClaim',- entityId: nodeId(filePath, srcKey),- field: `${r.predicate.toLowerCase()}:${r.dstName}`,- value: r.dstName,- confidence: null,- });- }- // 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- ? 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',- timestamp: new Date().toISOString(),- source: {- uri: filePath,- sourceHash,- extractor,- sourceType: sourceType(filePath),- },- baseRev: 0,- ops,- replaces,- intent: `Parsed ${nodePath.basename(filePath)}`,- };-}-// ----------------------------------------------------------------------------// buildPatchWithResolution — like buildPatch but fixes CALLS edge dst to point-// to the actual defining file for cross-file calls resolved by resolveCallEdges.-// ----------------------------------------------------------------------------export function buildPatchWithResolution(result, sourceHash, resolvedEdges, previousSourceHash, opts) {- // Build lookup: `${srcName}:${predicate}:${dstName}` → { dstFilePath, dstQualifiedKey }- // Callers should pass only edges for this file (pre-grouped) for best performance,- // but we still tolerate the full array for backward compatibility.- const edgeResolution = new Map();- for (const edge of resolvedEdges) {- if (edge.srcFilePath !== result.filePath)- continue;- edgeResolution.set(`${edge.srcName}:${edge.predicate}:${edge.dstName}`, {- dstFilePath: edge.dstFilePath,- dstQualifiedKey: edge.dstQualifiedKey,- });- }- const { filePath, entities, chunks, relationships } = result;- const ops = [];- const entityQKey = new Map();- for (const e of entities) {- entityQKey.set(e, e.container ? `${e.container}.${e.name}` : e.name);- }- const nameToQKeys = new Map();- for (const [e, qk] of entityQKey) {- const list = nameToQKeys.get(e.name) ?? [];- list.push(qk);- nameToQKeys.set(e.name, list);- }- function resolveKey(name, container) {- const rawKeys = nameToQKeys.get(name);- if (!rawKeys)- return name;- const keys = [...new Set(rawKeys)]; // deduplicate — @overload produces identical qks- if (keys.length === 1)- return keys[0];- if (container) {- const qualified = `${container}.${name}`;- if (keys.includes(qualified))- return qualified;- }- return name;- }- const seenNodeIds2 = new Set();- for (const e of entities) {- const qk = entityQKey.get(e);- const id = nodeId(filePath, qk);- if (!seenNodeIds2.has(id)) {- seenNodeIds2.add(id);- const roleAttrs = e.kind === 'file'- ? { role: result.fileRole.role, role_confidence: result.fileRole.role_confidence, role_signals: result.fileRole.role_signals }- : { role: result.fileRole.role, role_source: 'inherited_from_file' };- ops.push({- type: 'UpsertNode',- id,- kind: e.kind,- name: e.name,- attrs: { line_start: e.lineStart, line_end: e.lineEnd, language: e.language, ...roleAttrs },- });- }- }- // UpsertNode + edges for each chunk (same logic as buildPatch)- const fileNodeId2 = nodeId(filePath, entities.find(e => e.kind === 'file')?.name ?? filePath);- for (const chunk of chunks) {- const cid = chunkId(filePath, chunk.chunkKind, chunk.name, chunk.lineStart);- const chunkName = chunk.name ?? `file_body:${chunk.lineStart}`;- ops.push({- type: 'UpsertNode',- id: cid,- kind: 'chunk',- name: chunkName,- attrs: {- file_uri: filePath,- language: chunk.language,- chunk_kind: chunk.chunkKind,- start_line: chunk.lineStart,- end_line: chunk.lineEnd,- start_byte: chunk.startByte,- end_byte: chunk.endByte,- content_hash: chunk.contentHash,- parser_version: extractorName(),- },- });- ops.push({- type: 'UpsertEdge',- id: edgeId(filePath, 'file', chunkName, 'CONTAINS_CHUNK'),- src: fileNodeId2,- dst: cid,- predicate: 'CONTAINS_CHUNK',- attrs: {},- });- if (chunk.name !== null) {- const symbolKey = chunk.container ? `${chunk.container}.${chunk.name}` : chunk.name;- const symbolNid = nodeId(filePath, symbolKey);- ops.push({- type: 'UpsertEdge',- id: edgeId(filePath, chunkName, symbolKey, 'DEFINES'),- src: cid,- dst: symbolNid,- predicate: 'DEFINES',- attrs: {},- });- }- }- for (let i = 0; i + 1 < chunks.length; i++) {- const a = chunks[i];- const b = chunks[i + 1];- if (a.container == null && b.container == null) {- const aid = chunkId(filePath, a.chunkKind, a.name, a.lineStart);- const bid = chunkId(filePath, b.chunkKind, b.name, b.lineStart);- const aName = a.name ?? `file_body:${a.lineStart}`;- const bName = b.name ?? `file_body:${b.lineStart}`;- ops.push({- type: 'UpsertEdge',- id: edgeId(filePath, aName, bName, 'NEXT'),- src: aid,- dst: bid,- predicate: 'NEXT',- attrs: {},- });- }- }- for (const r of relationships) {- const srcKey = resolveKey(r.srcName);- const dstKey = r.predicate === 'CONTAINS'- ? resolveKey(r.dstName, r.srcName)- : resolveKey(r.dstName);- // For cross-file resolved edges (CALLS, EXTENDS), use the defining file's nodeId- let dstNodeId;- const resolutionKey = `${r.srcName}:${r.predicate}:${r.dstName}`;- if (edgeResolution.has(resolutionKey)) {- const { dstFilePath, dstQualifiedKey } = edgeResolution.get(resolutionKey);- dstNodeId = nodeId(dstFilePath, dstQualifiedKey);- }- else {- dstNodeId = nodeId(filePath, dstKey);- }- ops.push({- type: 'UpsertEdge',- id: edgeId(filePath, srcKey, dstKey, r.predicate),- src: nodeId(filePath, srcKey),- dst: dstNodeId,- predicate: r.predicate,- attrs: {},- });- }- if (opts?.emitClaims !== false) {- for (const r of relationships) {- const srcKey = resolveKey(r.srcName);- ops.push({- type: 'AssertClaim',- entityId: nodeId(filePath, srcKey),- field: `${r.predicate.toLowerCase()}:${r.dstName}`,- value: r.dstName,- confidence: null,- });- }- }- const extractor = extractorName();- const patchId = computePatchId(filePath, sourceHash, extractor);- const previousPatchId = previousSourceHash- ? computePatchId(filePath, previousSourceHash, extractor)- : legacyPatchId(filePath, sourceHash);- const replaces = [previousPatchId, ...PREVIOUS_EXTRACTORS.map(prev => computePatchId(filePath, sourceHash, prev))];- return {- patchId,- actor: 'ix/ingestion',- timestamp: new Date().toISOString(),- source: {- uri: filePath,- sourceHash,- extractor,- sourceType: sourceType(filePath),- },- baseRev: 0,- ops,- replaces,- intent: `Parsed ${nodePath.basename(filePath)}`,- };-}diff --git a/core-ingestion/dist/queries.d.ts b/core-ingestion/dist/queries.d.tsdeleted file mode 100644index a6b93dd6..00000000--- a/core-ingestion/dist/queries.d.ts+++ /dev/null@@ -1,16 +0,0 @@-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; this.method() \u2014 capture this as qualifier so index.ts can substitute the enclosing class.\n; Analogous to Python's self/cls substitution.\n(call_expression\n function: (member_expression\n object: (this) @_qualifier\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; var foo = function() {} (CommonJS var declarations)\n(variable_declaration\n (variable_declarator\n name: (identifier) @name\n value: (function_expression))) @definition.function\n\n; var foo = () => {} (CommonJS var arrow functions)\n(variable_declaration\n (variable_declarator\n name: (identifier) @name\n value: (arrow_function))) @definition.function\n\n; obj.method = function name() {} (prototype/mixin method assignments)\n(expression_statement\n (assignment_expression\n left: (member_expression\n property: (property_identifier) @name)\n right: (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; CommonJS require() \u2192 IMPORTS\n(call_expression\n function: (identifier) @_req\n arguments: (arguments (string) @import.source)\n (#eq? @_req \"require\")) @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; this.method() \u2014 capture this as qualifier so index.ts can substitute the enclosing class.\n; Analogous to Python's self/cls substitution.\n(call_expression\n function: (member_expression\n object: (this) @_qualifier\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; Attribute calls with object captured as qualifier so Tier-1b resolution can use\n; class/module name to break ties (e.g. Session.execute \u2192 resolves to Session in\n; the importing file). Emitted alongside the bare-name pattern above so that\n; bare-name global fallback still fires when qualifier resolution fails.\n(call\n function: (attribute\n object: (identifier) @_qualifier\n attribute: (identifier) @call.name)) @call\n\n; Django ORM manager pattern: Model.objects.method(...)\n; Unwinds the intermediate accessor (objects/related_manager/etc.) and captures\n; the model class as qualifier, e.g. User.objects.filter(...) \u2192 CALLS User.filter.\n; This creates cross-file edges between view/form code and model definitions.\n(call\n function: (attribute\n object: (attribute\n object: (identifier) @_qualifier\n attribute: (identifier))\n attribute: (identifier) @call.name)) @call\n\n; Chained call pattern: qualifier.method1(...).method2(...)\n; Propagates the qualifier from the inner call to the outer, e.g.\n; User.filter(...).order_by(...) \u2192 CALLS User.order_by.\n(call\n function: (attribute\n object: (call\n function: (attribute\n object: (identifier) @_qualifier\n attribute: (identifier)))\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: (type (identifier) @reference.type))\n(typed_default_parameter type: (type (identifier) @reference.type))\n\n; Typed parameters: capture name + type together so qualifier substitution can\n; map a local variable name to its declared class (e.g. query: Query \u2192 'query' \u2192 'Query').\n(function_definition\n parameters: (parameters\n (typed_parameter\n (identifier) @_typed_param_name\n type: (type (identifier) @_typed_param_type)))) @_typed_param_scope\n\n(function_definition\n parameters: (parameters\n (typed_default_parameter\n (identifier) @_typed_param_name\n type: (type (identifier) @_typed_param_type)))) @_typed_param_scope\n\n; Assignment tracking: x = SomeClass() or x = SomeClass(args)\n; Maps local variable name \u2192 constructor type for untyped-parameter qualifier substitution.\n; Only PascalCase RHS names are tracked in TypeScript (constructor convention).\n(function_definition\n body: (block\n (expression_statement\n (assignment\n left: (identifier) @_assign_lhs\n right: (call\n function: (identifier) @_assign_rhs_type))))) @_assign_scope\n\n; Assignment tracking: x = Model.objects.method()\n; Captures the outermost identifier (model class) for ORM manager patterns.\n(function_definition\n body: (block\n (expression_statement\n (assignment\n left: (identifier) @_assign_lhs\n right: (call\n function: (attribute\n object: (attribute\n object: (identifier) @_assign_rhs_type\n attribute: (identifier))\n attribute: (identifier))))))) @_assign_scope\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 (plain: extends Foo)\n(class_declaration name: (identifier) @heritage.class\n (superclass (type_identifier) @heritage.extends)) @heritage\n\n; Heritage - extends class with generics (extends Foo<T>)\n(class_declaration name: (identifier) @heritage.class\n (superclass (generic_type (type_identifier) @heritage.extends))) @heritage\n\n; Heritage - implements interfaces (plain: implements Foo)\n(class_declaration name: (identifier) @heritage.class\n (super_interfaces (type_list (type_identifier) @heritage.implements))) @heritage.impl\n\n; Heritage - implements interfaces with generics (implements Foo<T>)\n(class_declaration name: (identifier) @heritage.class\n (super_interfaces (type_list (generic_type (type_identifier) @heritage.implements)))) @heritage.impl\n\n; Heritage - interface extends interfaces (plain: extends Foo)\n(interface_declaration name: (identifier) @heritage.class\n (extends_interfaces (type_list (type_identifier) @heritage.extends))) @heritage\n\n; Heritage - interface extends interfaces with generics (extends Foo<T>)\n(interface_declaration name: (identifier) @heritage.class\n (extends_interfaces (type_list (generic_type (type_identifier) @heritage.extends)))) @heritage\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; Only match struct/union with a body to avoid treating forward declarations as definitions\n(struct_specifier name: (type_identifier) @name body: (field_declaration_list)) @definition.struct\n(union_specifier name: (type_identifier) @name body: (field_declaration_list)) @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; struct_specifier forms: e.g. \"const struct Curl_protocol foo = {...}\"\n(declaration type: (struct_specifier name: (type_identifier) @reference.type))\n(parameter_declaration type: (struct_specifier name: (type_identifier) @reference.type))\n";-export declare const GO_QUERIES = "\n; Functions\n(function_declaration name: (identifier) @name) @definition.function\n\n; Methods \u2014 non-pointer receiver: func (r ReceiverType) Name(...)\n; The receiver.type capture lets the parser set container = ReceiverType so that\n; qualifiedKey becomes \"ReceiverType.Name\" instead of bare \"Name\".\n(method_declaration\n receiver: (parameter_list (parameter_declaration\n type: (type_identifier) @receiver.type))\n name: (field_identifier) @name) @definition.method\n\n; Methods \u2014 pointer receiver: func (r *ReceiverType) Name(...)\n(method_declaration\n receiver: (parameter_list (parameter_declaration\n type: (pointer_type (type_identifier) @receiver.type)))\n 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; Interface method signatures \u2014 emits each method inside an interface_type as a method entity.\n; @heritage.class = interface name (used as container in index.ts via heritageClassCapture).\n; node type is method_elem in tree-sitter-go v0.21+.\n(type_declaration\n (type_spec\n name: (type_identifier) @heritage.class\n type: (interface_type\n (method_elem\n name: (field_identifier) @name)))) @definition.method\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 \u2014 value: type Foo struct { Bar }\n; NOTE: no @definition.* capture here \u2014 if it were present, defCapture fires first and\n; the heritage block is never reached (early-exit in the first pass).\n; The . anchors require the type_identifier to be the FIRST and ONLY named child of\n; field_declaration, distinguishing anonymous embedded fields from named fields like:\n; w Writer (named field \u2014 field_identifier_list precedes type, not matched)\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_identifier) @heritage.extends .)))))\n\n; Struct embedding \u2014 pointer: type Foo struct { *Bar }\n; The . anchor requires pointer_type to be the first named child (anonymous embedded).\n(type_declaration\n (type_spec\n name: (type_identifier) @heritage.class\n type: (struct_type\n (field_declaration_list\n (field_declaration .\n (pointer_type (type_identifier) @heritage.extends) .)))))\n\n; Calls\n(call_expression function: (identifier) @call.name) @call\n; Qualified calls: pkg.Func() or localVar.Method() where the operand is a simple\n; identifier \u2014 capture it as @_qualifier so cross-file resolution uses the fully\n; qualified name \"scrape.NewManager\" instead of bare \"NewManager\", preventing\n; ambiguous same-named symbols in different packages from being collapsed.\n(call_expression function: (selector_expression\n operand: (identifier) @_qualifier\n field: (field_identifier) @call.name)) @call\n; Chained/complex calls: a.b.Method(), call().Method(), index[i].Method() \u2014 the\n; operand is not a simple identifier, so emit without qualifier (bare method name).\n(call_expression function: (selector_expression\n operand: (selector_expression)\n 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; Return types: in tree-sitter-go, return type is a direct type_identifier child of function/method\n(function_declaration result: (type_identifier) @reference.type)\n(method_declaration result: (type_identifier) @reference.type)\n\n; Pointer-type variants: e.g. opts *Options, func(*Options) *Result\n(field_declaration type: (pointer_type (type_identifier) @reference.type))\n(parameter_declaration type: (pointer_type (type_identifier) @reference.type))\n(function_declaration result: (pointer_type (type_identifier) @reference.type))\n(method_declaration result: (pointer_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 (variable_declaration type: (identifier) @reference.type))\n(method_declaration returns: (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\n path: (identifier) @_qualifier\n 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; Wrapped type references \u2014 &Type, &mut Type\n(field_declaration type: (reference_type (type_identifier) @reference.type))\n(parameter pattern: (_) type: (reference_type (type_identifier) @reference.type))\n(function_item return_type: (reference_type (type_identifier) @reference.type))\n\n; Generic wrapper types \u2014 Box<Type>, Arc<Type>, Vec<Type>, Option<Type>, Result<Type,_>, etc.\n; Capture the type argument (inner type), not the wrapper name.\n(field_declaration type: (generic_type type_arguments: (type_arguments (type_identifier) @reference.type)))\n(parameter pattern: (_) type: (generic_type type_arguments: (type_arguments (type_identifier) @reference.type)))\n(function_item return_type: (generic_type type_arguments: (type_arguments (type_identifier) @reference.type)))\n\n; impl Trait in parameter / return positions\n(parameter pattern: (_) type: (abstract_type (type_identifier) @reference.type))\n(function_item return_type: (abstract_type (type_identifier) @reference.type))\n\n; dyn Trait \u2014 trait objects (direct: fn foo(x: dyn Trait) or field: x: dyn Trait)\n(field_declaration type: (dynamic_type (type_identifier) @reference.type))\n(parameter pattern: (_) type: (dynamic_type (type_identifier) @reference.type))\n(function_item return_type: (dynamic_type (type_identifier) @reference.type))\n\n; dyn Trait nested inside generic wrapper \u2014 Box<dyn Trait>, Arc<dyn Trait>, etc.\n(field_declaration type: (generic_type type_arguments: (type_arguments (dynamic_type (type_identifier) @reference.type))))\n(parameter pattern: (_) type: (generic_type type_arguments: (type_arguments (dynamic_type (type_identifier) @reference.type))))\n(function_item return_type: (generic_type type_arguments: (type_arguments (dynamic_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; Scoped class name: class Module::ClassName\n(class\n name: (scope_resolution) @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\n; Scoped superclass: class Foo < Module::Class\n; Captures full \"Module::Class\" text to avoid ambiguity with bare \"Class\" names\n(class\n name: (constant) @heritage.class\n superclass: (superclass\n (scope_resolution) @heritage.extends)) @heritage\n\n; Scoped class name, bare superclass: class Module::Foo < Bar\n(class\n name: (scope_resolution) @heritage.class\n superclass: (superclass\n (constant) @heritage.extends)) @heritage\n\n; Scoped class name, scoped superclass: class Module::Foo < Module::Bar\n(class\n name: (scope_resolution) @heritage.class\n superclass: (superclass\n (scope_resolution) @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 Val/var definitions (class-level members only, not method-local vars) \u2500\u2500\u2500\u2500\u2500\u2500\n; Restricting to template_body ensures we only capture class/object-level\n; declarations (e.g. companion object implicits) and not local val bindings\n; inside method bodies, which would add noise entities to the graph.\n(template_body\n (val_definition (identifier) @name) @definition.const)\n\n(template_body\n (var_definition (identifier) @name) @definition.const)\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.jsdeleted file mode 100644index 0b2b03c5..00000000--- a/core-ingestion/dist/queries.js+++ /dev/null@@ -1,1100 +0,0 @@-import { SupportedLanguages } from './languages.js';-/*- * Tree-sitter queries for extracting code definitions.- *- * Note: Different grammars (typescript vs tsx vs javascript) may have- * slightly different node types. These queries are designed to be- * compatible with the standard tree-sitter grammars.- */-// TypeScript queries - works with tree-sitter-typescript-export const TYPESCRIPT_QUERIES = `-(class_declaration- name: (type_identifier) @name) @definition.class--(interface_declaration- name: (type_identifier) @name) @definition.interface--(function_declaration- name: (identifier) @name) @definition.function--(method_definition- name: (property_identifier) @name) @definition.method--(lexical_declaration- (variable_declarator- name: (identifier) @name- value: (arrow_function))) @definition.function--(lexical_declaration- (variable_declarator- name: (identifier) @name- value: (function_expression))) @definition.function--(export_statement- declaration: (lexical_declaration- (variable_declarator- name: (identifier) @name- value: (arrow_function)))) @definition.function--(export_statement- declaration: (lexical_declaration- (variable_declarator- name: (identifier) @name- value: (function_expression)))) @definition.function--(import_statement- source: (string) @import.source) @import--; Re-export statements: export { X } from './y'-(export_statement- source: (string) @import.source) @import--; Dynamic import with string literal: import('./foo') or await import('./foo')-(call_expression- function: (import)- arguments: (arguments (string) @import.source)) @import--(call_expression- function: (identifier) @call.name) @call--(call_expression- function: (member_expression- property: (property_identifier) @call.name)) @call--; this.method() — capture this as qualifier so index.ts can substitute the enclosing class.-; Analogous to Python's self/cls substitution.-(call_expression- function: (member_expression- object: (this) @_qualifier- property: (property_identifier) @call.name)) @call--; Constructor calls: new Foo()-(new_expression- constructor: (identifier) @call.name) @call--; Heritage queries - class extends-(class_declaration- name: (type_identifier) @heritage.class- (class_heritage- (extends_clause- value: (identifier) @heritage.extends))) @heritage--; Heritage queries - class implements interface-(class_declaration- name: (type_identifier) @heritage.class- (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 = `-(class_declaration- name: (identifier) @name) @definition.class--(function_declaration- name: (identifier) @name) @definition.function--(method_definition- name: (property_identifier) @name) @definition.method--(lexical_declaration- (variable_declarator- name: (identifier) @name- value: (arrow_function))) @definition.function--(lexical_declaration- (variable_declarator- name: (identifier) @name- value: (function_expression))) @definition.function--; var foo = function() {} (CommonJS var declarations)-(variable_declaration- (variable_declarator- name: (identifier) @name- value: (function_expression))) @definition.function--; var foo = () => {} (CommonJS var arrow functions)-(variable_declaration- (variable_declarator- name: (identifier) @name- value: (arrow_function))) @definition.function--; obj.method = function name() {} (prototype/mixin method assignments)-(expression_statement- (assignment_expression- left: (member_expression- property: (property_identifier) @name)- right: (function_expression))) @definition.function--(export_statement- declaration: (lexical_declaration- (variable_declarator- name: (identifier) @name- value: (arrow_function)))) @definition.function--(export_statement- declaration: (lexical_declaration- (variable_declarator- name: (identifier) @name- value: (function_expression)))) @definition.function--(import_statement- source: (string) @import.source) @import--; Re-export statements: export { X } from './y'-(export_statement- source: (string) @import.source) @import--; Dynamic import with string literal: import('./foo') or await import('./foo')-(call_expression- function: (import)- arguments: (arguments (string) @import.source)) @import--; CommonJS require() → IMPORTS-(call_expression- function: (identifier) @_req- arguments: (arguments (string) @import.source)- (#eq? @_req "require")) @import--(call_expression- function: (identifier) @call.name) @call--(call_expression- function: (member_expression- property: (property_identifier) @call.name)) @call--; this.method() — capture this as qualifier so index.ts can substitute the enclosing class.-; Analogous to Python's self/cls substitution.-(call_expression- function: (member_expression- object: (this) @_qualifier- property: (property_identifier) @call.name)) @call--; Constructor calls: new Foo()-(new_expression- constructor: (identifier) @call.name) @call--; Heritage queries - class extends (JavaScript uses different AST than TypeScript)-; In tree-sitter-javascript, class_heritage directly contains the parent identifier-(class_declaration- name: (identifier) @heritage.class- (class_heritage- (identifier) @heritage.extends)) @heritage-`;-// Python queries - works with tree-sitter-python-export const PYTHON_QUERIES = `-(class_definition- name: (identifier) @name) @definition.class--(function_definition- name: (identifier) @name) @definition.function--(import_statement- name: (dotted_name) @import.source) @import--(import_from_statement- module_name: (dotted_name) @import.source) @import--(import_from_statement- module_name: (relative_import) @import.source) @import--; from . import utils / from .models import User — also capture the imported symbol names-(import_from_statement- module_name: (relative_import)- name: (dotted_name (identifier) @import.name)) @import.names--(call- function: (identifier) @call.name) @call--(call- function: (attribute- attribute: (identifier) @call.name)) @call--; Attribute calls with object captured as qualifier so Tier-1b resolution can use-; class/module name to break ties (e.g. Session.execute → resolves to Session in-; the importing file). Emitted alongside the bare-name pattern above so that-; bare-name global fallback still fires when qualifier resolution fails.-(call- function: (attribute- object: (identifier) @_qualifier- attribute: (identifier) @call.name)) @call--; Django ORM manager pattern: Model.objects.method(...)-; Unwinds the intermediate accessor (objects/related_manager/etc.) and captures-; the model class as qualifier, e.g. User.objects.filter(...) → CALLS User.filter.-; This creates cross-file edges between view/form code and model definitions.-(call- function: (attribute- object: (attribute- object: (identifier) @_qualifier- attribute: (identifier))- attribute: (identifier) @call.name)) @call--; Chained call pattern: qualifier.method1(...).method2(...)-; Propagates the qualifier from the inner call to the outer, e.g.-; User.filter(...).order_by(...) → CALLS User.order_by.-(call- function: (attribute- object: (call- function: (attribute- object: (identifier) @_qualifier- attribute: (identifier)))- attribute: (identifier) @call.name)) @call--; Heritage queries - Python class inheritance-(class_definition- name: (identifier) @heritage.class- superclasses: (argument_list- (identifier) @heritage.extends)) @heritage--; Type references — captures types used in type annotations / hints-(typed_parameter type: (type (identifier) @reference.type))-(typed_default_parameter type: (type (identifier) @reference.type))--; Typed parameters: capture name + type together so qualifier substitution can-; map a local variable name to its declared class (e.g. query: Query → 'query' → 'Query').-(function_definition- parameters: (parameters- (typed_parameter- (identifier) @_typed_param_name- type: (type (identifier) @_typed_param_type)))) @_typed_param_scope--(function_definition- parameters: (parameters- (typed_default_parameter- (identifier) @_typed_param_name- type: (type (identifier) @_typed_param_type)))) @_typed_param_scope--; Assignment tracking: x = SomeClass() or x = SomeClass(args)-; Maps local variable name → constructor type for untyped-parameter qualifier substitution.-; Only PascalCase RHS names are tracked in TypeScript (constructor convention).-(function_definition- body: (block- (expression_statement- (assignment- left: (identifier) @_assign_lhs- right: (call- function: (identifier) @_assign_rhs_type))))) @_assign_scope--; Assignment tracking: x = Model.objects.method()-; Captures the outermost identifier (model class) for ORM manager patterns.-(function_definition- body: (block- (expression_statement- (assignment- left: (identifier) @_assign_lhs- right: (call- function: (attribute- object: (attribute- object: (identifier) @_assign_rhs_type- attribute: (identifier))- attribute: (identifier))))))) @_assign_scope-`;-// Java queries - works with tree-sitter-java-export const JAVA_QUERIES = `-; Classes, Interfaces, Enums, Annotations-(class_declaration name: (identifier) @name) @definition.class-(interface_declaration name: (identifier) @name) @definition.interface-(enum_declaration name: (identifier) @name) @definition.enum-(annotation_type_declaration name: (identifier) @name) @definition.annotation--; Methods & Constructors-(method_declaration name: (identifier) @name) @definition.method-(constructor_declaration name: (identifier) @name) @definition.constructor--; Imports - capture any import declaration child as source-(import_declaration (_) @import.source) @import--; Calls-(method_invocation name: (identifier) @call.name) @call-(method_invocation object: (_) name: (identifier) @call.name) @call--; Constructor calls: new Foo()-(object_creation_expression type: (type_identifier) @call.name) @call--; Heritage - extends class (plain: extends Foo)-(class_declaration name: (identifier) @heritage.class- (superclass (type_identifier) @heritage.extends)) @heritage--; Heritage - extends class with generics (extends Foo<T>)-(class_declaration name: (identifier) @heritage.class- (superclass (generic_type (type_identifier) @heritage.extends))) @heritage--; Heritage - implements interfaces (plain: implements Foo)-(class_declaration name: (identifier) @heritage.class- (super_interfaces (type_list (type_identifier) @heritage.implements))) @heritage.impl--; Heritage - implements interfaces with generics (implements Foo<T>)-(class_declaration name: (identifier) @heritage.class- (super_interfaces (type_list (generic_type (type_identifier) @heritage.implements)))) @heritage.impl--; Heritage - interface extends interfaces (plain: extends Foo)-(interface_declaration name: (identifier) @heritage.class- (extends_interfaces (type_list (type_identifier) @heritage.extends))) @heritage--; Heritage - interface extends interfaces with generics (extends Foo<T>)-(interface_declaration name: (identifier) @heritage.class- (extends_interfaces (type_list (generic_type (type_identifier) @heritage.extends)))) @heritage--; 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 = `-; Functions (direct declarator)-(function_definition declarator: (function_declarator declarator: (identifier) @name)) @definition.function-(declaration declarator: (function_declarator declarator: (identifier) @name)) @definition.function--; Functions returning pointers (pointer_declarator wraps function_declarator)-(function_definition declarator: (pointer_declarator declarator: (function_declarator declarator: (identifier) @name))) @definition.function-(declaration declarator: (pointer_declarator declarator: (function_declarator declarator: (identifier) @name))) @definition.function--; Functions returning double pointers (nested pointer_declarator)-(function_definition declarator: (pointer_declarator declarator: (pointer_declarator declarator: (function_declarator declarator: (identifier) @name)))) @definition.function--; Structs, Unions, Enums, Typedefs-; Only match struct/union with a body to avoid treating forward declarations as definitions-(struct_specifier name: (type_identifier) @name body: (field_declaration_list)) @definition.struct-(union_specifier name: (type_identifier) @name body: (field_declaration_list)) @definition.union-(enum_specifier name: (type_identifier) @name) @definition.enum-(type_definition declarator: (type_identifier) @name) @definition.typedef--; Macros-(preproc_function_def name: (identifier) @name) @definition.macro-(preproc_def name: (identifier) @name) @definition.macro--; Includes-(preproc_include path: (_) @import.source) @import--; 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)-; struct_specifier forms: e.g. "const struct Curl_protocol foo = {...}"-(declaration type: (struct_specifier name: (type_identifier) @reference.type))-(parameter_declaration type: (struct_specifier name: (type_identifier) @reference.type))-`;-// Go queries - works with tree-sitter-go-export const GO_QUERIES = `-; Functions-(function_declaration name: (identifier) @name) @definition.function--; Methods — non-pointer receiver: func (r ReceiverType) Name(...)-; The receiver.type capture lets the parser set container = ReceiverType so that-; qualifiedKey becomes "ReceiverType.Name" instead of bare "Name".-(method_declaration- receiver: (parameter_list (parameter_declaration- type: (type_identifier) @receiver.type))- name: (field_identifier) @name) @definition.method--; Methods — pointer receiver: func (r *ReceiverType) Name(...)-(method_declaration- receiver: (parameter_list (parameter_declaration- type: (pointer_type (type_identifier) @receiver.type)))- name: (field_identifier) @name) @definition.method--; Types-(type_declaration (type_spec name: (type_identifier) @name type: (struct_type))) @definition.struct-(type_declaration (type_spec name: (type_identifier) @name type: (interface_type))) @definition.interface--; Interface method signatures — emits each method inside an interface_type as a method entity.-; @heritage.class = interface name (used as container in index.ts via heritageClassCapture).-; node type is method_elem in tree-sitter-go v0.21+.-(type_declaration- (type_spec- name: (type_identifier) @heritage.class- type: (interface_type- (method_elem- name: (field_identifier) @name)))) @definition.method--; Imports-(import_declaration (import_spec path: (interpreted_string_literal) @import.source)) @import-(import_declaration (import_spec_list (import_spec path: (interpreted_string_literal) @import.source))) @import--; Struct embedding — value: type Foo struct { Bar }-; NOTE: no @definition.* capture here — if it were present, defCapture fires first and-; the heritage block is never reached (early-exit in the first pass).-; The . anchors require the type_identifier to be the FIRST and ONLY named child of-; field_declaration, distinguishing anonymous embedded fields from named fields like:-; w Writer (named field — field_identifier_list precedes type, not matched)-(type_declaration- (type_spec- name: (type_identifier) @heritage.class- type: (struct_type- (field_declaration_list- (field_declaration .- (type_identifier) @heritage.extends .)))))--; Struct embedding — pointer: type Foo struct { *Bar }-; The . anchor requires pointer_type to be the first named child (anonymous embedded).-(type_declaration- (type_spec- name: (type_identifier) @heritage.class- type: (struct_type- (field_declaration_list- (field_declaration .- (pointer_type (type_identifier) @heritage.extends) .)))))--; Calls-(call_expression function: (identifier) @call.name) @call-; Qualified calls: pkg.Func() or localVar.Method() where the operand is a simple-; identifier — capture it as @_qualifier so cross-file resolution uses the fully-; qualified name "scrape.NewManager" instead of bare "NewManager", preventing-; ambiguous same-named symbols in different packages from being collapsed.-(call_expression function: (selector_expression- operand: (identifier) @_qualifier- field: (field_identifier) @call.name)) @call-; Chained/complex calls: a.b.Method(), call().Method(), index[i].Method() — the-; operand is not a simple identifier, so emit without qualifier (bare method name).-(call_expression function: (selector_expression- operand: (selector_expression)- field: (field_identifier) @call.name)) @call--; 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)-; Return types: in tree-sitter-go, return type is a direct type_identifier child of function/method-(function_declaration result: (type_identifier) @reference.type)-(method_declaration result: (type_identifier) @reference.type)--; Pointer-type variants: e.g. opts *Options, func(*Options) *Result-(field_declaration type: (pointer_type (type_identifier) @reference.type))-(parameter_declaration type: (pointer_type (type_identifier) @reference.type))-(function_declaration result: (pointer_type (type_identifier) @reference.type))-(method_declaration result: (pointer_type (type_identifier) @reference.type))-`;-// C++ queries - works with tree-sitter-cpp-export const CPP_QUERIES = `-; Classes, Structs, Namespaces-(class_specifier name: (type_identifier) @name) @definition.class-(struct_specifier name: (type_identifier) @name) @definition.struct-(namespace_definition name: (namespace_identifier) @name) @definition.namespace-(enum_specifier name: (type_identifier) @name) @definition.enum--; Typedefs and unions (common in C-style headers and mixed C/C++ code)-(type_definition declarator: (type_identifier) @name) @definition.typedef-(union_specifier name: (type_identifier) @name) @definition.union--; Macros-(preproc_function_def name: (identifier) @name) @definition.macro-(preproc_def name: (identifier) @name) @definition.macro--; Functions & Methods (direct declarator)-(function_definition declarator: (function_declarator declarator: (identifier) @name)) @definition.function-(function_definition declarator: (function_declarator declarator: (qualified_identifier name: (identifier) @name))) @definition.method--; Functions/methods returning pointers (pointer_declarator wraps function_declarator)-(function_definition declarator: (pointer_declarator declarator: (function_declarator declarator: (identifier) @name))) @definition.function-(function_definition declarator: (pointer_declarator declarator: (function_declarator declarator: (qualified_identifier name: (identifier) @name)))) @definition.method--; Functions/methods returning double pointers (nested pointer_declarator)-(function_definition declarator: (pointer_declarator declarator: (pointer_declarator declarator: (function_declarator declarator: (identifier) @name)))) @definition.function-(function_definition declarator: (pointer_declarator declarator: (pointer_declarator declarator: (function_declarator declarator: (qualified_identifier name: (identifier) @name))))) @definition.method--; Functions/methods returning references (reference_declarator wraps function_declarator)-(function_definition declarator: (reference_declarator (function_declarator declarator: (identifier) @name))) @definition.function-(function_definition declarator: (reference_declarator (function_declarator declarator: (qualified_identifier name: (identifier) @name)))) @definition.method--; Destructors (destructor_name is distinct from identifier in tree-sitter-cpp)-(function_definition declarator: (function_declarator declarator: (qualified_identifier name: (destructor_name) @name))) @definition.method--; Function declarations / prototypes (common in headers)-(declaration declarator: (function_declarator declarator: (identifier) @name)) @definition.function-(declaration declarator: (pointer_declarator declarator: (function_declarator declarator: (identifier) @name))) @definition.function--; Inline class method declarations (inside class body, no body: void Foo();)-(field_declaration declarator: (function_declarator declarator: (identifier) @name)) @definition.method--; Inline class method definitions (inside class body, with body: void Foo() { ... })-(field_declaration_list- (function_definition- declarator: (function_declarator- declarator: [(field_identifier) (identifier) (operator_name) (destructor_name)] @name)) @definition.method)--; Templates-(template_declaration (class_specifier name: (type_identifier) @name)) @definition.template-(template_declaration (function_definition declarator: (function_declarator declarator: (identifier) @name))) @definition.template--; Includes-(preproc_include path: (_) @import.source) @import--; Calls-(call_expression function: (identifier) @call.name) @call-(call_expression function: (field_expression field: (field_identifier) @call.name)) @call-(call_expression function: (qualified_identifier name: (identifier) @call.name)) @call-(call_expression function: (template_function name: (identifier) @call.name)) @call--; Constructor calls: new User()-(new_expression type: (type_identifier) @call.name) @call--; Heritage-(class_specifier name: (type_identifier) @heritage.class- (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 = `-; Types-(class_declaration name: (identifier) @name) @definition.class-(interface_declaration name: (identifier) @name) @definition.interface-(struct_declaration name: (identifier) @name) @definition.struct-(enum_declaration name: (identifier) @name) @definition.enum-(record_declaration name: (identifier) @name) @definition.record-(delegate_declaration name: (identifier) @name) @definition.delegate--; Namespaces (block form and C# 10+ file-scoped form)-(namespace_declaration name: (identifier) @name) @definition.namespace-(namespace_declaration name: (qualified_name) @name) @definition.namespace-(file_scoped_namespace_declaration name: (identifier) @name) @definition.namespace-(file_scoped_namespace_declaration name: (qualified_name) @name) @definition.namespace--; Methods & Properties-(method_declaration name: (identifier) @name) @definition.method-(local_function_statement name: (identifier) @name) @definition.function-(constructor_declaration name: (identifier) @name) @definition.constructor-(property_declaration name: (identifier) @name) @definition.property--; Primary constructors (C# 12): class User(string name, int age) { }-(class_declaration name: (identifier) @name (parameter_list) @definition.constructor)-(record_declaration name: (identifier) @name (parameter_list) @definition.constructor)--; Using-(using_directive (qualified_name) @import.source) @import-(using_directive (identifier) @import.source) @import--; Calls-(invocation_expression function: (identifier) @call.name) @call-(invocation_expression function: (member_access_expression name: (identifier) @call.name)) @call--; Null-conditional method calls: user?.Save()-; Parses as: invocation_expression → conditional_access_expression → member_binding_expression → identifier-(invocation_expression- function: (conditional_access_expression- (member_binding_expression- (identifier) @call.name))) @call--; Constructor calls: new Foo() and new Foo { Props }-(object_creation_expression type: (identifier) @call.name) @call--; Target-typed new (C# 9): User u = new("x", 5)-(variable_declaration type: (identifier) @call.name (variable_declarator (implicit_object_creation_expression) @call))--; Heritage-(class_declaration name: (identifier) @heritage.class- (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 (variable_declaration type: (identifier) @reference.type))-(method_declaration returns: (identifier) @reference.type)-`;-// Rust queries - works with tree-sitter-rust-export const RUST_QUERIES = `-; Functions & Items-(function_item name: (identifier) @name) @definition.function-(struct_item name: (type_identifier) @name) @definition.struct-(enum_item name: (type_identifier) @name) @definition.enum-(trait_item name: (type_identifier) @name) @definition.trait-(impl_item type: (type_identifier) @name !trait) @definition.impl-(impl_item type: (generic_type type: (type_identifier) @name) !trait) @definition.impl-(mod_item name: (identifier) @name) @definition.module--; Type aliases, const, static, macros-(type_item name: (type_identifier) @name) @definition.type-(const_item name: (identifier) @name) @definition.const-(static_item name: (identifier) @name) @definition.static-(macro_definition name: (identifier) @name) @definition.macro--; Use statements-(use_declaration argument: (_) @import.source) @import--; Calls-(call_expression function: (identifier) @call.name) @call-(call_expression function: (field_expression field: (field_identifier) @call.name)) @call-(call_expression function: (scoped_identifier- path: (identifier) @_qualifier- name: (identifier) @call.name)) @call-(call_expression function: (generic_function function: (identifier) @call.name)) @call--; 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)--; Wrapped type references — &Type, &mut Type-(field_declaration type: (reference_type (type_identifier) @reference.type))-(parameter pattern: (_) type: (reference_type (type_identifier) @reference.type))-(function_item return_type: (reference_type (type_identifier) @reference.type))--; Generic wrapper types — Box<Type>, Arc<Type>, Vec<Type>, Option<Type>, Result<Type,_>, etc.-; Capture the type argument (inner type), not the wrapper name.-(field_declaration type: (generic_type type_arguments: (type_arguments (type_identifier) @reference.type)))-(parameter pattern: (_) type: (generic_type type_arguments: (type_arguments (type_identifier) @reference.type)))-(function_item return_type: (generic_type type_arguments: (type_arguments (type_identifier) @reference.type)))--; impl Trait in parameter / return positions-(parameter pattern: (_) type: (abstract_type (type_identifier) @reference.type))-(function_item return_type: (abstract_type (type_identifier) @reference.type))--; dyn Trait — trait objects (direct: fn foo(x: dyn Trait) or field: x: dyn Trait)-(field_declaration type: (dynamic_type (type_identifier) @reference.type))-(parameter pattern: (_) type: (dynamic_type (type_identifier) @reference.type))-(function_item return_type: (dynamic_type (type_identifier) @reference.type))--; dyn Trait nested inside generic wrapper — Box<dyn Trait>, Arc<dyn Trait>, etc.-(field_declaration type: (generic_type type_arguments: (type_arguments (dynamic_type (type_identifier) @reference.type))))-(parameter pattern: (_) type: (generic_type type_arguments: (type_arguments (dynamic_type (type_identifier) @reference.type))))-(function_item return_type: (generic_type type_arguments: (type_arguments (dynamic_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-(impl_item trait: (type_identifier) @heritage.trait type: (generic_type type: (type_identifier) @heritage.class)) @heritage-(impl_item trait: (generic_type type: (type_identifier) @heritage.trait) type: (generic_type type: (type_identifier) @heritage.class)) @heritage-`;-// PHP queries - works with tree-sitter-php (php_only grammar)-export const PHP_QUERIES = `-; ── Namespace ────────────────────────────────────────────────────────────────-(namespace_definition- name: (namespace_name) @name) @definition.namespace--; ── Classes ──────────────────────────────────────────────────────────────────-(class_declaration- name: (name) @name) @definition.class--; ── Interfaces ───────────────────────────────────────────────────────────────-(interface_declaration- name: (name) @name) @definition.interface--; ── Traits ───────────────────────────────────────────────────────────────────-(trait_declaration- name: (name) @name) @definition.trait--; ── Enums (PHP 8.1) ──────────────────────────────────────────────────────────-(enum_declaration- name: (name) @name) @definition.enum--; ── Top-level functions ───────────────────────────────────────────────────────-(function_definition- name: (name) @name) @definition.function--; ── Methods (including constructors) ─────────────────────────────────────────-(method_declaration- name: (name) @name) @definition.method--; ── Class properties (including Eloquent $fillable, $casts, etc.) ────────────-(property_declaration- (property_element- (variable_name- (name) @name))) @definition.property--; ── Imports: use statements ──────────────────────────────────────────────────-; Simple: use App\\Models\\User;-(namespace_use_declaration- (namespace_use_clause- (qualified_name) @import.source)) @import--; ── Function/method calls ────────────────────────────────────────────────────-; Regular function call: foo()-(function_call_expression- function: (name) @call.name) @call--; Method call: $obj->method()-(member_call_expression- name: (name) @call.name) @call--; Nullsafe method call: $obj?->method()-(nullsafe_member_call_expression- name: (name) @call.name) @call--; Static call: Foo::bar() (php_only uses scoped_call_expression)-(scoped_call_expression- name: (name) @call.name) @call--; Constructor call: new User()-(object_creation_expression (name) @call.name) @call--; ── Heritage: extends ────────────────────────────────────────────────────────-(class_declaration- name: (name) @heritage.class- (base_clause- [(name) (qualified_name)] @heritage.extends)) @heritage--; ── Heritage: implements ─────────────────────────────────────────────────────-(class_declaration- name: (name) @heritage.class- (class_interface_clause- [(name) (qualified_name)] @heritage.implements)) @heritage.impl--; ── Heritage: use trait (must capture enclosing class name) ──────────────────-(class_declaration- name: (name) @heritage.class- 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 = `-; ── Modules ──────────────────────────────────────────────────────────────────-(module- name: (constant) @name) @definition.module--; ── Classes ──────────────────────────────────────────────────────────────────-(class- name: (constant) @name) @definition.class--; Scoped class name: class Module::ClassName-(class- name: (scope_resolution) @name) @definition.class--; ── Instance methods ─────────────────────────────────────────────────────────-(method- name: (identifier) @name) @definition.method--; ── Singleton (class-level) methods ──────────────────────────────────────────-(singleton_method- name: (identifier) @name) @definition.method--; ── Require / require_relative → IMPORTS ─────────────────────────────────────-; Capture the string argument so the second pass emits an IMPORTS edge.-(call- method: (identifier) @_req- arguments: (argument_list- (string (string_content) @import.source))- (#match? @_req "^require")) @import--; ── All other calls ───────────────────────────────────────────────────────────-(call- method: (identifier) @call.name) @call--; ── Bare calls without parens (identifiers at statement level are method calls) ─-; NOTE: This may over-capture variable reads as calls (e.g. 'result' at-; statement level). Ruby's grammar makes bare identifiers ambiguous — they-; could be local variables or zero-arity method calls. Post-processing via-; the BUILTINS set suppresses most false positives.-(body_statement- (identifier) @call.name @call)--; ── Heritage: class < SuperClass ─────────────────────────────────────────────-(class- name: (constant) @heritage.class- superclass: (superclass- (constant) @heritage.extends)) @heritage--; Scoped superclass: class Foo < Module::Class-; Captures full "Module::Class" text to avoid ambiguity with bare "Class" names-(class- name: (constant) @heritage.class- superclass: (superclass- (scope_resolution) @heritage.extends)) @heritage--; Scoped class name, bare superclass: class Module::Foo < Bar-(class- name: (scope_resolution) @heritage.class- superclass: (superclass- (constant) @heritage.extends)) @heritage--; Scoped class name, scoped superclass: class Module::Foo < Module::Bar-(class- name: (scope_resolution) @heritage.class- superclass: (superclass- (scope_resolution) @heritage.extends)) @heritage-`;-// Kotlin queries - works with tree-sitter-kotlin (fwcd/tree-sitter-kotlin)-// Based on official tags.scm; functions use simple_identifier, classes use type_identifier-export const KOTLIN_QUERIES = `-; ── Interfaces ─────────────────────────────────────────────────────────────-; tree-sitter-kotlin (fwcd) has no interface_declaration node type.-; Interfaces are class_declaration nodes with an anonymous "interface" keyword child.-(class_declaration- "interface"- (type_identifier) @name) @definition.interface--; ── Classes (regular, data, sealed, enum) ────────────────────────────────-; All have the anonymous "class" keyword child. enum class has both-; "enum" and "class" children — the "class" child still matches.-(class_declaration- "class"- (type_identifier) @name) @definition.class--; ── Object declarations (Kotlin singletons) ──────────────────────────────-(object_declaration- (type_identifier) @name) @definition.class--; ── Companion objects (named only) ───────────────────────────────────────-(companion_object- (type_identifier) @name) @definition.class--; ── Functions (top-level, member, extension) ──────────────────────────────-(function_declaration- (simple_identifier) @name) @definition.function--; ── Properties ───────────────────────────────────────────────────────────-(property_declaration- (variable_declaration- (simple_identifier) @name)) @definition.property--; ── Enum entries ─────────────────────────────────────────────────────────-(enum_entry- (simple_identifier) @name) @definition.enum--; ── Type aliases ─────────────────────────────────────────────────────────-(type_alias- (type_identifier) @name) @definition.type--; ── Imports ──────────────────────────────────────────────────────────────-(import_header- (identifier) @import.source) @import--; ── Function calls (direct) ──────────────────────────────────────────────-(call_expression- (simple_identifier) @call.name) @call--; ── Method calls (via navigation: obj.method()) ──────────────────────────-(call_expression- (navigation_expression- (navigation_suffix- (simple_identifier) @call.name))) @call--; ── Constructor invocations ──────────────────────────────────────────────-(constructor_invocation- (user_type- (type_identifier) @call.name)) @call--; ── Infix function calls (e.g., a to b, x until y) ──────────────────────-(infix_expression- (simple_identifier) @call.name) @call--; ── Heritage: extends / implements via delegation_specifier ──────────────-; Interface implementation (bare user_type): class Foo : Bar-(class_declaration- (type_identifier) @heritage.class- (delegation_specifier- (user_type (type_identifier) @heritage.extends))) @heritage--; Class extension (constructor_invocation): class Foo : Bar()-(class_declaration- (type_identifier) @heritage.class- (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 = `-; Classes-(class_declaration "class" name: (type_identifier) @name) @definition.class--; Structs-(class_declaration "struct" name: (type_identifier) @name) @definition.struct--; Enums-(class_declaration "enum" name: (type_identifier) @name) @definition.enum--; Extensions (mapped to class — no dedicated label in schema)-(class_declaration "extension" name: (user_type (type_identifier) @name)) @definition.class--; Actors-(class_declaration "actor" name: (type_identifier) @name) @definition.class--; Protocols (mapped to interface)-(protocol_declaration name: (type_identifier) @name) @definition.interface--; Type aliases-(typealias_declaration name: (type_identifier) @name) @definition.type--; Functions (top-level and methods)-(function_declaration name: (simple_identifier) @name) @definition.function--; Protocol method declarations-(protocol_function_declaration name: (simple_identifier) @name) @definition.method--; Initializers — "init" is the canonical name; line offset tracked via definition node-(init_declaration "init" @name) @definition.constructor--; Properties (stored and computed)-(property_declaration (pattern (simple_identifier) @name)) @definition.property--; Imports-(import_declaration (identifier (simple_identifier) @import.source)) @import--; Calls - direct function calls-(call_expression (simple_identifier) @call.name) @call--; Calls - member/navigation calls (obj.method())-(call_expression (navigation_expression (navigation_suffix (simple_identifier) @call.name))) @call--; Heritage - class/struct/enum inheritance and protocol conformance-(class_declaration name: (type_identifier) @heritage.class- (inheritance_specifier inherits_from: (user_type (type_identifier) @heritage.extends))) @heritage--; Heritage - protocol inheritance-(protocol_declaration name: (type_identifier) @heritage.class- (inheritance_specifier inherits_from: (user_type (type_identifier) @heritage.extends))) @heritage--; Heritage - extension protocol conformance (e.g. extension Foo: SomeProtocol)-; 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 = `-; ── Classes (class, case class, abstract class, sealed class) ────────────────-(class_definition- name: (identifier) @name) @definition.class--; ── Traits (mapped to interface) ─────────────────────────────────────────────-(trait_definition- name: (identifier) @name) @definition.interface--; ── Object definitions (companion objects, case objects, singletons) ─────────-(object_definition- name: (identifier) @name) @definition.class--; ── Function / method definitions ────────────────────────────────────────────-(function_definition- name: (identifier) @name) @definition.function--; ── Abstract method declarations (in traits / abstract classes) ──────────────-(function_declaration- name: (identifier) @name) @definition.method--; ── Type aliases ──────────────────────────────────────────────────────────────-(type_definition- name: (type_identifier) @name) @definition.type--; ── Val/var definitions (class-level members only, not method-local vars) ──────-; Restricting to template_body ensures we only capture class/object-level-; declarations (e.g. companion object implicits) and not local val bindings-; inside method bodies, which would add noise entities to the graph.-(template_body- (val_definition (identifier) @name) @definition.const)--(template_body- (var_definition (identifier) @name) @definition.const)--; ── 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- function: (identifier) @call.name) @call--; ── Calls: method call (obj.method()) ────────────────────────────────────────-(call_expression- function: (field_expression- field: (identifier) @call.name)) @call--; ── Constructor: new Foo() ────────────────────────────────────────────────────-(instance_expression- (type_identifier) @call.name) @call--; ── Heritage: class / object extends and with ────────────────────────────────-(class_definition- name: (identifier) @heritage.class- extend: (extends_clause- (type_identifier) @heritage.extends)) @heritage--(trait_definition- name: (identifier) @heritage.class- extend: (extends_clause- (type_identifier) @heritage.extends)) @heritage--(object_definition- 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,- [SupportedLanguages.JavaScript]: JAVASCRIPT_QUERIES,- [SupportedLanguages.Python]: PYTHON_QUERIES,- [SupportedLanguages.Java]: JAVA_QUERIES,- [SupportedLanguages.C]: C_QUERIES,- [SupportedLanguages.Go]: GO_QUERIES,- [SupportedLanguages.CPlusPlus]: CPP_QUERIES,- [SupportedLanguages.CSharp]: CSHARP_QUERIES,- [SupportedLanguages.Ruby]: RUBY_QUERIES,- [SupportedLanguages.Rust]: RUST_QUERIES,- [SupportedLanguages.PHP]: PHP_QUERIES,- [SupportedLanguages.Kotlin]: KOTLIN_QUERIES,- [SupportedLanguages.Swift]: SWIFT_QUERIES,- [SupportedLanguages.Scala]: SCALA_QUERIES,-};diff --git a/core-ingestion/dist/role-classifier.d.ts b/core-ingestion/dist/role-classifier.d.tsdeleted file mode 100644index 3773ca06..00000000--- a/core-ingestion/dist/role-classifier.d.ts+++ /dev/null@@ -1,7 +0,0 @@-export type EntityRole = 'production' | 'test' | 'fixture' | 'generated' | 'external' | 'tooling';-export interface RoleClassification {- role: EntityRole;- role_confidence: number;- role_signals: string[];-}-export declare function classifyFileRole(filePath: string, source?: string): RoleClassification;diff --git a/core-ingestion/dist/role-classifier.js b/core-ingestion/dist/role-classifier.jsdeleted file mode 100644index d1671b21..00000000--- a/core-ingestion/dist/role-classifier.js+++ /dev/null@@ -1,210 +0,0 @@-import * as nodePath from 'node:path';-// ----------------------------------------------------------------------------// Signal tables-// ----------------------------------------------------------------------------const TEST_PATH_PATTERNS = [- { pattern: /[/\\]__tests__[/\\]/i, signal: 'path:__tests__' },- { pattern: /[/\\]tests?[/\\]/i, signal: 'path:tests/' },- { pattern: /[/\\]spec[/\\]/i, signal: 'path:spec/' },- { pattern: /[/\\]src[/\\]test[/\\]/i, signal: 'path:src/test/' },- { pattern: /[/\\]test[/\\]unit[/\\]/i, signal: 'path:test/unit/' },- { pattern: /[/\\]test[/\\]integration[/\\]/i, signal: 'path:test/integration/' },- // C#/.NET: directories named Foo.Tests or Foo.Test (e.g. Newtonsoft.Json.Tests/)- { pattern: /[/\\][^/\\]*\.tests?[/\\]/i, signal: 'path:.Tests/' },-];-const TEST_FILE_PATTERNS = [- { pattern: /\.test\.[^.]+$/i, signal: 'filename:.test.' },- { pattern: /\.spec\.[^.]+$/i, signal: 'filename:.spec.' },- { pattern: /Tests?\.[^.]+$/, signal: 'filename:Test(s).' }, // matches Test.cs and Tests.cs- { pattern: /Spec\.[^.]+$/, signal: 'filename:Spec.' },- { pattern: /_test\.[^.]+$/i, signal: 'filename:_test.' },- { pattern: /_spec\.[^.]+$/i, signal: 'filename:_spec.' },-];-const TEST_IMPORT_PATTERNS = [- { pattern: /from ['"](?:jest|vitest|mocha|chai|sinon|jasmine|@testing-library)/, signal: 'import:js_test_framework' },- { pattern: /require\(['"](?:jest|vitest|mocha|chai|sinon|jasmine)['"]\)/, signal: 'import:js_test_framework_require' },- { pattern: /import\s+(?:unittest|pytest)/, signal: 'import:python_test_framework' },- { pattern: /from\s+(?:unittest|pytest)/, signal: 'import:python_test_framework_from' },- { pattern: /import\s+org\.junit/, signal: 'import:junit' },- { pattern: /import\s+org\.testng/, signal: 'import:testng' },- { pattern: /import\s+io\.mockk/, signal: 'import:mockk' },- { pattern: /import\s+org\.mockito/, signal: 'import:mockito' },- { pattern: /import\s+org\.scalatest/, signal: 'import:scalatest' },- { pattern: /import\s+munit/, signal: 'import:munit' },- { pattern: /import\s+zio\.test/, signal: 'import:zio_test' },- { pattern: /"testing"/, signal: 'import:go_testing' },- { pattern: /require\s+['"]rspec['"]/, signal: 'import:rspec' },- { pattern: /require\s+['"]minitest['"]/, signal: 'import:minitest' },- // C#/.NET test frameworks- { pattern: /using\s+NUnit\.Framework/, signal: 'import:nunit' },- { pattern: /using\s+Xunit/, signal: 'import:xunit' },- { pattern: /using\s+Microsoft\.VisualStudio\.TestTools\.UnitTesting/, signal: 'import:mstest' },-];-const FIXTURE_PATH_PATTERNS = [- { pattern: /[/\\]fixtures?[/\\]/i, signal: 'path:fixtures/' },- { pattern: /[/\\]__fixtures__[/\\]/i, signal: 'path:__fixtures__/' },- { pattern: /[/\\]test[/\\]resources[/\\]/i, signal: 'path:test/resources/' },- { pattern: /[/\\]testdata[/\\]/i, signal: 'path:testdata/' },-];-const FIXTURE_FILE_PATTERNS = [- { pattern: /fixture/i, signal: 'filename:fixture' },- { pattern: /\.mock\.[^.]+$/i, signal: 'filename:.mock.' },- { pattern: /stub/i, signal: 'filename:stub' },- { pattern: /fake/i, signal: 'filename:fake' },- { pattern: /sample/i, signal: 'filename:sample' },- { pattern: /seed/i, signal: 'filename:seed' },-];-const GENERATED_PATH_PATTERNS = [- { pattern: /[/\\]generated[/\\]/i, signal: 'path:generated/' },- { pattern: /[/\\]gen[/\\]/i, signal: 'path:gen/' },- { pattern: /[/\\]\.gen[/\\]/i, signal: 'path:.gen/' },- { pattern: /\.pb\.[^.]+$/, signal: 'filename:.pb. (protobuf)' },- { pattern: /\.gen\.[^.]+$/, signal: 'filename:.gen.' },- { pattern: /_generated\.[^.]+$/, signal: 'filename:_generated.' },-];-const GENERATED_SOURCE_PATTERNS = [- { pattern: /^\/\/ Code generated/m, signal: 'source_marker:code_generated' },- { pattern: /^\/\/ DO NOT EDIT/m, signal: 'source_marker:do_not_edit' },- { pattern: /^# Code generated/m, signal: 'source_marker:code_generated_hash' },- { pattern: /^# DO NOT EDIT/m, signal: 'source_marker:do_not_edit_hash' },- { pattern: /^\/\* Generated by/m, signal: 'source_marker:generated_by' },- { pattern: /^\/\* AUTO-GENERATED/im, signal: 'source_marker:auto_generated' },- { pattern: /^\/\/ AUTO-GENERATED/im, signal: 'source_marker:auto_generated_line' },-];-const EXTERNAL_PATH_PATTERNS = [- { pattern: /[/\\]vendor[/\\]/i, signal: 'path:vendor/' },- { pattern: /[/\\]third[-_]?party[/\\]/i, signal: 'path:third_party/' },- { pattern: /[/\\]extern[/\\]/i, signal: 'path:extern/' },-];-const TOOLING_PATH_PATTERNS = [- { pattern: /[/\\]scripts?[/\\]/i, signal: 'path:scripts/' },- { pattern: /[/\\]tools?[/\\]/i, signal: 'path:tools/' },- { pattern: /[/\\]ci[/\\]/i, signal: 'path:ci/' },- { pattern: /[/\\]\.github[/\\]/i, signal: 'path:.github/' },- { pattern: /[/\\]dev[/\\]/i, signal: 'path:dev/' },-];-const TOOLING_FILE_PATTERNS = [- { pattern: /^Makefile$/, signal: 'filename:Makefile' },- { pattern: /^Dockerfile[^/\\]*$/, signal: 'filename:Dockerfile' },- { pattern: /^docker-compose[^/\\]*\.yml$/i, signal: 'filename:docker-compose' },- { pattern: /\.config\.[^.]+$/i, signal: 'filename:.config.' },- { pattern: /^vite\.config\./i, signal: 'filename:vite.config' },- { pattern: /^webpack\.config\./i, signal: 'filename:webpack.config' },- { pattern: /^jest\.config\./i, signal: 'filename:jest.config' },- { pattern: /^babel\.config\./i, signal: 'filename:babel.config' },- { pattern: /^tsconfig[^/\\]*\.json$/i, signal: 'filename:tsconfig.json' },- { pattern: /^\.eslintrc/i, signal: 'filename:.eslintrc' },- { pattern: /^rollup\.config\./i, signal: 'filename:rollup.config' },- { pattern: /^build\.[^.]+$/i, signal: 'filename:build.' },- { pattern: /migrate\.[^.]+$/i, signal: 'filename:migrate.' },-];-// ----------------------------------------------------------------------------// Main classifier-// ----------------------------------------------------------------------------export function classifyFileRole(filePath, source) {- const normalizedPath = filePath.replace(/\\/g, '/');- const fileName = nodePath.basename(filePath);- const signals = [];- // --- Test ---- let testScore = 0;- for (const { pattern, signal } of TEST_PATH_PATTERNS) {- if (pattern.test(normalizedPath)) {- testScore += 0.8;- signals.push(signal);- break;- }- }- for (const { pattern, signal } of TEST_FILE_PATTERNS) {- if (pattern.test(fileName)) {- testScore += 0.9;- signals.push(signal);- break;- }- }- if (source) {- for (const { pattern, signal } of TEST_IMPORT_PATTERNS) {- if (pattern.test(source)) {- testScore += 0.5;- signals.push(signal);- break;- }- }- }- // --- Fixture ---- let fixtureScore = 0;- for (const { pattern, signal } of FIXTURE_PATH_PATTERNS) {- if (pattern.test(normalizedPath)) {- fixtureScore += 0.8;- signals.push(signal);- break;- }- }- for (const { pattern, signal } of FIXTURE_FILE_PATTERNS) {- if (pattern.test(fileName)) {- fixtureScore += 0.6;- signals.push(signal);- break;- }- }- // --- Generated ---- let generatedScore = 0;- for (const { pattern, signal } of GENERATED_PATH_PATTERNS) {- if (pattern.test(normalizedPath)) {- generatedScore += 0.7;- signals.push(signal);- break;- }- }- if (source) {- for (const { pattern, signal } of GENERATED_SOURCE_PATTERNS) {- if (pattern.test(source)) {- generatedScore += 0.9;- signals.push(signal);- break;- }- }- }- // --- External ---- let externalScore = 0;- for (const { pattern, signal } of EXTERNAL_PATH_PATTERNS) {- if (pattern.test(normalizedPath)) {- externalScore += 0.9;- signals.push(signal);- break;- }- }- // --- Tooling ---- let toolingScore = 0;- for (const { pattern, signal } of TOOLING_PATH_PATTERNS) {- if (pattern.test(normalizedPath)) {- toolingScore += 0.6;- signals.push(signal);- break;- }- }- for (const { pattern, signal } of TOOLING_FILE_PATTERNS) {- if (pattern.test(fileName)) {- toolingScore += 0.7;- signals.push(signal);- break;- }- }- // --- Pick winner ---- const scores = [- ['test', testScore],- ['fixture', fixtureScore],- ['generated', generatedScore],- ['external', externalScore],- ['tooling', toolingScore],- ];- scores.sort((a, b) => b[1] - a[1]);- const [topRole, topScore] = scores[0];- if (topScore >= 0.5) {- return {- role: topRole,- role_confidence: parseFloat(Math.min(topScore, 1.0).toFixed(2)),- role_signals: signals,- };- }- return { role: 'production', role_confidence: 0.5, role_signals: [] };-}diff --git a/core-ingestion/dist/types.d.ts b/core-ingestion/dist/types.d.tsdeleted file mode 100644index c0868c43..00000000--- a/core-ingestion/dist/types.d.ts+++ /dev/null@@ -1,20 +0,0 @@-export interface PatchSource {- uri: string;- sourceHash?: string;- extractor: string;- sourceType: string;-}-export interface PatchOp {- type: string;- [key: string]: unknown;-}-export interface GraphPatchPayload {- patchId: string;- actor: string;- timestamp: string;- source: PatchSource;- baseRev: number;- ops: PatchOp[];- replaces: string[];- intent?: string;-}diff --git a/core-ingestion/dist/types.js b/core-ingestion/dist/types.jsdeleted file mode 100644index cb0ff5c3..00000000--- a/core-ingestion/dist/types.js+++ /dev/null@@ -1 +0,0 @@-export {};diff --git a/memory-layer/src/main/scala/ix/memory/db/ArangoClient.scala b/memory-layer/src/main/scala/ix/memory/db/ArangoClient.scalaindex ee377976..2e8d7451 100644--- a/memory-layer/src/main/scala/ix/memory/db/ArangoClient.scala+++ b/memory-layer/src/main/scala/ix/memory/db/ArangoClient.scala@@ -3,6 +3,7 @@ package ix.memory.dbimport scala.concurrent.duration._import cats.effect.{IO, Resource}+import cats.syntax.traverse._import com.arangodb.{ArangoDB, ArangoDatabase}import com.arangodb.entity.MultiDocumentEntityimport com.arangodb.model.{AqlQueryOptions, DocumentCreateOptions, OverwriteMode, StreamTransactionOptions}@@ -38,14 +39,7 @@ class ArangoClient private (db: ArangoDatabase) {IO.blocking {val cursor = db.query(aql, classOf[AnyRef], asJava(bindVars), queryOptions(txId))cursor.asListRemaining().asScala.toList- }.flatMap { values =>- values.foldLeft(IO.pure(List.empty[Json])) { (accIO, value) =>- for {- acc <- accIO- json <- toJson(value)- } yield acc :+ json- }- }+ }.flatMap(_.traverse(toJson))def queryOne(aql: String,