worktrunk 0.36.0

A CLI for Git worktree management, designed for parallel AI agent workflows
Documentation
---
source: tests/integration_tests/init.rs
info:
  program: wt
  args:
    - config
    - shell
    - init
    - fish
  env:
    APPDATA: "[TEST_CONFIG_HOME]"
    CLICOLOR_FORCE: "1"
    COLUMNS: "500"
    GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
    GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
    GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
    GIT_CONFIG_SYSTEM: /dev/null
    GIT_EDITOR: ""
    GIT_TERMINAL_PROMPT: "0"
    HOME: "[TEST_HOME]"
    LANG: C
    LC_ALL: C
    MOCK_CONFIG_DIR: "[MOCK_CONFIG_DIR]"
    NO_COLOR: ""
    OPENCODE_CONFIG_DIR: "[TEST_OPENCODE_CONFIG]"
    PATH: "[PATH]"
    PSModulePath: ""
    RUST_LOG: warn
    SHELL: ""
    TERM: alacritty
    USERPROFILE: "[TEST_HOME]"
    WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
    WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
    WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
    WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
    WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
    WORKTRUNK_TEST_EPOCH: "1735776000"
    WORKTRUNK_TEST_NUSHELL_ENV: "0"
    WORKTRUNK_TEST_OPENCODE_INSTALLED: "0"
    WORKTRUNK_TEST_POWERSHELL_ENV: "0"
    WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
    XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
exit_code: 0
----- stdout -----
# worktrunk shell integration for fish
#
# This is the full function definition, output by `wt config shell init fish`.
# It's sourced at runtime by the wrapper in ~/.config/fish/functions/wt.fish.

# Override wt command with file-based directive passing.
# Creates a temp file, passes path via WORKTRUNK_DIRECTIVE_FILE, evals it after.
# WORKTRUNK_BIN can override the binary path (for testing dev builds).
#
# Note: We use `eval (string collect < file)` instead of `source` because
# fish's `source` doesn't propagate exit codes to the parent function.
# We read the directive with `string collect` (builtin) instead of `cat`
# (external) to avoid spawning a subprocess whose CWD may have been renamed
# by worktree removal.
function wt
    set -l use_source false
    set -l args

    for arg in $argv
        if test "$arg" = "--source"; set use_source true; else; set -a args $arg; end
    end

    test -n "$WORKTRUNK_BIN"; or set -l WORKTRUNK_BIN (type -P wt 2>/dev/null)
    if test -z "$WORKTRUNK_BIN"
        echo "wt: command not found" >&2
        return 127
    end
    set -l directive_file (mktemp)

    # --source: use cargo run (builds from source)
    if test $use_source = true
        env WORKTRUNK_DIRECTIVE_FILE=$directive_file cargo run --bin wt --quiet -- $args
    else
        env WORKTRUNK_DIRECTIVE_FILE=$directive_file $WORKTRUNK_BIN $args
    end
    set -l exit_code $status

    if test -s "$directive_file"
        # Use fish builtin instead of cat to avoid spawning a subprocess
        # whose CWD may have been renamed by worktree removal.
        set -l directive (string collect < "$directive_file")
        eval $directive
        if test $exit_code -eq 0
            set exit_code $status
        end
    end

    command rm -f "$directive_file"
    return $exit_code
end

# Completions are in ~/.config/fish/completions/wt.fish (installed by `wt config shell install`)

----- stderr -----