#compdef workmux

autoload -U is-at-least

_workmux_base() {
    typeset -A opt_args
    typeset -a _arguments_options
    local ret=1

    if is-at-least 5.2; then
        _arguments_options=(-s -S -C)
    else
        _arguments_options=(-s -C)
    fi

    local context curcontext="$curcontext" state line
    _arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
'-V[Print version]' \
'--version[Print version]' \
":: :_workmux_base_commands" \
"*::: :->workmux" \
&& ret=0
    case $state in
    (workmux)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:workmux-command-$line[1]:"
        case $line[1] in
            (_deferred-cleanup)
_arguments "${_arguments_options[@]}" : \
'--worktree-path=[]:WORKTREE_PATH:_files' \
'--branch-name=[]:BRANCH_NAME:_default' \
'--handle=[]:HANDLE:_default' \
'--device=[]:DEVICE:_default' \
'--inode=[]:INODE:_default' \
'--expected-worktree=[]:EXPECTED_WORKTREE:_files' \
'--admin-dir=[]:ADMIN_DIR:_files' \
'--common-dir=[]:COMMON_DIR:_files' \
'--dot-git=[]:DOT_GIT:_files' \
'--source-mode=[]:SOURCE_MODE:(window session)' \
'--source-name=[]:SOURCE_NAME:_default' \
'--parent-session=[]:PARENT_SESSION:_default' \
'--source-id=[]:SOURCE_ID:_default' \
'--keep-branch[]' \
'--force[]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(add)
_arguments "${_arguments_options[@]}" : \
'(--base -A --auto-name)--pr=[Pull/merge request number or full GitHub/GitLab URL to checkout]:NUMBER|URL:_default' \
'--forge=[Forge for numeric --pr references (auto-detects gitlab.com; otherwise GitHub)]:FORGE:(github gitlab)' \
'--base=[Base branch/commit/tag to branch from (overrides config base_branch; config may use "auto"; defaults to current branch)]:BASE:_default' \
'--name=[Explicit name for the worktree directory and tmux window (overrides worktree_naming strategy and worktree_prefix)]:NAME:_default' \
'--target-name=[Explicit name for the workmux-managed tmux target]:TARGET_NAME:_default' \
'--parent-session=[Parent tmux session for window-mode targets]:PARENT_SESSION:_default' \
'(-P --prompt-file -e --prompt-editor)-p+[Inline prompt text to store in the new worktree]:PROMPT:_default' \
'(-P --prompt-file -e --prompt-editor)--prompt=[Inline prompt text to store in the new worktree]:PROMPT:_default' \
'(-p --prompt -e --prompt-editor)-P+[Path to a file whose contents should be used as the prompt]:PROMPT_FILE:_files' \
'(-p --prompt -e --prompt-editor)--prompt-file=[Path to a file whose contents should be used as the prompt]:PROMPT_FILE:_files' \
'*-a+[The agent(s) to use. Creates one worktree per agent if -n is not specified]:AGENT:_default' \
'*--agent=[The agent(s) to use. Creates one worktree per agent if -n is not specified]:AGENT:_default' \
'(--foreach)-n+[Number of worktree instances to create. Can be used with zero or one --agent. Incompatible with --foreach]:COUNT:_default' \
'(--foreach)--count=[Number of worktree instances to create. Can be used with zero or one --agent. Incompatible with --foreach]:COUNT:_default' \
'(-a --agent -n --count)--foreach=[Generate multiple worktrees from a variable matrix. Format\: "var1\:valA,valB;var2\:valX,valY". Lists must have equal length. Incompatible with --agent and --count]:FOREACH:_default' \
'--branch-template=[Template for branch names in multi-worktree modes. Variables\: {{ base_name }}, {{ agent }}, {{ num }}, {{ foreach_vars }}]:BRANCH_TEMPLATE:_default' \
'--max-concurrent=[Maximum number of worktrees to run concurrently. When set, waits for a slot to open before creating new worktrees]:MAX_CONCURRENT:_default' \
'(-a --agent)-l+[Use a named pane layout from config instead of default panes]:LAYOUT:_default' \
'(-a --agent)--layout=[Use a named pane layout from config instead of default panes]:LAYOUT:_default' \
'--fork=[Fork the last conversation from the current worktree into the new one. Specify a session ID to fork a specific conversation, or omit for most recent]::FORK:_default' \
'--mode=[Override the multiplexer mode for this command only]:MODE:(window session)' \
'--config=[Use an alternate config file for this invocation (still merges with global config)]:CONFIG:_files' \
'(--pr)-A[Generate branch name from prompt using LLM]' \
'(--pr)--auto-name[Generate branch name from prompt using LLM]' \
'(-p --prompt -P --prompt-file)-e[Open \$EDITOR to write the prompt]' \
'(-p --prompt -P --prompt-file)--prompt-editor[Open \$EDITOR to write the prompt]' \
'--prompt-file-only[Write the prompt file without injecting it into agent commands. The prompt is written to .workmux/PROMPT-<branch>.md in the worktree, but no agent pane is required. Useful when your editor has an embedded agent that reads the prompt file directly]' \
'-H[Skip running post-create hooks]' \
'--no-hooks[Skip running post-create hooks]' \
'-F[Skip file copy/symlink operations]' \
'--no-file-ops[Skip file copy/symlink operations]' \
'-C[Skip executing pane commands (panes open with plain shells)]' \
'--no-pane-cmds[Skip executing pane commands (panes open with plain shells)]' \
'-b[Create tmux window in the background (do not switch to it)]' \
'--background[Create tmux window in the background (do not switch to it)]' \
'(-w --with-changes)-o[Open existing worktree if it exists instead of failing (like tmux new -A)]' \
'(-w --with-changes)--open-if-exists[Open existing worktree if it exists instead of failing (like tmux new -A)]' \
'-S[Enable sandbox mode even when disabled in config]' \
'--sandbox[Enable sandbox mode even when disabled in config]' \
'(-n --count --foreach)-w[Move uncommitted changes from the current worktree to the new worktree]' \
'(-n --count --foreach)--with-changes[Move uncommitted changes from the current worktree to the new worktree]' \
'--patch[Interactively select which changes to move (only applies with --with-changes)]' \
'-u[Also move untracked files (only applies with --with-changes)]' \
'--include-untracked[Also move untracked files (only applies with --with-changes)]' \
'(--fork)-c[Resume the agent'\''s most recent conversation at the destination worktree path]' \
'(--fork)--continue[Resume the agent'\''s most recent conversation at the destination worktree path]' \
'-W[Block until the created tmux window is closed]' \
'--wait[Block until the created tmux window is closed]' \
'(--mode)-s[Create the window in its own tmux session (useful for session-per-project workflows)]' \
'(--mode)--session[Create the window in its own tmux session (useful for session-per-project workflows)]' \
'--dry-run[Show what would be created without making persistent changes]' \
'--headless[Create and provision the worktree without a multiplexer target]' \
'--json[Emit a machine-readable headless provisioning receipt]' \
'-h[Print help]' \
'--help[Print help]' \
'::branch_name -- Name of the branch (creates if it doesn'\''t exist) or remote ref (e.g., origin/feature). When used with --pr, this becomes the custom local branch name:_default' \
&& ret=0
;;
(open)
_arguments "${_arguments_options[@]}" : \
'--mode=[Override the multiplexer mode for this command only]:MODE:(window session)' \
'--target-name=[Explicit name for the workmux-managed tmux target]:TARGET_NAME:_default' \
'--parent-session=[Parent tmux session for window-mode targets]:PARENT_SESSION:_default' \
'(-P --prompt-file -e --prompt-editor)-p+[Inline prompt text to store in the new worktree]:PROMPT:_default' \
'(-P --prompt-file -e --prompt-editor)--prompt=[Inline prompt text to store in the new worktree]:PROMPT:_default' \
'(-p --prompt -e --prompt-editor)-P+[Path to a file whose contents should be used as the prompt]:PROMPT_FILE:_files' \
'(-p --prompt -e --prompt-editor)--prompt-file=[Path to a file whose contents should be used as the prompt]:PROMPT_FILE:_files' \
'--config=[Use an alternate config file for this invocation (still merges with global config)]:CONFIG:_files' \
'--run-hooks[Re-run post-create hooks (e.g., pnpm install)]' \
'--force-files[Re-apply file operations (copy/symlink)]' \
'-n[Force opening in a new window (creates suffix like -2, -3) instead of switching to existing]' \
'--new[Force opening in a new window (creates suffix like -2, -3) instead of switching to existing]' \
'(--mode)-s[Open in session mode (overrides stored mode for this worktree)]' \
'(--mode)--session[Open in session mode (overrides stored mode for this worktree)]' \
'-c[Resume the agent'\''s most recent conversation in this worktree]' \
'--continue[Resume the agent'\''s most recent conversation in this worktree]' \
'(-p --prompt -P --prompt-file)-e[Open \$EDITOR to write the prompt]' \
'(-p --prompt -P --prompt-file)--prompt-editor[Open \$EDITOR to write the prompt]' \
'--prompt-file-only[Write the prompt file without injecting it into agent commands. The prompt is written to .workmux/PROMPT-<branch>.md in the worktree, but no agent pane is required. Useful when your editor has an embedded agent that reads the prompt file directly]' \
'-h[Print help]' \
'--help[Print help]' \
'*::names -- Worktree name(s) (directory name, visible in tmux window). Optional with --new:_default' \
&& ret=0
;;
(close)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
'::name -- Worktree name (defaults to current directory if omitted):_default' \
&& ret=0
;;
(resurrect)
_arguments "${_arguments_options[@]}" : \
'--dry-run[Show what would be restored without doing it]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
&& ret=0
;;
(merge)
_arguments "${_arguments_options[@]}" : \
'--into=[The target branch to merge into (defaults to main_branch from config)]:INTO:_default' \
'--ignore-uncommitted[Ignore uncommitted and staged changes]' \
'--rebase[Rebase the branch onto the main branch before merging (fast-forward)]' \
'--squash[Squash all commits from the branch into a single commit on the main branch]' \
'-k[Keep the worktree, window, and branch after merging (skip cleanup)]' \
'--keep[Keep the worktree, window, and branch after merging (skip cleanup)]' \
'(-k --keep)--cleanup[Clean up the worktree, window, and branch after merging]' \
'-n[Skip running pre-merge hooks]' \
'--no-verify[Skip running pre-merge hooks]' \
'--no-hooks[Skip running all hooks (pre-merge and pre-remove)]' \
'--notification[Show a system notification on successful merge]' \
'-h[Print help]' \
'--help[Print help]' \
'::name -- Worktree name or branch (defaults to current directory):_default' \
&& ret=0
;;
(rebase)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
'::name -- Worktree name or branch (defaults to current directory):_default' \
&& ret=0
;;
(rename)
_arguments "${_arguments_options[@]}" : \
'-b[Also rename the underlying git branch to match the new handle]' \
'--branch[Also rename the underlying git branch to match the new handle]' \
'-h[Print help]' \
'--help[Print help]' \
'*::names -- \[OLD_NAME\] NEW_NAME. If only one argument is given, renames the current worktree:_default' \
&& ret=0
;;
(remove)
_arguments "${_arguments_options[@]}" : \
'(--all)--gone[Remove worktrees whose upstream remote branch has been deleted (e.g., after PR merge)]' \
'--all[Remove all worktrees (except the main worktree)]' \
'-f[Skip confirmation and ignore uncommitted changes]' \
'--force[Skip confirmation and ignore uncommitted changes]' \
'-k[Keep the local branch (only remove worktree and tmux window)]' \
'--keep-branch[Keep the local branch (only remove worktree and tmux window)]' \
'-h[Print help]' \
'--help[Print help]' \
'*::names -- Worktree names (defaults to current directory name if empty):_default' \
&& ret=0
;;
(rm)
_arguments "${_arguments_options[@]}" : \
'(--all)--gone[Remove worktrees whose upstream remote branch has been deleted (e.g., after PR merge)]' \
'--all[Remove all worktrees (except the main worktree)]' \
'-f[Skip confirmation and ignore uncommitted changes]' \
'--force[Skip confirmation and ignore uncommitted changes]' \
'-k[Keep the local branch (only remove worktree and tmux window)]' \
'--keep-branch[Keep the local branch (only remove worktree and tmux window)]' \
'-h[Print help]' \
'--help[Print help]' \
'*::names -- Worktree names (defaults to current directory name if empty):_default' \
&& ret=0
;;
(list)
_arguments "${_arguments_options[@]}" : \
'--pr[Show PR status for each worktree (requires gh CLI)]' \
'--json[Output as JSON]' \
'--all[List worktrees across repositories with tracked agents]' \
'-h[Print help]' \
'--help[Print help]' \
'*::filter -- Filter by worktree name or branch (supports multiple):_default' \
&& ret=0
;;
(ls)
_arguments "${_arguments_options[@]}" : \
'--pr[Show PR status for each worktree (requires gh CLI)]' \
'--json[Output as JSON]' \
'--all[List worktrees across repositories with tracked agents]' \
'-h[Print help]' \
'--help[Print help]' \
'*::filter -- Filter by worktree name or branch (supports multiple):_default' \
&& ret=0
;;
(path)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
':name -- Worktree name (directory name):_default' \
&& ret=0
;;
(send)
_arguments "${_arguments_options[@]}" : \
'()-f+[Read prompt from file]:FILE:_default' \
'()--file=[Read prompt from file]:FILE:_default' \
'-h[Print help]' \
'--help[Print help]' \
':name -- Worktree name (supports cross-project with project\:handle syntax):_default' \
'::text -- Text to send (reads from --file or stdin if omitted):_default' \
&& ret=0
;;
(capture)
_arguments "${_arguments_options[@]}" : \
'-n+[Number of lines to capture]:LINES:_default' \
'--lines=[Number of lines to capture]:LINES:_default' \
'-h[Print help]' \
'--help[Print help]' \
':name -- Worktree name (supports cross-project with project\:handle syntax):_default' \
&& ret=0
;;
(status)
_arguments "${_arguments_options[@]}" : \
'--json[Output as JSON]' \
'()--all[Report tracked agents across all repositories]' \
'--git[Include git info (staged/unstaged changes, unmerged commits)]' \
'-h[Print help]' \
'--help[Print help]' \
'*::worktrees -- Worktree names (supports cross-project with project\:handle syntax):_default' \
&& ret=0
;;
(wait)
_arguments "${_arguments_options[@]}" : \
'--status=[Target status to wait for]:STATUS:_default' \
'--timeout=[Maximum wait time in seconds]:TIMEOUT:_default' \
'--any[Return when ANY worktree reaches target (default\: wait for ALL)]' \
'-h[Print help]' \
'--help[Print help]' \
'*::worktrees -- Worktree names (supports cross-project with project\:handle syntax):_default' \
&& ret=0
;;
(run)
_arguments "${_arguments_options[@]}" : \
'--timeout=[Maximum wait time in seconds]:TIMEOUT:_default' \
'-b[Run in background without waiting (default\: wait and stream output)]' \
'--background[Run in background without waiting (default\: wait and stream output)]' \
'--keep[Keep run artifacts after completion (for debugging)]' \
'-h[Print help]' \
'--help[Print help]' \
':name -- Worktree name (supports cross-project with project\:handle syntax):_default' \
'*::command -- Command to run (everything after --):_default' \
&& ret=0
;;
(reap-agents)
_arguments "${_arguments_options[@]}" : \
'--hours=[Age threshold in hours]:HOURS:_default' \
'-f[Actually exit matching agents instead of showing what would happen]' \
'--force[Actually exit matching agents instead of showing what would happen]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(sync-files)
_arguments "${_arguments_options[@]}" : \
'--all[Sync all worktrees instead of just the current one]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(init)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(setup)
_arguments "${_arguments_options[@]}" : \
'--hooks[Only set up status tracking hooks]' \
'--skills[Only install skills]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(uninstall)
_arguments "${_arguments_options[@]}" : \
'--dry-run[Show what would be removed without actually removing]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(docs)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(changelog)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(update)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(sidebar)
_arguments "${_arguments_options[@]}" : \
'--position=[Sidebar placement when enabling]:POSITION:(left top)' \
'--width=[Sidebar width in columns or as a percentage, for example 40 or 15%]:WIDTH:_default' \
'--height=[Sidebar height in rows or as a percentage, for example 3 or 10%]:HEIGHT:_default' \
'-s[Scope sidebar to this session, or toggle this session off when global sidebar is active]' \
'--session[Scope sidebar to this session, or toggle this session off when global sidebar is active]' \
'-h[Print help]' \
'--help[Print help]' \
":: :_workmux_base__sidebar_commands" \
"*::: :->sidebar" \
&& ret=0

    case $state in
    (sidebar)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:workmux-sidebar-command-$line[1]:"
        case $line[1] in
            (on)
