@diegopetrucci/pi-permission-gate
A pi extension that prompts before dangerous bash commands and protected file writes.
Package details
Install @diegopetrucci/pi-permission-gate from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@diegopetrucci/pi-permission-gate- Package
@diegopetrucci/pi-permission-gate- Version
0.1.7- Published
- Jul 14, 2026
- Downloads
- 247/mo · 21/wk
- Author
- diegopetrucci
- License
- MIT
- Types
- extension
- Size
- 7.9 KB
- Dependencies
- 0 dependencies · 1 peer
Pi manifest JSON
{
"extensions": [
"index.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
permission-gate
A small pi extension that prompts for confirmation before running potentially dangerous bash commands or writing to protected paths.
This is adapted from the original permission-gate.ts example in earendil-works/pi-mono and kept basically the same.
What it checks
rm -rfsudochmod/chownwith777- direct
write/editcalls touching normalized protected paths:- exact
.gitpath segments - exact
node_modulespath segments - secret-bearing
.envfiles such as.envand.env.production
- exact
Safe .env templates/examples such as .env.example and .env.production.template are allowed.
If pi is running without an interactive UI, it blocks matching commands and protected path writes by default.
Install
Standalone npm package
pi install npm:@diegopetrucci/pi-permission-gate
Collection package
pi install npm:@diegopetrucci/pi-extensions
GitHub package
pi install git:github.com/diegopetrucci/pi-extensions
Then reload pi:
/reload
Notes
- Hooks the
tool_callevent. - Inspects
bash,write, andedittool calls. - Normalizes relative/absolute paths before matching so traversal tricks do not bypass the guard.
- Prompts with a simple
Yes/Noselector before allowing dangerous commands or protected path writes.