UNPKG

@necto-ai/pgit

Version:

Private file tracking with dual git repositories

152 lines 4.39 kB
import { z } from 'zod'; /** * Path validation result */ export interface PathValidationResult { isValid: boolean; normalizedPath: string; issues: string[]; securityRisk: boolean; } /** * Command validation options */ export interface ValidationOptions { allowAbsolutePaths?: boolean; allowParentDirectory?: boolean; maxPathLength?: number; requiredExtensions?: string[]; blockedPatterns?: RegExp[]; requireFileExists?: boolean; } /** * Input validation service for security and data integrity */ export declare class InputValidator { private static readonly DANGEROUS_PATTERNS; private static readonly BLOCKED_DIRECTORIES; private static readonly MAX_PATH_LENGTH; /** * Validate file path for security and correctness */ static validatePath(inputPath: string, options?: ValidationOptions): PathValidationResult; /** * Validate commit message */ static validateCommitMessage(message: string): void; /** * Validate branch name */ static validateBranchName(branchName: string): void; /** * Validate numeric arguments */ static validateNumber(value: string, field: string, min?: number, max?: number): number; /** * Validate command options using Zod schema */ static validateOptions<T>(options: unknown, schema: z.ZodSchema<T>, command: string): T; /** * Sanitize string input for safe processing */ static sanitizeString(input: string, maxLength?: number): string; /** * Validate environment and prerequisites */ static validateEnvironment(): void; /** * Validate working directory safety */ static validateWorkingDirectory(workingDir: string): void; /** * Create safe file path within working directory */ static createSafePath(workingDir: string, relativePath: string): string; } /** * Zod schemas for common validation patterns */ export declare const ValidationSchemas: { /** * Basic command options */ basicOptions: z.ZodObject<{ verbose: z.ZodOptional<z.ZodBoolean>; }, "strip", z.ZodTypeAny, { verbose?: boolean | undefined; }, { verbose?: boolean | undefined; }>; /** * Log command options */ logOptions: z.ZodObject<{ verbose: z.ZodOptional<z.ZodBoolean>; maxCount: z.ZodOptional<z.ZodNumber>; oneline: z.ZodOptional<z.ZodBoolean>; }, "strip", z.ZodTypeAny, { verbose?: boolean | undefined; maxCount?: number | undefined; oneline?: boolean | undefined; }, { verbose?: boolean | undefined; maxCount?: number | undefined; oneline?: boolean | undefined; }>; /** * Diff command options */ diffOptions: z.ZodObject<{ verbose: z.ZodOptional<z.ZodBoolean>; cached: z.ZodOptional<z.ZodBoolean>; nameOnly: z.ZodOptional<z.ZodBoolean>; }, "strip", z.ZodTypeAny, { verbose?: boolean | undefined; cached?: boolean | undefined; nameOnly?: boolean | undefined; }, { verbose?: boolean | undefined; cached?: boolean | undefined; nameOnly?: boolean | undefined; }>; /** * Branch command options */ branchOptions: z.ZodObject<{ verbose: z.ZodOptional<z.ZodBoolean>; create: z.ZodOptional<z.ZodBoolean>; }, "strip", z.ZodTypeAny, { verbose?: boolean | undefined; create?: boolean | undefined; }, { verbose?: boolean | undefined; create?: boolean | undefined; }>; /** * Commit options */ commitOptions: z.ZodObject<{ verbose: z.ZodOptional<z.ZodBoolean>; message: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { message?: string | undefined; verbose?: boolean | undefined; }, { message?: string | undefined; verbose?: boolean | undefined; }>; /** * Cleanup options */ cleanupOptions: z.ZodObject<{ verbose: z.ZodOptional<z.ZodBoolean>; force: z.ZodOptional<z.ZodBoolean>; }, "strip", z.ZodTypeAny, { verbose?: boolean | undefined; force?: boolean | undefined; }, { verbose?: boolean | undefined; force?: boolean | undefined; }>; }; //# sourceMappingURL=input.validator.d.ts.map