modscode EN

modscode / 図鑑 / pr-watch

pr-watch

Above the prompt: the branch PR with its checks and failing log lines, uncommitted work with a commit-and-push key, and how far the branch is behind the default branch with a rebase key. The branch name sits in the hint line.

確かめやすいコードターミナル+デスクトップペインバンドステータスライントーストBoxButtonText

何をするか

  • プロンプトの上の帯・欄・トーストを描く
  • /pr-watch を足す
  • mcp__pr-watch__commit・mcp__pr-watch__push・mcp__pr-watch__rebase_and_push の呼び出しを見張る(止めることがある)
  • prompt.submit・session.start・turn.completeにフックする
  • プロセスを起こす

良いところ

  • ネットワークに出ない
  • TypeScript で書かれている
  • エラーを扱う
  • ファイルを書かない

作り始めるためのコード

2 種類あります。上のデザインから modscode が書いた雛形と、その Mod 自身のコードのうち描いている部分です。

雛形(register.tsx)

register.tsx
import type { Register } from 'claude-code'

// Drawn like pr-watch by cephalofoil (pane, band, status, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/cephalofoil-pr-watch/
// 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, Button } = $.ui.resolve(e)
    const mark = '…'
    const number = '…'
    const word = '…'
    const title = '…'
    const done = '…'
    const total = '…'
    const GLYPH = '…'
    const split = '…'
    const GLYPH2 = '…'
    const split2 = '…'
    const GLYPH3 = '…'
    const split3 = '…'
    const skipped = '…'
    const name = '…'
    const line = '…'
    const line2 = '…'
    const line3 = '…'
    const name2 = '…'
    const line4 = '…'
    const line5 = '…'
    const line6 = '…'
    const name3 = '…'
    const line7 = '…'
    const line8 = '…'
    const line9 = '…'
    const dirty = '…'
    const filter = '…'
    const outgoing = '…'
    const plural = '…'
    const number2 = '…'
    const behind = '…'
    const base = '…'
    const map = '…'
    return (
      <Box flexDirection="column">
        <Box flexDirection="column">
          <Box flexDirection="column">
            <Box columnGap={1}>
              <Text bold>
                {mark}
                {" PR #"}
                {number}
              </Text>
              <Text>
                {word}
              </Text>
              <Text dimColor>
                ·
              </Text>
              <Box flexGrow={1} flexShrink={1}>
                <Text wrap="truncate-end">
                  {title}
                  {` · ${done}/${total} done`}
                </Text>
              </Box>
            </Box>
            <Box columnGap={2} flexWrap="wrap" marginLeft={2}>
              <Box>
                <Text>
                  {GLYPH}
                  {" "}
                </Text>
                <Text>
                  {split}
                </Text>
                <Text dimColor>
                  {" queued"}
                </Text>
              </Box>
              <Box>
                <Text>
                  {GLYPH2}
                  {" "}
                </Text>
                <Text>
                  {split2}
                </Text>
                <Text dimColor>
                  {" queued"}
                </Text>
              </Box>
              <Box>
                <Text>
                  {GLYPH3}
                  {" "}
                </Text>
                <Text>
                  {split3}
                </Text>
                <Text dimColor>
                  {" queued"}
                </Text>
              </Box>
              <Text dimColor>
                {"– "}
                {skipped}
                {" skipped"}
              </Text>
              <Text dimColor>
                no checks reported yet
              </Text>
            </Box>
            <Box flexDirection="column" marginLeft={2}>
              <Text color="red" wrap="truncate-end">
                {"✗ "}
                {name}
                {" · log arrives when the run finishes"}
              </Text>
              <Text dimColor wrap="truncate-end">
                {" "}
                {line}
              </Text>
              <Text dimColor wrap="truncate-end">
                {" "}
                {line2}
              </Text>
              <Text dimColor wrap="truncate-end">
                {" "}
                {line3}
              </Text>
            </Box>
            <Box flexDirection="column" marginLeft={2}>
              <Text color="red" wrap="truncate-end">
                {"✗ "}
                {name2}
                {" · log arrives when the run finishes"}
              </Text>
              <Text dimColor wrap="truncate-end">
                {" "}
                {line4}
              </Text>
              <Text dimColor wrap="truncate-end">
                {" "}
                {line5}
              </Text>
              <Text dimColor wrap="truncate-end">
                {" "}
                {line6}
              </Text>
            </Box>
            <Box flexDirection="column" marginLeft={2}>
              <Text color="red" wrap="truncate-end">
                {"✗ "}
                {name3}
                {" · log arrives when the run finishes"}
              </Text>
              <Text dimColor wrap="truncate-end">
                {" "}
                {line7}
              </Text>
              <Text dimColor wrap="truncate-end">
                {" "}
                {line8}
              </Text>
              <Text dimColor wrap="truncate-end">
                {" "}
                {line9}
              </Text>
            </Box>
            <Box columnGap={2} marginLeft={2}>
              <Button plain hotkey="1" label="Retry failed" />
              <Button plain hotkey="2" label="Hand log to Claude" />
              <Button plain dimColor hotkey="3" label="Open in browser" />
              <Button plain dimColor hotkey="x" label="Hide" />
            </Box>
          </Box>
          <Box columnGap={1}>
            <Text bold color="cyan">
              {"● "}
              {dirty}
              {" uncommitted"}
            </Text>
            <Text dimColor>
              {"· "}
              {filter}
              {` · ↑ ${outgoing} not pushed`}
            </Text>
            <Text>
              {" "}
            </Text>
            <Button plain hotkey="c" label="Commit" />
          </Box>
          <Box columnGap={1}>
            <Text bold color="cyan">
              {`↑ ${plural} not pushed`}
            </Text>
            <Text dimColor>
              · no PR yet
            </Text>
            <Text>
              {" "}
            </Text>
            <Button plain hotkey="p" label="Push" />
          </Box>
          <Box columnGap={1}>
            <Text bold color="magenta">
              ✓ PR #
              {number2}
              {" merged"}
            </Text>
            <Text dimColor>
              · this branch is done
            </Text>
            <Text>
              {" "}
            </Text>
            <Text dimColor>
              commit or stash first to switch
            </Text>
          </Box>
          <Box columnGap={1}>
            <Text bold color="yellow">
              {"↓ "}
              {behind}
              {" behind "}
              {base}
            </Text>
            <Text dimColor>
              ·
            </Text>
            <Text dimColor>
              conflict check unavailable
            </Text>
            <Text color="green">
              rebase looks clean
            </Text>
            <Text color="red" wrap="truncate-end">
              {"conflicts likely in "}
              {plural}
              :
              {" "}
              {map}
              , …
            </Text>
            <Text>
              {" "}
            </Text>
            <Button plain hotkey="b" label="Rebase & push" />
            <Button plain dimColor hotkey="h" label="Hide" />
          </Box>
        </Box>
        {await next(e)}
      </Box>
    )
  })

  // the pane: open it with $.ui.open({ id: 'my-pane', title: "PR" })
  on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
    const { Box, Text, Button } = $.ui.resolve(e)
    const mark = '…'
    const number = '…'
    const title = '…'
    const word = '…'
    const number2 = '…'
    const title2 = '…'
    const done = '…'
    const total = '…'
    const branch = '…'
    const behind = '…'
    const base = '…'
    const GLYPH = '…'
    const name = '…'
    const duration = '…'
    const step = '…'
    const line = '…'
    const line2 = '…'
    const line3 = '…'
    const GLYPH2 = '…'
    const name2 = '…'
    const duration2 = '…'
    const step2 = '…'
    const line4 = '…'
    const line5 = '…'
    const line6 = '…'
    const GLYPH3 = '…'
    const name3 = '…'
    const duration3 = '…'
    const step3 = '…'
    const line7 = '…'
    const line8 = '…'
    const line9 = '…'
    const length = '…'
    const map = '…'
    return (
      <Box flexDirection="column">
        <Text bold wrap="truncate-end">
          {mark}
          {" PR #"}
          {number}
          {" · "}
          {title}
        </Text>
        <Box>
          <Text dimColor>
            {"Status "}
          </Text>
          <Text bold>
            {word}
          </Text>
          <Text dimColor>
            {" · draft"}
          </Text>
        </Box>
        <Box>
          <Text dimColor>
            {"Issue "}
          </Text>
          <Text wrap="truncate-end">
            #
            {number2}
            {" "}
            {title2}
            {` · ${done}/${total} done`}
          </Text>
        </Box>
        <Box>
          <Text dimColor>
            {"Branch "}
          </Text>
          <Text wrap="truncate-end">
            {branch}
          </Text>
          <Text color="yellow">
            {` · ${behind} behind ${base}`}
          </Text>
        </Box>
        <Text>
          {" "}
        </Text>
        <Text dimColor>
          {" No checks reported yet."}
        </Text>
        <Box flexDirection="column">
          <Box>
            <Text>
              {" "}
              {GLYPH}
              {" "}
            </Text>
            <Box flexGrow={1}>
              <Text wrap="truncate-end">
                {name}
              </Text>
            </Box>
            <Text dimColor>
              {" running "}
              {duration}
            </Text>
          </Box>
          <Text dimColor italic>
            {" log arrives when the run finishes"}
          </Text>
          <Box flexDirection="column" marginLeft={6}>
            <Text color="red" wrap="truncate-end">
              {step}
            </Text>
            <Text dimColor wrap="truncate-end">
              {line}
            </Text>
            <Text dimColor wrap="truncate-end">
              {line2}
            </Text>
            <Text dimColor wrap="truncate-end">
              {line3}
            </Text>
          </Box>
        </Box>
        <Box flexDirection="column">
          <Box>
            <Text>
              {" "}
              {GLYPH2}
              {" "}
            </Text>
            <Box flexGrow={1}>
              <Text wrap="truncate-end">
                {name2}
              </Text>
            </Box>
            <Text dimColor>
              {" running "}
              {duration2}
            </Text>
          </Box>
          <Text dimColor italic>
            {" log arrives when the run finishes"}
          </Text>
          <Box flexDirection="column" marginLeft={6}>
            <Text color="red" wrap="truncate-end">
              {step2}
            </Text>
            <Text dimColor wrap="truncate-end">
              {line4}
            </Text>
            <Text dimColor wrap="truncate-end">
              {line5}
            </Text>
            <Text dimColor wrap="truncate-end">
              {line6}
            </Text>
          </Box>
        </Box>
        <Box flexDirection="column">
          <Box>
            <Text>
              {" "}
              {GLYPH3}
              {" "}
            </Text>
            <Box flexGrow={1}>
              <Text wrap="truncate-end">
                {name3}
              </Text>
            </Box>
            <Text dimColor>
              {" running "}
              {duration3}
            </Text>
          </Box>
          <Text dimColor italic>
            {" log arrives when the run finishes"}
          </Text>
          <Box flexDirection="column" marginLeft={6}>
            <Text color="red" wrap="truncate-end">
              {step3}
            </Text>
            <Text dimColor wrap="truncate-end">
              {line7}
            </Text>
            <Text dimColor wrap="truncate-end">
              {line8}
            </Text>
            <Text dimColor wrap="truncate-end">
              {line9}
            </Text>
          </Box>
        </Box>
        <Text dimColor italic wrap="truncate-end">
          {"  "}
          {"– "}
          {length}
          {" skipped by path filter: "}
          {map}
        </Text>
        <Text>
          {" "}
        </Text>
        <Box columnGap={2} flexWrap="wrap">
          <Button plain hotkey="1" label="Retry failed" />
          <Button plain hotkey="2" label="Hand log to Claude" />
          <Button plain hotkey="3" label="Open in browser" />
          <Button plain hotkey="r" label="Refresh" />
        </Box>
      </Box>
    )
  })

  on('session.start', async ($, e, next) => {
    const behind = '…'
    const base = '…'
    const number = '…'
    await $.ui.toast(`${behind} behind ${base}: rebasing (auto-rebase is on)`)
    await $.ui.toast(`PR #${number}: failed jobs restarted`)
    return next(e)
  })
}

