@senomas/pi-git-hat
v0.2.9
Published
Pi extension for role-based Git branch workflows — wear different hats by switching branches
Maintainers
Readme
git-hat 🧢
Wear different hats by switching git branches.
A pi extension that maps git branches to roles (planner, implementor, reviewer, admin) and enforces role-based permissions.
Install
pi install npm:@senomas/pi-git-hatNo other dependencies needed. On first startup, role prompts and a default roles.json auto-seed into your project's .pi/.
Features
- Role-based branch switching —
/hatTUI to pick branches grouped by role - Permission enforcement — each role can only write to certain paths
- Tool enforcement — per-role allow/block rules for commands (docs)
- System prompt injection — role instructions injected automatically per session
- Ancestry checking —
/hattvalidates branch parent chain before work - Auto-seeding — role prompts copied from bundled
roles/to project.pi/on first use
Quick Start
# Install
pi install npm:@senomas/pi-git-hat
# Create a roles.json
mkdir -p .pi
cat > .pi/roles.json << 'EOF'
{
"roles": {
"planner": { "pattern": "^plan", "description": "Plan work" },
"implementor": { "pattern": "^feat", "description": "Implement features" },
"reviewer": { "pattern": "^review", "description": "Review implementations" },
"admin": { "pattern": "^(main|master)$", "description": "Configuration" }
}
}
EOF
# Start pi — role prompts auto-seed into .pi/
piCommands
| Command | Description |
|---------|-------------|
| /hat | TUI branch selector |
| /hat info | Show current role and branch |
| /hat todo | List pending items across todo/ |
| /hatt | Ancestry check + todo listing |
| /hatl [N] | Colored git log (default 10 lines) |
License
MIT
