#!/bin/sh # Tests for bin/check-surfaces. # # The repo ships to three surfaces — the Claude Code plugin, the symlinked # library (Crush/Pi/OpenCode) and claude.ai, which has no fetch path at all — # and used to treat every skill as belonging to all of them. gitea-ci, # playwright and web-shot cannot fire in a chat surface; a flat mirror installs # skills that can never trigger and degrades selection for the ones that can # (#29). # # The risk this gate exists for: a wrong `surfaces:` value silently removes a # skill from a harness rather than erroring. So presence is not enough — values # are validated against the allowed set. set -u ROOT=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd) SUT="$ROOT/bin/check-surfaces" pass=0 fail=0 WORK=${TMPDIR:-/tmp}/check_surfaces_test.$$ if [ ! -f "$SUT" ]; then printf 'FAIL: %s does not exist\n' "$SUT" exit 1 fi cleanup() { rm -rf "$WORK"; } trap cleanup EXIT INT TERM # fixture — a checkout holding one skill. fixture() { _f="$WORK/$1" mkdir -p "$_f/skills/alpha" if [ -n "$2" ]; then printf -- '---\nname: alpha\n%s\ndescription: a\n---\n' "$2" > "$_f/skills/alpha/SKILL.md" else printf -- '---\nname: alpha\ndescription: a\n---\n' > "$_f/skills/alpha/SKILL.md" fi printf '%s' "$_f" } # expect