#!/usr/bin/env bash # Turn the img-no-alt scan into a checklist with context. set -euo pipefail STAMP="$(date +%Y%m%d-%H%M%S)" OUT_DIR="reports/phase1-${STAMP}-alt-todo" SRC_TXT="$(ls -1t reports/phase1-*-img-no-alt.txt 2>/dev/null | head -n1 || true)" mkdir -p "$OUT_DIR" OUT_MD="$OUT_DIR/alt-fix-todo.md" if [[ -z "$SRC_TXT" ]]; then echo "No img-no-alt report found. Run scripts/dev/phase1/list-imgs-missing-alt.sh first." >&2 exit 1 fi echo "# Alt text fixes — TODO" > "$OUT_MD" echo "" >> "$OUT_MD" echo "_Source: $SRC_TXT_" >> "$OUT_MD" echo "" >> "$OUT_MD" while IFS= read -r line; do file="$(cut -d: -f1 <<<"$line")" ln_no="$(cut -d: -f2 <<<"$line")" echo "- [ ] \`$file:$ln_no\`" >> "$OUT_MD" { echo "" echo '```tsx' nl -ba -w2 -s': ' "$file" | sed -n "$((ln_no-2)),$((ln_no+2))p" echo '```' echo "" } >> "$OUT_MD" done < "$SRC_TXT" echo "Wrote $OUT_MD"