import type { Range } from "./types.js"; export type SemanticNodeType = "File" | "Function" | "Class" | "Variable" | "Export" | "Import" | "Dynamic" | "Unknown"; export type ReferenceKind = "CALLS" | "IMPORTS" | "EXPORTS" | "DEFINES" | "USES" | "TYPE_DEPENDENCY"; export interface SemanticNode { id: string; contentHash: string; type: SemanticNodeType; name?: string; location?: Range; fileId: string; metadata: Record; incomingReferences: Reference[]; outgoingReferences: Reference[]; isStale?: boolean; } export interface Reference { sourceNodeId: string; targetNodeId: string; kind: ReferenceKind; metadata?: Record | undefined; } export declare class SemanticGraph { private nodes; private fileToNodes; /** * Generates a stable Logical Entity Identifier (LEI). */ static generateLei(fileId: string, type: SemanticNodeType, name?: string): string; /** * Generates a content-addressed hash for change detection. */ static generateContentHash(content: string): string; addNode(node: SemanticNode): void; getNode(id: string): SemanticNode | undefined; removeNode(id: string): void; addReference(sourceId: string, targetId: string, kind: ReferenceKind, metadata?: Record): void; getNodesInFile(fileId: string): SemanticNode[]; getAllNodes(): SemanticNode[]; /** * Returns nodes that have no incoming references of a certain kind. * Useful for initial dead code detection. */ getOrphanedNodes(kind?: ReferenceKind): SemanticNode[]; }