gh-context

Crates.iogh-context
lib.rsgh-context
version0.1.3
created_at2026-01-18 19:29:48.075546+00
updated_at2026-01-21 22:07:51.690078+00
descriptionA CLI tool for fetching GitHub Issue and Pull Request context.
homepage
repositoryhttps://github.com/hdcodedev/gh-context
max_upload_size
id2052926
size6,212,090
HDCode (hdcodedev)

documentation

README

gh-context

Crates.io

A CLI tool to fetch and format GitHub Issues and Pull Requests context, ready for use in LLM prompts.

Screenshot 2026-01-18 at 11 23 56

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

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)
Commit count: 13

cargo fmt