/** * Validation Lock Wrapper * * Provides a reusable locking mechanism for validation workflows. * Extracts the locking logic from validate.ts to enable consistent * lock management across commands (validate, pre-commit, etc.). */ import type { VibeValidateConfig } from '@vibe-validate/config'; import { type TreeHashResult } from '@vibe-validate/git'; import type { AgentContext } from './context-detector.js'; /** * Options for validation lock wrapper */ export interface ValidationLockOptions { /** Whether locking is enabled (CLI flag override) */ lockEnabled?: boolean; /** Whether to wait for existing locks */ waitEnabled?: boolean; /** Maximum time to wait for lock (seconds) */ waitTimeout?: number; /** Whether in YAML output mode (suppresses display output) */ yaml?: boolean; } /** * Context passed to callback */ export interface ValidationLockContext { /** Loaded configuration */ config: VibeValidateConfig; /** Directory where config was found */ configDir: string; /** Agent context (Claude Code, CI, etc.) */ context: AgentContext; /** Pre-computed tree hash (avoids redundant computation in workflow) */ treeHashResult?: TreeHashResult; } /** * Execute a callback with validation lock management * * This function handles the complete locking workflow: * 1. Load configuration with directory detection * 2. Detect agent context * 3. Determine lock options from config * 4. Wait for existing locks (if enabled) * 5. Acquire lock (if enabled) * 6. Execute callback with context * 7. Release lock in finally block * * @param options - Lock options * @param callback - Function to execute with lock held * @returns Result from callback * * @example * ```typescript * await withValidationLock( * { lockEnabled: true, waitEnabled: true }, * async ({ config, configDir, context }) => { * // Run validation workflow * return runValidateWorkflow(config, options); * } * ); * ``` */ export declare function withValidationLock(options: ValidationLockOptions, callback: (_ctx: ValidationLockContext) => Promise): Promise; //# sourceMappingURL=validation-lock-wrapper.d.ts.map