wtcode 0.2.0__tar.gz → 0.3.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.2.0/wtcode.egg-info → wtcode-0.3.0}/PKG-INFO +4 -3
- {wtcode-0.2.0 → wtcode-0.3.0}/README.md +3 -2
- {wtcode-0.2.0 → wtcode-0.3.0}/pyproject.toml +1 -1
- {wtcode-0.2.0 → wtcode-0.3.0}/wtcode/__init__.py +1 -1
- {wtcode-0.2.0 → wtcode-0.3.0}/wtcode/wtcode.sh +71 -29
- {wtcode-0.2.0 → wtcode-0.3.0/wtcode.egg-info}/PKG-INFO +4 -3
- {wtcode-0.2.0 → wtcode-0.3.0}/LICENSE +0 -0
- {wtcode-0.2.0 → wtcode-0.3.0}/setup.cfg +0 -0
- {wtcode-0.2.0 → wtcode-0.3.0}/wtcode/__main__.py +0 -0
- {wtcode-0.2.0 → wtcode-0.3.0}/wtcode.egg-info/SOURCES.txt +0 -0
- {wtcode-0.2.0 → wtcode-0.3.0}/wtcode.egg-info/dependency_links.txt +0 -0
- {wtcode-0.2.0 → wtcode-0.3.0}/wtcode.egg-info/entry_points.txt +0 -0
- {wtcode-0.2.0 → wtcode-0.3.0}/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.
|
|
3
|
+
Version: 0.3.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
|
|
@@ -88,13 +88,14 @@ WTCODE_CMD=cursor wtcode feature # use cursor as default tool
|
|
|
88
88
|
|
|
89
89
|
1. **Select/specify a branch** -- pass as argument or pick interactively with fzf
|
|
90
90
|
2. **Create or switch to the worktree** -- worktrees are organized under `$GIT_WORKTREE_ROOT` (defaults to `../<repo>.worktrees/`)
|
|
91
|
-
3. **
|
|
91
|
+
3. **Provision Claude Code, if that's what you're launching** -- when the resolved tool is `claude`, the worktree is auto-trusted (skips the "do you trust this folder" dialog) and `.claude/settings.json` / `.claude/settings.local.json` are symlinked in from the main repo if not already present -- never for other tools, never clobbering a file that's already there
|
|
92
|
+
4. **Launch the tool** -- runs the specified command (or smart default) inside the worktree
|
|
92
93
|
|
|
93
94
|
## Dependencies
|
|
94
95
|
|
|
95
96
|
- **git** -- required
|
|
96
97
|
- **[fzf](https://github.com/junegunn/fzf)** -- recommended, for interactive branch selection
|
|
97
|
-
- **[jq](https://jqlang.github.io/jq/)** -- optional, for Claude Code auto-trust setup
|
|
98
|
+
- **[jq](https://jqlang.github.io/jq/)** -- optional, for Claude Code auto-trust setup (no dependency needed for the settings symlinking itself)
|
|
98
99
|
|
|
99
100
|
## License
|
|
100
101
|
|
|
@@ -70,13 +70,14 @@ WTCODE_CMD=cursor wtcode feature # use cursor as default tool
|
|
|
70
70
|
|
|
71
71
|
1. **Select/specify a branch** -- pass as argument or pick interactively with fzf
|
|
72
72
|
2. **Create or switch to the worktree** -- worktrees are organized under `$GIT_WORKTREE_ROOT` (defaults to `../<repo>.worktrees/`)
|
|
73
|
-
3. **
|
|
73
|
+
3. **Provision Claude Code, if that's what you're launching** -- when the resolved tool is `claude`, the worktree is auto-trusted (skips the "do you trust this folder" dialog) and `.claude/settings.json` / `.claude/settings.local.json` are symlinked in from the main repo if not already present -- never for other tools, never clobbering a file that's already there
|
|
74
|
+
4. **Launch the tool** -- runs the specified command (or smart default) inside the worktree
|
|
74
75
|
|
|
75
76
|
## Dependencies
|
|
76
77
|
|
|
77
78
|
- **git** -- required
|
|
78
79
|
- **[fzf](https://github.com/junegunn/fzf)** -- recommended, for interactive branch selection
|
|
79
|
-
- **[jq](https://jqlang.github.io/jq/)** -- optional, for Claude Code auto-trust setup
|
|
80
|
+
- **[jq](https://jqlang.github.io/jq/)** -- optional, for Claude Code auto-trust setup (no dependency needed for the settings symlinking itself)
|
|
80
81
|
|
|
81
82
|
## License
|
|
82
83
|
|
|
@@ -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.
|
|
19
|
+
WTCODE_VERSION=0.3.0
|
|
20
20
|
--version() { echo "wtcode $WTCODE_VERSION"; }
|
|
21
21
|
--help() {
|
|
22
22
|
cat <<USAGE
|
|
@@ -228,6 +228,73 @@ WTCODE_CMDS_TO_TRY=(
|
|
|
228
228
|
git checkout "$branch_name" --
|
|
229
229
|
}
|
|
230
230
|
|
|
231
|
+
###############################################################################
|
|
232
|
+
## --provision-claude-settings -- Claude Code setup, only when launching claude
|
|
233
|
+
###############################################################################
|
|
234
|
+
# Everything Claude-Code-specific lives here so it runs once, synchronously,
|
|
235
|
+
# before dispatch -- regardless of tmux mode -- and only when the resolved
|
|
236
|
+
# tool is actually `claude`. See the call site in --launch-code-tool.
|
|
237
|
+
--provision-claude-settings() {
|
|
238
|
+
# auto-trust this worktree in Claude Code's global config. Newer Claude
|
|
239
|
+
# Code versions also gate a separate "pre-approves N tool permissions"
|
|
240
|
+
# onboarding screen (shown when .claude/settings.local.json grants
|
|
241
|
+
# auto-approve rules) that hasTrustDialogAccepted alone doesn't suppress --
|
|
242
|
+
# hasCompletedProjectOnboarding is needed too.
|
|
243
|
+
if type jq &>/dev/null && [[ -f ~/.claude.json ]]; then
|
|
244
|
+
(
|
|
245
|
+
export worktree_path="$PWD"
|
|
246
|
+
jq -e '.projects[env.worktree_path]' ~/.claude.json &>/dev/null || {
|
|
247
|
+
jq '.projects[env.worktree_path] = ({} | .hasTrustDialogAccepted = true | .hasCompletedProjectOnboarding = true)' \
|
|
248
|
+
~/.claude.json >~/.claude.json.wtcode.$$
|
|
249
|
+
mv -f ~/.claude.json.wtcode.$$ ~/.claude.json
|
|
250
|
+
}
|
|
251
|
+
)
|
|
252
|
+
fi
|
|
253
|
+
|
|
254
|
+
# symlink project-local settings from the main worktree, if not already
|
|
255
|
+
# present here -- never clobber a file that's git-tracked, hook-provisioned,
|
|
256
|
+
# or already customized in this worktree (including from a prior run: a
|
|
257
|
+
# dangling/previously-created symlink also counts as "already present").
|
|
258
|
+
local main_root
|
|
259
|
+
main_root=$(
|
|
260
|
+
git_common_dir=$(git rev-parse --git-common-dir)
|
|
261
|
+
cd "$git_common_dir"
|
|
262
|
+
cd ..
|
|
263
|
+
pwd
|
|
264
|
+
)
|
|
265
|
+
[[ -d "$main_root/.claude" ]] || return 0 # nothing to provision from
|
|
266
|
+
[[ "$main_root" == "$PWD" ]] && return 0 # already in the main worktree
|
|
267
|
+
|
|
268
|
+
local name created_names=()
|
|
269
|
+
for name in settings.json settings.local.json; do
|
|
270
|
+
local src="$main_root/.claude/$name" dst="$PWD/.claude/$name"
|
|
271
|
+
[[ -e "$src" ]] || continue # nothing to link
|
|
272
|
+
[[ -e "$dst" || -L "$dst" ]] && continue # don't clobber existing/broken link
|
|
273
|
+
mkdir -p "$PWD/.claude" # safe no-op if .claude/ (with other content) already exists
|
|
274
|
+
ln -s "$src" "$dst"
|
|
275
|
+
--msg "symlinked .claude/$name from main worktree"
|
|
276
|
+
created_names+=("$name")
|
|
277
|
+
done
|
|
278
|
+
|
|
279
|
+
(( ${#created_names[@]} > 0 )) || return 0
|
|
280
|
+
|
|
281
|
+
local gi="$PWD/.claude/.gitignore"
|
|
282
|
+
[[ -e $gi ]] && return 0 # respect a pre-existing, possibly customized file
|
|
283
|
+
|
|
284
|
+
local already_ignored=true
|
|
285
|
+
for name in "${created_names[@]}"; do
|
|
286
|
+
git check-ignore -q ".claude/$name" || already_ignored=false
|
|
287
|
+
done
|
|
288
|
+
$already_ignored && return 0
|
|
289
|
+
|
|
290
|
+
{
|
|
291
|
+
echo '# wtcode: symlinked from the main worktree; never commit these here'
|
|
292
|
+
echo 'settings.json'
|
|
293
|
+
echo 'settings.local.json'
|
|
294
|
+
} >"$gi"
|
|
295
|
+
--msg "created .claude/.gitignore"
|
|
296
|
+
}
|
|
297
|
+
|
|
231
298
|
###############################################################################
|
|
232
299
|
## --launch-code-tool -- resolve and exec the tool in the worktree
|
|
233
300
|
###############################################################################
|
|
@@ -241,6 +308,8 @@ WTCODE_CMDS_TO_TRY=(
|
|
|
241
308
|
[[ $# -gt 0 ]] || set -- "${SHELL:-bash}"
|
|
242
309
|
fi
|
|
243
310
|
|
|
311
|
+
[[ $1 == claude ]] && --provision-claude-settings
|
|
312
|
+
|
|
244
313
|
--msg "launching: $*"
|
|
245
314
|
|
|
246
315
|
# when inside tmux, default to send-keys for command history access
|
|
@@ -288,34 +357,7 @@ WTCODE_CMDS_TO_TRY=(
|
|
|
288
357
|
fi
|
|
289
358
|
|
|
290
359
|
# outside tmux, WTCODE_TMUX_MODE=exec, or unknown mode: exec directly
|
|
291
|
-
|
|
292
|
-
"$@"
|
|
293
|
-
else
|
|
294
|
-
exec "$@"
|
|
295
|
-
fi
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
###############################################################################
|
|
299
|
-
## Command wrappers -- override specific tools with pre-launch setup.
|
|
300
|
-
## Define a function with the tool's name to add custom behavior.
|
|
301
|
-
###############################################################################
|
|
302
|
-
|
|
303
|
-
# claude: auto-trust the worktree in Claude Code's config
|
|
304
|
-
claude() {
|
|
305
|
-
if type jq &>/dev/null && [[ -f ~/.claude.json ]]; then
|
|
306
|
-
(
|
|
307
|
-
export worktree_path="$PWD"
|
|
308
|
-
jq -e '.projects[env.worktree_path]' ~/.claude.json &>/dev/null || {
|
|
309
|
-
jq '
|
|
310
|
-
.projects[env.worktree_path] = ({}
|
|
311
|
-
| .hasTrustDialogAccepted = true
|
|
312
|
-
)
|
|
313
|
-
' ~/.claude.json >~/.claude.json.wtcode.$$
|
|
314
|
-
mv -f ~/.claude.json.wtcode.$$ ~/.claude.json
|
|
315
|
-
}
|
|
316
|
-
)
|
|
317
|
-
fi
|
|
318
|
-
exec claude "$@"
|
|
360
|
+
exec "$@"
|
|
319
361
|
}
|
|
320
362
|
|
|
321
363
|
###############################################################################
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: wtcode
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.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
|
|
@@ -88,13 +88,14 @@ WTCODE_CMD=cursor wtcode feature # use cursor as default tool
|
|
|
88
88
|
|
|
89
89
|
1. **Select/specify a branch** -- pass as argument or pick interactively with fzf
|
|
90
90
|
2. **Create or switch to the worktree** -- worktrees are organized under `$GIT_WORKTREE_ROOT` (defaults to `../<repo>.worktrees/`)
|
|
91
|
-
3. **
|
|
91
|
+
3. **Provision Claude Code, if that's what you're launching** -- when the resolved tool is `claude`, the worktree is auto-trusted (skips the "do you trust this folder" dialog) and `.claude/settings.json` / `.claude/settings.local.json` are symlinked in from the main repo if not already present -- never for other tools, never clobbering a file that's already there
|
|
92
|
+
4. **Launch the tool** -- runs the specified command (or smart default) inside the worktree
|
|
92
93
|
|
|
93
94
|
## Dependencies
|
|
94
95
|
|
|
95
96
|
- **git** -- required
|
|
96
97
|
- **[fzf](https://github.com/junegunn/fzf)** -- recommended, for interactive branch selection
|
|
97
|
-
- **[jq](https://jqlang.github.io/jq/)** -- optional, for Claude Code auto-trust setup
|
|
98
|
+
- **[jq](https://jqlang.github.io/jq/)** -- optional, for Claude Code auto-trust setup (no dependency needed for the settings symlinking itself)
|
|
98
99
|
|
|
99
100
|
## License
|
|
100
101
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|