bugger-mcp
Version:
MCP Server for managing bugs, feature requests, and improvements
161 lines • 4.24 kB
TypeScript
export interface FunctionMatch {
name: string;
filePath: string;
startLine: number;
endLine: number;
signature: string;
parameters: string[];
returnType?: string;
isAsync: boolean;
isMethod: boolean;
className?: string;
accessibility?: 'public' | 'private' | 'protected';
relevanceScore: number;
}
export interface ClassMatch {
name: string;
filePath: string;
startLine: number;
endLine: number;
extendsClass?: string;
implements: string[];
methods: string[];
properties: string[];
isAbstract: boolean;
isInterface: boolean;
relevanceScore: number;
}
export interface PatternMatch {
pattern: string;
filePath: string;
startLine: number;
endLine: number;
similarity: number;
context: string[];
matchType: 'exact' | 'structural' | 'semantic';
}
export interface CodeTraversalOptions {
includeExtensions: string[];
excludePatterns: string[];
maxDepth: number;
followSymlinks: boolean;
ignoreCase: boolean;
}
export interface PatternSearchOptions {
maxResults: number;
minSimilarity: number;
includeComments: boolean;
normalizeWhitespace: boolean;
caseSensitive: boolean;
}
/**
* Modern code analyzer using Tree-sitter for accurate AST parsing
*/
export declare class TreeSitterCodeAnalyzer {
private rootPath;
private parsers;
private readonly defaultExtensions;
private readonly defaultExcludePatterns;
constructor(rootPath?: string);
private initializeParsers;
/**
* Find function definitions across the codebase
*/
findFunctionDefinitions(functionName?: string, options?: CodeTraversalOptions): Promise<FunctionMatch[]>;
/**
* Find class definitions across the codebase
*/
findClassDefinitions(className?: string, options?: CodeTraversalOptions): Promise<ClassMatch[]>;
/**
* Find similar code patterns using structural similarity
*/
findSimilarPatterns(targetPattern: string, options?: PatternSearchOptions): Promise<PatternMatch[]>;
/**
* Extract function definitions from a file using AST parsing
*/
private extractFunctionDefinitions;
/**
* Extract class definitions from a file using AST parsing
*/
private extractClassDefinitions;
/**
* Traverse AST nodes with a callback
*/
private traverseAST;
/**
* Check if a node represents a function
*/
private isFunctionNode;
/**
* Check if a node represents a class
*/
private isClassNode;
/**
* Extract function data from AST node
*/
private extractFunctionData;
/**
* Extract class data from AST node
*/
private extractClassData;
/**
* Parse pattern structure for similarity matching
*/
private parsePatternStructure;
/**
* Extract structural features from AST for similarity comparison
*/
private extractStructuralFeatures;
/**
* Find structural matches in a file
*/
private findStructuralMatches;
/**
* Calculate structural similarity between two AST nodes
*/
private calculateStructuralSimilarity;
/**
* Compare child types between two nodes
*/
private compareChildTypes;
/**
* Compare complexity between two nodes
*/
private compareComplexity;
/**
* Get the depth of an AST node
*/
private getNodeDepth;
/**
* Extract context around a node
*/
private extractContext;
/**
* Determine match type based on similarity score
*/
private determineMatchType;
/**
* Find child node by type
*/
private findChildByType;
/**
* Get text content of a node
*/
private getNodeText;
/**
* Calculate function relevance score
*/
private calculateFunctionRelevance;
/**
* Calculate class relevance score
*/
private calculateClassRelevance;
/**
* Traverse the codebase and collect relevant files
*/
private traverseCodebase;
private shouldExclude;
private getDefaultTraversalOptions;
private getDefaultPatternSearchOptions;
}
//# sourceMappingURL=treesitter-code-analyzer.d.ts.map