import { ToolResult, SearchOptions } from '../types.js'; import { WorkspaceService } from './WorkspaceService.js'; export interface FileReadOptions { encoding?: BufferEncoding; maxSize?: number; } export interface FileWriteOptions { encoding?: BufferEncoding; backup?: boolean; createBackup?: boolean; skipAutoFormat?: boolean; skipAutoCommit?: boolean; commitMessage?: string; formatCommand?: string; } export interface DirectoryListOptions { recursive?: boolean; includeHidden?: boolean; filter?: string; pattern?: string; detailed?: boolean; sortBy?: 'name' | 'size' | 'modified'; sortOrder?: 'asc' | 'desc'; } export interface FileCopyOptions { overwrite?: boolean; preserveTimestamps?: boolean; } export interface DiffOptions { format?: 'unified' | 'side-by-side' | 'inline' | 'context'; contextLines?: number; ignoreWhitespace?: boolean; ignoreCase?: boolean; wordDiff?: boolean; colorOutput?: boolean; } export interface FileDiffOptions extends DiffOptions { file1: string; file2: string; label1?: string; label2?: string; } export interface PatchOptions { dryRun?: boolean; reverse?: boolean; stripPaths?: number; backup?: boolean; } export interface FileComparisonResult { identical: boolean; differences: Array<{ line: number; type: 'added' | 'removed' | 'modified'; content: string; oldContent?: string; }>; stats: { linesAdded: number; linesRemoved: number; linesModified: number; }; } export declare class FileService { workspaceService: WorkspaceService; private statsCache; private cacheTimeout; constructor(workspaceService: WorkspaceService); /** * Read the contents of a file with enhanced options */ readFile(filePath: string, options?: FileReadOptions): Promise; /** * Write content to a file with enhanced options */ writeFile(filePath: string, content: string, options?: FileWriteOptions): Promise; /** * List contents of a directory with enhanced options */ listDirectory(dirPath: string, options?: DirectoryListOptions): Promise; /** * Create a new directory */ createDirectory(dirPath: string): Promise; /** * Delete a file or directory */ deleteFile(filePath: string, options?: { force?: boolean; }): Promise; /** * Delete a directory */ deleteDirectory(dirPath: string, options?: { recursive?: boolean; }): Promise; /** * Move or rename a file or directory */ moveFile(sourcePath: string, destinationPath: string, options?: { overwrite?: boolean; }): Promise; /** * Copy a file or directory */ copyFile(sourcePath: string, destinationPath: string, options?: FileCopyOptions): Promise; /** * Get file or directory information */ getFileInfo(filePath: string): Promise; /** * Check if file exists */ fileExists(filePath: string): Promise; /** * Search for files by pattern or content */ searchFiles(query: string, directory?: string, options?: SearchOptions): Promise; /** * Get file stats with caching */ private getFileStats; /** * Clear stats cache for a specific file */ private clearStatsCache; /** * Recursively list directory contents */ private _listDirectoryRecursive; /** * Sort file list by specified criteria */ private _sortFileList; /** * Copy directory recursively */ private _copyDirectory; /** * Format a file using the provided format command */ formatFile(filePath: string, formatCommand?: string): Promise; /** * Create a new file with optional formatting and auto-commit */ createFile(filePath: string, content: string, options?: FileWriteOptions): Promise; /** * Format the entire project using common formatting tools */ formatProject(): Promise; /** * Compare two files and show differences */ compareFiles(options: FileDiffOptions): Promise; /** * Generate a detailed file comparison with statistics */ analyzeFileDifferences(file1: string, file2: string): Promise; /** * Apply a patch file to the workspace */ applyPatch(patchFile: string, options?: PatchOptions): Promise; /** * Create a patch file from differences between two files or directories */ createPatch(source: string, target: string, outputFile?: string): Promise; /** * Find and replace text across multiple files with preview option */ findAndReplace(searchPattern: string, replacement: string, options?: { files?: string[]; filePattern?: string; regex?: boolean; caseSensitive?: boolean; wholeWord?: boolean; preview?: boolean; backup?: boolean; }): Promise; /** * Helper method to find files matching a simple pattern */ private _findMatchingFiles; /** * Simple pattern matching helper */ private _matchesPattern; } //# sourceMappingURL=FileService.d.ts.map