diff
Show differences between local component copies and the latest registry versions. Plain text by default, with an optional interactive TUI.
Usage
npx @gentleduck/cli diff [components...]
npx @gentleduck/cli diff [components...]
Compares your local component source against the latest registry version. Default output is plain text printed to the terminal (unified-diff style, colorized). Pass -g/--gui to open an interactive TUI instead.
Options
| Flag | Description |
|---|---|
-c, --cwd <cwd> | Working directory |
-g, --gui | Open in interactive GUI mode (off by default) |
-w, --workspace <path> | Target workspace |
--gui is a plain on/off flag - it doesn't take a value. There's no --gui false; to get plain text just omit the flag.
Examples
# Diff a specific component (plain text)
npx @gentleduck/cli diff button
# Diff all installed components (plain text)
npx @gentleduck/cli diff
# Open the interactive TUI
npx @gentleduck/cli diff button --gui
What you see
Without --gui, each changed file prints as a unified diff: old/new line numbers, then a +/-/space prefix, then the content, colored green/red:
12 12 function Button() {
13 - return <button />
13 + return <button {...props} />
14 14 }
With --gui, you first pick a component from a list, then see the diff rendered full-screen. It starts in unified view; press Tab to switch to a side-by-side LOCAL / REGISTRY layout.
| Key | Action |
|---|---|
j / k | Scroll |
n / p | Jump to next/previous hunk |
Tab | Toggle unified / side-by-side view |
h / l | Switch file (when a component has more than one changed file) |
Esc | Back to the component list |
There's no key to launch update from inside the diff TUI - run it separately.
Common workflow
cli diff: see what's drifted from upstreamcli update <name>: pull changes, choosing merge to resolve conflicts hunk-by-hunk (preserves your local edits)cli diff <name>: verify the merge resolved correctly
Use in CI
For CI / scripts, diff (in its default plain-text mode) exits with code 1 when there's a diff and 0 when in sync:
npx @gentleduck/cli diff || echo "drift detected"
npx @gentleduck/cli diff || echo "drift detected"