Conversation
Add `--format=json` flag to `wt switch` for structured output, and WorktreeCreate/WorktreeRemove hooks to the Claude Code plugin so agent-created worktrees go through wt instead of raw git. The format flag only affects output — hooks, --execute, shell integration, and cd all run normally regardless of format. Hook scripts intentionally omit --yes so wt's approval prompts still run. Co-Authored-By: Claude <noreply@anthropic.com>
# Conflicts: # src/cli/mod.rs # src/main.rs # tests/snapshots/integration__integration_tests__help__help_switch_short.snap
Remove separate shell scripts; inline hooks into hooks.json. Remove hook passes worktree path directly to `wt remove` instead of deriving the branch name via git rev-parse. Remove timeout overrides, redundant docs paragraph, and || true. Co-Authored-By: Claude <noreply@anthropic.com>
# Conflicts: # src/cli/mod.rs # src/main.rs
worktrunk-bot
approved these changes
Apr 7, 2026
Remove SwitchAction enum — action strings map 1:1 from SwitchResult variants and are a serialization detail. Consolidate from_result match arms. Use serde_json::to_string + println! to match list's JSON output pattern. Co-Authored-By: Claude <noreply@anthropic.com>
worktrunk-bot
approved these changes
Apr 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
--format=jsontowt switchand WorktreeCreate/WorktreeRemove hooks to the Claude Code plugin, so agent-created worktrees go throughwtinstead of rawgit.wt switch --format=jsonprints structured JSON to stdout (action,branch,path, etc.) without changing any behavior — hooks,--execute, shell integration, and cd all run normally regardless of format. ASwitchFormatenum (text/json) keeps the help text clean (only valid values shown).Plugin hooks are inline one-liners in
hooks.json:WorktreeCreate— pipes CC's JSON throughjqto extract the branch, callswt switch --create --format=json, extracts the pathWorktreeRemove— extracts the worktree path from CC's JSON, passes it directly towt remove -D --foregroundApproval prompts still run — the hooks don't pass
--yes, sowt's non-interactive detection applies normally.