pi-show-diffs
Pi package that adds a diff approval viewer before edit and write tools change files.
Package details
Install pi-show-diffs from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:pi-show-diffs- Package
pi-show-diffs- Version
0.2.14- Published
- May 27, 2026
- Downloads
- 1,177/mo · 80/wk
- Author
- xryul
- License
- MIT
- Types
- extension
- Size
- 159.5 KB
- Dependencies
- 2 dependencies · 2 peers
Pi manifest JSON
{
"extensions": [
"./index.ts"
],
"video": "https://github.com/user-attachments/assets/8bda7619-fcd2-4615-a93a-d15b2fee408b"
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
pi-show-diffs
warp.dev inspired pi extension that stops and shows an editable diff before file changes are applied.
https://github.com/user-attachments/assets/8bda7619-fcd2-4615-a93a-d15b2fee408b
It currently reviews:
edithashline_editwrite
This gives pi an interactive pre-apply diff review step, so you can inspect the proposed change first and then decide whether to allow it.
Diff review UX
For normal file changes, the modal uses a split diff viewer with:
- side-by-side Original / Updated columns
- syntax-aware ANSI highlighting for common code file types
- optional colored rail markers beside rendered diff lines
- collapsed unchanged regions with clear labels
- hunk-aware navigation
- unified diff fallback for narrow terminals or preview errors
- live toggle between split and unified views
- inline editing for
edit,write, and validhashline_editpreviews directly inside the diff modal - adjustable context expansion around hunks
- wrapped inline rendering for long lines
Install
Install from npm:
pi install npm:pi-show-diffs
Or install directly from GitHub:
pi install git:github.com/xRyul/pi-show-diffs
Commands
/diff-approval— open approval settings; use↑/↓to select a setting andSpace/Enterto cycle its value. The Keybindings row opens the keybinding editor./show-diffs— alias for/diff-approval
Command args:
/diff-approval on/diff-approval off/diff-approval toggle/diff-approval colors default— use built-in diff backgrounds (darkuses the original muted red/green;lightuses light-friendly red/green)/diff-approval colors theme— use the active pi theme's tool success/error backgrounds/diff-approval keybindings— open the keybinding editor directly/diff-approval status
Shortcuts in the diff modal
Approval actions
Enter,a, ory- approverorEsc- rejectEore- enter inline edit mode for the updated sideEscin inline edit mode — leave editing and return to review modes- steer and add feedbackShift+A- approve and turn on auto-approve
Navigation
↑/↓- scrollPgUp/PgDn- jump by pageHome/End— jump to top/bottomn/p- next / previous hunk- inline edit mode:
Ctrl+N/Ctrl+Pjump hunks;Alt/Option+↑/↓also works if your terminal is configured to send Alt
View controls
Tab- toggle split / unified view←/→— decrease / increase shown context around hunks[/]- alternate context controlsw- toggle wrappingCtrl+F- when expandable layout is enabled, open/collapse the expanded overlay
Config
Persistent config is stored at:
~/.pi/agent/extensions/pi-show-diffs.json
Current config shape:
{
"autoApprove": false,
"diffColorMode": "default",
"showDiffRail": true,
"expandableLayout": false,
"collapsedHeight": "30%",
"expandedHeight": "100%",
"expandedWidth": "100%",
"keybindings": {
"approve": ["Enter", "a", "y"],
"reject": ["Escape", "r"]
}
}
diffColorMode accepts:
default— use pi-show-diffs predefined diff backgrounds. Dark themes use the original muted red/green; light themes use light-friendly red/green.theme— follow your active pi theme's tool success/error backgrounds.
Diff marker options:
showDiffRail— whentrue, show a colored▌rail marker next to rendered diff lines.
Expandable layout options:
expandableLayout— whentrue, render the diff inline first instead of as a centered overlay.collapsedHeight— inline diff height as a percentage string, clamped to10%-100%.expandedHeight— maximum overlay height afterCtrl+F, clamped to10%-100%.expandedWidth— overlay width afterCtrl+F, clamped to10%-100%.
Keybindings are configured per action. Use comma-separated pi-tui key ids such as Enter, Escape, ctrl+f, pageUp, or up; set an action to false to disable it. Missing actions fall back to defaults.
Notes
- no
edit/writetool overrides are registered, so it stays compatible with other tool-wrapping extensions likecollapse-tools.ts - non-interactive mode falls back to a text-based diff review flow
- steering rejects the current proposal and sends your feedback back to the model
- editing final file content applies immediately for
edit,write, andhashline_editafter the original tool call succeeds - auto-approve restores normal behavior until you turn it off again
- invalid
hashline_editpreviews (for example tag mismatches) skip the review modal and fall through to the tool's normal error handling