modscode EN

modscode / 図鑑 / show-and-tell

show-and-tell

📸 Shows you the pictures: a thumbnail the moment you paste one, and /gallery of every image you and Claude passed around this session.

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

何をするか

  • プロンプトの上の帯・欄・トーストを描く
  • /gallery を足す
  • Read・Write・Edit・Bash の呼び出しを見張る
  • classic.SessionStart・prompt.submit・session.append・session.end ほか 1 個にフックする
  • ターンをまたいで自分の状態を持つ

良いところ

  • ネットワークに出ない
  • TypeScript で書かれている
  • デスクトップ専用の分岐がある

作り始めるためのコード

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

雛形(register.tsx)

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

// Drawn like show-and-tell by Lorcan Chinnock (pane, band, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/lorcanchinnock-show-and-tell/
// 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 length = '…'
    return (
      <Box flexDirection="column">
        <Box flexDirection="row" flexWrap="wrap" columnGap={2}>
          <Box flexShrink={1}>
            <Text>
              {"📸 "}
              {` and ${length} more`}
            </Text>
          </Box>
          <Box flexShrink={0}>
            <Button plain label="Gallery" />
          </Box>
        </Box>
        {await next(e)}
      </Box>
    )
  })

  // the pane: open it with $.ui.open({ id: 'my-pane', title: "📸 Show & Tell" })
  on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
    const { Box, Text, Button } = $.ui.resolve(e)
    const length = '…'
    const hotkey = '…'
    const label = '…'
    const ICON = '…'
    const sizeText = '…'
    const SOURCE_WORD = '…'
    const clockTime = '…'
    const path = '…'
    const length2 = '…'
    const ICON2 = '…'
    const label2 = '…'
    const sizeText2 = '…'
    const SOURCE_WORD2 = '…'
    const clockTime2 = '…'
    const path2 = '…'
    const length3 = '…'
    return (
      <Box flexDirection="column">
        <Box flexDirection="row" flexWrap="wrap" columnGap={3} marginBottom={1}>
          <Box flexDirection="row">
            <Text bold>
              📸 Show & Tell
            </Text>
            <Text dimColor>
              {" "}
              {"· "}
              {length}
              {" image"}
              {" this session"}
            </Text>
          </Box>
          <Box flexDirection="row" columnGap={2}>
            <Button hotkey={`${hotkey}`} plain label={`${label}`} />
            <Button hotkey={`${hotkey}`} plain label={`${label}`} />
            <Button hotkey={`${hotkey}`} plain label={`${label}`} />
          </Box>
        </Box>
        <Text dimColor>
          Nothing yet. Paste an image with ctrl+v, or let Claude read or make one.
        </Text>
        <Box flexDirection="row">
          <Box flexDirection="column" flexGrow={1} flexShrink={1}>
            <Box flexDirection="column" marginBottom={1}>
              <Text bold wrap="truncate-end">
                {ICON}
                {" "}
                {label}
                {sizeText}
              </Text>
              <Text dimColor wrap="truncate-end">
                {SOURCE_WORD}
                {" at "}
                {clockTime}
                {" · "}
                {path}
              </Text>
              <Box flexDirection="row" flexWrap="wrap" columnGap={2}>
                <Button hotkey="o" plain label="Open" autoFocus />
                <Button hotkey="i" plain label="Insert @path" />
                <Button hotkey="p" plain label="Copy path" />
                <Button hotkey="f" plain label="Show in folder" />
              </Box>
            </Box>
            <Button plain label={`› ${clockTime}  ${ICON} ${label}${sizeText}`} />
            <Button plain label={`› ${clockTime}  ${ICON} ${label}${sizeText}`} />
            <Button plain label={`› ${clockTime}  ${ICON} ${label}${sizeText}`} />
            <Text dimColor>
              {" +"}
              {length2}
              {" more"}
            </Text>
          </Box>
        </Box>
        <Box flexDirection="column">
          <Box flexDirection="column" marginBottom={1}>
            <Text bold wrap="truncate-end">
              {ICON2}
              {" "}
              {label2}
              {sizeText2}
            </Text>
            <Text dimColor wrap="truncate-end">
              {SOURCE_WORD2}
              {" at "}
              {clockTime2}
              {" · "}
              {path2}
            </Text>
            <Box flexDirection="row" flexWrap="wrap" columnGap={2}>
              <Button hotkey="o" plain label="Open" autoFocus />
              <Button hotkey="i" plain label="Insert @path" />
              <Button hotkey="p" plain label="Copy path" />
              <Button hotkey="f" plain label="Show in folder" />
            </Box>
          </Box>
          <Button plain label={`› ${clockTime}  ${ICON} ${label}${sizeText}`} />
          <Button plain label={`› ${clockTime}  ${ICON} ${label}${sizeText}`} />
          <Button plain label={`› ${clockTime}  ${ICON} ${label}${sizeText}`} />
          <Text dimColor>
            {" +"}
            {length3}
            {" more"}
          </Text>
        </Box>
        <Box marginTop={1}>
          <Text dimColor>
            {"Kept "}
            7
            {" days · tab walks the list · esc closes"}
          </Text>
        </Box>
      </Box>
    )
  })

  on('session.start', async ($, e, next) => {
    const path = '…'
    const dirName = '…'
    await $.ui.toast(`📸 Could not open ${path}`)
    await $.ui.toast(`📸 Could not open ${dirName}`)
    return next(e)
  })
}

