Skip to content

Quote ${CLAUDE_PLUGIN_ROOT} in hook commands (fixes hooks on paths with spaces)#62

Open
Seph396 wants to merge 1 commit into
plastic-labs:mainfrom
Seph396:fix/quote-claude-plugin-root
Open

Quote ${CLAUDE_PLUGIN_ROOT} in hook commands (fixes hooks on paths with spaces)#62
Seph396 wants to merge 1 commit into
plastic-labs:mainfrom
Seph396:fix/quote-claude-plugin-root

Conversation

@Seph396

@Seph396 Seph396 commented Jun 9, 2026

Copy link
Copy Markdown

Fixes #61.

The bun run hook commands in plugins/honcho/hooks/hooks.json reference ${CLAUDE_PLUGIN_ROOT} unquoted, so the shell word-splits the path when it contains a space. On macOS the default Claude Desktop plugin location is under ~/Library/Application Support/Claude/… (note the space), so the hooks silently fail to fire for that install class — no Honcho capture, often a confusing/empty error.

This wraps ${CLAUDE_PLUGIN_ROOT} in double quotes on all 8 commands, matching the check-version.sh command which was already quoted. No behavior change for space-free paths.

- "command": "bun run ${CLAUDE_PLUGIN_ROOT}/hooks/session-start.ts"
+ "command": "bun run \"${CLAUDE_PLUGIN_ROOT}/hooks/session-start.ts\""

JSON validated after the change.

Summary by CodeRabbit

  • Bug Fixes
    • Fixed hook command execution by properly formatting script paths in configuration to ensure reliable invocation across multiple hooks (SessionStart, SessionEnd, PostToolUse, PreToolUse, UserPromptSubmit, PreCompact, and Stop).

The bun-run hook commands in plugins/honcho/hooks/hooks.json use an
unquoted ${CLAUDE_PLUGIN_ROOT}, so they break when the plugin root path
contains a space — which is the default macOS Claude Desktop location
(~/Library/Application Support/Claude/...). Wrap the path in double
quotes on all 8 commands, matching the already-quoted check-version line.

Fixes plastic-labs#61

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 9, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3e46b545-2ca3-466d-b324-eb17411fad7f

📥 Commits

Reviewing files that changed from the base of the PR and between 15d07cd and 50aa8fd.

📒 Files selected for processing (1)
  • plugins/honcho/hooks/hooks.json

Walkthrough

This pull request fixes hook execution failures on systems where the plugin root path contains spaces. All eight hook definitions in plugins/honcho/hooks/hooks.json now wrap the ${CLAUDE_PLUGIN_ROOT} variable in double quotes when passing it to bun run, matching the quoting already applied to the version-check script.

Changes

Hook path quoting for space-safe shell invocation

Layer / File(s) Summary
Quote hook script paths in bun run commands
plugins/honcho/hooks/hooks.json
All eight hook command definitions (SessionStart, SessionEnd, PostToolUse, PreToolUse, UserPromptSubmit, PreCompact auto and manual matchers, and Stop) now invoke bun run with quoted ${CLAUDE_PLUGIN_ROOT} paths to handle installation directories containing spaces.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A space in the path, oh what a plight!
Quotes wrap the variable, making it right,
Eight hooks now safe from the shell's split and shatter,
With quoted roots, every plugin will chatter! 🌟

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: quoting ${CLAUDE_PLUGIN_ROOT} in hook commands to fix issues with paths containing spaces.
Linked Issues check ✅ Passed The PR directly addresses issue #61 by quoting ${CLAUDE_PLUGIN_ROOT} in all eight bun run hook commands in hooks.json, matching the linked issue requirements.
Out of Scope Changes check ✅ Passed All changes are scoped to the linked issue #61; only hook command definitions in hooks.json were modified with no extraneous changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

Hooks fail when plugin path contains a space — unquoted ${CLAUDE_PLUGIN_ROOT} in hooks.json

1 participant