#!/usr/bin/env bash
#
# pre-commit -- repository clean-room and public-surface guard.
#
# Ported from MGB64's pre-commit, which called scripts/ci/check_no_rom_data.sh
# (a tracked-file/history contamination scan). mdkr64's equivalent-purpose guard
# is tools/check_clean_room.sh -- it proves no ROM or ROM-derived data is tracked
# or was ever committed, the same "guard against committing ROM data" job
# check_no_rom_data.sh does in MGB64. (mdkr64's tools/check_no_rom.sh is a
# different, complementary guard: it scans a *built artifact* — e.g. dist/web —
# before publishing, not the repository's tracked files/history.)
#
# Enable in a checkout with: tools/install_git_hooks.sh  (sets
# core.hooksPath=.githooks).
set -euo pipefail

repo_root="$(git rev-parse --show-toplevel)"
cd "$repo_root"

tools/check_clean_room.sh
python3 tools/check_public_surface.py --staged
