# pi-show-diff

Pi extension for local development: open a visual Diff2Html view of what your current branch would contribute to `main`.

It is not a sharing service. It does not upload diffs. It writes a temporary local HTML file and opens it in your browser.

Repository: https://gitlab.com/mjfuertesf/pi-show-diff

## Screenshots

Line-by-line:

![pi-show-diff line-by-line screenshot](./docs/pi-show-diff-line-by-line.png)

Side-by-side:

![pi-show-diff side-by-side screenshot](./docs/pi-show-diff-side-by-side.png)

## Install

```bash
pi install git:gitlab.com/mjfuertesf/pi-show-diff
pi install npm:@mjfuertesf/pi-show-diff
```


## Usage

```text
/show-diff
```

Defaults to `main`, then `master`.

Use another base ref:

```text
/show-diff develop
/show-diff origin/main
```

## What it does

- Runs a PR-style diff: `git diff <base>...HEAD`
- Renders it with Diff2Html
- Opens a local browser preview
- Warns if the working tree is dirty
- Includes committed branch changes only

## Pi tool

Also registers:

```ts
show_review_diff({ base?: string })
```

Useful when a Pi skill or agent should open the same local review preview.

## Development

```bash
npm test
npm pack --dry-run
```

## Credits

Built with [CodeMirror 6](https://codemirror.net/) by Marijn Haverbeke and contributors.

## License

MIT
