vibe-tools
Version:
CLI tools for AI agents
58 lines (57 loc) • 2.48 kB
TypeScript
/**
* Manages isolated test environments for each test scenario.
* Handles temporary directory creation, asset copying, and cleanup.
*/
export declare class TestEnvironmentManager {
/**
* Creates a unique temporary directory for a test scenario.
* @param scenarioId The ID of the test scenario
* @returns The path to the created temporary directory
* @throws Error if directory creation fails
*/
static createTempDirectory(scenarioId: string): Promise<string>;
/**
* Extracts asset references from a scenario task description.
* Supports both inline content references [[asset:name]] and path references {{path:name}}.
* @param taskDescription The task description containing asset references
* @returns Array of asset references with their type (inline or path)
*/
static extractAssetReferences(taskDescription: string): Array<{
type: 'inline' | 'path';
name: string;
originalRef: string;
}>;
/**
* Extracts environment variable overrides from task description.
* Supports [[env:unset:VARIABLE_NAME]] to unset variables and
* [[env:set:VARIABLE_NAME=value]] to set variables.
*
* @param taskDescription The task description text
* @returns Record of environment variable overrides
*/
static extractEnvOverrides(taskDescription: string): Record<string, string | undefined>;
/**
* Resolves the actual file path for an asset based on the scenario ID.
* @param assetRef The asset reference object
* @param scenarioId The ID of the test scenario
* @param testDir The base directory for test files (optional)
* @returns The absolute path to the asset file
*/
static resolveAssetPath(assetRef: {
name: string;
type: 'inline' | 'path';
}, scenarioId: string, testDir?: string): string;
/**
* Copies all assets referenced in a scenario to the temporary directory.
* @param scenario The test scenario
* @param tempDir The temporary directory to copy assets to
* @param debug Whether to enable debug mode
* @returns Modified task description with updated asset references
*/
static copyAssets(scenario: any, tempDir: string, debug?: boolean): Promise<string>;
/**
* Cleans up the temporary directory after test execution.
* @param tempDir The temporary directory to clean up
*/
static cleanup(tempDir: string): Promise<void>;
}