$ show badlogic/pi-diff-review
The pi-diff-review plugin adds a `/diff-review` command to the pi coding agent that opens a native review window for examining git changes. The window allows users to switch between viewing changes in the working tree (git diff), the last commit, a specific commit, or all files. Users can add inline comments and an overall note, which are then formatted into a prompt and inserted into the pi editor. The plugin consists of a backend written in TypeScript that interacts with git and the pi extension, and a frontend built with HTML, CSS, and Monaco Editor that runs in a Glimpse window. The backend cleanly separates concerns: git data collection (src/git.ts), command handling and messaging (src/index.ts), prompt composition (src/prompt.ts), and HTML generation (src/ui.ts). The frontend provides an interactive diff viewer with commenting capabilities. A notable reusable component is the git data gathering logic in src/git.ts, which isolates the complexity of interacting with git to collect file status across multiple scopes. This module could be extracted for use in other git-based tools with minimal adaptation, primarily by replacing the pi ExtensionAPI-dependent command execution with a generic interface.
The LLM identified 1 files worth highlighting for reuse:
This module provides a self-contained git data gathering service for a diff review tool. It computes the status of files across multiple scopes (working tree, git diff vs HEAD, last commit, and historical commits) by executing git commands and processing their output. The module handles file renames, untracked files, and deleted files, and builds a comprehensive dataset for each file. While it uses the pi ExtensionAPI to execute git commands, the core logic is isolated and could be adapted to other environments by replacing the command execution mechanism.