Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/utils/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ export const getGlobalClaudeFile = memoize((): string => {
}

const filename = `.claude${fileSuffixForOauthConfig()}.json`
return join(process.env.CLAUDE_CONFIG_DIR || homedir(), filename)
return join(
process.env.CLAUDE_CONFIG_DIR || getClaudeConfigHomeDir(),
filename,
)
Comment on lines +25 to +28

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Use getClaudeConfigHomeDir() as the sole directory resolver.

When CLAUDE_CONFIG_DIR is set to an empty string, getClaudeConfigHomeDir() returns "" because it uses ??. The || expression therefore still yields "", and join("", filename) resolves to the current working directory instead of ~/.claude/. This can split or misplace the global configuration. Use the helper directly.

Proposed fix
   return join(
-    process.env.CLAUDE_CONFIG_DIR || getClaudeConfigHomeDir(),
+    getClaudeConfigHomeDir(),
     filename,
   )
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/utils/env.ts` around lines 25 - 28, Update the directory argument in the
configuration path construction to use getClaudeConfigHomeDir() directly,
removing the process.env.CLAUDE_CONFIG_DIR || fallback expression. Preserve
joining the resolved directory with filename so empty environment values follow
the helper’s home-directory behavior.

})

const hasInternetAccess = memoize(async (): Promise<boolean> => {
Expand Down