#!/bin/sh
set -euo pipefail

repo_root="$(git rev-parse --show-toplevel)"
sync_script="$repo_root/scripts/sync-consumers.ps1"

if command -v pwsh >/dev/null 2>&1; then
  pwsh -NoProfile -NonInteractive -ExecutionPolicy Bypass -File "$sync_script" -Commit
elif command -v powershell.exe >/dev/null 2>&1; then
  powershell.exe -NoProfile -NonInteractive -ExecutionPolicy Bypass -File "$sync_script" -Commit
else
  echo "SharedCode synchronization requires pwsh or powershell.exe." >&2
  exit 1
fi
