test: add run-tests.sh, fix stale tests for marketplace model

- Add tests/run-tests.sh: discovers and runs all test-*.sh (including
  plugin subdirs) and the bats suite; replaces per-script pre-push calls
- Add tests/run-tests.bats: TDD coverage for run-tests.sh behaviours
- Update setup-hooks.sh: pre-push block now calls run-tests.sh
- Fix test-install.sh: remove provider adapter symlink tests (adapter
  removed in marketplace migration), guard skills loops on dir existence
- Fix test-instructions-and-docs.sh: content index checks now point to
  core/AGENTS.md (where it lives), remove ard/bug dir assertions
- Fix test-setup-hooks.sh: assert pre-push hook calls run-tests.sh

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-25 19:47:20 +00:00
parent 93e3de4d02
commit 32cd2e3128
6 changed files with 207 additions and 112 deletions

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env bash
# shellcheck disable=SC2015 # pass()/fail() always exit 0; A && pass || fail is safe here
set -euo pipefail
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
@@ -35,18 +36,19 @@ CLAUDE="$REPO_ROOT/providers/claude-code/CLAUDE.md"
&& pass "behavior: rules not duplicated in CLAUDE.md (moved to core/AGENTS.md)" \
|| fail "behavior: rules still inline in CLAUDE.md — 0015 refactor incomplete"
# Content index — must reference each on-demand file
contains "coding" "$CLAUDE" \
&& pass "content index: coding conventions trigger present" \
|| fail "content index: coding conventions trigger missing"
# Content index lives in core/AGENTS.md (deployed as ~/.agents/AGENTS.md), not in CLAUDE.md
CORE_AGENTS_FOR_0004="$REPO_ROOT/core/AGENTS.md"
contains "coding" "$CORE_AGENTS_FOR_0004" \
&& pass "content index: coding conventions trigger present (core/AGENTS.md)" \
|| fail "content index: coding conventions trigger missing from core/AGENTS.md"
contains "git" "$CLAUDE" \
&& pass "content index: git conventions trigger present" \
|| fail "content index: git conventions trigger missing"
contains "git" "$CORE_AGENTS_FOR_0004" \
&& pass "content index: git conventions trigger present (core/AGENTS.md)" \
|| fail "content index: git conventions trigger missing from core/AGENTS.md"
contains "testing" "$CLAUDE" \
&& pass "content index: testing conventions trigger present" \
|| fail "content index: testing conventions trigger missing"
contains "testing" "$CORE_AGENTS_FOR_0004" \
&& pass "content index: testing conventions trigger present (core/AGENTS.md)" \
|| fail "content index: testing conventions trigger missing from core/AGENTS.md"
# global.md must be retired — no longer referenced in content index
! contains "global\.md" "$CLAUDE" \
@@ -156,7 +158,7 @@ echo ""
echo "--- 0008: docs/ restructure ---"
for dir in prd ard bug notes adr; do
for dir in prd notes adr; do
[[ -d "$REPO_ROOT/docs/$dir" ]] \
&& pass "docs/$dir/ exists" \
|| fail "docs/$dir/ missing"
@@ -285,7 +287,8 @@ contains "core/AGENTS\.md" "$ARCH" \
&& pass "architecture.md: core/AGENTS.md entry present" \
|| fail "architecture.md: core/AGENTS.md entry missing"
contains "~/\.agents/AGENTS\.md" "$ARCH" \
# shellcheck disable=SC2088 # tilde is a literal search string, not a path
grep -qF '~/.agents/AGENTS.md' "$ARCH" \
&& pass "architecture.md: ~/.agents/AGENTS.md deployment path present" \
|| fail "architecture.md: ~/.agents/AGENTS.md deployment path missing"