feat(setup-isolated-env): add WorktreeCreate and WorktreeRemove hooks#1
Open
joel611 wants to merge 6 commits into
Open
feat(setup-isolated-env): add WorktreeCreate and WorktreeRemove hooks#1joel611 wants to merge 6 commits into
joel611 wants to merge 6 commits into
Conversation
joel611
force-pushed
the
feat/setup-isolated-env-hooks
branch
from
March 5, 2026 15:26
fd59e52 to
9db201c
Compare
…SKILL_DIR
Update script path references to use the new ${CLAUDE_SKILL_DIR} variable
(supported since Claude 2.1.69) which points to the skill's own directory,
replacing the longer ${CLAUDE_PLUGIN_ROOT}/skills/generate-env-scripts/scripts/ pattern.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
All three scripts (setup-env.sh, smoke-test.sh, cleanup-env.sh) run from inside the worktree, not the project root. The .worktrees_scripts/ directory is tracked in git and present in every worktree checkout, so the correct path is `.worktrees_scripts/<script>` — not `../../<worktree_scripts>/`. smoke-test.sh and cleanup-env.sh take no arguments and auto-detect the environment name from $PWD (basename of the current directory). - Fix all path references across SKILL.md, README.md, WORKTREE.md template, and smoke-test.sh asset error messages - Update activate-worktree-env: simplify Step 1 to direct path check, correct Step 2 to run from inside worktree, fix cleanup instructions - Update generate-env-scripts: remove ONE-TIME framing from description, remove 'When to Use' section from body (moved to description), consolidate duplicated Common Mistakes + Troubleshooting sections, fix embedded CLAUDE.md template snippet - Add hook integration note to activate-worktree-env explaining WorktreeCreate hook auto-surfaces the skill Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds a new skill that tears down everything generate-env-scripts created: - cleans up all active worktrees and drops their databases - removes generated scripts (setup-env.sh, cleanup-env.sh, smoke-test.sh) - removes WORKTREE.md and the CLAUDE.md isolation section Updates CLAUDE.md flow diagram and trigger points table to document the new uninstall skill.
joel611
force-pushed
the
feat/setup-isolated-env-hooks
branch
from
March 11, 2026 15:37
7936895 to
00f8e92
Compare
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
This PR adds automation hooks and an uninstall skill to the
setup-isolated-envplugin.activate-worktree-envskill when a git worktree is created, and suggest cleanup when one is removedgenerate-env-scriptssetup: cleans up all active worktrees (dropping databases), removes generated scripts, WORKTREE.md, and the CLAUDE.md isolation sectionCLAUDE_PLUGIN_ROOTwithCLAUDE_SKILL_DIRthroughout skill scripts for correct path resolution; fixed script calling conventionsChanges
hooks/hooks.jsonhooks/scripts/worktree-create.shhooks/scripts/worktree-remove.shskills/uninstall/SKILL.mdskills/activate-worktree-env/SKILL.mdskills/generate-env-scripts/SKILL.mdCLAUDE.mdplugin.jsonTest plan
git worktree addis called and surfaces activate-worktree-env promptgit worktree removeis calledsetup-isolated-env:uninstalltriggers on "uninstall setup-isolated-env", "remove worktree scripts", "tear down worktree isolation"scripts/)CLAUDE_SKILL_DIR