fix(hooks): double-quote CLAUDE_PLUGIN_ROOT in hook commands #2

Open
yoshi wants to merge 2 commits from fix/hooks-quoting-claude-plugin-root into main
Owner

Problem

Claude Code meldete bei jedem Tool-Call:

Failed with non-blocking status code: bash: ${CLAUDE_PLUGIN_ROOT}/hooks/post-tool-use.sh: Datei oder Verzeichnis nicht gefunden

Alle drei Hooks (PostToolUse, Stop, SessionStart) waren tot — Auto-Compile, Session-Start usw. liefen nicht.

Ursache

In hooks/hooks.json waren die Pfade mit single quotes umschlossen:

"command": "bash '${CLAUDE_PLUGIN_ROOT}/hooks/post-tool-use.sh'"

Bash expandiert Variablen in single quotes nicht, also wurde der wörtliche String ${CLAUDE_PLUGIN_ROOT}/hooks/post-tool-use.sh an bash übergeben → "Datei nicht gefunden".

Fix

Single quotes → double quotes (escaped), analog zu anderen Plugins wie ralph-loop:

"command": "bash \"${CLAUDE_PLUGIN_ROOT}/hooks/post-tool-use.sh\""

Test

  • JSON validiert (python3 -m json.tool)
  • Cache-Kopie lokal überschrieben, Hook-Fehler verschwindet in laufenden Sessions
## Problem Claude Code meldete bei jedem Tool-Call: ``` Failed with non-blocking status code: bash: ${CLAUDE_PLUGIN_ROOT}/hooks/post-tool-use.sh: Datei oder Verzeichnis nicht gefunden ``` Alle drei Hooks (PostToolUse, Stop, SessionStart) waren tot — Auto-Compile, Session-Start usw. liefen nicht. ## Ursache In `hooks/hooks.json` waren die Pfade mit **single quotes** umschlossen: ```json "command": "bash '${CLAUDE_PLUGIN_ROOT}/hooks/post-tool-use.sh'" ``` Bash expandiert Variablen in single quotes nicht, also wurde der wörtliche String `${CLAUDE_PLUGIN_ROOT}/hooks/post-tool-use.sh` an bash übergeben → "Datei nicht gefunden". ## Fix Single quotes → double quotes (escaped), analog zu anderen Plugins wie `ralph-loop`: ```json "command": "bash \"${CLAUDE_PLUGIN_ROOT}/hooks/post-tool-use.sh\"" ``` ## Test - JSON validiert (`python3 -m json.tool`) - Cache-Kopie lokal überschrieben, Hook-Fehler verschwindet in laufenden Sessions
Single quotes prevented bash from expanding ${CLAUDE_PLUGIN_ROOT}, causing
'Datei oder Verzeichnis nicht gefunden' for all three hooks
(PostToolUse, Stop, SessionStart).
Claude Code rejects the hook output without 'hookEventName' inside
hookSpecificOutput. Also drop the deprecated top-level 'additional_context'
field which is now redundant with hookSpecificOutput.additionalContext.
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin fix/hooks-quoting-claude-plugin-root:fix/hooks-quoting-claude-plugin-root
git switch fix/hooks-quoting-claude-plugin-root

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch main
git merge --no-ff fix/hooks-quoting-claude-plugin-root
git switch fix/hooks-quoting-claude-plugin-root
git rebase main
git switch main
git merge --ff-only fix/hooks-quoting-claude-plugin-root
git switch fix/hooks-quoting-claude-plugin-root
git rebase main
git switch main
git merge --no-ff fix/hooks-quoting-claude-plugin-root
git switch main
git merge --squash fix/hooks-quoting-claude-plugin-root
git switch main
git merge --ff-only fix/hooks-quoting-claude-plugin-root
git switch main
git merge fix/hooks-quoting-claude-plugin-root
git push origin main
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
yoshi/second-brain-skill!2
No description provided.