fix(setup): symlink skill bin/ dirs so PreToolUse hooks resolve (#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 #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.
This commit is contained in:
genisis0x 2026-05-14 14:10:44 +05:30
parent c7ae63201a
commit 2be16c4f3f
1 changed files with 12 additions and 0 deletions

12
setup
View File

@ -577,6 +577,18 @@ link_claude_skill_dirs() {
if [ -e "$target/sections" ] || [ -L "$target/sections" ]; then rm -rf "$target/sections"; fi
_link_or_copy "$gstack_dir/$dir_name/sections" "$target/sections"
fi
# Also link bin/ when the source skill ships one. PreToolUse hook
# frontmatter references $CLAUDE_SKILL_DIR/bin/<script>; without
# this link those paths resolve to a non-existent target and the
# hook silently no-ops (issue #1459). Same fix applies to every
# skill that publishes scripts -- freeze, careful, browse, etc.
# Routes through _link_or_copy so Windows installs without
# Developer Mode get a directory copy instead of a frozen symlink.
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
_link_or_copy "$gstack_dir/$dir_name/bin" "$target/bin"
fi
linked+=("$link_name")
fi
done