@senomas/pi-git-hat

Pi extension for role-based Git branch workflows — wear different hats by switching branches

Packages

Package details

extension

Install @senomas/pi-git-hat from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@senomas/pi-git-hat
Package
@senomas/pi-git-hat
Version
0.2.7
Published
Jun 9, 2026
Downloads
not available
Author
senomas
License
MIT
Types
extension
Size
95.5 KB
Dependencies
0 dependencies · 2 peers
Pi manifest JSON
{
  "extensions": [
    "./git-hat.ts"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

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-hat

No 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/hat TUI 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/hatt validates 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/
pi

Commands

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