flake-update-20260505

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 diff
  • pr-checkout - Checkout PR locally
  • checks - Show check status for a PR
  • checks-log - Get failed check logs
  • run-list - List workflow runs (filter by branch, status, workflow)
  • run-view - View specific run details with jobs
  • issue-list - List issues with filters (state, label, assignee)
  • issue-view - View issue details + comments
  • repo-view - View current repo info
  • release-list - List releases

Write Operations (Require User Approval)

  • pr-create - Create PR
  • pr-merge - Merge PR (merge, squash, or rebase)
  • pr-review - Submit review (approve, request-changes, comment)
  • pr-comment - Comment on PR
  • pr-line-comment - Post an inline comment on a specific file/line in the diff
  • pr-review-comments - Submit a review (approve/request-changes/comment) with multiple inline comments
  • pr-reviews-list - List reviews on a PR (with IDs for editing)
  • pr-review-edit - Edit a review body by review ID
  • pr-review-comments-list - List inline review comments (with IDs)
  • pr-review-comment-edit - Edit an inline review comment by ID
  • pr-review-comment-delete - Delete an inline review comment by ID
  • pr-ready - Mark draft as ready for review
  • pr-close - Close PR without merging
  • checks-restart - Restart failed workflow runs
  • issue-create - Create issue
  • issue-close - Close issue
  • issue-comment - Comment on issue
  • issue-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

  1. Add action string to the StringEnum in index.ts
  2. Add handler function in the appropriate actions/*.ts file
  3. Add routing in the execute() switch in index.ts
  4. Add rendering case in renderResult() in index.ts
  5. Add any new parameters to the tool schema
  6. Add tests in github.test.ts
  7. 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.