Mod 自身のコード

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

plugins/show-and-tell/hooks/register.tsx 545〜605 行 · バンド
  on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
    if (e.props.hasSurvey) return next(e)
    const ids = await read($, fresh)
    const list = await read($, shots)
    const showing = ids.map(id => list.find(s => s.id === id)).filter((s): s is Shot => s !== undefined)
    if (showing.length === 0) return next(e)
    const below = await next(e)
    const width = e.props.bodyColumns - MARKER
    const fits = Math.max(1, Math.floor((width - 22) / (THUMB_COLUMNS + 2)))
    const thumbRows = e.props.maxRows - 2
    if (e.surface === 'terminal' && thumbRows >= 3) {
      const { Box, Text, Button, Image } = $.ui.resolve(e)
      return (
        <Box flexDirection="column">
          {below}
          <Box flexDirection="row" columnGap={2} width={width}>
            {showing.slice(0, fits).map(shot => (
              <Box flexDirection="column" width={THUMB_COLUMNS} flexShrink={0}>
                {/* The label is under it, so where the terminal draws no pixels the alt says the size. */}
                {shot.thumb !== null && (
                  <Image
                    key={`band-${shot.id}`}
                    source={{ file: shot.thumb, format: 'png', generation: shot.at }}
                    columns={THUMB_COLUMNS}
                    rows={rowsFor(shot.width, shot.height, THUMB_COLUMNS, thumbRows)}
                    alt={shot.width !== null && shot.height !== null ? `${shot.width}×${shot.height}` : 'picture'}
                  />
                )}
                <Text dimColor wrap="truncate-end">
                  {ICON[shot.source]} {shot.label}
                </Text>
              </Box>
            ))}
            <Box flexDirection="column" flexShrink={0}>
              {showing.length > fits && <Text dimColor>+{showing.length - fits} more</Text>}
              <Button key="band-gallery" plain label="Gallery" onPress={() => void openGallery($)} />
              <Button key="band-dismiss" plain dimColor label="Dismiss" onPress={() => void $.state.set(FRESH, [])} />
            </Box>
          </Box>
        </Box>
      )
    }
    const { Box, Text, Button } = $.ui.resolve(e)
    const [first] = showing
    return (
      <Box flexDirection="column">
        {below}
        <Box flexDirection="row" flexWrap="wrap" columnGap={2} width={width}>
          <Box flexShrink={1}>
            <Text>
              📸 {first === undefined ? '' : `${ICON[first.source]} ${first.label}${sizeText(first)}`}
              {showing.length > 1 ? ` and ${showing.length - 1} more` : ''}
            </Text>
          </Box>
          <Box flexShrink={0}>
            <Button key="band-gallery" plain label="Gallery" onPress={() => void openGallery($)} />
          </Box>
        </Box>
      </Box>
    )
  })
