#!/usr/bin/env bash
# Copyright 2026 Petri Koistinen. Licensed under the Apache License, Version 2.0.
#
# Mandatory pre-push gate; enabled per clone by Scripts/install-hooks.sh.
# Bypassing it (--no-verify or otherwise) is prohibited for every
# contributor, human or AI agent alike.

set -euo pipefail

# Classify before dependency refresh or any compiler invocation.
if python3 "$(git rev-parse --show-toplevel)/Scripts/DocumentationGate.py" push "${1:-origin}"; then
    exit 0
else
    scope_status=$?
    if [ "$scope_status" -ne 1 ]; then
        exit "$scope_status"
    fi
fi
exec "$(git rev-parse --show-toplevel)/Scripts/verify-push.sh"
