@diegopetrucci/pi-dirty-repo-guard
A pi extension that prompts before session changes when the current git repo has uncommitted changes.
Package details
Install @diegopetrucci/pi-dirty-repo-guard from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@diegopetrucci/pi-dirty-repo-guard- Package
@diegopetrucci/pi-dirty-repo-guard- Version
0.1.2- Published
- Jun 1, 2026
- Downloads
- 339/mo · 184/wk
- Author
- diegopetrucci
- License
- MIT
- Types
- extension
- Size
- 3.2 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
dirty-repo-guard
A small pi extension that prompts before session changes when the current git repo has uncommitted changes.
This is copied from the original dirty-repo-guard.ts example in earendil-works/pi-mono and kept basically the same.
What it checks
Before creating a new session, switching sessions, or forking, the extension runs:
git status --porcelain
If the command reports changed files, pi asks whether to proceed anyway. If pi is running without an interactive UI, matching actions are cancelled by default.
Install
Standalone npm package
pi install npm:@diegopetrucci/pi-dirty-repo-guard
Collection package
pi install npm:@diegopetrucci/pi-extensions
GitHub package
pi install git:github.com/diegopetrucci/pi-extensions
Then reload pi:
/reload
Notes
- Hooks
session_before_switchandsession_before_fork. - Allows session changes outside git repos.
- Cancels the action when the user declines.