| name | github |
| description | Read-only GitHub CLI commands for querying PRs, reviews, issues, and repo information |
GitHub CLI (Read-Only)
Use the gh CLI to query information from GitHub. All commands
are read-only โ never use gh to create, update, delete, or
push anything.
Authentication
Assume gh is already configured. If a command fails with an
authentication error, the user needs to set up a fine-grained
read-only personal access token:
- Go to https://github.com/settings/tokens?type=beta
- Click "Generate new token"
- Set a token name (e.g., "kiro-readonly")
- Under "Repository access", select "Public Repositories (read-only)"
- Click "Generate token" and copy it
- Run in terminal:
export GH_TOKEN=<token>
NEVER run gh auth commands yourself.
PR Information
gh pr view <number>
gh pr view <number> --comments
gh pr diff <number> --stat
gh pr diff <number>
gh pr list
Review Comments
gh api repos/{owner}/{repo}/pulls/{number}/comments
gh api repos/{owner}/{repo}/pulls/{number}/reviews
gh api repos/{owner}/{repo}/pulls/{number}/comments \
--jq '.[] | {id: .id, path: .path, body: .body, user: .user.login}'
Issues
gh issue view <number>
gh issue list
gh issue list --search "keyword"
Repository
gh repo view
gh api repos/{owner}/{repo}/branches --jq '.[].name'
gh api repos/{owner}/{repo}/commits?sha=<branch> \
--jq '.[:10] | .[].commit.message'
General API Access
For any GitHub REST API endpoint, use gh api:
gh api <endpoint> [--jq '<filter>'] [--paginate]
Use --paginate for endpoints that return paginated results.
Use --jq to filter JSON output.
Rules
- Only use read-only commands (
view, list, diff, GET API calls)
- Never use write commands (
create, edit, close, merge, delete)
- Never run
gh auth commands
- Use
--jq to keep output concise