modscode EN

modscode / 図鑑 / lavish-pages

lavish-pages

Shows the Lavish pages this session opened, whether each is streaming, idle, closed or dead, with a one-line description of each and open and end buttons

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

何をするか

  • プロンプトの上の帯・欄・トーストを描く
  • /lavish-pages を足す
  • Write・Edit・Bash の呼び出しを見張る
  • session.startにフックする
  • ターンをまたいで自分の状態を持つ

良いところ

  • TypeScript で書かれている
  • エラーを扱う
  • ファイルを書かない

作り始めるためのコード

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

雛形(register.tsx)

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

// Drawn like lavish-pages by FoCDoT (pane, band, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/focdot-lavish-pages/
// 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 summary = '…'
    const label = '…'
    const name = '…'
    const inline = '…'
    const metaText = '…'
    const label2 = '…'
    const metaText2 = '…'
    const label3 = '…'
    const metaText3 = '…'
    const more = '…'
    const length = '…'
    return (
      <Box flexDirection="column">
        <Box flexDirection="row">
          <Text bold>
            {"lavish "}
          </Text>
          <Text dimColor wrap="truncate-end">
            {summary}
            {"  "}
          </Text>
          <Button label="collapse" plain dimColor />
          <Text>
            {" "}
          </Text>
          <Button label="hide" plain dimColor />
        </Box>
        <Box flexDirection="row">
          <Text>
            {label}
          </Text>
          <Button label={`${name}`} plain />
          <Text dimColor>
            {` · ${inline}`}
          </Text>
          <Text dimColor>
            {metaText}
          </Text>
          <Text>
            {" "}
          </Text>
          <Button label="open" />
          <Button label="end" />
          <Button label="reopen" />
          <Button label="forget" dimColor />
        </Box>
        <Box flexDirection="row">
          <Text>
            {label2}
          </Text>
          <Button label={`${name}`} plain />
          <Text dimColor>
            {` · ${inline}`}
          </Text>
          <Text dimColor>
            {metaText2}
          </Text>
          <Text>
            {" "}
          </Text>
          <Button label="open" />
          <Button label="end" />
          <Button label="reopen" />
          <Button label="forget" dimColor />
        </Box>
        <Box flexDirection="row">
          <Text>
            {label3}
          </Text>
          <Button label={`${name}`} plain />
          <Text dimColor>
            {` · ${inline}`}
          </Text>
          <Text dimColor>
            {metaText3}
          </Text>
          <Text>
            {" "}
          </Text>
          <Button label="open" />
          <Button label="end" />
          <Button label="reopen" />
          <Button label="forget" dimColor />
        </Box>
        <Text dimColor>
          {`  +${more} more · /lavish-pages lists them all`}
        </Text>
        <Button label={`hide ${length} closed`} plain dimColor />
        {await next(e)}
      </Box>
    )
  })

  // the pane: open it with $.ui.open({ id: 'my-pane', title: "Lavish pages" })
  on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
    const { Box, Text, Button } = $.ui.resolve(e)
    const summary = '…'
    const label = '…'
    const name = '…'
    const inline = '…'
    const metaText = '…'
    const below = '…'
    const label2 = '…'
    const metaText2 = '…'
    const label3 = '…'
    const metaText3 = '…'
    return (
      <Box flexDirection="column">
        <Text dimColor wrap="truncate-end">
          {summary}
        </Text>
        <Text dimColor>
          No Lavish pages from this session.
        </Text>
        <Box flexDirection="column">
          <Box flexDirection="row">
            <Text>
              {label}
            </Text>
            <Button label={`${name}`} plain />
            <Text dimColor>
              {` · ${inline}`}
            </Text>
            <Text dimColor>
              {metaText}
            </Text>
            <Text>
              {" "}
            </Text>
            <Button label="open" />
            <Button label="end" />
            <Button label="reopen" />
            <Button label="forget" dimColor />
          </Box>
          <Text dimColor wrap="truncate-end">
            {`    ${below}`}
          </Text>
        </Box>
        <Box flexDirection="column">
          <Box flexDirection="row">
            <Text>
              {label2}
            </Text>
            <Button label={`${name}`} plain />
            <Text dimColor>
              {` · ${inline}`}
            </Text>
            <Text dimColor>
              {metaText2}
            </Text>
            <Text>
              {" "}
            </Text>
            <Button label="open" />
            <Button label="end" />
            <Button label="reopen" />
            <Button label="forget" dimColor />
          </Box>
          <Text dimColor wrap="truncate-end">
            {`    ${below}`}
          </Text>
        </Box>
        <Box flexDirection="column">
          <Box flexDirection="row">
            <Text>
              {label3}
            </Text>
            <Button label={`${name}`} plain />
            <Text dimColor>
              {` · ${inline}`}
            </Text>
            <Text dimColor>
              {metaText3}
            </Text>
            <Text>
              {" "}
            </Text>
            <Button label="open" />
            <Button label="end" />
            <Button label="reopen" />
            <Button label="forget" dimColor />
          </Box>
          <Text dimColor wrap="truncate-end">
            {`    ${below}`}
          </Text>
        </Box>
      </Box>
    )
  })

  on('session.start', async ($, e, next) => {
    const stderr = '…'
    await $.ui.toast(`lavish: ${stderr}`)
    return next(e)
  })
}

