vibe-tools
Version:
CLI tools for AI agents
124 lines (123 loc) • 3.23 kB
TypeScript
import type { CommandOptions, Provider } from '../../types';
import type { ToolExecutionResult } from '../../utils/tool-enabled-llm/unified-client';
import { AssetReference } from '../../utils/assets';
import { z } from 'zod';
/**
* A specialized AsyncGenerator for test commands that can return TestReport
*/
export type TestCommandGenerator<T = any> = AsyncGenerator<string, T, unknown>;
/**
* Extended command options for the test command
*/
export interface TestOptions extends CommandOptions {
output?: string;
parallel?: number;
branch?: string;
compareWith?: string;
timeout?: number;
retries?: number;
tag?: string;
mcpServers?: string[];
scenarios?: string;
provider?: Provider;
/**
* Maximum number of files to process concurrently.
* @defaultValue 3
*/
fileConcurrency?: number;
/**
* Skip intermediate output during test execution.
* @defaultValue false
*/
skipIntermediateOutput?: boolean;
}
/**
* Represents a test scenario in a feature behavior file
*/
export interface TestScenario {
id: string;
type: string;
description: string;
taskDescription: string;
expectedBehavior: string[];
successCriteria: string[];
tags?: string[];
assets?: Record<string, AssetReference>;
}
/**
* Represents the parsed content of a feature behavior file
*/
export interface FeatureBehavior {
name: string;
description: string;
scenarios: TestScenario[];
}
/**
* Represents the result of executing a test scenario
*/
export interface TestScenarioResult {
id: string;
type: string;
description: string;
taskDescription: string;
approachTaken: string;
commands: string[];
actualCommands?: string[];
output: string;
outputBuffer?: string[];
toolExecutions?: Array<{
tool: string;
args: any;
result: ToolExecutionResult;
}>;
expectedBehavior: {
behavior: string;
met: boolean;
explanation?: string;
}[];
successCriteria: {
criteria: string;
met: boolean;
explanation?: string;
}[];
result: 'PASS' | 'FAIL';
executionTime: number;
attempts?: number;
explanation?: string;
error?: string;
}
/**
* Represents a complete test report for a feature behavior file
*/
export interface TestReport {
featureName: string;
description: string;
scenarios: TestScenarioResult[];
timestamp: string;
branch: string;
provider: string;
model: string;
os: string;
nodeVersion: string;
overallResult: 'PASS' | 'FAIL';
failedScenarios: string[];
passedScenarios?: number;
totalExecutionTime: number;
}
/**
* Exponential backoff retry configuration
*/
export interface RetryConfig {
initialDelay: number;
maxDelay: number;
factor: number;
retries: number;
jitter: boolean;
}
export declare const TestResultSchema: z.ZodObject<{
id: z.ZodString;
status: z.ZodPipe<z.ZodString, z.ZodTransform<"PASS" | "FAIL", string>>;
summary: z.ZodString;
error: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
}, z.core.$strip>;
export type TestResult = z.infer<typeof TestResultSchema>;