Skip to content

Commit e793cd3

Browse files
iHiDclaude
andauthored
Symlink node_modules and husky in worktrees for JS tooling (#8422)
Worktrees don't have node_modules or .husky/_/husky.sh, breaking pre-commit hooks (prettier, eslint) and JS tests. Fix by symlinking both from the main repo after worktree creation. Also add .husky/_ to .gitignore so the symlink doesn't show as untracked, and update worktree paths to use ./worktrees/. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 49eb174 commit e793cd3

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

.claude/skills/fix/SKILL.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,15 @@ Only create the worktree **after the plan is approved**. The issue number has be
6767

6868
```bash
6969
git pull --ff-only origin main
70-
mkdir -p ../website-worktrees
71-
git worktree add ../website-worktrees/fix-<issue-number> -b fix/<issue-number>
72-
cd ../website-worktrees/fix-<issue-number>
70+
git worktree add worktrees/fix-<issue-number> -b fix/<issue-number>
71+
cd worktrees/fix-<issue-number>
72+
```
73+
74+
After creating the worktree, symlink `node_modules` and husky from the main repo so that JS tooling (prettier, eslint, jest) and pre-commit hooks work without a full `yarn install`:
75+
76+
```bash
77+
ln -s /Users/iHiD/Code/exercism/website/node_modules node_modules
78+
ln -s /Users/iHiD/Code/exercism/website/.husky/_ .husky/_
7379
```
7480

7581
**Important:** After creating the worktree, `cd` into it immediately. All subsequent work (file edits, bash commands, tests) happens inside the worktree. The main repo stays untouched on its current branch.
@@ -129,7 +135,7 @@ EOF
129135

130136
```bash
131137
cd /Users/iHiD/Code/exercism/website
132-
git worktree remove ../website-worktrees/fix-<issue-number>
138+
git worktree remove worktrees/fix-<issue-number>
133139
```
134140

135141
This removes the worktree directory and returns you to the main repo. The branch remains on the remote for the PR.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
/public/packs
2929
/public/packs-test
3030
/node_modules
31+
.husky/_
3132
/yarn-error.log
3233
yarn-debug.log*
3334
.yarn-integrity

0 commit comments

Comments
 (0)