modscode JA

modscode / Gallery / pr-inbox

pr-inbox

An inbox for review requests and your own PRs: AI summary and risk, an AI review that can approve, a reader for the description and diff, merging (gh stack too) and CI fixes with Claude

Code you can checkTerminal + desktopPaneStatus lineToastBoxButtonLinkText

What it does

  • Draws a pane, the status line, toasts
  • Adds /pr-inbox
  • Watches tool calls and can refuse them
  • Hooks session.start, turn.complete, turn.start, ui.close
  • Keeps its own state between turns

Good points

  • No network calls
  • Written in TypeScript
  • Handles errors
  • Writes no files

Code to start from

Two kinds: a starter modscode writes from the design above, and the lines of the mod's own code that draw it.

Starter (register.tsx)

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

// Drawn like pr-inbox by 2bo (pane, status, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/2bo-pr-inbox/
// 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 pane: open it with $.ui.open({ id: 'my-pane', title: "PR Inbox" })
  on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
    const { Box, Text, Link, Button } = $.ui.resolve(e)
    const prLink = '…'
    const label = '…'
    const title = '…'
    const what = '…'
    return (
      <Box flexDirection="column">
        <Box flexDirection="row" columnGap={1}>
          <Text color="#ff00d7">
            ▍
          </Text>
          <Text color="#ff00d7" bold>
            read
          </Text>
          <Link href={`${prLink}`}>
            <Text color="#00d7ff" underline>
              {label}
            </Text>
          </Link>
          <Text bold wrap="truncate-end">
            {title}
          </Text>
        </Box>
        <Text color="#af5fff">
          ━━━━━━━━
        </Text>
        <Text color="#ff5f5f">
          {what}
        </Text>
        <Box flexDirection="row" columnGap={2}>
          <Button label={`${label}`} hotkey="q" plain />
        </Box>
        Still fetching · q goes back
      </Box>
    )
  })

  on('session.start', async ($, e, next) => {
    const error = '…'
    const number = '…'
    await $.ui.status(`Could not fetch PRs: ${error}`)
    await $.ui.toast(`Unsnoozed #${number}`)
    await $.ui.toast(`Snoozed #${number} until it is updated (z shows snoozed PRs)`)
    return next(e)
  })
}

The mod's own code

Shown under the mod's licence (MIT); its text is below. Keep the notice if you copy these lines.

