A small CLI tool to make jj (Jujutsu) workspaces easier to manage.
It helps with jj workspace add and provides a zsh function for moving between workspaces.
jj(Jujutsu) installed: https://github.com/jj-vcs/jj
Install via a Homebrew tap:
brew tap omihirofumi/tap
brew install wwww new [options] <name>
ww go [options] <name>
ww list
ww default
ww init zsh
ww completion zsh
ww help [command]new [options] <name>- Runs
jj workspace addto create a workspace. - Options:
-r, --revision <revision>: revision to use when creating.
- Runs
go [options] <name>- Prints a
cd ...command for the workspace path. - Options:
-c, --create: create workspace if missing.-r, --revision <revision>: revision to use when creating.
- Prints a
list- Shows workspace names from
jj workspace list.
- Shows workspace names from
default- Prints a
cd ...command for the default workspace.
- Prints a
init zsh- Prints a zsh function that interprets
wwoutput.
- Prints a zsh function that interprets
completion zsh- Prints a zsh completion script.
help [command]- Shows help for
wwor a specific command.
- Shows help for
To make ww go actually change directories, add the function to your shell:
eval "$(ww init zsh)"After that, ww go <name> will move your current directory.
ww completion is available (zsh only for now).
ww supports two workspace location strategies:
| Strategy | Path Pattern | Description |
|---|---|---|
sibling (default) |
<repo>__<name> |
Workspace created as sibling directory |
internal |
<repo>/.workspaces/<name> |
Workspace created inside repo |
Configuration is loaded from two locations (per-repo overrides global):
- Global:
~/.config/ww/config.toml - Per-repo:
<repo>/.jj/ww.toml
# Choose workspace location strategy
workspace_location = sibling # or "internal"Global config (~/.config/ww/config.toml):
# Default to internal workspaces for all repos
workspace_location = internalPer-repo override (<repo>/.jj/ww.toml):
# This specific repo uses sibling workspaces
workspace_location = siblingww supports optional hooks that run after workspace operations.
| Hook | Location | Trigger |
|---|---|---|
post-workspace-add |
<repo>/.jj/hooks/post-workspace-add |
After ww new or ww go -c |
post-workspace-forget |
<repo>/.jj/hooks/post-workspace-forget |
After ww forget |
All hooks run with:
- Working directory: Repository root
- Environment variables:
WW_WORKSPACE_NAME: Name of the workspaceWW_WORKSPACE_PATH: Path to the workspace
If a hook fails (non-zero exit), a warning is printed but the command still succeeds.
#!/bin/sh
# .jj/hooks/post-workspace-add
# Copy local config files to new workspace
# Copy .env file if it exists
if [ -f ".env" ]; then
cp .env "$WW_WORKSPACE_PATH/"
fi
# Copy local settings
if [ -f ".vscode/settings.local.json" ]; then
mkdir -p "$WW_WORKSPACE_PATH/.vscode"
cp .vscode/settings.local.json "$WW_WORKSPACE_PATH/.vscode/"
fi#!/bin/sh
# .jj/hooks/post-workspace-forget
# Clean up workspace directory after forgetting
if [ -d "$WW_WORKSPACE_PATH" ]; then
echo "Removing workspace directory: $WW_WORKSPACE_PATH"
rm -rf "$WW_WORKSPACE_PATH"
fiMake sure hooks are executable:
chmod +x .jj/hooks/post-workspace-add
chmod +x .jj/hooks/post-workspace-forgetww new -r @- feature-x
ww list
ww go -c -r @- feature-xUse -h or --help to show help, or ww help <command> for command-specific usage.