{"_id":"@danielmeneses/pi-review","name":"@danielmeneses/pi-review","dist-tags":{"latest":"0.0.1"},"versions":{"0.0.1":{"name":"@danielmeneses/pi-review","type":"module","description":"PI extension to review, accept, and revert agent code changes","pi":{"extensions":["./index.ts"]},"scripts":{"prepare":"git config core.hooksPath .githooks","build:frontend":"node build.mjs","test:e2e":"playwright test","test:e2e:ui":"playwright test --ui","test:unit":"node --import tsx --test tests/*.test.ts","test":"npm run test:unit"},"dependencies":{"highlight.js":"^11.11.1","ignore":"^7.0.5","preact":"^10.26.0"},"devDependencies":{"@earendil-works/pi-coding-agent":"latest","@playwright/test":"^1.52.0","esbuild":"^0.25.0","tsx":"^4.22.3","typescript":"^6.0.3"},"version":"0.0.1","main":"index.ts","directories":{"test":"tests"},"repository":{"type":"git","url":"git+https://github.com/danielmeneses/pi-review.git"},"keywords":["pi-extension","pi","pi-package"],"author":{"name":"Daniel Meneses"},"license":"Apache-2.0","bugs":{"url":"https://github.com/danielmeneses/pi-review/issues"},"homepage":"https://github.com/danielmeneses/pi-review#readme","_id":"@danielmeneses/pi-review@0.0.1","gitHead":"4e29dd6072d20ffb2c8061a18c2f2cf05e883e0c","_nodeVersion":"22.22.1","_npmVersion":"10.9.4","dist":{"integrity":"sha512-xhY2rY+Ud312y1h0LUOub5ytatTbNqhb2fjme8xHJDSKmz5nc1Asdu3FDnfUgBc6mC08NJnO5qtDB5YR0GIasg==","shasum":"d342195bd8e776f6b13e36c9b27554d43ee1e76e","tarball":"https://registry.npmjs.org/@danielmeneses/pi-review/-/pi-review-0.0.1.tgz","fileCount":30,"unpackedSize":599907,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCv8N++x9vLmnWwaST60sK6M9AuuSTfJN8D6z8vDTeRCAIgW2Dko3cIqc2JF7WGJcx3roowNOnNXjLvWtsXZLE7dgY="}]},"_npmUser":{"name":"danielmeneses","email":"pro.danielmeneses@gmail.com"},"maintainers":[{"name":"danielmeneses","email":"pro.danielmeneses@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/pi-review_0.0.1_1779967613780_0.07837121494963073"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-28T11:26:53.559Z","0.0.1":"2026-05-28T11:26:53.970Z","modified":"2026-05-28T11:26:54.170Z"},"maintainers":[{"name":"danielmeneses","email":"pro.danielmeneses@gmail.com"}],"description":"PI extension to review, accept, and revert agent code changes","homepage":"https://github.com/danielmeneses/pi-review#readme","keywords":["pi-extension","pi","pi-package"],"repository":{"type":"git","url":"git+https://github.com/danielmeneses/pi-review.git"},"author":{"name":"Daniel Meneses"},"bugs":{"url":"https://github.com/danielmeneses/pi-review/issues"},"license":"Apache-2.0","readme":"# PI Review\n\n**Review, accept, or revert code changes made by the PI agent — right from your browser.**\n\nPI Review is a [PI extension](https://pi.dev) that tracks every file the agent edits, creates, or deletes. It gives you a clean web interface to see what changed, leave line-level comments, accept the good changes, and revert the ones you don't want.\n\n---\n\n## The Problem\n\nWhen an AI coding agent modifies your code, it happens fast — files change, new code appears, and you're left wondering \"what did it just do?\" The agent's chat history shows tool calls, but it's hard to get a clear picture of every file change across multiple edits.\n\nPI Review solves this by:\n\n- **Tracking every edit** the agent makes (through `edit`, `write`, or `bash` tools)\n- **Showing a unified diff** per file — so you see all changes together, not scattered across tool calls\n- **Letting you accept or revert** changes, one file at a time or all at once\n- **Preserving a history** of every accept/revert action, so you can go back and review what was done\n\n---\n\n## Main Workflow\n\n### 1. The agent makes changes\n\nWhen the PI agent edits a file, PI Review automatically captures the original content, the new content, and a diff showing exactly what changed. Nothing extra to do — it just works.\n\n### 2. Open the review UI\n\nRun `/review` in PI to open the web interface. You'll see:\n\n- A **sidebar** listing every file that was changed\n- A **main panel** showing the diff for the selected file\n- Status badges: **Pending** (yellow), **Accepted** (green), **Reverted** (grey)\n\n### 3. Review changes\n\nFor each file you can choose between two views:\n\n- **Diff view** — shows only the changed lines\n- **Full file view** — shows the complete file with changes highlighted in green (additions) and red (deletions). A down-arrow button jumps you to the next change.\n\n### 4. Accept or revert\n\n- **Accept** — keeps the agent's changes. Future edits to the same file will diff against the accepted version.\n- **Revert** — restores the file to its original content before the agent touched it.\n\nYou can do this per file or globally with the \"Accept All\" / \"Revert All\" buttons.\n\n### 5. Leave comments\n\nClick any line number to add a comment. Comments are sent to the agent as instructions — useful for asking \"why did you change this?\" or requesting a fix without leaving the review UI.\n\n### 6. Check history\n\nEvery accept or revert is recorded. Files with history show a collapsible list of past cycles, so you can see the full timeline of what happened.\n\n### 7. Talk to the agent\n\nUse the **Chat** button to start an open conversation with the agent. The chat panel slides in from the right — you can resize it by dragging the left edge.\n\n### 8. Reference code\n\nRight-click on any line or selection to open the \"Reference this code\" menu. This sends the selected code along with a question to the agent.\n\n---\n\n## Key Features\n\n| Feature | Description |\n|---|---|\n| **File tracking** | Automatically captures changes from `edit`, `write`, and `bash` tools |\n| **Unified diffs** | Merges multiple edits to the same file into a single, readable diff |\n| **Diff view** | Shows only changed lines |\n| **Full file view** | Shows the complete file with inline diff highlighting |\n| **Scroll to next diff** | In full file view, jumps to the next changed line |\n| **Accept / Revert** | Per-file or global accept/revert with history tracking |\n| **Line comments** | Click a line number to leave a comment for the agent |\n| **Reference code** | Right-click code to ask the agent about specific lines |\n| **Chat** | Open-ended conversation with the agent from inside the review UI |\n| **Resizable panels** | Drag the divider between sidebar and main content, or the chat panel edge |\n| **History timeline** | Every accept/revert is recorded for future reference |\n| **Live updates** | The UI refreshes automatically when new changes come in |\n| **Open in VS Code** | Click the VS Code icon to jump straight to a file |\n| **External change detection** | Warns when a file was modified outside the agent |\n\n---\n\n## Project Structure\n\n```\npi-review/\n├── src/\n│   ├── index.ts          — PI extension entry point\n│   ├── tracker.ts        — Core engine: tracks, merges, accepts, reverts\n│   ├── server.ts         — HTTP server with SSE and REST API\n│   ├── types.ts          — TypeScript type definitions\n│   └── frontend/\n│       ├── app.tsx       — Root Preact component\n│       ├── main.tsx      — Frontend entry point\n│       ├── store.ts      — API client and SSE manager\n│       ├── styles.css    — All styles\n│       ├── utils.ts      — Helper functions\n│       ├── highlight.ts  — Syntax highlighting\n│       ├── selection.ts  — Line selection utilities\n│       └── components/\n│           ├── file-viewer.tsx      — File diff/full-file display\n│           ├── full-file-view.tsx   — Full file with diff highlighting\n│           ├── diff-table.tsx       — Unified diff table\n│           ├── header.tsx           — Top toolbar\n│           ├── sidebar.tsx          — File list sidebar\n│           ├── chat-panel.tsx       — Agent chat (slide-in panel)\n│           └── reference-panel.tsx  — Code reference panel\n├── dist/                — Built frontend assets\n├── build.mjs            — esbuild config for frontend\n├── package.json         — PI extension config in the `pi` key\n└── README.md\n```\n\n---\n\n## Installation\n\nPI Review is a PI extension. It's loaded from the `pi` key in `package.json`:\n\n```json\n\"pi\": {\n  \"extensions\": [\"./src/index.ts\"]\n}\n```\n\nTo use it in another project, either:\n\n```bash\n# Install from git\npi install git:github.com/danielmeneses/pi-review\n\n# Or install locally from a local path\npi install /path/to/pi-review -l\n```\n\nExtensions and packages are placed in `~/.pi/agent/` (global) or `.pi/` (project-local). See the [PI extensions docs](https://pi.dev) for more details.\n\n---\n\n## Getting Started\n\n```bash\n# Build the frontend (required after any UI changes)\nnpm run build:frontend\n\n# In PI, start the review UI\n/review\n```\n\nThe server picks a port at runtime (defaults to 3123, falls back to a random port if busy). Run `/review` to open it in your browser.\n\n---\n\n## Commands\n\n| PI Command | Description |\n|---|---|\n| `/review` | Open the review UI in your browser |\n| `/accept-all` | Accept all pending changes |\n| `/revert-all` | Revert all pending changes (with confirmation) |\n\n---\n\n## State Persistence\n\nPI Review saves its state to `.pi-review/state.json` in your project root. This means:\n\n- Changes survive PI restarts\n- You can close and reopen the review UI without losing data\n- Accepted/reverted history is preserved between sessions\n\n---\n\n## Requirements\n\n- Node.js 18+\n- PI coding agent\n- A modern browser (Chrome, Firefox, Safari 14+)\n","readmeFilename":"README.md","_rev":"1-8318f4f0cb4863e90e24dbbe428fdb86"}