import { IFileOperationsService } from '../services/FileOperationsService.js'; export interface CopyOptions { onProgress?: (copied: number, total: number, currentFile: string) => void; excludePatterns?: string[]; maxRetries?: number; } export interface FileStats { totalFiles: number; totalSize: number; } /** * Cross-platform file operations utility * Centralizes common file operations with progress reporting and error handling */ export declare class FileOperations { /** * Recursively copy a directory with progress reporting * Works cross-platform without relying on shell commands */ static copyDirectory(src: string, dest: string, options?: CopyOptions): Promise; /** * Calculate directory statistics for progress reporting */ private static calculateDirectoryStats; /** * Internal recursive copy implementation */ private static copyDirectoryRecursive; /** * Copy a single file with retry logic */ private static copyFileWithRetry; /** * Check if a file/directory should be excluded * * FIX: ReDoS vulnerability - replaced unsafe glob-to-regex conversion * Previously: Used pattern.replace with .* which could cause catastrophic backtracking * Now: Uses safe glob matching with proper escaping and bounded patterns * SonarCloud: Resolves DOS vulnerability hotspot */ private static shouldExclude; /** * Remove a directory with progress reporting */ static removeDirectory(dir: string, options?: { onProgress?: (removed: number, total: number) => void; }): Promise; /** * Internal recursive remove implementation */ private static removeDirectoryRecursive; /** * Create a transaction manager for atomic file operations */ static createTransaction(): FileTransaction; } /** * Transaction manager for atomic file operations * Ensures all operations succeed or all are rolled back */ export declare class FileTransaction { private readonly operations; private completed; private readonly fileOps; constructor(fileOperations?: IFileOperationsService); /** * Add a move operation to the transaction */ addMove(source: string, destination: string): Promise; /** * Add a copy operation to the transaction */ addCopy(source: string, destination: string): Promise; /** * Add a delete operation to the transaction */ addDelete(deletePath: string, backupPath?: string): Promise; /** * Commit the transaction (mark as successful) */ commit(): void; /** * Rollback all operations in reverse order */ rollback(): Promise; /** * Check if any operations have been performed */ hasOperations(): boolean; } //# sourceMappingURL=fileOperations.d.ts.map