#!/usr/bin/env bash set -euo pipefail # Kyberforge's Vale prefilter is duplicated into skill-audit and agent-audit's own # scripts/assets (per plugins/kyberforge/skills/skill-author/references/deployment-modes.md's # no-cross-skill-path rule: a plugin's cache-install copy only includes each skill's own files). # agent-audit's copy is canonical — it's the superset (Kyberforge + KyberforgeCopilot) that the # repo root's own pre-commit hook and .pre-commit-hooks.yaml both consume. This fails the build # if skill-audit's copy has drifted from it, since nothing else would catch a rule fix landing in # only one of the two. Run from repo root or pass REPO_ROOT as arg. REPO_ROOT="${1:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}" FAIL=0 err() { echo " FAIL: $1" >&2; FAIL=$((FAIL + 1)); } SKILL_AUDIT="$REPO_ROOT/plugins/kyberforge/skills/skill-audit" AGENT_AUDIT="$REPO_ROOT/plugins/kyberforge/skills/agent-audit" if [[ ! -d "$SKILL_AUDIT" && ! -d "$AGENT_AUDIT" ]]; then exit 0 fi # Exactly one present is drift, not absence: the missing copy can't be in sync # with the surviving one, and treating it as a no-op is how a deleted or # renamed copy would slip through silently. if [[ ! -d "$SKILL_AUDIT" ]]; then echo "Vale style sync check failed: $AGENT_AUDIT exists but $SKILL_AUDIT does not — run scripts/sync-vale-styles.sh to regenerate skill-audit's copy." >&2 exit 1 fi if [[ ! -d "$AGENT_AUDIT" ]]; then echo "Vale style sync check failed: $SKILL_AUDIT exists but $AGENT_AUDIT does not — agent-audit holds the canonical copy, so restore it before syncing." >&2 exit 1 fi if ! diff -q "$SKILL_AUDIT/scripts/vale-wrap.sh" "$AGENT_AUDIT/scripts/vale-wrap.sh" >/dev/null 2>&1; then err "scripts/vale-wrap.sh differs between skill-audit and agent-audit" fi if ! diff -rq "$SKILL_AUDIT/assets/vale/styles/Kyberforge" "$AGENT_AUDIT/assets/vale/styles/Kyberforge" >/dev/null 2>&1; then err "assets/vale/styles/Kyberforge differs between skill-audit and agent-audit" fi if [[ $FAIL -gt 0 ]]; then echo "Vale style sync check failed: $FAIL error(s). agent-audit's copy is canonical — run scripts/sync-vale-styles.sh to regenerate skill-audit's copy, then commit both." >&2 exit 1 fi