@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

extension

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 active
  • j / k - move through lines, automatically crossing hunk and file boundaries
  • d / u or Ctrl+D / Ctrl+U - move down/up half a page, including across adjacent hunks and files

Actions

  • / - search within the current file diff
  • g - open the changed-file picker with fuzzy filename matching and per-file summaries
  • c - start an inline line comment or question
  • H - start an inline hunk comment or question
  • F - start an inline file-level comment or question
  • 1-4 or e - edit a visible comment thread inline
  • x or Backspace - delete a visible comment thread
  • s - send all queued review comments as one batch
  • r - refresh the diff against the current base ref
  • w - toggle word wrap in the diff viewer
  • ? - toggle help
  • F1 / Alt+H - toggle help, including while a text input is focused
  • Esc / 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 input
  • Ctrl+N / Ctrl+P - alternate next/previous match keys
  • Enter - jump to the selected file
  • F1 / Alt+H - toggle help without leaving the filter input
  • Esc - 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 input
  • Ctrl+N / Ctrl+P - alternate next/previous match keys
  • Enter - jump to the selected match and close the search input
  • Esc - close the search input and keep the current search active
  • n / N - move to the next/previous match after closing the search input
  • F1 / Alt+H - toggle help without leaving the search input

While the inline comment editor is open:

  • Enter - save the comment
  • Shift+Enter - insert a newline
  • Tab - toggle between batch and immediate send mode
  • F1 / Alt+H - toggle help without leaving the editor
  • Esc - cancel editing

Review flow

  1. Open /review
  2. 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, press g to jump through a fuzzy searchable file list with +added / -removed summaries, or press / to search inside the current file diff
  3. Add comments/questions inline while still seeing the diff above the editor
  4. Use Tab in the inline editor to choose either:
    • batch to queue the thread
    • immediate to have the agent address it right away
  5. Press s when you want to send the whole queued batch
  6. Use 1-4 or e to reopen and edit visible comments
  7. Sending comments closes the review UI so pi can run the review turn cleanly
  8. Reopen /review to see agent responses attached to the relevant threads

Notes

  • The extension compares the merge-base of your review base and HEAD against your current working tree, so committed, staged, unstaged, and untracked file changes are all reviewable.
  • Default branch detection prefers origin/HEAD, then falls back to origin/main, origin/master, main, and master.
  • 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.

Repository