Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
Migrate shell completions to lazy loading
Maximilian Roos56b811459596
diff --git a/src/commands/init.rs b/src/commands/init.rsindex a34d60260..89f298f38 100644--- a/src/commands/init.rs+++ b/src/commands/init.rs@@ -1,119 +1,15 @@-use clap::Command;-use clap_complete::{Shell as CompletionShell, generate};use worktrunk::shell;-use worktrunk::styling::{ERROR, ERROR_EMOJI, println};+use worktrunk::styling::println;-pub fn handle_init(- shell: shell::Shell,- command_name: String,- cli_cmd: &mut Command,-) -> Result<(), String> {- let init = shell::ShellInit::new(shell, command_name.clone());+pub fn handle_init(shell: shell::Shell, command_name: String) -> Result<(), String> {+ let init = shell::ShellInit::new(shell, command_name);- // Generate shell integration code+ // Generate shell integration code (includes dynamic completion registration)let integration_output = init.generate().map_err(|e| format!("Failed to generate shell code: {}", e))?;println!("{}", integration_output);- // Generate and append static completions- println!();- println!("# Static completions (commands and flags)");-- // Check if shell supports completion- if !shell.supports_completion() {- println!("{ERROR_EMOJI} {ERROR}Completion not yet supported for {shell}{ERROR:#}");- std::process::exit(1);- }-- // Generate completions to a string so we can filter out hidden commands- let mut completion_output = Vec::new();- let completion_shell = match shell {- shell::Shell::Bash => CompletionShell::Bash,- shell::Shell::Fish => CompletionShell::Fish,- shell::Shell::Zsh => CompletionShell::Zsh,- // Disabled shells would be handled here- };- generate(- completion_shell,- cli_cmd,- &command_name,- &mut completion_output,- );-- // Filter out lines for hidden commands (completion, complete) and hidden flags (--internal)- let completion_str = String::from_utf8_lossy(&completion_output);-- for line in completion_str.lines() {- // Skip lines that complete the hidden commands- if line.contains("\"completion\"")- || line.contains("\"complete\"")- || line.contains("-a \"completion\"")- || line.contains("-a \"complete\"")- {- continue;- }-- // Skip lines that are specifically for completing --internal flag- // But DON'T skip opts= lines that just mention --internal in the list- if line.contains("-l internal") && !line.contains("opts=") {- // Fish: complete -c wt ... -l internal ...- continue;- }- if line.contains("'--internal[") {- // Zsh: '--internal[Use internal mode]'- continue;- }-- // For bash opts= lines and zsh argument specs, remove --internal from the string- let line = if line.contains("--internal") {- // Bash: opts="-c -b --create --base --internal --help"- // Remove --internal and -internal from opts strings- line.replace(" --internal", "").replace("--internal ", "")- } else {- line.to_string()- };-- // For Fish: Add --source to global optspecs so argparse recognizes it- // --source is shell-wrapper-only but Fish's argparse needs to know about it- // for completion to work when users type "wt --source <TAB>"- let line = if matches!(shell, shell::Shell::Fish)- && line.contains("string join \\n v/verbose internal")- {- line.replace(- "string join \\n v/verbose internal",- "string join \\n source v/verbose internal",- )- } else {- line- };-- // For Fish: Add -f (no file completion) to --base flag- // The --base flag should only complete branches, not files- let line = if matches!(shell, shell::Shell::Fish) && line.contains("-l base") {- // Insert -f before -d (description) to disable file completion- line.replace(" -d ", " -f -d ")- } else {- line- };-- // For Zsh: Guard the final compdef call to avoid errors when completion system isn't loaded- // Not all users have compinit in their .zshrc, and --no-rcs mode never loads it- let line = if matches!(shell, shell::Shell::Zsh)- && line.trim() == format!("compdef _{} {}", command_name, command_name)- {- // Replace with guarded version that checks if compdef exists- format!(- " if (( $+functions[compdef] )); then compdef _{} {}; fi",- command_name, command_name- )- } else {- line- };-- println!("{}", line);- }-Ok(())}diff --git a/src/main.rs b/src/main.rsindex 6dde5587f..780b25deb 100644--- a/src/main.rs+++ b/src/main.rs@@ -208,9 +208,7 @@ fn main() {command_name,} => {// Generate shell code to stdout- let mut cli_cmd = cli::build_command();- handle_init(shell, command_name, &mut cli_cmd)- .map_err(|e| anyhow::anyhow!("{}", e))+ handle_init(shell, command_name).map_err(|e| anyhow::anyhow!("{}", e))}ConfigShellCommand::Install {shell,diff --git a/src/shell.rs b/src/shell.rsindex 6cfe4e2aa..df07a8ad0 100644--- a/src/shell.rs+++ b/src/shell.rs@@ -30,11 +30,6 @@ pub enum Shell {}impl Shell {- /// Returns true if this shell supports completion generation- pub fn supports_completion(&self) -> bool {- matches!(self, Self::Bash | Self::Fish | Self::Zsh)- }-/// Returns the standard config file paths for this shell////// Returns paths in order of preference. The first existing file should be used.diff --git a/templates/bash.sh b/templates/bash.shindex 4c0ad9ca7..fdd54159e 100644--- a/templates/bash.sh+++ b/templates/bash.sh@@ -52,8 +52,25 @@ if command -v {{ cmd_prefix }} >/dev/null 2>&1 || [[ -n "${WORKTRUNK_BIN:-}" ]];return $result}- # Register Clap-based completions (auto-updates after wt upgrades)- if completion_script=$(COMPLETE=bash "$_WORKTRUNK_CMD" 2>/dev/null); then- eval "$completion_script"- fi+ # Lazy completion loader - loads real completions on first tab-press+ # This avoids ~11ms binary invocation at shell startup+ _wt_lazy_complete() {+ # Only try to install completions once+ if [[ -z "${_WT_COMPLETION_LOADED:-}" ]]; then+ _WT_COMPLETION_LOADED=1+ if completion_script=$(COMPLETE=bash "${_WORKTRUNK_CMD:-{{ cmd_prefix }}}" 2>/dev/null); then+ eval "$completion_script"+ else+ # Failed to load - remove completion registration+ complete -r {{ cmd_prefix }} 2>/dev/null || true+ return 1+ fi+ fi++ # Delegate to real completion function if it was installed+ if declare -F _clap_complete_{{ cmd_prefix }} >/dev/null 2>&1; then+ _clap_complete_{{ cmd_prefix }} "$@"+ fi+ }+ complete -o nospace -o bashdefault -o nosort -F _wt_lazy_complete {{ cmd_prefix }}fidiff --git a/templates/zsh.zsh b/templates/zsh.zshindex 83da2abf7..3673b2db8 100644--- a/templates/zsh.zsh+++ b/templates/zsh.zsh@@ -52,10 +52,30 @@ if command -v {{ cmd_prefix }} >/dev/null 2>&1 || [[ -n "${WORKTRUNK_BIN:-}" ]];return $result}- # Register Clap-based completions (auto-updates after wt upgrades)+ # Lazy completion loader - loads real completions on first tab-press+ # This avoids ~11ms binary invocation at shell startup+ _wt_lazy_complete() {+ # Only try to install completions once+ if [[ -z "${_WT_COMPLETION_LOADED:-}" ]]; then+ typeset -g _WT_COMPLETION_LOADED=1+ local completion_script+ if completion_script=$(COMPLETE=zsh "${_WORKTRUNK_CMD:-{{ cmd_prefix }}}" 2>/dev/null); then+ eval "$completion_script"+ else+ # Failed to load - unregister to prevent future silent failures+ compdef -d {{ cmd_prefix }} 2>/dev/null+ return 1+ fi+ fi++ # Delegate to real completion function if it was installed+ if (( $+functions[_clap_dynamic_completer_{{ cmd_prefix }}] )); then+ _clap_dynamic_completer_{{ cmd_prefix }} "$@"+ fi+ }++ # Register stub, but only if compdef is available (compinit was run)if (( $+functions[compdef] )); then- local completion_script- completion_script=$(COMPLETE=zsh "$_WORKTRUNK_CMD" 2>/dev/null)- eval "$completion_script"+ compdef _wt_lazy_complete {{ cmd_prefix }}fifidiff --git a/tests/integration_tests/init.rs b/tests/integration_tests/init.rsindex d47f8d99c..5c3a51d15 100644--- a/tests/integration_tests/init.rs+++ b/tests/integration_tests/init.rs@@ -72,37 +72,3 @@ fn test_init_invalid_shell() {");});}--#[cfg(unix)]-#[test]-fn test_fish_no_duplicate_base_completion() {- // Verify that the fish completion doesn't have duplicate entries for --base- let repo = TestRepo::new();- let mut cmd = wt_command();- repo.clean_cli_env(&mut cmd);- cmd.arg("config")- .arg("shell")- .arg("init")- .arg("fish")- .current_dir(repo.root_path());-- let output = cmd- .output()- .expect("Failed to run wt config shell init fish");- let stdout = String::from_utf8_lossy(&output.stdout);-- // Count how many lines contain "complete -c wt" and "-l base"- let base_completions: Vec<&str> = stdout- .lines()- .filter(|line| line.contains("complete -c wt") && line.contains("-l base"))- .collect();-- // Should only have one completion for --base (from clap's static generation)- assert_eq!(- base_completions.len(),- 1,- "Expected exactly 1 completion for --base, but found {}:\n{}",- base_completions.len(),- base_completions.join("\n")- );-}diff --git a/tests/integration_tests/shell_wrapper.rs b/tests/integration_tests/shell_wrapper.rsindex 9b06724a2..673997997 100644--- a/tests/integration_tests/shell_wrapper.rs+++ b/tests/integration_tests/shell_wrapper.rs@@ -1685,8 +1685,8 @@ approved-commands = ["echo 'bash background'"]export WORKTRUNK_BIN='{}'export WORKTRUNK_CONFIG_PATH='{}'{}- # Check if _wt completion function exists- if (( $+functions[_wt] )); then+ # Check if lazy completion stub is registered+ if (( $+functions[_wt_lazy_complete] )); thenecho "__COMPLETION_REGISTERED__"elseecho "__NO_COMPLETION__"diff --git a/tests/snapshots/integration__integration_tests__init__init_bash.snap b/tests/snapshots/integration__integration_tests__init__init_bash.snapindex 715b263d0..6386b4953 100644--- a/tests/snapshots/integration__integration_tests__init__init_bash.snap+++ b/tests/snapshots/integration__integration_tests__init__init_bash.snap@@ -164,835 +164,27 @@ wt_exec() {return $result}- # Register Clap-based completions (auto-updates after wt upgrades)- if completion_script=$(COMPLETE=bash "$_WORKTRUNK_CMD" 2>/dev/null); then- eval "$completion_script"- fi-fi--# Static completions (commands and flags)-_wt() {- local i cur prev opts cmd- COMPREPLY=()- if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then- cur="$2"- else- cur="${COMP_WORDS[COMP_CWORD]}"- fi- prev="$3"- cmd=""- opts=""-- for i in "${COMP_WORDS[@]:0:COMP_CWORD}"- do- case "${cmd},${i}" in- ",$1")- cmd="wt"- ;;- wt,beta)- cmd="wt__beta"- ;;- wt,config)- cmd="wt__config"- ;;- wt,list)- cmd="wt__list"- ;;- wt,merge)- cmd="wt__merge"- ;;- wt,remove)- cmd="wt__remove"- ;;- wt,step)- cmd="wt__step"- ;;- wt,switch)- cmd="wt__switch"- ;;- wt__beta,select)- cmd="wt__beta__select"- ;;- wt__config,approvals)- cmd="wt__config__approvals"- ;;- wt__config,create)- cmd="wt__config__create"- ;;- wt__config,list)- cmd="wt__config__list"- ;;- wt__config,refresh-cache)- cmd="wt__config__refresh__cache"- ;;- wt__config,shell)- cmd="wt__config__shell"- ;;- wt__config,status)- cmd="wt__config__status"- ;;- wt__config__approvals,ask)- cmd="wt__config__approvals__ask"- ;;- wt__config__approvals,clear)- cmd="wt__config__approvals__clear"- ;;- wt__config__shell,init)- cmd="wt__config__shell__init"- ;;- wt__config__shell,install)- cmd="wt__config__shell__install"- ;;- wt__config__status,set)- cmd="wt__config__status__set"- ;;- wt__config__status,unset)- cmd="wt__config__status__unset"- ;;- wt__step,commit)- cmd="wt__step__commit"- ;;- wt__step,post-create)- cmd="wt__step__post__create"- ;;- wt__step,post-merge)- cmd="wt__step__post__merge"- ;;- wt__step,post-start)- cmd="wt__step__post__start"- ;;- wt__step,pre-commit)- cmd="wt__step__pre__commit"- ;;- wt__step,pre-merge)- cmd="wt__step__pre__merge"- ;;- wt__step,push)- cmd="wt__step__push"- ;;- wt__step,rebase)- cmd="wt__step__rebase"- ;;- wt__step,squash)- cmd="wt__step__squash"- ;;- *)- ;;- esac- done-- case "${cmd}" in- wt)- opts="-C -v -h -V --config --verbose --help --version config step beta list switch remove merge"- if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0- fi- case "${prev}" in- -C)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- --config)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- *)- COMPREPLY=()- ;;- esac- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0- ;;- wt__beta)- opts="-C -v -h --config --verbose --help select"- if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0- fi- case "${prev}" in- -C)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- --config)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- *)- COMPREPLY=()- ;;- esac- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0- ;;- wt__beta__select)- opts="-C -v -h --config --verbose --help"- if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0- fi- case "${prev}" in- -C)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- --config)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- *)- COMPREPLY=()- ;;- esac- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0- ;;- wt__config)- opts="-C -v -h --config --verbose --help shell create list refresh-cache status approvals"- if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0- fi- case "${prev}" in- -C)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- --config)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- *)- COMPREPLY=()- ;;- esac- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0- ;;- wt__config__approvals)- opts="-C -v -h --config --verbose --help ask clear"- if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0- fi- case "${prev}" in- -C)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- --config)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- *)- COMPREPLY=()- ;;- esac- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0- ;;- wt__config__approvals__ask)- opts="-f -C -v -h --force --all --config --verbose --help"- if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0- fi- case "${prev}" in- -C)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- --config)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- *)- COMPREPLY=()- ;;- esac- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0- ;;- wt__config__approvals__clear)- opts="-g -C -v -h --global --config --verbose --help"- if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0- fi- case "${prev}" in- -C)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- --config)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- *)- COMPREPLY=()- ;;- esac- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0- ;;- wt__config__create)- opts="-C -v -h --config --verbose --help"- if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0- fi- case "${prev}" in- -C)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- --config)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- *)- COMPREPLY=()- ;;- esac- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0- ;;- wt__config__list)- opts="-C -v -h --config --verbose --help"- if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0- fi- case "${prev}" in- -C)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- --config)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- *)- COMPREPLY=()- ;;- esac- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0- ;;- wt__config__refresh__cache)- opts="-C -v -h --config --verbose --help"- if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0- fi- case "${prev}" in- -C)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- --config)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- *)- COMPREPLY=()- ;;- esac- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0- ;;- wt__config__shell)- opts="-C -v -h --config --verbose --help init install"- if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0- fi- case "${prev}" in- -C)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- --config)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- *)- COMPREPLY=()- ;;- esac- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0- ;;- wt__config__shell__init)- opts="-C -v -h --command-name --config --verbose --help bash fish zsh"- if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0- fi- case "${prev}" in- --command-name)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- -C)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- --config)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- *)- COMPREPLY=()- ;;- esac- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0- ;;- wt__config__shell__install)- opts="-f -C -v -h --force --command-name --config --verbose --help bash fish zsh"- if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0- fi- case "${prev}" in- --command-name)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- -C)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- --config)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- *)- COMPREPLY=()- ;;- esac- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0- ;;- wt__config__status)- opts="-C -v -h --config --verbose --help set unset"- if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0- fi- case "${prev}" in- -C)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- --config)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- *)- COMPREPLY=()- ;;- esac- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0- ;;- wt__config__status__set)- opts="-C -v -h --branch --config --verbose --help <VALUE>"- if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0- fi- case "${prev}" in- --branch)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- -C)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- --config)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- *)- COMPREPLY=()- ;;- esac- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0- ;;- wt__config__status__unset)- opts="-C -v -h --config --verbose --help [TARGET]"- if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0- fi- case "${prev}" in- -C)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- --config)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- *)- COMPREPLY=()- ;;- esac- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0- ;;- wt__list)- opts="-C -v -h --format --branches --remotes --full --progressive --no-progressive --config --verbose --help"- if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0- fi- case "${prev}" in- --format)- COMPREPLY=($(compgen -W "table json" -- "${cur}"))- return 0- ;;- -C)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- --config)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- *)- COMPREPLY=()- ;;- esac- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0- ;;- wt__merge)- opts="-f -C -v -h --squash --no-squash --commit --no-commit --remove --no-remove --verify --no-verify --force --stage --config --verbose --help [TARGET]"- if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0- fi- case "${prev}" in- --stage)- COMPREPLY=($(compgen -W "all tracked none" -- "${cur}"))- return 0- ;;- -C)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- --config)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- *)- COMPREPLY=()- ;;- esac- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0- ;;- wt__remove)- opts="-D -C -v -h --no-delete-branch --force-delete --no-background --config --verbose --help [WORKTREES]..."- if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0- fi- case "${prev}" in- -C)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- --config)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- *)- COMPREPLY=()- ;;- esac- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0- ;;- wt__step)- opts="-C -v -h --config --verbose --help commit squash push rebase post-create post-start pre-commit pre-merge post-merge"- if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0- fi- case "${prev}" in- -C)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- --config)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- *)- COMPREPLY=()- ;;- esac- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0- ;;- wt__step__commit)- opts="-f -C -v -h --force --no-verify --stage --config --verbose --help"- if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0- fi- case "${prev}" in- --stage)- COMPREPLY=($(compgen -W "all tracked none" -- "${cur}"))- return 0- ;;- -C)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- --config)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- *)- COMPREPLY=()- ;;- esac- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0- ;;- wt__step__post__create)- opts="-f -C -v -h --force --config --verbose --help"- if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0- fi- case "${prev}" in- -C)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- --config)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- *)- COMPREPLY=()- ;;- esac- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0- ;;- wt__step__post__merge)- opts="-f -C -v -h --force --config --verbose --help"- if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0- fi- case "${prev}" in- -C)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- --config)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- *)- COMPREPLY=()- ;;- esac- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0- ;;- wt__step__post__start)- opts="-f -C -v -h --force --config --verbose --help"- if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0- fi- case "${prev}" in- -C)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- --config)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- *)- COMPREPLY=()- ;;- esac- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0- ;;- wt__step__pre__commit)- opts="-f -C -v -h --force --config --verbose --help"- if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0- fi- case "${prev}" in- -C)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- --config)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- *)- COMPREPLY=()- ;;- esac- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0- ;;- wt__step__pre__merge)- opts="-f -C -v -h --force --config --verbose --help"- if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0- fi- case "${prev}" in- -C)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- --config)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- *)- COMPREPLY=()- ;;- esac- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0- ;;- wt__step__push)- opts="-C -v -h --allow-merge-commits --config --verbose --help [TARGET]"- if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0- fi- case "${prev}" in- -C)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- --config)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- *)- COMPREPLY=()- ;;- esac- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0- ;;- wt__step__rebase)- opts="-C -v -h --config --verbose --help [TARGET]"- if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0- fi- case "${prev}" in- -C)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- --config)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- *)- COMPREPLY=()- ;;- esac- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0- ;;- wt__step__squash)- opts="-f -C -v -h --force --no-verify --stage --config --verbose --help [TARGET]"- if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0- fi- case "${prev}" in- --stage)- COMPREPLY=($(compgen -W "all tracked none" -- "${cur}"))- return 0- ;;- -C)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- --config)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- *)- COMPREPLY=()- ;;- esac- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0- ;;- wt__switch)- opts="-c -b -x -f -C -v -h --create --base --execute --force --no-verify --config --verbose --help <BRANCH>"- if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0+ # Lazy completion loader - loads real completions on first tab-press+ # This avoids ~11ms binary invocation at shell startup+ _wt_lazy_complete() {+ # Only try to install completions once+ if [[ -z "${_WT_COMPLETION_LOADED:-}" ]]; then+ _WT_COMPLETION_LOADED=1+ if completion_script=$(COMPLETE=bash "${_WORKTRUNK_CMD:-wt}" 2>/dev/null); then+ eval "$completion_script"+ else+ # Failed to load - remove completion registration+ complete -r wt 2>/dev/null || true+ return 1fi- case "${prev}" in- --base)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- -b)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- --execute)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- -x)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- -C)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- --config)- COMPREPLY=($(compgen -f "${cur}"))- return 0- ;;- *)- COMPREPLY=()- ;;- esac- COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )- return 0- ;;- esac-}+ fi-if [[ "${BASH_VERSINFO[0]}" -eq 4 && "${BASH_VERSINFO[1]}" -ge 4 || "${BASH_VERSINFO[0]}" -gt 4 ]]; then- complete -F _wt -o nosort -o bashdefault -o default wt-else- complete -F _wt -o bashdefault -o default wt+ # Delegate to real completion function if it was installed+ if declare -F _clap_complete_wt >/dev/null 2>&1; then+ _clap_complete_wt "$@"+ fi+ }+ complete -o nospace -o bashdefault -o nosort -F _wt_lazy_complete wtfi----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__init__init_fish.snap b/tests/snapshots/integration__integration_tests__init__init_fish.snapindex 7735470e4..e106833ed 100644--- a/tests/snapshots/integration__integration_tests__init__init_fish.snap+++ b/tests/snapshots/integration__integration_tests__init__init_fish.snap@@ -159,201 +159,4 @@ if type -q wt; or set -q WORKTRUNK_BINendend-# Static completions (commands and flags)-# Print an optspec for argparse to handle cmd's options that are independent of any subcommand.-function __fish_wt_global_optspecs- string join \n C= config= v/verbose internal h/help V/version-end--function __fish_wt_needs_command- # Figure out if the current invocation already has a command.- set -l cmd (commandline -opc)- set -e cmd[1]- argparse -s (__fish_wt_global_optspecs) -- $cmd 2>/dev/null- or return- if set -q argv[1]- # Also print the command, so this can be used to figure out what it is.- echo $argv[1]- return 1- end- return 0-end--function __fish_wt_using_subcommand- set -l cmd (__fish_wt_needs_command)- test -z "$cmd"- and return 1- contains -- $cmd[1] $argv-end--complete -c wt -n "__fish_wt_needs_command" -s C -d 'Working directory for this command' -r -F-complete -c wt -n "__fish_wt_needs_command" -l config -d 'User config file path' -r -F-complete -c wt -n "__fish_wt_needs_command" -s v -l verbose -d 'Show commands and debug info'-complete -c wt -n "__fish_wt_needs_command" -s h -l help -d 'Print help (see more with \'--help\')'-complete -c wt -n "__fish_wt_needs_command" -s V -l version -d 'Print version'-complete -c wt -n "__fish_wt_needs_command" -f -a "config" -d 'Manage configuration and shell integration'-complete -c wt -n "__fish_wt_needs_command" -f -a "step" -d 'Primitive operations (building blocks for workflows)'-complete -c wt -n "__fish_wt_needs_command" -f -a "beta" -d 'Experimental commands'-complete -c wt -n "__fish_wt_needs_command" -f -a "list" -d 'List worktrees and optionally branches'-complete -c wt -n "__fish_wt_needs_command" -f -a "switch" -d 'Switch to a worktree'-complete -c wt -n "__fish_wt_needs_command" -f -a "remove" -d 'Remove worktree and branch'-complete -c wt -n "__fish_wt_needs_command" -f -a "merge" -d 'Merge worktree into target branch'-complete -c wt -n "__fish_wt_using_subcommand config; and not __fish_seen_subcommand_from shell create list refresh-cache status approvals" -s C -d 'Working directory for this command' -r -F-complete -c wt -n "__fish_wt_using_subcommand config; and not __fish_seen_subcommand_from shell create list refresh-cache status approvals" -l config -d 'User config file path' -r -F-complete -c wt -n "__fish_wt_using_subcommand config; and not __fish_seen_subcommand_from shell create list refresh-cache status approvals" -s v -l verbose -d 'Show commands and debug info'-complete -c wt -n "__fish_wt_using_subcommand config; and not __fish_seen_subcommand_from shell create list refresh-cache status approvals" -s h -l help -d 'Print help (see more with \'--help\')'-complete -c wt -n "__fish_wt_using_subcommand config; and not __fish_seen_subcommand_from shell create list refresh-cache status approvals" -f -a "shell" -d 'Shell integration setup'-complete -c wt -n "__fish_wt_using_subcommand config; and not __fish_seen_subcommand_from shell create list refresh-cache status approvals" -f -a "create" -d 'Create global configuration file'-complete -c wt -n "__fish_wt_using_subcommand config; and not __fish_seen_subcommand_from shell create list refresh-cache status approvals" -f -a "list" -d 'List configuration files & locations'-complete -c wt -n "__fish_wt_using_subcommand config; and not __fish_seen_subcommand_from shell create list refresh-cache status approvals" -f -a "refresh-cache" -d 'Refresh default branch from remote'-complete -c wt -n "__fish_wt_using_subcommand config; and not __fish_seen_subcommand_from shell create list refresh-cache status approvals" -f -a "status" -d 'Manage branch status markers'-complete -c wt -n "__fish_wt_using_subcommand config; and not __fish_seen_subcommand_from shell create list refresh-cache status approvals" -f -a "approvals" -d 'Manage command approvals'-complete -c wt -n "__fish_wt_using_subcommand config; and __fish_seen_subcommand_from shell" -s C -d 'Working directory for this command' -r -F-complete -c wt -n "__fish_wt_using_subcommand config; and __fish_seen_subcommand_from shell" -l config -d 'User config file path' -r -F-complete -c wt -n "__fish_wt_using_subcommand config; and __fish_seen_subcommand_from shell" -s v -l verbose -d 'Show commands and debug info'-complete -c wt -n "__fish_wt_using_subcommand config; and __fish_seen_subcommand_from shell" -s h -l help -d 'Print help'-complete -c wt -n "__fish_wt_using_subcommand config; and __fish_seen_subcommand_from shell" -f -a "init" -d 'Generate shell integration code'-complete -c wt -n "__fish_wt_using_subcommand config; and __fish_seen_subcommand_from shell" -f -a "install" -d 'Write shell integration to config files'-complete -c wt -n "__fish_wt_using_subcommand config; and __fish_seen_subcommand_from create" -s C -d 'Working directory for this command' -r -F-complete -c wt -n "__fish_wt_using_subcommand config; and __fish_seen_subcommand_from create" -l config -d 'User config file path' -r -F-complete -c wt -n "__fish_wt_using_subcommand config; and __fish_seen_subcommand_from create" -s v -l verbose -d 'Show commands and debug info'-complete -c wt -n "__fish_wt_using_subcommand config; and __fish_seen_subcommand_from create" -s h -l help -d 'Print help (see more with \'--help\')'-complete -c wt -n "__fish_wt_using_subcommand config; and __fish_seen_subcommand_from list" -s C -d 'Working directory for this command' -r -F-complete -c wt -n "__fish_wt_using_subcommand config; and __fish_seen_subcommand_from list" -l config -d 'User config file path' -r -F-complete -c wt -n "__fish_wt_using_subcommand config; and __fish_seen_subcommand_from list" -s v -l verbose -d 'Show commands and debug info'-complete -c wt -n "__fish_wt_using_subcommand config; and __fish_seen_subcommand_from list" -s h -l help -d 'Print help (see more with \'--help\')'-complete -c wt -n "__fish_wt_using_subcommand config; and __fish_seen_subcommand_from refresh-cache" -s C -d 'Working directory for this command' -r -F-complete -c wt -n "__fish_wt_using_subcommand config; and __fish_seen_subcommand_from refresh-cache" -l config -d 'User config file path' -r -F-complete -c wt -n "__fish_wt_using_subcommand config; and __fish_seen_subcommand_from refresh-cache" -s v -l verbose -d 'Show commands and debug info'-complete -c wt -n "__fish_wt_using_subcommand config; and __fish_seen_subcommand_from refresh-cache" -s h -l help -d 'Print help (see more with \'--help\')'-complete -c wt -n "__fish_wt_using_subcommand config; and __fish_seen_subcommand_from status" -s C -d 'Working directory for this command' -r -F-complete -c wt -n "__fish_wt_using_subcommand config; and __fish_seen_subcommand_from status" -l config -d 'User config file path' -r -F-complete -c wt -n "__fish_wt_using_subcommand config; and __fish_seen_subcommand_from status" -s v -l verbose -d 'Show commands and debug info'-complete -c wt -n "__fish_wt_using_subcommand config; and __fish_seen_subcommand_from status" -s h -l help -d 'Print help'-complete -c wt -n "__fish_wt_using_subcommand config; and __fish_seen_subcommand_from status" -f -a "set" -d 'Set status emoji for branch'-complete -c wt -n "__fish_wt_using_subcommand config; and __fish_seen_subcommand_from status" -f -a "unset" -d 'Clear status emoji'-complete -c wt -n "__fish_wt_using_subcommand config; and __fish_seen_subcommand_from approvals" -s C -d 'Working directory for this command' -r -F-complete -c wt -n "__fish_wt_using_subcommand config; and __fish_seen_subcommand_from approvals" -l config -d 'User config file path' -r -F-complete -c wt -n "__fish_wt_using_subcommand config; and __fish_seen_subcommand_from approvals" -s v -l verbose -d 'Show commands and debug info'-complete -c wt -n "__fish_wt_using_subcommand config; and __fish_seen_subcommand_from approvals" -s h -l help -d 'Print help (see more with \'--help\')'-complete -c wt -n "__fish_wt_using_subcommand config; and __fish_seen_subcommand_from approvals" -f -a "ask" -d 'Store approvals in config'-complete -c wt -n "__fish_wt_using_subcommand config; and __fish_seen_subcommand_from approvals" -f -a "clear" -d 'Clear approved commands from config'-complete -c wt -n "__fish_wt_using_subcommand step; and not __fish_seen_subcommand_from commit squash push rebase post-create post-start pre-commit pre-merge post-merge" -s C -d 'Working directory for this command' -r -F-complete -c wt -n "__fish_wt_using_subcommand step; and not __fish_seen_subcommand_from commit squash push rebase post-create post-start pre-commit pre-merge post-merge" -l config -d 'User config file path' -r -F-complete -c wt -n "__fish_wt_using_subcommand step; and not __fish_seen_subcommand_from commit squash push rebase post-create post-start pre-commit pre-merge post-merge" -s v -l verbose -d 'Show commands and debug info'-complete -c wt -n "__fish_wt_using_subcommand step; and not __fish_seen_subcommand_from commit squash push rebase post-create post-start pre-commit pre-merge post-merge" -s h -l help -d 'Print help'-complete -c wt -n "__fish_wt_using_subcommand step; and not __fish_seen_subcommand_from commit squash push rebase post-create post-start pre-commit pre-merge post-merge" -f -a "commit" -d 'Commit changes with LLM message'-complete -c wt -n "__fish_wt_using_subcommand step; and not __fish_seen_subcommand_from commit squash push rebase post-create post-start pre-commit pre-merge post-merge" -f -a "squash" -d 'Squash commits with LLM message'-complete -c wt -n "__fish_wt_using_subcommand step; and not __fish_seen_subcommand_from commit squash push rebase post-create post-start pre-commit pre-merge post-merge" -f -a "push" -d 'Push changes to local target branch'-complete -c wt -n "__fish_wt_using_subcommand step; and not __fish_seen_subcommand_from commit squash push rebase post-create post-start pre-commit pre-merge post-merge" -f -a "rebase" -d 'Rebase onto target'-complete -c wt -n "__fish_wt_using_subcommand step; and not __fish_seen_subcommand_from commit squash push rebase post-create post-start pre-commit pre-merge post-merge" -f -a "post-create" -d 'Run post-create hook'-complete -c wt -n "__fish_wt_using_subcommand step; and not __fish_seen_subcommand_from commit squash push rebase post-create post-start pre-commit pre-merge post-merge" -f -a "post-start" -d 'Run post-start hook'-complete -c wt -n "__fish_wt_using_subcommand step; and not __fish_seen_subcommand_from commit squash push rebase post-create post-start pre-commit pre-merge post-merge" -f -a "pre-commit" -d 'Run pre-commit hook'-complete -c wt -n "__fish_wt_using_subcommand step; and not __fish_seen_subcommand_from commit squash push rebase post-create post-start pre-commit pre-merge post-merge" -f -a "pre-merge" -d 'Run pre-merge hook'-complete -c wt -n "__fish_wt_using_subcommand step; and not __fish_seen_subcommand_from commit squash push rebase post-create post-start pre-commit pre-merge post-merge" -f -a "post-merge" -d 'Run post-merge hook'-complete -c wt -n "__fish_wt_using_subcommand step; and __fish_seen_subcommand_from commit" -l stage -d 'What to stage before committing [default: all]' -r -f -a "all\t'Stage everything: untracked files + unstaged tracked changes'-tracked\t'Stage tracked changes only (like git add -u)'-none\t'Stage nothing, commit only what\'s already in the index'"-complete -c wt -n "__fish_wt_using_subcommand step; and __fish_seen_subcommand_from commit" -s C -d 'Working directory for this command' -r -F-complete -c wt -n "__fish_wt_using_subcommand step; and __fish_seen_subcommand_from commit" -l config -d 'User config file path' -r -F-complete -c wt -n "__fish_wt_using_subcommand step; and __fish_seen_subcommand_from commit" -s f -l force -d 'Skip approval prompts'-complete -c wt -n "__fish_wt_using_subcommand step; and __fish_seen_subcommand_from commit" -l no-verify -d 'Skip pre-commit hooks'-complete -c wt -n "__fish_wt_using_subcommand step; and __fish_seen_subcommand_from commit" -s v -l verbose -d 'Show commands and debug info'-complete -c wt -n "__fish_wt_using_subcommand step; and __fish_seen_subcommand_from commit" -s h -l help -d 'Print help (see more with \'--help\')'-complete -c wt -n "__fish_wt_using_subcommand step; and __fish_seen_subcommand_from squash" -l stage -d 'What to stage before committing [default: all]' -r -f -a "all\t'Stage everything: untracked files + unstaged tracked changes'-tracked\t'Stage tracked changes only (like git add -u)'-none\t'Stage nothing, commit only what\'s already in the index'"-complete -c wt -n "__fish_wt_using_subcommand step; and __fish_seen_subcommand_from squash" -s C -d 'Working directory for this command' -r -F-complete -c wt -n "__fish_wt_using_subcommand step; and __fish_seen_subcommand_from squash" -l config -d 'User config file path' -r -F-complete -c wt -n "__fish_wt_using_subcommand step; and __fish_seen_subcommand_from squash" -s f -l force -d 'Skip approval prompts'-complete -c wt -n "__fish_wt_using_subcommand step; and __fish_seen_subcommand_from squash" -l no-verify -d 'Skip pre-commit hooks'-complete -c wt -n "__fish_wt_using_subcommand step; and __fish_seen_subcommand_from squash" -s v -l verbose -d 'Show commands and debug info'-complete -c wt -n "__fish_wt_using_subcommand step; and __fish_seen_subcommand_from squash" -s h -l help -d 'Print help (see more with \'--help\')'-complete -c wt -n "__fish_wt_using_subcommand step; and __fish_seen_subcommand_from push" -s C -d 'Working directory for this command' -r -F-complete -c wt -n "__fish_wt_using_subcommand step; and __fish_seen_subcommand_from push" -l config -d 'User config file path' -r -F-complete -c wt -n "__fish_wt_using_subcommand step; and __fish_seen_subcommand_from push" -l allow-merge-commits -d 'Allow merge commits'-complete -c wt -n "__fish_wt_using_subcommand step; and __fish_seen_subcommand_from push" -s v -l verbose -d 'Show commands and debug info'-complete -c wt -n "__fish_wt_using_subcommand step; and __fish_seen_subcommand_from push" -s h -l help -d 'Print help (see more with \'--help\')'-complete -c wt -n "__fish_wt_using_subcommand step; and __fish_seen_subcommand_from rebase" -s C -d 'Working directory for this command' -r -F-complete -c wt -n "__fish_wt_using_subcommand step; and __fish_seen_subcommand_from rebase" -l config -d 'User config file path' -r -F-complete -c wt -n "__fish_wt_using_subcommand step; and __fish_seen_subcommand_from rebase" -s v -l verbose -d 'Show commands and debug info'-complete -c wt -n "__fish_wt_using_subcommand step; and __fish_seen_subcommand_from rebase" -s h -l help -d 'Print help (see more with \'--help\')'-complete -c wt -n "__fish_wt_using_subcommand step; and __fish_seen_subcommand_from post-create" -s C -d 'Working directory for this command' -r -F-complete -c wt -n "__fish_wt_using_subcommand step; and __fish_seen_subcommand_from post-create" -l config -d 'User config file path' -r -F-complete -c wt -n "__fish_wt_using_subcommand step; and __fish_seen_subcommand_from post-create" -s f -l force -d 'Skip approval prompts'-complete -c wt -n "__fish_wt_using_subcommand step; and __fish_seen_subcommand_from post-create" -s v -l verbose -d 'Show commands and debug info'-complete -c wt -n "__fish_wt_using_subcommand step; and __fish_seen_subcommand_from post-create" -s h -l help -d 'Print help'-complete -c wt -n "__fish_wt_using_subcommand step; and __fish_seen_subcommand_from post-start" -s C -d 'Working directory for this command' -r -F-complete -c wt -n "__fish_wt_using_subcommand step; and __fish_seen_subcommand_from post-start" -l config -d 'User config file path' -r -F-complete -c wt -n "__fish_wt_using_subcommand step; and __fish_seen_subcommand_from post-start" -s f -l force -d 'Skip approval prompts'-complete -c wt -n "__fish_wt_using_subcommand step; and __fish_seen_subcommand_from post-start" -s v -l verbose -d 'Show commands and debug info'-complete -c wt -n "__fish_wt_using_subcommand step; and __fish_seen_subcommand_from post-start" -s h -l help -d 'Print help'-complete -c wt -n "__fish_wt_using_subcommand step; and __fish_seen_subcommand_from pre-commit" -s C -d 'Working directory for this command' -r -F-complete -c wt -n "__fish_wt_using_subcommand step; and __fish_seen_subcommand_from pre-commit" -l config -d 'User config file path' -r -F-complete -c wt -n "__fish_wt_using_subcommand step; and __fish_seen_subcommand_from pre-commit" -s f -l force -d 'Skip approval prompts'-complete -c wt -n "__fish_wt_using_subcommand step; and __fish_seen_subcommand_from pre-commit" -s v -l verbose -d 'Show commands and debug info'-complete -c wt -n "__fish_wt_using_subcommand step; and __fish_seen_subcommand_from pre-commit" -s h -l help -d 'Print help'-complete -c wt -n "__fish_wt_using_subcommand step; and __fish_seen_subcommand_from pre-merge" -s C -d 'Working directory for this command' -r -F-complete -c wt -n "__fish_wt_using_subcommand step; and __fish_seen_subcommand_from pre-merge" -l config -d 'User config file path' -r -F-complete -c wt -n "__fish_wt_using_subcommand step; and __fish_seen_subcommand_from pre-merge" -s f -l force -d 'Skip approval prompts'-complete -c wt -n "__fish_wt_using_subcommand step; and __fish_seen_subcommand_from pre-merge" -s v -l verbose -d 'Show commands and debug info'-complete -c wt -n "__fish_wt_using_subcommand step; and __fish_seen_subcommand_from pre-merge" -s h -l help -d 'Print help'-complete -c wt -n "__fish_wt_using_subcommand step; and __fish_seen_subcommand_from post-merge" -s C -d 'Working directory for this command' -r -F-complete -c wt -n "__fish_wt_using_subcommand step; and __fish_seen_subcommand_from post-merge" -l config -d 'User config file path' -r -F-complete -c wt -n "__fish_wt_using_subcommand step; and __fish_seen_subcommand_from post-merge" -s f -l force -d 'Skip approval prompts'-complete -c wt -n "__fish_wt_using_subcommand step; and __fish_seen_subcommand_from post-merge" -s v -l verbose -d 'Show commands and debug info'-complete -c wt -n "__fish_wt_using_subcommand step; and __fish_seen_subcommand_from post-merge" -s h -l help -d 'Print help'-complete -c wt -n "__fish_wt_using_subcommand beta; and not __fish_seen_subcommand_from select" -s C -d 'Working directory for this command' -r -F-complete -c wt -n "__fish_wt_using_subcommand beta; and not __fish_seen_subcommand_from select" -l config -d 'User config file path' -r -F-complete -c wt -n "__fish_wt_using_subcommand beta; and not __fish_seen_subcommand_from select" -s v -l verbose -d 'Show commands and debug info'-complete -c wt -n "__fish_wt_using_subcommand beta; and not __fish_seen_subcommand_from select" -s h -l help -d 'Print help'-complete -c wt -n "__fish_wt_using_subcommand beta; and not __fish_seen_subcommand_from select" -f -a "select" -d 'Interactive worktree selector'-complete -c wt -n "__fish_wt_using_subcommand beta; and __fish_seen_subcommand_from select" -s C -d 'Working directory for this command' -r -F-complete -c wt -n "__fish_wt_using_subcommand beta; and __fish_seen_subcommand_from select" -l config -d 'User config file path' -r -F-complete -c wt -n "__fish_wt_using_subcommand beta; and __fish_seen_subcommand_from select" -s v -l verbose -d 'Show commands and debug info'-complete -c wt -n "__fish_wt_using_subcommand beta; and __fish_seen_subcommand_from select" -s h -l help -d 'Print help (see more with \'--help\')'-complete -c wt -n "__fish_wt_using_subcommand list" -l format -d 'Output format (table, json)' -r -f -a "table\t'Human-readable table format'-json\t'JSON output'"-complete -c wt -n "__fish_wt_using_subcommand list" -s C -d 'Working directory for this command' -r -F-complete -c wt -n "__fish_wt_using_subcommand list" -l config -d 'User config file path' -r -F-complete -c wt -n "__fish_wt_using_subcommand list" -l branches -d 'Include branches without worktrees'-complete -c wt -n "__fish_wt_using_subcommand list" -l remotes -d 'Include remote branches'-complete -c wt -n "__fish_wt_using_subcommand list" -l full -d 'Show CI, conflicts, diffs'-complete -c wt -n "__fish_wt_using_subcommand list" -l progressive -d 'Show fast info immediately, update with slow info'-complete -c wt -n "__fish_wt_using_subcommand list" -l no-progressive -d 'Force buffered rendering'-complete -c wt -n "__fish_wt_using_subcommand list" -s v -l verbose -d 'Show commands and debug info'-complete -c wt -n "__fish_wt_using_subcommand list" -s h -l help -d 'Print help (see more with \'--help\')'-complete -c wt -n "__fish_wt_using_subcommand switch" -s b -l base -f -d 'Base branch' -r-complete -c wt -n "__fish_wt_using_subcommand switch" -s x -l execute -d 'Command to run after switch' -r-complete -c wt -n "__fish_wt_using_subcommand switch" -s C -d 'Working directory for this command' -r -F-complete -c wt -n "__fish_wt_using_subcommand switch" -l config -d 'User config file path' -r -F-complete -c wt -n "__fish_wt_using_subcommand switch" -s c -l create -d 'Create a new branch'-complete -c wt -n "__fish_wt_using_subcommand switch" -s f -l force -d 'Skip approval prompts'-complete -c wt -n "__fish_wt_using_subcommand switch" -l no-verify -d 'Skip all project hooks'-complete -c wt -n "__fish_wt_using_subcommand switch" -s v -l verbose -d 'Show commands and debug info'-complete -c wt -n "__fish_wt_using_subcommand switch" -s h -l help -d 'Print help (see more with \'--help\')'-complete -c wt -n "__fish_wt_using_subcommand remove" -s C -d 'Working directory for this command' -r -F-complete -c wt -n "__fish_wt_using_subcommand remove" -l config -d 'User config file path' -r -F-complete -c wt -n "__fish_wt_using_subcommand remove" -l no-delete-branch -d 'Keep branch after removal'-complete -c wt -n "__fish_wt_using_subcommand remove" -s D -l force-delete -d 'Delete unmerged branches'-complete -c wt -n "__fish_wt_using_subcommand remove" -l no-background -d 'Run removal in foreground'-complete -c wt -n "__fish_wt_using_subcommand remove" -s v -l verbose -d 'Show commands and debug info'-complete -c wt -n "__fish_wt_using_subcommand remove" -s h -l help -d 'Print help (see more with \'--help\')'-complete -c wt -n "__fish_wt_using_subcommand merge" -l stage -d 'What to stage before committing [default: all]' -r -f -a "all\t'Stage everything: untracked files + unstaged tracked changes'-tracked\t'Stage tracked changes only (like git add -u)'-none\t'Stage nothing, commit only what\'s already in the index'"-complete -c wt -n "__fish_wt_using_subcommand merge" -s C -d 'Working directory for this command' -r -F-complete -c wt -n "__fish_wt_using_subcommand merge" -l config -d 'User config file path' -r -F-complete -c wt -n "__fish_wt_using_subcommand merge" -l squash -d 'Force commit squashing'-complete -c wt -n "__fish_wt_using_subcommand merge" -l no-squash -d 'Skip commit squashing'-complete -c wt -n "__fish_wt_using_subcommand merge" -l commit -d 'Force commit, squash, and rebase'-complete -c wt -n "__fish_wt_using_subcommand merge" -l no-commit -d 'Skip commit, squash, and rebase'-complete -c wt -n "__fish_wt_using_subcommand merge" -l remove -d 'Force worktree removal after merge'-complete -c wt -n "__fish_wt_using_subcommand merge" -l no-remove -d 'Keep worktree after merge'-complete -c wt -n "__fish_wt_using_subcommand merge" -l verify -d 'Force running project hooks'-complete -c wt -n "__fish_wt_using_subcommand merge" -l no-verify -d 'Skip all project hooks'-complete -c wt -n "__fish_wt_using_subcommand merge" -s f -l force -d 'Skip approval prompts'-complete -c wt -n "__fish_wt_using_subcommand merge" -s v -l verbose -d 'Show commands and debug info'-complete -c wt -n "__fish_wt_using_subcommand merge" -s h -l help -d 'Print help (see more with \'--help\')'------ stderr -----diff --git a/tests/snapshots/integration__integration_tests__init__init_zsh.snap b/tests/snapshots/integration__integration_tests__init__init_zsh.snapindex c9bcc9753..11de623db 100644--- a/tests/snapshots/integration__integration_tests__init__init_zsh.snap+++ b/tests/snapshots/integration__integration_tests__init__init_zsh.snap@@ -164,683 +164,32 @@ wt_exec() {return $result}- # Register Clap-based completions (auto-updates after wt upgrades)- if (( $+functions[compdef] )); then- local completion_script- completion_script=$(COMPLETE=zsh "$_WORKTRUNK_CMD" 2>/dev/null)- eval "$completion_script"- fi-fi--# Static completions (commands and flags)-#compdef wt--autoload -U is-at-least+ # Lazy completion loader - loads real completions on first tab-press+ # This avoids ~11ms binary invocation at shell startup+ _wt_lazy_complete() {+ # Only try to install completions once+ if [[ -z "${_WT_COMPLETION_LOADED:-}" ]]; then+ typeset -g _WT_COMPLETION_LOADED=1+ local completion_script+ if completion_script=$(COMPLETE=zsh "${_WORKTRUNK_CMD:-wt}" 2>/dev/null); then+ eval "$completion_script"+ else+ # Failed to load - unregister to prevent future silent failures+ compdef -d wt 2>/dev/null+ return 1+ fi+ fi-_wt() {- typeset -A opt_args- typeset -a _arguments_options- local ret=1+ # Delegate to real completion function if it was installed+ if (( $+functions[_clap_dynamic_completer_wt] )); then+ _clap_dynamic_completer_wt "$@"+ fi+ }- if is-at-least 5.2; then- _arguments_options=(-s -S -C)- else- _arguments_options=(-s -C)+ # Register stub, but only if compdef is available (compinit was run)+ if (( $+functions[compdef] )); then+ compdef _wt_lazy_complete wtfi-- local context curcontext="$curcontext" state line- _arguments "${_arguments_options[@]}" : \-'-C+[Working directory for this command]:path:_files' \-'--config=[User config file path]:path:_files' \-'-v[Show commands and debug info]' \-'--verbose[Show commands and debug info]' \-'-h[Print help (see more with '\''--help'\'')]' \-'--help[Print help (see more with '\''--help'\'')]' \-'-V[Print version]' \-'--version[Print version]' \-":: :_wt_commands" \-"*::: :->wt" \-&& ret=0- case $state in- (wt)- words=($line[1] "${words[@]}")- (( CURRENT += 1 ))- curcontext="${curcontext%:*:*}:wt-command-$line[1]:"- case $line[1] in- (config)-_arguments "${_arguments_options[@]}" : \-'-C+[Working directory for this command]:path:_files' \-'--config=[User config file path]:path:_files' \-'-v[Show commands and debug info]' \-'--verbose[Show commands and debug info]' \-'-h[Print help (see more with '\''--help'\'')]' \-'--help[Print help (see more with '\''--help'\'')]' \-":: :_wt__config_commands" \-"*::: :->config" \-&& ret=0-- case $state in- (config)- words=($line[1] "${words[@]}")- (( CURRENT += 1 ))- curcontext="${curcontext%:*:*}:wt-config-command-$line[1]:"- case $line[1] in- (shell)-_arguments "${_arguments_options[@]}" : \-'-C+[Working directory for this command]:path:_files' \-'--config=[User config file path]:path:_files' \-'-v[Show commands and debug info]' \-'--verbose[Show commands and debug info]' \-'-h[Print help]' \-'--help[Print help]' \-":: :_wt__config__shell_commands" \-"*::: :->shell" \-&& ret=0-- case $state in- (shell)- words=($line[1] "${words[@]}")- (( CURRENT += 1 ))- curcontext="${curcontext%:*:*}:wt-config-shell-command-$line[1]:"- case $line[1] in- (init)-_arguments "${_arguments_options[@]}" : \-'--command-name=[Command name]:COMMAND_NAME:_default' \-'-C+[Working directory for this command]:path:_files' \-'--config=[User config file path]:path:_files' \-'-v[Show commands and debug info]' \-'--verbose[Show commands and debug info]' \-'-h[Print help (see more with '\''--help'\'')]' \-'--help[Print help (see more with '\''--help'\'')]' \-':shell -- Shell to generate code for:(bash fish zsh)' \-&& ret=0-;;-(install)-_arguments "${_arguments_options[@]}" : \-'--command-name=[Command name]:COMMAND_NAME:_default' \-'-C+[Working directory for this command]:path:_files' \-'--config=[User config file path]:path:_files' \-'-f[Skip confirmation prompt]' \-'--force[Skip confirmation prompt]' \-'-v[Show commands and debug info]' \-'--verbose[Show commands and debug info]' \-'-h[Print help (see more with '\''--help'\'')]' \-'--help[Print help (see more with '\''--help'\'')]' \-'::shell -- Shell to install (default\: auto-detect):(bash fish zsh)' \-&& ret=0-;;- esac- ;;-esac-;;-(create)-_arguments "${_arguments_options[@]}" : \-'-C+[Working directory for this command]:path:_files' \-'--config=[User config file path]:path:_files' \-'-v[Show commands and debug info]' \-'--verbose[Show commands and debug info]' \-'-h[Print help (see more with '\''--help'\'')]' \-'--help[Print help (see more with '\''--help'\'')]' \-&& ret=0-;;-(list)-_arguments "${_arguments_options[@]}" : \-'-C+[Working directory for this command]:path:_files' \-'--config=[User config file path]:path:_files' \-'-v[Show commands and debug info]' \-'--verbose[Show commands and debug info]' \-'-h[Print help (see more with '\''--help'\'')]' \-'--help[Print help (see more with '\''--help'\'')]' \-&& ret=0-;;-(refresh-cache)-_arguments "${_arguments_options[@]}" : \-'-C+[Working directory for this command]:path:_files' \-'--config=[User config file path]:path:_files' \-'-v[Show commands and debug info]' \-'--verbose[Show commands and debug info]' \-'-h[Print help (see more with '\''--help'\'')]' \-'--help[Print help (see more with '\''--help'\'')]' \-&& ret=0-;;-(status)-_arguments "${_arguments_options[@]}" : \-'-C+[Working directory for this command]:path:_files' \-'--config=[User config file path]:path:_files' \-'-v[Show commands and debug info]' \-'--verbose[Show commands and debug info]' \-'-h[Print help]' \-'--help[Print help]' \-":: :_wt__config__status_commands" \-"*::: :->status" \-&& ret=0-- case $state in- (status)- words=($line[1] "${words[@]}")- (( CURRENT += 1 ))- curcontext="${curcontext%:*:*}:wt-config-status-command-$line[1]:"- case $line[1] in- (set)-_arguments "${_arguments_options[@]}" : \-'--branch=[Target branch (defaults to current)]:BRANCH:_default' \-'-C+[Working directory for this command]:path:_files' \-'--config=[User config file path]:path:_files' \-'-v[Show commands and debug info]' \-'--verbose[Show commands and debug info]' \-'-h[Print help (see more with '\''--help'\'')]' \-'--help[Print help (see more with '\''--help'\'')]' \-':value -- Status emoji to display:_default' \-&& ret=0-;;-(unset)-_arguments "${_arguments_options[@]}" : \-'-C+[Working directory for this command]:path:_files' \-'--config=[User config file path]:path:_files' \-'-v[Show commands and debug info]' \-'--verbose[Show commands and debug info]' \-'-h[Print help (see more with '\''--help'\'')]' \-'--help[Print help (see more with '\''--help'\'')]' \-'::target -- Branch or "*" for all:_default' \-&& ret=0-;;- esac- ;;-esac-;;-(approvals)-_arguments "${_arguments_options[@]}" : \-'-C+[Working directory for this command]:path:_files' \-'--config=[User config file path]:path:_files' \-'-v[Show commands and debug info]' \-'--verbose[Show commands and debug info]' \-'-h[Print help (see more with '\''--help'\'')]' \-'--help[Print help (see more with '\''--help'\'')]' \-":: :_wt__config__approvals_commands" \-"*::: :->approvals" \-&& ret=0-- case $state in- (approvals)- words=($line[1] "${words[@]}")- (( CURRENT += 1 ))- curcontext="${curcontext%:*:*}:wt-config-approvals-command-$line[1]:"- case $line[1] in- (ask)-_arguments "${_arguments_options[@]}" : \-'-C+[Working directory for this command]:path:_files' \-'--config=[User config file path]:path:_files' \-'-f[Skip approval prompts]' \-'--force[Skip approval prompts]' \-'--all[Show all commands]' \-'-v[Show commands and debug info]' \-'--verbose[Show commands and debug info]' \-'-h[Print help (see more with '\''--help'\'')]' \-'--help[Print help (see more with '\''--help'\'')]' \-&& ret=0-;;-(clear)-_arguments "${_arguments_options[@]}" : \-'-C+[Working directory for this command]:path:_files' \-'--config=[User config file path]:path:_files' \-'-g[Clear global approvals]' \-'--global[Clear global approvals]' \-'-v[Show commands and debug info]' \-'--verbose[Show commands and debug info]' \-'-h[Print help (see more with '\''--help'\'')]' \-'--help[Print help (see more with '\''--help'\'')]' \-&& ret=0-;;- esac- ;;-esac-;;- esac- ;;-esac-;;-(step)-_arguments "${_arguments_options[@]}" : \-'-C+[Working directory for this command]:path:_files' \-'--config=[User config file path]:path:_files' \-'-v[Show commands and debug info]' \-'--verbose[Show commands and debug info]' \-'-h[Print help]' \-'--help[Print help]' \-":: :_wt__step_commands" \-"*::: :->step" \-&& ret=0-- case $state in- (step)- words=($line[1] "${words[@]}")- (( CURRENT += 1 ))- curcontext="${curcontext%:*:*}:wt-step-command-$line[1]:"- case $line[1] in- (commit)-_arguments "${_arguments_options[@]}" : \-'--stage=[What to stage before committing \[default\: all\]]:STAGE:((all\:"Stage everything\: untracked files + unstaged tracked changes"-tracked\:"Stage tracked changes only (like git add -u)"-none\:"Stage nothing, commit only what'\''s already in the index"))' \-'-C+[Working directory for this command]:path:_files' \-'--config=[User config file path]:path:_files' \-'-f[Skip approval prompts]' \-'--force[Skip approval prompts]' \-'--no-verify[Skip pre-commit hooks]' \-'-v[Show commands and debug info]' \-'--verbose[Show commands and debug info]' \-'-h[Print help (see more with '\''--help'\'')]' \-'--help[Print help (see more with '\''--help'\'')]' \-&& ret=0-;;-(squash)-_arguments "${_arguments_options[@]}" : \-'--stage=[What to stage before committing \[default\: all\]]:STAGE:((all\:"Stage everything\: untracked files + unstaged tracked changes"-tracked\:"Stage tracked changes only (like git add -u)"-none\:"Stage nothing, commit only what'\''s already in the index"))' \-'-C+[Working directory for this command]:path:_files' \-'--config=[User config file path]:path:_files' \-'-f[Skip approval prompts]' \-'--force[Skip approval prompts]' \-'--no-verify[Skip pre-commit hooks]' \-'-v[Show commands and debug info]' \-'--verbose[Show commands and debug info]' \-'-h[Print help (see more with '\''--help'\'')]' \-'--help[Print help (see more with '\''--help'\'')]' \-'::target -- Target branch:_default' \-&& ret=0-;;-(push)-_arguments "${_arguments_options[@]}" : \-'-C+[Working directory for this command]:path:_files' \-'--config=[User config file path]:path:_files' \-'--allow-merge-commits[Allow merge commits]' \-'-v[Show commands and debug info]' \-'--verbose[Show commands and debug info]' \-'-h[Print help (see more with '\''--help'\'')]' \-'--help[Print help (see more with '\''--help'\'')]' \-'::target -- Target branch:_default' \-&& ret=0-;;-(rebase)-_arguments "${_arguments_options[@]}" : \-'-C+[Working directory for this command]:path:_files' \-'--config=[User config file path]:path:_files' \-'-v[Show commands and debug info]' \-'--verbose[Show commands and debug info]' \-'-h[Print help (see more with '\''--help'\'')]' \-'--help[Print help (see more with '\''--help'\'')]' \-'::target -- Target branch:_default' \-&& ret=0-;;-(post-create)-_arguments "${_arguments_options[@]}" : \-'-C+[Working directory for this command]:path:_files' \-'--config=[User config file path]:path:_files' \-'-f[Skip approval prompts]' \-'--force[Skip approval prompts]' \-'-v[Show commands and debug info]' \-'--verbose[Show commands and debug info]' \-'-h[Print help]' \-'--help[Print help]' \-&& ret=0-;;-(post-start)-_arguments "${_arguments_options[@]}" : \-'-C+[Working directory for this command]:path:_files' \-'--config=[User config file path]:path:_files' \-'-f[Skip approval prompts]' \-'--force[Skip approval prompts]' \-'-v[Show commands and debug info]' \-'--verbose[Show commands and debug info]' \-'-h[Print help]' \-'--help[Print help]' \-&& ret=0-;;-(pre-commit)-_arguments "${_arguments_options[@]}" : \-'-C+[Working directory for this command]:path:_files' \-'--config=[User config file path]:path:_files' \-'-f[Skip approval prompts]' \-'--force[Skip approval prompts]' \-'-v[Show commands and debug info]' \-'--verbose[Show commands and debug info]' \-'-h[Print help]' \-'--help[Print help]' \-&& ret=0-;;-(pre-merge)-_arguments "${_arguments_options[@]}" : \-'-C+[Working directory for this command]:path:_files' \-'--config=[User config file path]:path:_files' \-'-f[Skip approval prompts]' \-'--force[Skip approval prompts]' \-'-v[Show commands and debug info]' \-'--verbose[Show commands and debug info]' \-'-h[Print help]' \-'--help[Print help]' \-&& ret=0-;;-(post-merge)-_arguments "${_arguments_options[@]}" : \-'-C+[Working directory for this command]:path:_files' \-'--config=[User config file path]:path:_files' \-'-f[Skip approval prompts]' \-'--force[Skip approval prompts]' \-'-v[Show commands and debug info]' \-'--verbose[Show commands and debug info]' \-'-h[Print help]' \-'--help[Print help]' \-&& ret=0-;;- esac- ;;-esac-;;-(beta)-_arguments "${_arguments_options[@]}" : \-'-C+[Working directory for this command]:path:_files' \-'--config=[User config file path]:path:_files' \-'-v[Show commands and debug info]' \-'--verbose[Show commands and debug info]' \-'-h[Print help]' \-'--help[Print help]' \-":: :_wt__beta_commands" \-"*::: :->beta" \-&& ret=0-- case $state in- (beta)- words=($line[1] "${words[@]}")- (( CURRENT += 1 ))- curcontext="${curcontext%:*:*}:wt-beta-command-$line[1]:"- case $line[1] in- (select)-_arguments "${_arguments_options[@]}" : \-'-C+[Working directory for this command]:path:_files' \-'--config=[User config file path]:path:_files' \-'-v[Show commands and debug info]' \-'--verbose[Show commands and debug info]' \-'-h[Print help (see more with '\''--help'\'')]' \-'--help[Print help (see more with '\''--help'\'')]' \-&& ret=0-;;- esac- ;;-esac-;;-(list)-_arguments "${_arguments_options[@]}" : \-'--format=[Output format (table, json)]:FORMAT:((table\:"Human-readable table format"-json\:"JSON output"))' \-'-C+[Working directory for this command]:path:_files' \-'--config=[User config file path]:path:_files' \-'--branches[Include branches without worktrees]' \-'--remotes[Include remote branches]' \-'--full[Show CI, conflicts, diffs]' \-'--progressive[Show fast info immediately, update with slow info]' \-'--no-progressive[Force buffered rendering]' \-'-v[Show commands and debug info]' \-'--verbose[Show commands and debug info]' \-'-h[Print help (see more with '\''--help'\'')]' \-'--help[Print help (see more with '\''--help'\'')]' \-&& ret=0-;;-(switch)-_arguments "${_arguments_options[@]}" : \-'-b+[Base branch]:BASE:_default' \-'--base=[Base branch]:BASE:_default' \-'-x+[Command to run after switch]:EXECUTE:_default' \-'--execute=[Command to run after switch]:EXECUTE:_default' \-'-C+[Working directory for this command]:path:_files' \-'--config=[User config file path]:path:_files' \-'-c[Create a new branch]' \-'--create[Create a new branch]' \-'-f[Skip approval prompts]' \-'--force[Skip approval prompts]' \-'--no-verify[Skip all project hooks]' \-'-v[Show commands and debug info]' \-'--verbose[Show commands and debug info]' \-'-h[Print help (see more with '\''--help'\'')]' \-'--help[Print help (see more with '\''--help'\'')]' \-':branch -- Branch, path, '\''@'\'' (HEAD), '\''-'\'' (previous), or '\''^'\'' (main):_default' \-&& ret=0-;;-(remove)-_arguments "${_arguments_options[@]}" : \-'-C+[Working directory for this command]:path:_files' \-'--config=[User config file path]:path:_files' \-'--no-delete-branch[Keep branch after removal]' \-'-D[Delete unmerged branches]' \-'--force-delete[Delete unmerged branches]' \-'--no-background[Run removal in foreground]' \-'-v[Show commands and debug info]' \-'--verbose[Show commands and debug info]' \-'-h[Print help (see more with '\''--help'\'')]' \-'--help[Print help (see more with '\''--help'\'')]' \-'*::worktrees -- Worktree or branch (@ for current):_default' \-&& ret=0-;;-(merge)-_arguments "${_arguments_options[@]}" : \-'--stage=[What to stage before committing \[default\: all\]]:STAGE:((all\:"Stage everything\: untracked files + unstaged tracked changes"-tracked\:"Stage tracked changes only (like git add -u)"-none\:"Stage nothing, commit only what'\''s already in the index"))' \-'-C+[Working directory for this command]:path:_files' \-'--config=[User config file path]:path:_files' \-'--squash[Force commit squashing]' \-'--no-squash[Skip commit squashing]' \-'--commit[Force commit, squash, and rebase]' \-'--no-commit[Skip commit, squash, and rebase]' \-'--remove[Force worktree removal after merge]' \-'--no-remove[Keep worktree after merge]' \-'--verify[Force running project hooks]' \-'--no-verify[Skip all project hooks]' \-'-f[Skip approval prompts]' \-'--force[Skip approval prompts]' \-'-v[Show commands and debug info]' \-'--verbose[Show commands and debug info]' \-'-h[Print help (see more with '\''--help'\'')]' \-'--help[Print help (see more with '\''--help'\'')]' \-'::target -- Target branch:_default' \-&& ret=0-;;- esac- ;;-esac-}--(( $+functions[_wt_commands] )) ||-_wt_commands() {- local commands; commands=(-'config:Manage configuration and shell integration' \-'step:Primitive operations (building blocks for workflows)' \-'beta:Experimental commands' \-'list:List worktrees and optionally branches' \-'switch:Switch to a worktree' \-'remove:Remove worktree and branch' \-'merge:Merge worktree into target branch' \- )- _describe -t commands 'wt commands' commands "$@"-}-(( $+functions[_wt__beta_commands] )) ||-_wt__beta_commands() {- local commands; commands=(-'select:Interactive worktree selector' \- )- _describe -t commands 'wt beta commands' commands "$@"-}-(( $+functions[_wt__beta__select_commands] )) ||-_wt__beta__select_commands() {- local commands; commands=()- _describe -t commands 'wt beta select commands' commands "$@"-}-(( $+functions[_wt__config_commands] )) ||-_wt__config_commands() {- local commands; commands=(-'shell:Shell integration setup' \-'create:Create global configuration file' \-'list:List configuration files & locations' \-'refresh-cache:Refresh default branch from remote' \-'status:Manage branch status markers' \-'approvals:Manage command approvals' \- )- _describe -t commands 'wt config commands' commands "$@"-}-(( $+functions[_wt__config__approvals_commands] )) ||-_wt__config__approvals_commands() {- local commands; commands=(-'ask:Store approvals in config' \-'clear:Clear approved commands from config' \- )- _describe -t commands 'wt config approvals commands' commands "$@"-}-(( $+functions[_wt__config__approvals__ask_commands] )) ||-_wt__config__approvals__ask_commands() {- local commands; commands=()- _describe -t commands 'wt config approvals ask commands' commands "$@"-}-(( $+functions[_wt__config__approvals__clear_commands] )) ||-_wt__config__approvals__clear_commands() {- local commands; commands=()- _describe -t commands 'wt config approvals clear commands' commands "$@"-}-(( $+functions[_wt__config__create_commands] )) ||-_wt__config__create_commands() {- local commands; commands=()- _describe -t commands 'wt config create commands' commands "$@"-}-(( $+functions[_wt__config__list_commands] )) ||-_wt__config__list_commands() {- local commands; commands=()- _describe -t commands 'wt config list commands' commands "$@"-}-(( $+functions[_wt__config__refresh-cache_commands] )) ||-_wt__config__refresh-cache_commands() {- local commands; commands=()- _describe -t commands 'wt config refresh-cache commands' commands "$@"-}-(( $+functions[_wt__config__shell_commands] )) ||-_wt__config__shell_commands() {- local commands; commands=(-'init:Generate shell integration code' \-'install:Write shell integration to config files' \- )- _describe -t commands 'wt config shell commands' commands "$@"-}-(( $+functions[_wt__config__shell__init_commands] )) ||-_wt__config__shell__init_commands() {- local commands; commands=()- _describe -t commands 'wt config shell init commands' commands "$@"-}-(( $+functions[_wt__config__shell__install_commands] )) ||-_wt__config__shell__install_commands() {- local commands; commands=()- _describe -t commands 'wt config shell install commands' commands "$@"-}-(( $+functions[_wt__config__status_commands] )) ||-_wt__config__status_commands() {- local commands; commands=(-'set:Set status emoji for branch' \-'unset:Clear status emoji' \- )- _describe -t commands 'wt config status commands' commands "$@"-}-(( $+functions[_wt__config__status__set_commands] )) ||-_wt__config__status__set_commands() {- local commands; commands=()- _describe -t commands 'wt config status set commands' commands "$@"-}-(( $+functions[_wt__config__status__unset_commands] )) ||-_wt__config__status__unset_commands() {- local commands; commands=()- _describe -t commands 'wt config status unset commands' commands "$@"-}-(( $+functions[_wt__list_commands] )) ||-_wt__list_commands() {- local commands; commands=()- _describe -t commands 'wt list commands' commands "$@"-}-(( $+functions[_wt__merge_commands] )) ||-_wt__merge_commands() {- local commands; commands=()- _describe -t commands 'wt merge commands' commands "$@"-}-(( $+functions[_wt__remove_commands] )) ||-_wt__remove_commands() {- local commands; commands=()- _describe -t commands 'wt remove commands' commands "$@"-}-(( $+functions[_wt__step_commands] )) ||-_wt__step_commands() {- local commands; commands=(-'commit:Commit changes with LLM message' \-'squash:Squash commits with LLM message' \-'push:Push changes to local target branch' \-'rebase:Rebase onto target' \-'post-create:Run post-create hook' \-'post-start:Run post-start hook' \-'pre-commit:Run pre-commit hook' \-'pre-merge:Run pre-merge hook' \-'post-merge:Run post-merge hook' \- )- _describe -t commands 'wt step commands' commands "$@"-}-(( $+functions[_wt__step__commit_commands] )) ||-_wt__step__commit_commands() {- local commands; commands=()- _describe -t commands 'wt step commit commands' commands "$@"-}-(( $+functions[_wt__step__post-create_commands] )) ||-_wt__step__post-create_commands() {- local commands; commands=()- _describe -t commands 'wt step post-create commands' commands "$@"-}-(( $+functions[_wt__step__post-merge_commands] )) ||-_wt__step__post-merge_commands() {- local commands; commands=()- _describe -t commands 'wt step post-merge commands' commands "$@"-}-(( $+functions[_wt__step__post-start_commands] )) ||-_wt__step__post-start_commands() {- local commands; commands=()- _describe -t commands 'wt step post-start commands' commands "$@"-}-(( $+functions[_wt__step__pre-commit_commands] )) ||-_wt__step__pre-commit_commands() {- local commands; commands=()- _describe -t commands 'wt step pre-commit commands' commands "$@"-}-(( $+functions[_wt__step__pre-merge_commands] )) ||-_wt__step__pre-merge_commands() {- local commands; commands=()- _describe -t commands 'wt step pre-merge commands' commands "$@"-}-(( $+functions[_wt__step__push_commands] )) ||-_wt__step__push_commands() {- local commands; commands=()- _describe -t commands 'wt step push commands' commands "$@"-}-(( $+functions[_wt__step__rebase_commands] )) ||-_wt__step__rebase_commands() {- local commands; commands=()- _describe -t commands 'wt step rebase commands' commands "$@"-}-(( $+functions[_wt__step__squash_commands] )) ||-_wt__step__squash_commands() {- local commands; commands=()- _describe -t commands 'wt step squash commands' commands "$@"-}-(( $+functions[_wt__switch_commands] )) ||-_wt__switch_commands() {- local commands; commands=()- _describe -t commands 'wt switch commands' commands "$@"-}--if [ "$funcstack[1]" = "_wt" ]; then- _wt "$@"-else- if (( $+functions[compdef] )); then compdef _wt wt; fifi----- stderr -----