#!/usr/bin/env bash
# Plugin-bundled goc wrapper.
#
# Codex plugins do not currently document automatic PATH-prepending for plugin
# bin directories. This wrapper is still shipped so local/plugin-aware launchers
# can invoke the bundled engine directly without a separate PyPI install.

set -euo pipefail

SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)"
PLUGIN_ROOT="$(dirname -- "$SCRIPT_DIR")"

if command -v python3 > /dev/null 2>&1; then
    PYTHON=python3
elif command -v python > /dev/null 2>&1; then
    PYTHON=python
else
    echo "goc: 'python3' not found on PATH. Install Python 3.10+ from python.org." >&2
    exit 127
fi

exec env PYTHONPATH="${PLUGIN_ROOT}:${PYTHONPATH:-}" "$PYTHON" -m goc.cli "$@"
