#!/usr/bin/env bash # check-docs-crossrefs.sh - List docs that may be missing a "Related Documentation" section # Usage: run from repo root: ./docs/scripts/check-docs-crossrefs.sh # Optional: use output to add cross-references manually where appropriate. set -e SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" DOCS_DIR="$(cd "$SCRIPT_DIR/.." && pwd)" echo "Checking docs for 'Related Documentation' section..." echo "" missing=0 while IFS= read -r -d '' f; do if ! grep -q "Related Documentation\|Related documentation\|## Related" "$f" 2>/dev/null; then rel="${f#$DOCS_DIR/}" echo " ${rel:-$f}" missing=$((missing + 1)) fi done < <(find "$DOCS_DIR" -name "*.md" -not -path "*/node_modules/*" -print0 2>/dev/null | sort -z) if [ "$missing" -eq 0 ]; then echo "All checked docs have a Related Documentation section (or similar)." else echo "" echo "Total: $missing doc(s) without a clear Related section. Add cross-refs where appropriate." fi exit 0