[FEATURE] /diff panel: support Jujutsu (jj) working copies
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
The /diff panel reads only git. In a Jujutsu (jj) repository that leaves it either blind or showing git's view of the repository:
- Secondary jj workspaces (
jj workspace add) have a.jj/but no.git.git rev-parsefails there, so/diffreports that the directory isn't in a git repository and opens nothing. This is where we do most of our work: one workspace per change. - The colocated default workspace works by accident: jj keeps git's
HEADat@-, so "uncommitted changes" happen to equal the working-copy change. The comparison bases are still git's (HEAD, the merge-base with the default branch), not jj's (@-,trunk()).
Proposed Solution
Ship a jj backend for the built-in diff mod. The mod already has the slot: INSTALLED_BACKEND_PROBES in mods/diff/hooks/backend/installed-backend-probes.ts ("Where a host adds backends: probes for version-control systems other than git … Empty as shipped"), and backendOf asks those probes before git.
A jj probe could claim a directory where jj root succeeds and map the existing modes:
| Mode | jj |
| --- | --- |
| uncommitted | jj diff --git -r @ (the working-copy change against its parent) |
| branch | jj diff --git --from 'trunk()' --to @ |
| session | jj diff --git --from <commit id of @ at session start> --to @; commit ids are stable, so no mtime heuristics are needed |
jj diff --git prints git-format unified diffs, the format the panel already reads.
Alternative Solutions
- Expose the probe slot to plugins, for example as a noun contract, so a jj backend can live in a plugin. Today only a host compiling the module in can reach it ("there is no other channel").
- Copy
mods/diffinto our own plugin with a jj probe added. That forks an early-access API that may change between releases. - Run
jj diffin the terminal. That loses the live panel, the refresh on edits and attaching lines to the next prompt.
Priority
Medium - Would be very helpful
Feature Category
Interactive mode (TUI)
Use Case Example
- I keep several jj workspaces side by side, one per change under review.
- I start Claude Code in one of them and ask it to change code.
- With jj support,
/diffopens beside the conversation and shows the change growing as Claude edits, compared against@-ortrunk(). - Today it opens nothing in that workspace, so I leave the session to run
jj diff.
Additional Context
- Claude Code 2.1.283, jj 0.45.1, macOS.
- Every jj command snapshots the working copy unless it passes
--ignore-working-copy. The panel's periodic checks (theheadKeyOfpoll) should pass it, or they will record files the user hasn't cleaned up yet, such as build artifacts. - Related jj gaps: #74775 (detecting
.jj/in environment metadata), #85118 (worktree isolation guard and jj).
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