/** * Rehearsal Manager * * Coordinates rehearsal analyzers to provide impact analysis * for destructive operations before they are executed. */ import type { RehearsalAnalyzer, RehearsalResult, RehearsalManagerOptions, RehearsalEventHandler } from './types.js'; /** * RehearsalManager - Coordinates impact analysis for destructive operations * * @example * ```typescript * const manager = new RehearsalManager({ * workingDirectory: '/path/to/project', * }); * * // Analyze before executing * const result = await manager.rehearse('rm -rf node_modules'); * * if (result.recommendation === 'abort') { * console.log('Operation too dangerous:', result.warnings); * } else if (result.recommendation === 'confirm') { * const confirmed = await askUser(result.impact.summary); * if (confirmed) { * // Execute the operation * } * } * ``` */ export declare class RehearsalManager { private readonly analyzers; private readonly workingDirectory; private readonly warningThreshold; private readonly sessionStartTime; private readonly sessionModifiedFiles; private readonly trackSessionFiles; private eventHandler?; constructor(options?: RehearsalManagerOptions); /** * Register an analyzer */ registerAnalyzer(analyzer: RehearsalAnalyzer): this; /** * Unregister an analyzer */ unregisterAnalyzer(id: string): boolean; /** * Get all registered analyzers */ getAnalyzers(): RehearsalAnalyzer[]; /** * Set event handler */ onEvent(handler: RehearsalEventHandler): this; /** * Emit an event */ private emit; /** * Track a file as modified in this session */ trackFileModification(filePath: string): void; /** * Get files modified in this session */ getSessionModifiedFiles(): string[]; /** * Check if an operation is potentially destructive */ isDestructive(operation: string): boolean; /** * Find the appropriate analyzer for an operation */ findAnalyzer(operation: string): RehearsalAnalyzer | undefined; /** * Rehearse an operation - analyze its impact before execution * * @param operation - The command or operation to analyze * @returns Impact analysis result */ rehearse(operation: string): Promise; /** * Rehearse multiple operations */ rehearseAll(operations: string[]): Promise; /** * Check if an operation should proceed based on rehearsal * * @returns true if safe to proceed, false if should abort */ shouldProceed(operation: string): Promise; /** * Get a formatted summary of a rehearsal result */ formatResult(result: RehearsalResult): string; } /** * Create a RehearsalManager with default configuration */ export declare function createRehearsalManager(options?: RehearsalManagerOptions): RehearsalManager;