context-engine-mcp
Version:
Context engine MCP server for comprehensive project analysis and multi-file editing
87 lines • 2.4 kB
TypeScript
import type { FileInfo } from '../types/index.js';
export declare class FileManager {
private static instance;
private readonly maxFileSize;
private readonly supportedExtensions;
private constructor();
static getInstance(): FileManager;
/**
* Safely read a file with validation and caching
*/
readFile(filePath: string, useCache?: boolean): Promise<string>;
/**
* Safely write a file with backup creation
*/
writeFile(filePath: string, content: string, options?: {
createBackup?: boolean;
ensureDirectory?: boolean;
encoding?: BufferEncoding;
}): Promise<void>;
/**
* Safely delete a file with backup creation
*/
deleteFile(filePath: string, createBackup?: boolean): Promise<void>;
/**
* Get file information with caching
*/
getFileInfo(filePath: string): Promise<FileInfo | null>;
/**
* Find files matching patterns with exclusions
*/
findFiles(searchPath: string, patterns?: string[], ignorePatterns?: string[]): Promise<string[]>;
/**
* Check if a file exists
*/
fileExists(filePath: string): Promise<boolean>;
/**
* Create a backup of a file
*/
private createBackup;
/**
* Ensure directory exists
*/
private ensureDirectory;
/**
* Generate MD5 hash of file content
*/
private generateFileHash;
/**
* Detect programming language from file extension
*/
private detectLanguage;
/**
* Validate that a path is within project boundaries
*/
validateProjectBoundaries(filePath: string, projectRoot: string): boolean;
/**
* Get disk usage statistics for a directory
*/
getDiskUsage(dirPath: string): Promise<{
totalFiles: number;
totalSize: number;
largestFile: {
path: string;
size: number;
} | null;
filesByExtension: Record<string, {
count: number;
size: number;
}>;
}>;
/**
* Clear all caches
*/
clearCache(): void;
/**
* Get cache statistics
*/
getCacheStats(): {
size: number;
maxSize: number;
oldestEntry?: string;
newestEntry?: string;
memoryUsage: string;
};
}
export declare const fileManager: FileManager;
//# sourceMappingURL=file-manager.d.ts.map