modscode EN

modscode / 図鑑 / roco

roco

Pixel-art mascot that reacts live to what Claude does. Pick one of 8, recolor it or create your own with /roco:crear. Mascota pixel art para Claude Code.

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

何をするか

  • 欄・プロンプトの上の帯を描く
  • /roco を足す
  • mcp__roco__guardar_personaje・mcp__roco__ajustar の呼び出しを見張る(止めることがある)
  • session.start・turn.complete・turn.start・ui.closeにフックする
  • ターンをまたいで自分の状態を持つ

良いところ

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

作り始めるためのコード

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

雛形(register.tsx)

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

// Drawn like roco by s4duq (pane, band, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/s4duq-roco/
// 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: "‹titulo›" })
  on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
    const { Box, Text, Button } = $.ui.resolve(e)
    const pista = '…'
    const animo = '…'
    const mascotas = '…'
    const tema = '…'
    const color = '…'
    const info = '…'
    const tamano = '…'
    const crear = '…'
    const cerrar = '…'
    return (
      <Box flexDirection="column" gap={1}>
        <Text dimColor wrap="truncate-end">
          {pista}
        </Text>
        <Box flexDirection="column">
          <Text bold>
            {animo}
          </Text>
          <Box flexDirection="row" flexWrap="wrap" columnGap={1} />
        </Box>
        <Box flexDirection="column">
          <Text bold>
            {mascotas}
          </Text>
          <Box flexDirection="row" flexWrap="wrap" columnGap={1} />
        </Box>
        <Box flexDirection="column">
          <Text bold>
            {tema}
          </Text>
          <Box flexDirection="row" flexWrap="wrap" columnGap={1} />
        </Box>
        <Box flexDirection="column">
          <Text bold>
            {color}
          </Text>
          <Box flexDirection="row" flexWrap="wrap" columnGap={1} />
        </Box>
        <Box flexDirection="column">
          <Text bold>
            {info}
          </Text>
          <Box flexDirection="row" flexWrap="wrap" columnGap={1} />
        </Box>
        <Box flexDirection="column">
          <Text bold>
            {tamano}
          </Text>
          <Box flexDirection="row" flexWrap="wrap" columnGap={1} />
        </Box>
        <Box flexDirection="row" flexWrap="wrap" columnGap={2}>
          <Button label={`${crear}`} variant="primary" />
          <Button label={`${cerrar}`} role="dismiss" />
        </Box>
      </Box>
    )
  })

  // the band above the prompt; what else goes there is drawn under it
  on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
    const { Box, Svg, Text } = $.ui.resolve(e)
    const svg = '…'
    const nombreDisplay = '…'
    const animo = '…'
    const detalle = '…'
    const nombreDisplay2 = '…'
    const animo2 = '…'
    const detalle2 = '…'
    const nombreDisplay3 = '…'
    const animo3 = '…'
    const detalle3 = '…'
    const turnos = '…'
    const turnos2 = '…'
    const ediciones = '…'
    const comandos = '…'
    const errores = '…'
    const turnos3 = '…'
    const turnos4 = '…'
    const ediciones2 = '…'
    const comandos2 = '…'
    const errores2 = '…'
    const turnos5 = '…'
    const turnos6 = '…'
    const ediciones3 = '…'
    const comandos3 = '…'
    const errores3 = '…'
    return (
      <Box flexDirection="column">
        <Box flexDirection="row" alignItems="center" gap={1} width="100%" borderStyle="round">
          <Svg source={`${svg}`} alt={`${nombreDisplay} · ${animo}: ${detalle}`} />
          <Box flexGrow={1} flexShrink={1} minWidth={0}>
            <Box flexDirection="column" justifyContent="center" minWidth={0}>
              <Box flexDirection="row" minWidth={0}>
                <Text bold>
                  <Text>
                    {nombreDisplay}
                    {" ·"}
                  </Text>
                  {" "}
                  {animo}
                </Text>
                <Text dimColor wrap="truncate-end">
                  {" — "}
                  {detalle}
                </Text>
              </Box>
              <Box flexDirection="row" minWidth={0}>
                <Text bold>
                  <Text>
                    {nombreDisplay2}
                    {" ·"}
                  </Text>
                  {" "}
                  {animo2}
                </Text>
                <Text dimColor wrap="truncate-end">
                  {" — "}
                  {detalle2}
                </Text>
              </Box>
              <Box flexDirection="row" minWidth={0}>
                <Text bold>
                  <Text>
                    {nombreDisplay3}
                    {" ·"}
                  </Text>
                  {" "}
                  {animo3}
                </Text>
                <Text dimColor wrap="truncate-end">
                  {" — "}
                  {detalle3}
                </Text>
              </Box>
            </Box>
          </Box>
          <Box flexDirection="column" alignItems="flex-start" justifyContent="center" flexShrink={0}>
            <Text dimColor wrap="truncate-end">
              {"💬 "}
              {turnos}
              {" "}
              {turnos2}
              {" · ✏️ "}
              {ediciones}
              {" · ▶ "}
              {comandos}
              {" · ⚠ "}
              {errores}
            </Text>
            <Text dimColor wrap="truncate-end">
              {"💬 "}
              {turnos3}
              {" "}
              {turnos4}
              {" · ✏️ "}
              {ediciones2}
              {" · ▶ "}
              {comandos2}
              {" · ⚠ "}
              {errores2}
            </Text>
            <Text dimColor wrap="truncate-end">
              {"💬 "}
              {turnos5}
              {" "}
              {turnos6}
              {" · ✏️ "}
              {ediciones3}
              {" · ▶ "}
              {comandos3}
              {" · ⚠ "}
              {errores3}
            </Text>
          </Box>
        </Box>
        {await next(e)}
      </Box>
    )
  })
}

