ClaudeMods
☰
ZH-TW
● 0 人在線上 · 瀏覽 0 次
贊助提交作品
GitHub 儲存庫 · 發布者 2bo

pr-inbox

一個用於審查請求的收件箱(最早的在前,包含 AI 摘要、風險和發布影響)以及你自己的 PR(最需要優先處理的),支援從窗格中解釋和批准

已翻譯

關於這個 mod

pr-inbox

一個 Claude Code 外掛,將你的審查請求和你自己的拉取請求轉變成一個收件箱,按需要優先順序排序。

  • 提示列下方的狀態行保持計數可見(review 3 ⚙2 · ▲1 high │ mine ✗1 fix · ✓1 ship · …2 wait)
  • /pr-inbox 打開一個窗格,風格類似 lazygit 和 gh-dash:每個 PR 一行(風險或狀態、等待時間熱力條、CI、AI 審查),選中的 PR 的詳情在列表下方,快捷鍵在底部。兩個分頁
    • 待審查:審查請求,最長等待時間優先。每個 PR 獲得 AI 摘要、風險等級(低/中/高)及其對發布的影響(對使用者可見/不可見/無法判斷),考慮功能旗標
    • 我的 PR:需要操作(請求變更、CI 失敗、衝突)→ 可合併 → 等待審查 → 過期。失敗的 CI 檢查與其執行連結一起列出
  • 當新的審查請求到達時,通知訊息會告知你,當你的 PR 被批准、要求變更或 CI 失敗時也會通知。新的審查請求也會觸發作業系統通知(macOS 和 Linux),所以你可以在 Claude Code 外也看到它們

待審查分頁:每行一個審查請求及其風險、等待時間和 CI,選中的 PR 的摘要和發布影響顯示在下方

使用 Claude Code v2.1.288 測試。外掛需要 v2.1.287 或更高版本。

安裝

在 Claude Code 中:

/plugin marketplace add 2bo/pr-inbox
/plugin install pr-inbox@pr-inbox

或從 shell:claude plugin marketplace add 2bo/pr-inbox && claude plugin install pr-inbox@pr-inbox。

使用

| 快捷鍵 | 動作 | | :- | :- | | 1 / 2 | 待審查 / 我的 PR | | j / k | 選擇下一個 / 上一個 PR | | e | 要求 Claude 解釋 PR(對你自己的 PR,診斷阻礙因素)。Claude 讀取描述、評論、審查和相關問題與 PR,不僅是差異 | | a | 批准(僅在確認對話中選擇 批准 後執行,其中 取消 被先選中) | | v | AI 審查,如果通過則批准(見下文)。再按 v 取消正在執行的審查 | | d | 差異,一次一個檔案,繪製方式類似 Claude Code 自身的差異:n / b 下一個/上一個檔案,l 檔案清單,q 返回 PR。鎖定檔案和產生的檔案被折疊(g 顯示它們);AI 審查在檔案中的發現列出在上方 | | i | 資訊:AI 審查的每個發現,包含行連結 | | n | 當資訊不適合窗格時的下一頁(在末尾返回頂部) | | x | 暫停 PR 直到更新(z 顯示暫停的 PR) | | w | AI 審查每個尚未審查的機器人 PR,一次一個(再按 w 停止) | | m | 合併一個可以合併的 PR,在選擇方法後(固定到螢幕上的提交) | | c | 重新執行你 PR 的失敗 GitHub Actions 工作 | | f | 按儲存庫、編號、標題或 @作者 篩選(Enter 保留;空的清除) | | h | 顯示快捷鍵 | | Ctrl+X Tab | 從提示列返回窗格(或點選它)。窗格有焦點時快捷鍵才能到達窗格。提示列下方的提示行說明哪邊要去 | | o | 在瀏覽器中開啟 | | b / s / z | 顯示或隱藏機器人 PR / 過期 PR / 暫停的 PR | | r | 再次擷取 | | Esc | 返回提示列;窗格保持開啟 | | q | 關閉窗格(/pr-inbox 重新開啟) |

● 標記自你上次選擇後更新的 PR。你批准的 PR 會離開待審查,因為 GitHub 刪除審查請求;從這裡批准的 PR 在 "最近批准" 下列出一天。

