fix(settings-hook): respect CLAUDE_CONFIG_DIR when resolving settings.json

gstack-settings-hook hardcoded $HOME/.claude/settings.json, so users running
Claude Code with a relocated CLAUDE_CONFIG_DIR had hooks written to a config
file Claude never reads. Resolve ${CLAUDE_CONFIG_DIR:-$HOME/.claude} first;
the explicit GSTACK_SETTINGS_FILE override still wins.

Partial #349.

Contributed by @andrefogelman (PR #2239).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Garry Tan 2026-08-14 19:26:33 -07:00
parent dcdd28ce34
commit 0572125a5b
No known key found for this signature in database
GPG Key ID: C1F69E85C74EFE1D
1 changed files with 1 additions and 1 deletions

View File

@ -26,7 +26,7 @@
set -euo pipefail
ACTION="${1:-}"
SETTINGS_FILE="${GSTACK_SETTINGS_FILE:-$HOME/.claude/settings.json}"
SETTINGS_FILE="${GSTACK_SETTINGS_FILE:-${CLAUDE_CONFIG_DIR:-$HOME/.claude}/settings.json}"
if [ -z "$ACTION" ]; then
cat <<EOF >&2