From fa5fbcbd64e6c462553cb7b9e880578c4ea7dfa0 Mon Sep 17 00:00:00 2001 From: vic322 Date: Fri, 10 Jul 2026 10:54:54 +0900 Subject: [PATCH] fix(paths): honor CLAUDE_CONFIG_DIR for Claude live locations Claude Code relocates its credentials and main config into $CLAUDE_CONFIG_DIR when that variable is set (common on WSL and multi-config setups), but toguru hard-coded ~/.claude and ~/.claude.json. As a result `add`/`current` reported no active session even while logged in. Resolve claudeDir() and claudeConfigFile() from CLAUDE_CONFIG_DIR when present, mirroring the existing CODEX_HOME/TOGURU_HOME handling. claudeCredentialsFile() already derives from claudeDir(), so it follows automatically. --- src/core/paths.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/core/paths.ts b/src/core/paths.ts index d1789b3..6c13773 100644 --- a/src/core/paths.ts +++ b/src/core/paths.ts @@ -31,6 +31,10 @@ export function storeFile(): string { /* --- Claude Code (Anthropic) live locations --- */ export function claudeDir(): string { + const override = process.env.CLAUDE_CONFIG_DIR?.trim(); + if (override) { + return path.resolve(override); + } return path.join(os.homedir(), ".claude"); } @@ -39,8 +43,16 @@ export function claudeCredentialsFile(): string { return path.join(claudeDir(), ".credentials.json"); } -/** Claude Code's main config; holds the signed-in account's profile. */ +/** + * Claude Code's main config; holds the signed-in account's profile. + * With `CLAUDE_CONFIG_DIR` set, it lives inside that directory alongside the + * credentials; otherwise it sits at `~/.claude.json`. + */ export function claudeConfigFile(): string { + const override = process.env.CLAUDE_CONFIG_DIR?.trim(); + if (override) { + return path.join(path.resolve(override), ".claude.json"); + } return path.join(os.homedir(), ".claude.json"); }