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.
101 lines • 2.8 kB
TypeScript
import { ValidationError, ValidationSuggestion } from '../../domain/types/validation.types';
/**
* Application service for interactive file fixing
*/
export declare class InteractiveFixService {
private readonly rl;
private readonly configService;
private readonly moveToUpperFolderService;
private readonly addFilePatternToConfigService;
private readonly importUpdateService;
private readonly fileDiscoveryService;
constructor();
/**
* Handle interactive mode for fixing validation errors
*/
handleInteractiveMode(errors: readonly ValidationError[], suggestions: readonly ValidationSuggestion[]): Promise<void>;
/**
* Get user action for a file
*/
private getUserAction;
/**
* Get suggested subfolder name based on file characteristics and config
*/
private getSuggestedSubfolder;
/**
* Check if filename matches any of the given patterns
*/
private matchesPatterns;
/**
* Check if filename matches a specific pattern (glob to regex)
*/
private matchesPattern;
/**
* Convert glob pattern to regex
*/
private globToRegex;
/**
* Execute the chosen action
* @returns true if configuration was updated and validation should restart
*/
private executeAction;
/**
* Move file to a subfolder
*/
private moveToSubfolder;
/**
* Rename file
*/
private renameFile;
/**
* Get suggested rename options based on current folder and config patterns
*/
private getSuggestedRenameOptions;
/**
* Generate a name suggestion based on a pattern
*/
private generateNameFromPattern;
/**
* Delete file
*/
private deleteFile;
/**
* Add file to structure-validation.config.json
*/
private addFileToConfig;
/**
* Skip file
*/
private skipFile;
/**
* Sanitize folder name
*/
private sanitizeFolderName;
/**
* Sanitize file name
*/
private sanitizeFileName;
/**
* Check if file is at root level (configured root directory)
* @param filePath The absolute path of the file
* @returns boolean True if the file is at root level
*/
private isFileAtRootLevel;
/**
* Get the project root directory
* @returns string The project root path
*/
private getProjectRoot;
/**
* Update imports after a file has been moved
* @param oldPath The old file path
* @param newPath The new file path
* @returns Promise<void>
*/
private updateImportsAfterMove;
/**
* Clear file discovery cache to ensure fresh file discovery after operations
*/
private clearFileDiscoveryCache;
}
//# sourceMappingURL=InteractiveFixService.d.ts.map