Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

feat: Add Rust project and mock CI demo

Maximilian Roos59ab6129efe8
diff --git a/.claude-plugin/skills/worktrunk/reference/README.md b/.claude-plugin/skills/worktrunk/reference/README.md
index 9e86c4957..bdb1187b4 100644
--- a/.claude-plugin/skills/worktrunk/reference/README.md
+++ b/.claude-plugin/skills/worktrunk/reference/README.md
@@ -18,6 +18,8 @@ colliding; each agent gets a separate directory with a version of the code. But
creating worktrees, tracking paths & statuses, cleaning up, etc, is manual.
Worktrunk offers control, transparency & automation for this workflow.
+![Worktrunk Demo](scripts/wt-demo/out/wt-demo.gif)
+
## Quick Start
**Create a worktree:**
diff --git a/.gitignore b/.gitignore
index 71b641e38..a5e0714b9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
/target
scripts/wt-demo/out/
+!scripts/wt-demo/out/wt-demo.gif
# Lychee link checker cache
.lycheecache
diff --git a/README.md b/README.md
index 9e86c4957..bdb1187b4 100644
--- a/README.md
+++ b/README.md
@@ -18,6 +18,8 @@ colliding; each agent gets a separate directory with a version of the code. But
creating worktrees, tracking paths & statuses, cleaning up, etc, is manual.
Worktrunk offers control, transparency & automation for this workflow.
+![Worktrunk Demo](scripts/wt-demo/out/wt-demo.gif)
+
## Quick Start
**Create a worktree:**
diff --git a/scripts/wt-demo-build.sh b/scripts/wt-demo-build.sh
index 84001223c..fcd4c1ab9 100755
--- a/scripts/wt-demo-build.sh
+++ b/scripts/wt-demo-build.sh
@@ -5,15 +5,15 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
DEMO_DIR="$SCRIPT_DIR/wt-demo"
OUT_DIR="$DEMO_DIR/out"
-DEMO_ROOT="${DEMO_ROOT:-$OUT_DIR/demo}"
+DEMO_HOME="${DEMO_HOME:-$DEMO_ROOT}"
LOG="$OUT_DIR/record.log"
TAPE_TEMPLATE="$DEMO_DIR/demo.tape"
TAPE_RENDERED="$OUT_DIR/.rendered.tape"
STARSHIP_CONFIG_PATH="$OUT_DIR/starship.toml"
OUTPUT_GIF="$OUT_DIR/wt-demo.gif"
BARE_REMOTE=""
-DEMO_CONTAINER=""
DEMO_REPO=""
+DEMO_WORK_BASE=""
cleanup() {
rm -f "$TAPE_RENDERED"
@@ -29,7 +29,7 @@ require_bin() {
write_starship_config() {
mkdir -p "$(dirname "$STARSHIP_CONFIG_PATH")"
cat >"$STARSHIP_CONFIG_PATH" <<'CFG'
-format = "$directory$git_branch$git_status$cmd_duration$character"
+format = "$directory$character"
palette = "gh_light"
[palettes.gh_light]
@@ -64,7 +64,8 @@ untracked = "?"
[cmd_duration]
min_time = 500
-format = " [⏱ $duration]($style)"
+# Keep duration but drop the timer icon to reduce prompt noise.
+format = " [$duration]($style)"
style = "fg:muted"
[character]
@@ -84,8 +85,11 @@ prepare_repo() {
rm -rf "$REPO_ROOT/.demo"
fi
mkdir -p "$DEMO_ROOT"
- DEMO_CONTAINER="$(mktemp -d "$DEMO_ROOT/session-XXXXXXXX")"
- DEMO_REPO="$DEMO_CONTAINER/wt-demo"
+ export HOME="$DEMO_HOME"
+ DEMO_WORK_BASE="$HOME/w"
+ rm -rf "$DEMO_WORK_BASE"
+ mkdir -p "$DEMO_WORK_BASE"
+ DEMO_REPO="$DEMO_WORK_BASE/acme"
mkdir -p "$DEMO_REPO"
export DEMO_REPO
@@ -93,6 +97,8 @@ prepare_repo() {
git init --bare -q "$BARE_REMOTE"
git -C "$DEMO_REPO" init -q
+ git -C "$DEMO_REPO" config user.name "Worktrunk Demo"
+ git -C "$DEMO_REPO" config user.email "[email protected]"
printf "# Worktrunk demo\n\nThis repo is generated automatically.\n" >"$DEMO_REPO/README.md"
git -C "$DEMO_REPO" add README.md
SKIP_DEMO_HOOK=1 git -C "$DEMO_REPO" commit -qm "Initial demo commit"
@@ -100,13 +106,113 @@ prepare_repo() {
git -C "$DEMO_REPO" remote add origin "$BARE_REMOTE"
git -C "$DEMO_REPO" push -u origin main -q
- # Add a visible git hook to prove hooks run during commits/merges.
-cat >"$DEMO_REPO/.git/hooks/pre-commit" <<'HOOK'
+# Create a simple Rust project with tests
+ cat >"$DEMO_REPO/Cargo.toml" <<'CARGO'
+[package]
+name = "acme"
+version = "0.1.0"
+edition = "2021"
+CARGO
+ cat >"$DEMO_REPO/rust-toolchain.toml" <<'TOOLCHAIN'
+[toolchain]
+channel = "stable"
+TOOLCHAIN
+ mkdir -p "$DEMO_REPO/src"
+ cat >"$DEMO_REPO/src/lib.rs" <<'RUST'
+pub fn add(a: i32, b: i32) -> i32 {
+ a + b
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn test_add() {
+ assert_eq!(add(2, 2), 4);
+ }
+
+ #[test]
+ fn test_add_negative() {
+ assert_eq!(add(-1, 1), 0);
+ }
+}
+RUST
+ echo "/target" >"$DEMO_REPO/.gitignore"
+ git -C "$DEMO_REPO" add .gitignore Cargo.toml rust-toolchain.toml src/
+ SKIP_DEMO_HOOK=1 git -C "$DEMO_REPO" commit -qm "Add Rust project with tests"
+ # Pre-build to create Cargo.lock and cache dependencies
+ (cd "$DEMO_REPO" && cargo build --release -q 2>/dev/null)
+ git -C "$DEMO_REPO" add Cargo.lock
+ SKIP_DEMO_HOOK=1 git -C "$DEMO_REPO" commit -qm "Add Cargo.lock"
+ git -C "$DEMO_REPO" push -q
+
+ # Add worktrunk project hooks
+ mkdir -p "$DEMO_REPO/.config"
+ cat >"$DEMO_REPO/.config/wt.toml" <<'TOML'
+[pre-merge-command]
+test = "cargo nextest run --no-fail-fast"
+TOML
+ git -C "$DEMO_REPO" add .config/wt.toml
+ SKIP_DEMO_HOOK=1 git -C "$DEMO_REPO" commit -qm "Add project hooks"
+ git -C "$DEMO_REPO" push -q
+
+ # Create mock gh CLI for CI status
+ mkdir -p "$DEMO_HOME/bin"
+ cat >"$DEMO_HOME/bin/gh" <<'GH'
#!/usr/bin/env bash
-[ -n "$SKIP_DEMO_HOOK" ] && exit 0
-echo "🔧 pre-commit hook: running quick checks"
-HOOK
- chmod +x "$DEMO_REPO/.git/hooks/pre-commit"
+# Mock gh CLI for demo
+
+if [[ "$1" == "auth" && "$2" == "status" ]]; then
+ exit 0
+fi
+
+if [[ "$1" == "pr" && "$2" == "list" ]]; then
+ branch=""
+ for arg in "$@"; do
+ if [[ "$prev" == "--head" ]]; then
+ branch="$arg"
+ fi
+ prev="$arg"
+ done
+
+ case "$branch" in
+ feature/alpha)
+ echo '[{"state":"OPEN","headRefOid":"abc123","mergeStateStatus":"CLEAN","statusCheckRollup":[{"status":"COMPLETED","conclusion":"SUCCESS"}],"url":"https://github.com/acme/demo/pull/1"}]'
+ ;;
+ feature/beta)
+ echo '[{"state":"OPEN","headRefOid":"def456","mergeStateStatus":"CLEAN","statusCheckRollup":[{"status":"IN_PROGRESS","conclusion":null}],"url":"https://github.com/acme/demo/pull/2"}]'
+ ;;
+ feature/hooks)
+ echo '[{"state":"OPEN","headRefOid":"ghi789","mergeStateStatus":"CLEAN","statusCheckRollup":[{"status":"COMPLETED","conclusion":"FAILURE"}],"url":"https://github.com/acme/demo/pull/3"}]'
+ ;;
+ *)
+ echo '[]'
+ ;;
+ esac
+ exit 0
+fi
+
+if [[ "$1" == "run" && "$2" == "list" ]]; then
+ echo '[]'
+ exit 0
+fi
+
+exit 1
+GH
+ chmod +x "$DEMO_HOME/bin/gh"
+
+ # Set up user config with LLM and pre-approved commands
+ local project_id="${BARE_REMOTE%.git}"
+ mkdir -p "$DEMO_HOME/.config/worktrunk"
+ cat >"$DEMO_HOME/.config/worktrunk/config.toml" <<TOML
+[commit-generation]
+command = "llm"
+args = ["-m", "claude-haiku-4.5"]
+
+[projects."$project_id"]
+approved-commands = ["cargo nextest run --no-fail-fast"]
+TOML
# Create two extra branches (no worktrees) for listing.
git -C "$DEMO_REPO" branch docs/readme
@@ -119,7 +225,7 @@ HOOK
create_branch_and_worktree() {
local branch="$1" label="$2" line="$3"
- local path="$DEMO_CONTAINER/wt-demo.${branch//\//-}"
+ local path="$DEMO_WORK_BASE/acme.${branch//\//-}"
git -C "$DEMO_REPO" checkout -q -b "$branch" main
printf "%s\n" "$line" >>"$DEMO_REPO/notes.txt"
git -C "$DEMO_REPO" add notes.txt
@@ -147,6 +253,8 @@ create_branch_and_worktree() {
render_tape() {
sed \
-e "s|{{DEMO_REPO}}|$DEMO_REPO|g" \
+ -e "s|{{DEMO_HOME}}|$DEMO_HOME|g" \
+ -e "s|{{REAL_HOME}}|$HOME|g" \
-e "s|{{STARSHIP_CONFIG}}|$STARSHIP_CONFIG_PATH|g" \
-e "s|{{OUTPUT_GIF}}|$OUTPUT_GIF|g" \
"$TAPE_TEMPLATE" >"$TAPE_RENDERED"
@@ -155,9 +263,14 @@ render_tape() {
record_text() {
mkdir -p "$OUT_DIR"
DEMO_RAW="$OUT_DIR/run.raw.txt"
+ local real_home="$HOME"
env DEMO_REPO="$DEMO_REPO" RAW_PATH="$DEMO_RAW" bash -lc '
set -o pipefail
export LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8
+ export RUSTUP_HOME="'"$real_home"'/.rustup"
+ export CARGO_HOME="'"$real_home"'/.cargo"
+ export HOME="'"$DEMO_HOME"'"
+ export PATH="$HOME/bin:$PATH"
export STARSHIP_CONFIG="'"$STARSHIP_CONFIG_PATH"'"
export STARSHIP_CACHE="'"$DEMO_ROOT"'"/starship-cache
mkdir -p "$STARSHIP_CACHE"
@@ -169,7 +282,7 @@ record_text() {
cd "$DEMO_REPO"
{
wt list --branches --full
- wt switch --create feature/reports --base main
+ wt switch --create feature/reports
echo "- Q4 report ready" >> notes.md
wt merge
wt list --branches --full
diff --git a/scripts/wt-demo/CLAUDE.md b/scripts/wt-demo/CLAUDE.md
new file mode 100644
index 000000000..17259e18d
--- /dev/null
+++ b/scripts/wt-demo/CLAUDE.md
@@ -0,0 +1,37 @@
+# Demo Recording
+
+## Running the Demo
+
+Build and record the demo GIF:
+
+```bash
+./scripts/wt-demo-build.sh
+```
+
+This creates:
+- `scripts/wt-demo/out/wt-demo.gif` - The animated demo
+- `scripts/wt-demo/out/run.txt` - Text log of the output
+
+## Viewing Results
+
+**Do NOT use `open` on the GIF** - that's for the user to do manually.
+
+To inspect what the demo produces:
+- Read `scripts/wt-demo/out/run.txt` to see the text output
+- The GIF can be viewed in a browser or image viewer by the user
+
+Claude Code cannot view GIFs directly. Use `run.txt` for verification.
+
+## Prerequisites
+
+- `wt` (worktrunk) installed and in PATH
+- `vhs` for recording
+- `starship` for prompt
+- `llm` CLI with Claude model configured (for commit message generation)
+- `cargo-nextest` for running tests
+
+## Files
+
+- `demo.tape` - VHS tape file with recording script
+- `wt-demo-build.sh` - Build script that sets up demo repo and records
+- `out/` - Output directory (gitignored)
diff --git a/scripts/wt-demo/demo.tape b/scripts/wt-demo/demo.tape
index 4b5bacc70..06921debe 100644
--- a/scripts/wt-demo/demo.tape
+++ b/scripts/wt-demo/demo.tape
@@ -3,12 +3,12 @@ Output "{{OUTPUT_GIF}}"
Require wt
Require git
-Set Shell "bash"
+Set Shell "zsh"
Set FontSize 19
-Set FontFamily "Menlo, SF Mono, JetBrains Mono, Consolas, Apple Color Emoji"
+Set FontFamily "Geist Mono, Berkeley Mono, Fira Code, JetBrains Mono, Menlo, Apple Color Emoji"
Set Width 1280
Set Height 720
-Set Theme { "name": "GitHub Light Custom", "black": "#24292f", "red": "#d73a49", "green": "#22863a", "yellow": "#d29922", "blue": "#0969da", "magenta": "#8250df", "cyan": "#1b7c83", "white": "#6e7781", "brightBlack": "#57606a", "brightRed": "#cb2431", "brightGreen": "#2ea043", "brightYellow": "#f2cc60", "brightBlue": "#218bff", "brightMagenta": "#a475f9", "brightCyan": "#39c5cf", "brightWhite": "#1f2328", "background": "#ffffff", "foreground": "#1f2328", "cursor": "#0969da", "selection": "#ddf4ff" }
+Set Theme { "name": "GitHub Light Custom", "black": "#8c959f", "red": "#d73a49", "green": "#22863a", "yellow": "#d29922", "blue": "#0969da", "magenta": "#8250df", "cyan": "#1b7c83", "white": "#8c959f", "brightBlack": "#8c959f", "brightRed": "#cb2431", "brightGreen": "#2ea043", "brightYellow": "#f2cc60", "brightBlue": "#218bff", "brightMagenta": "#a475f9", "brightCyan": "#39c5cf", "brightWhite": "#1f2328", "background": "#ffffff", "foreground": "#1f2328", "cursor": "#0969da", "selection": "#ddf4ff" }
Set Padding 18
Set LineHeight 1.12
Set TypingSpeed 28ms
@@ -16,14 +16,19 @@ Set CursorBlink false
Set Framerate 30
Env DEMO_REPO "{{DEMO_REPO}}"
+Env RUSTUP_HOME "{{REAL_HOME}}/.rustup"
+Env CARGO_HOME "{{REAL_HOME}}/.cargo"
+Env HOME "{{DEMO_HOME}}"
Env STARSHIP_CONFIG "{{STARSHIP_CONFIG}}"
Hide
Type "export LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8"
Enter
-Type 'eval "$(starship init bash)" >/dev/null 2>&1'
+Type "export PATH=$HOME/bin:$PATH"
Enter
-Type 'eval "$(wt init bash)" >/dev/null 2>&1'
+Type 'eval "$(starship init zsh)" >/dev/null 2>&1'
+Enter
+Type 'eval "$(wt init zsh)" >/dev/null 2>&1'
Enter
Type "cd $DEMO_REPO"
Enter
@@ -31,11 +36,11 @@ Type "clear"
Enter
Show
-Type "wt list --branches --full"
+Type "wt list"
Enter
Sleep 1.6s
-Type "wt switch --create feature/reports --base main"
+Type "wt switch --create feature/reports"
Enter
Sleep 1.6s
@@ -45,12 +50,13 @@ Sleep 0.8s
Type "wt merge"
Enter
-Sleep 2.2s
+Sleep 8s
Type "wt list --branches --full"
Enter
Sleep 1.5s
+Sleep 3s
Type "exit"
Enter
Sleep 700ms