/** * Command Validator - Handles command execution validation and rate limiting * * Validates command prerequisites before execution, including: * - Rate limiting checks * - File path argument validation */ import { ExecutionError } from '../utils/error-handler.js'; export interface FileValidationResult { error?: ExecutionError; invalidFiles: Array<{ flag: string; path: string; reason: string; }>; isValid: boolean; } export interface ValidationResult { error?: ExecutionError; isValid: boolean; } export declare class CommandValidator { /** * Validate command execution prerequisites */ validateCommand(commandName: string): ValidationResult; /** * Check rate limiting for command execution */ private checkRateLimit; /** * Validate file path arguments (e.g., --specs-file, --prd-file) * * Checks that any flag ending with '-file' or 'File' points to an existing file. * This prevents wasted API calls when input files do not exist. * * @param commandName - The name of the command being executed * @param flags - Parsed flags from Commander * @param args - Additional args that may contain unparsed flags (e.g., --specs-file=path) */ validateFileArguments(commandName: string, flags: Record, args?: string[]): FileValidationResult; /** * Extract file-related flags from parsed Commander options */ private extractFileFlagsFromOptions; /** * Validate a single file path exists and is a file * * @returns Error message if invalid, undefined if valid */ private validateSingleFilePath; /** * Format file validation error message for display */ private formatFileValidationError; /** * Extract file-related flags from command args array * * Parses args for patterns like: * - --specs-file=path * - --specs-file path * - --prd-file=path */ private extractFileFlagsFromArgs; /** * Check if an argument is a file-related flag */ private isFileFlagArg; /** * Parse --flag=value format */ private parseEqualsFormat; /** * Parse --flag value format */ private parseSpaceFormat; } //# sourceMappingURL=command-validator.d.ts.map