From 84ef58e90a7198b43309dddf435b3e71ea9408f4 Mon Sep 17 00:00:00 2001 From: "coderabbitai[bot]" <136622811+coderabbitai[bot]@users.noreply.github.com> Date: Thu, 30 Jul 2026 03:54:42 +0000 Subject: [PATCH] CodeRabbit Generated Unit Tests: Generate Unit Tests for PR Changes --- scripts/test-agents-md.sh | 117 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 scripts/test-agents-md.sh diff --git a/scripts/test-agents-md.sh b/scripts/test-agents-md.sh new file mode 100644 index 0000000..cb67f05 --- /dev/null +++ b/scripts/test-agents-md.sh @@ -0,0 +1,117 @@ +#!/usr/bin/env bash +# Tests for the top-level AGENTS.md. +# +# AGENTS.md is documentation, not executable code, so this suite verifies +# that the factual claims it makes (paths, npm scripts, ports, URLs) are +# actually true of the repository, catching doc/code drift. Mirrors the +# check style used by godmode/scripts/validate.sh. +# +# Run: bash scripts/test-agents-md.sh +set -euo pipefail +ROOT="$(cd "$(dirname "$0")/.." && pwd)" +AGENTS_MD="$ROOT/AGENTS.md" +pass=0 +fail=0 + +ok() { + echo "OK: $1" + pass=$((pass + 1)) +} + +bad() { + echo "FAIL: $1" + fail=$((fail + 1)) +} + +check_exists() { + local path="$1" desc="$2" + if [[ -e "$ROOT/$path" ]]; then + ok "$desc ($path exists)" + else + bad "$desc ($path missing)" + fi +} + +check_grep() { + local file="$1" pattern="$2" desc="$3" + if grep -qF -- "$pattern" "$ROOT/$file" 2>/dev/null; then + ok "$desc" + else + bad "$desc" + fi +} + +check_not_grep() { + local file="$1" pattern="$2" desc="$3" + if grep -qF -- "$pattern" "$ROOT/$file" 2>/dev/null; then + bad "$desc" + else + ok "$desc" + fi +} + +echo "== AGENTS.md itself ==" +if [[ -f "$AGENTS_MD" ]]; then + ok "root AGENTS.md exists" +else + bad "root AGENTS.md exists" +fi +if [[ -s "$AGENTS_MD" ]]; then + ok "root AGENTS.md is non-empty" +else + bad "root AGENTS.md is non-empty" +fi +check_grep "AGENTS.md" "# AGENTS" "AGENTS.md has an # AGENTS heading" +check_grep "AGENTS.md" "**Bloom**" "AGENTS.md documents Bloom" +check_grep "AGENTS.md" "**GODMODE**" "AGENTS.md documents GODMODE" +check_grep "AGENTS.md" "## Cursor Cloud specific instructions" "AGENTS.md has Cursor Cloud section" + +echo "== Paths referenced for Bloom exist ==" +check_exists "src" "Bloom source directory" +check_exists "public/tulip" "prebuilt tulip frames directory" +check_exists "package-lock.json" "npm lockfile (documents npm as package manager)" +check_exists "vite.config.ts" "vite config (documents fixed dev port)" +check_exists "src/vision.ts" "vision module (documents MediaPipe fetch URLs)" + +echo "== Paths referenced for GODMODE exist ==" +check_exists "godmode" "godmode directory" +check_exists "godmode/README.md" "godmode README" +check_exists "godmode/AGENTS.md" "godmode AGENTS.md" +check_exists "godmode/scripts/validate.sh" "godmode validate script" + +echo "== Documented npm scripts and quality gate match package.json ==" +check_grep "package.json" '"dev": "vite"' "dev script matches documented \`npm run dev\`" +check_grep "package.json" '"build": "tsc && vite build"' "build script matches documented \`tsc && vite build\`" +check_not_grep "package.json" '"lint"' "no lint script, matching documented 'no lint script'" +check_not_grep "package.json" '"test"' "no test script, matching documented 'no test framework'" + +echo "== Documented dev server port matches vite.config.ts ==" +check_grep "vite.config.ts" "port: 5175" "vite.config.ts pins the documented port 5175" + +echo "== Documented runtime network egress targets match src/vision.ts ==" +check_grep "src/vision.ts" "cdn.jsdelivr.net" "WASM is fetched from documented cdn.jsdelivr.net" +check_grep "src/vision.ts" "storage.googleapis.com" "hand model is fetched from documented storage.googleapis.com" +check_grep "src/vision.ts" "hand_landmarker.task" "documented model filename hand_landmarker.task is referenced" + +echo "== GODMODE has no build system, as documented ==" +if [[ -e "$ROOT/godmode/package.json" ]]; then + bad "godmode has no package.json (matches 'no dependencies/build')" +else + ok "godmode has no package.json (matches 'no dependencies/build')" +fi + +echo "== GODMODE self-check command matches documented invocation ==" +check_grep "godmode/scripts/validate.sh" "python3" "validate.sh invokes python3, matching documented requirement" +if [[ -x "$ROOT/godmode/scripts/validate.sh" ]]; then + ok "validate.sh is executable (runnable as \`bash godmode/scripts/validate.sh\`)" +else + ok "validate.sh runnable via documented \`bash godmode/scripts/validate.sh\` even if not marked executable" +fi + +echo +echo "Passed: $pass, Failed: $fail" +if [[ "$fail" -ne 0 ]]; then + echo "TEST FAILED" + exit 1 +fi +echo "TEST PASSED" \ No newline at end of file