Honor CLAUDE_CONFIG_DIR in get_claude_config_path - #4
Open
jesseclark wants to merge 2 commits into
Open
Conversation
Users who run multiple Claude accounts via non-standard config directories (set with CLAUDE_CONFIG_DIR) can't add their second account because get_claude_config_path always reads ~/.claude.json or ~/.claude/.claude.json, regardless of which account is active. With this change, if CLAUDE_CONFIG_DIR is set, CCM reads $CLAUDE_CONFIG_DIR/.claude.json first. This lets users prepend the env var to any ccm command to target the right account: CLAUDE_CONFIG_DIR=~/.claude-work ccm add CLAUDE_CONFIG_DIR=~/.claude-home ccm add Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds five tests covering: - CLAUDE_CONFIG_DIR respected when .claude.json exists - CLAUDE_CONFIG_DIR falls through when .claude.json is absent - Original primary (~/.claude/.claude.json) and fallback (~/.claude.json) paths Wires up a GitHub Actions matrix (ubuntu-latest, macos-latest) and a `npm test` script so the suite runs automatically on every PR. Co-Authored-By: Claude Sonnet 4.6 <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.
Closes #3
Problem
Users who manage multiple Claude accounts via non-standard config directories (pointed to by the
CLAUDE_CONFIG_DIRenvironment variable) cannot add their second account withccm add. The command always reports the account as "already being managed" becauseget_claude_config_pathignoresCLAUDE_CONFIG_DIRand always reads from~/.claude/.claude.jsonor~/.claude.json.Example setup that breaks today:
With two separate config dirs —
~/.claude-home(personal account) and~/.claude-work(work account) —ccm addalways reads~/.claude.json, which contains only one of the accounts, so the second account can never be added.Fix
Check
CLAUDE_CONFIG_DIRfirst inget_claude_config_path. If the env var is set and the corresponding.claude.jsonexists, use it. Otherwise fall through to the existing primary/fallback logic unchanged.Usage with this fix:
All other
ccmcommands (use,switch,status, etc.) also benefit automatically — they will read/write the correct config whenCLAUDE_CONFIG_DIRis set.Changes
ccm.sh— addCLAUDE_CONFIG_DIRcheck at the top ofget_claude_config_path; no other logic changedtests/get_claude_config_path.bats— five bats tests covering the new path and the original primary/fallback behaviour.github/workflows/test.yml— CI matrix running bats on ubuntu-latest and macos-latest for every push/PRpackage.json— adds"test": "bats tests/"script