/** * FABER CLI - Input Validation Utilities * * Common validation functions for CLI inputs */ /** * Parse and validate an integer string * @param value - String value to parse * @param fieldName - Field name for error messages * @returns Validated integer * @throws Error if value is not a valid integer */ export declare function parseValidInteger(value: string, fieldName: string): number; /** * Parse and validate an optional integer string * @param value - String value to parse (may be undefined) * @param fieldName - Field name for error messages * @returns Validated integer or undefined * @throws Error if value is provided but not a valid integer */ export declare function parseOptionalInteger(value: string | undefined, fieldName: string): number | undefined; /** * Parse and validate a positive integer string * @param value - String value to parse * @param fieldName - Field name for error messages * @returns Validated positive integer * @throws Error if value is not a valid positive integer */ export declare function parsePositiveInteger(value: string, fieldName: string): number; /** * Validates work ID format * Work IDs must be numeric (GitHub issue numbers) * * @param workId - Work ID to validate * @returns True if valid * @throws Error if invalid */ export declare function validateWorkId(workId: string): boolean; /** * Validates multiple comma-separated work IDs * * @param workIds - Comma-separated work IDs * @returns Array of validated work IDs * @throws Error if any ID is invalid */ export declare function validateWorkIds(workIds: string): string[]; /** * Validates label format * Labels must be alphanumeric with hyphens, colons, and underscores only * * @param label - Label to validate * @returns True if valid * @throws Error if invalid */ export declare function validateLabel(label: string): boolean; /** * Validates multiple comma-separated labels * * @param labels - Comma-separated labels * @returns Array of validated labels * @throws Error if any label is invalid */ export declare function validateLabels(labels: string): string[]; /** * Validates workflow name format * Workflow names must be alphanumeric with hyphens and underscores * * @param workflowName - Workflow name to validate * @returns True if valid * @throws Error if invalid */ export declare function validateWorkflowName(workflowName: string): boolean; /** * Validates and sanitizes file path to prevent path traversal * Ensures path doesn't contain dangerous patterns like ../, absolute paths, etc. * * @param filePath - File path to validate * @param baseDir - Base directory that path must be relative to (optional) * @returns Sanitized path * @throws Error if path is unsafe */ export declare function validateSafePath(filePath: string, baseDir?: string): string; /** * Validates JSON response size to prevent DoS attacks * * @param jsonString - JSON string to validate * @param maxSizeBytes - Maximum allowed size in bytes (default: 1MB) * @returns True if valid * @throws Error if too large */ export declare function validateJsonSize(jsonString: string, maxSizeBytes?: number): boolean; /** * Slugify a string for use in identifiers (plan IDs, paths, etc.) * Converts to lowercase, replaces non-alphanumeric with hyphens, trims hyphens. * * @param input - String to slugify * @returns Slugified string (max 50 chars) */ export declare function slugify(input: string): string; /** * Validates plan ID format * Plan IDs follow format: {org}-{project}-{work-id} * Also accepts legacy format with timestamp: {org}-{project}-{work-id}-{YYYYMMDD}-{HHMMSS} * * @param planId - Plan ID to validate * @returns True if valid * @throws Error if invalid */ export declare function validatePlanId(planId: string): boolean; //# sourceMappingURL=validation.d.ts.map