npm package: @openpets/github
Description: Full-featured GitHub plugin for OpenCode - manage repositories, issues, pull requests, releases, workflows, and more
Latest version: 1.0.3

# GitHub Plugin

Complete GitHub API integration for OpenCode. Manage repositories, issues, pull requests, releases, workflows, and more.

## Setup

### 1. Create a GitHub Personal Access Token

1. Go to [Create New Token](https://github.com/settings/personal-access-tokens/new) to create a fine-grained token automatically
2. Or use [Classic Tokens](https://github.com/settings/tokens) and click "Generate new token (classic)"
3. Select scopes:
   - `repo` - Full control of private repositories
   - `workflow` - Update GitHub Action workflows
   - `gist` - Create and manage gists
   - `notifications` - Access notifications
4. Copy the generated token

### 2. Configure Environment

Add to your `.env` file:

```bash
GITHUB_TOKEN=ghp_your_token_here
```

### 3. Test Connection

```bash
cd pets/github
opencode run "test github connection"
```

## Available Tools

### Repository Management
- `github-list-repos` - List repositories for user/org
- `github-get-repo` - Get detailed repo information
- `github-search-repos` - Search GitHub repositories
- `github-star-repo` - Star/unstar a repository
- `github-fork-repo` - Fork a repository

### Issues
- `github-list-issues` - List issues with filters
- `github-get-issue` - Get issue details
- `github-create-issue` - Create new issue
- `github-update-issue` - Update issue (title, body, state, labels)
- `github-add-issue-comment` - Add comment to issue
- `github-list-issue-comments` - List comments on issue
- `github-search-issues` - Search issues and PRs

### Pull Requests
- `github-list-pull-requests` - List PRs with filters
- `github-get-pull-request` - Get PR details (commits, files, reviews)
- `github-create-pull-request` - Create new PR
- `github-merge-pull-request` - Merge a PR

### Branches & Commits
- `github-list-branches` - List repository branches
- `github-list-commits` - List commits with filters
- `github-get-commit` - Get commit details

### File Contents
- `github-get-file-content` - Read file from repository
- `github-search-code` - Search code on GitHub

### Releases
- `github-list-releases` - List repository releases
- `github-create-release` - Create new release

### GitHub Actions
- `github-list-workflow-runs` - List workflow runs with filters

### Gists
- `github-list-gists` - List user gists
- `github-create-gist` - Create new gist

### Users & Notifications
- `github-test-connection` - Test connection and get authenticated user
- `github-get-user` - Get user profile information
- `github-list-notifications` - List notifications

## Example Queries

```bash
# List your repositories
opencode run "list my repositories"

# Search for popular TypeScript repos
opencode run "search for typescript repositories with stars:>10000"

# List open issues in a repo
opencode run "list open issues in facebook/react"

# Get pull request details
opencode run "get pull request #123 from owner/repo"

# View recent workflow runs
opencode run "show workflow runs for owner/repo"

# Read a file from a repo
opencode run "get contents of README.md from owner/repo"

# Create an issue
opencode run "create issue titled 'Bug report' in owner/repo"
```

## Search Qualifiers

Use GitHub's search syntax for powerful queries:

### Repository Search
- `language:typescript` - Filter by language
- `stars:>1000` - Minimum stars
- `forks:>100` - Minimum forks
- `topic:react` - By topic
- `user:octocat` - By user

### Issue/PR Search
- `is:issue` or `is:pr` - Type filter
- `is:open` or `is:closed` - State filter
- `label:bug` - By label
- `author:username` - By author
- `repo:owner/name` - In specific repo

### Code Search
- `extension:ts` - By file extension
- `path:src/` - In specific path
- `repo:owner/name` - In specific repo

## Token Scopes Reference

| Scope | Required For |
|-------|--------------|
| `repo` | All repository operations |
| `workflow` | GitHub Actions |
| `gist` | Gist operations |
| `notifications` | Notifications |
| `read:user` | User profile info |