import { type FileDiffMetadata } from '@pierre/diffs'; export type PatchChangeKind = 'add' | 'delete' | 'update' | 'rename'; /** * FNV-1a 32-bit. Cheap enough to run on every normalize pass and stable across * reloads, which is what Pierre's worker AST cache keys need. Not cryptographic * and not used for anything security-sensitive. */ export declare function contentHash(value: string): string; /** Per-hunk ranges/stats used for the existing hunk chip design. */ export interface NormalizedHunkStat { oldStart: number; oldLines: number; newStart: number; newLines: number; additions: number; deletions: number; context?: string; } export interface NormalizedPatchFile { /** Stable identity for React keys; unique within one tool call. */ id: string; /** Repository-relative path of the file the operation touches. */ path: string; /** Previous path for renames, when the payload provides one. */ previousPath?: string; kind: PatchChangeKind; /** A singular git-style unified patch describing exactly this file. */ patch: string; /** * The operation's own source text. Rendered verbatim (with +/- colouring) * when `renderable` is false, so no operation is ever silently dropped. */ text: string; /** * True when `patch` resolves to a Pierre model with real content. False for * custom envelopes that cannot be expressed as a unified diff (for example * `*** Find:`/`*** With:` blocks) and for pure renames with no hunks. */ renderable: boolean; /** * Parsed once here so renderers never feed the patch string back through a * second parse. Carries a stable `cacheKey` so the worker AST cache survives * collapse/reopen. `undefined` exactly when `renderable` is false. */ fileDiff?: FileDiffMetadata; additions: number; deletions: number; hunks: NormalizedHunkStat[]; } declare const ENVELOPE_FILE: RegExp; /** Strips leading `./`, leading slashes and jsdiff's `a/` / `b/` prefixes. */ export declare function toPatchPath(filePath: string): string; /** * Confirms `@pierre/diffs` can actually build a renderable model from a patch: * exactly one file with at least one hunk carrying real line content. Anything * else would produce an empty diff shell, so callers must fall back instead. */ export declare function isRenderablePierrePatch(patch: string): boolean; /** * Converts any patch payload Otto's tools produce into an ordered list of * per-file operations. One `apply_patch` call may contain many operations, * many files and many hunks per file; every one of them is preserved. * * Entries with `renderable: false` cannot be expressed as a unified diff and * must be rendered from their `text` instead, per file — never by discarding * the whole payload. */ export declare function normalizeToolPatch(rawPatch: string, fallbackPath?: string): NormalizedPatchFile[]; /** Aggregate totals across every operation in one tool call. */ export declare function summarizePatchFiles(files: NormalizedPatchFile[]): { files: number; additions: number; deletions: number; }; /** * Normalizes a `git diff` payload for a single selected file into one unified * patch. Returns `null` when no renderable patch exists for that file. */ export declare function normalizeGitPatch(diffText: string, filePath: string): string | null; /** * Resolves the single renderable operation for a selected Git file, keeping the * parsed {@link FileDiffMetadata} (and its stable cache key) so the full-pane * viewer does not reparse the patch. */ export declare function normalizeGitDiffFile(diffText: string, filePath: string): NormalizedPatchFile | null; export { ENVELOPE_FILE as ENVELOPE_FILE_PATTERN }; //# sourceMappingURL=patchNormalize.d.ts.map