_arguments "${_arguments_options[@]}" : \
'--position=[Sidebar placement when enabling]:POSITION:(left top)' \
'--width=[Sidebar width in columns or as a percentage, for example 40 or 15%]:WIDTH:_default' \
'--height=[Sidebar height in rows or as a percentage, for example 3 or 10%]:HEIGHT:_default' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(off)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(next)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(prev)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(jump)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
':index -- Agent number (1-9):_default' \
&& ret=0
;;
(filter)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
'::mode -- Filter mode\: "none"/"all" or "session"/"project":_default' \
&& ret=0
;;
(group)
_arguments "${_arguments_options[@]}" : \
'()--clear[Drop the runtime grouping and follow the config file again]' \
'-h[Print help]' \
'--help[Print help]' \
'::mode -- Grouping\: "none"/"off", "project" or "session":_default' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_workmux_base__sidebar__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:workmux-sidebar-help-command-$line[1]:"
        case $line[1] in
            (on)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(off)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(next)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(prev)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(jump)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(filter)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(group)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
;;
(_sidebar-run)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(_sidebar-sync)
_arguments "${_arguments_options[@]}" : \
'--window=[Target window ID (from tmux hook context)]:WINDOW:_default' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(_sidebar-reflow)
_arguments "${_arguments_options[@]}" : \
'--window=[Target window ID]:WINDOW:_default' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(_sidebar-reflow-all)
_arguments "${_arguments_options[@]}" : \
'--exclude=[Exclude this window ID from reflow (e.g. the window that just lost a pane)]:EXCLUDE:_default' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(_sidebar-daemon)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(dashboard)
_arguments "${_arguments_options[@]}" : \
'-P+[Preview pane size as percentage (10-90). Larger = more preview, less table]:PREVIEW_SIZE:_default' \
'--preview-size=[Preview pane size as percentage (10-90). Larger = more preview, less table]:PREVIEW_SIZE:_default' \
'-t+[Open directly on the specified tab]:TAB:(agents worktrees)' \
'--tab=[Open directly on the specified tab]:TAB:(agents worktrees)' \
'-d[Open diff view directly for the current worktree]' \
'--diff[Open diff view directly for the current worktree]' \
'-s[Filter to only show agents in the current session]' \
'--session[Filter to only show agents in the current session]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(config)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
":: :_workmux_base__config_commands" \
"*::: :->config" \
&& ret=0

    case $state in
    (config)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:workmux-config-command-$line[1]:"
        case $line[1] in
            (edit)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(path)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(reference)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_workmux_base__config__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:workmux-config-help-command-$line[1]:"
        case $line[1] in
            (edit)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(path)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(reference)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
