#!/usr/bin/env bash
# CHECK -- replies/ catalog extract (Extract lane, 2026-10-28).
# Re-derives every committed reply's git blob SHA + size from `git ls-tree` and
# diffs the resulting table against the committed replies-catalog.tsv.
# Exit code IS the verdict: 0 = artifact matches live git, non-zero = wrong.
cd /root/troupe-standup || exit 1
diff -u \
  <(tail -n +2 wizard-work/ledger/replies-catalog.tsv | sort) \
  <(git ls-tree -r -l HEAD replies/ | awk '$1=="100644" && $2=="blob"{print $5 "\t" $4 "\t" $3}' | sort) \
