wtcode 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
wtcode-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Jaeho Shin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
wtcode-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,94 @@
1
+ Metadata-Version: 2.4
2
+ Name: wtcode
3
+ Version: 0.1.0
4
+ Summary: Launch your favorite code tool in a git worktree
5
+ Author-email: Jaeho Shin <netj@sparcs.org>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/netj/wtcode
8
+ Project-URL: Repository, https://github.com/netj/wtcode
9
+ Project-URL: Issues, https://github.com/netj/wtcode/issues
10
+ Keywords: git,worktree,cli,claude,developer-tools
11
+ Classifier: Environment :: Console
12
+ Classifier: Topic :: Software Development
13
+ Classifier: Programming Language :: Python :: 3
14
+ Requires-Python: >=3.9
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ Dynamic: license-file
18
+
19
+ # wtcode
20
+
21
+ **Launch your favorite code tool in a git worktree.**
22
+
23
+ *worktree code* / *what-the-code* -- streamlines git worktree selection, creation, and launching tools like [Claude Code](https://claude.ai/code), [lazygit](https://github.com/jesseduffield/lazygit), your editor, or any command.
24
+
25
+ ## Install
26
+
27
+ ### Homebrew
28
+
29
+ ```sh
30
+ brew install netj/tap/wtcode
31
+ ```
32
+
33
+ ### PyPI (via [uv](https://docs.astral.sh/uv/))
34
+
35
+ ```sh
36
+ uvx wtcode
37
+ ```
38
+
39
+ Or install globally:
40
+
41
+ ```sh
42
+ uv tool install wtcode
43
+ ```
44
+
45
+ ### From source
46
+
47
+ ```sh
48
+ git clone https://github.com/netj/wtcode.git
49
+ ln -s "$PWD/wtcode/wtcode.sh" /usr/local/bin/wtcode
50
+ ```
51
+
52
+ ## Usage
53
+
54
+ ```
55
+ wtcode [BRANCH] [CMD [CMD-ARGS...]]
56
+ ```
57
+
58
+ - **`BRANCH`** -- Git branch or worktree name. If omitted and [fzf](https://github.com/junegunn/fzf) is available, interactively select one. Prefix with `:` to create a new branch (use `:::name` to avoid fzf matching the colons).
59
+ - **`CMD`** -- Command to launch in the worktree. Defaults to `$WTCODE_CMD`, or the first available of: `claude`, `aider`, `codex`, `$SHELL`.
60
+
61
+ ### Examples
62
+
63
+ ```sh
64
+ wtcode feature-x # launch default tool in feature-x worktree
65
+ wtcode feature-x lazygit # launch lazygit
66
+ wtcode feature-x claude --resume # launch claude with flags
67
+ wtcode :new-feature # create new branch and worktree
68
+ wtcode # interactive branch selection via fzf
69
+ WTCODE_CMD=cursor wtcode feature # use cursor as default tool
70
+ ```
71
+
72
+ ## Environment variables
73
+
74
+ | Variable | Description |
75
+ |---|---|
76
+ | `WTCODE_CMD` | Default tool to launch (e.g., `claude`, `lazygit`, `vim`, `cursor`) |
77
+ | `WTCODE_DEBUG` | Enable debug tracing when set to any value |
78
+ | `GIT_WORKTREE_ROOT` | Override the directory where worktrees are created |
79
+
80
+ ## How it works
81
+
82
+ 1. **Select/specify a branch** -- pass as argument or pick interactively with fzf
83
+ 2. **Create or switch to the worktree** -- worktrees are organized under `$GIT_WORKTREE_ROOT` (defaults to `../<repo>.worktrees/`)
84
+ 3. **Launch a tool** -- runs the specified command (or smart default) inside the worktree
85
+
86
+ ## Dependencies
87
+
88
+ - **git** -- required
89
+ - **[fzf](https://github.com/junegunn/fzf)** -- recommended, for interactive branch selection
90
+ - **[jq](https://jqlang.github.io/jq/)** -- optional, for Claude Code auto-trust setup
91
+
92
+ ## License
93
+
94
+ [MIT](LICENSE)
wtcode-0.1.0/README.md ADDED
@@ -0,0 +1,76 @@
1
+ # wtcode
2
+
3
+ **Launch your favorite code tool in a git worktree.**
4
+
5
+ *worktree code* / *what-the-code* -- streamlines git worktree selection, creation, and launching tools like [Claude Code](https://claude.ai/code), [lazygit](https://github.com/jesseduffield/lazygit), your editor, or any command.
6
+
7
+ ## Install
8
+
9
+ ### Homebrew
10
+
11
+ ```sh
12
+ brew install netj/tap/wtcode
13
+ ```
14
+
15
+ ### PyPI (via [uv](https://docs.astral.sh/uv/))
16
+
17
+ ```sh
18
+ uvx wtcode
19
+ ```
20
+
21
+ Or install globally:
22
+
23
+ ```sh
24
+ uv tool install wtcode
25
+ ```
26
+
27
+ ### From source
28
+
29
+ ```sh
30
+ git clone https://github.com/netj/wtcode.git
31
+ ln -s "$PWD/wtcode/wtcode.sh" /usr/local/bin/wtcode
32
+ ```
33
+
34
+ ## Usage
35
+
36
+ ```
37
+ wtcode [BRANCH] [CMD [CMD-ARGS...]]
38
+ ```
39
+
40
+ - **`BRANCH`** -- Git branch or worktree name. If omitted and [fzf](https://github.com/junegunn/fzf) is available, interactively select one. Prefix with `:` to create a new branch (use `:::name` to avoid fzf matching the colons).
41
+ - **`CMD`** -- Command to launch in the worktree. Defaults to `$WTCODE_CMD`, or the first available of: `claude`, `aider`, `codex`, `$SHELL`.
42
+
43
+ ### Examples
44
+
45
+ ```sh
46
+ wtcode feature-x # launch default tool in feature-x worktree
47
+ wtcode feature-x lazygit # launch lazygit
48
+ wtcode feature-x claude --resume # launch claude with flags
49
+ wtcode :new-feature # create new branch and worktree
50
+ wtcode # interactive branch selection via fzf
51
+ WTCODE_CMD=cursor wtcode feature # use cursor as default tool
52
+ ```
53
+
54
+ ## Environment variables
55
+
56
+ | Variable | Description |
57
+ |---|---|
58
+ | `WTCODE_CMD` | Default tool to launch (e.g., `claude`, `lazygit`, `vim`, `cursor`) |
59
+ | `WTCODE_DEBUG` | Enable debug tracing when set to any value |
60
+ | `GIT_WORKTREE_ROOT` | Override the directory where worktrees are created |
61
+
62
+ ## How it works
63
+
64
+ 1. **Select/specify a branch** -- pass as argument or pick interactively with fzf
65
+ 2. **Create or switch to the worktree** -- worktrees are organized under `$GIT_WORKTREE_ROOT` (defaults to `../<repo>.worktrees/`)
66
+ 3. **Launch a tool** -- runs the specified command (or smart default) inside the worktree
67
+
68
+ ## Dependencies
69
+
70
+ - **git** -- required
71
+ - **[fzf](https://github.com/junegunn/fzf)** -- recommended, for interactive branch selection
72
+ - **[jq](https://jqlang.github.io/jq/)** -- optional, for Claude Code auto-trust setup
73
+
74
+ ## License
75
+
76
+ [MIT](LICENSE)
@@ -0,0 +1,29 @@
1
+ [build-system]
2
+ requires = ["setuptools>=64"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "wtcode"
7
+ version = "0.1.0"
8
+ description = "Launch your favorite code tool in a git worktree"
9
+ license = "MIT"
10
+ readme = "README.md"
11
+ requires-python = ">=3.9"
12
+ authors = [{name = "Jaeho Shin", email = "netj@sparcs.org"}]
13
+ keywords = ["git", "worktree", "cli", "claude", "developer-tools"]
14
+ classifiers = [
15
+ "Environment :: Console",
16
+ "Topic :: Software Development",
17
+ "Programming Language :: Python :: 3",
18
+ ]
19
+
20
+ [project.urls]
21
+ Homepage = "https://github.com/netj/wtcode"
22
+ Repository = "https://github.com/netj/wtcode"
23
+ Issues = "https://github.com/netj/wtcode/issues"
24
+
25
+ [project.scripts]
26
+ wtcode = "wtcode.__main__:main"
27
+
28
+ [tool.setuptools.package-data]
29
+ wtcode = ["wtcode.sh"]
wtcode-0.1.0/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,3 @@
1
+ """wtcode -- launch your favorite code tool in a git worktree."""
2
+
3
+ __version__ = "0.1.0"
@@ -0,0 +1,15 @@
1
+ """Thin wrapper to exec wtcode.sh from the installed package."""
2
+
3
+ import os
4
+ import sys
5
+ from importlib.resources import as_file, files
6
+
7
+
8
+ def main():
9
+ script = files("wtcode").joinpath("wtcode.sh")
10
+ with as_file(script) as path:
11
+ os.execvp("bash", ["bash", str(path)] + sys.argv[1:])
12
+
13
+
14
+ if __name__ == "__main__":
15
+ main()
@@ -0,0 +1,239 @@
1
+ #!/usr/bin/env bash
2
+ # wtcode -- launch a code tool in a git worktree for a given branch
3
+ # https://github.com/netj/wtcode
4
+ # Author: Jaeho Shin <netj@sparcs.org>
5
+ # Created: 2026-02-03
6
+ set -eu
7
+ shopt -s extglob
8
+ ${WTCODE_DEBUG:+set -x}
9
+
10
+ --msg() { echo "wtcode: $*" >&2; }
11
+
12
+ WTCODE_VERSION=0.1.0
13
+ --version() { echo "wtcode $WTCODE_VERSION"; }
14
+ --help() {
15
+ cat <<USAGE
16
+ wtcode $WTCODE_VERSION -- launch a code tool in a git worktree
17
+
18
+ Usage: wtcode [BRANCH] [CMD [CMD-ARGS...]]
19
+
20
+ BRANCH Git branch or worktree name to switch to.
21
+ If omitted and fzf is available, interactively select one.
22
+ Prefix with ':' to force creating a new branch
23
+ (use multiple colons to avoid fzf matching, e.g., :::my-branch).
24
+
25
+ CMD Command to launch in the worktree (default: \$WTCODE_CMD,
26
+ or first available of: ${WTCODE_CMDS_TO_TRY[*]}, \$SHELL).
27
+
28
+ Environment variables:
29
+ WTCODE_CMD Default tool to launch (e.g., claude, lazygit, vim)
30
+ WTCODE_DEBUG Enable debug tracing when set
31
+ GIT_WORKTREE_ROOT Override the directory where worktrees are created
32
+
33
+ Examples:
34
+ wtcode feature-x # select/create worktree, launch default tool
35
+ wtcode feature-x lazygit # launch lazygit in the worktree
36
+ wtcode feature-x claude --resume # launch claude with --resume
37
+ wtcode :new-feature # create new branch and worktree
38
+ WTCODE_CMD=cursor wtcode feature # use cursor as the default tool
39
+ USAGE
40
+ }
41
+
42
+ # commands to try as default, in order of preference
43
+ WTCODE_CMDS_TO_TRY=(
44
+ ${WTCODE_CMD:-}
45
+ claude
46
+ aider
47
+ codex
48
+ )
49
+
50
+ ###############################################################################
51
+ ## --select-git-branch -- determine which branch/worktree to use
52
+ ###############################################################################
53
+ --select-git-branch() {
54
+ if [[ $# -gt 0 ]]; then
55
+ branch_name=$1; shift
56
+ elif type fzf &>/dev/null; then
57
+ # if branch name unspecified, use fzf to select one or enter a new name
58
+ # format: branch_name<TAB>indicator branch_name date hash [upstream] subject
59
+ branch_name=$(
60
+ { set +x; } &>/dev/null
61
+ # NOTE: git branch --format uses ref-filter syntax which doesn't support
62
+ # pretty-format's %<(N,trunc) truncation. Using bash to handle truncation,
63
+ # alignment, and coloring instead.
64
+ c_reset=$'\e[0m' c_green=$'\e[32m' c_cyan=$'\e[36m' c_blue=$'\e[34m' c_yellow=$'\e[33m' c_red=$'\e[31m' c_dim=$'\e[2m'
65
+ {
66
+ git branch --sort=-committerdate \
67
+ --format=$'x%(refname:lstrip=2)\tx%(HEAD)\tx%(worktreepath)\tx%(committerdate:relative)\tx%(objectname:short)\tx%(upstream:track)\tx%(contents:subject)'
68
+ # also include remote-tracking branches that don't have a local counterpart
69
+ local_branches=$(git branch --format='%(refname:lstrip=2)')
70
+ git branch -r --sort=-committerdate \
71
+ --format=$'x%(refname:lstrip=2)\tx>\tx\tx%(committerdate:relative)\tx%(objectname:short)\tx\tx%(contents:subject)' |
72
+ while IFS=$'\t' read -r remote_ref rest; do
73
+ remote_ref=${remote_ref#x}
74
+ [[ $remote_ref == */HEAD ]] && continue
75
+ local_name=${remote_ref#*/}
76
+ grep -qxF "$local_name" <<< "$local_branches" && continue
77
+ printf 'x%s\t%s\n' "$remote_ref" "$rest"
78
+ done
79
+ } |
80
+ while IFS=$'\t' read -r branch head worktree date hash upstream subject; do
81
+ # strip the x prefix from all fields
82
+ branch=${branch#x} head=${head#x} worktree=${worktree#x} date=${date#x} hash=${hash#x} upstream=${upstream#x} subject=${subject#x}
83
+ # determine indicator and color: HEAD (*) takes precedence, then worktree (+)
84
+ if [[ $head == '*' ]]; then ind='*'; c=$c_green
85
+ elif [[ -n $worktree ]]; then ind='+'; c=$c_cyan
86
+ elif [[ $head == '>' ]]; then ind=' '; c=$c_dim
87
+ else ind=' '; c=$c_reset
88
+ fi
89
+ # truncate then pad branch name, right-pad date (before adding colors)
90
+ if (( ${#branch} > 50 )); then name="${branch:0:48}.."; else name=$branch; fi
91
+ printf -v name '%-50s' "$name"
92
+ printf -v date '%14s' "$date"
93
+ # build display fields with colors embedded
94
+ name_shown="${c}${name}${c_reset}"
95
+ date_shown="${c_blue}${date}${c_reset}"
96
+ hash_shown="${c_yellow}${hash}${c_reset}"
97
+ if [[ -n $upstream ]]; then upstream_shown="${c_red}${upstream}${c_reset} "; else upstream_shown=''; fi
98
+ printf '%s\t%s %s\t%s %s %s%s\n' \
99
+ "$branch" "$ind" "$name_shown" "$date_shown" "$hash_shown" "$upstream_shown" "$subject"
100
+ done |
101
+ fzf --ansi --color --tmux --print-query --delimiter=$'\t' --with-nth=2 --nth=1 \
102
+ --preview 'echo {3}' --preview-window 'down:2:wrap' \
103
+ --prompt 'wtcode: select worktree/branch (prefix : to create new) > ' |
104
+ cut -f1 |
105
+ tail -1
106
+ )
107
+ else # abort if fzf not available
108
+ branch_name=${1:?Need a worktree/branch name as first argument}; shift
109
+ fi
110
+
111
+ : ${branch_name:?non-empty worktree/branch name required}
112
+
113
+ # check if branch name starts with ':' to force new branch creation
114
+ # supports multiple colons (e.g., :::my-branch) to avoid fzf matching
115
+ force_new_branch=false
116
+ if [[ $branch_name == :* ]]; then
117
+ force_new_branch=true
118
+ branch_name=${branch_name##+(:)}
119
+ : ${branch_name:?non-empty branch name required after ':'}
120
+ # sanitize free-form text into a valid git branch name
121
+ branch_name=$(printf '%s' "$branch_name" |
122
+ tr '[:upper:]' '[:lower:]' | # lowercase
123
+ sed 's/[^a-z0-9/_-]/-/g' | # replace non-alnum to hyphens
124
+ sed 's/--*/-/g' | # collapse consecutive hyphens
125
+ sed 's/^-//; s/-$//' # trim leading/trailing hyphens
126
+ )
127
+ : ${branch_name:?branch name is empty after sanitization}
128
+ fi
129
+
130
+ # check if branch_name refers to a remote branch (e.g., origin/feature-x)
131
+ remote_branch=
132
+ if ! $force_new_branch; then
133
+ for remote in $(git remote); do
134
+ if [[ $branch_name == "$remote/"* ]]; then
135
+ remote_branch=$branch_name
136
+ branch_name=${branch_name#"$remote/"}
137
+ break
138
+ fi
139
+ done
140
+ fi
141
+
142
+ # remaining args are the command to launch
143
+ wtcode_cmd=("$@")
144
+ }
145
+
146
+ ###############################################################################
147
+ ## --prepare-git-worktree -- create or switch to the worktree for $branch_name
148
+ ###############################################################################
149
+ --prepare-git-worktree() {
150
+ # determine root of the worktree dirs
151
+ cd "$(git rev-parse --show-toplevel)"
152
+ : ${GIT_WORKTREE_ROOT:=$(
153
+ git_common_dir=$(git rev-parse --git-common-dir)
154
+ cd "$git_common_dir"
155
+ cd ..
156
+ repo_name=$(basename "$PWD")
157
+ echo "$PWD"/../"$repo_name".worktrees
158
+ )}
159
+
160
+ # ensure worktree based on given branch name
161
+ worktree_path="$GIT_WORKTREE_ROOT"/"$branch_name"
162
+ if [[ -e "$worktree_path"/.git ]]; then
163
+ --msg "using existing worktree: $worktree_path"
164
+ elif [[ -n ${remote_branch-} ]] && ! git rev-parse --verify "refs/heads/$branch_name" &>/dev/null; then
165
+ # remote branch: create local tracking branch in a new worktree
166
+ --msg "creating worktree for remote branch: $remote_branch"
167
+ git worktree add -b "$branch_name" "$worktree_path" "$remote_branch"
168
+ git -C "$worktree_path" branch --set-upstream-to="$remote_branch" "$branch_name"
169
+ elif git rev-parse "$branch_name" &>/dev/null; then
170
+ # branch exists, just check it out in a new worktree with the same name
171
+ --msg "creating worktree for branch: $branch_name"
172
+ git worktree add -B "$branch_name" "$worktree_path" "$(git rev-parse "$branch_name")"
173
+ else
174
+ # fork the current HEAD and create the new worktree
175
+ --msg "creating worktree with new branch: $branch_name"
176
+ git worktree add -b "$branch_name" "$worktree_path" "$(git rev-parse HEAD)"
177
+ fi
178
+ cd "$worktree_path"
179
+
180
+ # ensure the branch is checked out on the worktree
181
+ [[ $(git branch --show-current) = $branch_name ]] ||
182
+ git checkout "$branch_name" --
183
+ }
184
+
185
+ ###############################################################################
186
+ ## --launch-code-tool -- resolve and exec the tool in the worktree
187
+ ###############################################################################
188
+ --launch-code-tool() {
189
+ # resolve the command to launch if not specified by user
190
+ if [[ ${#wtcode_cmd[@]} -eq 0 ]]; then
191
+ for _cmd in "${WTCODE_CMDS_TO_TRY[@]}"; do
192
+ [[ -n "$_cmd" ]] && type "$_cmd" &>/dev/null && wtcode_cmd=("$_cmd") && break
193
+ done
194
+ # fall back to an interactive shell
195
+ wtcode_cmd=("${wtcode_cmd[@]:-${SHELL:-bash}}")
196
+ fi
197
+
198
+ --msg "launching: ${wtcode_cmd[*]}"
199
+ "${wtcode_cmd[@]}"
200
+ }
201
+
202
+ ###############################################################################
203
+ ## Command wrappers -- override specific tools with pre-launch setup.
204
+ ## Define a function with the tool's name to add custom behavior.
205
+ ###############################################################################
206
+
207
+ # claude: auto-trust the worktree in Claude Code's config
208
+ claude() {
209
+ if type jq &>/dev/null && [[ -f ~/.claude.json ]]; then
210
+ (
211
+ export worktree_path="$PWD"
212
+ jq -e '.projects[env.worktree_path]' ~/.claude.json &>/dev/null || {
213
+ jq '
214
+ .projects[env.worktree_path] = ({}
215
+ | .hasTrustDialogAccepted = true
216
+ )
217
+ ' ~/.claude.json >~/.claude.json.wtcode.$$
218
+ mv -f ~/.claude.json.wtcode.$$ ~/.claude.json
219
+ }
220
+ )
221
+ fi
222
+ exec command claude "$@"
223
+ }
224
+
225
+ ###############################################################################
226
+ ## main
227
+ ###############################################################################
228
+
229
+ -h() { --help "$@"; }
230
+
231
+ --() {
232
+ --select-git-branch "$@"
233
+ --prepare-git-worktree
234
+ --launch-code-tool
235
+ }
236
+
237
+ # dispatch $1 as a function when it starts with -
238
+ [[ ${1-} == -* ]] || set -- -- "$@"
239
+ "$@"
@@ -0,0 +1,94 @@
1
+ Metadata-Version: 2.4
2
+ Name: wtcode
3
+ Version: 0.1.0
4
+ Summary: Launch your favorite code tool in a git worktree
5
+ Author-email: Jaeho Shin <netj@sparcs.org>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/netj/wtcode
8
+ Project-URL: Repository, https://github.com/netj/wtcode
9
+ Project-URL: Issues, https://github.com/netj/wtcode/issues
10
+ Keywords: git,worktree,cli,claude,developer-tools
11
+ Classifier: Environment :: Console
12
+ Classifier: Topic :: Software Development
13
+ Classifier: Programming Language :: Python :: 3
14
+ Requires-Python: >=3.9
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ Dynamic: license-file
18
+
19
+ # wtcode
20
+
21
+ **Launch your favorite code tool in a git worktree.**
22
+
23
+ *worktree code* / *what-the-code* -- streamlines git worktree selection, creation, and launching tools like [Claude Code](https://claude.ai/code), [lazygit](https://github.com/jesseduffield/lazygit), your editor, or any command.
24
+
25
+ ## Install
26
+
27
+ ### Homebrew
28
+
29
+ ```sh
30
+ brew install netj/tap/wtcode
31
+ ```
32
+
33
+ ### PyPI (via [uv](https://docs.astral.sh/uv/))
34
+
35
+ ```sh
36
+ uvx wtcode
37
+ ```
38
+
39
+ Or install globally:
40
+
41
+ ```sh
42
+ uv tool install wtcode
43
+ ```
44
+
45
+ ### From source
46
+
47
+ ```sh
48
+ git clone https://github.com/netj/wtcode.git
49
+ ln -s "$PWD/wtcode/wtcode.sh" /usr/local/bin/wtcode
50
+ ```
51
+
52
+ ## Usage
53
+
54
+ ```
55
+ wtcode [BRANCH] [CMD [CMD-ARGS...]]
56
+ ```
57
+
58
+ - **`BRANCH`** -- Git branch or worktree name. If omitted and [fzf](https://github.com/junegunn/fzf) is available, interactively select one. Prefix with `:` to create a new branch (use `:::name` to avoid fzf matching the colons).
59
+ - **`CMD`** -- Command to launch in the worktree. Defaults to `$WTCODE_CMD`, or the first available of: `claude`, `aider`, `codex`, `$SHELL`.
60
+
61
+ ### Examples
62
+
63
+ ```sh
64
+ wtcode feature-x # launch default tool in feature-x worktree
65
+ wtcode feature-x lazygit # launch lazygit
66
+ wtcode feature-x claude --resume # launch claude with flags
67
+ wtcode :new-feature # create new branch and worktree
68
+ wtcode # interactive branch selection via fzf
69
+ WTCODE_CMD=cursor wtcode feature # use cursor as default tool
70
+ ```
71
+
72
+ ## Environment variables
73
+
74
+ | Variable | Description |
75
+ |---|---|
76
+ | `WTCODE_CMD` | Default tool to launch (e.g., `claude`, `lazygit`, `vim`, `cursor`) |
77
+ | `WTCODE_DEBUG` | Enable debug tracing when set to any value |
78
+ | `GIT_WORKTREE_ROOT` | Override the directory where worktrees are created |
79
+
80
+ ## How it works
81
+
82
+ 1. **Select/specify a branch** -- pass as argument or pick interactively with fzf
83
+ 2. **Create or switch to the worktree** -- worktrees are organized under `$GIT_WORKTREE_ROOT` (defaults to `../<repo>.worktrees/`)
84
+ 3. **Launch a tool** -- runs the specified command (or smart default) inside the worktree
85
+
86
+ ## Dependencies
87
+
88
+ - **git** -- required
89
+ - **[fzf](https://github.com/junegunn/fzf)** -- recommended, for interactive branch selection
90
+ - **[jq](https://jqlang.github.io/jq/)** -- optional, for Claude Code auto-trust setup
91
+
92
+ ## License
93
+
94
+ [MIT](LICENSE)
@@ -0,0 +1,11 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ wtcode/__init__.py
5
+ wtcode/__main__.py
6
+ wtcode/wtcode.sh
7
+ wtcode.egg-info/PKG-INFO
8
+ wtcode.egg-info/SOURCES.txt
9
+ wtcode.egg-info/dependency_links.txt
10
+ wtcode.egg-info/entry_points.txt
11
+ wtcode.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ wtcode = wtcode.__main__:main
@@ -0,0 +1 @@
1
+ wtcode