Mod 自身のコード

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

lavish-pages/hooks/register.tsx 462〜516 行 · バンド
  on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
    const list = ordered(await read($, pages))
    if (e.props.hasSurvey || list.length === 0 || (await read($, isHidden))) return next(e)

    const { Box, Text, Button } = $.ui.resolve(e)
    const columns = e.props.bodyColumns
    const expandedSetting = await read($, isExpanded)
    const expanded = expandedSetting ?? list.length <= AUTO_EXPAND_MAX
    const withClosed = await read($, showClosed)

    const header = (
      <Box flexDirection="row">
        <Text bold>lavish </Text>
        <Text dimColor wrap="truncate-end">
          {summary(list)}
          {'  '}
        </Text>
        <Button
          key="toggle"
          label={expanded ? 'collapse' : 'expand'}
          plain
          dimColor
          onPress={() => update($, isExpanded, () => !expanded)}
        />
        <Text> </Text>
        <Button key="hide" label="hide" plain dimColor onPress={() => update($, isHidden, () => true)} />
      </Box>
    )
    if (!expanded) return header

    const active = list.filter(p => !isDone(p))
    const done = list.filter(isDone)
    const candidates = withClosed ? [...active, ...done] : active
    // Header, the closed toggle and the "+N more" line take three rows at most.
    const room = Math.max(1, Math.min(BAND_ROWS_MAX, e.props.maxRows - 3))
    const shown = candidates.slice(0, room)
    const more = candidates.length - shown.length

    return (
      <Box flexDirection="column">
        {header}
        {shown.map(page => row($, e, page, columns))}
        {more > 0 && <Text dimColor>{`  +${more} more · /lavish-pages lists them all`}</Text>}
        {done.length > 0 && (
          <Button
            key="closed"
            label={withClosed ? `hide ${done.length} closed` : `show ${done.length} closed`}
            plain
            dimColor
            onPress={() => update($, showClosed, () => !withClosed)}
          />
        )}
      </Box>
    )
  })
