feat(claude-design): add verify.sh top-level roll-up

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Kjell Tore Guttormsen 2026-05-18 12:34:24 +02:00
commit a6fb3869d9

152
plugins/claude-design/verify.sh Executable file
View file

@ -0,0 +1,152 @@
#!/usr/bin/env bash
# verify.sh — Top-level roll-up for claude-design plugin verification
#
# Runs the 5 test scripts in dependency order:
# 1. tests/validate-plugin.sh (foundation plugin structure)
# 2. tests/test-skill-triggers.sh (skill description + trigger phrases)
# 3. tests/test-sc2-artifact-coverage.sh (SC2 — every preset has ≥1 file)
# 4. tests/test-sc3-citations.sh (SC3 — citation discipline)
# 5. tests/test-sc1-dogfood-log.sh (SC1 — operator dogfood log format)
#
# Flags:
# --strict pass --strict to test-sc1-dogfood-log.sh (missing block = FAIL)
# --quick skip tests/test-skill-triggers.sh (fast incremental runs)
#
# Exit codes: 0 = all sub-tests pass; non-zero = at least one sub-test failed
#
# Bash 3.2 compatible. Modelled on plugins/voyage/verify.sh helper style.
set -u
LC_ALL=en_US.UTF-8
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BOLD='\033[1m'
NC='\033[0m'
PLUGIN_ROOT="$(cd "$(dirname "$0")" && pwd)"
# Flag parsing
STRICT=false
QUICK=false
for arg in "$@"; do
case "$arg" in
--strict) STRICT=true ;;
--quick) QUICK=true ;;
-h|--help)
echo "Usage: $0 [--strict] [--quick]"
echo " --strict Pass --strict to test-sc1-dogfood-log.sh"
echo " --quick Skip tests/test-skill-triggers.sh"
exit 0
;;
*)
echo "Unknown flag: $arg" >&2
echo "Usage: $0 [--strict] [--quick]" >&2
exit 2
;;
esac
done
TOTAL_PASS=0
TOTAL_FAIL=0
TOTAL_WARN=0
FAILED_SCRIPTS=""
run_script() {
local script_name="$1"
shift
local script_path="$PLUGIN_ROOT/tests/$script_name"
if [ ! -f "$script_path" ]; then
printf "${RED}[MISSING]${NC} %s\n" "$script_name"
TOTAL_FAIL=$((TOTAL_FAIL + 1))
FAILED_SCRIPTS="$FAILED_SCRIPTS $script_name"
return 1
fi
printf "${BOLD}### %s${NC}\n" "$script_name"
local output exit_code
output="$(bash "$script_path" "$@" 2>&1)"
exit_code=$?
printf '%s\n' "$output"
# Parse the script's own Summary line: "Pass: N Fail: N Warn: N"
local summary
summary="$(printf '%s\n' "$output" | grep -E '^Pass: [0-9]+ Fail: [0-9]+ Warn: [0-9]+$' | tail -n 1)"
if [ -n "$summary" ]; then
local p f w
p="$(printf '%s' "$summary" | awk '{print $2}')"
f="$(printf '%s' "$summary" | awk '{print $4}')"
w="$(printf '%s' "$summary" | awk '{print $6}')"
TOTAL_PASS=$((TOTAL_PASS + p))
TOTAL_FAIL=$((TOTAL_FAIL + f))
TOTAL_WARN=$((TOTAL_WARN + w))
fi
if [ "$exit_code" -ne 0 ]; then
FAILED_SCRIPTS="$FAILED_SCRIPTS $script_name"
fi
printf "\n"
return "$exit_code"
}
echo "=== claude-design verify.sh ==="
echo "Plugin root: $PLUGIN_ROOT"
echo "Strict mode: $STRICT Quick mode: $QUICK"
echo ""
# -------------------------------------------------------
# 1. validate-plugin.sh
# -------------------------------------------------------
run_script "validate-plugin.sh" || true
# -------------------------------------------------------
# 2. test-skill-triggers.sh (skipped in --quick mode)
# -------------------------------------------------------
if $QUICK; then
printf "${YELLOW}### test-skill-triggers.sh${NC} (skipped — --quick)\n\n"
else
run_script "test-skill-triggers.sh" || true
fi
# -------------------------------------------------------
# 3. test-sc2-artifact-coverage.sh
# -------------------------------------------------------
run_script "test-sc2-artifact-coverage.sh" || true
# -------------------------------------------------------
# 4. test-sc3-citations.sh
# -------------------------------------------------------
run_script "test-sc3-citations.sh" || true
# -------------------------------------------------------
# 5. test-sc1-dogfood-log.sh (strict if --strict)
# -------------------------------------------------------
if $STRICT; then
run_script "test-sc1-dogfood-log.sh" --strict || true
else
run_script "test-sc1-dogfood-log.sh" || true
fi
# -------------------------------------------------------
# Aggregate summary
# -------------------------------------------------------
echo "================================================="
echo "=== claude-design verify.sh — aggregate summary"
echo "================================================="
printf "${GREEN}Pass:${NC} %d ${RED}Fail:${NC} %d ${YELLOW}Warn:${NC} %d\n" \
"$TOTAL_PASS" "$TOTAL_FAIL" "$TOTAL_WARN"
if [ -n "$FAILED_SCRIPTS" ]; then
printf "${RED}Failed scripts:${NC}%s\n" "$FAILED_SCRIPTS"
fi
if [ "$TOTAL_FAIL" -gt 0 ]; then
exit 1
fi
exit 0