/** * Unified-diff parsing — the input half of `SignalContext`. * * `SignalContext.pr.diffLines` is a `Map>` of post-image * line numbers per file, and this is what produces the `Set`. It lived * in the review engine's `github-api.ts`, which meant the only way to get diff * parsing was to import a module that also imports Octokit — so a caller * driving the signals from a local `git diff` had to either take on a GitHub * client it never calls, or fork the logic. The harness already forked it * (`packages/review/test/harness/capture-pr.ts`'s `extractPostImageLines`). * * The function itself never needed any of that: it is a pure walk over patch * text. */ /** * Post-image line numbers a unified diff patch covers — the lines that can * carry a review comment. * * Counts both added (`+`) and context (` `) lines, because a consumer * filtering findings to "lines this diff touched" wants context lines too: * a bug on a context line adjacent to the change is in scope. Deleted (`-`) * lines do not advance the counter, since they have no post-image position. * * Known limit: the `+++` file-header guard is a prefix test, so an ADDED line * whose own content starts with `++` (`++i;` arrives in the patch as `+++i;`) * reads as a header and is skipped. The skipped line's number is not lost — it * is silently reused by the next line, so every later line in the hunk is * attributed one position too low, and the hunk's LAST line falls out of the * set entirely. Rare enough to have never been hit (it needs added source * beginning with `++`, e.g. a C pre-increment at column 0), and long-standing * behaviour; recorded because it is invisible from the call site. */ export declare function parsePatchLines(patch: string): Set; /** * A whole diff, split into what `SignalContext.pr` carries: the raw patch text * per file, and the post-image line numbers per file. */ export interface ParsedUnifiedDiff { patches: Map; diffLines: Map>; } /** * Split a unified diff into per-file patches plus the lines each one touches. * * The path comes from the `+++` header rather than the block header wherever * possible, because the block header has no unambiguous split when a filename * contains a space — its only separator is the literal ` b/`. The `+++` line * carries one path and needs no split. * * A block whose post-image is `/dev/null` is a deletion: it gets an entry with * an empty line set rather than being dropped, so a caller can distinguish * "this file was deleted" from "this file was not in the diff at all". * * Known ambiguity, unavoidable without invoking git once per file: a filename * containing the literal ` b/` breaks the fallback split. Only reachable for a * block with no `+++` line — a pure mode change, or a binary file. */ export declare function parseUnifiedDiff(diff: string): ParsedUnifiedDiff; //# sourceMappingURL=unified-diff.d.ts.map