Files
gstack/hosts/codex/hooks/codex-destructive-guard-hook
T
Garry Tanandcapy-ai[bot] 944b41e24d Codex gets gstack's skill routing hint and destructive-command check (GST-3172) (#4512)
`./setup --host codex` now adds gstack's skill-routing hint and
destructive-command check to Codex's `~/.codex/hooks.json`, next to your
own hooks, so Codex users get the same guardrails Claude Code users
have.

Codex runs a hook only after you trust it, so nothing fires until you
accept gstack's hooks at Codex's startup prompt or in `/hooks`;
`gstack-doctor` shows whether you have.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Review-Finding: p1/red-team#1 reader=red-team
2026-11-19 11:09:11 +00:00

12 lines
743 B
Bash
Executable File

#!/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