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-26 10:49:57 +00:00
1 parent fe372a6abc
commit 21ebbce024
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.