78 lines
3.8 KiB
Bash
Executable File
78 lines
3.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -uo pipefail
|
|
|
|
# Structural smoke tests for Phase 2 skills
|
|
# Verifies files exist, frontmatter is valid, and reference symlinks resolve
|
|
|
|
cd "$(dirname "$0")/.."
|
|
|
|
pass=0
|
|
fail=0
|
|
|
|
check() {
|
|
local desc="$1"
|
|
shift
|
|
if "$@" >/dev/null 2>&1; then
|
|
printf ' \033[32m✓\033[0m %s\n' "$desc"
|
|
((pass++))
|
|
else
|
|
printf ' \033[31m✗\033[0m %s\n' "$desc"
|
|
((fail++))
|
|
fi
|
|
}
|
|
|
|
# Inverse check: passes when the command FAILS (e.g. grep finds nothing)
|
|
check_absent() {
|
|
local desc="$1"
|
|
shift
|
|
if "$@" >/dev/null 2>&1; then
|
|
printf ' \033[31m✗\033[0m %s\n' "$desc"
|
|
((fail++))
|
|
else
|
|
printf ' \033[32m✓\033[0m %s\n' "$desc"
|
|
((pass++))
|
|
fi
|
|
}
|
|
|
|
for skill in elicit distill propagate; do
|
|
echo "=== $skill ==="
|
|
check "SKILL.md exists" test -f ".pi/skills/$skill/SKILL.md"
|
|
check "frontmatter: name: $skill" grep -q "^name: $skill" ".pi/skills/$skill/SKILL.md"
|
|
check "frontmatter: disable-model-invocation" grep -q "^disable-model-invocation:" ".pi/skills/$skill/SKILL.md"
|
|
check "frontmatter: license" grep -q "^license:" ".pi/skills/$skill/SKILL.md"
|
|
check "frontmatter: metadata.upstream" grep -q "upstream:" ".pi/skills/$skill/SKILL.md"
|
|
check "references/ directory exists" test -d ".pi/skills/$skill/references"
|
|
done
|
|
|
|
echo "=== reference symlinks ==="
|
|
check "elicit: language-reference.md resolves" test -s ".pi/skills/elicit/references/language-reference.md"
|
|
check "elicit: library-spec-signals.md resolves" test -s ".pi/skills/elicit/references/library-spec-signals.md"
|
|
check "distill: language-reference.md resolves" test -s ".pi/skills/distill/references/language-reference.md"
|
|
check "distill: worked-examples.md resolves" test -s ".pi/skills/distill/references/worked-examples.md"
|
|
check "propagate: test-generation.md resolves" test -s ".pi/skills/propagate/references/test-generation.md"
|
|
|
|
echo "=== cross-references in SKILL.md ==="
|
|
check "elicit: refs use references/ prefix" grep -q '(references/language-reference.md)' ".pi/skills/elicit/SKILL.md"
|
|
check "elicit: sub-ref uses references/ prefix" grep -q '(references/library-spec-signals.md)' ".pi/skills/elicit/SKILL.md"
|
|
check "distill: refs use references/ prefix" grep -q '(references/language-reference.md)' ".pi/skills/distill/SKILL.md"
|
|
check "distill: sub-ref uses references/ prefix" grep -q '(references/worked-examples.md)' ".pi/skills/distill/SKILL.md"
|
|
check "propagate: refs use references/ prefix" grep -q 'references/test-generation.md' ".pi/skills/propagate/SKILL.md"
|
|
|
|
echo "=== invocation references ==="
|
|
check "elicit: uses /skill:tend" grep -q '/skill:tend' ".pi/skills/elicit/SKILL.md"
|
|
check "elicit: uses /skill:weed" grep -q '/skill:weed' ".pi/skills/elicit/SKILL.md"
|
|
check "distill: uses /skill:tend" grep -q '/skill:tend' ".pi/skills/distill/SKILL.md"
|
|
check "distill: uses /skill:weed" grep -q '/skill:weed' ".pi/skills/distill/SKILL.md"
|
|
check "propagate: uses /skill:distill" grep -q '/skill:distill' ".pi/skills/propagate/SKILL.md"
|
|
check "propagate: uses /skill:elicit" grep -q '/skill:elicit' ".pi/skills/propagate/SKILL.md"
|
|
|
|
echo "=== no upstream path leaks ==="
|
|
check_absent "elicit: no ../../references/" grep -q '\.\./\.\./references/' ".pi/skills/elicit/SKILL.md"
|
|
check_absent "distill: no ../../references/" grep -q '\.\./\.\./references/' ".pi/skills/distill/SKILL.md"
|
|
check_absent "elicit: no \`tend\` skill" grep -q '`tend` skill' ".pi/skills/elicit/SKILL.md"
|
|
check_absent "distill: no \`tend\` skill" grep -q '`tend` skill' ".pi/skills/distill/SKILL.md"
|
|
|
|
echo ""
|
|
echo "passed: $pass failed: $fail"
|
|
[ "$fail" -eq 0 ]
|