pi-review-mode
v0.3.1
Published
Pi extension that opens a native review surface for frozen Git diffs.
Readme
Pi Review Mode
Pi Review Mode is a Pi extension package that adds /review. It opens a Glimpse native review window for commenting on a frozen Git diff, then writes the submitted review prompt back into the active Pi editor with ctx.ui.setEditorText.
The extension does not modify Pi core and does not touch packages/coding-agent/*.
Development
Install and verify with pnpm:
pnpm install
pnpm typecheck
pnpm test -- --run
pnpm build
pnpm biome:checkRun locally in Pi from this repository:
pnpm build
pi -e ./For web UI work, run the Vite dev server for component development:
pnpm dev:webThe production /review command loads built assets from dist/review-web in a Glimpse native WebView. Rebuild before testing the live extension flow:
pnpm build
pi -e ./Run a repeatable development-only fixture review without editing files:
PI_REVIEW_MODE_FIXTURES=1 pi -e ./Then run /review --fixture basic or /review --fixture mixed. Fixture mode is blocked unless PI_REVIEW_MODE_FIXTURES=1 is set.
The package manifest points Pi at the extension entry, and the extension loads the bundled review UI from dist/review-web.
Configuration
Agent pre-review runs by default before the review window opens. Disable it with a global extension config file at ~/.pi/agent/extensions/pi-review-mode.json:
{
"agent-review": false
}Set "agent-review": true or remove the file to use the default agent pre-review flow.
Native Window Requirements
The review window is hosted by glimpseui.
- macOS: Xcode Command Line Tools provide
swiftcfor the native WKWebView host. - Linux: Glimpse can use a Rust/GTK/WebKitGTK host when those development packages are installed, or its Chromium backend when a Chromium-based browser is available.
- Windows: Glimpse uses .NET 8 and WebView2.
If Glimpse cannot build or find a host, /review reports the Glimpse error and leaves the Pi editor unchanged.
Installation
Install from a local checkout:
pnpm build
pi install ./Try it for one Pi run without installing:
pnpm build
pi -e ./Install from npm after publishing:
pi install npm:pi-review-modeInstall from git:
pi install git:github.com/<owner>/pi-review-modeThe package entry is declared in package.json and loads the built extension:
{
"pi": {
"extensions": ["./dist/extension/src/index.js"]
}
}Distribution
Build and inspect the npm tarball before publishing:
pnpm install
pnpm build
npm pack --dry-runPublish with npm when the tarball includes dist/extension/** and dist/review-web/**:
npm publishRelease scripts build the extension and review UI before packaging. The generated dist/ assets are committed so Pi git installs and updates can run with production dependencies only. Runtime review UI assets are bundled locally; no CDN assets are required.
Manual Smoke Tests
Working-tree review:
- Edit a tracked file and create one untracked file.
- Run
/review. - Choose working-tree changes.
- Add at least one file or line comment in the native review window.
- Submit and confirm the generated Markdown appears in the Pi editor but is not sent automatically.
Branch review:
- Commit local changes on a feature branch.
- Ensure the working tree is clean.
- Run
/review. - Choose the branch-vs-base option.
- Submit feedback and confirm the editor is updated.
Explicit base review:
/review --base mainFixture review:
- Run
PI_REVIEW_MODE_FIXTURES=1 pi -e ./. - Run
/review --fixture basic. - Add at least one comment in the native review window.
- Submit and confirm the generated Markdown appears in the Pi editor.
- Unset
PI_REVIEW_MODE_FIXTURESand confirm/review --fixture basicreports that fixtures are development-only.
Close/cancel behavior:
- Start
/review. - Close the native review window or press the Close button.
- Confirm the Pi editor contents are unchanged.