;;
(claude)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
":: :_workmux_base__claude_commands" \
"*::: :->claude" \
&& ret=0

    case $state in
    (claude)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:workmux-claude-command-$line[1]:"
        case $line[1] in
            (prune)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_workmux_base__claude__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:workmux-claude-help-command-$line[1]:"
        case $line[1] in
            (prune)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
;;
(sandbox)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
":: :_workmux_base__sandbox_commands" \
"*::: :->sandbox" \
&& ret=0

    case $state in
    (sandbox)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:workmux-sandbox-command-$line[1]:"
        case $line[1] in
            (build)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(pull)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(init-dockerfile)
_arguments "${_arguments_options[@]}" : \
'--force[Overwrite existing Dockerfiles]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(prune)
_arguments "${_arguments_options[@]}" : \
'-f[Skip confirmation and delete all workmux VMs]' \
'--force[Skip confirmation and delete all workmux VMs]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(run)
_arguments "${_arguments_options[@]}" : \
'--worktree-root=[Root of the worktree for mounting (defaults to worktree path)]:WORKTREE_ROOT:_files' \
'-h[Print help]' \
'--help[Print help]' \
':worktree -- Path to the working directory:_files' \
'*::command -- Command and arguments to run inside the sandbox:_default' \
&& ret=0
;;
(install-dev)
_arguments "${_arguments_options[@]}" : \
'--skip-build[Skip cross-compilation and use existing binary]' \
'--release[Use release profile (slower build, faster binary)]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(stop)
_arguments "${_arguments_options[@]}" : \
'--all[Stop all workmux VMs (wm-* prefix)]' \
'-y[Skip confirmation prompt]' \
'--yes[Skip confirmation prompt]' \
'-h[Print help]' \
'--help[Print help]' \
'::name -- VM name to stop (if not provided, show interactive list):_default' \
&& ret=0
;;
(agent)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
'*::command -- Command to run instead of the configured agent:_default' \
&& ret=0
;;
(shell)
_arguments "${_arguments_options[@]}" : \
'-e[Exec into an existing container for this worktree instead of starting a new one (container backend only)]' \
'--exec[Exec into an existing container for this worktree instead of starting a new one (container backend only)]' \
'-h[Print help]' \
'--help[Print help]' \
'*::command -- Command to run instead of bash:_default' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_workmux_base__sandbox__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:workmux-sandbox-help-command-$line[1]:"
        case $line[1] in
            (build)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(pull)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(init-dockerfile)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(prune)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(run)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(install-dev)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(stop)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(agent)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(shell)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
;;
(set-window-status)
_arguments "${_arguments_options[@]}" : \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
':command:((working\:"Set status to "working" (agent is processing)"
waiting\:"Set status to "waiting" (agent needs user input) - auto-clears on window focus"
done\:"Set status to "done" (agent finished) - auto-clears on window focus"
clear\:"Clear the status"))' \
&& ret=0
;;
(register-agent)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(set-base)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
':base -- The new base branch:_default' \
&& ret=0
;;
(_exec)
_arguments "${_arguments_options[@]}" : \
'--run-dir=[Absolute path to run directory]:RUN_DIR:_files' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(last-done)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(last-agent)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(host-exec)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
'*::args -- Command name and arguments:_default' \
&& ret=0
;;
(clipboard-read)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
':mime -- MIME type to read:_default' \
&& ret=0
;;
(completions)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
':shell -- The shell to generate completions for:(bash elvish fish powershell zsh)' \
&& ret=0
;;
(_complete-branches)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(_complete-handles)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(_complete-git-branches)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(_complete-agent-targets)
_arguments "${_arguments_options[@]}" : \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
&& ret=0
;;
(_check-update)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_workmux_base__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:workmux-help-command-$line[1]:"
        case $line[1] in
            (_deferred-cleanup)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(add)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(open)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(close)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(resurrect)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(merge)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(rebase)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(rename)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(remove)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(list)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(path)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(send)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(capture)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(status)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(wait)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(run)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(reap-agents)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(sync-files)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(init)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(setup)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(uninstall)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(docs)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(changelog)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(update)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(sidebar)
_arguments "${_arguments_options[@]}" : \
":: :_workmux_base__help__sidebar_commands" \
"*::: :->sidebar" \
&& ret=0

    case $state in
    (sidebar)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:workmux-help-sidebar-command-$line[1]:"
        case $line[1] in
            (on)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(off)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(next)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(prev)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(jump)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(filter)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(group)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
(_sidebar-run)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(_sidebar-sync)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(_sidebar-reflow)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(_sidebar-reflow-all)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(_sidebar-daemon)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(dashboard)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(config)
_arguments "${_arguments_options[@]}" : \
":: :_workmux_base__help__config_commands" \
"*::: :->config" \
&& ret=0

    case $state in
    (config)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:workmux-help-config-command-$line[1]:"
        case $line[1] in
            (edit)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(path)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(reference)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
(claude)
_arguments "${_arguments_options[@]}" : \
":: :_workmux_base__help__claude_commands" \
"*::: :->claude" \
&& ret=0

    case $state in
    (claude)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:workmux-help-claude-command-$line[1]:"
        case $line[1] in
            (prune)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
(sandbox)
_arguments "${_arguments_options[@]}" : \
":: :_workmux_base__help__sandbox_commands" \
"*::: :->sandbox" \
&& ret=0

    case $state in
    (sandbox)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:workmux-help-sandbox-command-$line[1]:"
        case $line[1] in
            (build)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(pull)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(init-dockerfile)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(prune)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(run)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(install-dev)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(stop)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(agent)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(shell)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
(set-window-status)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(register-agent)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(set-base)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(_exec)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(last-done)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(last-agent)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(host-exec)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(clipboard-read)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(completions)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(_complete-branches)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(_complete-handles)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(_complete-git-branches)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(_complete-agent-targets)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(_check-update)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
}

