#!/bin/sh
# pre-push：推送前校验桌面仓 plugins/ 与插件源仓一致（v3.26.109）
# 由 scripts/install-git-hooks.sh 安装；源仓不存在时 check 脚本会自行跳过。
root=$(git rev-parse --show-toplevel)
if ! node "$root/scripts/check-plugins-sync.js"; then
  echo ''
  echo '[pre-push] 插件两仓不一致，已阻止推送。'
  echo '[pre-push] 正确做法：在 iwb-plugins-desktop 改源码 → 桌面仓 node scripts/sync-plugins-from-repo.js'
  echo '[pre-push] 说明：docs/standards/plugin-source-of-truth.md'
  exit 1
fi
exit 0
