Skip to content

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

Add tab completion to wt-core demo

Maximilian Roos74ff38927aba
diff --git a/docs/demos/CLAUDE.md b/docs/demos/CLAUDE.md
index b669f12b1..60cf5eafd 100644
--- a/docs/demos/CLAUDE.md
+++ b/docs/demos/CLAUDE.md
@@ -154,6 +154,11 @@ Demo GIFs should feel natural—not rushed, but not lingering. The goal is to le
| LLM operations | 4s | Show thinking + generated output |
| Transitions (cd, switch) | 1–1.5s | Brief pause after context change |
| Quick sequences (keystrokes) | 0.1–0.5s | Related actions feel like one gesture |
+| Tab completion (shows menu) | 400ms | Pause after Tab when menu appears for viewer to see options |
+| Tab completion (cycles selection) | 300ms | Pause after Tab cycles to show selected option |
+| Tab completion (auto-completes) | 0 | No pause needed when Tab completes to single result |
+| Tab completion (before Enter) | 50ms | Required after final Tab/selection before Enter; lets fish settle |
+| Tab cycling → execute | Enter, 50ms, Enter | When Tab cycling with pager open: first Enter accepts, second executes |
| End hold (before exit) | 2–4s | Let final state sink in |
| Pre-enter pause | 1s | For commands where output clears visible area: TUI takeover (`claude`) or heavy output (`wt merge`). |
| Claude UI startup | 6s | Big visual change; wait for UI to render and settle |
diff --git a/docs/demos/build b/docs/demos/build
index 9a629a54c..50224fab7 100755
--- a/docs/demos/build
+++ b/docs/demos/build
@@ -216,7 +216,7 @@ echo "Add placeholder module for user profile settings."
# Zellij + Fish configs (with --create in wsl abbreviation)
setup_zellij_config(env, default_cwd=str(env.repo))
- setup_fish_config(env, REPO_ROOT, wsl_create=True)
+ setup_fish_config(env, wsl_create=True)
# Claude Code config with pre-approved tools
worktree_branches = ["api", "auth", "billing", "feature"]
diff --git a/docs/demos/shared/lib.py b/docs/demos/shared/lib.py
index e121c1424..569d83c6e 100644
--- a/docs/demos/shared/lib.py
+++ b/docs/demos/shared/lib.py
@@ -215,6 +215,14 @@ fi
# Build wt binary
build_wt(repo_root)
+ # Install fish completions (needed for tab completion in demos)
+ # Note: Demos using tab completion also need to source the completions
+ # in the tape's hidden section (VHS doesn't trigger fish's lazy loading)
+ wt_bin = repo_root / "target" / "debug" / "wt"
+ install_env = os.environ.copy()
+ install_env["HOME"] = str(env.home)
+ run([str(wt_bin), "config", "shell", "install", "fish", "--yes"], env=install_env)
+
# User config directory (demos add their own config.toml)
config_dir = env.home / ".config" / "worktrunk"
config_dir.mkdir(parents=True)
@@ -376,16 +384,18 @@ keybinds clear-defaults=true {{
''')
-def setup_fish_config(env: DemoEnv, repo_root: Path, wsl_create: bool = False) -> None:
+def setup_fish_config(env: DemoEnv, wsl_create: bool = False) -> None:
"""Set up Fish shell configuration for demo recording.
Creates config with wsl abbreviation, starship, wt shell integration,
- and Zellij tab auto-rename. Runs `wt config shell install` to install
- shell extension and completions.
+ Zellij tab auto-rename, and completion pre-loading.
+
+ Note: Completion files are installed by prepare_base_repo(). This function
+ creates config.fish that sources them (needed because VHS doesn't trigger
+ fish's lazy completion loading reliably).
Args:
env: Demo environment
- repo_root: Path to worktrunk repo (for wt binary)
wsl_create: If True, wsl abbreviation includes --create flag
"""
fish_config_dir = env.home / ".config" / "fish"
@@ -399,6 +409,8 @@ set -U fish_greeting ""
# wsl abbreviation: switch to worktree and launch Claude
abbr --add wsl '{wsl_cmd}'
starship init fish | source
+# Pre-load wt completions (VHS doesn't trigger lazy loading reliably)
+source ~/.config/fish/completions/wt.fish 2>/dev/null
# Disable cursor blinking for VHS recording
set fish_cursor_default block
@@ -418,12 +430,6 @@ function __zellij_tab_rename --on-variable PWD
end
''')
- # Install shell extension and completions via wt command
- wt_bin = repo_root / "target" / "debug" / "wt"
- install_env = os.environ.copy()
- install_env["HOME"] = str(env.home)
- run([str(wt_bin), "config", "shell", "install", "fish", "--yes"], env=install_env)
-
def setup_mock_clis(env: DemoEnv) -> None:
"""Set up comprehensive mock CLIs for all demo scenarios.
diff --git a/docs/demos/tapes/wt-core.tape b/docs/demos/tapes/wt-core.tape
index 1f8ed720c..36a848281 100644
--- a/docs/demos/tapes/wt-core.tape
+++ b/docs/demos/tapes/wt-core.tape
@@ -34,6 +34,8 @@ Type "starship init fish | source"
Enter
Type "wt config shell init fish | source"
Enter
+Type "source ~/.config/fish/completions/wt.fish"
+Enter
Type "cd $DEMO_REPO"
Enter
Type "clear"
@@ -62,8 +64,19 @@ Type "wt list --full"
Enter
Sleep 3s
-# 5. Switch to billing (already merged)
-Type "wt switch billing"
+# 5. Switch to billing using Tab cycling through branch options
+# NOTE: Maintainer marked this as excellent - showcases completion well
+# - "wt switch b" + Tab → shows billing/beta menu (400ms to review options)
+# - Tab → cycles through options, selecting billing (300ms to see selection)
+# - Enter → accepts selection (dismisses pager)
+# - 50ms then Enter again → executes command
+Type "wt switch b"
+Tab
+Sleep 400ms
+Tab
+Sleep 300ms
+Enter
+Sleep 50ms
Enter
Sleep 1.5s