hikma-engine
Version:
Code Knowledge Graph Indexer - A sophisticated TypeScript-based indexer that transforms Git repositories into multi-dimensional knowledge stores for AI agents
49 lines • 1.87 kB
TypeScript
/**
* @file Responsible for parsing AST of supported languages and extracting code structure.
* It identifies and creates various node types (CodeNode, FileNode,
* TestNode, FunctionNode) and their relationships (edges).
* Polyglot AST parser supporting multiple languages.
*/
import { CodeNode, FileNode, Edge, TestNode, FunctionNode } from '../types';
import { ConfigManager } from '../config';
export declare class AstParser {
private config;
private logger;
private projectRoot;
private repoId;
private nodes;
private edges;
private pathToIdMap;
/**
* @param {string} projectRoot - The absolute path to the root of the project.
* @param {ConfigManager} config - Configuration manager instance.
* @param {string} repoId - The repository ID for foreign key relationships.
*/
constructor(projectRoot: string, config: ConfigManager, repoId: string);
getNodes(): (CodeNode | FileNode | TestNode | FunctionNode)[];
getEdges(): Edge[];
/**
* Parses the given files and extracts nodes and edges.
* @param {string[]} filePaths – files to parse
* @param {Map<string,string>} idMap – absolute path → FileNode.id
* @returns {Promise<void>}
*/
parseFiles(filePaths: string[], idMap?: Map<string, string>): Promise<void>;
private isTestFile;
private detectLanguage;
private createNodeId;
private parseTypeScriptFile;
private extractFunctionDetails;
private extractCodeNode;
private extractTestNode;
private detectTestFramework;
private determineFileType;
private generateContentHash;
private createFileNodes;
private createEdges;
private extractFunctionCalls;
private buildCallGraph;
private computeTransitiveDepth;
private getNodeTypeStats;
}
//# sourceMappingURL=ast-parser.d.ts.map