modscode EN

modscode / 図鑑 / parked

parked

A per-project backlog of items needing your attention, parked by you or the orchestrator

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

何をするか

  • 欄・トーストを描く
  • /park・/parked を足す
  • ツールの呼び出しを見張る(止めることがある)
  • prompt.compose・prompt.submit・session.start・state.set ほか 5 個にフックする
  • ターンをまたいで自分の状態を持つ

良いところ

  • ネットワークに出ない
  • プロセスを起こさない
  • TypeScript で書かれている
  • エラーを扱う

作り始めるためのコード

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

雛形(register.tsx)

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

// Drawn like parked by Kuang Tar Lim (pane, status, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/buddylim-parked/
// 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: "Parked" })
  on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
    const { Box, Text, Button } = $.ui.resolve(e)
    const summary = '…'
    const glyphOf = '…'
    const title = '…'
    const meta = '…'
    const glyphOf2 = '…'
    const meta2 = '…'
    const glyphOf3 = '…'
    const meta3 = '…'
    const meta4 = '…'
    const meta5 = '…'
    const meta6 = '…'
    const meta7 = '…'
    const meta8 = '…'
    const meta9 = '…'
    return (
      <Box flexDirection="column" paddingX={2}>
        <Text bold>
          {"📌 Parked · "}
          {summary}
        </Text>
        <Text dimColor>
          ────────
        </Text>
        <Text color="warning" bold>
          NEEDS ATTENTION
        </Text>
        <Box justifyContent="space-between">
          <Box>
            <Text>
              {glyphOf}
              {" "}
            </Text>
            <Button plain label={`${title}`} />
          </Box>
          <Text dimColor>
            {meta}
          </Text>
        </Box>
        <Box justifyContent="space-between">
          <Box>
            <Text>
              {glyphOf2}
              {" "}
            </Text>
            <Button plain label={`${title}`} />
          </Box>
          <Text dimColor>
            {meta2}
          </Text>
        </Box>
        <Box justifyContent="space-between">
          <Box>
            <Text>
              {glyphOf3}
              {" "}
            </Text>
            <Button plain label={`${title}`} />
          </Box>
          <Text dimColor>
            {meta3}
          </Text>
        </Box>
        <Box marginTop={1}>
          <Text color="cyan" bold>
            FYI
          </Text>
        </Box>
        <Box justifyContent="space-between">
          <Box>
            <Text>
              
              {" "}
            </Text>
            <Button plain label={`${title}`} />
          </Box>
          <Text dimColor>
            {meta4}
          </Text>
        </Box>
        <Box justifyContent="space-between">
          <Box>
            <Text>
              
              {" "}
            </Text>
            <Button plain label={`${title}`} />
          </Box>
          <Text dimColor>
            {meta5}
          </Text>
        </Box>
        <Box justifyContent="space-between">
          <Box>
            <Text>
              
              {" "}
            </Text>
            <Button plain label={`${title}`} />
          </Box>
          <Text dimColor>
            {meta6}
          </Text>
        </Box>
        <Box marginTop={1}>
          <Text color="success" bold>
            DONE
          </Text>
        </Box>
        <Box justifyContent="space-between">
          <Box>
            <Text>
              
              {" "}
            </Text>
            <Button plain label={`${title}`} />
          </Box>
          <Text dimColor>
            {meta7}
          </Text>
        </Box>
        <Box justifyContent="space-between">
          <Box>
            <Text>
              
              {" "}
            </Text>
            <Button plain label={`${title}`} />
          </Box>
          <Text dimColor>
            {meta8}
          </Text>
        </Box>
        <Box justifyContent="space-between">
          <Box>
            <Text>
              
              {" "}
            </Text>
            <Button plain label={`${title}`} />
          </Box>
          <Text dimColor>
            {meta9}
          </Text>
        </Box>
        <Text dimColor>
          ────────
        </Text>
        <Text dimColor>
          1-9 open · ↑↓ move · enter open · esc close
        </Text>
      </Box>
    )
  })

  on('session.start', async ($, e, next) => {
    const count = '…'
    const id = '…'
    await $.ui.toast(`Parked: ${count} in the prompt box. Press Enter to send into the running turn.`)
    await $.ui.toast(`Parked #${id}: default accepted. The agent already went that way.`)
    return next(e)
  })
}

