Skip to content

fix(setup): symlink skill bin/ dirs so PreToolUse hooks resolve#1486

Open
genisis0x wants to merge 1 commit into
garrytan:mainfrom
genisis0x:fix/1459-symlink-skill-bin-dirs
Open

fix(setup): symlink skill bin/ dirs so PreToolUse hooks resolve#1486
genisis0x wants to merge 1 commit into
garrytan:mainfrom
genisis0x:fix/1459-symlink-skill-bin-dirs

Conversation

@genisis0x
Copy link
Copy Markdown

Summary

Resolves §1 of #1459 (`/freeze` enforcement chain). Companion defects §2 / §3 are intentionally out of scope.

`link_claude_skill_dirs` previously only symlinked `SKILL.md` into the top-level skill directory, leaving `bin/` behind. PreToolUse hook frontmatter references `\$CLAUDE_SKILL_DIR/bin/<script>`; with no symlink the path resolves to a non-existent target and the hook silently no-ops. The same defect affects every skill that ships scripts — `freeze`, `careful`, `browse`, etc.

What changes

In `setup`'s `link_claude_skill_dirs` function, after the existing `SKILL.md` symlink:

```bash
if [ -d "\$gstack_dir/\$dir_name/bin" ]; then
if [ -L "\$target/bin" ]; then rm "\$target/bin"; fi
if [ -e "\$target/bin" ] && [ ! -L "\$target/bin" ]; then rm -rf "\$target/bin"; fi
ln -snf "\$gstack_dir/\$dir_name/bin" "\$target/bin"
fi
```

Idempotent (rm + `ln -snf`) and tolerant of a prior real-directory entry at the target path so re-installs over an older copy upgrade cleanly.

Out of scope (explicitly)

Defects §2 (registering PreToolUse hooks in user `~/.claude/settings.json`) and §3 are out of scope. Both touch user-global state on behalf of `./setup` and deserve a separate design call — happy to follow up if you want me to take §2 next.

Test plan

  • `bash -n setup` — script syntax clean.
  • Diff is one block inside `link_claude_skill_dirs`; no other code paths touched.

…ytan#1459)

`link_claude_skill_dirs` previously only symlinked SKILL.md into the
top-level skill directory, leaving `bin/` behind. PreToolUse hook
frontmatter references \/bin/<script>; with no symlink
the path resolves to a non-existent target and the hook silently
no-ops. The same defect affects every skill that ships scripts -
freeze, careful, browse, etc.

Now creates a directory symlink for `bin/` alongside the existing
SKILL.md symlink. Idempotent (rm + ln -snf) and tolerant of a prior
real-directory entry at the target path. Source: issue garrytan#1459 §1.

Defects §2 (registering PreToolUse hooks in user settings.json) and
§3 (runtime path resolution) are out of scope; they need a separate
design discussion about whether the setup script should mutate
`~/.claude/settings.json` on user behalf.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant