pi-dx

Pi extension that opens the dx diff reviewer from /diff.

Packages

Package details

extension

Install pi-dx from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:pi-dx
Package
pi-dx
Version
0.1.1
Published
Jun 19, 2026
Downloads
not available
Author
phongndo
License
MIT
Types
extension
Size
14.1 KB
Dependencies
0 dependencies · 1 peer
Pi manifest JSON
{
  "extensions": [
    "./extensions/pi-dx.ts"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

pi-dx

Pi extension that adds /diff and opens the external dx terminal diff reviewer from inside Pi.

dx is not bundled with this package. Install dx separately and keep it on PATH, or set PI_DX_BIN to the executable path.

Install

Install dx first:

curl -fsSL https://raw.githubusercontent.com/phongndo/dx/main/scripts/install.sh | sh

Then install the Pi package from npm:

pi install npm:pi-dx

Use a non-PATH binary with:

PI_DX_BIN=/path/to/dx pi

Development

Run the extension from this checkout without installing the npm package:

pi -e ./extensions/pi-dx.ts

Developer checks use pnpm:

cd pi-dx
pnpm install
pnpm run check

Useful individual commands:

pnpm run typecheck
pnpm run lint
pnpm run format:check
pnpm run format

Release

Publishing is manual, matching the main dx binary release flow:

  1. Update pi-dx/package.json version.
  2. Merge the change.
  3. Run the Publish pi-dx GitHub Actions workflow.

The workflow validates the package, publishes it to npm with provenance, and can create a pi-dx-vX.Y.Z GitHub release. npm trusted publishing must be configured for this repository and workflow before the publish step can succeed.

Usage

/diff
/diff --staged
/diff --unstaged
/diff --base main
/diff main feature
/diff --pr 123
/diff --pr https://github.com/owner/repo/pull/123
/diff --patch changes.diff

The external dx terminal UI opens immediately from interactive Pi, including while an agent turn is still running. Pi's TUI is restored when dx exits.

/diff --patch - is intentionally rejected because Pi cannot pipe stdin into the external viewer from a slash command. Write the patch to a file and pass the file path instead.

Current error behavior

  • Missing dx: shows an install hint.
  • Non-interactive Pi mode: refuses to run because dx needs a terminal.
  • No Git repo for Git-backed diffs: shows a clean error. Future agent turn diff support can use this branch as the fallback path.
  • Malformed /diff quoting or non-zero dx exit: shows a Pi notification.