wtcode 0.1.1__tar.gz → 0.1.2__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.1/wtcode.egg-info → wtcode-0.1.2}/PKG-INFO +7 -4
- {wtcode-0.1.1 → wtcode-0.1.2}/README.md +6 -3
- {wtcode-0.1.1 → wtcode-0.1.2}/pyproject.toml +1 -1
- {wtcode-0.1.1 → wtcode-0.1.2}/wtcode/__init__.py +1 -1
- {wtcode-0.1.1 → wtcode-0.1.2}/wtcode/wtcode.sh +36 -25
- {wtcode-0.1.1 → wtcode-0.1.2/wtcode.egg-info}/PKG-INFO +7 -4
- {wtcode-0.1.1 → wtcode-0.1.2}/LICENSE +0 -0
- {wtcode-0.1.1 → wtcode-0.1.2}/setup.cfg +0 -0
- {wtcode-0.1.1 → wtcode-0.1.2}/wtcode/__main__.py +0 -0
- {wtcode-0.1.1 → wtcode-0.1.2}/wtcode.egg-info/SOURCES.txt +0 -0
- {wtcode-0.1.1 → wtcode-0.1.2}/wtcode.egg-info/dependency_links.txt +0 -0
- {wtcode-0.1.1 → wtcode-0.1.2}/wtcode.egg-info/entry_points.txt +0 -0
- {wtcode-0.1.1 → wtcode-0.1.2}/wtcode.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: wtcode
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: Launch your favorite code tool in a git worktree
|
|
5
5
|
Author-email: Jaeho Shin <netj@sparcs.org>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -33,15 +33,18 @@ brew install netj/tap/wtcode
|
|
|
33
33
|
### PyPI (via [uv](https://docs.astral.sh/uv/))
|
|
34
34
|
|
|
35
35
|
```sh
|
|
36
|
-
|
|
36
|
+
uv tool install wtcode
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
Or
|
|
39
|
+
Or try it without installing:
|
|
40
40
|
|
|
41
41
|
```sh
|
|
42
|
-
|
|
42
|
+
uvx wtcode
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
+
> **Note:** `uv tool install` is recommended over `uvx` for regular use.
|
|
46
|
+
> `uvx` keeps a parent `uv tool run` process alive, which can interfere with tools like tmux that detect the working directory from the process tree.
|
|
47
|
+
|
|
45
48
|
### From source
|
|
46
49
|
|
|
47
50
|
```sh
|
|
@@ -15,15 +15,18 @@ brew install netj/tap/wtcode
|
|
|
15
15
|
### PyPI (via [uv](https://docs.astral.sh/uv/))
|
|
16
16
|
|
|
17
17
|
```sh
|
|
18
|
-
|
|
18
|
+
uv tool install wtcode
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
Or
|
|
21
|
+
Or try it without installing:
|
|
22
22
|
|
|
23
23
|
```sh
|
|
24
|
-
|
|
24
|
+
uvx wtcode
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
+
> **Note:** `uv tool install` is recommended over `uvx` for regular use.
|
|
28
|
+
> `uvx` keeps a parent `uv tool run` process alive, which can interfere with tools like tmux that detect the working directory from the process tree.
|
|
29
|
+
|
|
27
30
|
### From source
|
|
28
31
|
|
|
29
32
|
```sh
|
|
@@ -9,13 +9,14 @@ ${WTCODE_DEBUG:+set -x}
|
|
|
9
9
|
|
|
10
10
|
--msg() { echo "wtcode: $*" >&2; }
|
|
11
11
|
|
|
12
|
-
WTCODE_VERSION=0.1.
|
|
12
|
+
WTCODE_VERSION=0.1.2
|
|
13
13
|
--version() { echo "wtcode $WTCODE_VERSION"; }
|
|
14
14
|
--help() {
|
|
15
15
|
cat <<USAGE
|
|
16
16
|
wtcode $WTCODE_VERSION -- launch a code tool in a git worktree
|
|
17
17
|
|
|
18
18
|
Usage: wtcode [BRANCH] [CMD [CMD-ARGS...]]
|
|
19
|
+
wtcode --exec CMD [CMD-ARGS...]
|
|
19
20
|
|
|
20
21
|
BRANCH Git branch or worktree name to switch to.
|
|
21
22
|
If omitted and fzf is available, interactively select one.
|
|
@@ -25,6 +26,8 @@ Usage: wtcode [BRANCH] [CMD [CMD-ARGS...]]
|
|
|
25
26
|
CMD Command to launch in the worktree (default: \$WTCODE_CMD,
|
|
26
27
|
or first available of: ${WTCODE_CMDS_TO_TRY[*]}, \$SHELL).
|
|
27
28
|
|
|
29
|
+
--exec Skip branch argument; select interactively, then launch CMD.
|
|
30
|
+
|
|
28
31
|
Environment variables:
|
|
29
32
|
WTCODE_CMD Default tool to launch (e.g., claude, lazygit, vim)
|
|
30
33
|
WTCODE_DEBUG Enable debug tracing when set
|
|
@@ -34,6 +37,7 @@ Examples:
|
|
|
34
37
|
wtcode feature-x # select/create worktree, launch default tool
|
|
35
38
|
wtcode feature-x lazygit # launch lazygit in the worktree
|
|
36
39
|
wtcode feature-x claude --resume # launch claude with --resume
|
|
40
|
+
wtcode --exec claude --resume # select interactively, launch claude --resume
|
|
37
41
|
wtcode :new-feature # create new branch and worktree
|
|
38
42
|
WTCODE_CMD=cursor wtcode feature # use cursor as the default tool
|
|
39
43
|
USAGE
|
|
@@ -48,9 +52,12 @@ WTCODE_CMDS_TO_TRY=(
|
|
|
48
52
|
)
|
|
49
53
|
|
|
50
54
|
###############################################################################
|
|
51
|
-
## --
|
|
55
|
+
## --enter-git-worktree -- select branch and create/switch worktree
|
|
52
56
|
###############################################################################
|
|
53
|
-
--
|
|
57
|
+
--enter-git-worktree() {
|
|
58
|
+
local branch_name=
|
|
59
|
+
|
|
60
|
+
# 1. determine which branch/worktree to use
|
|
54
61
|
if [[ $# -gt 0 ]]; then
|
|
55
62
|
branch_name=$1; shift
|
|
56
63
|
elif type fzf &>/dev/null; then
|
|
@@ -115,7 +122,7 @@ WTCODE_CMDS_TO_TRY=(
|
|
|
115
122
|
|
|
116
123
|
# check if branch name starts with ':' to force new branch creation
|
|
117
124
|
# supports multiple colons (e.g., :::my-branch) to avoid fzf matching
|
|
118
|
-
force_new_branch=false
|
|
125
|
+
local force_new_branch=false
|
|
119
126
|
if [[ $branch_name == :* ]]; then
|
|
120
127
|
force_new_branch=true
|
|
121
128
|
branch_name=${branch_name##+(:)}
|
|
@@ -131,7 +138,7 @@ WTCODE_CMDS_TO_TRY=(
|
|
|
131
138
|
fi
|
|
132
139
|
|
|
133
140
|
# check if branch_name refers to a remote branch (e.g., origin/feature-x)
|
|
134
|
-
remote_branch=
|
|
141
|
+
local remote_branch=
|
|
135
142
|
if ! $force_new_branch; then
|
|
136
143
|
for remote in $(git remote); do
|
|
137
144
|
if [[ $branch_name == "$remote/"* ]]; then
|
|
@@ -142,15 +149,8 @@ WTCODE_CMDS_TO_TRY=(
|
|
|
142
149
|
done
|
|
143
150
|
fi
|
|
144
151
|
|
|
145
|
-
# remaining args are the command to launch
|
|
146
|
-
wtcode_cmd=("$@")
|
|
147
|
-
}
|
|
148
152
|
|
|
149
|
-
|
|
150
|
-
## --prepare-git-worktree -- create or switch to the worktree for $branch_name
|
|
151
|
-
###############################################################################
|
|
152
|
-
--prepare-git-worktree() {
|
|
153
|
-
# determine root of the worktree dirs
|
|
153
|
+
# 2. create or switch to the worktree
|
|
154
154
|
cd "$(git rev-parse --show-toplevel)"
|
|
155
155
|
: ${GIT_WORKTREE_ROOT:=$(
|
|
156
156
|
git_common_dir=$(git rev-parse --git-common-dir)
|
|
@@ -160,8 +160,7 @@ WTCODE_CMDS_TO_TRY=(
|
|
|
160
160
|
echo "$PWD"/../"$repo_name".worktrees
|
|
161
161
|
)}
|
|
162
162
|
|
|
163
|
-
|
|
164
|
-
worktree_path="$GIT_WORKTREE_ROOT"/"$branch_name"
|
|
163
|
+
local worktree_path="$GIT_WORKTREE_ROOT"/"$branch_name"
|
|
165
164
|
if [[ -e "$worktree_path"/.git ]]; then
|
|
166
165
|
--msg "using existing worktree: $worktree_path"
|
|
167
166
|
elif [[ -n ${remote_branch-} ]] && ! git rev-parse --verify "refs/heads/$branch_name" &>/dev/null; then
|
|
@@ -189,17 +188,21 @@ WTCODE_CMDS_TO_TRY=(
|
|
|
189
188
|
## --launch-code-tool -- resolve and exec the tool in the worktree
|
|
190
189
|
###############################################################################
|
|
191
190
|
--launch-code-tool() {
|
|
192
|
-
# resolve the command to launch if not specified
|
|
193
|
-
if [[
|
|
191
|
+
# resolve the command to launch if not specified
|
|
192
|
+
if [[ $# -eq 0 ]]; then
|
|
194
193
|
for _cmd in "${WTCODE_CMDS_TO_TRY[@]}"; do
|
|
195
|
-
[[ -n "$_cmd" ]] && type "$_cmd" &>/dev/null &&
|
|
194
|
+
[[ -n "$_cmd" ]] && type "$_cmd" &>/dev/null && set -- "$_cmd" && break
|
|
196
195
|
done
|
|
197
196
|
# fall back to an interactive shell
|
|
198
|
-
|
|
197
|
+
[[ $# -gt 0 ]] || set -- "${SHELL:-bash}"
|
|
199
198
|
fi
|
|
200
199
|
|
|
201
|
-
--msg "launching:
|
|
202
|
-
"$
|
|
200
|
+
--msg "launching: $*"
|
|
201
|
+
if [[ $(type -t "$1") == function ]]; then
|
|
202
|
+
"$@"
|
|
203
|
+
else
|
|
204
|
+
exec "$@"
|
|
205
|
+
fi
|
|
203
206
|
}
|
|
204
207
|
|
|
205
208
|
###############################################################################
|
|
@@ -222,7 +225,7 @@ claude() {
|
|
|
222
225
|
}
|
|
223
226
|
)
|
|
224
227
|
fi
|
|
225
|
-
exec
|
|
228
|
+
exec claude "$@"
|
|
226
229
|
}
|
|
227
230
|
|
|
228
231
|
###############################################################################
|
|
@@ -231,10 +234,18 @@ claude() {
|
|
|
231
234
|
|
|
232
235
|
-h() { --help "$@"; }
|
|
233
236
|
|
|
237
|
+
--exec() {
|
|
238
|
+
--enter-git-worktree
|
|
239
|
+
--launch-code-tool "$@"
|
|
240
|
+
}
|
|
241
|
+
|
|
234
242
|
--() {
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
243
|
+
if [[ $# -gt 0 ]]; then
|
|
244
|
+
--enter-git-worktree "$1"; shift
|
|
245
|
+
else
|
|
246
|
+
--enter-git-worktree
|
|
247
|
+
fi
|
|
248
|
+
--launch-code-tool "$@"
|
|
238
249
|
}
|
|
239
250
|
|
|
240
251
|
# dispatch $1 as a function when it starts with -
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: wtcode
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: Launch your favorite code tool in a git worktree
|
|
5
5
|
Author-email: Jaeho Shin <netj@sparcs.org>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -33,15 +33,18 @@ brew install netj/tap/wtcode
|
|
|
33
33
|
### PyPI (via [uv](https://docs.astral.sh/uv/))
|
|
34
34
|
|
|
35
35
|
```sh
|
|
36
|
-
|
|
36
|
+
uv tool install wtcode
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
Or
|
|
39
|
+
Or try it without installing:
|
|
40
40
|
|
|
41
41
|
```sh
|
|
42
|
-
|
|
42
|
+
uvx wtcode
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
+
> **Note:** `uv tool install` is recommended over `uvx` for regular use.
|
|
46
|
+
> `uvx` keeps a parent `uv tool run` process alive, which can interfere with tools like tmux that detect the working directory from the process tree.
|
|
47
|
+
|
|
45
48
|
### From source
|
|
46
49
|
|
|
47
50
|
```sh
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|