Skip to content

fix(cli): honor CLAUDE_CONFIG_DIR for global Claude settings path#1

Closed
punk-dev-robot wants to merge 1 commit into
mainfrom
fix/respect-claude-config-dir
Closed

fix(cli): honor CLAUDE_CONFIG_DIR for global Claude settings path#1
punk-dev-robot wants to merge 1 commit into
mainfrom
fix/respect-claude-config-dir

Conversation

@punk-dev-robot
Copy link
Copy Markdown
Owner

Problem

cupcake init --global --harness claude always wrote hooks to ~/.claude/settings.json, ignoring Claude Code's CLAUDE_CONFIG_DIR environment variable. Users who relocate their Claude config via CLAUDE_CONFIG_DIR got the integration installed in the wrong place.

Fix

ClaudeHarness::settings_path (global branch) now resolves CLAUDE_CONFIG_DIR first and falls back to ~/.claude when the var is unset or empty. The project-level (.claude/settings.json) path is unchanged.

std::env::var_os("CLAUDE_CONFIG_DIR")
    .filter(|dir| !dir.is_empty())
    .map(PathBuf::from)
    .unwrap_or_else(|| dirs::home_dir()...join(".claude"))
    .join("settings.json")

Scope

Repo-wide search confirmed settings_path is the only production code that constructed ~/.claude; CLAUDE_CONFIG_DIR was referenced nowhere before this change.

Tests

Added test_claude_global_settings_path_respects_config_dir covering the override, the unset fallback, and that the non-global path is unaffected. cargo test -p cupcake-cli harness_config → 4 passed.

ClaudeHarness::settings_path hardcoded ~/.claude for global init,
ignoring Claude Code's CLAUDE_CONFIG_DIR config-relocation env var.
Now resolve CLAUDE_CONFIG_DIR first, falling back to ~/.claude when
unset or empty. Project-level path is unchanged.

Adds a unit test covering the override, the fallback, and that the
non-global path is unaffected.
@punk-dev-robot
Copy link
Copy Markdown
Owner Author

Wrong target — recreated against upstream eqtylab/cupcake as eqtylab#112.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant