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

Claude Code supports alternate profile directories via the
CLAUDE_CONFIG_DIR environment variable, but gstack-settings-hook
hardcoded $HOME/.claude/settings.json as its default target. On
machines where sessions run with CLAUDE_CONFIG_DIR set (e.g. isolated
agent profiles), hooks registered by setup --plan-tune-hooks landed in
the wrong profile's settings.json and never executed.

Fall back to CLAUDE_CONFIG_DIR before $HOME/.claude. Behavior is
unchanged when the variable is unset, and the explicit
GSTACK_SETTINGS_FILE override still takes precedence.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
andrefogelman 2026-07-11 11:14:44 +00:00
parent 7c9df1c568
commit 9394efc865
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