fix(hooks): use Python JSON generation for reliable context injection

- Replace bash escape_json + printf with Python json.dump for
  reliable handling of Unicode and special characters in SKILL.md
- Output follows superpowers pattern: hookSpecificOutput.additionalContext
- 55KB context, 1230 lines, 8 mandatory skills injected at session start
- Tested: JSON valid, content complete
This commit is contained in:
asepharyana
2026-07-26 11:51:35 +07:00
parent a460599fc8
commit a167705769
2 changed files with 64 additions and 44 deletions
+6 -3
View File
@@ -3,15 +3,18 @@
"SessionStart": [{
"hooks": [{
"type": "command",
"command": "bash \"$CLAUDE_PLUGIN_ROOT/hooks/scripts/detect-project.sh\"",
"timeout": 10
"command": "\"${CLAUDE_PLUGIN_ROOT}/hooks/scripts/detect-project.sh\"",
"shell": "bash",
"timeout": 10,
"async": false
}]
}],
"PreToolUse": [{
"matcher": "Write|Edit",
"hooks": [{
"type": "command",
"command": "bash \"$CLAUDE_PLUGIN_ROOT/hooks/scripts/detect-file-type.sh\" \"$TOOL_INPUT\"",
"command": "\"${CLAUDE_PLUGIN_ROOT}/hooks/scripts/detect-file-type.sh\" \"$TOOL_INPUT\"",
"shell": "bash",
"timeout": 10
}]
}]