fix: quote CLAUDE_PLUGIN_ROOT in hook commands to support paths with spaces#212
Merged
scottschreckengaust merged 2 commits intoJul 8, 2026
Merged
Conversation
…spaces
The aws-serverless and deploy-on-aws hooks passed ${CLAUDE_PLUGIN_ROOT}
directly to /bin/sh -c without quoting or a bash prefix. When
CLAUDE_CONFIG_DIR contains a space (e.g. /Users/me/Work/Company Name/),
the shell word-splits the path and the hook fails on every Edit/Write
with:
/bin/sh: /Users/me/Work/Company: is a directory
Wrap the interpolated path in escaped double quotes and prefix with
bash, matching the pattern used by superpowers in
anthropics/claude-plugins-official. Applied the same pattern to the
databases-on-aws scripts README example so users don't copy the
broken form.
Closes #146
Sagargupta16
requested review from
a team,
Copilot,
krokoko,
scottschreckengaust and
theagenticguy
July 4, 2026 14:56
Sagargupta16
requested review from
Benjscho,
Morlej,
amaksimo,
jaichabria,
pkale,
praba2210 and
spencercorwin
July 4, 2026 14:56
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes PostToolUse hook command strings to work when CLAUDE_PLUGIN_ROOT contains spaces (e.g., paths under .../Company Name/...) by invoking scripts via bash and quoting the interpolated script path (and, in docs, quoting example arguments too). This aligns hook behavior across aws-serverless and deploy-on-aws and prevents shell word-splitting failures.
Changes:
- Quote
${CLAUDE_PLUGIN_ROOT}in hookcommandstrings and prefix withbashfor reliable execution. - Apply the same fix to both
aws-serverlessanddeploy-on-awshook configs for parity. - Update the
databases-on-awsscripts README hook example to use the safe quoted form (including quoting$CLUSTERand$REGION).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| plugins/aws-serverless/hooks/hooks.json | Quotes ${CLAUDE_PLUGIN_ROOT} and runs validation script via bash to prevent failures on space-containing paths. |
| plugins/deploy-on-aws/hooks/hooks.json | Applies the same bash + quoted ${CLAUDE_PLUGIN_ROOT} pattern to the drawio validation hook. |
| plugins/databases-on-aws/scripts/README.md | Updates the documented hook example to use quoted script path and arguments, avoiding copy/paste breakage. |
spencercorwin
approved these changes
Jul 7, 2026
bfreiberg
approved these changes
Jul 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The `aws-serverless` and `deploy-on-aws` PostToolUse hooks pass `${CLAUDE_PLUGIN_ROOT}` directly to `/bin/sh -c` with no quoting and no explicit interpreter. When `CLAUDE_CONFIG_DIR` (and therefore `CLAUDE_PLUGIN_ROOT`) contains a space -- e.g. `/Users/me/Work/Company Name/.claude` or `C:\Users\First Last.claude\plugins...` -- the shell word-splits the expanded path and the hook fails on every `Edit`/`Write`:
```
PostToolUse:Edit hook error
Failed with non-blocking status code: /bin/sh: /Users/me/Work/Company: is a directory
```
Fix
Wrap the interpolated path in escaped double quotes and prefix with `bash`, matching the pattern used by `superpowers` in `anthropics/claude-plugins-official`:
```diff
```
Files touched
Space-free paths are unaffected (double quotes and `bash` are no-ops on well-formed paths).
Testing
Closes #146
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the project license.