cc-pr-tracker
Watch GitHub PRs from a Claude Code session: merge state, review and required checks above the prompt, with alerts when they change
何をするか
- プロンプトの上の帯・欄・トーストを描く
- Bash の呼び出しを見張る(止めることがある)
- config.describe・config.set・prompt.submit・session.end ほか 2 個にフックする
- ターンをまたいで自分の状態を持つ
- プロセスを起こす
良いところ
- ネットワークに出ない
- TypeScript で書かれている
- エラーを扱う
- ファイルを書かない
作り始めるためのコード
2 種類あります。上のデザインから modscode が書いた雛形と、その Mod 自身のコードのうち描いている部分です。
雛形(register.tsx)
import type { Register } from 'claude-code'
// Drawn like cc-pr-tracker by Seza Akgün (pane, band, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/sezaakgun-cc-pr-tracker/
// Written by modscode from that reading, not copied from the mod: use it as you like.
// Each value below stands for one the mod works out at run time; put in your own.
export const register: Register = on => {
// the band above the prompt; what else goes there is drawn under it
on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
const { Box, Text, Link, Button } = $.ui.resolve(e)
const url = '…'
const label = '…'
const mergeStateStatus = '…'
const reviewOf = '…'
const n = '…'
const otherFails = '…'
const title = '…'
const label2 = '…'
const mergeStateStatus2 = '…'
const reviewOf2 = '…'
const label3 = '…'
const mergeStateStatus3 = '…'
const reviewOf3 = '…'
return (
<Box flexDirection="column">
<Box backgroundColor="white">
<Text color="black" backgroundColor="white" bold>
{" ● PR checks changed"}
</Text>
</Box>
<Box flexDirection="row">
<Box flexShrink={0}>
<Link href={`${url}`}>
<Text dimColor strikethrough>
{label}
</Text>
</Link>
</Box>
<Text wrap="truncate-end">
<Text dimColor>
{" "}
</Text>
<Text color="gray">
{mergeStateStatus}
</Text>
<Text dimColor>
{" · "}
</Text>
<Text color="gray">
{reviewOf}
</Text>
<Text dimColor>
{" · "}
</Text>
<Text color="green">
{`✓${n}`}
</Text>
<Text color="red">
{` ✗${n}${n}`}
</Text>
<Text color="yellow">
{` ●${n}`}
</Text>
<Text color="red">
{` (+${otherFails} optional ✗)`}
</Text>
<Text color="red">
{" · refresh failed"}
</Text>
<Text dimColor>
{" · muted"}
</Text>
<Text dimColor>
{` · ${title}`}
</Text>
</Text>
<Box display="none" flexShrink={0} flexDirection="row">
<Button label="open" />
<Button label="copy" />
<Button label="unmute" />
<Button label="details" />
<Button label="×" />
</Box>
</Box>
<Box flexDirection="row">
<Box flexShrink={0}>
<Link href={`${url}`}>
<Text dimColor strikethrough>
{label2}
</Text>
</Link>
</Box>
<Text wrap="truncate-end">
<Text dimColor>
{" "}
</Text>
<Text color="gray">
{mergeStateStatus2}
</Text>
<Text dimColor>
{" · "}
</Text>
<Text color="gray">
{reviewOf2}
</Text>
<Text dimColor>
{" · "}
</Text>
<Text color="green">
{`✓${n}`}
</Text>
<Text color="red">
{` ✗${n}${n}`}
</Text>
<Text color="yellow">
{` ●${n}`}
</Text>
<Text color="red">
{` (+${otherFails} optional ✗)`}
</Text>
<Text color="red">
{" · refresh failed"}
</Text>
<Text dimColor>
{" · muted"}
</Text>
<Text dimColor>
{` · ${title}`}
</Text>
</Text>
<Box display="none" flexShrink={0} flexDirection="row">
<Button label="open" />
<Button label="copy" />
<Button label="unmute" />
<Button label="details" />
<Button label="×" />
</Box>
</Box>
<Box flexDirection="row">
<Box flexShrink={0}>
<Link href={`${url}`}>
<Text dimColor strikethrough>
{label3}
</Text>
</Link>
</Box>
<Text wrap="truncate-end">
<Text dimColor>
{" "}
</Text>
<Text color="gray">
{mergeStateStatus3}
</Text>
<Text dimColor>
{" · "}
</Text>
<Text color="gray">
{reviewOf3}
</Text>
<Text dimColor>
{" · "}
</Text>
<Text color="green">
{`✓${n}`}
</Text>
<Text color="red">
{` ✗${n}${n}`}
</Text>
<Text color="yellow">
{` ●${n}`}
</Text>
<Text color="red">
{` (+${otherFails} optional ✗)`}
</Text>
<Text color="red">
{" · refresh failed"}
</Text>
<Text dimColor>
{" · muted"}
</Text>
<Text dimColor>
{` · ${title}`}
</Text>
</Text>
<Box display="none" flexShrink={0} flexDirection="row">
<Button label="open" />
<Button label="copy" />
<Button label="unmute" />
<Button label="details" />
<Button label="×" />
</Box>
</Box>
{await next(e)}
</Box>
)
})
// the pane: open it with $.ui.open({ id: 'my-pane', title: "‹id›" })
on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
const { Box, Text, Button } = $.ui.resolve(e)
const title = '…'
const state = '…'
const mergeStateStatus = '…'
const mergeable = '…'
const reviewOf = '…'
const length = '…'
const ICON = '…'
const name = '…'
const name2 = '…'
const name3 = '…'
const toTimeString = '…'
const error = '…'
return (
<Box flexDirection="column">
<Text bold wrap="truncate-end">
{title}
</Text>
<Text>
<Text color="green">
{state}
</Text>
<Text dimColor>
{" · merge "}
</Text>
<Text color="gray">
{mergeStateStatus}
</Text>
<Text dimColor>
{` (${mergeable}) · `}
</Text>
<Text color="gray">
{reviewOf}
</Text>
</Text>
<Box flexDirection="row">
<Button label="open in browser" />
<Text>
{" "}
</Text>
<Button label="copy URL" />
<Text>
{" "}
</Text>
<Button label="stop watching" />
</Box>
<Text bold>
{`Required checks (${length})`}
</Text>
<Box flexDirection="row">
<Box flexShrink={0}>
<Text color="gray">
{`${ICON} `}
</Text>
</Box>
<Text wrap="truncate-end">
{name}
</Text>
<Text dimColor>
{" (optional)"}
</Text>
</Box>
<Box flexDirection="row">
<Box flexShrink={0}>
<Text color="gray">
{`${ICON} `}
</Text>
</Box>
<Text wrap="truncate-end">
{name2}
</Text>
<Text dimColor>
{" (optional)"}
</Text>
</Box>
<Box flexDirection="row">
<Box flexShrink={0}>
<Text color="gray">
{`${ICON} `}
</Text>
</Box>
<Text wrap="truncate-end">
{name3}
</Text>
<Text dimColor>
{" (optional)"}
</Text>
</Box>
<Text dimColor>
{`+ ${length} optional checks · updated ${toTimeString} · refresh failed: ${error}`}
</Text>
</Box>
)
})
on('session.start', async ($, e, next) => {
const text = '…'
const label = '…'
const changes = '…'
await $.ui.toast(`copied ${text}`)
await $.ui.toast(`${label} ${changes}`)
return next(e)
})
}
Mod 自身のコード
Mod のライセンス(MIT)に従って載せています。全文は下にあります。写すときは著作権表示を残してください。
hooks/register.tsx 396〜457 行 · バンド
on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
if (e.props.hasSurvey || (!flashing && !prs.size)) return next(e)
const { Box, Text, Link, Button } = await $.ui.resolve(e)
const cols = e.viewport?.columns ?? 80
return (
<Box flexDirection="column">
{flashing ? (
<Box backgroundColor="white" width={cols}>
<Text color="black" backgroundColor="white" bold> ● PR checks changed</Text>
</Box>
) : <Box />}
{[...prs.values()].map(pr => {
const v = pr.view
if (!v) return <Text dimColor wrap="truncate-end">{`${pr.label} ${pr.error ? `gh failed: ${pr.error}` : 'loading…'}`}</Text>
const n = (b: string) => pr.required.filter(c => c.bucket === b).length
const state = stateOf(v)
const otherFails = pr.others.filter(c => c.bucket === 'fail').length
// the label is a Link (cmd+click opens the PR); the rest is one Text, truncated, title
// last so it is what the width cuts; hovering the row reveals its buttons (no hotkeys:
// a band hotkey would press on a digit typed as the first character of a prompt).
// A merged or closed PR is done: the whole line struck through, label, state and title
const done = state === 'merged' || state === 'closed'
return (
<Box key={`row:${pr.pane}`} flexDirection="row">
<Box flexShrink={0}>
{done ? <Link href={pr.url}><Text dimColor strikethrough>{pr.label}</Text></Link> : <Link href={pr.url} label={pr.label} />}
</Box>
{done ? (
<Text wrap="truncate-end" strikethrough>
<Text color={state === 'merged' ? 'magenta' : 'gray'} strikethrough>{` ${state}`}</Text>
<Text dimColor strikethrough>{` · ${v.title}`}</Text>
</Text>
) : (
<Text wrap="truncate-end">
<Text dimColor>{state === 'open' ? ' ' : ` ${state} · `}</Text>
<Text color={MERGE[v.mergeStateStatus] ?? 'gray'}>{v.mergeStateStatus.toLowerCase()}</Text>
<Text dimColor> · </Text>
<Text color={REVIEW[v.reviewDecision] ?? 'gray'}>{reviewOf(v)}</Text>
<Text dimColor> · </Text>
<Text color="green">{`✓${n('pass')}`}</Text>
<Text color="red">{n('fail') + n('cancel') ? ` ✗${n('fail') + n('cancel')}` : ''}</Text>
<Text color="yellow">{n('pending') ? ` ●${n('pending')}` : ''}</Text>
<Text color="red">{otherFails ? ` (+${otherFails} optional ✗)` : ''}</Text>
<Text color="red">{pr.error ? ' · refresh failed' : ''}</Text>
<Text dimColor>{pr.muted || cfg.muteAll ? ' · muted' : ''}</Text>
<Text dimColor>{` · ${v.title}`}</Text>
</Text>
)}
<Box display="none" hover={{ display: 'flex' }} flexShrink={0} flexDirection="row">
<Button key={`open:${pr.pane}`} label="open" onPress={() => openUrl?.(pr.url)} />
<Button key={`copy:${pr.pane}`} label="copy" onPress={press => copy?.(pr.url, press.surface)} />
<Button key={`mute:${pr.pane}`} label={pr.muted ? 'unmute' : 'mute'} onPress={() => { pr.muted = !pr.muted; save?.(); $.ui.invalidate('ui.render') }} />
<Button key={`details:${pr.pane}`} label="details" onPress={() => { $.ui.open({ id: pr.pane, title: pr.id, focus: true }) }} />
<Button key={`stop:${pr.pane}`} label="×" onPress={() => stop?.(pr)} />
</Box>
</Box>
)
})}
{await next(e)}
</Box>
)
})hooks/register.tsx 461〜499 行 · ペイン
on('ui.render', { component: 'Pane' }, async ($, e, next) => {
const pr = [...prs.values()].find(p => p.pane === e.requestId)
if (!pr) return next(e)
const { Box, Text, Link, Button } = await $.ui.resolve(e)
const v = pr.view
if (!v) return <Text dimColor>{pr.error ? `gh failed: ${pr.error}` : 'loading…'}</Text>
const state = stateOf(v)
const optionalFails = pr.others.filter(c => c.bucket === 'fail')
return (
<Box flexDirection="column">
<Text bold wrap="truncate-end">{v.title}</Text>
<Text>
<Text color={state === 'open' ? 'green' : state === 'merged' ? 'magenta' : 'gray'}>{state}</Text>
<Text dimColor> · merge </Text>
<Text color={MERGE[v.mergeStateStatus] ?? 'gray'}>{v.mergeStateStatus.toLowerCase()}</Text>
<Text dimColor>{` (${v.mergeable.toLowerCase()}) · `}</Text>
<Text color={REVIEW[v.reviewDecision] ?? 'gray'}>{reviewOf(v)}</Text>
</Text>
<Box flexDirection="row">
<Button key={`pane-open:${pr.pane}`} label="open in browser" onPress={() => openUrl?.(pr.url)} />
<Text> </Text>
<Button key={`pane-copy:${pr.pane}`} label="copy URL" onPress={press => copy?.(pr.url, press.surface)} />
<Text> </Text>
<Button key={`pane-stop:${pr.pane}`} label="stop watching" onPress={() => stop?.(pr)} />
</Box>
<Text bold>{pr.required.length ? `Required checks (${pr.required.length})` : 'Required checks: none reported'}</Text>
{[...pr.required, ...optionalFails].map((c, i) => (
<Box key={c.key} flexDirection="row">
<Box flexShrink={0}>
<Text color={ICON[c.bucket]?.[1] ?? 'gray'}>{`${ICON[c.bucket]?.[0] ?? '?'} `}</Text>
</Box>
{linkable(c.link) ? <Link href={c.link} label={c.name} /> : <Text wrap="truncate-end">{c.name}</Text>}
<Text dimColor>{i >= pr.required.length ? ' (optional)' : ''}</Text>
</Box>
))}
<Text dimColor>{`+ ${pr.others.length} optional checks · updated ${new Date(pr.updated ?? 0).toTimeString().slice(0, 8)}${pr.error ? ` · refresh failed: ${pr.error}` : ''}`}</Text>
</Box>
)
})ライセンスの全文(MIT)
MIT License Copyright (c) 2026 Seza Akgün Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
コードが呼ぶもの
プログラム起動ファイル読み取り環境変数ツール呼び出し保存
コードから読み取ったデザイン
読み取ったコミットのソースから描いたもので、動かした結果ではありません。一覧は 3 回描き、条件はデスクトップアプリで描く最初の分岐を取り、動かしたときにだけ決まる値は仮の例(点線の下線)にするか省きます。色と書体はこのサイトのものです。
コードから読めること
2026-10-06 に読んだコミット 605b8fc515c3 のソースから。最初のまとまりが載せる条件で、残りは自分で判断するための材料です。後のコミットは、次に読むまで見ていません。
| 載せる条件: 確かめやすいコード | |
|---|---|
| 入口を読んだ | hooks/hooks.json が名指すモジュールをすべて読んだ。hooks/register.tsx |
| 解析できる | すべてのファイルが TypeScript か JavaScript として解析できる。1 ファイルを解析 |
| コードが Mod の中で完結 | import は Mod 自身のファイルかエンジンのモジュールだけ。パッケージも require もない。コードはすべて Mod の中 |
| 読める | 圧縮した行・eval・new Function・計算した道の import()・符号化した塊がない。圧縮・eval・符号化した塊なし |
| 呼び出しが見える | 通信とプログラム起動はその場で $.http.fetch・$.process.run と書き、他へ渡さない。外への呼び出しはすべてその場の $ で |
| 入れる前に自分で判断する材料 | |
| 描く場所 | コードから読んだ、描く先。ターミナル・デスクトップアプリ・両方・何も描かない(フックだけ: 見張りやプロンプトの書き換え)のどれか。出すだけで、外す理由にはしない。ターミナルとデスクトップアプリに同じように描く |
| 入れる手順 | リポジトリ自身の .claude-plugin/marketplace.json にこの Mod が載っていて、ページに書いた手順でそのマーケットプレイスから入れられるか。リポジトリの .claude-plugin/marketplace.json に載っており、そこから入れられる |
| Windows のプログラム | $.process で起動するプログラムが Windows にあるか(tail・date・open・osascript・/usr/… などは無い)。hooks/register.tsx:185 afplay(Windows にない); hooks/register.tsx:193 open(Windows にない); hooks/register.tsx:194 xdg-open(Windows にない) |
| 通信 | fetch の送り先(https のホスト)がコードに書いてあるか。通信なし |
| プログラム | 起動するプログラムの名前がコードに書いてあり、シェル・インタプリタ・通信用の道具でないか。hooks/register.tsx:176 実行時に決まるプログラム |
| 読んで送る | ファイルや環境変数を読み、かつ通信するか。reads environment variables and files and reaches the network |
| ソースの鍵 | ソースに API キーや秘密鍵らしきものがあるか。ソースに鍵なし |
| ライセンス | オープンなライセンス(MIT・Apache-2.0・BSD・ISC・Unlicense・0BSD・CC0)で全文があれば、modscode にコードを載せる。違えばリンクだけ。MIT |
コードの文面を読んだだけで、安全の審査ではありません。動かしてはおらず、起動するプログラムの中で何が起きるかも見えません。入れる前の確認はあなたの役目です。 載せる条件
入れる
入れる前に、必ず自分で確かめてください。Mod はサンドボックスなしで、あなたの権限で動きます。modscode はこのコードの安全を保証しません。下のコードを読み(またはフォルダーで claude plugin validate .)、触るものを見て、読んだコミットを入れてください。
リポジトリがそのままマーケットプレイスです。このマーケットプレイスを足し(ターミナルでは次のコマンド、デスクトップアプリではプラグインの設定)、そこから Mod を入れます。
/plugin marketplace add sezaakgun/cc-pr-tracker/plugin install cc-pr-tracker@cc-pr-tracker入るのはマーケットプレイスの最新のコミットで、ここで読んだもの(605b8fc515c3)と違うことがあります。入れる前に見比べてください。
Claude に聞く
modscode のコネクタを入れると、Claude がこのデザイン・コードが触るもの・コードを読んで、それをもとに作れます。たとえば:
modscode のデザイン「sezaakgun-cc-pr-tracker」をコードごと読んで、同じようなペインを作って似たデザイン
-
Claude に頼む…Session inboxK build 3K build 3K build 3Nothing is waiting on you.Running 3● build example.com● build example.com● build example.com▸ Fix login 3✓ Done✓ Done✓ Done▸ Fix login 3OpportunityOpportunityOpportunityokupdate failed, retries after the next reply
-
Claude に頼む…Fix loginRemoveCopy markdownacme/app · mainCopy linkCopy markdownbuild2h 10mbuild2h 10mbuild2h 10mHosted on uploads.sh, not committed to the repo.They will appear in a comment on the pull request once opened.
-
✦ explain as pick how Claude answers×3 ● build3 ● build3 ● build▸ VideoClaude に頼む…
-
何をするか
- プロンプトの上の帯・欄を描く
- ツールの呼び出しを見張る(止めることがある)
- config.describe・session.start・turn.complete・ui.closeにフックする
- ターンをまたいで自分の状態を持つ
-
Claude に頼む…CIcross Bash · Classicmain · a1b2c3d · failed at 14:32Open the run on GitHubFix it fClose x
(no log available)
-
Claude に頼む…GitHub inboxGitHubloading…Refresh rbuildbuildbuildClose xStealth IssuesNo open issues in this view.#3 Fix login · Pinned notice · 2h 10m · Top row commentsWork on itopen#3 Fix login · Pinned notice · 2h 10m · Top row commentsWork on itopen#3 Fix login · Pinned notice · 2h 10m · Top row commentsWork on itopenPull requestsNo open pull requests.#3 Fix login · main · draft · build · HiddenChecksReviewopen#3 Fix login · main · draft · build · HiddenChecksReviewopen#3 Fix login · main · draft · build · HiddenChecksReviewopenChecks for #3Plain