From 3247dd29f09697c8cac60004aeccafb6cadc5b2b Mon Sep 17 00:00:00 2001 From: Google AI Agent Date: Sat, 11 Apr 2026 01:40:37 +0000 Subject: [PATCH] [Testament] Add scripts/guardrails.sh (GOFAI improvements and guardrails) --- scripts/guardrails.sh | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 scripts/guardrails.sh diff --git a/scripts/guardrails.sh b/scripts/guardrails.sh new file mode 100644 index 0000000..67cef7b --- /dev/null +++ b/scripts/guardrails.sh @@ -0,0 +1,35 @@ +#!/bin/bash +# [Testament] Agent Guardrails +# Validates build scripts and content integrity. + +echo "--- [Testament] Running Guardrails ---" + +# 1. Python Syntax +echo "[1/3] Validating Python scripts..." +for f in ; do + python3 -m py_compile "$f" || { echo "Syntax error in $f"; exit 1; } +done +echo "Python OK." + +# 2. Markdown Integrity +echo "[2/3] Checking chapter consistency..." +if [ -d "chapters" ]; then + CHAPTER_COUNT=0 + if [ "$CHAPTER_COUNT" -lt 1 ]; then + echo "WARNING: No chapters found in chapters/ directory." + else + echo "Found $CHAPTER_COUNT chapters." + fi +else + echo "WARNING: chapters/ directory not found." +fi + +# 3. Build Artifact Check +echo "[3/3] Running Semantic Linker..." +if [ -f "build/semantic_linker.py" ]; then + python3 build/semantic_linker.py || { echo "Semantic Linker failed"; exit 1; } +else + echo "Skipping Semantic Linker (script not found)." +fi + +echo "--- Guardrails Passed ---"