FileDiffCard

An edit the agent proposes to one file. Accept or reject each hunk, or accept them all. AI.

Open playground
src/tax.ts+3 -1
@@ -12,5 +12,5 @@
export function tax(cents: number) {
return Math.round(cents * 0.0825);
return Math.ceil(cents * 0.0825);
}
@@ -30,3 +30,6 @@
export const RATE = 0.0825;
// Rounds up so the total never undercharges.
export const ROUNDING = "ceil";

About

FileDiffCard is a React component in the AI category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { FileDiffCard } from "@ashutoshswamy/smoui" and set path, hunks, onDecide.

Install

Terminal
npm i @ashutoshswamy/smoui

Usage

TSX
import { FileDiffCard } from "@ashutoshswamy/smoui";

<FileDiffCard path="src/tax.ts" hunks={hunks} onDecide={(id, v) => save(id, v)} />

Props 3

path

File name.

string
hunks

id, optional header and lines typed add, del or ctx.

DiffHunk[]
onDecide

Called per hunk.

(hunkId, decision) => void