PR 編號和失敗的檢查是超連結:在支援超連結的終端中 Cmd+click 它們。

/pr-inbox refresh 再次擷取並列印計數,不開啟窗格。

AI 審查和批准

在審查請求上按 v 從多個角度執行審查,每個是獨立的模型呼叫,通過時批准 PR:

  1. 檢查點,在程式碼中檢查:不是草稿、CI 通過(或沒有)、無合併衝突、無審查人請求變更
  2. 篩選:描述、差異和評論被檢查是否有指向 AI 的指令(提示注入)由小模型檢查,PR 被檢查是否有對 AI 指令的變更(CLAUDE.md、.claude/ 規則、技能、子任務程式等)。接下來發生什麼取決於誰決定:當批准在沒有你的情況下進行時(ai_approve auto 適用於作者),這些中的任何一個都會停止審查;當你在對話中批准時,審查繼續並在窗格、對話和記錄中顯示為 ⚠ 警告
  3. 審查人,並行在 review_model 上(預設 Sonnet)。每個首先說它需要讀什麼(PR 頭的檔案、程式碼搜尋、上游發布說明);外掛檢查請求、擷取並篩選,然後審查人審查:
    • 目的與範圍:是否做了描述和相關問題要求的,沒有不必要的複雜性或無關變更
    • 正確性與相容性:bug、重大變更、遷移、回滾、效能
    • 測試:是否測試了變更的行為
    • 安全與祕密
    • 約定:儲存庫的 CLAUDE.md、AGENTS.md、REVIEW.md、CONTRIBUTING.md 和模式。這些指南、.claude/rules/ 中的規則以及審查人要求的任何 AI 指令(技能、子任務程式定義、命令、嵌套 CLAUDE.md、Cursor 或 Copilot 指令)從基分支讀取,所以 PR 無法重寫它被審查的規則。它們按設計與 AI 交談,所以它們與 PR 內容分開給出,不進行注入篩選
    • 對於 Dependabot 和 Renovate PR,改為:升級影響(直接或在鎖定檔案中變更的每個套件;上游發布說明和變更日誌;此儲存庫是否使用變更的)和 供應鏈
  4. 驗證:重要發現(信心度 80+)轉到驗證者嘗試根據程式碼反駁它們
  5. 決定,在程式碼中:僅當每個檢查點保持、無任何內容看起來像注入、每個審查人都回答、無重要發現存活和 PR 無新提交時才通過。注項不阻止

在 PR 下方,結果首先出現,然後每個角度的結論用一兩句話:✓ 無問題、✗ 阻止批准、△ 發現不阻止的東西(低信心度或被驗證者反駁)、? 無法判斷。i 顯示每個發現及其證據和行連結。在批准對話前,結論和發現也寫入記錄。

僅每個審查人角度內的問題計數,從兩個角度發現的同一問題顯示一次。結果為審查的提交保留,所以重啟後仍在那裡;當新提交到達時,行說審查是較早提交的。

當通過時,ai_approve 決定:confirm(預設)先問你;auto 為儲存庫的成員和協作者以及 Dependabot 或 Renovate 的 PR 立即批准,但仍為任何人和分支問。批准固定到審查的提交。結果顯示在 PR 和記錄下方。

一次審查對每個角度進行約兩個 Sonnet 呼叫加驗證者和幾個小篩選呼叫,在你的計畫上。通常不到一分鐘。

要求

  • GitHub CLI,使用 gh auth login 登入。外掛透過 gh 擷取、差異和批准 PR,因為帳戶 gh 登入到

設定

使用 /config 或 /plugin configure 變更它們。