plugins/show-and-tell/hooks/register.tsx 620〜731 行 · ペイン
  on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
    const all = await read($, shots)
    const which = await read($, filter)
    const pickedId = await read($, picked)
    const list = all.filter(s => which === 'all' || (which === 'you' ? s.source === 'you' : s.source !== 'you'))
    const current = list.find(s => s.id === pickedId) ?? list[0]
    const { bodyColumns } = e.props
    const bodyRows = e.props.scroll.bodyRows
    const isBeside = bodyColumns >= SIDE_BY_SIDE
    // Every row is counted: an inline pane may get far fewer than it asked for, and what does not
    // fit is cut off. The header (with the filters) takes 2, the footer 2 where there is room.
    const hasFooter = bodyRows >= 14
    const room = Math.max(3, bodyRows - 2 - (hasFooter ? 2 : 0))
    // Beside the picture: the details (3 rows and a gap), the list, and a "+N more" line if needed.
    const listFits = (rows: number) => (list.length <= rows ? list.length : Math.max(1, rows - 1))
    const listRows = isBeside ? listFits(room - 4) : listFits(Math.min(3, Math.max(1, room - 7)))
    const box = fitPicture(
      current?.width ?? null,
      current?.height ?? null,
      isBeside ? Math.min(PREVIEW_COLUMNS, Math.floor(bodyColumns * 0.45)) : Math.min(bodyColumns - 2, PREVIEW_COLUMNS),
      isBeside ? room : room - 4 - listRows - (list.length > listRows ? 1 : 0),
    )
    const hasPicture = current?.thumb != null && e.surface === 'terminal' && box.rows >= 3
    const tabs = (['all', 'you', 'claude'] as const).map(f => ({ f, label: f === 'all' ? 'All' : f === 'you' ? 'You' : 'Claude', hotkey: f[0] }))
    const { Box, Text, Button } = $.ui.resolve(e)
    const preview =
      hasPicture && current?.thumb != null && e.surface === 'terminal'
        ? (() => {
            const { Image } = $.ui.resolve(e)
            return (
              <Box flexShrink={0} marginRight={isBeside ? 2 : 0}>
                <Image
                  key="preview"
                  source={{ file: current.thumb, format: 'png', generation: current.at }}
                  columns={box.columns}
                  rows={box.rows}
                  alt="This terminal shows no pictures; o opens it"
                />
              </Box>
            )
          })()
        : null
    const details = current !== undefined && (
      <Box flexDirection="column" marginBottom={1}>
        <Text bold wrap="truncate-end">
          {ICON[current.source]} {current.label}
          {sizeText(current)}
        </Text>
        <Text dimColor wrap="truncate-end">
          {SOURCE_WORD[current.source]} at {clockTime(current.at)} · {current.path}
        </Text>
        <Box flexDirection="row" flexWrap="wrap" columnGap={2}>
          <Button key="act-open" hotkey="o" plain label="Open" autoFocus onPress={() => void openFile($, current.path)} />
          <Button key="act-insert" hotkey="i" plain label="Insert @path" onPress={() => void insertPath($, current.path)} />
          <Button key="act-copy" hotkey="p" plain label="Copy path" onPress={press => void copyPath($, current.path, press.surface)} />
          <Button key="act-folder" hotkey="f" plain label="Show in folder" onPress={() => void showInFolder($, current.path)} />
        </Box>
      </Box>
    )
    const picks = list.slice(0, listRows).map(shot => (
      <Button
        key={`pick-${shot.id}`}
        plain
        dimColor={shot.id !== current?.id}
        label={`${shot.id === current?.id ? '›' : ' '} ${clockTime(shot.at)}  ${ICON[shot.source]} ${shot.label}${sizeText(shot)}`}
        onPress={() => void $.state.set(PICKED, shot.id)}
      />
    ))
    const more = list.length > picks.length ? <Text dimColor>  +{list.length - picks.length} more</Text> : null
    return (
      <Box flexDirection="column">
        <Box flexDirection="row" flexWrap="wrap" columnGap={3} marginBottom={1}>
          <Box flexDirection="row">
            <Text bold>📸 Show & Tell</Text>
            <Text dimColor>
              {' '}
              · {all.length} image{all.length === 1 ? '' : 's'} this session
            </Text>
          </Box>
          <Box flexDirection="row" columnGap={2}>
            {tabs.map(t => (
              <Button key={`tab-${t.f}`} hotkey={t.hotkey} plain dimColor={t.f !== which} label={t.label} onPress={() => void $.state.set(FILTER, t.f)} />
            ))}
          </Box>
        </Box>
        {current === undefined && <Text dimColor>Nothing yet. Paste an image with ctrl+v, or let Claude read or make one.</Text>}
        {current !== undefined && isBeside && (
          <Box flexDirection="row">
            {preview}
            <Box flexDirection="column" flexGrow={1} flexShrink={1}>
              {details}
              {picks}
              {more}
            </Box>
          </Box>
        )}
        {current !== undefined && !isBeside && (
          <Box flexDirection="column">
            {preview}
            {details}
            {picks}
            {more}
          </Box>
        )}
        {hasFooter && (
          <Box marginTop={1}>
            <Text dimColor>Kept {KEEP_DAYS} days · tab walks the list · esc closes</Text>
          </Box>
        )}
      </Box>
    )
  })
ライセンスの全文(MIT)
MIT License

Copyright (c) 2026 Lorcan Chinnock

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

載せる条件: 確かめやすいコード
入口を読んだhooks/hooks.json が名指すモジュールをすべて読んだ。plugins/show-and-tell/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/… などは無い)。plugins/show-and-tell/hooks/register.tsx:121 uname(Windows にない); plugins/show-and-tell/hooks/register.tsx:349 find(Windows にない); plugins/show-and-tell/hooks/register.tsx:350 find(Windows にない)
通信fetch の送り先(https のホスト)がコードに書いてあるか。通信なし
プログラム起動するプログラムの名前がコードに書いてあり、シェル・インタプリタ・通信用の道具でないか。plugins/show-and-tell/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 LorcanChinnock/claude-desk-neighbours
/plugin install show-and-tell@claude-desk-neighbours

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

Claude に聞く

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

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

Claude から探す: MCP コネクタ

似たデザイン