#!/usr/bin/env bash # Optional pre-push: warn if GISHEN-MASTER-SPEC may be stale. # Soft-fail by default. Set GISHEN_MASTER_SPEC_STRICT=1 to block push. set -euo pipefail ROOT="$(git rev-parse --show-toplevel 2>/dev/null || pwd)" SCRIPT="$ROOT/scripts/sync-master-spec-reminder.sh" echo "" echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" echo " Gishen: master spec check (pre-push)" echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" if [[ ! -x "$SCRIPT" && -f "$SCRIPT" ]]; then chmod +x "$SCRIPT" || true fi if [[ -f "$SCRIPT" ]]; then # Soft warn unless STRICT already set by user bash "$SCRIPT" || { status=$? if [[ "${GISHEN_MASTER_SPEC_STRICT:-0}" == "1" ]]; then echo "Push blocked: refresh docs/GISHEN-MASTER-SPEC.md then retry." exit "$status" fi echo "Continuing push (soft warn). Re-run with GISHEN_MASTER_SPEC_STRICT=1 to enforce." } else echo "WARN: missing $SCRIPT — update docs/GISHEN-MASTER-SPEC.md before push." fi echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" echo "" exit 0