#!/usr/bin/env bash
set -euo pipefail

skill_md="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")/.." && pwd)/skills/using-kicad/SKILL.md"

# argv[1] is CLAUDE_PLUGIN_ROOT: set means plugin mode (hookSpecificOutput), unset means legacy.
node -e 'const c=require("fs").readFileSync(0,"utf8").trimEnd();console.log(JSON.stringify(process.argv[1]?{hookSpecificOutput:{hookEventName:"SessionStart",additionalContext:c}}:{additional_context:c}))' "${CLAUDE_PLUGIN_ROOT:-}" <<EOF
<EXTREMELY_IMPORTANT>
You have KiCad design skills.

**Below is the full content of your 'kicad:using-kicad' skill - your introduction to the KiCad design pipeline. For all other skills, use the 'Skill' tool:**

$(cat "${skill_md}" 2>&1 || echo "Error reading using-kicad skill")
</EXTREMELY_IMPORTANT>
EOF
