/** * Read-only Git inspection used by /diff and /review. Every diff * invocation carries --no-ext-diff and --no-textconv, so configured * external diff drivers and text converters can never execute as a * side effect of reading a diff. */ export interface GitDiffSpec { readonly label: string; readonly args: readonly string[]; } /** One file section from a unified diff, retained in source order. */ export interface GitDiffFile { readonly path: string; readonly lines: readonly string[]; } /** A parsed diff ready for a file-oriented terminal viewport. */ export interface GitDiffView { readonly title: string; readonly files: readonly GitDiffFile[]; } /** Split Git's stable `diff --git` framing without interpreting patch content. */ export declare function parseGitDiffFiles(text: string): readonly GitDiffFile[]; /** Parse the intentionally small, option-safe /diff argument vocabulary. */ export declare function parseGitDiffSpec(argument: string): GitDiffSpec; /** * Load one complete textual diff without invoking external programs. * @param signal - aborted by the caller on session switches/quit, killing the * git subprocess instead of letting a stale repository's diff land later. */ export declare function loadGitDiff(cwd: string, argument: string, signal?: AbortSignal): Promise; /** One /review run's selection: what to review plus an optional user note. */ export type ReviewSelection = { readonly kind: 'uncommitted'; } | { readonly kind: 'base-branch'; readonly branch: string; readonly mergeBase?: string; } | { readonly kind: 'commit'; readonly sha: string; } | { readonly kind: 'custom'; readonly instructions: string; }; /** * The /review argument is always a free-form note applied to the uncommitted * working tree (`/review 使用中文` reviews the uncommitted diff in Chinese); * branch and commit targets come from the candidate picker, never from * argument guessing. */ export declare function parseReviewArgument(argument: string): ReviewSelection; /** The merge base of HEAD and one branch, or undefined when git cannot compute one. */ export declare function mergeBaseWith(cwd: string, branch: string, signal?: AbortSignal): Promise; /** One commit's own patch (parent..commit), falling back to `git show` for root commits. */ export declare function loadCommitDiff(cwd: string, sha: string, signal?: AbortSignal): Promise; /** * Build the in-session review prompt: the diff is pasted whole (truncated at * the character cap with an explicit marker the model can see), the rubric's * essentials ride along — P0-P3 priorities, file/line anchors, only defects * this change introduced — and an optional user note (language, focus) * prefixes everything as the user's explicit instruction. */ export declare function buildReviewPrompt(diff: string, label: string, note?: string, maxChars?: number): string; /** One branch candidate for the review picker. */ export interface ReviewBranch { readonly name: string; } /** One commit candidate for the review picker. */ export interface ReviewCommit { readonly sha: string; readonly title: string; /** Committer timestamp in Unix epoch milliseconds. */ readonly at: number; } /** * Local branch names for the review picker, newest activity first and with * the current branch excluded (reviewing against it is always empty). */ export declare function listReviewBranches(cwd: string, signal?: AbortSignal): Promise; /** Recent commits on the current branch for the review picker. */ export declare function listReviewCommits(cwd: string, signal?: AbortSignal, limit?: number): Promise; /** One finished review, ready for the terminal's result panel. */ export interface ReviewResultView { /** Panel header naming what was reviewed. */ readonly title: string; /** The reviewer's reply markdown (the findings list). */ readonly body: string; /** Compact summary: finding counts per priority plus the verdict. */ readonly summary: string; /** The review session id, so follow-ups can @-reference its context. */ readonly sessionId: string; } /** One parsed review finding from the reviewer's closing JSON block. */ export interface ReviewFinding { /** Priority 0-3 for P0-P3; undefined when the reviewer omitted it. */ readonly priority?: number; /** Finding title, already free of the [P#] prefix when present. */ readonly title: string; /** File path the finding anchors to, when stated. */ readonly path?: string; /** Line range as written, when stated. */ readonly range?: string; } /** The parsed conclusion of one review reply. */ export interface ReviewConclusion { readonly findings: readonly ReviewFinding[]; readonly overall?: 'correct' | 'incorrect'; readonly explanation?: string; } /** * Parse the reviewer's reply into a conclusion: whole-text JSON first, then * the first balanced JSON object anywhere in the text, then undefined (the * reply renders as plain markdown with no summary line). Malformed fields * are dropped, never thrown. */ export declare function parseReviewConclusion(text: string): ReviewConclusion | undefined; /** * One compact summary line for a finished review: finding counts per * priority plus the overall verdict, or a no-findings phrasing. */ export declare function reviewSummaryLine(conclusion: ReviewConclusion): string; /** * Resolve the working directory's git branch for the status line. * @param cwd - the session's working directory. * @returns the branch name, or '' outside a repository or on a detached HEAD. */ export declare function gitBranch(cwd: string): string;