#!/bin/bash # PAX-Coder Protected Execution Gate (ADR-0009) # # Shell wrapper for backward compatibility. # The actual gate logic is in pax_coder_gate.py (native Ed25519, Pydantic). # # This wrapper: # 1. Locates the Python gate # 2. Passes through environment and arguments # 3. Preserves exit codes # # Exit codes (passed through from Python): # 0 = AUTHORIZED (protected execution allowed) # 1 = INTEGRITY_FAILED (release verification failed) # 2 = AUTHORIZATION_DENIED (node not authorized or capability missing/invalid) # 3 = SCRIPT_ERROR (cannot determine status) SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" REPO_ROOT="$(dirname "$SCRIPT_DIR")" # Export repo root for the Python gate export PAX_REPO_ROOT="$REPO_ROOT" # Locate Python gate PYTHON_GATE="$REPO_ROOT/pax_coder_gate.py" if [ ! -f "$PYTHON_GATE" ]; then echo "ERROR: Python gate not found at $PYTHON_GATE" exit 3 fi # Check Python3 is available if ! command -v python3 &> /dev/null; then echo "ERROR: python3 not found in PATH" exit 3 fi # Execute Python gate with all arguments passed through exec python3 "$PYTHON_GATE" "$@"