| 設定 | 預設 | 功能 | | :- | :- | :- | | org_filter | (空) | 僅顯示此 GitHub 組織中的 PR | | stale_days | 30 | 將未更新超過這麼多天的 PR 折疊在 Stale 下 | | refresh_minutes | 5 | 多久從 GitHub 擷取一次 | | summary_model | sonnet | 寫摘要、風險和發布影響的模型 | | desktop_notify | review requests | review requests 的作業系統通知,all(也批准、請求變更和你 PR 的 CI 失敗)或 off。在 macOS 上使用 osascript,在 Linux 上使用 notify-send。在 macOS 上,在系統設定中為指令稿編輯器允許通知,如果沒有出現 | | analysis | auto | 何時分析審查請求:auto(從啟動)、when opened(一旦你在工作階段中開啟 /pr-inbox)或 off | | ai_approve | confirm | v 當 AI 審查通過時做什麼:confirm 或 auto | | review_model | sonnet | AI 審查的模型 | | review_purpose / review_correctness / review_tests / review_security / review_conventions | (內置) | 每個審查人的指令。off 跳過該角度 | | review_dependency_impact / review_supply_chain | (內置) | 相同,對於 Dependabot 和 Renovate PR | | explain_prompt | (內置) | e 對審查請求問什麼。{url} 變成 PR URL | | risk_high / risk_medium / risk_low | (內置) | 什麼在分析中計為每個風險等級 | | release_impact | (內置) | 如何判斷對發布的影響(是/否/未知) | | language | auto | AI 摘要、風險和發布影響的語言 |

將提示設定留空以使用內置文字。無論你寫什麼,外掛仍新增指令以讀評論和相關問題(對 e)和規則以保持 PR 內容不受信任和 e 唯讀。變更標準重新執行儲存的分析。

選單是英文的。AI 分析及其標籤遵循 language:

  1. language 設定為非 auto 的任何東西,如 English 或 Japanese
  2. 否則 Claude Code 的 language 設定
  3. 否則終端區域設定(LC_ALL、LC_MESSAGES,然後 LANG)
  4. 否則英文

當語言是日文時標籤是日文的,否則是英文的。分析本身用選擇的任何語言編寫。

分析呼叫一次模型每個 PR,在你的計畫上。結果與 PR 的更新時間和語言一起儲存,僅當 PR 變更或語言變更時重新執行。失敗的分析在 15 分鐘、30、60 和 120 後重試,然後保持到 PR 變更。一小時最多 30 個分析啟動。

當 PR 太大而無法完全讀取(超過 30,000 字元的差異、4,000 的描述或 300 個檔案)時,分析說這樣(judged on part of the PR)並且永遠不會評為低風險。

安全

  • PR 內容是不受信任的輸入。 任何可以開啟 PR 並請求你審查的人控制其標題、內容、差異和 CI 輸出,並可能在模型處植入指向它的指令
    • 分析呼叫沒有工具,僅返回文字。PR 內容用隨機標記圍挡,模型被告知不遵循其中的指令。不可見的 Unicode 標籤字元首先被移除
    • 當你按 e 時,該輪在外掛強制的唯讀保護下執行:僅讀、Grep、Glob 和唯讀 gh pr view、gh pr diff、gh pr checks、gh issue view、gh run view、gh run list 和 gh api PR 或問題評論和審查的 GET 請求可以執行。編輯、其他命令、Web 存取、子任務程式、批准、評論和推送被拒絕,即使你的權限模式或允許規則會讓它們通過。保護以該輪結束;你接下來問的任何東西用你工作階段的常規權限執行
  • AI 審查(v)。 根據 Anthropic 關於間接提示注入和雙 LLM 模式的指導建立。批准從審查人的結構化答案在程式碼中決定,永遠不由模型決定。審查的模型沒有工具:它們無法執行命令、讀本機檔案、到達網路或寫任何東西。它們僅讀外掛從審查中的 PR 擷取的(和,對於相依更新,上游發布說明和 GitHub 上的檔案);他們要求讀的驗證首先。內容到達它們作為標記為不受信任的 JSON、進行注入篩選的螢幕,不可見字元剝除。

安裝

請先查看作者 README,確認 marketplace 與外掛名稱;指令可能隨儲存庫結構而變動。

claude plugin marketplace add 2bo/pr-inbox
claude plugin install pr-inbox
原文 / README

pr-inbox

