opencode icon indicating copy to clipboard operation
opencode copied to clipboard

feat: support CLAUDE_CONFIG_DIR environment variable

Open ramarivera opened this issue 2 weeks ago • 2 comments

Summary

  • Adds support for CLAUDE_CONFIG_DIR environment variable
  • Falls back to ~/.config/claude (new Claude Code default) then ~/.claude (legacy)
  • Fixes ENOTDIR error when ~/.claude is a file instead of directory

Fixes #6551

Changes

  • Added CLAUDE_CONFIG_DIR to Flag namespace
  • Added Global.claudeConfigDir() function with proper fallback logic
  • Updated system.ts to use dynamic path for CLAUDE.md
  • Updated skill.ts to use dynamic path for skills directory
  • Added unit tests for the new logic

Testing

  • Added unit tests covering all fallback scenarios (8 tests, all passing)
  • Manually tested with CLAUDE_CONFIG_DIR set to custom path

ramarivera avatar Dec 31 '25 22:12 ramarivera