# pi-git-status-bar

Pi extension that shows live git status for the current project in the footer status bar: dirty files, staged/unstaged/untracked counts, new dirty files introduced during the session, ahead/behind vs. origin, and commits made in the current session.

## Install

```bash
pi install npm:pi-git-status-bar
```

Or try without installing:

```bash
pi -e npm:pi-git-status-bar
```

## What it shows

The status bar entry updates on session start, turn end, and after each `bash` tool call, plus a 10s background refresh. Example:

```
⎇ staged:1 unstaged:2 untracked:1 new:2 ↑1 commits:1
```

- `⎇` — git indicator (replaces the word "git")
- `staged:N` / `unstaged:N` / `untracked:N` — current `git status --porcelain=v2` counts
- `new:N` — files that became dirty since the session started (not dirty at session start)
- `↑N` / `↓N` — commits ahead/behind the upstream branch
- `commits:N` — commits made on this branch since the session started
- `✓ clean` — no dirty files and in sync with upstream
- `pushed` — no ahead/behind divergence, upstream configured
- `no upstream` — branch has no tracking upstream

Not a git repository: the status entry is cleared.

## How it works

Uses `git status --porcelain=v2 --branch`, `git rev-parse HEAD`, and `git rev-list --count` via `pi.exec`, scoped to the session's working directory. No state persists outside the running session; each new session recomputes its own dirty-file baseline and start commit.

## Requirements

- `git` available on `PATH`
- pi `>=0.70` (uses `ctx.ui.setStatus`)

## License

MIT
