Prechádzať zdrojové kódy

Fix SessionStart hook: use command type with script

- Changed from invalid 'type: json' to 'type: command'
- Created session-start.sh script that outputs JSON
- Script creates ~/.superpowers/ and injects context
Jesse Vincent 11 mesiacov pred
rodič
commit
f8bd448b50
2 zmenil súbory, kde vykonal 18 pridanie a 10 odobranie
  1. 1 10
      hooks/hooks.json
  2. 17 0
      hooks/session-start.sh

+ 1 - 10
hooks/hooks.json

@@ -5,16 +5,7 @@
       "hooks": [
         {
           "type": "command",
-          "command": "mkdir",
-          "args": ["-p", "~/.superpowers"],
-          "description": "Initialize superpowers data directory"
-        },
-        {
-          "type": "json",
-          "hookSpecificOutput": {
-            "hookEventName": "SessionStart",
-            "additionalContext": "<EXTREMELY_IMPORTANT>\nYou have superpowers.\n\nBefore ANY task, search for relevant skills:\n\n${CLAUDE_PLUGIN_ROOT}/skills/getting-started/skills-search PATTERN\n\n**Skills are mandatory when they exist, not optional.**\n\nFailed searches are logged to: ~/.superpowers/search-log.jsonl\n\n**Skills location**: ${CLAUDE_PLUGIN_ROOT}/skills/\n\nCategories:\n- testing/ - TDD, async testing, anti-patterns\n- debugging/ - Systematic debugging, root cause tracing, verification\n- collaboration/ - Brainstorming, planning, code review, parallel agents\n- meta/ - Creating, testing, and contributing skills\n\n**Critical**: Skills exist and you didn't use them = failed task.\n\n**RIGHT NOW, go read**: ${CLAUDE_PLUGIN_ROOT}/skills/getting-started/SKILL.md\n</EXTREMELY_IMPORTANT>"
-          }
+          "command": "${CLAUDE_PLUGIN_ROOT}/hooks/session-start.sh"
         }
       ]
     }

+ 17 - 0
hooks/session-start.sh

@@ -0,0 +1,17 @@
+#!/usr/bin/env bash
+# SessionStart hook for superpowers plugin
+
+# Create data directory
+mkdir -p ~/.superpowers
+
+# Output context injection as JSON
+cat <<'EOF'
+{
+  "hookSpecificOutput": {
+    "hookEventName": "SessionStart",
+    "additionalContext": "<EXTREMELY_IMPORTANT>\nYou have superpowers.\n\nBefore ANY task, search for relevant skills:\n\n${CLAUDE_PLUGIN_ROOT}/skills/getting-started/skills-search PATTERN\n\n**Skills are mandatory when they exist, not optional.**\n\nFailed searches are logged to: ~/.superpowers/search-log.jsonl\n\n**Skills location**: ${CLAUDE_PLUGIN_ROOT}/skills/\n\nCategories:\n- testing/ - TDD, async testing, anti-patterns\n- debugging/ - Systematic debugging, root cause tracing, verification\n- collaboration/ - Brainstorming, planning, code review, parallel agents\n- meta/ - Creating, testing, and contributing skills\n\n**Critical**: Skills exist and you didn't use them = failed task.\n\n**RIGHT NOW, go read**: ${CLAUDE_PLUGIN_ROOT}/skills/getting-started/SKILL.md\n</EXTREMELY_IMPORTANT>"
+  }
+}
+EOF
+
+exit 0