Mod 自身のコード

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

hooks/register.tsx 266〜292 行 · ペイン
  on('ui.render', { component: 'Pane', requestId: MENU }, async ($, e) => {
    const ui = $.ui.resolve(e)
    const animo = await read($, animoMenu)
    const tarjetas = await cargarGaleria($)
    const actual = { personaje: o.personaje, tema: o.temaId, acento: o.acento, campos: o.campos, estilo: o.estilo, animo }
    return panelMenu(ui, ov, actual, tarjetas, {
      animo: a => void update($, animoMenu, () => a),
      // El panel sigue abierto tras la recarga y se redibuja con lo nuevo.
      guardar: cambios =>
        void (async () => {
          if (!(await guardarEnOrden($, cambios))) $.ui.toast(tx.comando.noGuardado)
        })(),
      // Con el panel abierto (un diálogo) el cuadro no acepta texto: primero se cierra.
      crear: () =>
        void (async () => {
          await $.store.set('menuVisto', true).catch(() => undefined)
          await $.ui.close({ id: MENU }).catch(() => undefined)
          const r = await $.prompt.fill({ text: '/roco:crear ' }).catch(() => ({ isFilled: false }))
          $.ui.toast(r.isFilled ? tx.menu.escribeIdea : tx.menu.escribeComando)
        })(),
      cerrar: () =>
        void (async () => {
          await $.store.set('menuVisto', true).catch(() => undefined)
          await $.ui.close({ id: MENU }).catch(() => undefined)
        })(),
    })
  })
