iftypeset/scripts/audit.sh
2026-01-03 20:29:35 +00:00

56 lines
1.7 KiB
Bash
Executable file

#!/usr/bin/env bash
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$ROOT"
ts="$(date -u +"%Y-%m-%dT%H:%M:%SZ")"
echo "iftypeset audit @ ${ts}"
echo "root: ${ROOT}"
if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
echo "git: $(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo '?') $(git rev-parse --short HEAD 2>/dev/null || echo 'no-commit')"
git status --porcelain=v1 -b || true
else
echo "git: (not a git repo)"
fi
if [ -f out/coverage-report.json ]; then
python3 - <<'PY'
import json
from pathlib import Path
d = json.loads(Path("out/coverage-report.json").read_text())
counts = d.get("counts", {})
print("coverage:")
print(f" total_rules: {counts.get('total_rules')}")
print(f" by_category: {counts.get('by_category')}")
print(f" by_enforcement: {counts.get('by_enforcement')}")
print(f" by_severity: {counts.get('by_severity')}")
print(f" generated_at_utc: {d.get('generated_at_utc')}")
PY
else
echo "coverage: out/coverage-report.json missing (run ./scripts/ci.sh)"
fi
echo "recent files:"
ls -lt README.md STATUS.md spec/manifest.yaml 2>/dev/null | sed -n '1,5p' || true
ls -lt src/iftypeset 2>/dev/null | sed -n '1,12p' || true
echo "checkpoints:"
if ls out/checkpoints/iftypeset_checkpoint_*.tar.gz >/dev/null 2>&1; then
latest="$(ls -1t out/checkpoints/iftypeset_checkpoint_*.tar.gz | head -n 1)"
latest_sha="$(sha256sum "$latest" | awk '{print $1}')"
echo " latest_snapshot: ${latest}"
echo " latest_snapshot_sha256: ${latest_sha}"
else
echo " latest_snapshot: (none) # run ./scripts/checkpoint.sh"
fi
if [ -f docs/CHECKPOINTS.md ]; then
echo " docs/CHECKPOINTS.md: present"
tail -n 14 docs/CHECKPOINTS.md | sed 's/^/ | /'
else
echo " docs/CHECKPOINTS.md: missing"
fi