Files
bible/scripts/lint.sh
Michael Chus a44133aff2 Move inline code examples out of normative contracts
identifier-normalization, no-hardcoded-vendors,
vendor-installer-verification, and build-version-display follow the
go-database split: rules in contract.md, snippets in README.md. Routed
contract reads get cheaper; examples stay available on demand. Lint now
also rejects stale kit/patterns references.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 10:00:02 +03:00

35 lines
1.1 KiB
Bash
Executable File

#!/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 or stale path prefixes in committed markdown.
if grep -rn '/Users/\|kit/patterns' --include='*.md' . --exclude-dir=.git; then
echo "FAIL: machine-local absolute paths or stale kit/patterns references found (see above)"
fail=1
fi
if [ "$fail" -eq 0 ]; then
echo "OK: all checks passed"
fi
exit "$fail"