Mod 自身のコード

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

hooks/register.tsx 913〜1072 行 · ペイン
  on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e, next) => {
    // The thread needs a text field, which the mobile surface does not draw.
    if (e.surface === 'mobile') {
      return next(e)
    }

    const table = $.ui.resolve(e)
    const { Box, Button, Input, Text } = table
    // The keyboard view is drawn only where the surface has Client.
    const Client = (await read($, lab)) && 'Client' in table ? table.Client : undefined
    const waiting = await read($, pending)
    const list = await read($, items)
    const openId = await read($, selected)
    const now = await $.clock.now()
    // What is drawn is narrower than the pane by the padding at each side.
    const columns = Math.max(30, (e.props.bodyColumns ?? e.viewport?.columns ?? 60) - 2 * PAD)
    const rule = '─'.repeat(columns)

    const open = list.filter(one => one.status === 'open')
    // Those work is blocked on come first, as `orderOf` has them.
    const asked = open.filter(one => one.kind === 'needs-you')
    const needs = [
      ...asked.filter(one => one.isBlocking === true),
      ...asked.filter(one => one.isBlocking !== true),
    ]
    const toneOf = (one: ParkedItem) => (one.isBlocking === true ? 'error' : 'warning')
    const glyphOf = (one: ParkedItem) => (one.isBlocking === true ? ICON.blocking : ICON.needs)
    const isAnswering = await read($, answering)
    const fyi = open.filter(one => one.kind === 'fyi')
    const done = list.filter(one => one.status === 'done').slice(-10).reverse()
    // The order the list draws in, which Next and Prev walk.
    const order = orderOf(list)
    const item = order.find(one => one.id === openId)
    // A row of the pane's own buttons, one per letter. Claude Code presses one
    // when its letter is typed while the pane has the keyboard (ctrl+x tab),
    // with no click; the press is handed to the keyboard region as that key.
    const legend = (keys: readonly (readonly [string, string])[]) => (
      <Box columnGap={2}>
        {keys.map(([hot, means]) => (
          <Button
            key={`key-${hot}`}
            plain
            dimColor
            hotkey={hot}
            label={means}
            onPress={async () => {
              // While the composer is in use a letter is text for it, never a
              // shortcut: the press means the text field did not get the key.
              if (await read($, typing)) {
                await update($, draft, text => `${text}${hot}`)
              } else {
                await update($, nudge, last => ({ key: hot, n: last.n + 1 }))
              }
            }}
          />
        ))}
      </Box>
    )

    const go = async (id: number) => {
      await update($, back, () => 0)
      await update($, top, () => 0)
      await update($, selected, () => id)
    }

    if (item !== undefined) {
      const at = order.indexOf(item)
      const before = order[at - 1]
      const after = order[at + 1]
      const isOpen = item.status === 'open'
      const thread = item.thread ?? []
      const isWaiting = waiting.includes(item.id)
      const tone = !isOpen ? 'success' : item.kind === 'fyi' ? 'cyan' : toneOf(item)
      const label = !isOpen
        ? `${ICON.done} DONE`
        : item.kind === 'fyi'
          ? `${ICON.fyi} FYI`
          : item.isBlocking === true
            ? `${ICON.blocking} NEEDS ATTENTION · BLOCKING`
            : `${ICON.needs} NEEDS ATTENTION`
      const canAccept = isOpen && item.preferred !== undefined

      // Every row is counted so the tree fits the pane's window exactly: the
      // header, the ticket and the composer stay put, and only the two regions
      // move. Fixed rows: status, title, meta, buttons, rule; then rule and
      // thread heading; then the bordered composer (three rows) and the hint.
      const bodyRows = Math.max(16, e.props.scroll.bodyRows) - 1
      // The note is part of the ticket's own rows, not a row above them.
      const noteRows = 0
      const doneRows = item.resolution !== undefined ? 1 : 0
      // The action buttons wrap in a narrow pane; count the rows they take.
      const actions = [
        canAccept ? 'a: Accept' : '',
        isOpen ? 'd: Done' : 'r: Reopen',
        isOpen ? 'w: Answer' : '',
        (item.refs ?? []).length > 0 ? 'g: Open' : '',
        after !== undefined ? 'n: Next' : '',
        before !== undefined ? 'p: Prev' : '',
        thread.some(one => one.role === 'agent') ? 's: Send' : '',
        'b: Back',
      ].filter(Boolean)
      let buttonRows = 1
      let used = 0

      for (const action of actions) {
        // A button draws as `[ label ]`, with one column between neighbours.
        const width = action.length + 4

        if (used > 0 && used + 1 + width > columns) {
          buttonRows += 1
          used = width
        } else {
          used += (used > 0 ? 1 : 0) + width
        }
      }

      // The keyboard view has six rows beneath its region (actions, composer,
      // send, letter keys), one more than the classic view counts with one
      // button row.
      if (Client !== undefined) {
        buttonRows = 3
      }

      const room = Math.max(6, bodyRows - (4 + buttonRows + noteRows + doneRows + 2 + 4))
      const ticket = ticketLines(item, columns)
      const ticketRows = Math.min(ticket.length, Math.max(3, Math.floor(room * 0.4)))
      const threadRows = Math.max(3, room - ticketRows)
      const talk = threadLines(thread, columns)
      const maxTop = Math.max(0, ticket.length - ticketRows)
      const maxBack = Math.max(0, talk.length - threadRows)
      const topAt = Math.min(await read($, top), maxTop)
      const backAt = Math.min(await read($, back), maxBack)
      const end = talk.length - backAt
      const shown = talk.slice(Math.max(0, end - threadRows), end)
      const ticketStart = 4 + buttonRows + noteRows + doneRows
      layout = { ticketStart, ticketEnd: ticketStart + ticketRows, maxTop, maxBack }

      const more = (above: number, below: number) =>
        [above > 0 ? `↑${above}` : '', below > 0 ? `↓${below}` : ''].filter(Boolean).join(' ')

      // Where the surface has Client, the whole item is one region that owns
      // the keyboard once clicked: ↑ and ↓ move between the tickets, the
      // actions, the composer and Send, and ← and → act on the level in focus.
      // What it posts is answered by the `ui.message` hook.
      if (Client !== undefined) {
        const inner = 5 + noteRows + doneRows
        layout = { ticketStart: inner, ticketEnd: inner + ticketRows, maxTop, maxBack }
        const isTyping = await read($, typing)
        const typed = await read($, draft)

        return (
          <Box flexDirection="column" paddingX={PAD}>
            <Client
              key="detail"
              module="./detail.tsx"
              height={bodyRows - 5}
              props={{
                nudge: await read($, nudge),
                isTyping,
                typingAt: await read($, typingAt),
ライセンスの全文(MIT)
MIT License

Copyright (c) 2026 Kuang Tar Lim

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 に読んだコミット 698dbffaf529 のソースから。最初のまとまりが載せる条件で、残りは自分で判断するための材料です。後のコミットは、次に読むまで見ていません。

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

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

入れる

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

リポジトリの .claude-plugin/marketplace.json にこの Mod が載っていないため、入れる手順は出せません。コードとして読むか、作者の README に従ってください。

Claude に聞く

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

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

Claude から探す: MCP コネクタ

似たデザイン