mirror of
https://github.com/trailofbits/claude-code-devcontainer
synced 2026-06-21 14:11:48 +00:00
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>
This commit is contained in:
+6
-2
@@ -35,7 +35,11 @@ def setup_onboarding_bypass():
|
||||
)
|
||||
return
|
||||
|
||||
claude_json = Path.home() / ".claude.json"
|
||||
# When `CLAUDE_CONFIG_DIR` is set, as is done in `devcontainer.json`, `claude` unexpectedly
|
||||
# looks for `.claude.json` in *that* folder, instead of in `~`, contradicting the documentation.
|
||||
# See https://github.com/anthropics/claude-code/issues/3833#issuecomment-3694918874
|
||||
claude_json_dir = Path(os.environ.get("CLAUDE_CONFIG_DIR", Path.home()))
|
||||
claude_json = claude_json_dir / ".claude.json"
|
||||
|
||||
print("[post_install] Running claude -p to populate auth state...", file=sys.stderr)
|
||||
try:
|
||||
@@ -92,7 +96,7 @@ def setup_onboarding_bypass():
|
||||
|
||||
def setup_claude_settings():
|
||||
"""Configure Claude Code with bypassPermissions enabled."""
|
||||
claude_dir = Path.home() / ".claude"
|
||||
claude_dir = Path(os.environ.get("CLAUDE_CONFIG_DIR", Path.home() / ".claude"))
|
||||
claude_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
settings_file = claude_dir / "settings.json"
|
||||
|
||||
Reference in New Issue
Block a user