lavish-pages/hooks/register.tsx 320〜379 行 · バンド
function row(
  $: EngineInterface,
  e: Parameters<EngineInterface['ui']['resolve']>[0],
  page: LavishPage,
  columns: number,
  descBelow = false,
) {
  const { Box, Text, Button } = $.ui.resolve(e)
  const run = async (argv: string[], done: string) => {
    const res = await $.process.run(argv, { timeoutMs: 20000 })
    $.ui.toast(res.exitCode === 0 ? done : `lavish: ${(res.stderr || res.stdout).trim().slice(0, 120)}`)
    await refresh($)
  }
  const name = nameOf(page.file)
  const isNarrow = columns < 70
  const label = isNarrow ? `${GLYPH[page.status]} ` : `${GLYPH[page.status]} ${WORD[page.status]}`.padEnd(12)
  const meta = [
    page.prompts > 0 && !isDone(page) ? `${page.prompts} queued` : '',
    page.status === 'closed' && page.endedBy ? `by ${page.endedBy === 'user' ? 'you' : page.endedBy}` : '',
    !isNarrow && page.rev !== undefined ? `r${page.rev}` : '',
  ].filter(Boolean)
  const metaText = meta.length > 0 ? `  ${meta.join(' · ')}` : ''
  const buttons = isLive(page) ? 16 : page.status === 'pending' ? 8 : 20
  const room = Math.max(8, columns - label.length - metaText.length - buttons - 2)
  const nameWidth = Math.min(room, name.length)
  const inline = descBelow ? undefined : descFit(page.desc, room - nameWidth - 3)
  const canOpen = page.url !== undefined && !isDone(page) && page.status !== 'dead'

  return (
    <Box key={`row-${page.file}`} flexDirection="row">
      <Text bold={page.status === 'streaming'} dimColor={!isLive(page)}>
        {label}
      </Text>
      <Button
        key={`name-${page.file}`}
        label={fit(name, nameWidth)}
        plain
        dimColor={isDone(page)}
        onPress={() => page.url && run(['open', page.url], `Opened ${name}`)}
      />
      {inline !== undefined && <Text dimColor>{` · ${inline}`}</Text>}
      {metaText !== '' && <Text dimColor>{metaText}</Text>}
      <Text> </Text>
      {canOpen && <Button key={`open-${page.file}`} label="open" onPress={() => run(['open', page.url!], `Opened ${name}`)} />}
      {isLive(page) && (
        <Button key={`end-${page.file}`} label="end" onPress={() => run(['lavish-axi', 'end', page.file], `Ended ${name}`)} />
      )}
      {(isDone(page) || page.status === 'dead') && (
        <Button
          key={`reopen-${page.file}`}
          label="reopen"
          onPress={() => run(['lavish-axi', page.file, '--reopen'], `Reopened ${name}`)}
        />
      )}
      {(isDone(page) || page.status === 'dead') && (
        <Button key={`forget-${page.file}`} label="forget" dimColor onPress={() => save($, l => l.filter(p => p.file !== page.file))} />
      )}
    </Box>
  )
}
lavish-pages/hooks/register.tsx 518〜530 行 · ペイン
  on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
    const { Box, Text } = $.ui.resolve(e)
    const list = ordered(await read($, pages))
    return (
      <Box flexDirection="column">
        <Text dimColor wrap="truncate-end">
          {summary(list)}
        </Text>
        {list.length === 0 && <Text dimColor>No Lavish pages from this session.</Text>}
        {list.map(page => paneRow($, e, page, e.props.bodyColumns))}
      </Box>
    )
  })
lavish-pages/hooks/register.tsx 382〜391 行 · ペイン
function paneRow($: EngineInterface, e: Parameters<EngineInterface['ui']['resolve']>[0], page: LavishPage, columns: number) {
  const { Box, Text } = $.ui.resolve(e)
  const below = descFit(page.desc, columns - 4)
  return (
    <Box key={`pane-${page.file}`} flexDirection="column">
      {row($, e, page, columns, true)}
      {below !== undefined && <Text dimColor wrap="truncate-end">{`    ${below}`}</Text>}
    </Box>
  )
}
ライセンスの全文(MIT)
MIT License

Copyright (c) 2026 FoCDoT

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

載せる条件: 確かめやすいコード
入口を読んだhooks/hooks.json が名指すモジュールをすべて読んだ。lavish-pages/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/… などは無い)。lavish-pages/hooks/register.tsx:104 find(Windows にない); lavish-pages/hooks/register.tsx:117 grep(Windows にない); lavish-pages/hooks/register.tsx:118 grep(Windows にない)
通信fetch の送り先(https のホスト)がコードに書いてあるか。lavish-pages/hooks/register.tsx:184 fetch(`${baseOf(list)}/health`)
プログラム起動するプログラムの名前がコードに書いてあり、シェル・インタプリタ・通信用の道具でないか。lavish-pages/hooks/register.tsx:329 実行時に決まるプログラム
読んで送るファイルや環境変数を読み、かつ通信するか。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 FoCDoT/lavish-pages
/plugin install lavish-pages@lavish-pages

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

Claude に聞く

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

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

Claude から探す: MCP コネクタ

似たデザイン