Deduplicate README structure list and add consistency lint
README no longer mirrors the contract list; the bootstrap router is the single source of truth. scripts/lint.sh checks router coverage, dead bootstrap references, and machine-local absolute paths. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
34
scripts/lint.sh
Executable file
34
scripts/lint.sh
Executable file
@@ -0,0 +1,34 @@
|
||||
#!/bin/sh
|
||||
# Consistency checks for the rules library. Run from the repo root: sh scripts/lint.sh
|
||||
set -u
|
||||
|
||||
fail=0
|
||||
|
||||
# 1. Every pattern directory must be reachable from the bootstrap router.
|
||||
for dir in rules/patterns/*/; do
|
||||
name=$(basename "$dir")
|
||||
if ! grep -q "$name" AGENT-BOOTSTRAP.md; then
|
||||
echo "FAIL: rules/patterns/$name is not mentioned in AGENT-BOOTSTRAP.md"
|
||||
fail=1
|
||||
fi
|
||||
done
|
||||
|
||||
# 2. Every bible/... path mentioned in the bootstrap must exist in the repo.
|
||||
for ref in $(grep -o 'bible/rules/patterns/[a-z-]*/contract\.md' AGENT-BOOTSTRAP.md | sort -u); do
|
||||
path=${ref#bible/}
|
||||
if [ ! -f "$path" ]; then
|
||||
echo "FAIL: AGENT-BOOTSTRAP.md references missing file $path"
|
||||
fail=1
|
||||
fi
|
||||
done
|
||||
|
||||
# 3. No machine-local absolute paths in committed markdown.
|
||||
if grep -rn '/Users/' --include='*.md' . --exclude-dir=.git; then
|
||||
echo "FAIL: machine-local absolute paths found (see above)"
|
||||
fail=1
|
||||
fi
|
||||
|
||||
if [ "$fail" -eq 0 ]; then
|
||||
echo "OK: all checks passed"
|
||||
fi
|
||||
exit "$fail"
|
||||
Reference in New Issue
Block a user