hooks/menu.tsx 75〜163 行 · ペイン
export function panelMenu(ui: PiezasMenu, o: Opciones, a: Actual, tarjetas: readonly Tarjeta[], hacer: AccionesMenu) {
  const { Box, Text, Button } = ui
  const { tx, tema } = o
  const m = tx.menu

  const seccion = (key: string, titulo: string, hijos: unknown[]) => (
    <Box key={key} flexDirection="column">
      <Text bold>{titulo}</Text>
      <Box flexDirection="row" flexWrap="wrap" columnGap={1}>
        {hijos}
      </Box>
    </Box>
  )

  const animos = ANIMOS.map((an, i) => (
    <Button key={`animo-${an}`} label={tx.animo[an]} hotkey={String(i + 1)} {...marca(an === a.animo)} onPress={() => hacer.animo(an)} />
  ))

  const galeria = tarjetas.map(t => (
    <Box key={`tarjeta-${t.id}`} flexDirection="column" alignItems="center" width={18}>
      {figura(ui, t, a.animo, `${t.nombre} · ${tx.animo[a.animo]}`)}
      <Text bold wrap="truncate-end">
        {t.nombre}
      </Text>
      {t.id === a.personaje ? (
        <Text color={tema.acento}>✓ {m.actual}</Text>
      ) : (
        <Button key={`elegir-${t.id}`} label={m.elegir} onPress={() => hacer.guardar([['roco.personaje', t.id]])} />
      )}
    </Box>
  ))

  // Un tema trae su color: si había un color propio, se quita después de guardar el tema.
  const temas = TEMAS_VALIDOS.map(t => (
    <Button
      key={`tema-${t}`}
      label={t}
      {...marca(t === a.tema)}
      onPress={() => hacer.guardar(a.acento ? [['roco.tema', t], ['roco.acento', '']] : [['roco.tema', t]])}
    />
  ))

  const colores = [
    ...COLORES.map(c => (
      <Box key={`color-${c.id}`} flexDirection="row">
        <Text color={c.hex}>● </Text>
        <Button key={`boton-${c.id}`} label={m.colores[c.id] ?? c.id} {...marca(c.hex === a.acento)} onPress={() => hacer.guardar([['roco.acento', c.hex]])} />
      </Box>
    )),
    <Button key="color-tema" label={m.colorTema} {...marca(!a.acento)} onPress={() => hacer.guardar([['roco.acento', '']])} />,
  ]

  const campos = CAMPOS_MENU.map(c => {
    const prendido = a.campos.includes(c)
    const nuevos = alternarCampo(a.campos, c).join(',')
    return (
      <Button
        key={`campo-${c}`}
        label={`${prendido ? '✓' : '·'} ${m.campos[c] ?? c}`}
        {...(prendido ? {} : { dimColor: true })}
        onPress={() => {
          if (nuevos !== a.campos.join(',')) hacer.guardar([['roco.campos', nuevos]])
        }}
      />
    )
  })

  const estilos = ESTILOS.map(s => (
    <Button key={`estilo-${s}`} label={m.estilos[s]} {...marca(s === a.estilo)} onPress={() => hacer.guardar([['roco.estilo', s]])} />
  ))

  return (
    <Box flexDirection="column" gap={1}>
      <Text dimColor wrap="truncate-end">
        {m.pista}
      </Text>
      {seccion('animos', m.animo, animos)}
      {seccion('galeria', m.mascotas, galeria)}
      {seccion('temas', m.tema, temas)}
      {seccion('colores', m.color, colores)}
      {seccion('campos', m.info, campos)}
      {seccion('estilos', m.tamano, estilos)}
      <Box flexDirection="row" flexWrap="wrap" columnGap={2}>
        <Button key="crear" label={m.crear} variant="primary" onPress={hacer.crear} />
        <Button key="cerrar" label={m.cerrar} role="dismiss" onPress={hacer.cerrar} />
      </Box>
    </Box>
  )
}
hooks/register.tsx 384〜405 行 · バンド
  on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
    if (e.props.hasSurvey || (await read($, oculto))) {
      return next(e)
    }

    const l: Lectura = {
      ahora: await read($, estado),
      hechas: await read($, acciones),
      medido: await read($, uso),
      c: await read($, cuenta),
      g: await read($, git),
      ahoraMs: await read($, minuto),
    }
    const estilo = estiloEfectivo(o.estilo, (e.props as unknown as Record<string, unknown>).bodyColumns)

    if (e.surface === 'terminal') {
      // `cuadro` cambia cada 600 ms: solo se lee (y suscribe) donde se dibuja el ASCII; el personaje propio va fijo.
      const n = estilo === 'minimo' || dibujo ? 0 : await read($, cuadro)
      return franjaTerminal($.ui.resolve(e), ov, l, estilo, n, dibujo)
    }
    return franjaGrafica($.ui.resolve(e), ov, l, estilo, dibujo)
  })
