UNPKG

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.

91 lines 3.43 kB
import { ValidationError, ValidationSuggestion } from '../../domain/types/validation.types'; /** * Dedicated service for moving files to upper folder (option 1) * This service is completely independent with no code reuse from other services */ export declare class MoveToUpperFolderService { private readonly configService; private readonly importUpdateService; private readonly fileDiscoveryService; constructor(); /** * Execute the move to upper folder action * @param filePath The path of the file to move * @param fileName The name of the file * @param fileExt The file extension * @param error Optional validation error * @param suggestion Optional validation suggestion * @returns Promise<void> */ executeMoveToUpperFolder(filePath: string, fileName: string, fileExt: string, error?: ValidationError, suggestion?: ValidationSuggestion): Promise<void>; /** * Determine the target folder by analyzing the file and configuration * @param filePath The path of the file to analyze * @returns Promise<string | null> The suggested folder name */ private determineTargetFolder; /** * Check if a folder pattern is a special pattern that should be skipped * @param folderName The folder name to check * @returns boolean True if it's a special pattern */ private isSpecialPattern; /** * Check if filename matches any of the given patterns * @param fileName The file name to check * @param patterns The patterns to match against * @returns boolean True if the file matches any pattern */ private fileMatchesPatterns; /** * Check if filename matches a specific pattern * @param fileName The file name to check * @param pattern The pattern to match against * @returns boolean True if the file matches the pattern */ private fileMatchesPattern; /** * Convert glob pattern to regex for matching * @param pattern The glob pattern to convert * @returns RegExp The converted regex pattern */ private convertGlobToRegex; /** * Clean and validate folder name for file system compatibility * @param folderName The folder name to clean * @returns string | null The cleaned folder name or null if invalid */ private cleanFolderName; /** * Perform the actual file move operation * @param sourcePath The source file path * @param targetPath The target file path * @param fileName The file name for display * @param folderName The folder name for display * @returns Promise<void> */ private performFileMove; /** * Clear file discovery cache to ensure fresh file discovery after operations */ private clearFileDiscoveryCache; /** * 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; /** * 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; } //# sourceMappingURL=MoveToUpperFolderService.d.ts.map