docs/jujutsu: Explain the fork and its workflows

Describe the controls, the commands behind them and the source
files to consult. Record the fork update process and the remaining
trial checks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jackos1998andClaude Opus 5.5 committed 2026-11-24 22:56:42 +00:00
1 parent db0fa03514
commit b9518180f0
3 files changed
+284 -1

No files matched your search

+50
View File
@@ -77,6 +77,56 @@ server to capability-aware sessions. It deliberately does not use the broad recu
watcher or the per-session Git observer: those are checkout/status mechanisms and intentionally do
not retain non-Git directories.
See [Maintaining the Paseo Jujutsu fork](jujutsu-fork.md) for a feature and source guide.
Colocated Jujutsu checkouts reuse Git checkout placement and ownership, with Jujutsu
providing revision facts and working-copy diffs. Checkout providers dispatch
those reads, and status advertises the actions available for the detected VCS.
Existing `isGit` payload variants still describe the underlying Git checkout, so a
Jujutsu checkout reports `currentBranch: null` (Git sees a detached HEAD) and carries
its identity separately: checkout status has `jujutsu` (change and commit IDs,
description, bookmarks, conflicts, and the nearest bookmark under `@`), workspace
descriptors carry `gitRuntime.jujutsu` (change ID and bookmarks), and commit list
entries carry `jujutsu` with `shortSha` holding the short change ID. All are optional
fields, so older clients ignore them. Git mutation guards run on the daemon for
clients that lack VCS capabilities; discard is the exception and runs `jj restore` on
the given paths.
Paseo serializes Jujutsu actions per repository and checks the expected change
ID before applying change-specific actions. Fetch uses the configured base remote
when the base names one and otherwise follows Jujutsu's default or configured remotes.
`new` may name a parent bookmark or change, which must resolve to exactly one commit.
Publication passes an exact bookmark to `jj`. Forge adapters receive bookmark names
and published commit IDs, since colocated Git HEAD usually points to the parent of
the working-copy change. Change search (`checkout.jujutsu.changes`) runs a fixed
revset over mutable changes, bookmarks and recent trunk history; the user's query
only reaches `jj` as string literals or ID prefixes, never as revset syntax.
A Jujutsu workspace records its base by name: the bookmark or remote bookmark it
was created from, or the source change's ID when created from `@`. The base commit
recorded on creation or base selection provides a fallback if that name no longer
resolves. Diffs and the
commit list compare from `fork_point(base | @)`, the counterpart of Git's merge
base, so a base that moves after a fetch doesn't appear reverted.
Jujutsu metadata reads use `--ignore-working-copy`. Diff and commit-list reads use
`--no-integrate-operation`: they snapshot into an unintegrated operation to include
edits on disk without advancing the shared operation head or updating working-copy
files or Git refs. These reads still write objects and unintegrated operations;
normal Jujutsu garbage collection reclaims them. A row from an unintegrated snapshot
carries its operation ID so file diffs can reopen the same revision with `jj --at-op`.
When the read also imports Git refs, jj prints a second operation on top of the
snapshot; Paseo keeps the last one, which sees both.
Using Jujutsu for the file read keeps merge and conflict diffs consistent with the list.
Observe the shared repository's
`op_heads/heads` directory, not its object store, to avoid refresh feedback loops.
Jujutsu archive snapshots the working-copy change and records the exact revision
for recovery. A Git retention ref protects it from Git garbage collection. After
the last active workspace is archived, Paseo verifies the saved snapshot before
using `jj workspace remove` to release both registrations and remove the directory.
Restore recreates the checkout at the saved revision. Files excluded from the
Jujutsu snapshot, such as ignored scratch files, are lost when the directory is removed.
Workspace git and forge runtime data belongs to one daemon-level, directory-keyed store.
Workspace descriptors, checkout diff subscriptions, and script metadata read the last known
snapshot from that store, so reconnecting clients receive it before refresh completes.
+148
View File
@@ -0,0 +1,148 @@
# Maintaining the Paseo Jujutsu fork
Start with the [workspace guide](../public-docs/workspaces.md#jujutsu-repositories)
for the controls you can use in Paseo. This page explains what those controls do
behind the scenes, where to look when something breaks and how to carry the
changes forward.
## Two meanings of workspace
A **Paseo workspace** is a task with a directory and tabs for agents, terminals and
other tools. A **Jujutsu workspace** is a directory with its own working-copy
change, called `@`, in a shared Jujutsu repository. Several Paseo tasks can use
the same directory. Several Jujutsu directories can share the same history and
bookmarks while each has its own `@`.
The daemon expects a colocated checkout with both `.jj` and `.git`. Use Jujutsu
0.47.1, the version used in the trial and CI. Paseo uses Git for repository
location, worktree discovery and forge integration. It uses `jj` for changes,
diffs and checkout mutations. Git often sees a detached HEAD in these directories.
That is expected, and Git's HEAD commonly points at the parent of the change you
see in Paseo.
## What the fork adds
| In Paseo | What happens on the daemon host |
| ------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **New jj workspace** | Runs `jj workspace add --colocate` and creates a fresh working-copy change on the selected base. Pick `@` to include current work. **Existing jj workspace** opens a directory already registered in the repository. |
| **All changes** and **Working copy (@)** | Shows task changes since the fork point or only the current change. Discard in the working-copy view restores the chosen file to its parent content. For a merge, Jujutsu computes the merged parent content. |
| **Changes** list and **Start new change on…** | The list shows task history and a slice of base history. The picker searches beyond the active workspace. Selecting a result creates a child of that change and leaves the previous change in the repository. |
| **Describe**, **New change** and **Fetch** | Runs `jj describe`, `jj new` and `jj git fetch`. Fetch follows the base's remote when applicable. The terminal remains the place for rebase, squash and other general Jujutsu operations. |
| **Publish bookmark** and **Create pull request** | Pushes the named bookmark through `jj` and uses the existing forge adapter for the pull request. The app publishes to `origin`. The CLI can publish to a named remote with `--remote`. |
| **Archive** and **Restore** | Saves the exact change before removing a Paseo-created checkout. Restore reopens that change at the same path. Save any ignored files separately before archiving. |
## How the pieces fit together
The **daemon** is the background server on the box with your files. The **app**
and **CLI** send it requests through a WebSocket. The **protocol** defines the
shape of each request and reply, and the **client** package provides functions
the app and CLI can call. For example, **Describe** sends the checkout path,
the expected change ID and the new description. The daemon checks the change ID,
runs `jj describe`, and schedules a refresh.
| Start here | What you find there |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| [Checkout provider](../packages/server/src/utils/checkout-vcs.ts) and [Jujutsu commands](../packages/server/src/utils/checkout-jj.ts) | Detect the VCS and translate checkout reads into Git or Jujutsu commands. Detection stops at a nested repository boundary. |
| [Checkout session](../packages/server/src/server/session/checkout/checkout-session.ts), [protocol](../packages/protocol/src/messages.ts) and [client](../packages/client/src/daemon-client.ts) | Request handling and the data passed between the daemon and its clients. Search the files for `checkout.jujutsu`. |
| [Actions and publication](../packages/server/src/utils/jujutsu-actions.ts) and [CLI commands](../packages/cli/src/commands/workspace/jujutsu.ts) | The daemon's implementation of Describe, New, Fetch and Publish, the hand-off to the forge, and the CLI flags. |
| [Action policy](../packages/app/src/git/policy.ts), [action forms](../packages/app/src/git/jujutsu-actions.tsx) and [change picker](../packages/app/src/git/jujutsu-change-switcher.tsx) | The menu rules, text fields and search UI. TypeScript files ending in `.tsx` contain UI components. |
| [New workspace picker](../packages/app/src/screens/new-workspace-picker-item.ts), [creation service](../packages/server/src/server/worktree-core.ts) and [worktree utilities](../packages/server/src/utils/worktree.ts) | How the app picks a base, how the daemon chooses a directory and where it splits into Git worktree or Jujutsu workspace creation. |
| [Archive service](../packages/server/src/server/workspace-archive-service.ts) and [recovery service](../packages/server/src/server/session/workspace-recovery/workspace-recovery-service.ts) | When a checkout can be removed, what is kept in the persisted workspace record and how it is used on restore. |
### Bases, diffs and change IDs
A bookmark can move. Paseo saves its name so the comparison follows it, along
with the commit it pointed to when the base was selected as a fallback. When
starting from `@`, Paseo records the source change ID, which survives ordinary
rewrites. The comparison uses `fork_point(base | @)`. If your base moves forward
after a fetch, the diff still starts at the shared history and shows your work
without listing the upstream changes as removals.
A change ID follows a logical change as it is edited. A commit ID identifies one
version of it. The change picker uses an exact ref or commit ID so it can select
one result even when a Jujutsu change has diverged into multiple versions. The
picker searches mutable changes, bookmarked changes and recent trunk history,
with a bounded result list.
To include unrecorded edits, a diff or Changes list asks `jj` to snapshot in an
unintegrated operation. The command can see those edits without advancing the
repository's shared operation head. The operation ID on a Changes row lets Paseo
reopen the exact snapshot when you click a file. If that command also imports Git
refs, Paseo uses the final operation, which sees both the snapshot and the
imported commits. Open Changes again if garbage collection has removed the old
operation. See [daemon architecture](architecture.md#packagesserver--the-daemon)
for more about checkout observation and protocol compatibility.
### Config inheritance and recovery
`paseo.json` can configure setup commands and terminals. A new checkout keeps
its own copy if its selected revision includes one. When that file is absent, a
Git worktree tries the original repository first and then the selected checkout.
A Jujutsu workspace copies from the selected checkout only. This lets a task
based on one Jujutsu workspace inherit the local config from that workspace.
For archive, the daemon integrates a snapshot, saves its commit ID in the
Paseo workspace record and creates a Git ref under `refs/paseo/kept-commits/` to
keep the commit available for recovery. It checks ownership, active references
and whether tracked content has changed since the snapshot before asking
`jj workspace remove` to remove the directory and its registrations. It also
uses the upstream linked-worktree check to keep the directory if it contains a
nested linked Git worktree. User-created checkouts stay on disk. If the saved
checkout is missing, restore adds a workspace and edits the exact saved commit.
Retention refs accumulate, as they do for Git worktrees.
## Carrying the fork forward
The local series has a standalone fix for the detached-HEAD base picker, followed
by the Jujutsu daemon and protocol support, the CLI commands, the app controls
and the documentation. The daemon commit keeps creation, diff semantics and
archive safety together because they share the same checkout and persistence
code. The app and CLI both call that interface.
Keep a record of the upstream commit your fork starts from. For a new upstream
release, create an update branch and replay the fork on the chosen upstream
revision. For example, with full upstream history available:
```bash
git branch fork/jujutsu-update fork/jujutsu
git rebase --onto <new-upstream-revision> <old-upstream-base> fork/jujutsu-update
git range-diff <old-upstream-base>..fork/jujutsu <new-upstream-revision>..fork/jujutsu-update
```
The likely conflict points are the shared workspace lifecycle, checkout
status and diff data, and the new-workspace screen. Keep Git's behavior at those
boundaries and follow the new upstream call path before resolving a conflict.
The worktree manager plugin API introduced in Paseo 0.17 prepares and validates
Git targets. Route Jujutsu creation and recovery directly through the built-in
Jujutsu paths so a configured Git manager can coexist with checkout from `@`.
Both use the daemon's shared archive and restore coordination.
Build the protocol and client before typechecking the daemon, app or CLI so they
all see the new request types. For example:
```bash
npm run build:client
npm run typecheck --workspace=@getpaseo/server
npm run typecheck --workspace=@getpaseo/app
npm run typecheck --workspace=@getpaseo/cli
npm exec --workspace=@getpaseo/server -- vitest run --maxWorkers=1 \
src/server/daemon-e2e/git-operations.e2e.test.ts -t 'Jujutsu'
```
## Review findings and trial checks
- Open the web UI against a trial daemon with its own Paseo home. Create a Jujutsu
workspace, select another change in the picker, open a file diff, discard a
disposable edit, then archive and restore the workspace. Repeat creation and
archive in a plain Git repository.
- Test **Publish bookmark** and **Create pull request** against a disposable repo
on the forge you actually use. The trial's local bare Git remote can exercise
pushes. Live forge creation and status still need an interactive pass.
- Use an `origin` remote for the app's publication and pull request workflow.
Fetch can choose a different base remote, and the CLI can explicitly publish
to one. Pull request status looks for a single matching published bookmark on
`origin`.
- If a long fetch or push repeatedly delays diffs in unrelated repositories,
inspect the two-command daemon-wide limit in
[checkout-jj.ts](../packages/server/src/utils/checkout-jj.ts). Reproduce any
contention before changing how the daemon schedules Jujutsu commands.
+86 -1
View File
@@ -45,7 +45,92 @@ When you create a workspace, **Isolation** sets the directory it works in:
- **New worktree** creates a git worktree with its own directory and branch. Use it when a task needs its own copy of the files.
- **Existing worktree** uses a git worktree that is already on disk, on the branch it has checked out. Use it to continue work on a branch without a second copy. The list shows every git worktree of the repository, including the ones that Paseo did not create.
The workspace is the product concept; a git worktree is one way to isolate its files. More than one workspace can use the same worktree. Paseo removes a worktree that it created after the last workspace that uses it is archived. Paseo does not remove a worktree that it did not create.
The workspace is the product concept; a git worktree is one way to isolate its files. More than one workspace can use the same worktree. Paseo removes a Git worktree or Jujutsu checkout that it created after the last active workspace using it is archived. User-created checkouts stay on disk.
## Jujutsu repositories
Use Jujutsu 0.46 or newer on the daemon host; this integration is tested with
0.47.1. Open a colocated checkout, which has both `.jj` and `.git`. To enable
colocation in an existing Jujutsu checkout, run `jj git colocation enable` there.
### Changes
Where a Git workspace shows its branch, a Jujutsu workspace shows its working-copy
change: its bookmark, or its short change ID when it has none. The sidebar and the
Changes header use the same label. Pick it in the Changes header to **start a new
change on** a bookmark or a change elsewhere in the repository (`jj new`). The search
covers mutable changes, bookmarked changes and recent trunk history. Search by
description, bookmark name or a change or commit ID prefix. The change you were on
keeps its work.
The diff shows **All changes** since the base, or just the **Working copy (@)**.
Both include edits on disk that Jujutsu hasn't recorded yet. Comparisons start at
the point where the workspace left its base, so a base that moves on (for example
after a fetch) doesn't show its newer changes as reverted. The **Changes** list
under the diff shows the workspace's changes since the base, newest first, with
their bookmarks and working-copy, empty and conflict markers; select one to see its
diff. In the **Working copy (@)** view, discarding a file runs `jj restore` on it,
putting it back as it is in the parent change.
### Actions
The workspace actions button offers the Jujutsu actions in place of commit, pull and
push. It leads with **Describe** until the current change has a description, then
with **Publish bookmark**.
- **Describe** edits the current change's description.
- **New change** starts a child of the current change.
- **Fetch** runs `jj git fetch`, updating remote bookmarks such as `main@origin`.
Fetch uses the base bookmark's remote when the base names one. Otherwise it uses
your Jujutsu fetch configuration. Paseo doesn't fetch in the background.
- **Publish bookmark** creates the named bookmark at the current change if needed
and pushes it to `origin`.
- **Create pull request** publishes the selected existing bookmark and opens a
request against the base you choose. It appears when the remote has a supported
forge. Paseo shows the request's status when one published bookmark identifies the
current change.
- **Archive** works as for any workspace (see below).
Use the terminal for operations such as rebase or squash.
### New Jujutsu workspaces
When the project uses Jujutsu, **New jj workspace** creates a colocated Jujutsu
workspace sharing the source repository. The app prefers the closest bookmark
under your working copy and falls back to the repository's default bookmark.
If there is no default bookmark, the base is **Current change (@)**, which
includes edits on disk. Pick another base to start from a different change. Paseo
records the base by the bookmark's name (or, for `@`, the change it pointed to).
If the bookmark disappears, Paseo marks it missing and compares against the saved
base commit while it is available. Choose a new bookmark to update the comparison.
Each isolated workspace has its own working-copy change. Opening an existing change
uses **Project directory** or **Existing jj workspace**; checking out a branch or pull
request into a new Jujutsu workspace is not supported yet.
### Archive and restore
Archiving stops the workspace sessions and saves the exact working-copy change,
including edits that Jujutsu can snapshot. Paseo removes its checkout and
Jujutsu registration when the last active workspace using the checkout is archived.
Paseo keeps the directory if it contains another linked Git worktree. Restore
reuses a checkout that stayed on disk or recreates it at the saved change.
Copy any ignored files you want to keep before archiving. Ignored files are
deleted with the checkout.
### CLI
The CLI exposes the same actions as `paseo workspace jj`. For example:
```bash
paseo workspace jj describe --description "Fix login"
paseo workspace jj new --parent main
paseo workspace jj fetch
paseo workspace jj publish --bookmark fix-login --create
paseo workspace jj create-pull-request --bookmark fix-login --base main --title "Fix login"
```
When creating a Jujutsu workspace with `paseo workspace create`, omitting
`--base` uses the repository's default bookmark if available and `@` otherwise.
## Creating a workspace