Skip to content

fix: make Claude hook paths portable#8

Open
0xAndoroid wants to merge 1 commit intoishefi:mainfrom
0xAndoroid:pr/portable-claude-hooks
Open

fix: make Claude hook paths portable#8
0xAndoroid wants to merge 1 commit intoishefi:mainfrom
0xAndoroid:pr/portable-claude-hooks

Conversation

@0xAndoroid
Copy link
Copy Markdown

  1. Makes the path to the hooks use ${HOME} instead of full path to ensure settings can be shared across different machines.
  2. Resolves settings.json symlink, if settings.json is a symlink.

@ishefi
Copy link
Copy Markdown
Owner

ishefi commented May 4, 2026

Both fixes are good calls, dotfile-sync portability and the symlink-clobber bug are real annoyances. Two questions before merge:

  1. Does Claude Code's hook runner actually expand ${HOME} when it spawns the command, or does it pass the string straight through? If it's the latter, the hook will silently fail to fire after this change. A quick echo test on a fresh install would confirm. Worth a line in the README either way so users know the entry is intentionally unexpanded.

  2. readlink -f is GNU-flavored and only landed in macOS 12.3. Probably fine given the project's macOS focus, but a portable alternative (cd "$(dirname "$SETTINGS")" && pwd -P, or python3 -c 'import os,sys;print(os.path.realpath(sys.argv[1]))' "$SETTINGS") would avoid a surprise on older systems.

Otherwise lgtm, this is a clean fix.

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.

2 participants