fix(gates): run the provenance corpus gate from any cwd

The gate took its root from `git rev-parse --show-toplevel || pwd`, so
running it by absolute path from another directory found no skills and
exited 2. Derive the root from the script's own location; the optional
argument still overrides it.

The real-corpus test accepted exit 0 or 1, so it only caught a crash.
It now asserts exit 0. New cases cover a foreign cwd, a skill without
references/sources.md being skipped, several failing skills all being
reported, and an errored skill alongside a failing one.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EGHFJextYtVQseaHPDDhxB
This commit is contained in:
2026-09-21 19:40:34 +00:00
parent 2c4b6d2615
commit c008da1876
2 changed files with 80 additions and 5 deletions

View File

@@ -23,10 +23,10 @@ set -euo pipefail
# could not be audited must not read as a skill that failed the audit.
#
# The skill set is discovered by glob, not hardcoded, so a new skill is covered
# the moment it grows a references/sources.md. Run from repo root or pass
# the moment it grows a references/sources.md. Runs from any cwd: REPO_ROOT defaults to the parent of this script's directory, or pass
# REPO_ROOT as arg.
REPO_ROOT="${1:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}"
REPO_ROOT="${1:-$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)}"
if [[ ! -d "$REPO_ROOT" ]]; then
echo "Provenance corpus check failed: REPO_ROOT '$REPO_ROOT' is not a directory." >&2
exit 2