Version 1.1.0
Export GitHub and Bitbucket Cloud PR review comments to an AI-friendly Markdown file, so your AI coding assistant gets the full context without manual copy-paste.
When working with an AI assistant on a pull request, explaining reviewer feedback is tedious:
- You copy-paste comments manually
- The AI has no context about which line the comment refers to
- You lose the diff context
- Threading and replies are hard to follow
pr-bridge solves this by fetching PR review data and formatting it into a structured Markdown file that any AI agent can read directly.
| Provider | URL format | Auth |
|---|---|---|
| GitHub | https://github.com/owner/repo/pull/123 |
GitHub CLI (gh) |
| Bitbucket Cloud | https://bitbucket.org/workspace/repo_slug/pull-requests/123 |
Bitbucket Cloud REST API token |
Bitbucket Server/Data Center is not supported yet.
- Python 3.11+
- GitHub CLI (
gh) for GitHub PRs (optional if you store a token withpr-bridge auth github) - A Bitbucket Cloud API token for Bitbucket PRs
- uv only if installing directly from GitHub
The recommended way to authenticate is the built-in auth command. It prompts
for your credentials and stores them in a cross-platform config file, so you do
not have to set environment variables (which differ between PowerShell, cmd,
and POSIX shells):
pr-bridge auth bitbucket
pr-bridge auth githubSecrets are entered hidden and saved with owner-only permissions to:
| OS | Location |
|---|---|
| Windows | %APPDATA%\pr-bridge\credentials.json |
| macOS / Linux | $XDG_CONFIG_HOME/pr-bridge/credentials.json (default ~/.config/pr-bridge/credentials.json) |
Bitbucket serves the PR diff from the repository, so the token needs both of
these Read scopes — a common gotcha is granting only read:pullrequest, which
lets comments through but returns 403 on the diff:
read:pullrequest:bitbucketread:repository:bitbucket
Create the token at id.atlassian.com → Security → API tokens:
-
Name and expiry — give it a name (e.g.
pr-bridge) and an expiry date. -
Select app — choose Bitbucket.
-
Select scopes — check both
read:pullrequest:bitbucketandread:repository:bitbucket. -
Create token — review and create. Copy the token (you can't view it again).
Then run pr-bridge auth bitbucket and paste your Atlassian account email and
the token.
Note: API tokens are immutable — you can't add a scope to an existing token. If a token is missing
read:repository:bitbucket, create a new one.
Environment variables still work and take precedence over the stored file, which is handy for CI:
# Bitbucket Cloud API token
export BITBUCKET_EMAIL="you@example.com"
export BITBUCKET_API_TOKEN="your-api-token"
# Or a Bitbucket OAuth/access token
export BITBUCKET_ACCESS_TOKEN="your-access-token"
# GitHub (also honored by the gh CLI)
export GH_TOKEN="your-github-token"For GitHub you can alternatively just run gh auth login.
pip install pr-bridgeOr with uv:
uv tool install pr-bridgeuv tool install git+https://github.com/filipembedded/pr-bridge.git
git clone https://github.com/filipembedded/pr-bridge.git
cd pr-bridge
uv tool install -e .Install uv if you do not have it yet:
curl -LsSf https://astral.sh/uv/install.sh | sh# One-time: store credentials (see Authentication above)
pr-bridge auth bitbucket
pr-bridge auth github
# Fetch all review comments for a GitHub PR
pr-bridge fetch https://github.com/owner/repo/pull/123
# Fetch all review comments for a Bitbucket Cloud PR
pr-bridge fetch https://bitbucket.org/workspace/repo_slug/pull-requests/123
# Fetch only unresolved/open threads
pr-bridge fetch https://bitbucket.org/workspace/repo_slug/pull-requests/123 --filter unresolved
# Save output to a specific directory
pr-bridge fetch https://github.com/owner/repo/pull/123 --output ./reviews/
# Save to a specific file
pr-bridge fetch https://bitbucket.org/workspace/repo_slug/pull-requests/123 --output my-review.md
# Exclude general (non-inline) comments
pr-bridge fetch https://github.com/owner/repo/pull/123 --no-generalThe output file is saved as pr-<NUMBER>-<owner>-<repo>.md in the current directory, unless you provide a different output path.
The generated Markdown is structured for AI consumption:
# PR #123: Fix something important
- Repository: owner/repo
- Author: @someone
- State: open
- Branch: `fix/something` -> `main`
## Review Summaries
- @reviewer - `CHANGES_REQUESTED` (2024-01-15)
## Inline Review Comments
---
## File: `src/main.c`
### Thread 1 - `src/main.c` (line 42) [**OPEN**]
**Diff context:**
```diff
+int foo() {
+ return bar;
+}
```
**@reviewer** (member) - 2024-01-15
[view on GitHub](https://github.com/...)
This function is never called. Consider removing it.For Bitbucket output, provider links are rendered as view on Bitbucket.
| Option | Description |
|---|---|
--filter all |
Show all threads (default) |
--filter unresolved |
Show only unresolved/open threads |
--output PATH |
Output directory or file (default: current directory) |
--no-general |
Exclude general PR comments |
--version |
Show version |
- Parses the PR URL and detects GitHub or Bitbucket Cloud.
- For GitHub, uses
gh apito fetch inline comments, general comments, and review summaries. - For Bitbucket Cloud, uses the REST API to fetch PR metadata, comments, participants, and diff context.
- Groups inline comments into threads.
- Renders everything as structured Markdown.
- Saves the file locally for your AI assistant to read.
For GitHub unresolved filtering is inferred from replies because the GitHub REST endpoint used here does not expose thread resolution. For Bitbucket Cloud, unresolved filtering uses Bitbucket's comment thread resolution data.
Contributions are welcome. Please open an issue or pull request on GitHub.
MIT



