import type { ASTNode, ScriptNode, StatementNode } from "../ast/types.js"; /** * Semantic symbol type for bash scripts. */ export declare enum SymbolType { Variable = "Variable", Function = "Function", Command = "Command", File = "File", Class = "Class", Module = "Module" } /** * Levenshtein distance utility for fuzzy matching. */ export declare function levenshtein(a: string, b: string): number; /** * A semantic symbol found in the script. */ export interface SemanticSymbol { name: string; type: SymbolType; line: number; column: number; scope: string; path?: string; } /** * An occurrence of a symbol (either a definition or a reference). */ export interface SymbolOccurrence { name: string; type: SymbolType; line: number; column: number; isDefinition: boolean; scope: string; path?: string; } /** * Semantic Engine for Ag-Bash. * * Analyzes ASTs to provide semantic intelligence for shell scripts. */ export declare class SemanticEngine { private ast; private symbols; private occurrences; constructor(ast?: ScriptNode | undefined); /** * Refreshes the semantic symbol table by traversing the AST. */ analyze(path?: string): void; private traverse; /** * Traverses a Tree-sitter CST for generic symbol extraction. */ private traverseTreeSitter; /** * Returns all symbols visible from a specific scope. */ getVisibleSymbols(scope?: string): SemanticSymbol[]; /** * Returns all indexed symbols. */ getAllSymbols(): SemanticSymbol[]; /** * Returns all occurrences of a symbol. */ getOccurrences(name: string): SymbolOccurrence[]; /** * Resolves a symbol's definition. */ findDefinition(name: string, scope?: string): SemanticSymbol | undefined; /** * Incremental indexer called by the interpreter or workspace indexer. */ indexNode(node: ASTNode | any, path?: string, language?: string): void; indexStatement(node: StatementNode, path?: string): Promise; indexScript(node: ScriptNode, path?: string): Promise; /** * Fuzzy search for symbols similar to the query. */ fuzzySearchSymbols(query: string, type?: SymbolType, maxDistance?: number): SemanticSymbol[]; /** * Serializes the current symbol table and occurrences. */ serialize(): string; /** * Deserializes symbols and occurrences into the engine. */ deserialize(data: string | object): void; /** * Merges another set of symbols into the current index. * Useful for incremental workspace indexing. */ merge(other: { symbols: SemanticSymbol[]; occurrences: SymbolOccurrence[]; }): void; /** * Removes all symbols associated with a specific path. * Used for incremental updates when a file is modified. */ clearPath(path: string): void; }