Skip to content

claude: honor $CLAUDE_CONFIG_DIR for the settings file location - #343

Open
eabrouwer3 wants to merge 1 commit into
databricks:mainfrom
eabrouwer3:claude/issue-342-fix-l8l7mf
Open

claude: honor $CLAUDE_CONFIG_DIR for the settings file location#343
eabrouwer3 wants to merge 1 commit into
databricks:mainfrom
eabrouwer3:claude/issue-342-fix-l8l7mf

Conversation

@eabrouwer3

@eabrouwer3 eabrouwer3 commented Aug 14, 2026

Copy link
Copy Markdown

Claude Code reads its user config from $CLAUDE_CONFIG_DIR when set, but ucode hardcoded ~/.claude. Users who keep separate personal and work config dirs got a ucode-settings.json written somewhere the launched claude never reads.

Add a claude_config_dir() helper that resolves the env var with a fallback to ~/.claude, so existing setups are unchanged.

Fixes #342

Claude Code reads its user config from $CLAUDE_CONFIG_DIR when set, but
ucode hardcoded ~/.claude. Users who keep separate personal and work
config dirs got a ucode-settings.json written somewhere the launched
`claude` never reads.

Add a claude_config_dir() helper that resolves the env var with a
fallback to ~/.claude, so existing setups are unchanged.

Fixes databricks#342

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012fpivLSjbQ9QJMgfebeJoy
Copilot AI lite review requested due to automatic review settings August 14, 2026 22:42

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the Claude Code agent integration so ucode writes/reads its Claude settings file from the same config directory Claude Code uses: $CLAUDE_CONFIG_DIR when set, otherwise ~/.claude. This resolves cases where users switch between multiple Claude config directories and ucode previously wrote ucode-settings.json into the wrong location.

Changes:

  • Add a claude_config_dir() helper to resolve $CLAUDE_CONFIG_DIR with a ~/.claude fallback (including tilde expansion and blank-var fallback).
  • Update the Claude agent to compute its settings path from claude_config_dir().
  • Add unit tests covering default behavior, env-var overrides, tilde expansion, and blank env-var fallback.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/ucode/config_io.py Adds claude_config_dir() helper for resolving the Claude Code config directory from environment with backward-compatible fallback.
src/ucode/agents/claude.py Switches Claude settings directory to be derived from claude_config_dir() instead of a hardcoded ~/.claude.
tests/test_config_io.py Adds focused tests validating claude_config_dir() behavior across env/default cases.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

from ucode.ui import print_err, print_note, print_success, print_warning

CLAUDE_CONFIG_DIR = Path.home() / ".claude"
CLAUDE_CONFIG_DIR = claude_config_dir()
Comment thread src/ucode/config_io.py
Comment on lines +27 to +30
def claude_config_dir() -> Path:
"""Claude Code's user config directory: ``$CLAUDE_CONFIG_DIR`` or ``~/.claude``."""
override = os.environ.get("CLAUDE_CONFIG_DIR", "").strip()
return Path(override).expanduser() if override else Path.home() / ".claude"
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.

Support Custom $CLAUDE_CONFIG_DIR

3 participants