#!/usr/bin/env bash # Bash shim for Codex: Codex runs hook commands through a login shell, so this # wrapper makes the TypeScript hook executable via bun. ${CODEX_HOME}/hooks.json # references it through the Codex runtime root (${CODEX_HOME}/skills/gstack, # whose hosts/codex/hooks links here), so pwd -P finds the checkout. # # FAIL-OPEN: every failure path — bun missing, script crash — still exits 0. GSTACK_BUN_CONFIG=/dev/null; case "${OSTYPE:-}" in msys*|cygwin*) if command -v cygpath >/dev/null 2>&1; then GSTACK_BUN_CONFIG=NUL; fi ;; esac HERE="$(cd "$(dirname "$0")" && pwd -P)" || exit 0 GSTACK_HOOK_HOST=codex bun --no-env-file --config="${GSTACK_BUN_CONFIG:-/dev/null}" "$HERE/codex-destructive-guard-hook.ts" || true exit 0