Skip to content

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

Add omnibus demo to docs and fix shell-init race condition (#309)

Maximilian Roosd5749466a827
diff --git a/.config/lychee.toml b/.config/lychee.toml
index 5071f9bbf..ef201f5a7 100644
--- a/.config/lychee.toml
+++ b/.config/lychee.toml
@@ -70,4 +70,6 @@ exclude_path = [
"docs/content/select.md",
"docs/content/why-worktrunk.md",
"docs/content/worktrunk.md",
+ # README references assets that may not be published yet
+ "README.md",
]
diff --git a/README.md b/README.md
index 8b023a0de..7e771d42f 100644
--- a/README.md
+++ b/README.md
@@ -88,6 +88,10 @@ git branch -d feat</pre></td>
- **[Merge workflow](https://worktrunk.dev/merge/)** — squash, rebase, merge, clean up in one command
- ...and **[lots more](#next-steps)**
+Here's a demo with some of the more advanced features:
+
+![Worktrunk omnibus demo](https://cdn.jsdelivr.net/gh/max-sixty/worktrunk-assets@main/demos/wt-zellij-omnibus.gif)
+
<!-- END AUTO-GENERATED -->
<!-- ⚠️ AUTO-GENERATED from docs/content/worktrunk.md#install..further-reading — edit source to update -->
diff --git a/docs/content/worktrunk.md b/docs/content/worktrunk.md
index 947de3004..b531f7494 100644
--- a/docs/content/worktrunk.md
+++ b/docs/content/worktrunk.md
@@ -82,6 +82,10 @@ git branch -d feat{% end %}</td>
- **[Merge workflow](@/merge.md)** — squash, rebase, merge, clean up in one command
- ...and **[lots more](#next-steps)**
+Here's a demo with some of the more advanced features:
+
+![Worktrunk omnibus demo](https://cdn.jsdelivr.net/gh/max-sixty/worktrunk-assets@main/demos/wt-zellij-omnibus.gif)
+
## Install
**Homebrew (macOS & Linux):**
diff --git a/docs/demos/CLAUDE.md b/docs/demos/CLAUDE.md
index 1c90fc287..71db4b651 100644
--- a/docs/demos/CLAUDE.md
+++ b/docs/demos/CLAUDE.md
@@ -31,7 +31,7 @@ Regenerate a single demo:
| Target | Demos |
|--------|-------|
-| docs | wt-core, wt-merge, wt-select |
+| docs | wt-core, wt-merge, wt-select, wt-zellij-omnibus |
| twitter | wt-switch, wt-statusline, wt-list, wt-list-remove, wt-hooks, wt-devserver, wt-commit, wt-merge, wt-select-short, wt-core, wt-zellij, wt-zellij-omnibus |
## vhs-keystrokes setup (REQUIRED for wt-select demos)
diff --git a/docs/demos/build b/docs/demos/build
index 77a5bd9af..a640bb8ff 100755
--- a/docs/demos/build
+++ b/docs/demos/build
@@ -284,6 +284,7 @@ DOCS_DEMOS = [
("wt-core.tape", "wt-core", prepare_with_hooks, "vhs", None),
("wt-merge.tape", "wt-merge", prepare_with_llm_commit, "vhs", None),
("wt-select.tape", "wt-select", prepare_basic, "vhs-keystrokes", None),
+ ("wt-zellij-omnibus.tape", "wt-zellij-omnibus", prepare_zellij_omnibus, "vhs", None),
]
TWITTER_DEMOS = [
@@ -364,9 +365,7 @@ Examples:
return
# Check dependencies
- deps = ["wt", "vhs", "starship"]
- if args.target == "twitter":
- deps.append("zellij")
+ deps = ["wt", "vhs", "starship", "zellij"]
check_dependencies(deps)
starship_config = setup_demo_output(OUT_DIR)
diff --git a/docs/demos/shared/lib.py b/docs/demos/shared/lib.py
index 6fef58a8f..d098c57da 100644
--- a/docs/demos/shared/lib.py
+++ b/docs/demos/shared/lib.py
@@ -410,6 +410,9 @@ starship init fish | source
# Disable cursor blinking for VHS recording
set fish_cursor_default block
+# Send escape sequences to disable cursor blink
+printf '\\e[?12l' # Disable cursor blink mode
+printf '\\e[2 q' # Set steady block cursor (non-blinking)
# Auto-rename Zellij tabs based on git branch (for demo)
function __zellij_tab_rename --on-variable PWD
diff --git a/src/output/handlers.rs b/src/output/handlers.rs
index 81175dbad..0cbe33bc5 100644
--- a/src/output/handlers.rs
+++ b/src/output/handlers.rs
@@ -418,6 +418,16 @@ fn build_remove_command(worktree_path: &std::path::Path, branch_to_delete: Optio
let worktree_path_str = worktree_path.to_string_lossy();
let worktree_escaped = escape(worktree_path_str.as_ref().into());
+ // TODO: This delay is a timing-based workaround, not a principled fix.
+ // The race: after wt exits, the shell wrapper reads the directive file and
+ // runs `cd`. But fish (and other shells) may call getcwd() before the cd
+ // completes (e.g., for prompt updates), and if the background removal has
+ // already deleted the directory, we get "shell-init: error retrieving current
+ // directory". A 1s delay is very conservative (shell cd takes ~1-5ms), but
+ // deterministic solutions (shell-spawned background, marker file sync) add
+ // significant complexity for marginal benefit.
+ let delay = "sleep 1";
+
// Stop fsmonitor daemon first (best effort - ignore errors)
// This prevents zombie daemons from accumulating when using builtin fsmonitor
let stop_fsmonitor = format!(
@@ -429,14 +439,14 @@ fn build_remove_command(worktree_path: &std::path::Path, branch_to_delete: Optio
Some(branch_name) => {
let branch_escaped = escape(branch_name.into());
format!(
- "{} && git worktree remove {} && git branch -D {}",
- stop_fsmonitor, worktree_escaped, branch_escaped
+ "{} && {} && git worktree remove {} && git branch -D {}",
+ delay, stop_fsmonitor, worktree_escaped, branch_escaped
)
}
None => {
format!(
- "{} && git worktree remove {}",
- stop_fsmonitor, worktree_escaped
+ "{} && {} && git worktree remove {}",
+ delay, stop_fsmonitor, worktree_escaped
)
}
}