main
GitHub Extension for Pi
Manage GitHub PRs, issues, CI checks, and workflow runs directly from pi using the gh CLI.
Features
Read Operations (No Approval Required)
pr-list- List PRs with filters (state, author, label, base)pr-view- View PR details (metadata, diff summary, checks, reviews)pr-diff- View PR diffpr-checkout- Checkout PR locallychecks- Show check status for a PRchecks-log- Get failed check logsrun-list- List workflow runs (filter by branch, status, workflow)run-view- View specific run details with jobsissue-list- List issues with filters (state, label, assignee)issue-view- View issue details + commentsrepo-view- View current repo inforelease-list- List releases
Write Operations (Require User Approval)
pr-create- Create PRpr-merge- Merge PR (merge, squash, or rebase)pr-review- Submit review (approve, request-changes, comment)pr-comment- Comment on PRpr-line-comment- Post an inline comment on a specific file/line in the diffpr-review-comments- Submit a review (approve/request-changes/comment) with multiple inline commentspr-reviews-list- List reviews on a PR (with IDs for editing)pr-review-edit- Edit a review body by review IDpr-review-comments-list- List inline review comments (with IDs)pr-review-comment-edit- Edit an inline review comment by IDpr-review-comment-delete- Delete an inline review comment by IDpr-ready- Mark draft as ready for reviewpr-close- Close PR without mergingchecks-restart- Restart failed workflow runsissue-create- Create issueissue-close- Close issueissue-comment- Comment on issueissue-edit- Edit issue (title, body, labels, assignees, milestone)
All write operations show a confirmation dialog before executing.
Prerequisites
1. gh CLI
Install the GitHub CLI: https://cli.github.com/
2. Authentication
gh auth login
Verify:
gh auth status
Slash Commands (Instant, No LLM)
| Command | Description |
|---|---|
/gh |
Show my open PRs |
/gh-prs |
Show all open PRs in this repo |
/gh-pr <number> |
View PR details |
/gh-checks <number> |
Show check status for PR |
/gh-issues |
Show open issues |
/gh-runs |
Show recent workflow runs |
All commands execute directly via gh CLI — no LLM roundtrip!
Tab auto-completion for PR/issue numbers from your session.
Auto-Detection
The extension detects GitHub URLs pasted into the input:
https://github.com/org/repo/pull/123
→ Automatically transforms to: "View GitHub PR #123"
https://github.com/org/repo/issues/42
→ Automatically transforms to: "View GitHub issue #42"
Usage Examples
PR Workflows
"Show my open PRs"
→ github pr-list, author=me, state=open
"View PR 123"
→ github pr-view, number=123
"Show the diff for PR 123"
→ github pr-diff, number=123
"Create a PR for this branch"
→ github pr-create (approval dialog)
"Merge PR 123 with squash"
→ github pr-merge, number=123, method=squash (approval dialog)
"Approve PR 123 with LGTM"
→ github pr-review, number=123, reviewAction=approve, body="LGTM" (approval dialog)
Inline / Line Comments
"Add an inline comment on PR 123 at src/main.ts line 42 saying the error handling is missing"
→ github pr-line-comment, number=123, path=src/main.ts, line=42, body="..."
"Submit a review with changes requested on PR 123 with comments on specific lines"
→ github pr-review-comments, number=123, reviewAction=request-changes,
comments=[{path: "src/main.ts", line: 42, body: "Missing error handling"},
{path: "src/utils.ts", line: 10, body: "Unused import"}]
"Comment on lines 15-20 of src/config.ts in PR 456"
→ github pr-line-comment, number=456, path=src/config.ts, line=20, startLine=15, body="..."
Managing Reviews & Review Comments
"List all reviews on PR 9368"
→ github pr-reviews-list, number=9368
Shows review IDs, state, author, body preview
"Edit my CHANGES_REQUESTED review on PR 9368 to update the body"
→ github pr-review-edit, number=9368, reviewId=3779821940, body="Updated text..."
"List all inline review comments on PR 9368"
→ github pr-review-comments-list, number=9368
Shows comment IDs, file:line, author, body preview
"Edit inline review comment 2788725648"
→ github pr-review-comment-edit, commentId=2788725648, body="Updated comment..."
"Delete inline review comment 2788725648"
→ github pr-review-comment-delete, commentId=2788725648
CI/Checks
"Check the status of PR 123"
→ github checks, number=123
"Show the failed logs for run 456789"
→ github checks-log, runId=456789
"Restart the failed checks for run 456789"
→ github checks-restart, runId=456789 (approval dialog)
"List recent workflow runs"
→ github run-list
"Show failed runs on main"
→ github run-list, branch=main, status=failure
Issues
"Show open issues"
→ github issue-list, state=open
"Create an issue for the login bug"
→ github issue-create (approval dialog)
"Close issue 42"
→ github issue-close, number=42 (approval dialog)
"Add a comment to issue 42"
→ github issue-comment, number=42, body="..." (approval dialog)
Repository
"Show repo info"
→ github repo-view
"List recent releases"
→ github release-list
Architecture
github/
├── index.ts # Main extension: tool, commands, rendering, state
├── actions/
│ ├── pr.ts # PR action handlers
│ ├── checks.ts # CI/checks action handlers
│ ├── issue.ts # Issue action handlers
│ └── repo.ts # Repo/release action handlers
├── types.ts # TypeScript type definitions
├── utils.ts # Parsing, formatting, error helpers
├── github.test.ts # Tests (75 tests)
├── package.json # Package config
├── Makefile # Test runner
└── README.md # This file
Development
Running Tests
cd dots/pi/agent/extensions/github
make test
Watch mode:
make test-watch
Adding New Actions
- Add action string to the
StringEnuminindex.ts - Add handler function in the appropriate
actions/*.tsfile - Add routing in the
execute()switch inindex.ts - Add rendering case in
renderResult()inindex.ts - Add any new parameters to the tool schema
- Add tests in
github.test.ts - Update this README
State Management
The extension tracks:
- Current GitHub user (fetched lazily via
gh api user) - Recent PR numbers (for slash command auto-completion)
- Recent issue numbers (for slash command auto-completion)
State is reconstructed from session on load/fork/tree navigation.
Custom Rendering
The extension provides themed TUI rendering:
- PR list: Compact with draft/review status
- Checks: Color-coded pass ✓ / fail ✗ / pending ⏳
- Run list: Status icons with branch and age
- Write ops: Success confirmations with links
- Long output: Collapsed by default, expandable
License
Same as the homelab repository.