@haphazarddev/pi-interactive-code-review
A pi extension for interactive code review against your default branch, including uncommitted changes, with line or hunk comments, batching, and inline agent responses.
Package details
Install @haphazarddev/pi-interactive-code-review from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@haphazarddev/pi-interactive-code-review- Package
@haphazarddev/pi-interactive-code-review- Version
0.2.0- Published
- May 5, 2026
- Downloads
- 636/mo · 18/wk
- Author
- corwinm
- License
- MIT
- Types
- extension
- Size
- 114 KB
- Dependencies
- 0 dependencies · 2 peers
Pi manifest JSON
{
"extensions": [
"./src/index.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
@haphazarddev/pi-interactive-code-review
Review your current branch and working tree like a pull request, directly inside pi.
It opens an interactive diff browser against your default branch, lets you move file by file and hunk by hunk, toggle word wrap for long diff lines, open a searchable changed-file list with per-file +/- summaries, attach review comments to lines, hunks, or whole files, and then either batch those comments or send them to the agent immediately.
When the agent replies, the extension stores the response on the matching review thread so you can reopen the review UI and follow the conversation inline with the diff.
Install
pi install npm:@haphazarddev/pi-interactive-code-review
Or from a local checkout:
pi install ./extensions/pi-interactive-code-review
Usage
Open the review UI:
/review
Optionally review against a specific ref instead of the detected default branch:
/review origin/main
/review main
/review --base origin/main
Review a child repository or another repository path from your current working directory:
/review --repo repos/test-repo
/review --repo repos/test-repo --base origin/main
A single bare argument that points to a git repository directory is treated as the review target; otherwise it is treated as the base ref.
When /review discovers exactly one dirty candidate repo under the current working directory, it opens that repo automatically. When multiple dirty repos are discovered, it asks you to select the review target. File paths in the diff and in review prompts are relative to the selected repo root. Clean child repos are hidden by default; use /review --include-clean to force the picker and include them. Use /review --scan-depth <n> to override the default child repo scan depth of 3. Use /review --current to force the innermost/current repo when pi is running inside a nested repo.
If a child repo cannot be opened, check that the path exists, contains a .git directory or file, and has a resolvable base ref such as origin/main.
Controls
Inside the review UI, press ? to show the full control reference in the lower section.
Movement
Tab/Shift+Tab- next/previous changed file[- previous hunk, automatically moving to the previous file when you're already at the first hunk]- next hunk, automatically moving to the next file when you're already at the last hunk↑/↓- move through lines, automatically crossing into the previous/next hunk or file at the boundaries
Extra shortcuts shown in ? help
n/p- next/previous changed file when diff search is not activej/k- move through lines, automatically crossing hunk and file boundariesd/uorCtrl+D/Ctrl+U- move down/up half a page, including across adjacent hunks and files
Actions
/- search within the current file diffg- open the changed-file picker with fuzzy filename matching and per-file summariesc- start an inline line comment or questionH- start an inline hunk comment or questionF- start an inline file-level comment or question1-4ore- edit a visible comment thread inlinexorBackspace- delete a visible comment threads- send all queued review comments as one batchr- refresh the diff against the current base refw- toggle word wrap in the diff viewer?- toggle helpF1/Alt+H- toggle help, including while a text input is focusedEsc/q- close
While the file picker is open:
- type to fuzzy-match changed files by filename only
- matched characters are highlighted in the picker
- typing resets selection to the top-ranked result
↑/↓- move the selected match while keeping focus in the filter inputCtrl+N/Ctrl+P- alternate next/previous match keysEnter- jump to the selected fileF1/Alt+H- toggle help without leaving the filter inputEsc- close the picker
While diff search is open:
- type to search within the current file diff
- visible matches are highlighted in the diff view
↑/↓- move between matches while keeping focus in the search inputCtrl+N/Ctrl+P- alternate next/previous match keysEnter- jump to the selected match and close the search inputEsc- close the search input and keep the current search activen/N- move to the next/previous match after closing the search inputF1/Alt+H- toggle help without leaving the search input
While the inline comment editor is open:
Enter- save the commentShift+Enter- insert a newlineTab- toggle between batch and immediate send modeF1/Alt+H- toggle help without leaving the editorEsc- cancel editing
Review flow
- Open
/review - Navigate through the diff file by file, use the hunk banners and
Hunk x/y • ↑/↓ ...indicators to see when a file has more hunks above or below, and use the top/bottom navigation banners to see when[/]will continue into the previous/next file, pressgto jump through a fuzzy searchable file list with+added/-removedsummaries, or press/to search inside the current file diff - Add comments/questions inline while still seeing the diff above the editor
- Use
Tabin the inline editor to choose either:- batch to queue the thread
- immediate to have the agent address it right away
- Press
swhen you want to send the whole queued batch - Use
1-4oreto reopen and edit visible comments - Sending comments closes the review UI so pi can run the review turn cleanly
- Reopen
/reviewto see agent responses attached to the relevant threads
Notes
- The extension compares the merge-base of your review base and
HEADagainst your current working tree, so committed, staged, unstaged, and untracked file changes are all reviewable. - Default branch detection prefers
origin/HEAD, then falls back toorigin/main,origin/master,main, andmaster. - Review thread state is stored in the session, so queued comments and agent responses survive reloads and session switches on the same branch.
- Agent replies are requested in a thread-tagged format so the extension can attach them back to the correct line/hunk/file thread.