Initial commit

This commit is contained in:
Zhongwei Li
2025-11-29 17:58:10 +08:00
commit 62e38f6386
28 changed files with 8679 additions and 0 deletions

15
hooks/hooks.json Normal file
View File

@@ -0,0 +1,15 @@
{
"hooks": {
"SessionStart": [
{
"matcher": "startup|resume|clear|compact",
"hooks": [
{
"type": "command",
"command": "${CLAUDE_PLUGIN_ROOT}/hooks/session-start.sh"
}
]
}
]
}
}

31
hooks/session-start.sh Executable file
View File

@@ -0,0 +1,31 @@
#!/bin/bash
# Session-start hook for spectacular plugin
# Injects using-spectacular skill into every Claude Code session
set -euo pipefail
# Get the directory where this script lives
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PLUGIN_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
# Path to the using-spectacular skill
SKILL_FILE="$PLUGIN_DIR/skills/using-spectacular/SKILL.md"
# Check if skill file exists
if [ ! -f "$SKILL_FILE" ]; then
echo "{\"hookEventName\": \"SessionStart\", \"additionalContext\": \"⚠️ using-spectacular skill not found at $SKILL_FILE\"}"
exit 0
fi
# Read the skill file and use jq to properly escape for JSON
# jq -Rs reads the entire file as a single string and escapes it properly
SKILL_CONTENT=$(cat "$SKILL_FILE" | jq -Rs .)
# Output JSON with the skill content injected as additional context
cat <<EOF
{
"hookEventName": "SessionStart",
"additionalContext": $SKILL_CONTENT
}
EOF