@husniadil/codebase-analyzer
Version:
A compr ehensive tool for analyzing and summarizing codebases, supporting multiple file types and providing detailed file tree views and context extraction.
62 lines (58 loc) • 1.62 kB
text/typescript
type Config = {
directory?: string;
relevantExtensions?: string[];
maxFileSize?: number;
enableTokenCounting?: boolean;
maxTokens?: number;
ignorePatterns?: string[];
ignoreFilesWithNoExtension?: boolean;
memoryLimitMB?: number;
};
type Output = {
context: string;
tokenCount: number;
treeView: string;
files: {
totalSize: number;
totalCount: number;
processedCount: number;
};
};
type FileNode = {
name: string;
path: string;
size: number;
isDirectory: boolean;
children: FileNode[];
};
interface ICodebaseAnalyzer {
analyze(): Promise<Output>;
}
declare class CodebaseAnalyzer implements ICodebaseAnalyzer {
private readonly directory;
private readonly relevantExtensions;
private readonly maxFileSize;
private readonly enableTokenCounting;
private readonly maxTokens;
private readonly ignorePatterns;
private readonly ignoreFilesWithNoExtension;
private readonly memoryLimitMB;
private processedFiles;
private totalFiles;
private totalSize;
constructor(config?: Config);
private shouldIgnore;
private hasExtension;
private isRelevantFile;
private gatherFiles;
private countTotalFiles;
private checkMemoryUsage;
private processFileTree;
private gatherContext;
private truncateContext;
private countTokens;
private buildTreeView;
analyze(): Promise<Output>;
}
declare const formatSize: (bytes: number) => string;
export { CodebaseAnalyzer, type Config, type FileNode, type ICodebaseAnalyzer, type Output, formatSize };