Mod 自身のコード

Mod のライセンス(MIT)に従って載せています。全文は下にあります。写すときは著作権表示を残してください。

pr-watch/hooks/register.tsx 696〜855 行 · バンド
  on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
    if (e.props.hasSurvey) return next(e)

    const pr = await read($, snapshot)
    const git = await read($, gitState)
    const now = pr === null ? null : overall(pr)
    const hasPr =
      pr !== null && git !== null && now !== null && pr.branch === git.branch &&
      now !== 'merged' && now !== 'closed' && (await read($, hiddenPr)) !== keyOf(pr)
    const dirty = git === null ? 0 : git.modified + git.untracked
    // The branch's PR is merged and nothing was committed since: the branch is done.
    const isDone =
      pr !== null && git !== null && pr.state === 'MERGED' && pr.branch === git.branch && pr.headSha === git.head
    const isOpen = pr !== null && git !== null && pr.state === 'OPEN' && pr.branch === git.branch
    // A branch without an upstream has pushed nothing: everything on top of the base is outgoing.
    const outgoing = git === null ? 0 : (git.unpushed ?? git.ahead)
    const isBase = git !== null && `origin/${git.branch}` === git.base
    const hasPush =
      git !== null && dirty === 0 && !isDone && !isBase && (outgoing > 0 || (!isOpen && git.ahead > 0))
    const hasRebase =
      !isDone && git !== null && git.behind > 0 && `origin/${git.branch}` !== git.base && (await read($, hiddenRebase)) !== git.baseSha

    if (!hasPr && !isDone && dirty === 0 && !hasPush && !hasRebase) return next(e)

    const below = await next(e)

    const { Box, Button, Text } = $.ui.resolve(e)
    const width = Math.max(30, e.props.bodyColumns)
    const failed = hasPr ? pr.checks.filter(check => check.state === 'fail') : []
    const skipped = hasPr ? pr.checks.filter(check => check.state === 'skipped').length : 0
    const files = git?.conflicts ?? []

    return (
      <Box flexDirection="column">
        <Box flexDirection="column" width={width}>
        {hasPr && (
          <Box flexDirection="column">
            <Box columnGap={1}>
              <Text bold color={HEAD[now].color}>
                {HEAD[now].mark} PR #{pr.number}
              </Text>
              <Text color={HEAD[now].color}>{HEAD[now].word}</Text>
              <Text dimColor>·</Text>
              <Box flexGrow={1} flexShrink={1}>
                <Text wrap="truncate-end">
                  {pr.issue === null ? pr.title : `#${pr.issue.number} ${pr.issue.title}`}
                  {pr.issue !== null && pr.issue.total > 0 ? ` · ${pr.issue.done}/${pr.issue.total} done` : ''}
                </Text>
              </Box>
            </Box>
            <Box columnGap={2} flexWrap="wrap" marginLeft={2}>
              {pr.checks
                .filter(check => check.state !== 'skipped')
                .map(check => (
                  <Box>
                    <Text color={COLOR[check.state]}>{GLYPH[check.state]} </Text>
                    <Text bold={check.state === 'fail'} dimColor={check.state === 'pass'}>
                      {check.name.split(' — ')[0]}
                    </Text>
                    <Text dimColor>
                      {check.state === 'queued' ? ' queued' : check.seconds === null ? '' : ` ${duration(check.seconds)}`}
                    </Text>
                  </Box>
                ))}
              {skipped > 0 && <Text dimColor>– {skipped} skipped</Text>}
              {pr.checks.length === 0 && <Text dimColor>no checks reported yet</Text>}
            </Box>
            {failed.map(check => {
              const log = pr.logs.find(one => one.jobId === check.jobId)

              return (
                <Box flexDirection="column" marginLeft={2}>
                  <Text color="red" wrap="truncate-end">
                    ✗ {check.name}
                    {log === undefined ? ' · log arrives when the run finishes' : log.step === '' ? '' : ` › ${log.step}`}
                  </Text>
                  {log !== undefined &&
                    headline(log.lines, 2).map(line => (
                      <Text dimColor wrap="truncate-end">    {line}</Text>
                    ))}
                </Box>
              )
            })}
            <Box columnGap={2} marginLeft={2}>
              {failed.length > 0 && <Button key="retry" plain hotkey="1" label="Retry failed" onPress={() => retry($, pr)} />}
              {failed.length > 0 && <Button key="hand" plain hotkey="2" label="Hand log to Claude" onPress={() => hand($, pr)} />}
              <Button key="web" plain dimColor hotkey="3" label="Open in browser" onPress={() => browse($, pr)} />
              <Button key="hide-pr" plain dimColor hotkey="x" label="Hide" onPress={() => update($, hiddenPr, () => keyOf(pr))} />
            </Box>
          </Box>
        )}
        {git !== null && dirty > 0 && (
          <Box columnGap={1}>
            <Text bold color="cyan">● {dirty} uncommitted</Text>
            <Text dimColor>
              · {[git.modified > 0 ? `${git.modified} modified` : '', git.untracked > 0 ? `${git.untracked} new` : '']
                .filter(Boolean)
                .join(', ')}
              {outgoing > 0 ? ` · ↑ ${outgoing} not pushed` : ''}
            </Text>
            <Text> </Text>
            <Button
              key="commit"
              plain
              hotkey="c"
              label="Commit"
              onPress={() => void $.prompt.submit({ text: ASK.commit, asUser: true })}
            />
          </Box>
        )}
        {hasPush && (
          <Box columnGap={1}>
            <Text bold color="cyan">
              {outgoing > 0 ? `↑ ${plural(outgoing, 'commit')} not pushed` : '↑ pushed'}
            </Text>
            {!isOpen && <Text dimColor>· no PR yet</Text>}
            <Text> </Text>
            <Button
              key="push"
              plain
              hotkey="p"
              label={isOpen ? 'Push' : outgoing > 0 ? 'Push & open PR' : 'Open PR'}
              onPress={() => void $.prompt.submit({ text: isOpen ? ASK.push : ASK.ship, asUser: true })}
            />
          </Box>
        )}
        {isDone && (
          <Box columnGap={1}>
            <Text bold color="magenta">✓ PR #{pr.number} merged</Text>
            <Text dimColor>· this branch is done</Text>
            <Text> </Text>
            {dirty === 0 ? (
              <Button
                key="switch"
                plain
                hotkey="m"
                label={`Switch to ${git.base.replace(/^origin\//, '')}`}
                onPress={() => switchToBase($, git)}
              />
            ) : (
              <Text dimColor>commit or stash first to switch</Text>
            )}
          </Box>
        )}
        {hasRebase && (
          <Box columnGap={1}>
            <Text bold color="yellow">↓ {git.behind} behind {git.base.replace(/^origin\//, '')}</Text>
            <Text dimColor>·</Text>
            {git.conflicts === null && <Text dimColor>conflict check unavailable</Text>}
            {git.conflicts !== null && files.length === 0 && <Text color="green">rebase looks clean</Text>}
            {files.length > 0 && (
              <Text color="red" wrap="truncate-end">
                conflicts likely in {plural(files.length, 'file')}:{' '}
                {files.slice(0, 2).map(path => path.split('/').pop()).join(', ')}
                {files.length > 2 ? ', …' : ''}
              </Text>
            )}
            <Text> </Text>
            <Button
              key="rebase"
pr-watch/hooks/register.tsx 872〜969 行 · ペイン
  on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
    const { Box, Button, Text } = $.ui.resolve(e)
    const pr = await read($, snapshot)
    const git = await read($, gitState)

    if (pr === null) {
      return (
        <Box flexDirection="column">
          <Text dimColor>
            {(await read($, isLoaded)) ? 'This branch has no pull request.' : 'Looking for the pull request…'}
          </Text>
        </Box>
      )
    }

    const now = overall(pr)
    const head = HEAD[now]
    const width = Math.max(30, Math.min(e.props.bodyColumns, 76))
    const shown = pr.checks.filter(check => check.state !== 'skipped')
    const skipped = pr.checks.filter(check => check.state === 'skipped')
    const failed = pr.checks.filter(check => check.state === 'fail')
    const room = e.props.placement === 'dock' ? 6 : 3
    const behind = git !== null && git.branch === pr.branch ? git.behind : null

    return (
      <Box flexDirection="column" width={width}>
        <Text bold color={head.color} wrap="truncate-end">
          {head.mark} PR #{pr.number} · {pr.title}
        </Text>
        <Box>
          <Text dimColor>Status  </Text>
          <Text bold color={head.color}>{head.word}</Text>
          {pr.isDraft && <Text dimColor> · draft</Text>}
        </Box>
        {pr.issue !== null && (
          <Box>
            <Text dimColor>Issue   </Text>
            <Text wrap="truncate-end">
              #{pr.issue.number} {pr.issue.title}
              {pr.issue.total > 0 ? ` · ${pr.issue.done}/${pr.issue.total} done` : ''}
            </Text>
          </Box>
        )}
        <Box>
          <Text dimColor>Branch  </Text>
          <Text wrap="truncate-end">{pr.branch}</Text>
          {behind !== null && pr.state === 'OPEN' && (
            <Text color={behind > 0 ? 'yellow' : undefined} dimColor={behind === 0}>
              {behind > 0 ? ` · ${behind} behind ${git?.base.replace(/^origin\//, '') ?? 'base'}` : ' · up to date'}
            </Text>
          )}
        </Box>
        <Text> </Text>
        {pr.checks.length === 0 && <Text dimColor>  No checks reported yet.</Text>}
        {shown.map(check => {
          const log = pr.logs.find(one => one.jobId === check.jobId)

          return (
            <Box flexDirection="column">
              <Box>
                <Text color={COLOR[check.state]}>  {GLYPH[check.state]} </Text>
                <Box flexGrow={1}>
                  <Text bold={check.state === 'fail'} wrap="truncate-end">{check.name}</Text>
                </Box>
                <Text dimColor>
                  {check.state === 'running' ? ' running ' : check.state === 'queued' ? ' queued' : ' '}
                  {duration(check.seconds)}
                </Text>
              </Box>
              {check.state === 'fail' && log === undefined && (
                <Text dimColor italic>      log arrives when the run finishes</Text>
              )}
              {log !== undefined && (
                <Box flexDirection="column" marginLeft={6}>
                  {log.step !== '' && <Text color="red" wrap="truncate-end">{log.step}</Text>}
                  {headline(log.lines, room).map(line => (
                    <Text dimColor wrap="truncate-end">{line}</Text>
                  ))}
                </Box>
              )}
            </Box>
          )
        })}
        {skipped.length > 0 && (
          <Text dimColor italic wrap="truncate-end">
            {'  '}– {skipped.length} skipped by path filter: {skipped.map(check => check.name.split(' — ')[0]).join(', ')}
          </Text>
        )}
        <Text> </Text>
        <Box columnGap={2} flexWrap="wrap">
          {failed.length > 0 && <Button key="retry" plain hotkey="1" label="Retry failed" onPress={() => retry($, pr)} />}
          {failed.length > 0 && <Button key="hand" plain hotkey="2" label="Hand log to Claude" onPress={() => hand($, pr)} />}
          <Button key="web" plain hotkey="3" label="Open in browser" onPress={() => browse($, pr)} />
          <Button key="refresh" plain hotkey="r" label="Refresh" onPress={() => refreshPr($)} />
        </Box>
      </Box>
    )
  })
ライセンスの全文(MIT)
MIT License

Copyright (c) 2026 cephalofoil and contributors

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.

コードが呼ぶもの

プログラム起動Claude を動かすツール呼び出し

コードから読み取ったデザイン

読み取ったコミットのソースから描いたもので、動かした結果ではありません。一覧は 3 回描き、条件はデスクトップアプリで描く最初の分岐を取り、動かしたときにだけ決まる値は仮の例(点線の下線)にするか省きます。色と書体はこのサイトのものです。

コードから読めること

2026-10-06 に読んだコミット 0fae13e2bc93 のソースから。最初のまとまりが載せる条件で、残りは自分で判断するための材料です。後のコミットは、次に読むまで見ていません。

載せる条件: 確かめやすいコード
入口を読んだhooks/hooks.json が名指すモジュールをすべて読んだ。pr-watch/hooks/register.tsx
解析できるすべてのファイルが TypeScript か JavaScript として解析できる。2 ファイルを解析
コードが 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/… などは無い)。Windows にないプログラムを使わない
通信fetch の送り先(https のホスト)がコードに書いてあるか。通信なし
プログラム起動するプログラムの名前がコードに書いてあり、シェル・インタプリタ・通信用の道具でないか。pr-watch/hooks/register.tsx:111 実行時に決まるプログラム
読んで送るファイルや環境変数を読み、かつ通信するか。通信しない
ソースの鍵ソースに API キーや秘密鍵らしきものがあるか。ソースに鍵なし
ライセンスオープンなライセンス(MIT・Apache-2.0・BSD・ISC・Unlicense・0BSD・CC0)で全文があれば、modscode にコードを載せる。違えばリンクだけ。MIT

コードの文面を読んだだけで、安全の審査ではありません。動かしてはおらず、起動するプログラムの中で何が起きるかも見えません。入れる前の確認はあなたの役目です。 載せる条件

入れる

入れる前に、必ず自分で確かめてください。Mod はサンドボックスなしで、あなたの権限で動きます。modscode はこのコードの安全を保証しません。下のコードを読み(またはフォルダーで claude plugin validate .)、触るものを見て、読んだコミットを入れてください。

リポジトリがそのままマーケットプレイスです。このマーケットプレイスを足し(ターミナルでは次のコマンド、デスクトップアプリではプラグインの設定)、そこから Mod を入れます。

/plugin marketplace add cephalofoil/kitt
/plugin install pr-watch@kitt

入るのはマーケットプレイスの最新のコミットで、ここで読んだもの(0fae13e2bc93)と違うことがあります。入れる前に見比べてください。

Claude に聞く

modscode のコネクタを入れると、Claude がこのデザイン・コードが触るもの・コードを読んで、それをもとに作れます。たとえば:

modscode のデザイン「cephalofoil-pr-watch」をコードごと読んで、同じようなペインを作って

Claude から探す: MCP コネクタ

似たデザイン