/**
 * Parser and in-memory applier for the apply_patch format used by OpenAI Codex
 * and OpenCode:
 *
 * ```
 * *** Begin Patch
 * *** Add File: path/to/new.ts
 * +line one
 * *** Update File: path/to/existing.ts
 * *** Move to: path/to/renamed.ts
 * @@ optional context line
 *  unchanged line
 * -removed line
 * +added line
 * *** Delete File: path/to/old.ts
 * *** End Patch
 * ```
 *
 * Parsing and applying are pure: nothing here touches a filesystem.
 */
export declare class ApplyPatchError extends Error {
    constructor(message: string);
}
export interface UpdateChunk {
    /** Line from `@@ <context>` used to locate the chunk, if given. */
    context?: string;
    oldLines: string[];
    newLines: string[];
    /**
     * For each entry of `newLines`, the index in `oldLines` it was copied from
     * when it is a context line. Lets context keep the file's exact text when
     * the hunk only matched after ignoring whitespace.
     */
    contextSource: Array<number | undefined>;
    /** Set by `*** End of File`: the chunk must match the end of the file. */
    isEndOfFile: boolean;
}
export type PatchOperation = {
    type: 'add';
    path: string;
    content: string;
} | {
    type: 'delete';
    path: string;
} | {
    type: 'update';
    path: string;
    moveTo?: string;
    chunks: UpdateChunk[];
};
/**
 * Parse a patch into its file operations. Throws {@link ApplyPatchError} on
 * malformed input or when the same path is touched more than once.
 */
export declare function parsePatch(patch: string): PatchOperation[];
/** Every path a set of operations reads or writes, including move destinations. */
export declare function patchPaths(operations: PatchOperation[]): string[];
/**
 * Apply update hunks to file content in memory. Throws {@link ApplyPatchError}
 * when a hunk cannot be located. Preserves the file's line endings and whether
 * it ends with a newline.
 */
export declare function applyChunks(content: string, chunks: UpdateChunk[], path: string): string;
//# sourceMappingURL=apply-patch-parser.d.ts.map