summaryrefslogtreecommitdiff
path: root/hooks/session-start.sh
diff options
context:
space:
mode:
authorJesse Vincent <jesse@fsck.com>2025-10-10 14:01:45 -0700
committerJesse Vincent <jesse@fsck.com>2025-10-10 14:01:45 -0700
commit6c0ab4cfec8d2b3d2b1fd036e976298b1ca928a4 (patch)
treebd4ab8924ef84a7a085a47f5b75d083984375937 /hooks/session-start.sh
parentdee324d41705a235af987e39c7450ec54a532e24 (diff)
Add personal superpowers overlay system
Enables users to write and manage their own skills alongside core skills. ## Key Features: - Auto-setup on first session: Creates ~/.config/superpowers/ git repo - Two-tier skills: Personal skills shadow core skills when paths match - Environment variable support: PERSONAL_SUPERPOWERS_DIR, XDG_CONFIG_HOME - GitHub integration: Optional public repo creation for sharing skills - CLI-agnostic: Works across Claude Code, Codex CLI, Gemini CLI (future) ## Changes: - Added hooks/setup-personal-superpowers.sh - Auto-initializes personal repo - Updated hooks/session-start.sh - Runs setup, offers GitHub repo creation - Updated list-skills, skills-search - Search both personal and core skills - Renamed skills/meta/creating-skills → writing-skills - Added skills/meta/setting-up-personal-superpowers - Setup documentation - Added skills/meta/sharing-skills - Contribution workflow - Removed skills/meta/installing-skills - Old ~/.clank system - Removed all INDEX.md files - Replaced by list-skills tool - Updated README.md, getting-started - Document personal skills workflow ## Architecture: ~/.config/superpowers/skills/ # Personal (user-created, git-tracked) ${CLAUDE_PLUGIN_ROOT}/skills/ # Core (read-only, from plugin) Search order: Personal first, core second (first match wins)
Diffstat (limited to 'hooks/session-start.sh')
-rwxr-xr-xhooks/session-start.sh28
1 files changed, 25 insertions, 3 deletions
diff --git a/hooks/session-start.sh b/hooks/session-start.sh
index f6c4f11..27bb78a 100755
--- a/hooks/session-start.sh
+++ b/hooks/session-start.sh
@@ -1,15 +1,37 @@
#!/usr/bin/env bash
# SessionStart hook for superpowers plugin
-# Create data directory
-mkdir -p ~/.superpowers
+set -euo pipefail
+
+# Run personal superpowers setup
+SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+setup_output=$("${SCRIPT_DIR}/setup-personal-superpowers.sh" 2>&1 || echo "setup_failed=true")
+
+# Use same directory resolution as setup script
+SUPERPOWERS_DIR="${PERSONAL_SUPERPOWERS_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/superpowers}"
+
+# Check if GitHub CLI is available and setup succeeded
+github_recommendation=""
+if echo "$setup_output" | grep -q "github_cli_available=true"; then
+ if [[ ! -d "$SUPERPOWERS_DIR/.git" ]]; then
+ # This should not happen, but handle gracefully
+ github_recommendation=""
+ else
+ # Check if remote already exists
+ if ! (cd "$SUPERPOWERS_DIR" && git remote get-url origin &>/dev/null); then
+ github_recommendation="\n\n💡 Want to share your personal skills on GitHub? Superpowers are best when everyone can learn from them! I can create a 'personal-superpowers' repo for you."
+ fi
+ fi
+elif echo "$setup_output" | grep -q "setup_failed=true"; then
+ github_recommendation="\n\n⚠️ Personal superpowers setup encountered an issue. Please file a bug at https://github.com/obra/superpowers/issues"
+fi
# Output context injection as JSON
cat <<EOF
{
"hookSpecificOutput": {
"hookEventName": "SessionStart",
- "additionalContext": "<EXTREMELY_IMPORTANT>\nYou have superpowers.\n\n**RIGHT NOW, go read**: @${CLAUDE_PLUGIN_ROOT}/skills/getting-started/SKILL.md\n</EXTREMELY_IMPORTANT>"
+ "additionalContext": "<EXTREMELY_IMPORTANT>\nYou have superpowers.\n\n**RIGHT NOW, go read**: @${CLAUDE_PLUGIN_ROOT}/skills/getting-started/SKILL.md${github_recommendation}\n</EXTREMELY_IMPORTANT>"
}
}
EOF