vcs-jj — automate Jujutsu from Rust
Part of the vcs-toolkit-rs workspace.
What you can do: working-copy status & the change log, describe/new change,
bookmarks, the operation log (restore/undo), workspaces, squash/split/absorb/
duplicate/abandon, diff & template queries, git sync (fetch/push/clone/import),
parse & resolve jj's native conflict markers, and transactions that roll the op log
back on error — all as typed, repo-scoped async methods over the jj binary,
behind a mockable interface.
How it works: each call runs the real jj (its exact behaviour and config) and
parses the templated output into typed values. Commands run inside an OS job (an
OS-level container that kills the whole process tree if your program exits, via
processkit) so no jj subprocess is ever orphaned; calls return the structured
Error and honour an optional timeout.
Remote auth is ambient. Unlike vcs-git (which takes a per-operation
CredentialProvider), jj's in-process git backend has no per-invocation credential
override, so jj git fetch/push use the ambient git credential helpers / SSH
agent — configure those out of band.
📖 Full guide: on docs.rs — every command by theme, result types, builder/newtype APIs, and worked examples.
Every method is async, so call it from a tokio runtime:
use Path;
use ;
let jj = new;
let head = jj.current_change.await?; // Change
jj.describe.await?; // set @ description
A change workflow
use Path;
use ;
# async
Bookmarks and syncing the git remote
# use Path;
# use ;
# async
Workspaces
Manage workspaces (jj's worktrees) with structured results:
use ;
use Path;
# async
Timeouts
# use Jj;
use Duration;
let jj = new.default_timeout;
// every command now fails with `processkit::Error::Timeout` if it outruns 10s
# let _ = jj;
Consumers depend on the JjApi trait and substitute a fake in tests — enable
the mock feature for a mockall-generated MockJjApi, or inject a fake
process runner with Jj::with_runner(processkit::testing::ScriptedRunner::new()…):
use ;
use Path;
use ;
# async
Requires the jj binary on PATH.
License
MIT