socraticode
Version:
SocratiCode — MCP server for local codebase indexing, semantic search, and code dependency graphs. All private, all local via Docker.
82 lines • 3.55 kB
TypeScript
import type { SymbolNode } from "../types.js";
import { type SymbolGraphCache, type SymbolGraphReaderToken } from "./symbol-graph-cache.js";
export type ImpactStatus = "ok" | "not_found" | "ambiguous" | "unsupported_or_incomplete" | "storage_error" | "graph_upgrade_required";
export interface ImpactOptions {
file?: string;
symbolId?: string;
isIncomplete?: boolean;
/** Maximum ambiguous candidates to return, as a positive integer; all when omitted. */
limit?: number;
}
export interface ImpactResult {
target: string;
targetKind: "file" | "symbol";
depth: number;
/** Files grouped by hop distance (1 = direct caller, 2 = caller of caller, ...) */
filesByDepth: Map<number, string[]>;
totalFiles: number;
truncated: boolean;
status: ImpactStatus;
message?: string;
/** Set when `status` is "ambiguous": the matching symbols, at most `ImpactOptions.limit` of them. */
candidates?: SymbolNode[];
/** Set when `status` is "ambiguous": the number of matches after the file filter, including those not in `candidates`. */
totalCandidates?: number;
}
/** BFS over symbol call/reference graph or reverseFileIndex. Polymorphic on target type. */
export declare function getImpactRadius(cache: SymbolGraphCache, target: string, depth?: number, options?: ImpactOptions): Promise<ImpactResult>;
export interface FlowNode {
symbolId: string;
symbolName: string;
file: string;
line: number;
children: FlowNode[];
/** True if the recursion stopped here due to depth or cycle. */
truncatedReason?: "depth" | "cycle";
}
/** DFS via lazy-loaded outgoing edges, cycle-safe. */
export declare function getCallFlow(cache: SymbolGraphCache, entrypointId: string, depth?: number, operationToken?: SymbolGraphReaderToken): Promise<FlowNode | null>;
export interface SymbolContextCaller {
file: string;
line: number;
symbolId: string;
kind?: string;
}
export interface SymbolContextCallee {
name: string;
resolved: string[];
confidence: string;
kind?: string;
}
export interface SymbolContext {
symbol: SymbolNode;
callers: SymbolContextCaller[];
callees: SymbolContextCallee[];
}
export interface SymbolContextResult {
/** Context for the matching definitions that resolve, at most the `limit` passed to `getSymbolContextResult`. */
contexts: SymbolContext[];
/** Number of definitions that match the name and file hint. */
total: number;
/** Number of distinct files those definitions are in. */
fileCount: number;
}
/**
* Resolve definition, callers and callees for the definitions named `name`,
* optionally narrowed by `fileHint`.
*/
export declare function getSymbolContext(cache: SymbolGraphCache, name: string, fileHint?: string): Promise<SymbolContext[]>;
/**
* Resolve definition, callers and callees for the definitions named `name`,
* optionally narrowed by `fileHint`, with the match counts. With `limit`, a
* positive integer, resolution stops once `limit` definitions are resolved.
*/
export declare function getSymbolContextResult(cache: SymbolGraphCache, name: string, fileHint?: string, limit?: number): Promise<SymbolContextResult>;
export declare function listSymbols(cache: SymbolGraphCache, opts: {
file?: string;
query?: string;
limit?: number;
}): Promise<SymbolNode[]>;
/** Detect whether a target string looks like a file path vs a symbol name. */
export declare function looksLikeFilePath(s: string): boolean;
//# sourceMappingURL=graph-impact.d.ts.map