A Claude Code mod that turns your review requests and your own pull requests into an inbox, ordered by what needs you next.

  • A status line under the prompt keeps the counts in view (review 3 ⚙2 · ▲1 high │ mine ✗1 fix · ✓1 ship · …2 wait)
  • /pr-inbox opens a pane in the spirit of lazygit and gh-dash: one line per PR (risk or state, how long it has waited as a heat bar, CI, AI review), the selected PR's details under the list, and the keys on the bottom line. Two tabs
    • To review: review requests, the longest-waiting first. Each PR gets an AI summary, a risk level (low / medium / high) and its impact on release (visible to users / not visible / cannot tell), taking feature flags into account
    • My PRs: needs action (changes requested, CI failed, conflict) → ready to merge → waiting for review → stale. Failed CI checks are listed with links to their runs
  • A toast tells you about new review requests, and when your PRs are approved, get changes requested or fail CI. New review requests also raise an OS notification (macOS and Linux), so you see them outside Claude Code too

The To review tab: one line per review request with its risk, wait and CI, and the selected PR's summary and release impact below

Tested with Claude Code v2.1.288. Mods need v2.1.287 or later.

Install

In Claude Code:

/plugin marketplace add 2bo/pr-inbox
/plugin install pr-inbox@pr-inbox

Or from the shell: claude plugin marketplace add 2bo/pr-inbox && claude plugin install pr-inbox@pr-inbox.

Usage

| Key | Action | | :- | :- | | 1 / 2 | To review / My PRs | | j / k | Select the next / previous PR | | e | Ask Claude to explain the PR (for your own PR, to diagnose what blocks it). Claude reads the description, comments, reviews and linked issues and PRs, not only the diff | | a | Approve (runs only after you choose Approve in the confirmation dialog, where Cancel is selected first) | | v | AI review, then approve if it passes (see below). v again cancels a running review | | d | The diff, one file at a time, drawn like Claude Code's own diffs: n / b next and previous file, l the list of files, q back to the PRs. Lockfiles and generated files are folded (g shows them); the AI review's findings in a file are listed above it | | i | Info: every finding of the AI review, with links to the lines | | n | Next page of the info when it does not fit the pane (at the end, back to the top) | | x | Snooze the PR until it is updated (z shows snoozed PRs) | | w | AI review every bot PR not reviewed yet, one at a time (w again stops) | | m | Merge one of your PRs that is ready, after picking a method (pinned to the commit on screen) | | c | Re-run the failed GitHub Actions jobs of one of your PRs | | f | Filter by repository, number, title or @author (Enter keeps it; an empty one clears it) | | h | Show the keys | | Ctrl+X Tab | From the prompt back to the pane (or click it). Keys reach the pane only while it has the focus. The hint line under the prompt says which way to go | | o | Open in the browser | | b / s / z | Show or hide bot PRs / stale PRs / snoozed PRs | | r | Fetch again | | Esc | Back to the prompt; the pane stays open | | q | Close the pane (/pr-inbox opens it again) |

● marks PRs updated since you last selected them. A PR you approve leaves To review, as GitHub drops the review request; PRs approved from here stay listed under it as "Approved recently" for a day.

PR numbers and failed checks are hyperlinks: Cmd+click them in a terminal that supports hyperlinks.

/pr-inbox refresh fetches again and prints the counts without opening the pane.

AI review and approve

v on a review request runs a review from several perspectives, each an independent model call, and approves the PR when it passes:

  1. Gates, checked in code: not a draft, CI passed (or there is none), no merge conflict, no reviewer requested changes
  2. Screening: the description, diff and comments are checked for instructions aimed at an AI (prompt injection) by a small model, and the PR is checked for changes to AI instructions (CLAUDE.md, .claude/ rules, skills, subagents and the like). What happens next depends on who decides: when the approval would go through without you (ai_approve auto for an author it applies to), any of these stops the review; when you approve in the dialog, the review goes on and they are shown as ⚠ warnings in the pane, the dialog and the transcript
  3. Reviewers, in parallel on review_model (Sonnet by default). Each first says what else it needs to read (files at the PR head, code searches, upstream release notes); the mod checks the request, fetches and screens it, then the reviewer reviews:
    • Purpose & scope: does it do what the description and linked issues ask, without needless complexity or unrelated changes
    • Correctness & compatibility: bugs, breaking changes, migrations, rollback, performance
    • Tests: is the changed behavior tested
    • Security & secrets
    • Conventions: the repository's CLAUDE.md, AGENTS.md, REVIEW.md, CONTRIBUTING.md and patterns. These guides, the rules in .claude/rules/, and any AI instruction a reviewer asks for (skills, subagent definitions, commands, nested CLAUDE.md, Cursor or Copilot instructions) are read from the base branch, so a PR cannot rewrite the rules it is reviewed by. They talk to AI by design, so they are given apart from the PR content and not screened for injection
    • For Dependabot and Renovate PRs, instead: Upgrade impact (every package that changes, directly or in the lockfile; upstream release notes and changelogs; whether this repository uses what changed) and Supply chain
  4. Verification: important findings (confidence 80+) go to a verifier that tries to refute them against the code
  5. Decision, in code: it passes only when every gate holds, nothing looked like an injection, every reviewer answered, no important finding survived and the PR got no new commits. Nits do not block

