Skip to content

Commit ab1d7e6

Browse files
deargleDarkaMaul
andauthored
fix search path for .claude.json to account for CLAUDE_CONFIG_DIR (#40)
* fix search path for .claude.json to account for CLAUDE_CONFIG_DIR When `CLAUDE_CONFIG_DIR` is set, as is done in `devcontainer.json`, `claude` looks for `.claude.json` in that folder; otherwise, `~` is used. Learned through observation, not claude documentation :old-man-yells-at-cloud: * add more words to the lookup behavior description * Apply suggestion from @DarkaMaul --------- Co-authored-by: dm <darkamaul@hotmail.fr>
1 parent 40ca54d commit ab1d7e6

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

post_install.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@ def setup_onboarding_bypass():
3535
)
3636
return
3737

38-
claude_json = Path.home() / ".claude.json"
38+
# When `CLAUDE_CONFIG_DIR` is set, as is done in `devcontainer.json`, `claude` unexpectedly
39+
# looks for `.claude.json` in *that* folder, instead of in `~`, contradicting the documentation.
40+
# See https://github.com/anthropics/claude-code/issues/3833#issuecomment-3694918874
41+
claude_json_dir = Path(os.environ.get("CLAUDE_CONFIG_DIR", Path.home()))
42+
claude_json = claude_json_dir / ".claude.json"
3943

4044
print("[post_install] Running claude -p to populate auth state...", file=sys.stderr)
4145
try:
@@ -92,7 +96,7 @@ def setup_onboarding_bypass():
9296

9397
def setup_claude_settings():
9498
"""Configure Claude Code with bypassPermissions enabled."""
95-
claude_dir = Path.home() / ".claude"
99+
claude_dir = Path(os.environ.get("CLAUDE_CONFIG_DIR", Path.home() / ".claude"))
96100
claude_dir.mkdir(parents=True, exist_ok=True)
97101

98102
settings_file = claude_dir / "settings.json"

0 commit comments

Comments
 (0)