structure-validation
Version:
A Node.js CLI tool for validating codebase folder and file structure using a clean declarative configuration. Part of the guardz ecosystem for comprehensive TypeScript development.
67 lines • 2.43 kB
TypeScript
import { MovedFile } from './ImportUpdateService';
/**
* Represents the result of a file operation
*/
export interface FileOperationResult {
success: boolean;
message: string;
oldPath?: string;
newPath?: string;
movedFile?: MovedFile;
}
/**
* Application service for handling file operations with automatic import updates
*/
export declare class FileOperationService {
private readonly importUpdateService;
private readonly fileDiscoveryService;
constructor();
/**
* Move a file to a new location and update all imports
* @param sourcePath The source file path
* @param targetPath The target file path
* @param createDirectory Whether to create the target directory if it doesn't exist
* @returns Promise<FileOperationResult>
*/
moveFile(sourcePath: string, targetPath: string, createDirectory?: boolean): Promise<FileOperationResult>;
/**
* Clear file discovery cache to ensure fresh file discovery after operations
*/
private clearFileDiscoveryCache;
/**
* Rename a file and update all imports
* @param filePath The current file path
* @param newFileName The new file name (with extension)
* @returns Promise<FileOperationResult>
*/
renameFile(filePath: string, newFileName: string): Promise<FileOperationResult>;
/**
* Delete a file and update all imports (remove references to the deleted file)
* @param filePath The file path to delete
* @returns Promise<FileOperationResult>
*/
deleteFile(filePath: string): Promise<FileOperationResult>;
/**
* Update imports after a file has been moved
* @param oldPath The old file path
* @param newPath The new file path
* @returns Promise<{ updated: string[]; errors: string[] }>
*/
private updateImportsAfterMove;
/**
* Remove imports for a deleted file
* @param deletedFilePath The path of the deleted file
* @returns Promise<{ updated: string[]; errors: string[] }>
*/
private removeImportsForDeletedFile;
/**
* Batch move multiple files and update all imports
* @param moves Array of { sourcePath, targetPath } objects
* @returns Promise<FileOperationResult[]>
*/
batchMoveFiles(moves: Array<{
sourcePath: string;
targetPath: string;
}>): Promise<FileOperationResult[]>;
}
//# sourceMappingURL=FileOperationService.d.ts.map