mirror of
https://github.com/addyosmani/agent-skills.git
synced 2026-10-26 15:05:04 +00:00
hooks: gracefully fall back when jq is missing
The fix in 43a0dde introduces jq as a hard runtime dependency for the
session-start hook. jq is not preinstalled on every macOS or Linux setup,
so users without it would hit a cryptic failure on every new session.
Add a `command -v jq` guard that emits a valid INFO-priority JSON message
explaining the dependency and pointing at install commands. Skills remain
available individually — only the meta-skill injection is skipped.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
43a0dde996
commit
501d2266dd
1 file changed
+5
@@ -6,6 +6,11 @@ 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
|
||||
|
||||
Reference in new issue
Block a user