Under the PR, the outcome comes first, then each perspective's conclusion in a sentence or two: ✓ no problems, ✗ blocks the approval, △ found something that does not block (low confidence, or refuted by the verifier), ? could not tell. i shows every finding with its evidence and a link to the line. Before the approval dialog, the conclusions and findings are also written to the transcript.

Only problems within each reviewer's perspective count, and the same problem found from two perspectives is shown once. The result is kept for the reviewed commit, so it is still there after a restart; when new commits arrive, the row says the review is of an older commit.

When it passes, ai_approve decides: confirm (default) asks you first; auto approves at once for PRs from members and collaborators of the repository and from Dependabot or Renovate, and still asks for anyone else and for forks. The approval is pinned to the reviewed commit. The outcome shows under the PR and in the transcript.

A review makes about two Sonnet calls per perspective plus the verifier and several small screening calls, on your plan. It usually takes under a minute.

Requirements

  • GitHub CLI, signed in with gh auth login. The mod fetches, diffs and approves PRs through gh, as the account gh is signed in to

Settings

Change them with /config or /plugin configure.

| Setting | Default | What it does | | :- | :- | :- | | org_filter | (empty) | Only show PRs in this GitHub organization | | stale_days | 30 | Fold your PRs not updated for this many days under Stale | | refresh_minutes | 5 | How often to fetch from GitHub | | summary_model | sonnet | The model that writes the summary, risk and release impact | | desktop_notify | review requests | OS notifications for review requests, all (also approvals, changes requested and CI failures on your PRs) or off. Uses osascript on macOS and notify-send on Linux. On macOS, allow notifications for Script Editor in System Settings if none appear | | analysis | auto | When review requests are analyzed: auto (from startup), when opened (once you open /pr-inbox in the session) or off | | ai_approve | confirm | What v does when the AI review passes: confirm or auto | | review_model | sonnet | The model of the AI review | | review_purpose / review_correctness / review_tests / review_security / review_conventions | (built-in) | Instructions for each reviewer. off skips that perspective | | review_dependency_impact / review_supply_chain | (built-in) | The same, for Dependabot and Renovate PRs | | explain_prompt | (built-in) | What e asks about a review request. {url} becomes the PR URL | | risk_high / risk_medium / risk_low | (built-in) | What counts as each risk level in the analysis | | release_impact | (built-in) | How to judge the impact on release (yes / no / unknown) | | language | auto | The language of the AI summary, risk and release impact |

Leave the prompt settings empty to use the built-in text. Whatever you write, the mod still adds the instruction to read comments and linked issues (for e), and the rules that keep PR content untrusted and e read-only. Changing the criteria redoes the stored analyses.

The menus are in English. The AI analysis and its labels follow language:

  1. language set to anything other than auto, such as English or Japanese
  2. Otherwise Claude Code's language setting
  3. Otherwise the terminal locale (LC_ALL, LC_MESSAGES, then LANG)
  4. Otherwise English

The labels are in Japanese when the language is Japanese, and in English otherwise. The analysis itself is written in whatever language is chosen.

