#!/usr/bin/env bash
# Review package between two snapshot trees: stat + diff -U10 (built bundle excluded).
# Usage: pkg BASE_TREE HEAD_TREE LABEL   -> writes <workspace>/review-LABEL.diff, prints path
set -euo pipefail
here=$(cd "$(dirname "$0")" && pwd)
out="$here/review-$3.diff"
{
  echo "# Review package: tree $1 .. tree $2 (working-tree snapshots; nothing is committed in this repo per CLAUDE.md)"
  echo
  echo "## Files changed"
  git diff --stat "$1" "$2" -- . ':!src/variancelabs_mcp/app/static'
  echo
  echo "## Diff"
  git diff -U10 "$1" "$2" -- . ':!src/variancelabs_mcp/app/static'
} > "$out"
echo "wrote $out: $(wc -c < "$out" | tr -d ' ') bytes"
