#!/bin/sh # Regenerate the whole-corpus prune diff. The plan gates the timer on reviewing # this, and the same gate should be re-runnable after any change to the rule. set -eu NOTES="${1:-$HOME/docs/notes/todo}" HERE=$(cd "$(dirname "$0")" && pwd) OUT="${OUT:-$HOME/todo-prune-review.diff}" tmp=$(mktemp) trap 'rm -f "$tmp"' EXIT : > "$OUT" files=0 for f in "$NOTES"/*.md; do # Compare files rather than shell strings: command substitution eats # trailing newlines and would invent differences that are not there. python3 "$HERE/prune.py" "$f" > "$tmp" if ! cmp -s "$f" "$tmp"; then diff -u --label "$f (now)" --label "$f (pruned)" "$f" "$tmp" >> "$OUT" || true files=$((files + 1)) fi done all=$(grep -c '^-' "$OUT" || true) hdr=$(grep -c '^--- ' "$OUT" || true) echo "$OUT: $((all - hdr)) lines removed across $files files"