Skip to content

fix: write .claude.json to ~/.claude/ instead of homedir root - #1336

Open
p2p3p wants to merge 1 commit into
claude-code-best:mainfrom
p2p3p:fix/claude-json-path
Open

fix: write .claude.json to ~/.claude/ instead of homedir root#1336
p2p3p wants to merge 1 commit into
claude-code-best:mainfrom
p2p3p:fix/claude-json-path

Conversation

@p2p3p

@p2p3p p2p3p commented Aug 3, 2026

Copy link
Copy Markdown

将 .claude.json 写入路径从 homedir() 根目录改为 getClaudeConfigHomeDir() 对应的 ~/.claude/ 目录。

Summary by CodeRabbit

  • Bug Fixes
    • Improved configuration file discovery by respecting the configured Claude settings directory.
    • Preserved support for custom configuration directory overrides.

@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

getGlobalClaudeFile now uses getClaudeConfigHomeDir() when CLAUDE_CONFIG_DIR is not set. The override and filename construction remain unchanged.

Changes

Configuration directory resolution

Layer / File(s) Summary
Global Claude file path resolution
src/utils/env.ts
getGlobalClaudeFile retains the CLAUDE_CONFIG_DIR override and uses getClaudeConfigHomeDir() as the fallback directory.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the change to write .claude.json under ~/.claude/.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 1

🤖 Prompt for all review comments with 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.

Inline comments:
In `@src/utils/env.ts`:
- Around line 25-28: Update getClaudeConfigHomeDir in envUtils.ts to treat an
empty CLAUDE_CONFIG_DIR as unset, while preserving its existing
configured-directory behavior; then update the path construction in the shown
utility to use getClaudeConfigHomeDir as the sole source of the base directory.
Add a regression test covering CLAUDE_CONFIG_DIR="" and verify the resulting
path remains under the default Claude configuration directory rather than
becoming relative.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 8958d2b0-d4bd-477e-8b9c-a0330c4e3495

📥 Commits

Reviewing files that changed from the base of the PR and between 2ccc216 and c72b7f5.

📒 Files selected for processing (1)
  • src/utils/env.ts

Comment thread src/utils/env.ts
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