hooks/vista.tsx 136〜247 行 · バンド
export function franjaGrafica(ui: PiezasSvg, o: Opciones, l: Lectura, estilo: Estilo, d: Dibujo | null = null) {
  const { Box, Text, Svg } = ui
  const { tx, tema, camposDer } = o
  const nombreDisplay = o.nombre
  const { ahora, medido, c, ahoraMs } = l
  const aviso = avisoDe(medido, c, o.avisos, tx)
  const lineas = columnaIzquierda(ui, o, l)
  // Roco o el personaje propio, al alto pedido. El nombre va solo en `alt`, nunca dentro del SVG.
  const dibujar = (alto: number) => {
    const m = medidaSvg(d ? d.caja : null, alto)
    return (
      <Svg
        source={d ? d.svg[ahora.animo] : svg(ahora.animo)}
        alt={`${nombreDisplay} · ${tx.animo[ahora.animo]}: ${ahora.detalle}`}
        width={m.width}
        height={m.height}
      />
    )
  }

  if (estilo === 'minimo') {
    return (
      <Box flexDirection="row" alignItems="center" gap={1}>
        {dibujar(37)}
        <Text bold>
          <Text color={tema.acento}>{nombreDisplay} ·</Text> {tx.animo[ahora.animo]}
        </Text>
        <Text dimColor wrap="truncate-end">
          {' — '}
          {ahora.detalle}
        </Text>
      </Box>
    )
  }

  if (estilo === 'compacto') {
    const detalleCompacto = `${ahora.detalle} · 5 h ${pct(medido.cinco)} · ${tx.uso.semana} ${pct(medido.semana)}${aviso ? ` · ⚠ ${aviso}` : ''}`
    return (
      <Box flexDirection="row" alignItems="center" gap={1} width="100%">
        {dibujar(44)}
        <Box flexDirection="row" flexGrow={1} flexShrink={1} minWidth={0}>
          <Text bold>
            <Text color={tema.acento}>{nombreDisplay} ·</Text> {tx.animo[ahora.animo]}
          </Text>
          <Text dimColor wrap="truncate-end">
            {' — '}
            {detalleCompacto}
          </Text>
        </Box>
      </Box>
    )
  }

  const elementosDerecha = camposDer
    .map(campo => {
      switch (campo) {
        case 'sesion':
          return (
            <Text key="sesion" dimColor wrap="truncate-end">
              {tx.derecha.sesion(medido.inicio !== undefined && ahoraMs > 0 ? duracion(ahoraMs - medido.inicio, tx) : '–')}
            </Text>
          )
        case 'reinicio':
          return (
            <Text key="reinicio" dimColor wrap="truncate-end">
              {tx.derecha.cuotaCinco(medido.reinicioCinco !== undefined && ahoraMs > 0 ? duracion(medido.reinicioCinco - ahoraMs, tx) : '–')}
            </Text>
          )
        case 'contadores':
          return (
            <Text key="contadores" dimColor wrap="truncate-end">
              💬 {c.turnos} {tx.derecha.turnos} · ✏️ {c.ediciones} · ▶ {c.comandos} · ⚠ {c.errores}
            </Text>
          )
        default:
          return null
      }
    })
    .filter(Boolean)

  // Ancho fijo (peor caso de duraciones y contadores): si cambiara cada minuto, empujaría el texto de la izquierda.
  const anchoDer =
    Math.max(
      tx.derecha.sesion('23 h 59 m').length,
      tx.derecha.cuotaCinco('23 h 59 m').length,
      `💬 999 ${tx.derecha.turnos} · ✏️ 999 · ▶ 999 · ⚠ 999`.length,
    ) + 2
  const derecha =
    elementosDerecha.length > 0 ? (
      <Box flexDirection="column" alignItems="flex-start" justifyContent="center" flexShrink={0} width={anchoDer}>
        {elementosDerecha}
      </Box>
    ) : null

  return (
    <Box
      flexDirection="row"
      alignItems="center"
      gap={1}
      width="100%"
      borderStyle="round"
      borderColor={tema.acento}
    >
      {/* Como imagen (sin isInteractive): fondo transparente; el marco interactivo pinta blanco en modo oscuro. */}
      {dibujar(72)}
      <Box flexGrow={1} flexShrink={1} minWidth={0}>
        {lineas}
      </Box>
      {derecha}
    </Box>
  )
}
hooks/vista.tsx 32〜91 行 · バンド
function columnaIzquierda(ui: Piezas, o: Opciones, l: Lectura) {
  const { Box, Text } = ui
  const { tx, tema, camposIzq } = o
  const nombreDisplay = o.nombre
  const { ahora, hechas, medido, c, g } = l
  const aviso = avisoDe(medido, c, o.avisos, tx)

  const elementosIzquierda = camposIzq
    .map(campo => {
      switch (campo) {
        case 'estado':
          return (
            <Box key="estado" flexDirection="row" minWidth={0}>
              <Text bold>
                <Text color={tema.acento}>{nombreDisplay} ·</Text> {tx.animo[ahora.animo]}
              </Text>
              <Text dimColor wrap="truncate-end">
                {' — '}
                {ahora.detalle}
              </Text>
            </Box>
          )
        case 'acciones':
          return (
            <Text key="acciones" dimColor wrap="truncate-end">
              {hechas.length > 0 ? hechas.join(' · ') : tx.acciones.sinAcciones}
            </Text>
          )
        case 'uso':
          return aviso ? (
            <Text key="uso" color={tema.aviso} wrap="truncate-end">
              {lineaUso(medido, tx)} · ⚠ {aviso}
            </Text>
          ) : (
            <Text key="uso" dimColor wrap="truncate-end">
              {lineaUso(medido, tx)}
            </Text>
          )
        case 'git': {
          const lg = lineaGit(g, tx)
          return lg ? (
            <Text key="git" dimColor wrap="truncate-end">
              {lg}
            </Text>
          ) : null
        }
        default:
          return null
      }
    })
    .filter(Boolean)

  const lineas = (
    <Box flexDirection="column" justifyContent="center" minWidth={0}>
      {elementosIzquierda}
    </Box>
  )

  return lineas
}
ライセンスの全文(MIT)
MIT License

Copyright (c) 2026 s4duq

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 を動かすツール呼び出し保存

コードから読めること

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

載せる条件: 確かめやすいコード
入口を読んだhooks/hooks.json が名指すモジュールをすべて読んだ。hooks/register.tsx
解析できるすべてのファイルが TypeScript か JavaScript として解析できる。13 ファイルを解析
コードが 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 のホスト)がコードに書いてあるか。通信なし
プログラム起動するプログラムの名前がコードに書いてあり、シェル・インタプリタ・通信用の道具でないか。hooks/register.tsx:72 実行時に決まるプログラム
読んで送るファイルや環境変数を読み、かつ通信するか。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 s4duq/roco
/plugin install roco@roco

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

Claude に聞く

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

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

Claude から探す: MCP コネクタ

似たデザイン