modscode EN

modscode / 図鑑 / cockpit

cockpit

Progress bars from your todo list at zero extra tokens, a router where you pick the model and effort for quick, normal and hard prompts, and a prompt-cache meter that can keep the cache warm

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

何をするか

  • 欄・プロンプトの上の帯・トーストを描く
  • /progress・/progress-demo・/progress-clear・/progress-sounds を足す
  • TodoWrite・TaskCreate・TaskUpdate・AskUserQuestion の呼び出しを見張る(止めることがある)
  • classic.PostModelSwitch・classic.SessionStart・classic.Stop・plugin.register ほか 7 個にフックする
  • ターンをまたいで自分の状態を持つ

良いところ

  • ネットワークに出ない
  • TypeScript で書かれている
  • エラーを扱う

作り始めるためのコード

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

雛形(register.tsx)

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

// Drawn like cockpit by Syed Muhammad Hassaan (pane, band, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/brxerq-cockpit/
// 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: "Model router" })
  on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
    const { Box, Text, Button, Input } = $.ui.resolve(e)
    const title = '…'
    const routeShort = '…'
    const shortModel = '…'
    const modelWord = '…'
    const TASK_INFO = '…'
    const label = '…'
    const words = '…'
    const words2 = '…'
    const routeShort2 = '…'
    const words3 = '…'
    const routeShort3 = '…'
    const hint = '…'
    return (
      <Box flexDirection="column" gap={1} paddingX={1}>
        <Box flexDirection="row" alignItems="flex-start" gap={1}>
          <Box flexDirection="column" flexGrow={1} flexShrink={1}>
            <Text wrap="wrap">
              {`Last reply: ${title} → ${routeShort}`}
            </Text>
            <Text dimColor wrap="wrap">
              {`Kept off ${shortModel} to save the cache. Start a prompt with @${modelWord} to force it.`}
            </Text>
          </Box>
          <Button label="On" variant="primary" />
          <Button label="Off" variant="primary" />
        </Box>
        <Box flexDirection="column" gap={1}>
          <Text>
            <Text bold>
              Routes
            </Text>
            <Text dimColor>
              {"  model and effort for each kind of prompt"}
            </Text>
          </Text>
          <Box flexDirection="column">
            <Text wrap="wrap">
              <Text bold>
                0
              </Text>
              <Text dimColor>
                {`  ${TASK_INFO}`}
              </Text>
            </Text>
            <Box flexDirection="row" flexWrap="wrap" gap={1}>
              <Box flexDirection="row" flexWrap="wrap" gap={1}>
                <Button label={`${label}`} variant="primary" />
                <Button label={`${label}`} variant="primary" />
                <Button label={`${label}`} variant="primary" />
              </Box>
              <Box flexDirection="row" flexWrap="wrap" gap={1}>
                <Button label={`${label}`} variant="primary" />
                <Button label={`${label}`} variant="primary" />
                <Button label={`${label}`} variant="primary" />
              </Box>
            </Box>
          </Box>
          <Box flexDirection="column">
            <Text wrap="wrap">
              <Text bold>
                0
              </Text>
              <Text dimColor>
                {`  ${TASK_INFO}`}
              </Text>
            </Text>
            <Box flexDirection="row" flexWrap="wrap" gap={1}>
              <Box flexDirection="row" flexWrap="wrap" gap={1}>
                <Button label={`${label}`} variant="primary" />
                <Button label={`${label}`} variant="primary" />
                <Button label={`${label}`} variant="primary" />
              </Box>
              <Box flexDirection="row" flexWrap="wrap" gap={1}>
                <Button label={`${label}`} variant="primary" />
                <Button label={`${label}`} variant="primary" />
                <Button label={`${label}`} variant="primary" />
              </Box>
            </Box>
          </Box>
          <Box flexDirection="column">
            <Text wrap="wrap">
              <Text bold>
                0
              </Text>
              <Text dimColor>
                {`  ${TASK_INFO}`}
              </Text>
            </Text>
            <Box flexDirection="row" flexWrap="wrap" gap={1}>
              <Box flexDirection="row" flexWrap="wrap" gap={1}>
                <Button label={`${label}`} variant="primary" />
                <Button label={`${label}`} variant="primary" />
                <Button label={`${label}`} variant="primary" />
              </Box>
              <Box flexDirection="row" flexWrap="wrap" gap={1}>
                <Button label={`${label}`} variant="primary" />
                <Button label={`${label}`} variant="primary" />
                <Button label={`${label}`} variant="primary" />
              </Box>
            </Box>
          </Box>
        </Box>
        <Box flexDirection="column" gap={1}>
          <Text>
            <Text bold>
              Your rules
            </Text>
            <Text dimColor>
              {"  checked first"}
            </Text>
          </Text>
          <Text dimColor wrap="wrap">
            No rules yet. Pick a model and effort, type the words, press Add rule.
          </Text>
          <Box flexDirection="row" alignItems="flex-start" gap={1}>
            <Box flexGrow={1} flexShrink={1}>
              <Text wrap="wrap">
                {words}
              </Text>
            </Box>
            <Text bold>
              {routeShort}
            </Text>
            <Button plain dimColor label="✕" />
          </Box>
          <Box flexDirection="row" alignItems="flex-start" gap={1}>
            <Box flexGrow={1} flexShrink={1}>
              <Text wrap="wrap">
                {words2}
              </Text>
            </Box>
            <Text bold>
              {routeShort2}
            </Text>
            <Button plain dimColor label="✕" />
          </Box>
          <Box flexDirection="row" alignItems="flex-start" gap={1}>
            <Box flexGrow={1} flexShrink={1}>
              <Text wrap="wrap">
                {words3}
              </Text>
            </Box>
            <Text bold>
              {routeShort3}
            </Text>
            <Button plain dimColor label="✕" />
          </Box>
          <Box flexDirection="column" gap={1}>
            <Box flexDirection="row" flexWrap="wrap" gap={1}>
              <Box flexDirection="row" flexWrap="wrap" gap={1}>
                <Button label={`${label}`} variant="primary" />
                <Button label={`${label}`} variant="primary" />
                <Button label={`${label}`} variant="primary" />
              </Box>
              <Box flexDirection="row" flexWrap="wrap" gap={1}>
                <Button label={`${label}`} variant="primary" />
                <Button label={`${label}`} variant="primary" />
                <Button label={`${label}`} variant="primary" />
              </Box>
            </Box>
            <Input placeholder="words, for example landing page, redesign" submitLabel="Add rule" />
          </Box>
        </Box>
        <Box flexDirection="column" gap={1}>
          <Text>
            <Text bold>
              Options
            </Text>
            <Text dimColor>
              {`  ${hint}`}
            </Text>
          </Text>
          <Box flexDirection="row" flexWrap="wrap" alignItems="center" gap={1}>
            <Box flexGrow={1} flexShrink={1}>
              <Text wrap="wrap">
                When still broken after xhigh, move to
              </Text>
            </Box>
            <Box flexDirection="row" flexWrap="wrap" gap={1}>
              <Button label={`${label}`} variant="primary" />
              <Button label={`${label}`} variant="primary" />
              <Button label={`${label}`} variant="primary" />
            </Box>
          </Box>
          <Box flexDirection="row" flexWrap="wrap" alignItems="center" gap={1}>
            <Box flexGrow={1} flexShrink={1}>
              <Text wrap="wrap">
                Cache saver: skip one-off model switches in long chats
              </Text>
            </Box>
            <Box flexDirection="row" flexWrap="wrap" gap={1}>
              <Button label={`${label}`} variant="primary" />
              <Button label={`${label}`} variant="primary" />
              <Button label={`${label}`} variant="primary" />
            </Box>
          </Box>
        </Box>
        <Box flexDirection="row" alignItems="center" gap={1}>
          <Box flexGrow={1} flexShrink={1}>
            <Text dimColor wrap="wrap">
              One prompt only: start it with @opus, @max or @hard
            </Text>
          </Box>
          <Button label="Reset" dimColor />
        </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, Text, Button } = $.ui.resolve(e)
    const STATE_GLYPH = '…'
    const title = '…'
    const bar = '…'
    const bar2 = '…'
    const stageName = '…'
    const step = '…'
    const stageSize = '…'
    const pct = '…'
    const STATE_GLYPH2 = '…'
    const title2 = '…'
    const bar3 = '…'
    const bar4 = '…'
    const STATE_GLYPH3 = '…'
    const title3 = '…'
    const bar5 = '…'
    const bar6 = '…'
    const STATE_GLYPH4 = '…'
    const meterTitle = '…'
    const timeLeft = '…'
    return (
      <Box flexDirection="column" gap={1}>
        <Box flexDirection="row" alignItems="center" gap={1}>
          <Text>
            {STATE_GLYPH}
          </Text>
          <Text wrap="truncate">
            {title}
          </Text>
          <Box flexGrow={1} />
          <Text>
            <Text>
              {bar}
            </Text>
            <Text dimColor>
              {bar2}
            </Text>
            <Text>
              {` ${stageName} ${step}/${stageSize}`}
            </Text>
          </Text>
          <Text dimColor>
            {`${pct}%`}
          </Text>
          <Button plain dimColor label="✕" />
        </Box>
        <Box flexDirection="row" alignItems="center" gap={1}>
          <Text>
            {STATE_GLYPH2}
          </Text>
          <Text wrap="truncate">
            {title2}
          </Text>
          <Box flexGrow={1} />
          <Text>
            <Text>
              {bar3}
            </Text>
            <Text dimColor>
              {bar4}
            </Text>
            <Text>
              {` ${stageName} ${step}/${stageSize}`}
            </Text>
          </Text>
          <Text dimColor>
            {`${pct}%`}
          </Text>
          <Button plain dimColor label="✕" />
        </Box>
        <Box flexDirection="row" alignItems="center" gap={1}>
          <Text>
            {STATE_GLYPH3}
          </Text>
          <Text wrap="truncate">
            {title3}
          </Text>
          <Box flexGrow={1} />
          <Text>
            <Text>
              {bar5}
            </Text>
            <Text dimColor>
              {bar6}
            </Text>
            <Text>
              {` ${stageName} ${step}/${stageSize}`}
            </Text>
          </Text>
          <Text dimColor>
            {`${pct}%`}
          </Text>
          <Button plain dimColor label="✕" />
        </Box>
        <Box flexDirection="row" alignItems="center" gap={1}>
          <Text>
            {STATE_GLYPH4}
          </Text>
          <Text wrap="truncate">
            {meterTitle}
          </Text>
          <Button label="Keep warm" />
          <Box flexGrow={1} />
          <Text>
            <Text>
              ━━━━━━━━
            </Text>
            <Text dimColor>
              ────────
            </Text>
            <Text>
              {` ${timeLeft}`}
            </Text>
          </Text>
          <Text dimColor>
            {`${pct}%`}
          </Text>
          <Button plain dimColor label="✕" />
        </Box>
        {await next(e)}
      </Box>
    )
  })

  on('session.start', async ($, e, next) => {
    const path = '…'
    const leftLabel = '…'
    const k = '…'
    await $.ui.toast(`${path} is not valid JSON, so nothing was saved. Fix or delete it.`)
    await $.ui.toast(`Cache expires in ${leftLabel}. After that the next prompt re-reads ${k} tokens at full price. /cache warm keeps it.`)
    return next(e)
  })
}

