wtcode 0.1.4__py3-none-any.whl → 0.2.0__py3-none-any.whl

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/__init__.py CHANGED
@@ -1,3 +1,3 @@
1
1
  """wtcode -- launch your favorite code tool in a git worktree."""
2
2
 
3
- __version__ = "0.1.4"
3
+ __version__ = "0.2.0"
wtcode/wtcode.sh CHANGED
@@ -16,7 +16,7 @@ ${WTCODE_DEBUG:+set -x}
16
16
  sed 's/^-//; s/-$//' # trim leading/trailing hyphens
17
17
  }
18
18
 
19
- WTCODE_VERSION=0.1.4
19
+ WTCODE_VERSION=0.2.0
20
20
  --version() { echo "wtcode $WTCODE_VERSION"; }
21
21
  --help() {
22
22
  cat <<USAGE
@@ -38,6 +38,11 @@ Usage: wtcode [BRANCH] [CMD [CMD-ARGS...]]
38
38
 
39
39
  Environment variables:
40
40
  WTCODE_CMD Default tool to launch (e.g., claude, lazygit, vim)
41
+ WTCODE_TMUX_MODE When in tmux, control how the tool is launched:
42
+ send-keys - send command to current pane (default in tmux)
43
+ split-window - create split pane with send-keys
44
+ new-window - create new window with send-keys
45
+ exec - exec the tool directly (opt out of send-keys)
41
46
  WTCODE_DEBUG Enable debug tracing when set
42
47
  GIT_WORKTREE_ROOT Override the directory where worktrees are created
43
48
 
@@ -237,6 +242,52 @@ WTCODE_CMDS_TO_TRY=(
237
242
  fi
238
243
 
239
244
  --msg "launching: $*"
245
+
246
+ # when inside tmux, default to send-keys for command history access
247
+ # set WTCODE_TMUX_MODE=exec to opt out and exec directly
248
+ if [[ -n ${TMUX:-} ]] && type tmux &>/dev/null; then
249
+ local mode=${WTCODE_TMUX_MODE:-send-keys}
250
+
251
+ case $mode in
252
+ send-keys|split-window|new-window)
253
+ local worktree_path="$PWD"
254
+ # quote each argument for shell safety
255
+ local quoted_args=()
256
+ for arg in "$@"; do
257
+ quoted_args+=("$(printf '%q' "$arg")")
258
+ done
259
+ local cmd="cd $(printf '%q' "$worktree_path") && ${quoted_args[*]}"
260
+
261
+ case $mode in
262
+ send-keys)
263
+ # send to current pane
264
+ tmux send-keys "$cmd" Enter
265
+ return 0
266
+ ;;
267
+ split-window)
268
+ # create split, send there
269
+ tmux split-window -v -c "$worktree_path"
270
+ tmux send-keys "$cmd" Enter
271
+ return 0
272
+ ;;
273
+ new-window)
274
+ # create window, send there
275
+ tmux new-window -c "$worktree_path"
276
+ tmux send-keys "$cmd" Enter
277
+ return 0
278
+ ;;
279
+ esac
280
+ ;;
281
+ exec)
282
+ # explicitly opt out of send-keys, fall through to exec
283
+ ;;
284
+ *)
285
+ --msg "unknown WTCODE_TMUX_MODE: $mode (expected: send-keys, split-window, new-window, exec)"
286
+ ;;
287
+ esac
288
+ fi
289
+
290
+ # outside tmux, WTCODE_TMUX_MODE=exec, or unknown mode: exec directly
240
291
  if [[ $(type -t "$1") == function ]]; then
241
292
  "$@"
242
293
  else
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wtcode
3
- Version: 0.1.4
3
+ Version: 0.2.0
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
@@ -0,0 +1,9 @@
1
+ wtcode/__init__.py,sha256=8wIDZvCqXSwHi1obGTZsqnp-Zkf1KeYS-S3nx1vmTOY,89
2
+ wtcode/__main__.py,sha256=hOvSYANO-q_rf2yy-AQoEOr18KFRSOF8Ezosf8eeFmM,335
3
+ wtcode/wtcode.sh,sha256=tEljKNqwz899AuGUUn6IJUZd1a1whRH_UV0Xf5GanK8,13425
4
+ wtcode-0.2.0.dist-info/licenses/LICENSE,sha256=MV9gr1nAVj5R60EM2BQuBhBxCG5V9ulX6-Ep_-LcLqA,1067
5
+ wtcode-0.2.0.dist-info/METADATA,sha256=kEnP6efh4xTOr5vKH4Te-Wj8y2zqGEx5Ca6A7GVwSps,3477
6
+ wtcode-0.2.0.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
7
+ wtcode-0.2.0.dist-info/entry_points.txt,sha256=QkSPHU86FQa-ujQk07fF4sX4DBQgWzDtgusop4AA5bc,48
8
+ wtcode-0.2.0.dist-info/top_level.txt,sha256=oftTSYYjDMqt33wa0c9MC15KuQ3eyRyoTLXy3PdkVfE,7
9
+ wtcode-0.2.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (82.0.1)
2
+ Generator: setuptools (83.0.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,9 +0,0 @@
1
- wtcode/__init__.py,sha256=0ZQh71koVy1Uu4uc2158fJIamOMkJ-ER-gHxB2OBb7s,89
2
- wtcode/__main__.py,sha256=hOvSYANO-q_rf2yy-AQoEOr18KFRSOF8Ezosf8eeFmM,335
3
- wtcode/wtcode.sh,sha256=vhEWnZhhSpOXxaGA4WnOAYotb0opgdySAfZVR4LDyRc,11604
4
- wtcode-0.1.4.dist-info/licenses/LICENSE,sha256=MV9gr1nAVj5R60EM2BQuBhBxCG5V9ulX6-Ep_-LcLqA,1067
5
- wtcode-0.1.4.dist-info/METADATA,sha256=nZZUoSmKYRD3qyc08HFftXAkmjwjiPopBiluwxPZtoc,3477
6
- wtcode-0.1.4.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
7
- wtcode-0.1.4.dist-info/entry_points.txt,sha256=QkSPHU86FQa-ujQk07fF4sX4DBQgWzDtgusop4AA5bc,48
8
- wtcode-0.1.4.dist-info/top_level.txt,sha256=oftTSYYjDMqt33wa0c9MC15KuQ3eyRyoTLXy3PdkVfE,7
9
- wtcode-0.1.4.dist-info/RECORD,,