(( $+functions[_workmux_base_commands] )) ||
_workmux_base_commands() {
    local commands; commands=(
'_deferred-cleanup:' \
'add:Create a new worktree and tmux window' \
'open:Open a tmux window for an existing worktree' \
'close:Close a worktree'\''s tmux window (keeps the worktree and branch)' \
'resurrect:Restore worktree windows after a tmux or computer crash' \
'merge:Merge a branch, then clean up the worktree and tmux window' \
'rebase:Rebase a worktree branch onto its base branch' \
'rename:Rename a worktree, its tmux window/session, and (optionally) its branch' \
'remove:Remove a worktree, tmux window, and branch without merging' \
'rm:Remove a worktree, tmux window, and branch without merging' \
'list:List all worktrees' \
'ls:List all worktrees' \
'path:Get the filesystem path of a worktree' \
'send:Send a prompt or instruction to a running agent' \
'capture:Capture terminal output from a running agent' \
'status:Query agent status for worktrees' \
'wait:Wait for agents to reach a target status' \
'run:Run a command in a worktree'\''s window' \
'reap-agents:Exit tracked agent processes older than a configured age' \
'sync-files:Re-apply file operations (copy/symlink) to worktrees' \
'init:Generate example .workmux.yaml configuration file' \
'setup:Set up agent status tracking hooks and install skills' \
'uninstall:Remove agent status tracking hooks, skills, and cache/state dirs' \
'docs:Show detailed documentation (renders README.md)' \
'changelog:Show the changelog (what'\''s new in each version)' \
'update:Update workmux to the latest version' \
'sidebar:Control a live agent status sidebar in tmux' \
'_sidebar-run:Run the sidebar TUI (internal use)' \
'_sidebar-sync:Sync sidebar into a window (internal use, called by tmux hooks)' \
'_sidebar-reflow:Reflow sidebar layout after window resize (internal use, called by tmux hooks)' \
'_sidebar-reflow-all:Reflow sidebar layouts in all windows (internal use)' \
'_sidebar-daemon:Run the sidebar daemon (internal use)' \
'dashboard:Show a TUI dashboard of all active workmux agents across all sessions' \
'config:Manage global configuration' \
'claude:Claude Code integration commands' \
'sandbox:Manage sandbox settings' \
'set-window-status:Set agent status for the current tmux window (used by hooks)' \
'register-agent:Register the agent in the current multiplexer pane (used by hooks)' \
'set-base:Set the base branch for the current worktree (used after rebasing)' \
'_exec:Execute a run spec (internal use)' \
'last-done:Switch to the agent that most recently completed or is waiting for input' \
'last-agent:Switch to the last visited agent (toggle between two)' \
'host-exec:Execute a command on the host (used by guest shims)' \
'clipboard-read:Read clipboard from host (used by sandbox clipboard shims)' \
'completions:Generate shell completions' \
'_complete-branches:Output worktree branch names for shell completion (internal use)' \
'_complete-handles:Output worktree handles for shell completion (internal use)' \
'_complete-git-branches:Output git branches for shell completion (internal use)' \
'_complete-agent-targets:Output agent targets for shell completion (internal use)' \
'_check-update:Background update check (internal use)' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'workmux commands' commands "$@"
}
(( $+functions[_workmux_base___check-update_commands] )) ||
_workmux_base___check-update_commands() {
    local commands; commands=()
    _describe -t commands 'workmux _check-update commands' commands "$@"
}
(( $+functions[_workmux_base___complete-agent-targets_commands] )) ||
_workmux_base___complete-agent-targets_commands() {
    local commands; commands=()
    _describe -t commands 'workmux _complete-agent-targets commands' commands "$@"
}
(( $+functions[_workmux_base___complete-branches_commands] )) ||
_workmux_base___complete-branches_commands() {
    local commands; commands=()
    _describe -t commands 'workmux _complete-branches commands' commands "$@"
}
(( $+functions[_workmux_base___complete-git-branches_commands] )) ||
_workmux_base___complete-git-branches_commands() {
    local commands; commands=()
    _describe -t commands 'workmux _complete-git-branches commands' commands "$@"
}
(( $+functions[_workmux_base___complete-handles_commands] )) ||
_workmux_base___complete-handles_commands() {
    local commands; commands=()
    _describe -t commands 'workmux _complete-handles commands' commands "$@"
}
(( $+functions[_workmux_base___deferred-cleanup_commands] )) ||
_workmux_base___deferred-cleanup_commands() {
    local commands; commands=()
    _describe -t commands 'workmux _deferred-cleanup commands' commands "$@"
}
(( $+functions[_workmux_base___exec_commands] )) ||
_workmux_base___exec_commands() {
    local commands; commands=()
    _describe -t commands 'workmux _exec commands' commands "$@"
}
(( $+functions[_workmux_base___sidebar-daemon_commands] )) ||
_workmux_base___sidebar-daemon_commands() {
    local commands; commands=()
    _describe -t commands 'workmux _sidebar-daemon commands' commands "$@"
}
(( $+functions[_workmux_base___sidebar-reflow_commands] )) ||
_workmux_base___sidebar-reflow_commands() {
    local commands; commands=()
    _describe -t commands 'workmux _sidebar-reflow commands' commands "$@"
}
(( $+functions[_workmux_base___sidebar-reflow-all_commands] )) ||
_workmux_base___sidebar-reflow-all_commands() {
    local commands; commands=()
    _describe -t commands 'workmux _sidebar-reflow-all commands' commands "$@"
}
(( $+functions[_workmux_base___sidebar-run_commands] )) ||
_workmux_base___sidebar-run_commands() {
    local commands; commands=()
    _describe -t commands 'workmux _sidebar-run commands' commands "$@"
}
(( $+functions[_workmux_base___sidebar-sync_commands] )) ||
_workmux_base___sidebar-sync_commands() {
    local commands; commands=()
    _describe -t commands 'workmux _sidebar-sync commands' commands "$@"
}
(( $+functions[_workmux_base__add_commands] )) ||
_workmux_base__add_commands() {
    local commands; commands=()
    _describe -t commands 'workmux add commands' commands "$@"
}
(( $+functions[_workmux_base__capture_commands] )) ||
_workmux_base__capture_commands() {
    local commands; commands=()
    _describe -t commands 'workmux capture commands' commands "$@"
}
(( $+functions[_workmux_base__changelog_commands] )) ||
_workmux_base__changelog_commands() {
    local commands; commands=()
    _describe -t commands 'workmux changelog commands' commands "$@"
}
(( $+functions[_workmux_base__claude_commands] )) ||
_workmux_base__claude_commands() {
    local commands; commands=(
'prune:Remove stale entries from ~/.claude.json for deleted worktrees' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'workmux claude commands' commands "$@"
}
(( $+functions[_workmux_base__claude__help_commands] )) ||
_workmux_base__claude__help_commands() {
    local commands; commands=(
'prune:Remove stale entries from ~/.claude.json for deleted worktrees' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'workmux claude help commands' commands "$@"
}
(( $+functions[_workmux_base__claude__help__help_commands] )) ||
_workmux_base__claude__help__help_commands() {
    local commands; commands=()
    _describe -t commands 'workmux claude help help commands' commands "$@"
}
(( $+functions[_workmux_base__claude__help__prune_commands] )) ||
_workmux_base__claude__help__prune_commands() {
    local commands; commands=()
    _describe -t commands 'workmux claude help prune commands' commands "$@"
}
(( $+functions[_workmux_base__claude__prune_commands] )) ||
_workmux_base__claude__prune_commands() {
    local commands; commands=()
    _describe -t commands 'workmux claude prune commands' commands "$@"
}
(( $+functions[_workmux_base__clipboard-read_commands] )) ||
_workmux_base__clipboard-read_commands() {
    local commands; commands=()
    _describe -t commands 'workmux clipboard-read commands' commands "$@"
}
(( $+functions[_workmux_base__close_commands] )) ||
_workmux_base__close_commands() {
    local commands; commands=()
    _describe -t commands 'workmux close commands' commands "$@"
}
(( $+functions[_workmux_base__completions_commands] )) ||
_workmux_base__completions_commands() {
    local commands; commands=()
    _describe -t commands 'workmux completions commands' commands "$@"
}
(( $+functions[_workmux_base__config_commands] )) ||
_workmux_base__config_commands() {
    local commands; commands=(
'edit:Open the global configuration file in your editor (\$VISUAL, \$EDITOR, or vi)' \
'path:Print the path to the global configuration file' \
'reference:Print the default configuration reference with all options documented' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'workmux config commands' commands "$@"
}
(( $+functions[_workmux_base__config__edit_commands] )) ||
_workmux_base__config__edit_commands() {
    local commands; commands=()
    _describe -t commands 'workmux config edit commands' commands "$@"
}
(( $+functions[_workmux_base__config__help_commands] )) ||
_workmux_base__config__help_commands() {
    local commands; commands=(
'edit:Open the global configuration file in your editor (\$VISUAL, \$EDITOR, or vi)' \
'path:Print the path to the global configuration file' \
'reference:Print the default configuration reference with all options documented' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'workmux config help commands' commands "$@"
}
(( $+functions[_workmux_base__config__help__edit_commands] )) ||
_workmux_base__config__help__edit_commands() {
    local commands; commands=()
    _describe -t commands 'workmux config help edit commands' commands "$@"
}
(( $+functions[_workmux_base__config__help__help_commands] )) ||
_workmux_base__config__help__help_commands() {
    local commands; commands=()
    _describe -t commands 'workmux config help help commands' commands "$@"
}
(( $+functions[_workmux_base__config__help__path_commands] )) ||
_workmux_base__config__help__path_commands() {
    local commands; commands=()
    _describe -t commands 'workmux config help path commands' commands "$@"
}
(( $+functions[_workmux_base__config__help__reference_commands] )) ||
_workmux_base__config__help__reference_commands() {
    local commands; commands=()
    _describe -t commands 'workmux config help reference commands' commands "$@"
}
(( $+functions[_workmux_base__config__path_commands] )) ||
_workmux_base__config__path_commands() {
    local commands; commands=()
    _describe -t commands 'workmux config path commands' commands "$@"
}
(( $+functions[_workmux_base__config__reference_commands] )) ||
_workmux_base__config__reference_commands() {
    local commands; commands=()
    _describe -t commands 'workmux config reference commands' commands "$@"
}
(( $+functions[_workmux_base__dashboard_commands] )) ||
_workmux_base__dashboard_commands() {
    local commands; commands=()
    _describe -t commands 'workmux dashboard commands' commands "$@"
}
(( $+functions[_workmux_base__docs_commands] )) ||
_workmux_base__docs_commands() {
    local commands; commands=()
    _describe -t commands 'workmux docs commands' commands "$@"
}
(( $+functions[_workmux_base__help_commands] )) ||
_workmux_base__help_commands() {
    local commands; commands=(
'_deferred-cleanup:' \
'add:Create a new worktree and tmux window' \
'open:Open a tmux window for an existing worktree' \
'close:Close a worktree'\''s tmux window (keeps the worktree and branch)' \
'resurrect:Restore worktree windows after a tmux or computer crash' \
'merge:Merge a branch, then clean up the worktree and tmux window' \
'rebase:Rebase a worktree branch onto its base branch' \
'rename:Rename a worktree, its tmux window/session, and (optionally) its branch' \
'remove:Remove a worktree, tmux window, and branch without merging' \
'list:List all worktrees' \
'path:Get the filesystem path of a worktree' \
'send:Send a prompt or instruction to a running agent' \
'capture:Capture terminal output from a running agent' \
'status:Query agent status for worktrees' \
'wait:Wait for agents to reach a target status' \
'run:Run a command in a worktree'\''s window' \
'reap-agents:Exit tracked agent processes older than a configured age' \
'sync-files:Re-apply file operations (copy/symlink) to worktrees' \
'init:Generate example .workmux.yaml configuration file' \
'setup:Set up agent status tracking hooks and install skills' \
'uninstall:Remove agent status tracking hooks, skills, and cache/state dirs' \
'docs:Show detailed documentation (renders README.md)' \
'changelog:Show the changelog (what'\''s new in each version)' \
'update:Update workmux to the latest version' \
'sidebar:Control a live agent status sidebar in tmux' \
'_sidebar-run:Run the sidebar TUI (internal use)' \
'_sidebar-sync:Sync sidebar into a window (internal use, called by tmux hooks)' \
'_sidebar-reflow:Reflow sidebar layout after window resize (internal use, called by tmux hooks)' \
'_sidebar-reflow-all:Reflow sidebar layouts in all windows (internal use)' \
'_sidebar-daemon:Run the sidebar daemon (internal use)' \
'dashboard:Show a TUI dashboard of all active workmux agents across all sessions' \
'config:Manage global configuration' \
'claude:Claude Code integration commands' \
'sandbox:Manage sandbox settings' \
'set-window-status:Set agent status for the current tmux window (used by hooks)' \
'register-agent:Register the agent in the current multiplexer pane (used by hooks)' \
'set-base:Set the base branch for the current worktree (used after rebasing)' \
'_exec:Execute a run spec (internal use)' \
'last-done:Switch to the agent that most recently completed or is waiting for input' \
'last-agent:Switch to the last visited agent (toggle between two)' \
'host-exec:Execute a command on the host (used by guest shims)' \
'clipboard-read:Read clipboard from host (used by sandbox clipboard shims)' \
'completions:Generate shell completions' \
'_complete-branches:Output worktree branch names for shell completion (internal use)' \
'_complete-handles:Output worktree handles for shell completion (internal use)' \
'_complete-git-branches:Output git branches for shell completion (internal use)' \
'_complete-agent-targets:Output agent targets for shell completion (internal use)' \
'_check-update:Background update check (internal use)' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'workmux help commands' commands "$@"
}
(( $+functions[_workmux_base__help___check-update_commands] )) ||
_workmux_base__help___check-update_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help _check-update commands' commands "$@"
}
(( $+functions[_workmux_base__help___complete-agent-targets_commands] )) ||
_workmux_base__help___complete-agent-targets_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help _complete-agent-targets commands' commands "$@"
}
(( $+functions[_workmux_base__help___complete-branches_commands] )) ||
_workmux_base__help___complete-branches_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help _complete-branches commands' commands "$@"
}
(( $+functions[_workmux_base__help___complete-git-branches_commands] )) ||
_workmux_base__help___complete-git-branches_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help _complete-git-branches commands' commands "$@"
}
(( $+functions[_workmux_base__help___complete-handles_commands] )) ||
_workmux_base__help___complete-handles_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help _complete-handles commands' commands "$@"
}
(( $+functions[_workmux_base__help___deferred-cleanup_commands] )) ||
_workmux_base__help___deferred-cleanup_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help _deferred-cleanup commands' commands "$@"
}
(( $+functions[_workmux_base__help___exec_commands] )) ||
_workmux_base__help___exec_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help _exec commands' commands "$@"
}
(( $+functions[_workmux_base__help___sidebar-daemon_commands] )) ||
_workmux_base__help___sidebar-daemon_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help _sidebar-daemon commands' commands "$@"
}
(( $+functions[_workmux_base__help___sidebar-reflow_commands] )) ||
_workmux_base__help___sidebar-reflow_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help _sidebar-reflow commands' commands "$@"
}
(( $+functions[_workmux_base__help___sidebar-reflow-all_commands] )) ||
_workmux_base__help___sidebar-reflow-all_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help _sidebar-reflow-all commands' commands "$@"
}
(( $+functions[_workmux_base__help___sidebar-run_commands] )) ||
_workmux_base__help___sidebar-run_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help _sidebar-run commands' commands "$@"
}
(( $+functions[_workmux_base__help___sidebar-sync_commands] )) ||
_workmux_base__help___sidebar-sync_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help _sidebar-sync commands' commands "$@"
}
(( $+functions[_workmux_base__help__add_commands] )) ||
_workmux_base__help__add_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help add commands' commands "$@"
}
(( $+functions[_workmux_base__help__capture_commands] )) ||
_workmux_base__help__capture_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help capture commands' commands "$@"
}
(( $+functions[_workmux_base__help__changelog_commands] )) ||
_workmux_base__help__changelog_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help changelog commands' commands "$@"
}
(( $+functions[_workmux_base__help__claude_commands] )) ||
_workmux_base__help__claude_commands() {
    local commands; commands=(
'prune:Remove stale entries from ~/.claude.json for deleted worktrees' \
    )
    _describe -t commands 'workmux help claude commands' commands "$@"
}
(( $+functions[_workmux_base__help__claude__prune_commands] )) ||
_workmux_base__help__claude__prune_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help claude prune commands' commands "$@"
}
(( $+functions[_workmux_base__help__clipboard-read_commands] )) ||
_workmux_base__help__clipboard-read_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help clipboard-read commands' commands "$@"
}
(( $+functions[_workmux_base__help__close_commands] )) ||
_workmux_base__help__close_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help close commands' commands "$@"
}
(( $+functions[_workmux_base__help__completions_commands] )) ||
_workmux_base__help__completions_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help completions commands' commands "$@"
}
(( $+functions[_workmux_base__help__config_commands] )) ||
_workmux_base__help__config_commands() {
    local commands; commands=(
'edit:Open the global configuration file in your editor (\$VISUAL, \$EDITOR, or vi)' \
'path:Print the path to the global configuration file' \
'reference:Print the default configuration reference with all options documented' \
    )
    _describe -t commands 'workmux help config commands' commands "$@"
}
(( $+functions[_workmux_base__help__config__edit_commands] )) ||
_workmux_base__help__config__edit_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help config edit commands' commands "$@"
}
(( $+functions[_workmux_base__help__config__path_commands] )) ||
_workmux_base__help__config__path_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help config path commands' commands "$@"
}
(( $+functions[_workmux_base__help__config__reference_commands] )) ||
_workmux_base__help__config__reference_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help config reference commands' commands "$@"
}
(( $+functions[_workmux_base__help__dashboard_commands] )) ||
_workmux_base__help__dashboard_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help dashboard commands' commands "$@"
}
(( $+functions[_workmux_base__help__docs_commands] )) ||
_workmux_base__help__docs_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help docs commands' commands "$@"
}
(( $+functions[_workmux_base__help__help_commands] )) ||
_workmux_base__help__help_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help help commands' commands "$@"
}
(( $+functions[_workmux_base__help__host-exec_commands] )) ||
_workmux_base__help__host-exec_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help host-exec commands' commands "$@"
}
(( $+functions[_workmux_base__help__init_commands] )) ||
_workmux_base__help__init_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help init commands' commands "$@"
}
(( $+functions[_workmux_base__help__last-agent_commands] )) ||
_workmux_base__help__last-agent_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help last-agent commands' commands "$@"
}
(( $+functions[_workmux_base__help__last-done_commands] )) ||
_workmux_base__help__last-done_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help last-done commands' commands "$@"
}
(( $+functions[_workmux_base__help__list_commands] )) ||
_workmux_base__help__list_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help list commands' commands "$@"
}
(( $+functions[_workmux_base__help__merge_commands] )) ||
_workmux_base__help__merge_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help merge commands' commands "$@"
}
(( $+functions[_workmux_base__help__open_commands] )) ||
_workmux_base__help__open_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help open commands' commands "$@"
}
(( $+functions[_workmux_base__help__path_commands] )) ||
_workmux_base__help__path_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help path commands' commands "$@"
}
(( $+functions[_workmux_base__help__reap-agents_commands] )) ||
_workmux_base__help__reap-agents_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help reap-agents commands' commands "$@"
}
(( $+functions[_workmux_base__help__rebase_commands] )) ||
_workmux_base__help__rebase_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help rebase commands' commands "$@"
}
(( $+functions[_workmux_base__help__register-agent_commands] )) ||
_workmux_base__help__register-agent_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help register-agent commands' commands "$@"
}
(( $+functions[_workmux_base__help__remove_commands] )) ||
_workmux_base__help__remove_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help remove commands' commands "$@"
}
(( $+functions[_workmux_base__help__rename_commands] )) ||
_workmux_base__help__rename_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help rename commands' commands "$@"
}
(( $+functions[_workmux_base__help__resurrect_commands] )) ||
_workmux_base__help__resurrect_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help resurrect commands' commands "$@"
}
(( $+functions[_workmux_base__help__run_commands] )) ||
_workmux_base__help__run_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help run commands' commands "$@"
}
(( $+functions[_workmux_base__help__sandbox_commands] )) ||
_workmux_base__help__sandbox_commands() {
    local commands; commands=(
'build:Build the sandbox container image locally. Note\: a pre-built image is available via \`workmux sandbox pull\`' \
'pull:Pull the latest sandbox image from the container registry' \
'init-dockerfile:Export customizable Dockerfile templates for building your own sandbox image' \
'prune:Delete unused Lima VMs to reclaim disk space' \
'run:Run a command inside a sandbox (internal, used by pane setup)' \
'install-dev:Cross-compile and install workmux into containers and running Lima VMs for development' \
'stop:Stop Lima VMs to free resources' \
'agent:Run the configured agent inside a sandbox with full RPC support. Unlike \`shell\`, this starts an RPC server so the agent can call workmux commands (e.g., \`workmux add\` to spawn sub-agents)' \
'shell:Start an interactive shell in a sandbox. Uses the same mounts and environment as a normal worktree sandbox' \
    )
    _describe -t commands 'workmux help sandbox commands' commands "$@"
}
(( $+functions[_workmux_base__help__sandbox__agent_commands] )) ||
_workmux_base__help__sandbox__agent_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help sandbox agent commands' commands "$@"
}
(( $+functions[_workmux_base__help__sandbox__build_commands] )) ||
_workmux_base__help__sandbox__build_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help sandbox build commands' commands "$@"
}
(( $+functions[_workmux_base__help__sandbox__init-dockerfile_commands] )) ||
_workmux_base__help__sandbox__init-dockerfile_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help sandbox init-dockerfile commands' commands "$@"
}
(( $+functions[_workmux_base__help__sandbox__install-dev_commands] )) ||
_workmux_base__help__sandbox__install-dev_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help sandbox install-dev commands' commands "$@"
}
(( $+functions[_workmux_base__help__sandbox__prune_commands] )) ||
_workmux_base__help__sandbox__prune_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help sandbox prune commands' commands "$@"
}
(( $+functions[_workmux_base__help__sandbox__pull_commands] )) ||
_workmux_base__help__sandbox__pull_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help sandbox pull commands' commands "$@"
}
(( $+functions[_workmux_base__help__sandbox__run_commands] )) ||
_workmux_base__help__sandbox__run_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help sandbox run commands' commands "$@"
}
(( $+functions[_workmux_base__help__sandbox__shell_commands] )) ||
_workmux_base__help__sandbox__shell_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help sandbox shell commands' commands "$@"
}
(( $+functions[_workmux_base__help__sandbox__stop_commands] )) ||
_workmux_base__help__sandbox__stop_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help sandbox stop commands' commands "$@"
}
(( $+functions[_workmux_base__help__send_commands] )) ||
_workmux_base__help__send_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help send commands' commands "$@"
}
(( $+functions[_workmux_base__help__set-base_commands] )) ||
_workmux_base__help__set-base_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help set-base commands' commands "$@"
}
(( $+functions[_workmux_base__help__set-window-status_commands] )) ||
_workmux_base__help__set-window-status_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help set-window-status commands' commands "$@"
}
(( $+functions[_workmux_base__help__setup_commands] )) ||
_workmux_base__help__setup_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help setup commands' commands "$@"
}
(( $+functions[_workmux_base__help__sidebar_commands] )) ||
_workmux_base__help__sidebar_commands() {
    local commands; commands=(
'on:Ensure the sidebar is running' \
'off:Ensure the sidebar is stopped' \
'next:Switch to the next agent in sidebar order' \
'prev:Switch to the previous agent in sidebar order' \
'jump:Jump to the Nth agent in sidebar order (1-indexed)' \
'filter:Set sidebar filter mode. Toggles if no mode given' \
'group:Set sidebar grouping. Toggles between grouped and flat if no mode is given' \
    )
    _describe -t commands 'workmux help sidebar commands' commands "$@"
}
(( $+functions[_workmux_base__help__sidebar__filter_commands] )) ||
_workmux_base__help__sidebar__filter_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help sidebar filter commands' commands "$@"
}
(( $+functions[_workmux_base__help__sidebar__group_commands] )) ||
_workmux_base__help__sidebar__group_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help sidebar group commands' commands "$@"
}
(( $+functions[_workmux_base__help__sidebar__jump_commands] )) ||
_workmux_base__help__sidebar__jump_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help sidebar jump commands' commands "$@"
}
(( $+functions[_workmux_base__help__sidebar__next_commands] )) ||
_workmux_base__help__sidebar__next_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help sidebar next commands' commands "$@"
}
(( $+functions[_workmux_base__help__sidebar__off_commands] )) ||
_workmux_base__help__sidebar__off_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help sidebar off commands' commands "$@"
}
(( $+functions[_workmux_base__help__sidebar__on_commands] )) ||
_workmux_base__help__sidebar__on_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help sidebar on commands' commands "$@"
}
(( $+functions[_workmux_base__help__sidebar__prev_commands] )) ||
_workmux_base__help__sidebar__prev_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help sidebar prev commands' commands "$@"
}
(( $+functions[_workmux_base__help__status_commands] )) ||
_workmux_base__help__status_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help status commands' commands "$@"
}
(( $+functions[_workmux_base__help__sync-files_commands] )) ||
_workmux_base__help__sync-files_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help sync-files commands' commands "$@"
}
(( $+functions[_workmux_base__help__uninstall_commands] )) ||
_workmux_base__help__uninstall_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help uninstall commands' commands "$@"
}
(( $+functions[_workmux_base__help__update_commands] )) ||
_workmux_base__help__update_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help update commands' commands "$@"
}
(( $+functions[_workmux_base__help__wait_commands] )) ||
_workmux_base__help__wait_commands() {
    local commands; commands=()
    _describe -t commands 'workmux help wait commands' commands "$@"
}
(( $+functions[_workmux_base__host-exec_commands] )) ||
_workmux_base__host-exec_commands() {
    local commands; commands=()
    _describe -t commands 'workmux host-exec commands' commands "$@"
}
(( $+functions[_workmux_base__init_commands] )) ||
_workmux_base__init_commands() {
    local commands; commands=()
    _describe -t commands 'workmux init commands' commands "$@"
}
(( $+functions[_workmux_base__last-agent_commands] )) ||
_workmux_base__last-agent_commands() {
    local commands; commands=()
    _describe -t commands 'workmux last-agent commands' commands "$@"
}
(( $+functions[_workmux_base__last-done_commands] )) ||
_workmux_base__last-done_commands() {
    local commands; commands=()
    _describe -t commands 'workmux last-done commands' commands "$@"
}
(( $+functions[_workmux_base__list_commands] )) ||
_workmux_base__list_commands() {
    local commands; commands=()
    _describe -t commands 'workmux list commands' commands "$@"
}
(( $+functions[_workmux_base__merge_commands] )) ||
_workmux_base__merge_commands() {
    local commands; commands=()
    _describe -t commands 'workmux merge commands' commands "$@"
}
(( $+functions[_workmux_base__open_commands] )) ||
_workmux_base__open_commands() {
    local commands; commands=()
    _describe -t commands 'workmux open commands' commands "$@"
}
(( $+functions[_workmux_base__path_commands] )) ||
_workmux_base__path_commands() {
    local commands; commands=()
    _describe -t commands 'workmux path commands' commands "$@"
}
(( $+functions[_workmux_base__reap-agents_commands] )) ||
_workmux_base__reap-agents_commands() {
    local commands; commands=()
    _describe -t commands 'workmux reap-agents commands' commands "$@"
}
(( $+functions[_workmux_base__rebase_commands] )) ||
_workmux_base__rebase_commands() {
    local commands; commands=()
    _describe -t commands 'workmux rebase commands' commands "$@"
}
(( $+functions[_workmux_base__register-agent_commands] )) ||
_workmux_base__register-agent_commands() {
    local commands; commands=()
    _describe -t commands 'workmux register-agent commands' commands "$@"
}
(( $+functions[_workmux_base__remove_commands] )) ||
_workmux_base__remove_commands() {
    local commands; commands=()
    _describe -t commands 'workmux remove commands' commands "$@"
}
(( $+functions[_workmux_base__rename_commands] )) ||
_workmux_base__rename_commands() {
    local commands; commands=()
    _describe -t commands 'workmux rename commands' commands "$@"
}
(( $+functions[_workmux_base__resurrect_commands] )) ||
_workmux_base__resurrect_commands() {
    local commands; commands=()
    _describe -t commands 'workmux resurrect commands' commands "$@"
}
(( $+functions[_workmux_base__run_commands] )) ||
_workmux_base__run_commands() {
    local commands; commands=()
    _describe -t commands 'workmux run commands' commands "$@"
}
(( $+functions[_workmux_base__sandbox_commands] )) ||
_workmux_base__sandbox_commands() {
    local commands; commands=(
'build:Build the sandbox container image locally. Note\: a pre-built image is available via \`workmux sandbox pull\`' \
'pull:Pull the latest sandbox image from the container registry' \
'init-dockerfile:Export customizable Dockerfile templates for building your own sandbox image' \
'prune:Delete unused Lima VMs to reclaim disk space' \
'run:Run a command inside a sandbox (internal, used by pane setup)' \
'install-dev:Cross-compile and install workmux into containers and running Lima VMs for development' \
'stop:Stop Lima VMs to free resources' \
'agent:Run the configured agent inside a sandbox with full RPC support. Unlike \`shell\`, this starts an RPC server so the agent can call workmux commands (e.g., \`workmux add\` to spawn sub-agents)' \
'shell:Start an interactive shell in a sandbox. Uses the same mounts and environment as a normal worktree sandbox' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'workmux sandbox commands' commands "$@"
}
(( $+functions[_workmux_base__sandbox__agent_commands] )) ||
_workmux_base__sandbox__agent_commands() {
    local commands; commands=()
    _describe -t commands 'workmux sandbox agent commands' commands "$@"
}
(( $+functions[_workmux_base__sandbox__build_commands] )) ||
_workmux_base__sandbox__build_commands() {
    local commands; commands=()
    _describe -t commands 'workmux sandbox build commands' commands "$@"
}
(( $+functions[_workmux_base__sandbox__help_commands] )) ||
_workmux_base__sandbox__help_commands() {
    local commands; commands=(
'build:Build the sandbox container image locally. Note\: a pre-built image is available via \`workmux sandbox pull\`' \
'pull:Pull the latest sandbox image from the container registry' \
'init-dockerfile:Export customizable Dockerfile templates for building your own sandbox image' \
'prune:Delete unused Lima VMs to reclaim disk space' \
'run:Run a command inside a sandbox (internal, used by pane setup)' \
'install-dev:Cross-compile and install workmux into containers and running Lima VMs for development' \
'stop:Stop Lima VMs to free resources' \
'agent:Run the configured agent inside a sandbox with full RPC support. Unlike \`shell\`, this starts an RPC server so the agent can call workmux commands (e.g., \`workmux add\` to spawn sub-agents)' \
'shell:Start an interactive shell in a sandbox. Uses the same mounts and environment as a normal worktree sandbox' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'workmux sandbox help commands' commands "$@"
}
(( $+functions[_workmux_base__sandbox__help__agent_commands] )) ||
_workmux_base__sandbox__help__agent_commands() {
    local commands; commands=()
    _describe -t commands 'workmux sandbox help agent commands' commands "$@"
}
(( $+functions[_workmux_base__sandbox__help__build_commands] )) ||
_workmux_base__sandbox__help__build_commands() {
    local commands; commands=()
    _describe -t commands 'workmux sandbox help build commands' commands "$@"
}
(( $+functions[_workmux_base__sandbox__help__help_commands] )) ||
_workmux_base__sandbox__help__help_commands() {
    local commands; commands=()
    _describe -t commands 'workmux sandbox help help commands' commands "$@"
}
(( $+functions[_workmux_base__sandbox__help__init-dockerfile_commands] )) ||
_workmux_base__sandbox__help__init-dockerfile_commands() {
    local commands; commands=()
    _describe -t commands 'workmux sandbox help init-dockerfile commands' commands "$@"
}
(( $+functions[_workmux_base__sandbox__help__install-dev_commands] )) ||
_workmux_base__sandbox__help__install-dev_commands() {
    local commands; commands=()
    _describe -t commands 'workmux sandbox help install-dev commands' commands "$@"
}
(( $+functions[_workmux_base__sandbox__help__prune_commands] )) ||
_workmux_base__sandbox__help__prune_commands() {
    local commands; commands=()
    _describe -t commands 'workmux sandbox help prune commands' commands "$@"
}
(( $+functions[_workmux_base__sandbox__help__pull_commands] )) ||
_workmux_base__sandbox__help__pull_commands() {
    local commands; commands=()
    _describe -t commands 'workmux sandbox help pull commands' commands "$@"
}
(( $+functions[_workmux_base__sandbox__help__run_commands] )) ||
_workmux_base__sandbox__help__run_commands() {
    local commands; commands=()
    _describe -t commands 'workmux sandbox help run commands' commands "$@"
}
(( $+functions[_workmux_base__sandbox__help__shell_commands] )) ||
_workmux_base__sandbox__help__shell_commands() {
    local commands; commands=()
    _describe -t commands 'workmux sandbox help shell commands' commands "$@"
}
(( $+functions[_workmux_base__sandbox__help__stop_commands] )) ||
_workmux_base__sandbox__help__stop_commands() {
    local commands; commands=()
    _describe -t commands 'workmux sandbox help stop commands' commands "$@"
}
(( $+functions[_workmux_base__sandbox__init-dockerfile_commands] )) ||
_workmux_base__sandbox__init-dockerfile_commands() {
    local commands; commands=()
    _describe -t commands 'workmux sandbox init-dockerfile commands' commands "$@"
}
(( $+functions[_workmux_base__sandbox__install-dev_commands] )) ||
_workmux_base__sandbox__install-dev_commands() {
    local commands; commands=()
    _describe -t commands 'workmux sandbox install-dev commands' commands "$@"
}
(( $+functions[_workmux_base__sandbox__prune_commands] )) ||
_workmux_base__sandbox__prune_commands() {
    local commands; commands=()
    _describe -t commands 'workmux sandbox prune commands' commands "$@"
}
(( $+functions[_workmux_base__sandbox__pull_commands] )) ||
_workmux_base__sandbox__pull_commands() {
    local commands; commands=()
    _describe -t commands 'workmux sandbox pull commands' commands "$@"
}
(( $+functions[_workmux_base__sandbox__run_commands] )) ||
_workmux_base__sandbox__run_commands() {
    local commands; commands=()
    _describe -t commands 'workmux sandbox run commands' commands "$@"
}
(( $+functions[_workmux_base__sandbox__shell_commands] )) ||
_workmux_base__sandbox__shell_commands() {
    local commands; commands=()
    _describe -t commands 'workmux sandbox shell commands' commands "$@"
}
(( $+functions[_workmux_base__sandbox__stop_commands] )) ||
_workmux_base__sandbox__stop_commands() {
    local commands; commands=()
    _describe -t commands 'workmux sandbox stop commands' commands "$@"
}
(( $+functions[_workmux_base__send_commands] )) ||
_workmux_base__send_commands() {
    local commands; commands=()
    _describe -t commands 'workmux send commands' commands "$@"
}
(( $+functions[_workmux_base__set-base_commands] )) ||
_workmux_base__set-base_commands() {
    local commands; commands=()
    _describe -t commands 'workmux set-base commands' commands "$@"
}
(( $+functions[_workmux_base__set-window-status_commands] )) ||
_workmux_base__set-window-status_commands() {
    local commands; commands=()
    _describe -t commands 'workmux set-window-status commands' commands "$@"
}
(( $+functions[_workmux_base__setup_commands] )) ||
_workmux_base__setup_commands() {
    local commands; commands=()
    _describe -t commands 'workmux setup commands' commands "$@"
}
(( $+functions[_workmux_base__sidebar_commands] )) ||
_workmux_base__sidebar_commands() {
    local commands; commands=(
'on:Ensure the sidebar is running' \
'off:Ensure the sidebar is stopped' \
'next:Switch to the next agent in sidebar order' \
'prev:Switch to the previous agent in sidebar order' \
'jump:Jump to the Nth agent in sidebar order (1-indexed)' \
'filter:Set sidebar filter mode. Toggles if no mode given' \
'group:Set sidebar grouping. Toggles between grouped and flat if no mode is given' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'workmux sidebar commands' commands "$@"
}
(( $+functions[_workmux_base__sidebar__filter_commands] )) ||
_workmux_base__sidebar__filter_commands() {
    local commands; commands=()
    _describe -t commands 'workmux sidebar filter commands' commands "$@"
}
(( $+functions[_workmux_base__sidebar__group_commands] )) ||
_workmux_base__sidebar__group_commands() {
    local commands; commands=()
    _describe -t commands 'workmux sidebar group commands' commands "$@"
}
(( $+functions[_workmux_base__sidebar__help_commands] )) ||
_workmux_base__sidebar__help_commands() {
    local commands; commands=(
'on:Ensure the sidebar is running' \
'off:Ensure the sidebar is stopped' \
'next:Switch to the next agent in sidebar order' \
'prev:Switch to the previous agent in sidebar order' \
'jump:Jump to the Nth agent in sidebar order (1-indexed)' \
'filter:Set sidebar filter mode. Toggles if no mode given' \
'group:Set sidebar grouping. Toggles between grouped and flat if no mode is given' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'workmux sidebar help commands' commands "$@"
}
(( $+functions[_workmux_base__sidebar__help__filter_commands] )) ||
_workmux_base__sidebar__help__filter_commands() {
    local commands; commands=()
    _describe -t commands 'workmux sidebar help filter commands' commands "$@"
}
(( $+functions[_workmux_base__sidebar__help__group_commands] )) ||
_workmux_base__sidebar__help__group_commands() {
    local commands; commands=()
    _describe -t commands 'workmux sidebar help group commands' commands "$@"
}
(( $+functions[_workmux_base__sidebar__help__help_commands] )) ||
_workmux_base__sidebar__help__help_commands() {
    local commands; commands=()
    _describe -t commands 'workmux sidebar help help commands' commands "$@"
}
(( $+functions[_workmux_base__sidebar__help__jump_commands] )) ||
_workmux_base__sidebar__help__jump_commands() {
    local commands; commands=()
    _describe -t commands 'workmux sidebar help jump commands' commands "$@"
}
(( $+functions[_workmux_base__sidebar__help__next_commands] )) ||
_workmux_base__sidebar__help__next_commands() {
    local commands; commands=()
    _describe -t commands 'workmux sidebar help next commands' commands "$@"
}
(( $+functions[_workmux_base__sidebar__help__off_commands] )) ||
_workmux_base__sidebar__help__off_commands() {
    local commands; commands=()
    _describe -t commands 'workmux sidebar help off commands' commands "$@"
}
(( $+functions[_workmux_base__sidebar__help__on_commands] )) ||
_workmux_base__sidebar__help__on_commands() {
    local commands; commands=()
    _describe -t commands 'workmux sidebar help on commands' commands "$@"
}
(( $+functions[_workmux_base__sidebar__help__prev_commands] )) ||
_workmux_base__sidebar__help__prev_commands() {
    local commands; commands=()
    _describe -t commands 'workmux sidebar help prev commands' commands "$@"
}
(( $+functions[_workmux_base__sidebar__jump_commands] )) ||
_workmux_base__sidebar__jump_commands() {
    local commands; commands=()
    _describe -t commands 'workmux sidebar jump commands' commands "$@"
}
(( $+functions[_workmux_base__sidebar__next_commands] )) ||
_workmux_base__sidebar__next_commands() {
    local commands; commands=()
    _describe -t commands 'workmux sidebar next commands' commands "$@"
}
(( $+functions[_workmux_base__sidebar__off_commands] )) ||
_workmux_base__sidebar__off_commands() {
    local commands; commands=()
    _describe -t commands 'workmux sidebar off commands' commands "$@"
}
(( $+functions[_workmux_base__sidebar__on_commands] )) ||
_workmux_base__sidebar__on_commands() {
    local commands; commands=()
    _describe -t commands 'workmux sidebar on commands' commands "$@"
}
(( $+functions[_workmux_base__sidebar__prev_commands] )) ||
_workmux_base__sidebar__prev_commands() {
    local commands; commands=()
    _describe -t commands 'workmux sidebar prev commands' commands "$@"
}
(( $+functions[_workmux_base__status_commands] )) ||
_workmux_base__status_commands() {
    local commands; commands=()
    _describe -t commands 'workmux status commands' commands "$@"
}
(( $+functions[_workmux_base__sync-files_commands] )) ||
_workmux_base__sync-files_commands() {
    local commands; commands=()
    _describe -t commands 'workmux sync-files commands' commands "$@"
}
(( $+functions[_workmux_base__uninstall_commands] )) ||
_workmux_base__uninstall_commands() {
    local commands; commands=()
    _describe -t commands 'workmux uninstall commands' commands "$@"
}
(( $+functions[_workmux_base__update_commands] )) ||
_workmux_base__update_commands() {
    local commands; commands=()
    _describe -t commands 'workmux update commands' commands "$@"
}
(( $+functions[_workmux_base__wait_commands] )) ||
_workmux_base__wait_commands() {
    local commands; commands=()
    _describe -t commands 'workmux wait commands' commands "$@"
}

# Dynamic worktree handle completion (directory names)
# Used for open/remove/merge/path/close - repo-scoped lifecycle commands
_workmux_handles() {
    local -a handles
    handles=("${(@f)$(workmux _complete-handles 2>/dev/null)}")
    # "${(@f)...}" on empty output produces a single empty string; filter it out
    handles=(${handles:#})
    (( ${#handles} )) && compadd -a handles
}

# Dynamic agent target completion (local handles + cross-project agents)
# Used for send/capture/status/wait/run - agent communication commands
_workmux_agent_targets() {
    local -a targets
    targets=("${(@f)$(workmux _complete-agent-targets 2>/dev/null)}")
    targets=(${targets:#})
    (( ${#targets} )) && compadd -a targets
}

# Dynamic git branch completion for add command
_workmux_git_branches() {
    local -a branches
    branches=("${(@f)$(workmux _complete-git-branches 2>/dev/null)}")
    branches=(${branches:#})
    (( ${#branches} )) && compadd -a branches
}

# Main completion function.
#
# This replaces the clap-generated _workmux, wrapping _workmux_base with
# dynamic completions for positional arguments (handles, branches).
# Flag/option completion is delegated to _workmux_base which uses _arguments.
#
# Works with both autoloading (fpath) and eval:
# - Autoloaded: the file body defines all functions, then redefines _workmux
#   as this wrapper and calls it. Subsequent calls go directly to the wrapper.
# - Eval'd: all functions are defined at global scope, _workmux is registered
#   via compdef.
_workmux() {
    # Ensure standard zsh array indexing (1-based) regardless of user settings
    emulate -L zsh
    setopt extended_glob  # Required for _files glob qualifiers like *(-/)
    setopt no_nomatch     # Allow failed globs to resolve to empty list

    # Get the subcommand (second word)
    local cmd="${words[2]}"

    # List of flags that take arguments (values), by command.
    # When completing a flag value, we defer to _workmux_base so it can offer
    # file paths, custom hints, etc. via _arguments.
    # Boolean flags are excluded so we can offer positional completions after them.
    local -a arg_flags
    case "$cmd" in
        add)
            arg_flags=(
                -p --prompt
                -P --prompt-file
                --name
                -a --agent
                -n --count
                --foreach
                --branch-template
                --pr
                --forge
                # Note: --base is excluded because it needs dynamic completion
            )
            ;;
        open)
            arg_flags=(
                -p --prompt
                -P --prompt-file
                # Note: -n/--new is a boolean flag, not included here
            )
            ;;
        merge)
            arg_flags=(
                # Note: --into is excluded because it needs dynamic completion
            )
            ;;
        *)
            arg_flags=()
            ;;
    esac

    # If completing a flag (starts with -) or a flag's argument value,
    # use _workmux_base which has the full _arguments definitions.
    if [[ "${words[CURRENT]}" == -* ]] || [[ -n "${arg_flags[(r)${words[CURRENT-1]}]}" ]]; then
        _workmux_base "$@"
        return
    fi

    # For commands that take handles or branches, offer only those
    # (no file fallback from _default). Flag completion is handled above.
    case "$cmd" in
        open|remove|rm|rename|path|merge|rebase|close)
            _workmux_handles
            ;;
        send|capture|status|wait|run)
            _workmux_agent_targets
            ;;
        add)
            _workmux_git_branches
            ;;
        *)
            # For all other commands (config, sandbox, etc.), use base completions
            _workmux_base "$@"
            ;;
    esac
}

# Autoload / eval detection:
# - When autoloaded via fpath, funcstack[1] is the outer autoloaded function
#   that just defined _workmux (replacing itself). Call _workmux to handle
#   the current completion request.
# - When eval'd (e.g. eval "$(workmux completions zsh)"), we are at the top
#   level so funcstack[1] is not _workmux. Register the function with compdef.
if [ "$funcstack[1]" = "_workmux" ]; then
    _workmux "$@"
else
    compdef _workmux workmux
fi
