feat(git-worktree): auto-trust mise and direnv configs in new worktrees (#312)

This commit is contained in:
Adam Zywicki
2026-03-21 01:29:11 -04:00
committed by GitHub
parent 89faf49dd3
commit cfbfb6710a
2 changed files with 174 additions and 3 deletions

View File

@@ -16,6 +16,7 @@ This skill provides a unified interface for managing Git worktrees across your d
- **Interactive confirmations** at each step
- **Automatic .gitignore management** for worktree directory
- **Automatic .env file copying** from main repo to new worktrees
- **Automatic dev tool trusting** for mise and direnv configs with review-safe guardrails
## CRITICAL: Always Use the Manager Script
@@ -23,8 +24,11 @@ This skill provides a unified interface for managing Git worktrees across your d
The script handles critical setup that raw git commands don't:
1. Copies `.env`, `.env.local`, `.env.test`, etc. from main repo
2. Ensures `.worktrees` is in `.gitignore`
3. Creates consistent directory structure
2. Trusts dev tool configs with branch-aware safety rules:
- mise: auto-trust only when unchanged from a trusted baseline branch
- direnv: auto-allow only for trusted base branches; review worktrees stay manual
3. Ensures `.worktrees` is in `.gitignore`
4. Creates consistent directory structure
```bash
# ✅ CORRECT - Always use the script
@@ -95,7 +99,11 @@ bash ${CLAUDE_PLUGIN_ROOT}/skills/git-worktree/scripts/worktree-manager.sh creat
2. Updates the base branch from remote
3. Creates new worktree and branch
4. **Copies all .env files from main repo** (.env, .env.local, .env.test, etc.)
5. Shows path for cd-ing to the worktree
5. **Trusts dev tool configs** with branch-aware safety rules:
- trusted bases (`main`, `develop`, `dev`, `trunk`, `staging`, `release/*`) compare against themselves
- other branches compare against the default branch
- direnv auto-allow is skipped on non-trusted bases because `.envrc` can source unchecked files
6. Shows path for cd-ing to the worktree
### `list` or `ls`