#!/usr/bin/env bash
# Generate frozen.sha256 from Defs.lean and Theorems.lean.
# Run after SETUP is complete and before proofs are filled.
set -euo pipefail
REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
PINS="$REPO_ROOT/scripts/frozen.sha256"
echo "# SHA-256 pins for frozen files. Generated $(date -u '+%Y-%m-%dT%H:%M:%SZ')." > "$PINS"
for f in Defs.lean Theorems.lean; do
    fpath="$REPO_ROOT/$f"
    if [ -f "$fpath" ]; then
        sha=$(sha256sum "$fpath" | awk '{print $1}')
        echo "$sha  $f" >> "$PINS"
        echo "Pinned: $f ($sha)"
    fi
done
echo "Written to $PINS"
