Skip to content

Quote ${CLAUDE_PLUGIN_ROOT} so hooks work on paths with spaces#171

Merged
JuliusBrussee merged 1 commit intoJuliusBrussee:mainfrom
MukundaKatta:fix/quote-plugin-root-paths-with-spaces
Apr 15, 2026
Merged

Quote ${CLAUDE_PLUGIN_ROOT} so hooks work on paths with spaces#171
JuliusBrussee merged 1 commit intoJuliusBrussee:mainfrom
MukundaKatta:fix/quote-plugin-root-paths-with-spaces

Conversation

@MukundaKatta
Copy link
Copy Markdown
Contributor

Summary

  • Fixes Hook commands break on paths with spaces #157 — both hook commands in .claude-plugin/plugin.json passed ${CLAUDE_PLUGIN_ROOT} unquoted to the shell. On any system where the plugin root contains a space (e.g. /Users/Tyler Laprade/... on macOS), the shell split the expansion on whitespace and Node received a truncated path:

    Error: Cannot find module '/Users/Tyler'
    

    Both SessionStart and UserPromptSubmit hooks errored on every session start and every prompt submit, effectively disabling the plugin for those users.

  • Wrapping ${CLAUDE_PLUGIN_ROOT} in double quotes preserves the full path on any POSIX-style shell and is a no-op on paths without spaces.

Changes

  • .claude-plugin/plugin.json — quoted ${CLAUDE_PLUGIN_ROOT} in the caveman-activate.js and caveman-mode-tracker.js hook command strings.

Test plan

  • Verify diff is minimal (only the two hook command strings changed).
  • Reproduce bug: mkdir "/tmp/plugin root with space", copy the plugin in, run a hook → pre-fix errors with Cannot find module '/tmp/plugin', post-fix loads correctly.
  • Confirm hooks still work on plugin roots without spaces (unchanged behavior).

Both SessionStart and UserPromptSubmit hook commands passed
${CLAUDE_PLUGIN_ROOT} unquoted, so the shell split the expansion
on whitespace whenever a user's plugin root contained a space
(e.g. /Users/Tyler Laprade/...). Node received a truncated path
and errored with "Cannot find module '/Users/Tyler'", preventing
the plugin from loading.

Wrapping the variable in double quotes keeps the path intact on
any POSIX-style shell and has no effect on paths without spaces.

Fixes JuliusBrussee#157
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.

Hook commands break on paths with spaces

2 participants