@qmxme/pi-git-guard
Blocks destructive git operations (push, tag -d, reset --hard) in pi
Package details
Install @qmxme/pi-git-guard from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@qmxme/pi-git-guard- Package
@qmxme/pi-git-guard- Version
0.1.5- Published
- Apr 16, 2026
- Downloads
- 508/mo · 18/wk
- Author
- qmx
- License
- MIT
- Types
- extension
- Size
- 3.9 KB
- Dependencies
- 0 dependencies · 1 peer
Pi manifest JSON
{
"extensions": [
"./git-guard.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
@qmxme/pi-git-guard
Blocks destructive git operations in pi to prevent accidental pushes, tag deletions, or hard resets.
Blocked Operations
The following git commands are unconditionally blocked:
| Command | Reason |
|---|---|
git push (any form) |
Publishing is controlled manually |
git tag -d / git tag --delete |
Prevents accidental tag deletion |
git reset --hard |
Prevents discarding uncommitted changes |
Examples
Blocked:
git push # ❌ Blocked
git push origin main # ❌ Blocked
git push --force # ❌ Blocked
git tag -d v1.0 # ❌ Blocked
git tag --delete old-tag # ❌ Blocked
git reset --hard # ❌ Blocked
git reset --hard HEAD~1 # ❌ Blocked
Allowed:
git status # ✅ Allowed
git push --dry-run # ❌ Still blocked (all push blocked)
git pull # ✅ Allowed
git fetch # ✅ Allowed
git reset --soft HEAD # ✅ Allowed
git reset --mixed HEAD # ✅ Allowed
git tag v1.0 # ✅ Allowed (tag creation)
Installation
Install globally:
pi install npm:@qmxme/pi-git-guard
Install project-local:
pi install npm:@qmxme/pi-git-guard -l
Try without installing:
pi -e npm:@qmxme/pi-git-guard
How It Works
When pi attempts to execute a blocked git command:
- The command is intercepted before execution
- A warning notification is shown (if in interactive mode)
- The command is blocked with a clear reason
The LLM will see the block reason in the tool result and can adjust its approach.
Development
npm install # Install dependencies
npm test # Run tests
npm run typecheck # Type check
License
MIT