ollie/data/tools/skill_load

23 lines
573 B
Bash
Executable File

#!/bin/sh
# skill_load — load a skill module, outputting its content
set -e
skills_path="${XDG_CONFIG_HOME:-$HOME/.config}/ollie/skills"
# Read name from JSON stdin
name=$(python3 -c "import sys,json; print(json.load(sys.stdin).get('name',''))")
if [ -z "$name" ]; then
echo "error: name is required" >&2
exit 1
fi
skill_file="${skills_path}/${name}/SKILL.md"
if [ ! -f "$skill_file" ]; then
echo "error: skill '${name}' not found at ${skill_file}" >&2
exit 1
fi
# Strip YAML frontmatter, output the body
sed '1{/^---$/!q}; 1,/^---$/d' "$skill_file"