fix(cc-config): stop pinning CLAUDE_CONFIG_DIR in the bootstrap's plugin installer too

skill-plugins.js carried its own copy of the unconditional pin, with the
same comment claiming it keeps writes where cc-discovery reads. Same rule
as runClaude now: pin only when the operator set CLAUDE_HOME.

Also corrects three comments that described the old behaviour — the
confidently-wrong pair at these two call sites is what let two readers
believe reads and writes were aligned when they were not.
This commit is contained in:
2026-09-09 10:09:24 +07:00
parent c34931c3f5
commit 114823ceef
2 changed files with 15 additions and 11 deletions
+7 -7
View File
@@ -17,8 +17,10 @@
* per argument kind.
* - Mutating calls are serialized in-process; two dashboard clicks must not
* interleave writes to the same manifest.
* - `CLAUDE_CONFIG_DIR` is pinned to the same CLAUDE_HOME the dashboard
* reads, so the CLI writes where `cc-discovery` looks.
* - `CLAUDE_CONFIG_DIR` is pinned ONLY when the operator set `CLAUDE_HOME`.
* Left unset it stays unset, because the CLI's own defaults already write
* where `cc-discovery` looks — pinning it unconditionally is what once
* made every MCP add/remove write a file nothing reads.
*
* @author Nguyễn Ngọc Trí Vĩ <vinnt@smartgift.vn>
*/
@@ -138,11 +140,9 @@ function runClaude(args, opts = {}) {
// function's own comment). Pinning CLAUDE_CONFIG_DIR unconditionally to
// getClaudeHome() made the CLI write `~/.claude/.claude.json` instead —
// a file nothing reads — so every default-install add/remove was inert.
// When CLAUDE_HOME IS set, this still pins it, but note the residual:
// cc-discovery's read stays pinned to $HOME/.claude.json regardless (see
// getClaudeJsonPath's comment) while the CLI then writes
// <CLAUDE_HOME>/.claude.json — a pre-existing split this task does not
// attempt to fix, since no install in this repo runs with CLAUDE_HOME set.
// When CLAUDE_HOME IS set, this pins it and the CLI writes
// <CLAUDE_HOME>/.claude.json — which is what getClaudeJsonPath() reads in
// that branch, so both cases line up. Keep the two in step.
const env = { ...process.env };
if (process.env.CLAUDE_HOME) env.CLAUDE_CONFIG_DIR = getClaudeHome();
const child = execFile(