/** * AutoHealer, three-stage pipeline to fix write/edit validation failures. * * Pipeline (opt-in via tools.autoHeal config): * 1. Formatter: prettier --write or biome format * 2. Linter fix: eslint --fix * 3. ToolLLM: LLM-assisted fix with error context * * Design constraints: * - Returns {healed: false, content: originalContent} with warnings whenever * repair cannot safely produce validated replacement content * - Each stage checks if errors are resolved before proceeding to the next * - Uses Bun.which() to detect available tools at runtime */ import type { ConfigManager } from '../../config/manager.js'; import type { ToolLLM } from '../../config/tool-llm.js'; /** Result of an auto-heal attempt. */ export interface HealResult { healed: boolean; content: string; method?: 'formatter' | 'linter' | 'llm' | undefined; warnings?: string[] | undefined; } /** * AutoHealer, attempts to fix content with validation errors via a staged pipeline. * * Usage: * const healer = new AutoHealer(); * const result = await healer.heal(filePath, content, errors); * if (result.healed) { // use result.content } */ export declare class AutoHealer { private readonly configManager; private readonly toolLLM; constructor(configManager: Pick, toolLLM: Pick); /** * Attempt to auto-heal content with validation errors. * * @param filePath Original file path (used to determine extension/context). * @param content File content that failed validation. * @param errors Validation error messages from the failed write/edit. * @returns Heal result, healed=true means content was fixed. */ heal(filePath: string, content: string, errors: string[]): Promise; /** * Stage 1: Try formatting with prettier or biome. */ private _tryFormatter; /** * Stage 2: Try linter fix with eslint. */ private _tryLinter; /** * Stage 3: Try ToolLLM with error context. */ private _tryLLM; /** * Heuristic check: attempt to parse/validate a temp file to see if errors are resolved. * * For JS/TS files: uses Bun's built-in transpiler to check for syntax errors. * For other files: assumes resolved if formatter/linter succeeded (conservative). */ private _errorsResolved; } //# sourceMappingURL=auto-heal.d.ts.map