#!/bin/sh
# The gate runs before anything leaves the machine (P0 fase B, audit
# 2026-08-26; completed by the closure plan's F5, 2026-09-17). `npm run gate`
# runs `lint` (prettier --check) first, then `check:gate` (src/ and scripts/
# owe zero type errors), the fast validators, `apps:check` (check + build +
# smoke of apps/base) and the vitest suite last. The browser-dependent
# validators that walk the frozen demo tree (morfo:check, perm:check, smoke,
# layer:check) stay manual — they need a dev server.
#
# Armed by copying it; the two copies stay byte-identical:
#   cp scripts/hooks/pre-push .git/hooks/pre-push
#
# Skipping this hook (--no-verify) is forbidden by CLAUDE.md except when the
# user explicitly asks.
echo "pre-push: running npm run gate (lint, checks, apps, tests)..."
npm run gate || {
	echo "pre-push: gate FAILED — push rejected."
	exit 1
}
