Diff review
Compare two verifiable snapshots. Before is the review baseline. After is the proposed or updated version. Use the user's language when communicating results.
Use Python 3.8 or later for the commands below. Substitute python3 or py -3 if that is how Python 3 is available on the system.
Prepare the snapshots
- Confirm the baseline. For a proposal, use the working-tree contents from the start of the proposal, including existing local edits. For changes already applied, use the saved pre-change snapshot or the version the user specifies. Report any baseline you cannot verify.
- Prepare
BeforeandAfterin a temporary directory. For one file, pass two files. For multiple files, use directories containing only the files in scope and keep their relative paths. Put new files only inAfterand deleted files only inBefore. - Build
Afterfrom the reviewed change. If you have only a patch, check that it applies to a temporary copy, apply it there, then verify the result. Match the snapshot contents to the scope of the proposal.
Make edits in the review directory on the snapshots only.
Check the After snapshot
For a proposal, record the After you are about to show. Keep the returned manifest path with the review paths.
python -B "<skill directory>/scripts/review_after.py" record "<After path>"
After showing a proposal, wait for the user's approval before applying it to the original files. Check the on-disk snapshot before updating After in response to feedback or applying the approved proposal.
python -B "<skill directory>/scripts/review_after.py" check "<manifest path>"
unchangedmeans the paths and file contents match the displayed proposal.changedlists added, deleted, and modified files and returns a patch from the displayed proposal to the currentAfter. Read the patch before deciding how to incorporate the user's edits. Patch generation requires Git.- Record a new manifest when presenting an updated proposal. Reuse the original manifest when reopening the same proposal. Apply the version the user approved.
Reuse the review view
- Record the snapshot paths and how to find the view, such as its report path. On later requests for the same review, find the existing view first. Return to it if the contents match and it is still open.
- When a proposal changes, reuse the snapshot paths and keep the confirmed
Beforebaseline. UpdateAfterfor this revision. If the file scope changes, update the snapshots using the same baseline. - Follow the viewer guide to refresh the view. Verify the paths and the new differences. If the view is closed or cannot load the update, reopen the same snapshots in that viewer. Use the user's choice if they request a different viewer.
Open a comparison
Pass Before first and After second. Use two different paths of the same type, either files or directories.
python -B "<skill directory>/scripts/open_review.py" "<Before path>" "<After path>" --viewer "<viewer>"
Use the viewer the user specifies. For remote or mobile review, prefer Pierre Diffs. It packages the review in one offline HTML file. In other cases, try viewers in the order below, passing each name explicitly with --viewer. When the review needs a specific feature, try only viewers that provide it. Read the relevant guide from this skill directory.
| Viewer | --viewer | Opens in | Optional arguments |
|---|---|---|---|
| Pierre Diffs / 简体中文 | pierre-diffs | Browser with a shareable offline HTML report | --title, --language, --original-path, --include-full-files, --diff-only |
| difit / 简体中文 | difit | Local server and browser | |
| Beyond Compare / 简体中文 | beyond-compare | Desktop application | --title, --executable |
| VS Code / 简体中文 | vscode | Editor window | --title, --executable |
- If a web viewer reports missing npm dependencies, check its system requirements in the guide. Run the documented install command in the skill directory, then retry the same viewer.
- Run any bundled viewer that needs no installation according to its guide. Use existing system installations of Beyond Compare, VS Code, Git, Node.js, and npm.
- If the current viewer is still unavailable, explain why. Try the next eligible viewer only when the user did not specify one.
Pierre Diffs and difit display the Git patch between the snapshots. They identify binary changes by status. The script returns no-changes when the snapshots match.
After opening a viewer, use its guide to verify the paths and differences. For remote review, attach the Pierre Diffs HTML report if the host supports attachments. Otherwise provide an accessible report path. A generated status means the HTML is ready to share. If you cannot provide a report or verify an interactive comparison, explain the limitation and follow the patch export steps below.
Export a patch without a viewer
If a patch is the intended output, or the environment cannot provide a usable viewer or HTML report, export the patch with Git. Choose a new file outside both snapshots that the user can access. The script returns generated and the patch path, or no-changes when the snapshots match. For binary files, the patch records a change marker.
python -B "<skill directory>/scripts/open_review.py" "<Before path>" "<After path>" --patch-file "<output path>/review.patch"
If the host supports file attachments, attach the patch. Otherwise share its accessible path. If Git is missing, explain why patch export is unavailable and provide the snapshot paths.
Viewer arguments
| Argument | Purpose |
|---|---|
--title "<review title>" | Display a title in a supported viewer. Use the title the user gives you. |
--executable "<executable path>" | Use a specific desktop executable. Pair this with the corresponding --viewer. |
--language <language> | Set the initial language of a Pierre Diffs report. Use zh-CN for simplified Chinese or en for English. The default is en. |
--original-path "<original project path>" | Enable copying original absolute paths in Pierre Diffs. For one file, pass its original path. For a directory, pass the corresponding original directory. |
--include-full-files | Embed all changed text files in the Pierre Diffs report, bypassing the default full-file size budget. |
--diff-only | Include the diff and its usual context in Pierre Diffs. |
Run -h or --help for command usage.