import type { Side } from './types.js'; /** * A diff line resolved to the old/new line numbers it maps to. GitLab consumes * both (`old_line`/`new_line`); GitHub consumes one plus a `side`. Shared by both * platforms so line resolution lives in one place. */ export interface ResolvedDiffLine { newLine?: number; oldLine?: number; } /** * Classify a target line in a unified diff into the old/new line numbers it maps * to, tracking which side(s) apply: * - an **added** line resolves to `newLine` only, * - a **removed** line resolves to `oldLine` only, * - an **unchanged (context)** line resolves to BOTH `oldLine` and `newLine`. * * GitLab needs both sides for context lines: a one-sided position is accepted by * the draft-notes API but makes `bulk_publish` return 500 (GitLab skips position * validation on draft creation — gitlab-org/gitlab#579609). GitHub uses a single * `line` + `side`, taking `newLine`/`RIGHT` or `oldLine`/`LEFT`. We feed the * reviewer ±20 lines of context, so it routinely anchors comments on unchanged * lines; resolving them here is what lets both platforms place the comment. * * Returns `null` when the line is not part of the diff for `file`, so the caller * can fall back (GitLab) or drop the comment (GitHub avoids a 422 on off-diff * lines) rather than emit a position the platform cannot place. */ export declare function resolveDiffLine(diff: string, file: string, target: number, side: Side): ResolvedDiffLine | null; /** Context lines GitHub renders around each hunk change in a PR diff by default. */ export declare const GITHUB_DIFF_CONTEXT = 3; /** * True when the context line `target` (on `side`) is within `maxDistance` rows * of the nearest added/removed line in its hunk. * * The reviewer runs against our LOCAL merge diff, generated with a wide context * (`--unified=20`, see `git.ts`), so it routinely anchors findings on unchanged * lines up to 20 rows from a change. GitHub's PR diff, however, shows only 3 * context lines: a review comment on a line outside GitHub's diff gets a 422, * and because the review is posted as one atomic batch, a single 422 sinks every * inline comment. This lets the GitHub payload builder drop such an off-diff * context line (returning `null`) instead of 422-ing the whole review. * * Only meaningful for context lines (added/removed lines are always inside * GitHub's diff); the caller checks that before calling. */ export declare function contextLineWithinGitHubDiff(diff: string, file: string, target: number, side: Side, maxDistance?: number): boolean; //# sourceMappingURL=diff-lines.d.ts.map