/** * NEXUS symbol context query. * * Retrieves caller/callee relationships, community membership, and process * participation for a named code symbol. Used by `cleo nexus context`. * * @task T1473 */ import { type EngineResult } from '../engine-result.js'; /** Source code content fetched via smartUnfold. */ export interface NexusSourceContent { /** Extracted source text. */ source: string; /** Start line (1-based). */ startLine: number; /** End line (1-based). */ endLine: number; /** Any parse errors encountered. */ errors: string[]; } /** A single caller or callee relationship entry. */ export interface NexusContextRelation { /** Relation type (calls, imports, accesses). */ relationType: string; /** Node ID of the related symbol. */ nodeId: unknown; /** Human-readable symbol name. */ name: string; /** Node kind (function, method, class, …). */ kind: string; /** Relative file path, or null. */ filePath: unknown; } /** Process participation entry. */ export interface NexusContextProcess { /** Process node ID. */ processId: unknown; /** Human-readable process label. */ label: unknown; /** Role of this symbol in the process. */ role: string; /** Step order within the process, or null. */ step: unknown; } /** Context result for a single matching node. */ export interface NexusContextNode { /** Node ID. */ nodeId: string; /** Symbol name. */ name: unknown; /** Node kind. */ kind: unknown; /** Relative file path. */ filePath: unknown; /** Start line (1-based). */ startLine: unknown; /** End line (1-based). */ endLine: unknown; /** Whether the symbol is exported. */ isExported: unknown; /** One-line doc summary (if present). */ docSummary: unknown; /** Community membership, or null. */ community: { id: string | null; label: unknown; } | null; /** Incoming call/import edges (callers). */ callers: NexusContextRelation[]; /** Outgoing call/import edges (callees). */ callees: NexusContextRelation[]; /** Process participation records. */ processes: NexusContextProcess[]; /** Source content (populated when opts.showContent is true). */ source?: NexusSourceContent; } /** Options for {@link getSymbolContext}. */ export interface NexusContextOptions { /** Max callers/callees to return per symbol (default: 20). */ limit?: number; /** When true, fetch source code via smartUnfold. */ showContent?: boolean; } /** Result envelope for {@link getSymbolContext}. */ export interface NexusContextResult { /** Original symbol query. */ query: string; /** Project ID. */ projectId: string; /** Total matching nodes count. */ matchCount: number; /** Per-node context entries (up to 5). */ results: NexusContextNode[]; } /** * Retrieve caller/callee context and process participation for a named symbol. * * Searches the nexus_nodes table for nodes whose `name` contains `symbolName` * (case-insensitive), then builds caller/callee lists from nexus_relations. * Returns up to 5 matching nodes with full context. * * Throws with code `E_NOT_FOUND` when no symbol matches. * * @param symbolName - Symbol name to look up (partial match). * @param projectId - Nexus project ID. * @param repoPath - Absolute repository root path. * @param opts - Query options. * @returns Resolved symbol context. * * @example * const ctx = await getSymbolContext('dispatchFromCli', projectId, repoPath); * console.log(ctx.results[0].callers.length); */ export declare function getSymbolContext(symbolName: string, projectId: string, repoPath: string, opts?: NexusContextOptions): Promise; export declare function nexusContext(symbolName: string, projectId: string, repoPath: string, limit: number, showContent: boolean): Promise>; //# sourceMappingURL=context.d.ts.map