summaryrefslogtreecommitdiff
path: root/evals/bin/skill-called
blob: cf4fc50a8b08e43e927e4d816c26d12c16a07750 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env bash
# Verify a specific superpowers Skill was invoked at least once.
#
# Usage: skill-called <skill-name>
# Example: skill-called superpowers:systematic-debugging
#
# Wraps the common case of `tool-arg-match Skill '.skill == "<name>"'` so
# scenario YAML doesn't have to embed jq quoting.
set -euo pipefail
command -v jq >/dev/null || { echo "jq required"; exit 127; }

SKILL_NAME="$1"
FILE="tool_calls.jsonl"

if [ ! -s "$FILE" ]; then
    echo "FAIL: tool_calls.jsonl missing or empty"
    exit 1
fi

COUNT=$(
    jq -s --arg name "$SKILL_NAME" \
        '[.[] | select(.tool == "Skill" and (.args.skill // "") == $name)] | length' \
        "$FILE"
)

if [ "$COUNT" -gt 0 ]; then
    echo "PASS: Skill($SKILL_NAME) called $COUNT time(s)"
    exit 0
else
    echo "FAIL: Skill($SKILL_NAME) never called"
    exit 1
fi