| #!/usr/bin/env bash | |
| # Verify that src/baml_client/ matches what baml-cli generate would produce. | |
| # Exit 0 if up to date, exit 1 if stale. | |
| set -euo pipefail | |
| REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)" | |
| cd "$REPO_ROOT" | |
| # Snapshot current state | |
| BEFORE=$(git ls-files -m src/baml_client/ 2>/dev/null || true) | |
| # Regenerate in place | |
| baml-cli generate --no-version-check 2>/dev/null | |
| # Check if anything changed | |
| DIFF=$(git diff --name-only src/baml_client/) | |
| # Restore any modifications (we just wanted to check) | |
| if [ -n "$DIFF" ]; then | |
| git checkout -- src/baml_client/ | |
| echo "❌ baml_client is STALE — regenerate with: baml-cli generate" | |
| echo "Changed files:" | |
| echo "$DIFF" | |
| exit 1 | |
| else | |
| echo "✅ baml_client is up to date" | |
| exit 0 | |
| fi | |