fix(settings-hook): respect CLAUDE_CONFIG_DIR when resolving settings.json#2239
Open
andrefogelman wants to merge 1 commit into
Open
Conversation
….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>
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
Author
|
please merge |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Claude Code supports alternate profile directories via the
CLAUDE_CONFIG_DIRenvironment variable, butbin/gstack-settings-hookhardcodes$HOME/.claude/settings.jsonas its default target.On machines where sessions run with
CLAUDE_CONFIG_DIRset (e.g. isolated agent profiles like~/.claude-agentos), hooks registered by./setup --plan-tune-hooksland in the wrong profile'ssettings.jsonand never execute in the active session.Fix
One line — fall back to
CLAUDE_CONFIG_DIRbefore$HOME/.claude:SETTINGS_FILE="${GSTACK_SETTINGS_FILE:-${CLAUDE_CONFIG_DIR:-$HOME/.claude}/settings.json}"CLAUDE_CONFIG_DIRis unset (default~/.claude).GSTACK_SETTINGS_FILEoverride still takes precedence.Tested
On a machine with two profiles (
~/.claudeand~/.claude-agentos):CLAUDE_CONFIG_DIR=~/.claude-agentos gstack-settings-hook list-sources→ reads/writes the agentos profile (3 registered hooks listed).env -u CLAUDE_CONFIG_DIR gstack-settings-hook list-sources→ falls back to~/.claude/settings.json("no gstack-tagged hooks").add-event/remove-sourceround-trip verified against the profile selected by the env var.🤖 Generated with Claude Code