3 releases
Uses new Rust 2024
| 0.1.4 | Feb 9, 2026 |
|---|---|
| 0.1.3 | Jan 21, 2026 |
| 0.1.2 | Jan 18, 2026 |
#1405 in Command line utilities
1MB
827 lines
gh-context
A CLI tool to fetch and format GitHub Issues and Pull Requests context, ready for use in LLM prompts.
Prerequisites
This tool requires the GitHub CLI (gh) to be installed and authenticated.
# macOS
brew install gh
# Authenticate
gh auth login
Installation
To install from crates.io:
cargo install gh-context
To install from source (locally):
cargo install --path .
Usage
Running Installed Command
Once installed, you can use gh-context directly:
gh-context <input> [OPTIONS]
Running Locally (Development)
You can run the tool without installing it using cargo run. Note the -- separator used to pass arguments to the CLI.
cargo run -- <input> [OPTIONS]
Examples
Fetch context for a PR (creates repo-issue-123/repo-issue-123.md context by default, where repo is the repository name):
gh-context owner/repo#123
Fetch a PR range (inclusive, one file per PR in repo-prs/ by default):
gh-context owner/repo --from 244 --to 276
If any PR in the range fails to fetch, the command continues and prints a failure summary.
Bulk fetch open issues for a repo (one file per issue, first page by default):
gh-context https://github.com/openai/codex/issues --bulk
Bulk fetch multiple pages:
gh-context openai/codex --bulk --pages 3 --per-page 50
Fetch context for an issue and copy to clipboard:
gh-context https://github.com/owner/repo/issues/123 --clip
Save as JSON (prints to stdout):
gh-context owner/repo#123 --format json
Using cargo run:
cargo run -- https://github.com/hdcodedev/resume256/issues/48
Options
--format <json|md>: Output format (default: md)--out <path>: Write output to file (single) or directory (bulk)--clip: Copy output to clipboard (macOS only)--issue: Treat input as issue (disambiguate shorthand)--pr: Treat input as PR (disambiguate shorthand)--bulk: Fetch multiple issues for a repo (list mode)--state <open|closed|all>: Issue state filter for bulk mode (default: open)--per-page <n>: Items per page for bulk mode (default: 30)--pages <n>: Number of pages to fetch in bulk mode (default: 1)--from <n>: Start PR number for range mode (inclusive, requires--to)--to <n>: End PR number for range mode (inclusive, requires--from)
Dependencies
~1.3–2.4MB
~45K SLoC