skill-called 836 B

1234567891011121314151617181920212223242526272829303132
  1. #!/usr/bin/env bash
  2. # Verify a specific superpowers Skill was invoked at least once.
  3. #
  4. # Usage: skill-called <skill-name>
  5. # Example: skill-called superpowers:systematic-debugging
  6. #
  7. # Wraps the common case of `tool-arg-match Skill '.skill == "<name>"'` so
  8. # scenario YAML doesn't have to embed jq quoting.
  9. set -euo pipefail
  10. command -v jq >/dev/null || { echo "jq required"; exit 127; }
  11. SKILL_NAME="$1"
  12. FILE="tool_calls.jsonl"
  13. if [ ! -s "$FILE" ]; then
  14. echo "FAIL: tool_calls.jsonl missing or empty"
  15. exit 1
  16. fi
  17. COUNT=$(
  18. jq -s --arg name "$SKILL_NAME" \
  19. '[.[] | select(.tool == "Skill" and (.args.skill // "") == $name)] | length' \
  20. "$FILE"
  21. )
  22. if [ "$COUNT" -gt 0 ]; then
  23. echo "PASS: Skill($SKILL_NAME) called $COUNT time(s)"
  24. exit 0
  25. else
  26. echo "FAIL: Skill($SKILL_NAME) never called"
  27. exit 1
  28. fi