vibe-tools
Version:
CLI tools for AI agents
66 lines (65 loc) • 2.32 kB
TypeScript
import * as fs from 'fs';
import { RetryConfig } from './types';
export declare const readFile: typeof fs.readFile.__promisify__;
/**
* Get the current git branch
*
* @returns The current branch name or 'unknown-branch' if not in a git repository
*/
export declare function getCurrentBranch(): Promise<string>;
/**
* Create a directory if it doesn't exist
*
* @param dir - Directory path to create
*/
export declare function createDirIfNotExists(dir: string): Promise<void>;
/**
* Find all feature behavior files matching a pattern
*
* @param pattern - Glob pattern to match feature behavior files
* @returns AsyncGenerator that yields file paths as they are found
*/
export declare function findFeatureBehaviorFiles(pattern: string): AsyncGenerator<string, void, unknown>;
/**
* Find all feature behavior files matching a pattern (non-streaming version)
*
* @param pattern - Glob pattern to match feature behavior files
* @returns Promise resolving to array of file paths
* @deprecated Use the streaming version instead
*/
export declare function findFeatureBehaviorFilesArray(pattern: string): Promise<string[]>;
/**
* Generate a standardized report filename for a feature behavior file
*
* @param featureBehaviorFile - Path to the feature behavior file
* @returns Report filename
*/
export declare function getReportFilename(featureBehaviorFile: string): string;
/**
* Generate a standardized result filename for a feature behavior file
*
* @param featureBehaviorFile - Path to the feature behavior file
* @returns Result filename
*/
export declare function getResultFilename(featureBehaviorFile: string): string;
/**
* Check if an error is transient (network error, rate limit, etc.)
*
* @param error - The error to check
* @returns True if the error is transient and should be retried
*/
export declare function isTransientError(error: unknown): boolean;
/**
* Calculate exponential backoff delay with jitter
*
* @param attempt - Current attempt number (1-based)
* @param config - Retry configuration
* @returns Delay in milliseconds
*/
export declare function calculateBackoffDelay(attempt: number, config: RetryConfig): number;
/**
* Sleep for a specified duration
*
* @param ms - Duration in milliseconds
*/
export declare function sleep(ms: number): Promise<void>;