/** * Zod Schema for Run Command Results * * This schema defines the structure of `vibe-validate run` output and enables * runtime validation and JSON Schema generation for documentation. * * @packageDocumentation */ import { z } from 'zod'; /** * Run Result Schema * * Extends OperationMetadataSchema + CommandExecutionSchema with run-specific fields. * * Output structure from `vibe-validate run` command execution. * This is the YAML written to stdout and cached in git notes. * * Field ordering is optimized for LLM consumption: * - Command execution (command, exitCode, durationSecs, extraction) * - Operation metadata (timestamp, treeHash) * - Run-specific (outputFiles, isCachedResult, suggestedDirectCommand) * * v0.15.0 BREAKING CHANGES: * - Now extends CommandExecutionSchema (consistent with StepResult) * - Added durationSecs field * - Added outputFiles with organized temp structure (stdout.log, stderr.log, combined.jsonl) * - REMOVED fullOutputFile (use outputFiles.combined instead) * - REMOVED suggestedDirectCommand (command now contains unwrapped command) */ export declare const RunResultSchema: z.ZodObject<{ timestamp: z.ZodString; treeHash: z.ZodOptional; } & { command: z.ZodString; exitCode: z.ZodNumber; durationSecs: z.ZodNumber; extraction: z.ZodOptional; line: z.ZodOptional; column: z.ZodOptional; message: z.ZodString; code: z.ZodOptional; severity: z.ZodOptional>; context: z.ZodOptional; guidance: z.ZodOptional; }, "strip", z.ZodTypeAny, { message: string; file?: string | undefined; line?: number | undefined; column?: number | undefined; code?: string | undefined; severity?: "error" | "warning" | undefined; context?: string | undefined; guidance?: string | undefined; }, { message: string; file?: string | undefined; line?: number | undefined; column?: number | undefined; code?: string | undefined; severity?: "error" | "warning" | undefined; context?: string | undefined; guidance?: string | undefined; }>, "many">; guidance: z.ZodOptional; errorSummary: z.ZodOptional; metadata: z.ZodOptional; reason: z.ZodString; }, "strip", z.ZodTypeAny, { extractor: string; confidence: number; patterns: string[]; reason: string; }, { extractor: string; confidence: number; patterns: string[]; reason: string; }>>; confidence: z.ZodNumber; completeness: z.ZodNumber; issues: z.ZodArray; suggestions: z.ZodOptional>; }, "strip", z.ZodTypeAny, { issues: string[]; confidence: number; completeness: number; detection?: { extractor: string; confidence: number; patterns: string[]; reason: string; } | undefined; suggestions?: string[] | undefined; }, { issues: string[]; confidence: number; completeness: number; detection?: { extractor: string; confidence: number; patterns: string[]; reason: string; } | undefined; suggestions?: string[] | undefined; }>>; }, "strip", z.ZodTypeAny, { summary: string; totalErrors: number; errors: { message: string; file?: string | undefined; line?: number | undefined; column?: number | undefined; code?: string | undefined; severity?: "error" | "warning" | undefined; context?: string | undefined; guidance?: string | undefined; }[]; guidance?: string | undefined; errorSummary?: string | undefined; metadata?: { issues: string[]; confidence: number; completeness: number; detection?: { extractor: string; confidence: number; patterns: string[]; reason: string; } | undefined; suggestions?: string[] | undefined; } | undefined; }, { summary: string; totalErrors: number; errors: { message: string; file?: string | undefined; line?: number | undefined; column?: number | undefined; code?: string | undefined; severity?: "error" | "warning" | undefined; context?: string | undefined; guidance?: string | undefined; }[]; guidance?: string | undefined; errorSummary?: string | undefined; metadata?: { issues: string[]; confidence: number; completeness: number; detection?: { extractor: string; confidence: number; patterns: string[]; reason: string; } | undefined; suggestions?: string[] | undefined; } | undefined; }>>; } & { /** Organized output files (v0.15.0+) */ outputFiles: z.ZodOptional; stderr: z.ZodOptional; combined: z.ZodString; }, "strip", z.ZodTypeAny, { combined: string; stdout?: string | undefined; stderr?: string | undefined; }, { combined: string; stdout?: string | undefined; stderr?: string | undefined; }>>; /** Whether this result is from cache (true) or fresh execution (false/omitted) */ isCachedResult: z.ZodOptional; /** * The original command requested by the user (v0.17.3+) * * Only present when the actual executed command differs from what was requested. * This happens when nested vibe-validate commands are detected and unwrapped. * * Example: User runs `vv run "vv run 'echo test'"`, which executes `echo test`. * - command: "echo test" (what actually executed) * - requestedCommand: "vv run 'echo test'" (what user requested) */ requestedCommand: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ timestamp: z.ZodString; treeHash: z.ZodOptional; } & { command: z.ZodString; exitCode: z.ZodNumber; durationSecs: z.ZodNumber; extraction: z.ZodOptional; line: z.ZodOptional; column: z.ZodOptional; message: z.ZodString; code: z.ZodOptional; severity: z.ZodOptional>; context: z.ZodOptional; guidance: z.ZodOptional; }, "strip", z.ZodTypeAny, { message: string; file?: string | undefined; line?: number | undefined; column?: number | undefined; code?: string | undefined; severity?: "error" | "warning" | undefined; context?: string | undefined; guidance?: string | undefined; }, { message: string; file?: string | undefined; line?: number | undefined; column?: number | undefined; code?: string | undefined; severity?: "error" | "warning" | undefined; context?: string | undefined; guidance?: string | undefined; }>, "many">; guidance: z.ZodOptional; errorSummary: z.ZodOptional; metadata: z.ZodOptional; reason: z.ZodString; }, "strip", z.ZodTypeAny, { extractor: string; confidence: number; patterns: string[]; reason: string; }, { extractor: string; confidence: number; patterns: string[]; reason: string; }>>; confidence: z.ZodNumber; completeness: z.ZodNumber; issues: z.ZodArray; suggestions: z.ZodOptional>; }, "strip", z.ZodTypeAny, { issues: string[]; confidence: number; completeness: number; detection?: { extractor: string; confidence: number; patterns: string[]; reason: string; } | undefined; suggestions?: string[] | undefined; }, { issues: string[]; confidence: number; completeness: number; detection?: { extractor: string; confidence: number; patterns: string[]; reason: string; } | undefined; suggestions?: string[] | undefined; }>>; }, "strip", z.ZodTypeAny, { summary: string; totalErrors: number; errors: { message: string; file?: string | undefined; line?: number | undefined; column?: number | undefined; code?: string | undefined; severity?: "error" | "warning" | undefined; context?: string | undefined; guidance?: string | undefined; }[]; guidance?: string | undefined; errorSummary?: string | undefined; metadata?: { issues: string[]; confidence: number; completeness: number; detection?: { extractor: string; confidence: number; patterns: string[]; reason: string; } | undefined; suggestions?: string[] | undefined; } | undefined; }, { summary: string; totalErrors: number; errors: { message: string; file?: string | undefined; line?: number | undefined; column?: number | undefined; code?: string | undefined; severity?: "error" | "warning" | undefined; context?: string | undefined; guidance?: string | undefined; }[]; guidance?: string | undefined; errorSummary?: string | undefined; metadata?: { issues: string[]; confidence: number; completeness: number; detection?: { extractor: string; confidence: number; patterns: string[]; reason: string; } | undefined; suggestions?: string[] | undefined; } | undefined; }>>; } & { /** Organized output files (v0.15.0+) */ outputFiles: z.ZodOptional; stderr: z.ZodOptional; combined: z.ZodString; }, "strip", z.ZodTypeAny, { combined: string; stdout?: string | undefined; stderr?: string | undefined; }, { combined: string; stdout?: string | undefined; stderr?: string | undefined; }>>; /** Whether this result is from cache (true) or fresh execution (false/omitted) */ isCachedResult: z.ZodOptional; /** * The original command requested by the user (v0.17.3+) * * Only present when the actual executed command differs from what was requested. * This happens when nested vibe-validate commands are detected and unwrapped. * * Example: User runs `vv run "vv run 'echo test'"`, which executes `echo test`. * - command: "echo test" (what actually executed) * - requestedCommand: "vv run 'echo test'" (what user requested) */ requestedCommand: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ timestamp: z.ZodString; treeHash: z.ZodOptional; } & { command: z.ZodString; exitCode: z.ZodNumber; durationSecs: z.ZodNumber; extraction: z.ZodOptional; line: z.ZodOptional; column: z.ZodOptional; message: z.ZodString; code: z.ZodOptional; severity: z.ZodOptional>; context: z.ZodOptional; guidance: z.ZodOptional; }, "strip", z.ZodTypeAny, { message: string; file?: string | undefined; line?: number | undefined; column?: number | undefined; code?: string | undefined; severity?: "error" | "warning" | undefined; context?: string | undefined; guidance?: string | undefined; }, { message: string; file?: string | undefined; line?: number | undefined; column?: number | undefined; code?: string | undefined; severity?: "error" | "warning" | undefined; context?: string | undefined; guidance?: string | undefined; }>, "many">; guidance: z.ZodOptional; errorSummary: z.ZodOptional; metadata: z.ZodOptional; reason: z.ZodString; }, "strip", z.ZodTypeAny, { extractor: string; confidence: number; patterns: string[]; reason: string; }, { extractor: string; confidence: number; patterns: string[]; reason: string; }>>; confidence: z.ZodNumber; completeness: z.ZodNumber; issues: z.ZodArray; suggestions: z.ZodOptional>; }, "strip", z.ZodTypeAny, { issues: string[]; confidence: number; completeness: number; detection?: { extractor: string; confidence: number; patterns: string[]; reason: string; } | undefined; suggestions?: string[] | undefined; }, { issues: string[]; confidence: number; completeness: number; detection?: { extractor: string; confidence: number; patterns: string[]; reason: string; } | undefined; suggestions?: string[] | undefined; }>>; }, "strip", z.ZodTypeAny, { summary: string; totalErrors: number; errors: { message: string; file?: string | undefined; line?: number | undefined; column?: number | undefined; code?: string | undefined; severity?: "error" | "warning" | undefined; context?: string | undefined; guidance?: string | undefined; }[]; guidance?: string | undefined; errorSummary?: string | undefined; metadata?: { issues: string[]; confidence: number; completeness: number; detection?: { extractor: string; confidence: number; patterns: string[]; reason: string; } | undefined; suggestions?: string[] | undefined; } | undefined; }, { summary: string; totalErrors: number; errors: { message: string; file?: string | undefined; line?: number | undefined; column?: number | undefined; code?: string | undefined; severity?: "error" | "warning" | undefined; context?: string | undefined; guidance?: string | undefined; }[]; guidance?: string | undefined; errorSummary?: string | undefined; metadata?: { issues: string[]; confidence: number; completeness: number; detection?: { extractor: string; confidence: number; patterns: string[]; reason: string; } | undefined; suggestions?: string[] | undefined; } | undefined; }>>; } & { /** Organized output files (v0.15.0+) */ outputFiles: z.ZodOptional; stderr: z.ZodOptional; combined: z.ZodString; }, "strip", z.ZodTypeAny, { combined: string; stdout?: string | undefined; stderr?: string | undefined; }, { combined: string; stdout?: string | undefined; stderr?: string | undefined; }>>; /** Whether this result is from cache (true) or fresh execution (false/omitted) */ isCachedResult: z.ZodOptional; /** * The original command requested by the user (v0.17.3+) * * Only present when the actual executed command differs from what was requested. * This happens when nested vibe-validate commands are detected and unwrapped. * * Example: User runs `vv run "vv run 'echo test'"`, which executes `echo test`. * - command: "echo test" (what actually executed) * - requestedCommand: "vv run 'echo test'" (what user requested) */ requestedCommand: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>; /** * Inferred TypeScript types from Zod schemas */ export type { OutputFiles } from '@vibe-validate/core'; export type RunResult = z.infer; /** * Safe validation function for RunResult (uses shared utility) * * @example * ```typescript * const result = safeValidateRunResult(parsedYaml); * if (result.success) { * console.log('Valid run result:', result.data); * } else { * console.error('Invalid data:', result.errors); * } * ``` */ export declare const safeValidateRunResult: (data: unknown) => { success: false; errors: string[]; } | { success: true; data: z.objectOutputType<{ timestamp: z.ZodString; treeHash: z.ZodOptional; } & { command: z.ZodString; exitCode: z.ZodNumber; durationSecs: z.ZodNumber; extraction: z.ZodOptional; line: z.ZodOptional; column: z.ZodOptional; message: z.ZodString; code: z.ZodOptional; severity: z.ZodOptional>; context: z.ZodOptional; guidance: z.ZodOptional; }, "strip", z.ZodTypeAny, { message: string; file?: string | undefined; line?: number | undefined; column?: number | undefined; code?: string | undefined; severity?: "error" | "warning" | undefined; context?: string | undefined; guidance?: string | undefined; }, { message: string; file?: string | undefined; line?: number | undefined; column?: number | undefined; code?: string | undefined; severity?: "error" | "warning" | undefined; context?: string | undefined; guidance?: string | undefined; }>, "many">; guidance: z.ZodOptional; errorSummary: z.ZodOptional; metadata: z.ZodOptional; reason: z.ZodString; }, "strip", z.ZodTypeAny, { extractor: string; confidence: number; patterns: string[]; reason: string; }, { extractor: string; confidence: number; patterns: string[]; reason: string; }>>; confidence: z.ZodNumber; completeness: z.ZodNumber; issues: z.ZodArray; suggestions: z.ZodOptional>; }, "strip", z.ZodTypeAny, { issues: string[]; confidence: number; completeness: number; detection?: { extractor: string; confidence: number; patterns: string[]; reason: string; } | undefined; suggestions?: string[] | undefined; }, { issues: string[]; confidence: number; completeness: number; detection?: { extractor: string; confidence: number; patterns: string[]; reason: string; } | undefined; suggestions?: string[] | undefined; }>>; }, "strip", z.ZodTypeAny, { summary: string; totalErrors: number; errors: { message: string; file?: string | undefined; line?: number | undefined; column?: number | undefined; code?: string | undefined; severity?: "error" | "warning" | undefined; context?: string | undefined; guidance?: string | undefined; }[]; guidance?: string | undefined; errorSummary?: string | undefined; metadata?: { issues: string[]; confidence: number; completeness: number; detection?: { extractor: string; confidence: number; patterns: string[]; reason: string; } | undefined; suggestions?: string[] | undefined; } | undefined; }, { summary: string; totalErrors: number; errors: { message: string; file?: string | undefined; line?: number | undefined; column?: number | undefined; code?: string | undefined; severity?: "error" | "warning" | undefined; context?: string | undefined; guidance?: string | undefined; }[]; guidance?: string | undefined; errorSummary?: string | undefined; metadata?: { issues: string[]; confidence: number; completeness: number; detection?: { extractor: string; confidence: number; patterns: string[]; reason: string; } | undefined; suggestions?: string[] | undefined; } | undefined; }>>; } & { /** Organized output files (v0.15.0+) */ outputFiles: z.ZodOptional; stderr: z.ZodOptional; combined: z.ZodString; }, "strip", z.ZodTypeAny, { combined: string; stdout?: string | undefined; stderr?: string | undefined; }, { combined: string; stdout?: string | undefined; stderr?: string | undefined; }>>; /** Whether this result is from cache (true) or fresh execution (false/omitted) */ isCachedResult: z.ZodOptional; /** * The original command requested by the user (v0.17.3+) * * Only present when the actual executed command differs from what was requested. * This happens when nested vibe-validate commands are detected and unwrapped. * * Example: User runs `vv run "vv run 'echo test'"`, which executes `echo test`. * - command: "echo test" (what actually executed) * - requestedCommand: "vv run 'echo test'" (what user requested) */ requestedCommand: z.ZodOptional; }, z.ZodTypeAny, "passthrough">; }; /** * Strict validation function for RunResult (uses shared utility) * * @example * ```typescript * try { * const result = validateRunResult(parsedYaml); * // Use validated result * } catch (error) { * console.error('Validation failed:', error); * } * ``` */ export declare const validateRunResult: (data: unknown) => z.objectOutputType<{ timestamp: z.ZodString; treeHash: z.ZodOptional; } & { command: z.ZodString; exitCode: z.ZodNumber; durationSecs: z.ZodNumber; extraction: z.ZodOptional; line: z.ZodOptional; column: z.ZodOptional; message: z.ZodString; code: z.ZodOptional; severity: z.ZodOptional>; context: z.ZodOptional; guidance: z.ZodOptional; }, "strip", z.ZodTypeAny, { message: string; file?: string | undefined; line?: number | undefined; column?: number | undefined; code?: string | undefined; severity?: "error" | "warning" | undefined; context?: string | undefined; guidance?: string | undefined; }, { message: string; file?: string | undefined; line?: number | undefined; column?: number | undefined; code?: string | undefined; severity?: "error" | "warning" | undefined; context?: string | undefined; guidance?: string | undefined; }>, "many">; guidance: z.ZodOptional; errorSummary: z.ZodOptional; metadata: z.ZodOptional; reason: z.ZodString; }, "strip", z.ZodTypeAny, { extractor: string; confidence: number; patterns: string[]; reason: string; }, { extractor: string; confidence: number; patterns: string[]; reason: string; }>>; confidence: z.ZodNumber; completeness: z.ZodNumber; issues: z.ZodArray; suggestions: z.ZodOptional>; }, "strip", z.ZodTypeAny, { issues: string[]; confidence: number; completeness: number; detection?: { extractor: string; confidence: number; patterns: string[]; reason: string; } | undefined; suggestions?: string[] | undefined; }, { issues: string[]; confidence: number; completeness: number; detection?: { extractor: string; confidence: number; patterns: string[]; reason: string; } | undefined; suggestions?: string[] | undefined; }>>; }, "strip", z.ZodTypeAny, { summary: string; totalErrors: number; errors: { message: string; file?: string | undefined; line?: number | undefined; column?: number | undefined; code?: string | undefined; severity?: "error" | "warning" | undefined; context?: string | undefined; guidance?: string | undefined; }[]; guidance?: string | undefined; errorSummary?: string | undefined; metadata?: { issues: string[]; confidence: number; completeness: number; detection?: { extractor: string; confidence: number; patterns: string[]; reason: string; } | undefined; suggestions?: string[] | undefined; } | undefined; }, { summary: string; totalErrors: number; errors: { message: string; file?: string | undefined; line?: number | undefined; column?: number | undefined; code?: string | undefined; severity?: "error" | "warning" | undefined; context?: string | undefined; guidance?: string | undefined; }[]; guidance?: string | undefined; errorSummary?: string | undefined; metadata?: { issues: string[]; confidence: number; completeness: number; detection?: { extractor: string; confidence: number; patterns: string[]; reason: string; } | undefined; suggestions?: string[] | undefined; } | undefined; }>>; } & { /** Organized output files (v0.15.0+) */ outputFiles: z.ZodOptional; stderr: z.ZodOptional; combined: z.ZodString; }, "strip", z.ZodTypeAny, { combined: string; stdout?: string | undefined; stderr?: string | undefined; }, { combined: string; stdout?: string | undefined; stderr?: string | undefined; }>>; /** Whether this result is from cache (true) or fresh execution (false/omitted) */ isCachedResult: z.ZodOptional; /** * The original command requested by the user (v0.17.3+) * * Only present when the actual executed command differs from what was requested. * This happens when nested vibe-validate commands are detected and unwrapped. * * Example: User runs `vv run "vv run 'echo test'"`, which executes `echo test`. * - command: "echo test" (what actually executed) * - requestedCommand: "vv run 'echo test'" (what user requested) */ requestedCommand: z.ZodOptional; }, z.ZodTypeAny, "passthrough">; //# sourceMappingURL=run-result-schema.d.ts.map