@knath2000/codebase-indexing-mcp
Version:
MCP server for codebase indexing with Voyage AI embeddings and Qdrant vector storage
115 lines (114 loc) • 2.83 kB
TypeScript
import { CodeChunk } from '../types.js';
export declare class CodeParser {
private parser;
private languageConfigs;
constructor();
/**
* Parse a file and extract code chunks
*/
parseFile(filePath: string): Promise<CodeChunk[]>;
/**
* Parse content directly without file I/O
*/
parseContent(content: string, filePath: string, language?: string): Promise<CodeChunk[]>;
/**
* Extract code chunks from a tree-sitter node
*/
private extractChunks;
/**
* Recursively traverse tree-sitter nodes
*/
private traverseNode;
/**
* Create a code chunk from a tree-sitter node
*/
private createChunkFromNode;
/**
* Parse generic files (non-code files or unsupported languages)
*/
private parseGenericFile;
/**
* Parse generic content by splitting into logical chunks
*/
private parseGenericContent;
/**
* Parse markdown content without tree-sitter (fallback)
*/
private parseMarkdownContentFallback;
/**
* Create a markdown chunk with proper metadata
*/
private createMarkdownChunk;
/**
* Get language from file extension
*/
private getLanguageFromFile;
/**
* Convert tree-sitter node to our ParsedNode interface
*/
private nodeToParser;
/**
* Calculate node depth in the AST
*/
private calculateNodeDepth;
/**
* Generate content hash for chunk
*/
private generateContentHash;
/**
* Generate unique chunk ID compatible with Qdrant (UUID format)
*/
private generateChunkId;
/**
* Enhanced hash function that produces hex output suitable for UUID generation
*/
private simpleHash;
/**
* Check if file is a test file
*/
private isTestFile;
/**
* Calculate code complexity (simple metric)
*/
private calculateComplexity;
/**
* Extract dependencies/imports from content
*/
private extractDependencies;
/**
* Extract exports from content
*/
private extractExports;
/**
* Extract imports from content
*/
private extractImports;
/**
* Initialize language configurations
*/
private initializeLanguageConfigs;
/**
* Extract function name from node
*/
private extractFunctionName;
/**
* Extract class name from node
*/
private extractClassName;
/**
* Extract interface name from node
*/
private extractInterfaceName;
/**
* Extract method name from node
*/
private extractMethodName;
/**
* Extract markdown heading text from node
*/
private extractMarkdownHeading;
/**
* Extract code block language from fenced code block
*/
private extractCodeBlockLanguage;
}