hooks/register.ts lines 3406–3565 · Pane
  on('ui.render', { component: 'Pane' }, async ($, e, next) => {
    if (e.requestId !== PANE || !diffView) return next(e)
    const kit = $.ui.resolve(e)
    const { Box, Link, Code, Markdown } = kit
    const { Text, Button } = glyphed(kit)
    type El = ReturnType<typeof Box>
    const redraw = () => $.ui.invalidate('ui.render')
    // One cell short of the width: a symbol a terminal draws two cells wide does not wrap a full-width row
    const columns = Math.max(40, (e.props.bodyColumns ?? 80) - 1)
    const focused = e.props.isFocused === true
    const v = diffView
    const key = (k: string, label: string, hotkey: string, onPress: () => void, dim = false) =>
      Button({ key: k, label, hotkey, plain: true, dimColor: dim, onPress })
    const close = key('diff-close', 'back', 'q', () => {
      diffView = undefined
      redraw()
    })
    const { pr } = v
    const label = `${pr.repository.nameWithOwner.split('/')[1] ?? pr.repository.nameWithOwner}#${pr.number}`
    const prLink = safeHref(pr.url)
    const head: El[] = [
      Box({
        flexDirection: 'row',
        columnGap: 1,
        children: [
          Text({ color: focused ? NEON.pink : NEON.rule, children: ['▍'] }),
          Text({ color: NEON.pink, bold: true, children: ['read'] }),
          prLink
            ? Link({ href: prLink, children: [Text({ color: NEON.cyan, underline: true, children: [label] })] })
            : Text({ children: [label] }),
          Text({ bold: true, wrap: 'truncate-end', children: [fit(pr.title, Math.max(10, columns - textWidth(label) - 8))] }),
        ],
      }),
    ]
    const rule = Text({ color: focused ? NEON.violet : NEON.rule, children: ['━'.repeat(columns)] })
    const toast = (text: string) => $.ui.toast(text, { timeoutMs: 4000 })
    // n: the next PR in the list, read the same way
    const nextPr = () => {
      const rows = visibleRows(groups(fetchedAt || Date.now()))
      const i = rows.findIndex((p) => p.url === pr.url)
      const following = rows[i + 1] ?? (i < 0 ? rows[0] : undefined)
      if (!following) return toast('This is the last PR in the list · q goes back')
      selected = following.url
      void openDiff($, following)
    }
    const nextKey = key('diff-next-pr', 'next PR', 'n', nextPr, true)
    if (v.loading || v.error) {
      const what = v.loading
        ? `${SPINNER[Math.floor(Date.now() / 100) % SPINNER.length]} fetching the PR…`
        : `✗ ${fit(v.error, columns - 4)}`
      // A failed read still offers the way on: the whole PR (when this was the change since your approval), GitHub,
      // the next PR, back
      const ways = v.error
        ? [
            ...(isApproved(pr) && approvalOutdated(pr) ? [key('diff-since', 'all changes', 't', () => void openDiff($, pr, 'all'))] : []),
            key('diff-open', 'open on GitHub', 'o', async () => void (await $.process.run(['gh', 'pr', 'view', pr.url, '--web']))),
            nextKey,
          ]
        : []
      const tree = [
        ...head,
        rule,
        Text({ color: v.error ? NEON.red : NEON.muted, children: [what] }),
        Box({ flexDirection: 'row', columnGap: 2, children: [...ways, close] }),
      ]
      return Box({ flexDirection: 'column', children: [...tree, keyCatcher(kit, tree, () => 'Still fetching · q goes back', toast)] })
    }
    const files = v.files
    // Pages: the description, then each file
    const pages = files.length + 1
    const at = Math.min(Math.max(0, v.at), pages - 1)
    const file = at > 0 ? (files[at - 1] as DiffFile) : undefined
    const go = (to: number) => {
      v.at = Math.min(Math.max(0, to), pages - 1)
      v.block = 0
      v.list = false
      redraw()
    }
    const counts = (f: DiffFile) => `+${f.additions} -${f.deletions}`
    const marks = (f: DiffFile) => {
      const found = findingsIn(pr, f.path)
      const bad = found.filter((x) => findingMark(x) === '✗').length
      const soft = found.length - bad
      return { bad, soft, text: [bad ? `✗${bad}` : '', soft ? `△${soft}` : ''].filter(Boolean).join(' ') }
    }
    // j/k: the next or previous block of lines, scrolled to the top of the pane
    const blocks = file && !(isGenerated(file.path) && !v.showGenerated.has(file.path)) ? file.pieces.length : 0
    const scrollTo = (block: number) => {
      if (blocks === 0) return toast(file ? 'Nothing to scroll here · l: next file' : 'j/k scroll a file · l: the first file')
      v.block = Math.min(Math.max(0, block), blocks - 1)
      $.ui.scroll(v.block === 0 ? { to: 'start', in: PANE } : { to: { key: `block-${v.block}` }, in: PANE, block: 'start' }).catch(() => {
        // A surface that does not scroll: the arrow keys still do
      })
    }
    // What you can do with the PR without leaving the reader
    const isReview = review.some((p) => p.url === pr.url)
    const actOnPr: El[] = []
    if (isReview && reviews.get(pr.url)?.state !== 'running') actOnPr.push(key('diff-approve', 'approve', 'a', () => void approve($, pr)))
    if (isApproved(pr) && approvalOutdated(pr)) actOnPr.push(key('diff-approve', 'approve again', 'a', () => void approve($, pr)))
    if (isReview)
      actOnPr.push(
        key('diff-review', reviews.get(pr.url)?.state === 'running' ? 'cancel review' : 'review', 'v', () => void aiReview($, pr)),
      )
    actOnPr.push(
      key('diff-explain', mine.some((p) => p.url === pr.url) ? 'diagnose' : 'explain', 'e', () => {
        void $.prompt.submit({ text: explainRequest(pr), asUser: true })
        toast(`Asked Claude about #${pr.number}`)
      }),
    )
    // Since your approval, or the whole PR
    const since = v.since
    const toggleSince =
      isApproved(pr) && approvalOutdated(pr)
        ? [
            key('diff-since', since ? 'all changes' : 'since approval', 't', () => {
              void openDiff($, pr, since ? 'all' : 'since')
            }),
          ]
        : []
    const keys = Box({
      key: 'diff-keys',
      flexDirection: 'row',
      flexWrap: 'wrap',
      columnGap: 2,
      children: v.list
        ? [
            key('diff-cursor-down', '↓', 'j', () => {
              v.cursor = Math.min(pages - 1, v.cursor + 1)
              redraw()
            }),
            key('diff-cursor-up', '↑', 'k', () => {
              v.cursor = Math.max(0, v.cursor - 1)
              redraw()
            }),
            key('diff-pick', 'open', 'l', () => go(v.cursor)),
            key('diff-list', 'close', 'f', () => {
              v.list = false
              redraw()
            }),
            close,
          ]
        : [
            key('diff-prev', '◂', 'h', () => (at === 0 ? toast('This is the description · l: the first file') : go(at - 1)), at === 0),
            key(
              'diff-next',
              '▸',
              'l',
              () => (at === pages - 1 ? toast('End of this PR · n: the next PR · q: back') : go(at + 1)),
              at === pages - 1,
            ),
            key('diff-down', '↓', 'j', () => scrollTo(v.block + 1), blocks === 0),
            key('diff-up', '↑', 'k', () => scrollTo(v.block - 1), blocks === 0),
            key('diff-list', 'files', 'f', () => {
              v.list = true
              v.cursor = at
              redraw()
            }),
            ...(file && isGenerated(file.path)
              ? [
                  key('diff-generated', v.showGenerated.has(file.path) ? 'fold' : 'show', 'g', () => {
Licence text (MIT)
MIT License

Copyright (c) 2026 2bo

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.

What its code calls

runs programsenv varsdrives Claudetool callsremembers

The design, read from code

Drawn from the mod's source at the commit read, not from a run: a list is drawn three times, a condition takes its first branch that draws in the desktop app, and a value only the run time knows is shown as a made-up sample (dotted underline) or left out. Colours and type are this site's.

What its code shows

Read from the source at commit 503ad9199786 on 2026-10-06. The first group decides whether a mod is listed; the rest is for you to weigh. A later commit is not read until the next crawl.

Decides the listing: code you can check
Entry readEvery module hooks/hooks.json names was read.hooks/register.ts
ParsesEvery file parses as TypeScript or JavaScript.1 files parsed
All its code is in the modEvery import is a file of the mod or the engine's own module; no packages, no require.all its code is in the mod
ReadableNo minified lines, no eval or new Function, no import of a computed path, no encoded blobs.no minified code, no eval, no encoded blobs
Calls in the openNetwork and programs are reached as $.http.fetch and $.process.run in place, never passed around.every call outside goes through $ in the open
For you to weigh before installing
Where it drawsThe terminal, the desktop app, both, or nothing (hooks only: a guard or a prompt rewriter), as its code says. Shown, never a reason to leave a mod out.draws in the terminal and the desktop app, the same in both
Install lineWhether its repository's own .claude-plugin/marketplace.json lists it, so it installs from that marketplace with the lines on its page.listed in its repository's .claude-plugin/marketplace.json: installs from there
Programs on WindowsWhether every program it starts through $.process exists on Windows (tail, date, open, osascript, /usr/… do not).runs no program a Windows PC lacks
NetworkWhether every fetch names its https host in the code.no network
ProgramsWhether every program it starts is named in the code and is not a shell, an interpreter or a network tool.hooks/register.ts:1001 a program named at run time
Reads and sendsWhether it both reads files or environment variables and reaches the network.reads environment variables and reaches the network
Keys in the sourceWhether the source holds what looks like an API key or a private key.no keys in the source
LicenceAn open licence (MIT, Apache-2.0, BSD, ISC, Unlicense, 0BSD, CC0) with its text lets modscode show its code; otherwise the code is linked.MIT

This is a reading of the code text, not a security review: it does not run the mod, and it cannot see what a program the mod starts does. The check before installing is yours. How mods are chosen

Install it

Check it yourself before you install it. Mods run unsandboxed, with your permissions, and modscode does not vouch for what this code does. Read the code below (or run claude plugin validate . in its folder), weigh what it reaches, and install the commit you read.

Its repository is its marketplace. Add that marketplace (in the terminal with these commands, or in the desktop app's plugin settings) and install the mod from it:

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

This installs the marketplace's latest commit, which may not be the one read here (503ad9199786). Compare them before you install.

Ask Claude about it

With the modscode connector added, Claude can read this design, what its code reaches and its code, and build on them. Ask it like this:

Read the modscode design "2bo-pr-inbox" with its code and make me a pane like it

Search them from Claude: the MCP connector

Similar designs