phase-publication-hook
16 lines · autoplan/bin/phase-publication-hook at 3f79d81
1#!/usr/bin/env bash
2# Native Read barrier. A broken install must return deny JSON, never silence.
3set -euo pipefail
4GSTACK_BUN_CONFIG=/dev/null; case "${OSTYPE:-}" in msys*|cygwin*) if command -v cygpath >/dev/null 2>&1; then GSTACK_BUN_CONFIG=NUL; fi ;; esac
5_AUTOPLAN_DECIDED=''
6_autoplan_backstop() {
7 if [ -z "$_AUTOPLAN_DECIDED" ]; then
8 printf '%s\n' '{"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecision":"deny","permissionDecisionReason":"[autoplan] Publication hook unavailable. Restore the gstack installation and retry."}}'
9 fi
10}
11trap _autoplan_backstop EXIT
12_AUTOPLAN_HOOK_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
13_AUTOPLAN_RESULT="$(bun --no-env-file --config="${GSTACK_BUN_CONFIG:-/dev/null}" "$_AUTOPLAN_HOOK_DIR/phase-publication-hook.ts")"
14test -n "$_AUTOPLAN_RESULT"
15printf '%s\n' "$_AUTOPLAN_RESULT"
16_AUTOPLAN_DECIDED=1