oakoss/claude-plugins/tree/main/plugins/pr-watch
pr-watch
Claude Code 插件,在提示栏上方绘制 Claude 打开的每个 pull request:GitHub 工作流进度条、可合并状态、失败任务、阻塞原因、合并进基分支,以及推送分支检查。
关于这个 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 passedor 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 pushgets a line,⟳ push <branch>, that follows the runs on the branch's newest commit the way a merged line does: it reads✓ checks passedor 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 orEverything up-to-date, adds none, and neither does agit push -q, which prints nothing to read. A--dry-runprints 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 hostghdoes 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 createthat Claude runs through its Bash tool, and the branches in the output of agit pushit 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 graphqlcall: every 10 seconds while any workflow runs or GitHub is still settling, every 60 seconds while it waits on a person. When Claude runsgit push,gh pr merge,gh run rerunorgh 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 onegh apicall 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 toghas--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.