#!/bin/sh
set -eu

ROOT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
cd "$ROOT_DIR"

if command -v swift-format >/dev/null 2>&1; then
  swift-format --in-place --recursive Package.swift Sources Tests
else
  echo "swift-format not found; checking formatting invariants only."
  sh Scripts/lint.sh
fi
