Skip to content
Sign in
CodeInline hunk reviewMenu

Inline hunk reviewPro

Accept or reject an agent's edit hunk by hunk inside the file it changed. Y accepts, N rejects and both move on, J and K step between hunks, U undoes.

ProAn agent's rounding fix inside the file it changed. Y accepts, N rejects and moves to the next hunk, J and K step between hunks, U undoes, then Save file.

Installation

$ pnpm dlx shadcn@latest add @chatcn-pro/inline-hunk-review

Usage

tsx
import { InlineHunkReview } from "@/components/ui/chatcn/pro/inline-hunk-review"

<InlineHunkReview path="src/payouts/allocate.ts" oldText={before} newText={after} onSave={write} />

The whole file shows with each change in place, highlighted by the shared grammar. Accepted hunks settle into the file with a green edge, rejected ones bring the old lines back with a gray edge, and the mark in the gutter undoes either. onSave gets the file that results from your decisions. While streaming, the last hunk waits with a Writing label.

Examples

States

ProThe agent still writing, hunks already decided, a failed save with long lines, read only, no changes and loading.

Props

PropTypeNotes
oldText, newText, pathstringThe file before and after
languagestringDefaults to the extension
decisions, defaultDecisions, onDecisionsChangeRecord<string, HunkDecision>By hunk id; buildBlocks lists the ids
streamingbooleanThe last hunk is not final
disabledbooleanRead only
onSave, saving, saved, errorSave file, once every hunk has a decision
loading, height

Keyboard

KeyAction
Y / NAccept or reject the active hunk, then go to the next one that needs you
J K (ArrowDown ArrowUp)Next and previous hunk
Shift Y / Shift NAccept all or reject all
UUndo, back to the hunk it changed

Accessibility

  • Each hunk is a group named Change n of m with its line. Buttons carry the same name, so a screen reader hears which change they act on.
  • Every decision is announced politely. Lines keep + and - glyphs and read Added and Removed.

Motion

None. Decisions are made from the keyboard many times in a row, so hunks swap in place without animation.