Mod 自身のコード

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

plugins/cockpit/hooks/register.tsx 828〜947 行 · ペイン
  on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
    const t = $.ui.resolve(e)
    const { Box, Button, Text } = t
    const Select = 'Select' in t ? t.Select : null
    const Input = 'Input' in t ? t.Input : null
    const r = await read($, router)
    const isOn = r.mode !== 'off'
    const last = r.current
    const draft = await read($, ruleDraft)
    const modelValue = (id: string | null) => modelWord(id) ?? 'keep'
    const modelOptions = MODEL_CHOICES.map(([label, id]) => ({ value: modelWord(id) ?? 'keep', label: id ? `${label} ${shortModel(id).split(' ')[1] ?? ''}`.trim() : 'Keep yours' }))
    const effortOptions = EFFORT_CHOICES.map(([label, id]) => ({ value: id ?? 'keep', label: id ? label : 'Keep yours' }))
    const section = (label: string, hint?: string) => (
      <Text>
        <Text bold>{label}</Text>
        {hint ? <Text dimColor>{`  ${hint}`}</Text> : null}
      </Text>
    )
    // one picker: a dropdown where the surface has one, else a row of buttons
    const picker = (key: string, options: { value: string; label: string }[], value: string, onPick: (v: string) => unknown) =>
      Select ? (
        <Select key={key} options={options} value={value} onSelect={v => void onPick(v)} />
      ) : (
        <Box key={key} flexDirection="row" flexWrap="wrap" gap={1}>
          {options.map(o => (
            <Button key={`${key}-${o.value}`} label={o.label} variant={o.value === value ? 'primary' : undefined} dimColor={o.value !== value} onPress={() => onPick(o.value)} />
          ))}
        </Box>
      )

    return (
      <Box flexDirection="column" gap={1} paddingX={1}>
        <Box flexDirection="row" alignItems="flex-start" gap={1}>
          <Box flexDirection="column" flexGrow={1} flexShrink={1}>
            <Text wrap="wrap">{last ? `Last reply: ${title(last.task)} → ${routeShort(last)}` : 'No reply routed yet.'}</Text>
            {last?.held.includes('model') ? <Text dimColor wrap="wrap">{`Kept off ${shortModel(last.wanted.model)} to save the cache. Start a prompt with @${modelWord(last.wanted.model) ?? 'opus'} to force it.`}</Text> : null}
          </Box>
          <Button key="router-on" label="On" variant={isOn ? 'primary' : undefined} dimColor={!isOn} onPress={() => update($, router, x => ({ ...x, mode: 'auto' }))} />
          <Button key="router-off" label="Off" variant={isOn ? undefined : 'primary'} dimColor={isOn} onPress={() => update($, router, x => ({ ...x, mode: 'off' }))} />
        </Box>

        <Box flexDirection="column" gap={1}>
          {section('Routes', 'model and effort for each kind of prompt')}
          {TASKS.map((k: string) => {
            const x = r.routes[k] ?? { model: null, effort: null }
            return (
              <Box key={`route-${k}`} flexDirection="column">
                <Text wrap="wrap">
                  <Text bold>{title(k)}</Text>
                  <Text dimColor>{`  ${(TASK_INFO as Record<string, string>)[k]}`}</Text>
                </Text>
                <Box flexDirection="row" flexWrap="wrap" gap={1}>
                  {picker(`${k}-model`, modelOptions, modelValue(x.model), v => setRoute($, k, { model: v === 'keep' ? null : ((MODELS as Record<string, string>)[v] ?? null) }))}
                  {x.model && !takesEffort(x.model) ? <Text dimColor>No effort setting</Text> : picker(`${k}-effort`, effortOptions, x.effort ?? 'keep', v => setRoute($, k, { effort: v === 'keep' ? null : v }))}
                </Box>
              </Box>
            )
          })}
        </Box>

        <Box flexDirection="column" gap={1}>
          {section('Your rules', 'checked first')}
          {r.rules.length === 0 ? <Text dimColor wrap="wrap">No rules yet. Pick a model and effort, type the words, press Add rule.</Text> : null}
          {r.rules.map(rule => (
            <Box key={`rule-${rule.words[0]}`} flexDirection="row" alignItems="flex-start" gap={1}>
              <Box flexGrow={1} flexShrink={1}>
                <Text wrap="wrap">{rule.words.join(', ')}</Text>
              </Box>
              <Text bold color={MODEL_COLOR[modelWord(rule.route.model) ?? 'keep']}>{routeShort(rule.route)}</Text>
              <Button key={`rule-x-${rule.words[0]}`} plain dimColor label="✕" onPress={() => removeRule($, rule.words[0] ?? '')} />
            </Box>
          ))}
          {Input ? (
            <Box flexDirection="column" gap={1}>
              <Box flexDirection="row" flexWrap="wrap" gap={1}>
                {picker('rule-model', modelOptions, draft.model, v => update($, ruleDraft, x => ({ ...x, model: v })))}
                {draft.model !== 'keep' && !takesEffort((MODELS as Record<string, string>)[draft.model] ?? '') ? <Text dimColor>No effort setting</Text> : picker('rule-effort', effortOptions, draft.effort, v => update($, ruleDraft, x => ({ ...x, effort: v })))}
              </Box>
              <Input
                key="rule-add"
                placeholder="words, for example landing page, redesign"
                submitLabel="Add rule"
                onSubmit={v => {
                  // "words = model effort" typed in full still works; otherwise the dropdowns give the route
                  const rule = v.includes('=') ? parseRule(v) : parseRule(`${v} = ${draft.model} ${draft.effort}`)
                  if (rule) void addRule($, rule)
                  else $.ui.toast('Type the words that should trigger the rule, for example landing page, then pick a model and effort above.')
                }}
              />
            </Box>
          ) : (
            <Text dimColor wrap="wrap">Add one with /route rule landing page = sonnet max</Text>
          )}
        </Box>

        <Box flexDirection="column" gap={1}>
          {section('Options')}
          <Box flexDirection="row" flexWrap="wrap" alignItems="center" gap={1}>
            <Box flexGrow={1} flexShrink={1}>
              <Text wrap="wrap">When still broken after xhigh, move to</Text>
            </Box>
            {picker('stuck', [{ value: 'max', label: 'Max, same model' }, { value: 'sonnet', label: 'Sonnet 5.5' }, { value: 'opus', label: 'Opus 5.5' }, { value: 'fable', label: 'Fable 5.1' }], modelWord(r.top) ?? 'max', v => setOption($, { top: v === 'max' ? null : v }))}
          </Box>
          <Box flexDirection="row" flexWrap="wrap" alignItems="center" gap={1}>
            <Box flexGrow={1} flexShrink={1}>
              <Text wrap="wrap">Cache saver: skip one-off model switches in long chats</Text>
            </Box>
            {picker('saver', [{ value: 'on', label: 'On' }, { value: 'off', label: 'Off' }], r.saver ? 'on' : 'off', v => setOption($, { saver: v === 'on' }))}
          </Box>
        </Box>

        <Box flexDirection="row" alignItems="center" gap={1}>
          <Box flexGrow={1} flexShrink={1}>
            <Text dimColor wrap="wrap">One prompt only: start it with @opus, @max or @hard</Text>
          </Box>
          <Button key="router-reset" label="Reset" dimColor onPress={() => clearRoutes($)} />
        </Box>
      </Box>
    )
  })
