Files
Agent-System/scripts/arch-check.sh
T
weichenandCursor 312578ccd1 chore(arch): classify production writers and path rules
Replace whole-repo grep with four production-only gates so Goose and tests stop looking like writer debt, and so new SQL, path, or event crossings fail immediately.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-14 13:49:54 +00:00

40 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
# Architecture boundary check (U1).
# Production import / SQL write / path construction / event producer-consumer.
# Goose, *_test.go and fixtures are not production writers.
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
MODE="warn"
while [[ $# -gt 0 ]]; do
case "$1" in
--mode) MODE="${2:-warn}"; shift 2 ;;
--mode=*) MODE="${1#--mode=}"; shift ;;
*) echo "usage: $0 [--mode warn|block]" >&2; exit 2 ;;
esac
done
if [[ "${MODE}" != "warn" && "${MODE}" != "block" ]]; then
echo "mode must be warn or block" >&2
exit 2
fi
cd "${ROOT}"
echo "arch-check mode=${MODE}"
echo "boundaries=${ROOT}/.doc/system-design/module-boundaries.yaml"
if ! go test ./internal/archtest -count=1; then
echo "arch-check: new, expired, or unowned findings failed go test ./internal/archtest" >&2
exit 1
fi
if [[ "${MODE}" == "block" ]]; then
if ! ARCHTEST_STRICT=1 go test ./internal/archtest -count=1 -run TestArchitectureBoundaries; then
echo "arch-check block: baseline exceptions remain; only cleared rules may use --mode block" >&2
exit 1
fi
fi
echo "arch-check ${MODE}: production gate passed"