#!/usr/bin/env bash # Run buf lint and breaking-change detection locally. # Usage: ./scripts/buf-check.sh [against-branch] # Default against-branch: main set -euo pipefail AGAINST="${1:-main}" ROOT="$(cd "$(dirname "$0")/.." && pwd)" EVENTS="$ROOT/packages/shared-types/events" if ! command -v buf &>/dev/null; then echo "buf not found. Install: https://buf.build/docs/installation" echo " curl -sSfL https://github.com/bufbuild/buf/releases/latest/download/buf-Linux-x86_64 -o /usr/local/bin/buf && chmod +x /usr/local/bin/buf" exit 1 fi echo "==> buf lint" buf lint "$EVENTS" echo "==> buf breaking against $AGAINST" buf breaking "$EVENTS" \ --against ".git#branch=${AGAINST},subdir=packages/shared-types/events" echo "All checks passed."