plugins/cockpit/hooks/register.tsx 976〜1082 行 · バンド
  on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
    const list = (await read($, isOpen)) ? await read($, plans) : []
    const c = await read($, cache)
    const now = await $.clock.now()
    const state = phase(c, now) as 'none' | MeterLook
    // under FREE_BELOW tokens a lapsed cache costs too little to take a row
    const hasMeter = c.show && !c.hidden && state !== 'none' && c.tokens >= FREE_BELOW
    if ((list.length === 0 && !hasMeter) || e.props.hasSurvey) return next(e)
    const meterTitle = state === 'cold' ? `Cache expired · next prompt re-reads ${k(c.tokens)}` : `Prompt cache · ${k(c.tokens)}${c.why && state !== 'live' ? ` · missed: ${c.why}` : ''}`
    const t = $.ui.resolve(e)
    const { Box, Button, Text } = t
    const Svg = 'Svg' in t ? t.Svg : null
    const total = Math.max(320, (e.props.bodyColumns || 100) * 8)
    // every bar has the same width and is pinned to the right edge (fixed-width percent, close button),
    // so rows line up whatever their titles; the slack goes into the gap after the title.
    // Desktop reports ~8 CSS px per column; glyph, gaps, percent and the close button take ~126 px.
    const titleWidth = Math.min(Math.round(total * 0.3), Math.max(...[...list.map(p => p.title), ...(hasMeter ? [meterTitle] : [])].map(s => Math.round(textWidth(s, 6.4)))))
    // the cache row shares every width with the bars, so the tracks line up; the Keep warm button takes ~96 px of the title's side
    const trackW = Math.max(120, Math.min(1400, total - titleWidth - 140 - (hasMeter ? 96 : 0)))

    // the cache row is a bar like the others: glyph, title, a pill track whose fill drains by itself, the time left,
    // a close button. Its drawing starts from the time left now, so nothing is redrawn each second
    const meter = () => {
      const left = leftMs(c, now)
      const life = TTL_MS[c.life]
      const color = METER_COLOR[state as MeterLook]
      const canWarm = state === 'low' || state === 'soon'
      const filled = state === 'live' ? 25 : Math.round(Math.min(1, left / life) * 25)
      const pct = state === 'live' ? 100 : Math.round(Math.min(1, left / life) * 100)
      const timeLeft = state === 'live' ? 'live' : leftLabel(left)

      return (
        <Box key="cache-row" flexDirection="row" alignItems="center" gap={1}>
          <Text color={color}>{STATE_GLYPH[METER_STATE[state as MeterLook]]}</Text>
          <Text wrap="truncate">{meterTitle}</Text>
          {canWarm ? <Button key="cache-warm" label="Keep warm" onPress={async () => $.ui.toast(await keepWarm($))} /> : null}
          <Box flexGrow={1} />
          {Svg ? (
            <Box key="cache-track" flexShrink={0}>
              <Svg source={meterSvg(trackW, state as MeterLook, left, life)} alt={`Prompt cache: ${state === 'live' ? 'in use' : state === 'cold' ? 'expired' : `${timeLeft} left, ${pct}%`}`} width={trackW} height={TRACK_H} />
            </Box>
          ) : (
            <Text>
              <Text color={color}>{'━'.repeat(filled)}</Text>
              <Text dimColor>{'─'.repeat(25 - filled)}</Text>
              <Text color={color}>{` ${timeLeft}`}</Text>
            </Text>
          )}
          <Text dimColor>{`${String(pct).padStart(3, FIGURE_SPACE)}%`}</Text>
          <Button
            key="cache-close"
            plain
            dimColor
            label="✕"
            onPress={async () => {
              await update($, cache, x => ({ ...x, hidden: true }))
              $.ui.toast('Cache row hidden for this session. /cache on brings it back.')
            }}
          />
        </Box>
      )
    }

    return (
      <Box flexDirection="column" gap={1}>
        {list.map(p => {
          const track = trackSvg(p, trackW)
          // the hover layer is rebuilt on every redraw anyway, so its clock is set from now each time
          const hover = track.overlay.replace(/\{\{T:(\d+)\}\}/g, (_, t: string) => Math.max(0, (now - Number(t)) / 1000).toFixed(1))
          const w = where(p)
          const pct = p.state === 'done' ? 100 : Math.round((Math.min(w.pos, w.total) / Math.max(1, w.total)) * 100)
          const color = STATE_COLOR[p.state]
          const stageName = p.stages[w.stage]?.name ?? ''
          const alt =
            p.state === 'done'
              ? `${p.title}: done, ${plural(w.total, 'step')}${p.endedAt ? ` in ${elapsed(p.endedAt - p.startedAt)}` : ''}`
              : `${p.title}: ${stageName}, step ${w.step} of ${w.stageSize}, ${pct}%${p.note ? ` — ${p.note}` : ''}`
          const bar = `${'━'.repeat(Math.round(pct / 4))}${'─'.repeat(25 - Math.round(pct / 4))}`

          return (
            <Box key={`bar-${p.id}`} flexDirection="row" alignItems="center" gap={1}>
              <Text color={color}>{STATE_GLYPH[p.state]}</Text>
              <Text wrap="truncate">{p.title}</Text>
              <Box flexGrow={1} />
              {Svg ? (
                <Box key={`track-${p.id}`} flexShrink={0}>
                  <Svg source={track.base} alt={alt} width={trackW} height={TRACK_H} />
                  <Box position="absolute" top={0} left={0}>
                    <Svg source={hover} alt={`${p.title}: hover for times`} width={trackW} height={TRACK_H} isInteractive />
                  </Box>
                </Box>
              ) : (
                <Text>
                  <Text color={color}>{bar.replace(/─/g, '')}</Text>
                  <Text dimColor>{bar.replace(/━/g, '')}</Text>
                  <Text color={color}>{` ${stageName} ${w.step}/${w.stageSize}`}</Text>
                </Text>
              )}
              <Text dimColor>{`${String(pct).padStart(3, FIGURE_SPACE)}%`}</Text>
              <Button key={`close-${p.id}`} plain dimColor label="✕" onPress={() => dropPlan($, p.id)} />
            </Box>
          )
        })}
        {hasMeter ? meter() : null}
      </Box>
    )
  })
ライセンスの全文(MIT)
MIT License

Copyright (c) 2026 Syed Muhammad Hassaan

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

載せる条件: 確かめやすいコード
入口を読んだhooks/hooks.json が名指すモジュールをすべて読んだ。plugins/cockpit/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 .)、触るものを見て、読んだコミットを入れてください。

リポジトリがそのままマーケットプレイスです。このマーケットプレイスを足し(ターミナルでは次のコマンド、デスクトップアプリではプラグインの設定)、そこから Mod を入れます。

/plugin marketplace add Brxerq/claude-cockpit
/plugin install cockpit@claude-cockpit

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

Claude に聞く

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

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

Claude から探す: MCP コネクタ

似たデザイン