/**
 * Patch parser for the *** Begin Patch / *** End Patch format.
 *
 * Modeled on opencode's src/patch/index.ts. Supports Add / Update / Delete / Move
 * file operations. The heavy fuzzy-matching from opencode is included so that
 * minor whitespace differences in context lines still match.
 */
export type PatchOperationType = 'add' | 'update' | 'delete' | 'move';
export interface PatchChunk {
    /** Lines that must be found in the original file (context + remove) */
    oldLines: string[];
    /** Lines that replace the old lines (context + add) */
    newLines: string[];
    /** Optional context text from @@ header for disambiguation */
    changeContext?: string;
    /** If true, this chunk extends to the end of the file */
    endOfFile: boolean;
}
export interface PatchOperation {
    type: PatchOperationType;
    filePath: string;
    /** Destination path for 'move' operations */
    targetPath?: string;
    /** Raw new-file content for 'add' operations */
    addContent?: string;
    /** Ordered hunks for 'update' operations */
    chunks: PatchChunk[];
}
/**
 * Strip a heredoc wrapper if present, returning the inner text.
 * Supports both `cat <<'EOF'...EOF` and bare `<<EOF...EOF`.
 */
export declare function stripHeredoc(patchText: string): string;
/**
 * Parse a patch string into structured PatchOperations.
 *
 * Throws with a descriptive message if the format is invalid.
 */
export declare function parsePatch(rawPatchText: string): PatchOperation[];
/**
 * Apply all update chunks in order to file content string, returning new content.
 */
export declare function applyUpdateChunks(content: string, chunks: PatchChunk[]): string;
/**
 * Validate that all update/delete hunks can be applied to the files returned
 * by `readFile`. Throws on the first validation failure.
 *
 * This is a pure read phase — no writes happen.
 */
export declare function validateHunks(ops: PatchOperation[], readFile: (path: string) => Promise<string>): Promise<void>;
//# sourceMappingURL=patch-parser.d.ts.map