pi-git-guardrails
v0.1.1
Published
Native Pi extension that blocks dangerous git operations, including git calls hidden inside scripts.
Downloads
303
Maintainers
Readme
pi-git-guardrails
Native Pi extension that blocks dangerous git operations before the assistant can run them. It also injects a temporary git shim into assistant Bash commands so nested scripts such as npm run release or ./deploy.sh are guarded too.
Install
From npm:
pi install npm:pi-git-guardrailsFrom GitHub:
pi install git:github.com/ramaaudra/pi-git-guardrailsProject-local install from GitHub:
pi install git:github.com/ramaaudra/pi-git-guardrails -lTry a local checkout for one run:
pi -e ./pi-git-guardrailsBlocked by Default
git pushin all variantsgit reset --hardgit clean -f,git clean -fd,git clean --forcegit branch -Dand force branch deletiongit checkout .,git checkout -- .,git restore .
Path-specific restore/checkout remains allowed, for example git restore src/app.ts and git checkout -- src/app.ts.
Commands
/git-guardrails statusshows ON/OFF, session block count, pending allow-next, active rules, and recent audit entries./git-guardrails allow-next pushallows exactly one matchinggit push, including from nested scripts./git-guardrails off 5mdisables the guardrail temporarily. Supportss,m, andhsuffixes./git-guardrails onre-enables immediately and clears any temporary off timer.
Nested Script Protection
The extension prepends a session-local directory containing a git shim to PATH for assistant Bash calls. This catches normal git ... calls inside scripts, package scripts, Makefiles, and similar child processes.
Known limits:
- It does not catch scripts that call an absolute git path such as
/usr/bin/git. - It does not catch programs that use a Git library directly instead of spawning
git. - It is a coding-agent safety guardrail, not an OS-level sandbox.
Develop
npm test
npm run pack:dry-runPublish
npm login
npm publishIf npm asks for a scoped public package flow in the future, use:
npm publish --access publicLicense
MIT