The analysis calls the model once per PR, on your plan. Results are stored with the PR's update time and language, and are redone only when the PR changes or the language does. A failed analysis is retried after 15 minutes, then 30, 60 and 120, and then left until the PR changes. At most 30 analyses start in an hour.

When a PR is too large to read whole (more than 30,000 characters of diff, 4,000 of description or 300 files), the analysis says so (judged on part of the PR) and never rates it low risk.

Security

  • PR content is untrusted input. Anyone who can open a PR and request your review controls its title, body, diff and CI output, and may plant instructions aimed at the model
    • The analysis call has no tools and only returns text. The PR content is fenced with a random marker, and the model is told not to follow instructions in it. Invisible Unicode tag characters are removed first
    • When you press e, that turn runs under a read-only guard enforced by the mod: only Read, Grep, Glob and the read-only gh pr view, gh pr diff, gh pr checks, gh issue view, gh run view, gh run list, and gh api GET requests for a PR's or issue's comments and reviews can run. Edits, other commands, web access, subagents, approvals, comments and pushes are refused, even if your permission mode or allow rules would let them through. The guard ends with that turn; anything you ask next runs with your session's usual permissions
  • AI review (v). Built along Anthropic's guidance on indirect prompt injection and the dual-LLM pattern. The approval is decided in code from the reviewers' structured answers, never by a model. The review's models have no tools: they cannot run commands, read local files, reach the network or write anything. They read only what the mod fetched from the PR under review (and, for dependency updates, upstream release notes and files on GitHub); what they ask to read is validated first. Content reaches them as JSON labeled as untrusted, screened for injected instructions, with invisible characters stripped. Any error, timeout or unparsable answer blocks the approval; a suspected injection blocks it when no person approves, and is a ⚠ warning when you do. auto is still a choice to trust an AI judgment: keep it to repositories where that is acceptable, and keep branch protection and required reviews as the last line
  • The analysis is a hint. Do not approve on the strength of the risk or impact judgment. Approve runs only after you choose Approve in the confirmation dialog, which names the commit on screen. The approval is pinned to that commit, and it is refused if the PR got new commits in the meantime. Turning on "Dismiss stale pull request approvals" in your repositories' branch rules adds a second line of defense
  • Displayed text is sanitized. Terminal escape sequences, control characters, bidirectional override characters and invisible characters are stripped from PR titles, author names, check names and model output before they are drawn. The diff (d) is drawn by Claude Code's own highlighter, line by line with the same characters stripped (tabs kept), and is never sent to a model. Links open only canonical https:// URLs. Failed-check links point wherever the CI system says, which may be a third-party site
  • What is sent, and when. With analysis on auto, as soon as Claude Code starts (including claude -p runs and sessions in other projects) and on every refresh, each review request that has not been analyzed yet is sent to the model Claude Code is configured with (Anthropic, or your Bedrock, Vertex or gateway setup), under your account: its repository and number, author, title, list of changed files, description (first 4,000 characters) and diff (first 30,000 characters). You do not have to open the pane. Follow your organization's rules for work code: narrow it with org_filter, or set analysis to when opened or off
  • What is stored locally. In Claude Code's plugin store (~/.claude/plugins/store/): the URLs of your review requests and the state of your own PRs (to notice changes), each analysis (summary, risk, release impact), each AI review's findings, snoozed PRs and which updates you have seen. Analyses of PRs that are no longer open are deleted on the next refresh
  • Access. All GitHub access goes through gh; the mod holds no token. OS notifications go through osascript or notify-send, with the text passed as arguments, never as script. Commands run as argument lists, without a shell

Development

pnpm install
claude --plugin-dir .   # run the working copy; loading once also writes the type declarations to .claude-plugin/types/ (needed by typecheck)
pnpm run check          # validate (--strict) → tsc → Biome → claude plugin test

pnpm run demo starts Claude Code with the mod against made-up PRs: a fake gh (scripts/demo/gh) answers every GitHub call, so nothing real is read or written, and approvals and merges go nowhere. The mod's real state is set aside and put back when you /exit. It is also how the screenshot is taken.

Tests live in tests/*.test.ts. GitHub, the model, the store and the environment are all stubbed, so tests make no network calls.

License

MIT

更多類似作品