Available in
Marketplaces, most starred first
Tags
Add to README
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
By pedropaulovcv0.1.6MITIn 1 marketplace
PreToolUse hook that auto-fixes Windows+bash path pitfalls (backslash paths, /dev/stdin) before execution
Run automatically on Claude Code events. Claude doesn't decide.
1 caution to review before installing
A hook runs when Claude uses the Bash tool
Static checks of hooks, mods, MCP servers and commands. Not a security audit.
1 marketplace, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
A Windows-only Bash PreToolUse hook that passes the tool input to a local Rust helper and applies two narrowly scoped command rewrites before execution.
Rewrites:
node, exact quoted /dev/stdin, /dev/stdout, and /dev/stderr literals become file descriptors 0, 1, and 2.Harness behavior:
updatedInput and additionalContext when a rewrite applies; the hook does not grant approval.bypassPermissions or dontAsk); otherwise it leaves the command unchanged.[no-rewrite] in the Bash tool description bypasses rewriting.The plugin ships x86_64 Linux and Windows executables in hooks/bin; the Linux helper exits without rewriting. To rebuild them, use Rust/Cargo and the cross-compilation prerequisites in hooks/build-hooks.py; the script writes the generated binaries and executable mode into the plugin.
python3 hooks/build-hooks.py
Add the following optional guidance to ~/.claude/CLAUDE.md if useful. It is advice for the agent, not a promise that the hook rewrites every path rule shown here.
### Windows path guidance
**In common Windows Bash, Node.js, and Python path contexts, forward slashes avoid many escaping problems.** Backslashes can be transformed across bash → JS → filesystem layers.
```
# YES — forward slashes everywhere
node run.js "C:/Users/pedro/file.js"
node -e "require('fs').readFileSync('C:/src/data.json','utf8')"
ls -la "C:/src/project"
# NO — backslashes get mangled
node run.js "C:\\Users\\pedro\\file.js" # bash eats \U → node gets C:Userspedrofile.js
node -e "readFileSync('C:\\tmp\\file')" # \t = tab, \f = form feed in JS
ls -la "C:\src\styles\" # trailing \" eats closing quote → EOF error
```
Specific failure modes that backslashes cause:
- **Unquoted `C:\src`** → bash interprets `\s` as escape → `C:src` (ENOENT)
- **`node -e` with `C:\tmp`** → JS interprets `\t` as tab → corrupted path (ENOENT)
- **Trailing `"C:\path\"`** → `\"` eats the closing quote → `unexpected EOF`
- **Double-escaped `C:\\\\src`** in node -e → multi-layer escaping hell
Other Windows+bash pitfalls to avoid (these are guidance only; the hook does not rewrite all of them):
- **`/dev/stdin` does not exist on Windows.** Use `readFileSync(0)` (fd 0) instead of `readFileSync('/dev/stdin')`. Same for stdout (fd 1) and stderr (fd 2).
- **`$variable` in `node -e` double quotes** → bash expands `$metadata` to empty string. Use single quotes for the outer shell quoting, or escape as `\$`.
- **MSYS2-style `/c/...` paths may not work when passed to native Windows Node.** Use `C:/...` in that context.
- **Inside JS/TS source files**, use forward-slash paths: `'C:/Users/pedro/file.txt'`. Node.js handles them natively on Windows.
The runtime receives the current Bash tool input from the agent host through local stdin (OpenCode passes its Bash arguments directly), checks the command and relevant hook fields, and returns a rewritten command and explanation only when one of the supported patterns matches. The runtime does not read transcripts, write persistent files, or contact a network service. The host controls how tool inputs and returned context are handled afterward.
Separate, manually invoked analysis utilities can read transcript JSONL files from directories you provide and write local test-case data containing commands, error excerpts, categories, transcript filenames, timestamps, and working directories. They are not called during normal hook execution. The build script and optional helper-package setup may resolve build-time dependencies through your configured package registries.
Built from public signals: copy clicks on this site, GitHub stars and activity, the README and the manifest. Not a security audit or an endorsement.
npx claudepluginhub pedropaulovc/agent-plugins --plugin windows-bash-guardPlugins from other owners that cover similar ground