repositories / pi-ext

pi-ext

bugabingas pi extensions

owned by bugabinga

extensions/vcs-status/README.md

Raw

vcs-status

Pi workspace VCS telemetry for Git and Jujutsu.

Install / load

Loaded through root pi-ext package. See root README.

Commands / tools / settings

Behavior

Shows current working directory and VCS identity/status in UI sessions. The cwd label collapses $HOME to ~.

Detection:

Git branch comes from the detected Git dir HEAD. Dirty/ahead/stash status comes from porcelain v2. Detached HEAD shows HEAD.

Jujutsu status comes from jj log -r @ with --ignore-working-copy, so refresh does not snapshot the working copy. It shows current change id, local bookmarks, and flags:

If jj is missing in a detected jj repo, the VCS label is ?. Other jj command failures suppress the VCS label.

Git indicators:

With @bugabinga/pi-ext-footer loaded, emits footer:segment entries:

Without footer support, falls back to Pi status text keys:

When footer support is present, old cwd and vcs status text keys are cleared before footer segments are emitted. Without footer support, footer segments are cleared before status text is set.

Non-VCS dirs show cwd only. Status refreshes on session start, agent end, and tool execution end. Git and jj commands time out after 2500 ms. Segments/status keys are cleared on session shutdown.

Markdown source
File outline
# vcs-status

Pi workspace VCS telemetry for Git and Jujutsu.

## Install / load

Loaded through root `pi-ext` package.
See [root README](../../README.md).

## Commands / tools / settings

- Pi commands:
  none
- Pi tools:
  none
- Settings:
  none
- Hooks:
  `session_start`, `agent_end`, `tool_execution_end`, `session_shutdown`
- Pi events:
  - emits `footer:segment` when `@bugabinga/pi-ext-footer` is loaded
- External commands:
  - `git status --porcelain=2 --branch`
  - `git rev-parse --verify --quiet refs/stash`
  - `jj -R <root> --ignore-working-copy --no-pager --color never log --no-graph
    -r @ -T <json-template>`

## Behavior

Shows current working directory and VCS identity/status in UI sessions.
The cwd label collapses `$HOME` to `~`.

Detection:

- walks from `cwd` to filesystem root
- detects colocated `.jj` + `.git` as `jj`
- detects plain Git through `.git` dirs/files, conventional bare `.git` dirs,
  and `$GIT_DIR`
- detects jj-only repos through `.jj`
- prefers Git over jj-only when a parent Git repo appears first

Git branch comes from the detected Git dir `HEAD`.
Dirty/ahead/stash status comes from porcelain v2.
Detached HEAD shows `HEAD`.

Jujutsu status comes from `jj log -r @` with `--ignore-working-copy`, so refresh
does not snapshot the working copy.
It shows current change id, local bookmarks, and flags:

- `∅` empty change
- `×` conflict
- `≈` divergent

If `jj` is missing in a detected jj repo, the VCS label is `?`.
Other jj command failures suppress the VCS label.

Git indicators:

- `=` conflicted
- `$` stash exists
- `✘` deleted
- `»` renamed
- `!` modified
- `+` staged
- `?` untracked
- `↑` ahead
- `↓` behind
- `⇕` diverged

With `@bugabinga/pi-ext-footer` loaded, emits `footer:segment` entries:

- `cwd`, zone `workspace`, order `0`
- `vcs`, zone `workspace`, order `1`

Without footer support, falls back to Pi status text keys:

- `cwd`
- `vcs`

When footer support is present, old `cwd` and `vcs` status text keys are cleared
before footer segments are emitted.
Without footer support, footer segments are cleared before status text is set.

Non-VCS dirs show cwd only.
Status refreshes on session start, agent end, and tool execution end.
Git and jj commands time out after 2500 ms.
Segments/status keys are cleared on session shutdown.