A command-line tool that fetches GitHub pull requests (PRs) for a specified time period and scope (organization, team, user, or repository), summarizes them using an LLM (OpenAI or Ollama), and outputs the result in Markdown format.
- Multi-scope PR fetching: Fetch PRs from organizations, teams, users, or specific repositories
- Time-based filtering: Filter PRs by merge date using relative time ranges (
-7d,-1m,-1yr) - AI-powered summaries: Generate intelligent summaries using OpenAI or Ollama
- Multiple output formats: Output to stdout or save to files
- Flexible configuration: Configure via YAML files, environment variables, or CLI flags
- CI/CD friendly: Special mode for automated environments
- Dry-run support: Preview data without generating summaries
Requires Go 1.24 or later.
git clone https://github.com/willis7/prtool.git
cd prtool
go build -o prtool ./main.goDownload pre-built binaries for Linux, macOS, and Windows from the releases page.
You can build a snapshot using GoReleaser without publishing:
make snapshotArtifacts will appear in dist/ with a dev-<commit> version.
prtool initThis creates a .prtool.yaml file with all available configuration options and comments.
Set your GitHub personal access token:
export PRTOOL_GITHUB_TOKEN="your_github_token_here"Or edit the .prtool.yaml file:
github_token: "your_github_token_here"# Fetch PRs from a user for the last 7 days
prtool --user=octocat --since=-7d
# Fetch PRs from an organization for the last month
prtool --org=github --since=-1m
# Fetch PRs from a specific repository
prtool --repo=owner/repository --since=-2w# Fetch PRs from user 'octocat' for the last week
prtool --user=octocat --since=-7d
# Fetch PRs from organization 'github' for the last month
prtool --org=github --since=-1m
# Fetch PRs from specific repository
prtool --repo=microsoft/vscode --since=-14d
# Fetch PRs from team (format: org/team)
prtool --team=github/docs --since=-1w# Use OpenAI for AI summaries
prtool --user=octocat --llm-provider=openai --llm-api-key=sk-...
# Use Ollama (local)
prtool --user=octocat --llm-provider=ollama --llm-model=llama3.2
# Skip AI summary generation (dry-run) - outputs PR data in table format
prtool --user=octocat --dry-run# Save to file
prtool --user=octocat --output=report.md
# Verbose logging
prtool --user=octocat --verbose
# Log to file
prtool --user=octocat --log-file=prtool.log
# CI-friendly mode (no progress indicators)
prtool --user=octocat --ciCreate a configuration file with prtool init, then customize:
# .prtool.yaml
github_token: "ghp_xxxxxxxxxxxx"
user: "octocat"
since: "-7d"
llm_provider: "openai"
llm_api_key: "sk-xxxxxxxxxxxx"
llm_model: "gpt-3.5-turbo"
output: "weekly-report.md"
verbose: trueThen run simply:
prtoolprtool provides flexible logging options for different use cases:
Use --verbose to enable detailed logging to the console:
prtool --user=octocat --verboseLog to a file using --log-file:
prtool --user=octocat --log-file=prtool.logCombine with --verbose for both console and file logging:
prtool --user=octocat --verbose --log-file=prtool.logIn CI environments, use --ci to suppress progress indicators while still allowing error logging.
Configuration can be provided via:
- Command-line flags (highest precedence)
- Environment variables
- YAML configuration file (lowest precedence)
| Flag | Description | Example |
|---|---|---|
--github-token |
GitHub personal access token | --github-token=ghp_xxx |
--org |
GitHub organization | --org=github |
--team |
GitHub team (org/team) | --team=github/docs |
--user |
GitHub user | --user=octocat |
--repo |
GitHub repository (owner/repo) | --repo=owner/repo |
--since |
Time range for PRs | --since=-7d |
--llm-provider |
LLM provider (stub/openai/ollama) | --llm-provider=openai |
--llm-api-key |
LLM API key | --llm-api-key=sk-xxx |
--llm-model |
LLM model name | --llm-model=gpt-4 |
--output |
Output file path | --output=report.md |
--dry-run |
Skip LLM processing | --dry-run |
--verbose |
Enable verbose logging | --verbose |
--ci |
CI-friendly mode | --ci |
--log-file |
Log file path | --log-file=app.log |
All flags have corresponding environment variables with the PRTOOL_ prefix:
export PRTOOL_GITHUB_TOKEN="ghp_xxxxxxxxxxxx"
export PRTOOL_USER="octocat"
export PRTOOL_SINCE="-7d"
export PRTOOL_LLM_PROVIDER="openai"
export PRTOOL_LLM_API_KEY="sk-xxxxxxxxxxxx"
export PRTOOL_VERBOSE="true"| Format | Description | Example |
|---|---|---|
-7d |
Last 7 days | --since=-7d |
-2w |
Last 2 weeks | --since=-2w |
-1m |
Last 1 month | --since=-1m |
-3mo |
Last 3 months | --since=-3mo |
-1yr |
Last 1 year | --since=-1yr |
prtool --llm-provider=openai --llm-api-key=sk-xxx --llm-model=gpt-3.5-turboSupported models (defaults to gpt-3.5-turbo if not specified):
gpt-3.5-turbogpt-4gpt-4-turbo- Any other OpenAI model name
First, start Ollama locally:
ollama serve
ollama pull llama3.2Then use with prtool:
prtool --llm-provider=ollama --llm-model=llama3.2Supported models (defaults to llama3.2 if not specified):
llama3.2- Any other Ollama model you've pulled locally
prtool --llm-provider=stubReturns a fixed summary for testing purposes.
For automated environments and CI/CD pipelines, use the --ci flag:
prtool --user=octocat --since=-7d --output=report.md --ciCI mode is designed for non-interactive environments and:
- Suppresses progress indicators and spinners that don't work well in CI logs
- Uses clean exit codes (0 for success, 1 for failure)
- Reduces verbose output for cleaner, more readable CI logs
- Fails fast on configuration errors rather than prompting for input
Fetch and summarize pull requests.
Generate a sample configuration file (.prtool.yaml) in the current directory.
prtool initGenerate shell completion script for the specified shell.
# Show current version
prtool --version
# Show detailed version information including build metadata
prtool --version --verbose
# Check for latest version on GitHub
prtool --version-checkCreate a GitHub Personal Access Token with the following permissions:
repo(for private repositories)public_repo(for public repositories)read:org(for organization access)
Set the token via:
- Environment variable:
export PRTOOL_GITHUB_TOKEN="ghp_xxx" - Configuration file:
github_token: "ghp_xxx" - Command line:
--github-token=ghp_xxx
prtool supports shell completion for bash, zsh, fish, and PowerShell.
# Add to ~/.bashrc or ~/.bash_profile
source <(prtool completion bash)
# Or install globally
prtool completion bash > /etc/bash_completion.d/prtool# Add to ~/.zshrc
source <(prtool completion zsh)
# Or for oh-my-zsh users
prtool completion zsh > "${fpath[1]}/_prtool"prtool completion fish > ~/.config/fish/completions/prtool.fish# Add to PowerShell profile
prtool completion powershell >> $PROFILE# Generate weekly report for a team
prtool --team=myorg/backend --since=-7d --output=weekly-report.md --llm-provider=openai
# With configuration file
echo "team: myorg/backend
since: -7d
output: weekly-report.md
llm_provider: openai
llm_api_key: sk-xxx" > .prtool.yaml
prtoolprtool --org=mycompany --since=-1m --llm-provider=ollama --verboseprtool --user=developer --since=-2w --dry-runError: GitHub token is required
- Set your GitHub token via environment variable, config file, or CLI flag
Error: No pull requests found
- Check your scope (org/team/user/repo) and time range
- Verify you have access to the specified repositories
OpenAI API error
- Verify your API key is correct
- Check you have sufficient credits/quota
Ollama connection failed
- Ensure Ollama is running locally (
ollama serve) - Verify the model is installed (
ollama pull llama3.2)
Use verbose logging to troubleshoot:
prtool --user=octocat --verbose --log-file=debug.log- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Releases are automated with GoReleaser.
- Ensure you have a clean git tree and all tests pass.
- Install GoReleaser locally (optional for snapshot):
go install github.com/goreleaser/goreleaser/v2@latest
- Decide the next semantic version (e.g.
v0.2.0). - Update any docs if needed.
- Tag and push:
git tag v0.2.0 git push origin v0.2.0
- GitHub Actions will run the release workflow and publish binaries, checksums, SBOM, and Homebrew formula.
Generate unsigned snapshot artifacts locally without publishing:
make snapshotgoreleaser release --snapshot --skip=publish,sign --clean./prtool --version --verboseThis prints the version plus commit, build date, and builder.
This project is licensed under the MIT License - see the LICENSE file for details.