Merged
Conversation
worktrunk-bot
approved these changes
Feb 18, 2026
Collaborator
worktrunk-bot
left a comment
There was a problem hiding this comment.
Clean feature addition — the hook plumbing, docs, CLI wiring, and tests all follow the established patterns well.
| let config = repo.user_config(); | ||
|
|
||
| // Run pre-switch hooks before anything else (before branch validation, planning, etc.) | ||
| run_pre_switch_hooks(&repo, config, true)?; |
Collaborator
There was a problem hiding this comment.
yes: true here auto-approves project pre-switch hooks without prompting, while approve_switch_hooks on line 320 uses yes: false (which prompts). This means project-level pre-switch hooks silently auto-approve in the picker, but post-switch/post-create project hooks still prompt — feels inconsistent.
Suggested change
| run_pre_switch_hooks(&repo, config, true)?; | |
| run_pre_switch_hooks(&repo, config, false)?; |
Covers the hook_commands.rs dispatch path for pre-switch, improving codecov/patch coverage. Co-Authored-By: Claude <noreply@anthropic.com>
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.
Summary
pre-switchhook that runs beforewt switchdoes anything — before branch validation, planning, or worktree creationpost-startas the most common starting pointCloses #1085. Thanks to @jdb8 for reporting.
Test plan
test_user_pre_switch_hook_executes— hook runs in source worktree before switchtest_user_pre_switch_failure_blocks_switch— failing hook aborts--createtest_user_pre_switch_skipped_with_no_verify—--no-verifyskips hook