Skip to content

fix: respect CLAUDE_CONFIG_DIR env var across all hooks#146

Merged
JuliusBrussee merged 1 commit intoJuliusBrussee:mainfrom
BrendanIzu:fix/respect-claude-config-dir
Apr 15, 2026
Merged

fix: respect CLAUDE_CONFIG_DIR env var across all hooks#146
JuliusBrussee merged 1 commit intoJuliusBrussee:mainfrom
BrendanIzu:fix/respect-claude-config-dir

Conversation

@BrendanIzu
Copy link
Copy Markdown
Contributor

@BrendanIzu BrendanIzu commented Apr 14, 2026

Summary

  • All hook files (JS, sh, ps1) hardcoded ~/.claude as the Claude config directory
  • Users who set CLAUDE_CONFIG_DIR (e.g. for XDG compliance) had hooks reading/writing to the wrong location
  • Now every hook checks CLAUDE_CONFIG_DIR first, falling back to ~/.claude

Files changed

  • hooks/caveman-activate.js — use env var + updated comments and statusline nudge path
  • hooks/caveman-mode-tracker.js — use env var for flag file path
  • hooks/caveman-statusline.sh${CLAUDE_CONFIG_DIR:-$HOME/.claude}
  • hooks/caveman-statusline.ps1$env:CLAUDE_CONFIG_DIR with fallback
  • hooks/install.sh / install.ps1 — use env var for install target dir
  • hooks/uninstall.sh / uninstall.ps1 — use env var for uninstall target dir

Test plan

  • Set CLAUDE_CONFIG_DIR to a custom path, run install.sh — hooks install to custom dir
  • Unset CLAUDE_CONFIG_DIR, run install.sh — hooks install to ~/.claude (default behavior unchanged)
  • Start a Claude Code session with CLAUDE_CONFIG_DIR set — flag file written to correct location
  • Statusline badge reads from correct location when env var is set

Closes #140

All hook files hardcoded ~/.claude as the Claude config directory.
Users who set CLAUDE_CONFIG_DIR (e.g. for XDG compliance) had hooks
writing to the wrong location. Now all hooks check CLAUDE_CONFIG_DIR
first, falling back to ~/.claude.

Closes JuliusBrussee#140
@ChrisGVE
Copy link
Copy Markdown

Thanks for this work, this is a key feature to me

@JuliusBrussee JuliusBrussee merged commit 4345efd into JuliusBrussee:main Apr 15, 2026
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.

Respect CLAUDE_CONFIG_DIR

4 participants