Skills go directly to ~/.claude/skills/<name>/ (not ~/.claude/plugins/). Hooks configured via setup-hooks.sh -> settings.local.json. Changes: - install.sh: targets ~/.claude/skills/, no settings.json registration needed - install.ps1: updated to match - setup-hooks.sh: new script to add hooks to settings.local.json - README: fix install instructions - Remove nested .claude-plugin directory - 26 skills symlinked to ~/.claude/skills/
59 lines
1.5 KiB
Bash
Executable File
59 lines
1.5 KiB
Bash
Executable File
#!/bin/bash
|
|
# setup-hooks.sh — Configure hub-guide hooks in Claude Code
|
|
#
|
|
# Adds hub-guide hooks to ~/.claude/settings.local.json
|
|
# This allows Claude to auto-detect your project and suggest relevant skills.
|
|
#
|
|
# Usage: ./setup-hooks.sh
|
|
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
SETTINGS_FILE="${HOME}/.claude/settings.local.json"
|
|
|
|
echo "📐 hub-guide hooks setup"
|
|
|
|
python3 << PYEOF
|
|
import json, os
|
|
|
|
script_dir = os.path.dirname(os.path.abspath(__file__))
|
|
settings_file = os.path.expanduser("~/.claude/settings.local.json")
|
|
|
|
# Read existing or create empty
|
|
if os.path.exists(settings_file):
|
|
with open(settings_file) as f:
|
|
cfg = json.load(f)
|
|
else:
|
|
cfg = {}
|
|
|
|
# Build hooks config
|
|
cfg["hooks"] = {
|
|
"SessionStart": [{
|
|
"hooks": [{
|
|
"type": "command",
|
|
"command": f"bash \"{script_dir}/hooks/scripts/detect-project.sh\"",
|
|
"timeout": 10
|
|
}]
|
|
}],
|
|
"PreToolUse": [{
|
|
"matcher": "Write|Edit",
|
|
"hooks": [{
|
|
"type": "command",
|
|
"command": f"bash \"{script_dir}/hooks/scripts/detect-file-type.sh\" \"\$TOOL_INPUT\"",
|
|
"timeout": 10
|
|
}]
|
|
}]
|
|
}
|
|
|
|
# Ensure parent dir exists
|
|
os.makedirs(os.path.dirname(settings_file), exist_ok=True)
|
|
|
|
with open(settings_file, 'w') as f:
|
|
json.dump(cfg, f, indent=2)
|
|
|
|
print(f"✅ Hooks configured in {settings_file}")
|
|
PYEOF
|
|
|
|
echo ""
|
|
echo " Restart Claude Code or run /reload to activate hooks."
|