mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-07-04 13:23:15 +02:00
25 lines
1021 B
Bash
Executable File
25 lines
1021 B
Bash
Executable File
#!/bin/bash
|
|
# agent-skills session start hook
|
|
# Injects the using-agent-skills meta-skill into every new session
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
SKILLS_DIR="$(dirname "$SCRIPT_DIR")/skills"
|
|
META_SKILL="$SKILLS_DIR/using-agent-skills/SKILL.md"
|
|
|
|
if ! command -v jq >/dev/null 2>&1; then
|
|
echo '{"priority": "INFO", "message": "agent-skills: jq is required for the session-start hook but was not found on PATH. Install jq (e.g. `brew install jq` or `apt-get install jq`) to enable meta-skill injection. Skills remain available individually."}'
|
|
exit 0
|
|
fi
|
|
|
|
if [ -f "$META_SKILL" ]; then
|
|
CONTENT=$(cat "$META_SKILL")
|
|
# Use jq to properly escape and construct valid JSON
|
|
jq -cn \
|
|
--arg message "agent-skills loaded. Use the skill discovery flowchart to find the right skill for your task.
|
|
|
|
$CONTENT" \
|
|
'{priority: "IMPORTANT", message: $message}'
|
|
else
|
|
echo '{"priority": "INFO", "message": "agent-skills: using-agent-skills meta-skill not found. Skills may still be available individually."}'
|
|
fi
|