#!/bin/bash
set -euo pipefail

COMMAND="$*"

echo ""
echo "═══════════════════════════════════════════════════════"
echo "  OPERATOR APPROVAL REQUESTED"
echo "═══════════════════════════════════════════════════════"
echo "  Command: $COMMAND"
echo ""

# Check if stdin is interactive (tty)
if [ -t 0 ]; then
    read -p "  Type 'approve' to execute: " RESPONSE
    echo ""
    if [ "$RESPONSE" = "approve" ]; then
        # Execute the command directly
        exec "$@"
    else
        echo "  Operation cancelled."
        exit 1
    fi
else
    echo "  ERROR: This operation requires interactive approval."
    echo "  A human operator must run this command in a terminal."
    echo ""
    exit 1
fi
