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 mariusvniekerkv1.0.0MIT
Blocks or auto-approves Bash commands by parsing them into an AST and matching against configurable patterns, restricting shell access in multi-user or safety-critical contexts.
Trending plugins
7-day copy clicks
No risk signals detected
Nothing flagged in this plugin's hooks, MCP servers or commands. Other components are not analyzed.
Static checks of hooks, mods, MCP servers and commands. Not a security audit.
auto-approve, command-filtering, shell-restriction, safety, hooks, permissions
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
A command approval runtime for Claude Code and OpenCode. It auto-approves safe Bash commands, repo-scoped Read/Grep calls for Claude Code, and blocks dangerous operations. Written in Go for fast startup.
A reusable pi package is also included under packages/pi-bash-approve/ for protecting pi bash, read, grep, find, and ls tool calls via the same Go runtime.
Use unified installer:
python3 install.py install --target claude
python3 install.py install --target opencode
python3 install.py install --target opencode --scope project
python3 install.py install --target opencode --scope both
python3 install.py install --target codex
python3 install.py install --target codex --scope project
python3 install.py install --target codex --scope both
python3 install.py install --target all
For opencode and codex, default --scope is global.
Uninstall uses same entrypoint:
python3 install.py uninstall --target claude
python3 install.py uninstall --target opencode --scope both
python3 install.py uninstall --target codex --scope both
python3 install.py uninstall --target all
Installer requirements:
Shared runtime installs to $XDG_DATA_HOME/claude-bash-approve when XDG_DATA_HOME is an absolute path, else ~/.local/share/claude-bash-approve.
In Claude Code:
/plugin install github:mariusvniekerk/claude-bash-approve
For local/manual install, run python3 install.py install --target claude.
When Claude Code is about to run a matched tool call, this hook intercepts it and makes one of four decisions:
git tag v1.0.0)git push, gh pr create, or unrecognized commands)flowchart TD
A["Parse command AST"] --> C{"All segments\nmatched?"}
C -->|No| NOP["**no opinion**\nnext hook in chain"]
C -->|Yes| priority
subgraph priority["Decision priority"]
D{"any segment\ndenied?"} -->|Yes| DENY["**deny**\nblock command"]
D -->|No| E{"any segment\nask?"}
E -->|Yes| ASK["**ask**\nprompt user"]
E -->|No| F{"any segment\nno-opinion?"}
F -->|No| OK["**allow**\nrun immediately"]
end
F -->|Yes| NOP
Commands are parsed into an AST (using mvdan/sh) so chained commands (&&, ||, ;, |), subshells, command substitutions ($(…)), and control flow (if, for, while) are all handled correctly — every segment must be safe for the whole command to be approved.
For Read and Grep, the hook auto-approves only when the referenced paths stay inside the current Git repo or linked worktree root derived from the incoming cwd. Anything outside that boundary falls back to no-opinion.
The hook uses a compositional model: a command is split into wrappers (prefixes like timeout 30, env, VAR=val) and a core command (like git status, pytest). Both are matched against regex patterns organized into categories.
git clone https://github.com/mariusvniekerk/claude-bash-approve.git
cd claude-bash-approve
python3 install.py install --target claude
OpenCode installs write plugin files under project/global OpenCode config and point them at shared runtime hook. Codex installs enable hooks and write PermissionRequest hook config pointing at shared runtime hook.
TypeScript support for the OpenCode and pi integrations is enforced through the
root Vite+ typecheck: bun run typecheck.
This repo also includes prek.toml for pre-commit checks:
prek install --prepare-hooks
Configured hooks run:
uv run python -m unittest -v install_test.pycd hooks/bash-approve && go test ./...cd hooks/bash-approve && golangci-lint run ./...bun run typecheck for both TypeScript workspaces through Vite+git clone https://github.com/mariusvniekerk/claude-bash-approve.git
~/.claude/settings.json):{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "~/.local/share/claude-bash-approve/run-hook.sh"
}
]
},
{
"matcher": "Read|Grep",
"hooks": [
{
"type": "command",
"command": "~/.local/share/claude-bash-approve/run-hook.sh"
}
]
}
]
}
}
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.
Claude Code installs this plugin but refuses to load it
hooks/hooks.json: hooks.json declares PreToolUse/PermissionRequest at its top level, outside the "hooks" object — a PreToolUse/PermissionRequest hook that cannot be loaded may be what guards the permissions declared beside it, so nothing it sits in is applied until the entry is fixed or removed
hooks/hooks.json: hooks.json declares PreToolUse/PermissionRequest at its top level, outside the "hooks" object — a PreToolUse/PermissionRequest hook that cannot be loaded may be what guards the permissions declared beside it, so nothing it sits in is applied until the entry is fixed or removed
Checked against Claude Code 2.1.332. The listing below is what the repository ships; Claude Code doesn't load it as published.
Plugins from other owners that cover similar ground