installer: honor CLAUDE_CONFIG_DIR for global Claude Code installs#1029
Open
borfast wants to merge 1 commit into
Open
installer: honor CLAUDE_CONFIG_DIR for global Claude Code installs#1029borfast wants to merge 1 commit into
borfast wants to merge 1 commit into
Conversation
The Claude Code target hardcoded `~/.claude` and `~/.claude.json`, so `codegraph install --location global` always wrote to the default profile even when the user runs Claude Code against a custom profile via the `CLAUDE_CONFIG_DIR` env var (e.g. `~/.claude-gc`). The MCP server, permissions, and instructions all landed in a profile Claude Code never reads, so codegraph silently never loaded. Resolve the global config dir from `CLAUDE_CONFIG_DIR` when set, falling back to `~/.claude`. The `.claude.json` MCP file follows Claude Code's own rule: it lives *inside* the profile dir when `CLAUDE_CONFIG_DIR` is set, but beside `~/.claude` (in `$HOME`) for the default profile. Project-local installs are unaffected. Also clear `CLAUDE_CONFIG_DIR` in the installer-targets test harness so a custom profile in the real environment can't leak into tests that assume the default profile, and add a test covering the new behavior. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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
The Claude Code installer target hardcodes
~/.claudeand~/.claude.json, socodegraph install --location globalalways writes to the default profile — even when the user runs Claude Code against a custom profile via theCLAUDE_CONFIG_DIRenv var (e.g.~/.claude-gc).The result: the MCP server entry, permissions, and
CLAUDE.mdinstructions all land in a directory Claude Code never reads, so codegraph silently never loads for users on a non-default profile.Fix
Resolve the global config dir from
CLAUDE_CONFIG_DIRwhen set, falling back to~/.claude. The.claude.jsonMCP file follows Claude Code's own placement rule:~/.claude.json(in$HOME, beside~/.claude)CLAUDE_CONFIG_DIRset →$CLAUDE_CONFIG_DIR/.claude.json(inside the profile dir)settings.jsonandCLAUDE.mdmove with the profile dir. Project-local installs are unaffected.Tests
CLAUDE_CONFIG_DIRset, a global install writes.claude.json,settings.json, andCLAUDE.mdinto the custom profile and leaves~/.claudeuntouched. Verified it fails onmainand passes with this change.installer-targetsharness to clearCLAUDE_CONFIG_DIRinsetHome, so a custom profile in the real environment can't leak into the existing default-profile tests.All 152 tests in
installer-targets.test.tspass;tsc --noEmitis clean.🤖 Generated with Claude Code