feat: respect CLAUDE_CONFIG_DIR and CODEX_HOME env vars#83
Open
shellRaining wants to merge 1 commit into
Open
Conversation
Previously all configuration paths were hardcoded to ~/.claude and ~/.codex. Users who set CLAUDE_CONFIG_DIR (e.g. to ~/.config/claude) or CODEX_HOME (e.g. to ~/.config/codex) would find hooks, settings, and session files written to the wrong location. Introduce ConfigPaths as a single source of truth that checks the environment variables first and falls back to the default paths.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ConfigPathsas a single source of truth for discovering Claude Code and Codex configuration directoriesCLAUDE_CONFIG_DIRenvironment variable (falls back to~/.claude)CODEX_HOMEenvironment variable (falls back to~/.codex)~/.claude/...and~/.codex/...paths across 14 files with centralizedConfigPathslookupsProblem
Users who customise their configuration location via environment variables (e.g.
CLAUDE_CONFIG_DIR=~/.config/claudeorCODEX_HOME=~/.config/codex) find that MioIsland writes hooks, settings, and session files to the default~/.claude/~/.codexdirectories instead of the configured locations, making the app unusable for these setups.These are officially supported environment variables:
CLAUDE_CONFIG_DIR— "Override the configuration directory (default:~/.claude)"CODEX_HOME— custom config directoryChanges
New file
ClaudeIsland/Core/ConfigPaths.swift— centralises path discovery with convenience accessors for hooks, settings, projects, sessions, log file, etc.Modified files (14)
HookInstaller.swift— useConfigPaths.claudeSettings,ConfigPaths.hookScript, etc.CodexHookInstaller.swift— useConfigPaths.codexDir,ConfigPaths.hookScript, etc.HookHealthCheck.swift— useConfigPaths.claudeDir/ConfigPaths.codexDiras defaultsDebugLogger.swift/LogStreamer.swift— useConfigPaths.claudeLogFileBuddyReader.swift— useConfigPaths.claudeBuddyFile,ConfigPaths.claudeSaltCache,ConfigPaths.claudeBonesCacheAgentFileWatcher.swift/JSONLInterruptWatcher.swift/ConversationParser.swift— useConfigPaths.claudeProjectsDirSessionState.swift— useConfigPaths.claudeProjectsDirTerminalWriter.swift— useConfigPaths.claudeSessionsDirCapabilityScanner.swift— useConfigPaths.claudeDir,ConfigPaths.claudeBuddyFileCodexUsage.swift— useConfigPaths.codexDirHookDiagnosticsView.swift— useConfigPaths.claudeHooksDir,ConfigPaths.claudeSettingsHook command change
The hook command written to
settings.jsonnow uses the absolute path (viaConfigPaths.hookScript.path) instead of the shell-tilde shortcut~/.claude/hooks/codeisland-state.py. This correctly resolves to the custom directory whenCLAUDE_CONFIG_DIRis set.Test plan
~/.claudeconfigCLAUDE_CONFIG_DIR=~/.config/claudeand verify hooks are installed to the custom locationCODEX_HOME=~/.config/codexand verify Codex hooks are installed to the custom location