fix(cc-config): stop pinning CLAUDE_CONFIG_DIR when CLAUDE_HOME is unset
runClaude() unconditionally set CLAUDE_CONFIG_DIR to getClaudeHome() (~/.claude), so the CLI wrote ~/.claude/.claude.json — a file cc-discovery.getClaudeJsonPath() never reads (it reads ~/.claude.json, beside ~/.claude/, by design). Every default-install MCP add/remove and plugin/marketplace mutation was inert: add toasted success and vanished on refetch, remove 422'd for every server the panel lists. With CLAUDE_HOME unset (the default), leave CLAUDE_CONFIG_DIR unset too — the CLI's own default config dir already lines up with what cc-discovery reads, so alignment comes from doing nothing. Only pin it when the operator explicitly set CLAUDE_HOME, which is the one case the pin is meant for. Left a residual, documented at both sites: with CLAUDE_HOME set, reads still come from $HOME/.claude.json while the CLI writes <CLAUDE_HOME>/.claude.json — a split predating this task, affecting a configuration nobody here runs. New tests pin the env contract directly (no real CLI needed): runClaude must not set CLAUDE_CONFIG_DIR when CLAUDE_HOME is absent, and must set it to CLAUDE_HOME's value when present.
This commit is contained in:
@@ -31,6 +31,13 @@ function getProjectClaudeDir(cwd) {
|
||||
function getClaudeJsonPath() {
|
||||
// ~/.claude.json sits beside ~/.claude/, NOT inside it. Resolve from $HOME
|
||||
// so a CLAUDE_HOME override doesn't accidentally relocate it.
|
||||
//
|
||||
// Paired with cc-plugin-cli.js's runClaude(): with CLAUDE_HOME unset (the
|
||||
// default), it deliberately leaves CLAUDE_CONFIG_DIR unset too, so the CLI
|
||||
// writes here (its own default). With CLAUDE_HOME set, this read stays
|
||||
// pinned to $HOME/.claude.json while the CLI writes
|
||||
// <CLAUDE_HOME>/.claude.json — a known, unfixed split for that case; see
|
||||
// runClaude's comment.
|
||||
return path.join(os.homedir(), ".claude.json");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user