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

pr-watch

Claude Code 外掛,在提示列上方畫出 Claude 開啟的每個 pull request:GitHub 工作流程進度列、可合併狀態、失敗工作、封鎖原因、合併進基底分支,以及推送分支的檢查。

oakoss@oakoss

oakoss/claude-plugins/tree/main/plugins/pr-watch

已翻譯

關於這個 mod

pr-watch 會監看 Claude 透過 Bash 工具執行的 gh pr create 輸出中的 pull request,以及它在那裡執行 git push 輸出中的分支。每個 pull request 從建立到關閉,或檢查通過並合併前,都會在提示列上方顯示一行:執行中的工作流程附估算進度列、✓ ready to merge、失敗的工作名稱與日誌連結、封鎖原因(衝突、要求變更、分支落後、未命名規則)、等待狀態,以及跟隨基底分支執行結果的合併行。推送的分支會有自己的 ⟳ push <branch> 行。它透過 gh api graphql 輪詢(執行中每 10s、等待某人時每 60s,推送/合併/重新執行時加速),需要先登入主機的 gh,並持續到工作階段結束。安裝:先執行 claude plugin marketplace add oakoss/claude-plugins,再執行 claude plugin install pr-watch@oakoss。以 Claude Code 2.1.289 建置和測試。

安裝

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

claude plugin marketplace add oakoss/claude-plugins
claude plugin install pr-watch
原文 / README

pr-watch

A line above the Claude Code prompt for each pull request Claude opens, from the moment gh pr create prints its URL until the pull request closes, or until its merge has run its checks on the base branch. A branch Claude pushes gets a line too, until its checks pass.

#128 ● CI ████████████▏░░░░░░░░░░░ 1m11s / ~2m20s · CodeQL ✓ · Dependency Review ●
#128 ✓ ready to merge
#128 ✗ CI: Typecheck failed
#128 ⚠ conflicts
#128 merged into main · ● Release ████▏░░░░░░░░░░░░░░ 0m21s / ~1m40s · CI ●
#128 merged into main · ✓ checks passed
⟳ push feat/x · ● CI ███████▏░░░░░░░░░░░░░░░░░ 0m40s / ~2m20s

What it shows

  • Running. Of the running workflows that hold a required check (any running one when nothing on the commit is required), the longest gets a progress bar. Its length is that workflow's last successful run, so the bar stops short of full until the run ends; a workflow with no successful run shows only the time so far, and a re-run shows re-run, since GitHub keeps its first attempt's start time. The other workflows follow as marks: ✓ passed, ✗ failed, ● running.
  • Ready to merge. GitHub reports the pull request mergeable: required checks pass, no review blocks it, and it has no conflicts.
  • Failing. A job failed in a workflow that holds a required check, or in any workflow when nothing on the commit is required. The line names that job rather than a summary job that failed on it, and links to its log.
  • Blocked. Conflicts, changes requested, a branch behind its base, or a rule GitHub does not name (⚠ blocked).
  • Waiting. On a review, on a required check from a GitHub App, on GitHub to start the checks, on GitHub to work out the merge state, or on a draft to be marked ready.
  • Merged. The line names the base branch, #128 merged into main, and follows the merge commit's runs there, every workflow counting, with the same bar and marks. Once they finish it reads ✓ checks passed or names the job that failed. It keeps reading for 90 seconds after the merge in case a later run starts. A passed merge then leaves the band a few seconds later. A failed one stays, read once a minute, until a re-run passes, and then leaves the same way; the × removes it sooner. A merge whose commit starts no runs within 90 seconds leaves the band.
  • Pushed. A branch Claude pushes with git push gets a line, ⟳ push <branch>, that follows the runs on the branch's newest commit the way a merged line does: it reads ✓ checks passed or names the job that failed, and leaves the same way. A branch that is the head of an open pull request hands its line to that pull request instead, upstream when the branch is on a fork. A push that moved no branch, such as a delete, a tag or Everything up-to-date, adds none, and neither does a git push -q, which prints nothing to read. A --dry-run prints what a push would, so it gets a line: a new branch leaves at its first read, and an existing one shows its current checks. A branch gone by the time it is read leaves at once, and one that cannot be read at all, such as on a host gh does not know, leaves once 90 seconds have passed.

When a workflow has run more than once on the same commit, only its newest run counts.

Once nothing the merge waits on is running, a workflow it does not wait on still shows as a mark while it runs or after it fails.

A toast says when a pull request turns ready to merge, a job fails in a workflow the merge waits on, or a merge's runs on the base branch pass or fail, once per change. A line says why when gh fails, and · more checks not shown when a commit has more check suites than one read returns (100). Hover a line and press × to stop watching it. A pull request closed without merging leaves the band.

pr-watch draws above whatever other plugins draw in the same band, rather than replacing it.

How it works

  • It watches the pull request in the output of a gh pr create that Claude runs through its Bash tool, and the branches in the output of a git push it runs there. Pull requests opened and branches pushed from your own terminal or a GitHub tool are not seen.
  • It reads each pull request with one gh api graphql call: every 10 seconds while any workflow runs or GitHub is still settling, every 60 seconds while it waits on a person. When Claude runs git push, gh pr merge, gh run rerun or gh workflow run, it reads every watched pull request at once and every 5 seconds for the next minute, while GitHub starts the new runs. Each workflow's length comes from one gh api call the first time pr-watch sees it, asked again a minute later if that call fails.
  • It needs gh, logged in to the pull request's host. GitHub Enterprise hosts are passed to gh as --hostname.
  • Watched pull requests last for the session; a new session starts with none.

Install

claude plugin marketplace add oakoss/claude-plugins
claude plugin install pr-watch@oakoss

pr-watch is a mod: Claude Code runs its hooks module itself. It is built and tested against Claude Code 2.1.289.

其他同名作品

更多類似作品