-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-agents-md.sh
More file actions
117 lines (103 loc) · 3.98 KB
/
Copy pathtest-agents-md.sh
File metadata and controls
117 lines (103 loc) · 3.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
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"