Exporting PR Context! Introducing the Custom CLI Tool "pr-dump"

2025-09-18T12:00:00+09:00 | 3 minute read | 15 views

@
Exporting PR Context! Introducing the Custom CLI Tool "pr-dump"

Introduction

As a non-native speaker working in a Japanese development team, writing PR review comments is always a small challenge for me. It requires not only making technical judgments, but also expressing them accurately and appropriately in Japanese.

So I often ask AI to help write drafts, but having to manually copy and paste the PR context every time—the summary, comment threads, diff—one by one, was honestly quite tedious.

“This kind of thing should be automated”—with that thought, I built a small CLI tool called pr-dump. This post introduces its features, development background, and concrete usage.

📕 What is pr-dump?

pr-dump is a command-line tool that aggregates all context (metadata, all comments, and code diff) of a specified GitHub pull request (PR) and outputs it into a single text file.

The core value of this tool is that it transforms fragmented, multi-faceted information on GitHub into a single “flattened” text, delivered in the format that AI understands best.

🛠️ Installation and Usage

You can easily install it using Homebrew (macOS/Linux).

1# Add tap
2brew tap CheerChen/pr-dump
3
4# Install
5brew install pr-dump

For other installation methods, please refer to the GitHub repository .

How to Use

⚠️ Important: You must be logged in to GitHub CLI first.

1# 1. Navigate to the repository directory containing the PR to review
2cd /path/to/your/repository
3
4# 2. Run with the PR number
5pr-dump 123
6
7# This generates a review.txt file in the current directory.

Example Output

The structure of the generated file is as follows:

 1################################################################################
 2# PULL REQUEST CONTEXT: #42
 3################################################################################
 4
 5--- METADATA ---
 6PR Title: Add user authentication system
 7PR Body: This PR implements JWT-based authentication...
 8
 9--- ALL COMMENTS ---
10## Timeline Comments ##
11- Timeline comment from @developer1:
12  Looks good, but consider adding rate limiting...
13
14## Code Review Comments ##
15- Code comment from @reviewer on `auth.go` (line 25):
16  This function should handle edge cases...
17
18--- GIT DIFF ---
19diff --git a/auth.go b/auth.go
20new file mode 100644
21index 0000000..abc1234
22+++ b/auth.go
23@@ -0,0 +1,45 @@
24+package auth
25...

Key Features

  • Complete Context: Fully retrieves PR title, body, all review comments, timeline discussions, and git diff information.
  • Optimized for AI Reviews: The output is formatted as structured text optimized for AI code review.
  • Noise Filtering: Automatically filters out comments generated by bots like pr-agent by default, allowing you to focus on human discussions.
  • Simple Operation: Just one easy-to-remember command to instantly get the information you need.

🚀 Why Existing Tools Weren’t Enough

Before deciding to build it myself, I looked into existing solutions.

  • PR-Agent: Runs reviews automatically in CI/CD and fetches diffs, but does not include team discussions on the PR (Timeline Comments). The exact problem I needed to solve was “reviewing commented code based on existing discussions”—missing those discussions loses a lot of context.
  • GitHub Copilot Chat: Allows asking questions on the PR page, but the output is locked inside GitHub’s chat dialog, and the context cannot be exported for external use.
  • Manual Copy-Pasting: The most reliable, but gathering the PR metadata, all comments, and diff takes 3–5 minutes each time. Reviewing 5 PRs a week adds up to over 15 hours of purely manual labor per year.

So the final verdict was: I needed a single-purpose CLI that “gathers all context of a PR into one file.” To be honest, pr-dump isn’t a “tool for everyone,” but a “personal tool created to solve my own problem.” But if even one person shares the same frustration, building it was worthwhile.

Example Collaboration with Gemini

The text file generated by pr-dump is extremely useful when passing context to conversational AI like Gemini.

Below is a real-world example of how I use it.

1. Generate Context with pr-dump

First, run pr-dump to generate the text file.

1P-LMD0001:awesome-project xxx$ pr-dump 573
2🚀 Starting context generation for PR #573...
3✅ Success! All context has been saved to 'review.txt'.
4📄 Text format ready for LLM input.

2. Attach File to Gemini and Ask

Next, attach this review.txt file to Gemini and make a specific request with a prompt like this:

Prompt Example:

Read @review.txt. What does he mean when he asks “もしこのテーブルに「説明」や「優先度」などの列を追加して整理したい場合も対応できますが、追加しますか?”?

3. Example Response from Gemini

The AI then generates an accurate answer based on understanding the context.

Gemini

The author of this PR created a table in the changes section summarizing notification types and their corresponding notification channels. Regarding this, he asks the reviewer:

“もしこのテーブルに「説明」や「優先度」などの列を追加して整理したい場合も対応できますが、追加しますか?”

In other words, he wants to confirm whether they should add columns to the existing table explaining the meaning of each notification (“Description”) and its urgency (“Priority”) to make the table easier to manage.

In this way, conversations with AI become very smooth and concrete.

Other Use Cases

This tool is more than just a “conversation assistant.” In modern development workflows, it acts as an “adapter,” helping all developers maximize the advantages of AI.

  1. Speeding Up Code Reviews: Senior engineers reviewing numerous PRs can simply pass the generated file to AI and ask: “Summarize the key changes and potential risks of this PR,” grasping core details in seconds.

  2. Quickly Understanding Complex PRs: Even for PRs with long discussions and dozens of comments, asking AI “What are the main points of contention in this PR? What problems did the final code solve?” helps newly joined team members get up to speed quickly.

  3. Auto-Generating Release Notes and Documentation: Based on the context of merged PRs, asking AI to “Draft release notes for these changes” significantly reduces documentation effort.

Comparison with Similar Tools

Here is a more comprehensive comparison with the alternatives mentioned earlier:

Comparison Item pr-dump PR-Agent GitHub Copilot Chat
Primary Purpose Consolidates entire PR context into input for humans or AI Automates PR workflows, performing reviews and generating descriptions Ask questions about code diffs directly on the PR page, assisting reviews
Execution Environment Local CLI GitHub Actions (CI/CD) GitHub PR page
Context Scope Entire PR (metadata, all comments, diff) Primarily the PR code diff Code diff within the PR (scope automatically fetched by Copilot)
Best Use Case Assisting complex PR reviews, asking detailed questions to AI Automating routine PR reviews, auto-generating descriptions Asking specific questions about code diffs, suggesting review comments
Cost Free (open source) Free (open source, but backend requires API keys such as OpenAI) Requires a GitHub Copilot subscription

To sum up in one sentence: PR-Agent and Copilot Chat review for you; pr-dump prepares the material for review. They are not in competition, but can be used together.

Conclusion

I believe tools like pr-dump that bridge the gap between existing platforms and AI for developers will become increasingly important. Right now it is just a small tool born out of solving my personal problem, but I believe it has the potential to boost productivity for many developers in modern software engineering coexisting with AI.

Feel free to try it out and share your feedback.

© 2026 CheerChen's Blog

🌱 Powered by Hugo with theme Dream.

About

hi Hi, I’m CheerChen.