ultimate-mcp-server
Version:
The definitive all-in-one Model Context Protocol server for AI-assisted coding across 30+ platforms
57 lines • 2.02 kB
TypeScript
/**
* Base Context Extractor
* Common functionality for all language-specific extractors
*/
import { CodeContext, ContextExtractionOptions, FileContext } from '../types.js';
export declare abstract class BaseContextExtractor {
protected abstract language: string;
/**
* Extract contexts from code
*/
abstract extractContexts(filePath: string, content: string, options: ContextExtractionOptions): Promise<CodeContext[]>;
/**
* Extract file-level context information
*/
abstract extractFileContext(filePath: string, content: string): Promise<FileContext>;
/**
* Estimate token count for content
*/
protected estimateTokens(content: string): number;
/**
* Extract context around a specific line
*/
protected extractAroundLine(content: string, targetLine: number, contextLines?: number): {
content: string;
startLine: number;
endLine: number;
};
/**
* Extract function/method context
*/
protected extractFunctionContext(content: string, functionName: string, startLine: number, endLine: number): CodeContext;
/**
* Extract class context
*/
protected extractClassContext(content: string, className: string, startLine: number, endLine: number, options: ContextExtractionOptions): CodeContext;
/**
* Calculate cyclomatic complexity
*/
protected calculateComplexity(code: string): number;
/**
* Strip method bodies to reduce token count
*/
protected stripMethodBodies(classContent: string): string;
/**
* Extract docstring/comments
*/
protected extractDocstring(content: string, startLine: number): string | undefined;
/**
* Filter contexts based on relevance
*/
protected filterByRelevance(contexts: CodeContext[], minRelevance?: number): CodeContext[];
/**
* Sort contexts by relevance
*/
protected sortByRelevance(contexts: CodeContext[]): CodeContext[];
}
//# sourceMappingURL=base.d.ts.map