modscode EN

modscode / 図鑑 / wavy-usage

wavy-usage

Liquid-filled rings above the Claude Code prompt for the 5-hour and 7-day limit windows, context fill and prompt-cache lifetime, a fighter jet that shows the model's effort, and a pane of recent turns, their cost, their share of the 5-hour…

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

何をするか

  • 欄・プロンプトの上の帯を描く
  • /wavy-usage を足す
  • session.measure・session.start・turn.complete・turn.step ほか 1 個にフックする
  • ターンをまたいで自分の状態を持つ

良いところ

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

作り始めるためのコード

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

雛形(register.tsx)

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

// Drawn like wavy-usage by Batuhan Çakmak (pane, band, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/batuhancakmakk-wavy-usage/
// 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: "‹paneTitle›" })
  on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
    const { Box, Svg, Text, Button } = $.ui.resolve(e)
    const jetStrip = '…'
    const effort = '…'
    const liquidRing = '…'
    const label = '…'
    const value = '…'
    const win5h = '…'
    const percentText = '…'
    const extra = '…'
    const win7d = '…'
    const percentText2 = '…'
    const extra2 = '…'
    const ctx = '…'
    const percentText3 = '…'
    const tokens = '…'
    const cache = '…'
    const percentText4 = '…'
    const ttl = '…'
    const lastTurns = '…'
    const lastTurnsHint = '…'
    const turnsTotal = '…'
    const colTurn = '…'
    const headerCell = '…'
    const colSplit = '…'
    const colTokens = '…'
    const colCost = '…'
    const win5h2 = '…'
    const n = '…'
    const clockTime = '…'
    const turnBar = '…'
    const barAlt = '…'
    const ctxDeltaText = '…'
    const costText = '…'
    const fiveDeltaText = '…'
    const tokens2 = '…'
    const costText2 = '…'
    const fiveDeltaText2 = '…'
    const tokens3 = '…'
    const costText3 = '…'
    const fiveDeltaText3 = '…'
    const hint = '…'
    const barHint = '…'
    const filledBy = '…'
    const summary = '…'
    const byProject = '…'
    const shownName = '…'
    const resetBar = '…'
    const costText4 = '…'
    const turns = '…'
    const shownName2 = '…'
    const costText5 = '…'
    const turns2 = '…'
    const shownName3 = '…'
    const costText6 = '…'
    const turns3 = '…'
    const byModel = '…'
    const shownName4 = '…'
    const costText7 = '…'
    const turns4 = '…'
    const shownName5 = '…'
    const costText8 = '…'
    const turns5 = '…'
    const shownName6 = '…'
    const costText9 = '…'
    const turns6 = '…'
    const localOnly = '…'
    const resets = '…'
    const win5h3 = '…'
    const elapsedAlt = '…'
    const usedAlt = '…'
    const inTime = '…'
    const paceFull = '…'
    const win7d2 = '…'
    const inTime2 = '…'
    const paceFull2 = '…'
    return (
      <Box flexDirection="column" gap={1}>
        <Box flexDirection="column">
          <Svg source={`${jetStrip}`} alt={`${effort}`} height={84} isInteractive />
          <Text dimColor>
            {effort}
          </Text>
        </Box>
        <Box flexDirection="row" justifyContent="space-around">
          <Box flexDirection="column" alignItems="center">
            <Svg source={`${liquidRing}`} alt={`${label} ${value}`} width={64} height={64} isInteractive />
            <Text dimColor>
              {win5h}
            </Text>
            <Text bold>
              {percentText}
            </Text>
            <Text dimColor>
              {extra}
            </Text>
          </Box>
          <Box flexDirection="column" alignItems="center">
            <Svg source={`${liquidRing}`} alt={`${label} ${value}`} width={64} height={64} isInteractive />
            <Text dimColor>
              {win7d}
            </Text>
            <Text bold>
              {percentText2}
            </Text>
            <Text dimColor>
              {extra2}
            </Text>
          </Box>
          <Box flexDirection="column" alignItems="center">
            <Svg source={`${liquidRing}`} alt={`${label} ${value}`} width={64} height={64} isInteractive />
            <Text dimColor>
              {ctx}
            </Text>
            <Text bold>
              {percentText3}
            </Text>
            <Text dimColor>
              {`${tokens} / ${tokens}`}
            </Text>
          </Box>
          <Box flexDirection="column" alignItems="center">
            <Svg source={`${liquidRing}`} alt={`${label} ${value}`} width={64} height={64} isInteractive />
            <Text dimColor>
              {cache}
            </Text>
            <Text bold>
              {percentText4}
            </Text>
            <Text dimColor>
              {ttl}
            </Text>
          </Box>
        </Box>
        <Box flexDirection="column">
          <Text bold>
            {lastTurns}
          </Text>
          <Text dimColor>
            {lastTurnsHint}
          </Text>
        </Box>
        <Box flexDirection="column">
          <Text dimColor>
            {turnsTotal}
          </Text>
          <Box flexDirection="row" gap={1}>
            <Box width={12}>
              <Text dimColor>
                {colTurn}
              </Text>
            </Box>
            <Svg source={`${headerCell}`} alt={`${colSplit}`} height={14} />
            <Box width={6}>
              <Text dimColor>
                {colTokens}
              </Text>
            </Box>
            <Box width={7}>
              <Text dimColor>
                {colCost}
              </Text>
            </Box>
            <Box width={7}>
              <Text dimColor>
                {win5h2}
              </Text>
            </Box>
          </Box>
          <Box flexDirection="row" gap={1} alignItems="center">
            <Box width={12}>
              <Text dimColor wrap="truncate">
                {`#${n} ${clockTime}`}
              </Text>
            </Box>
            <Svg source={`${turnBar}`} alt={`${barAlt} · ctx ${ctxDeltaText}`} height={10} isInteractive />
            <Box width={6}>
              <Text bold>
                {tokens}
              </Text>
            </Box>
            <Box width={7}>
              <Text>
                {costText}
              </Text>
            </Box>
            <Box width={7}>
              <Text dimColor>
                {fiveDeltaText}
              </Text>
            </Box>
          </Box>
          <Box flexDirection="row" gap={1} alignItems="center">
            <Box width={12}>
              <Text dimColor wrap="truncate">
                {`#${n} ${clockTime}`}
              </Text>
            </Box>
            <Svg source={`${turnBar}`} alt={`${barAlt} · ctx ${ctxDeltaText}`} height={10} isInteractive />
            <Box width={6}>
              <Text bold>
                {tokens2}
              </Text>
            </Box>
            <Box width={7}>
              <Text>
                {costText2}
              </Text>
            </Box>
            <Box width={7}>
              <Text dimColor>
                {fiveDeltaText2}
              </Text>
            </Box>
          </Box>
          <Box flexDirection="row" gap={1} alignItems="center">
            <Box width={12}>
              <Text dimColor wrap="truncate">
                {`#${n} ${clockTime}`}
              </Text>
            </Box>
            <Svg source={`${turnBar}`} alt={`${barAlt} · ctx ${ctxDeltaText}`} height={10} isInteractive />
            <Box width={6}>
              <Text bold>
                {tokens3}
              </Text>
            </Box>
            <Box width={7}>
              <Text>
                {costText3}
              </Text>
            </Box>
            <Box width={7}>
              <Text dimColor>
                {fiveDeltaText3}
              </Text>
            </Box>
          </Box>
          <Box flexDirection="row" gap={2}>
            <Box flexDirection="row" gap={1}>
              <Text>
                ■
              </Text>
              <Text dimColor>
                {`${label}: ${hint}`}
              </Text>
            </Box>
            <Box flexDirection="row" gap={1}>
              <Text>
                ■
              </Text>
              <Text dimColor>
                {`${label}: ${hint}`}
              </Text>
            </Box>
          </Box>
          <Box flexDirection="row" gap={2}>
            <Box flexDirection="row" gap={1}>
              <Text>
                ■
              </Text>
              <Text dimColor>
                {`${label}: ${hint}`}
              </Text>
            </Box>
            <Box flexDirection="row" gap={1}>
              <Text>
                ■
              </Text>
              <Text dimColor>
                {`${label}: ${hint}`}
              </Text>
            </Box>
          </Box>
          <Text dimColor>
            {barHint}
          </Text>
        </Box>
        <Box flexDirection="row" gap={1} alignItems="center">
          <Text bold>
            {filledBy}
          </Text>
          <Box flexGrow={1} />
          <Button label={`${win5h}`} variant="primary" />
          <Button label={`${win7d}`} variant="primary" />
        </Box>
        <Box flexDirection="column">
          <Text dimColor>
            {summary}
          </Text>
          <Text bold>
            {byProject}
          </Text>
          <Box flexDirection="row" gap={1} alignItems="center">
            <Box width={14}>
              <Text wrap="truncate">
                {shownName}
              </Text>
            </Box>
            <Svg source={`${resetBar}`} alt={`${shownName}: ${costText}`} height={8} />
            <Box width={7}>
              <Text bold>
                {costText4}
              </Text>
            </Box>
            <Text dimColor>
              {turns}
            </Text>
          </Box>
          <Box flexDirection="row" gap={1} alignItems="center">
            <Box width={14}>
              <Text wrap="truncate">
                {shownName2}
              </Text>
            </Box>
            <Svg source={`${resetBar}`} alt={`${shownName}: ${costText}`} height={8} />
            <Box width={7}>
              <Text bold>
                {costText5}
              </Text>
            </Box>
            <Text dimColor>
              {turns2}
            </Text>
          </Box>
          <Box flexDirection="row" gap={1} alignItems="center">
            <Box width={14}>
              <Text wrap="truncate">
                {shownName3}
              </Text>
            </Box>
            <Svg source={`${resetBar}`} alt={`${shownName}: ${costText}`} height={8} />
            <Box width={7}>
              <Text bold>
                {costText6}
              </Text>
            </Box>
            <Text dimColor>
              {turns3}
            </Text>
          </Box>
          <Text bold>
            {byModel}
          </Text>
          <Box flexDirection="row" gap={1} alignItems="center">
            <Box width={14}>
              <Text wrap="truncate">
                {shownName4}
              </Text>
            </Box>
            <Svg source={`${resetBar}`} alt={`${shownName}: ${costText}`} height={8} />
            <Box width={7}>
              <Text bold>
                {costText7}
              </Text>
            </Box>
            <Text dimColor>
              {turns4}
            </Text>
          </Box>
          <Box flexDirection="row" gap={1} alignItems="center">
            <Box width={14}>
              <Text wrap="truncate">
                {shownName5}
              </Text>
            </Box>
            <Svg source={`${resetBar}`} alt={`${shownName}: ${costText}`} height={8} />
            <Box width={7}>
              <Text bold>
                {costText8}
              </Text>
            </Box>
            <Text dimColor>
              {turns5}
            </Text>
          </Box>
          <Box flexDirection="row" gap={1} alignItems="center">
            <Box width={14}>
              <Text wrap="truncate">
                {shownName6}
              </Text>
            </Box>
            <Svg source={`${resetBar}`} alt={`${shownName}: ${costText}`} height={8} />
            <Box width={7}>
              <Text bold>
                {costText9}
              </Text>
            </Box>
            <Text dimColor>
              {turns6}
            </Text>
          </Box>
        </Box>
        <Text dimColor>
          {localOnly}
        </Text>
        <Box flexDirection="column">
          <Text bold>
            {resets}
          </Text>
          <Box flexDirection="column">
            <Box flexDirection="row" gap={1} alignItems="center">
              <Box width={6}>
                <Text bold>
                  {win5h3}
                </Text>
              </Box>
              <Box flexDirection="column">
                <Svg source={`${resetBar}`} alt={`${elapsedAlt}`} height={8} />
                <Svg source={`${resetBar}`} alt={`${usedAlt}`} height={4} />
              </Box>
            </Box>
            <Text dimColor>
              {inTime}
            </Text>
            <Text color="#FF9800">
              {paceFull}
            </Text>
          </Box>
          <Box flexDirection="column">
            <Box flexDirection="row" gap={1} alignItems="center">
              <Box width={6}>
                <Text bold>
                  {win7d2}
                </Text>
              </Box>
              <Box flexDirection="column">
                <Svg source={`${resetBar}`} alt={`${elapsedAlt}`} height={8} />
                <Svg source={`${resetBar}`} alt={`${usedAlt}`} height={4} />
              </Box>
            </Box>
            <Text dimColor>
              {inTime2}
            </Text>
            <Text color="#FF9800">
              {paceFull2}
            </Text>
          </Box>
        </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, Svg, Button } = $.ui.resolve(e)
    const waitingBand = '…'
    const jetStrip = '…'
    const effort = '…'
    const panel = '…'
    return (
      <Box flexDirection="column">
        <Box flexDirection="row" gap={2} alignItems="center">
          5h
          7d
          ctx
          <Text dimColor>
            {waitingBand}
          </Text>
          <Box flexGrow={1} />
          <Svg source={`${jetStrip}`} alt={`${effort}`} width={130} height={44} isInteractive />
          <Button label={`${panel}`} dimColor />
        </Box>
        {await next(e)}
      </Box>
    )
  })
}

Mod 自身のコード

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

hooks/register.tsx 368〜527 行 · ペイン
  on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e, next) => {
    if (disabled) return next(e)
    if (e.surface !== 'desktop') {
      const { Text } = $.ui.resolve(e)
      return <Text dimColor>{t.desktopOnlyPane}</Text>
    }
    // Closing is the desktop header's own × control; the ui.close hook clears isPaneOpen.
    try {
      const { Box, Button, Svg, Text } = $.ui.resolve(e)
      const shownNow = await read($, screen)
      const r = shownNow.reading
      const turns = shownNow.turns
      const now = await $.clock.now()
      const width = Math.min(640, Math.max(160, e.props.bodyColumns * 7))
      const recent = recentTurns(turns, await read($, costBase))
      const scale = Math.max(0, ...recent.map(({ turn }) => turnTotal(turn)))
      const barWidth = Math.max(60, width - 230)
      const view = await read($, windowView)
      const since = windowStart(view, r, now)
      const entries = [...(await read($, others)), ...shownNow.log]
      const totals = windowTotals(entries, since)
      const shareWidth = Math.max(60, width - 230)
      const ttl = await read($, ttlMs)
      const cache = cacheState(shownNow.lastRequestAt, ttl, now, t)
      const big = (id: string, label: string, percent: number | undefined, extra?: string, value?: string, color?: string) => (
        <Box key={`big-${id}`} flexDirection="column" alignItems="center">
          <Svg
            source={liquidRing(percent, 64, 6, levelFrom(`pane-${id}`, percent), color)}
            alt={`${label} ${value ?? percentText(percent)}`}
            width={64}
            height={64}
            isInteractive
          />
          <Text dimColor>{label}</Text>
          <Text bold>{value ?? percentText(percent)}</Text>
          {extra !== undefined && <Text dimColor>{extra}</Text>}
        </Box>
      )
      const resetWidth = Math.max(60, width - 40)
      const paceSamples = await read($, samples)
      // Elapsed time on the blue bar, the limit used on a thin bar under it, and where it ends up at this pace.
      const resetRow = (label: string, at: number, length: number, clock: string, used: number | undefined, fullClock: (ms: number) => string) => {
        const pace = forecast(used, at, length, now, length === FIVE_HOURS ? paceSamples : [])
        return (
          <Box key={`reset-${label}`} flexDirection="column">
            <Box flexDirection="row" gap={1} alignItems="center">
              <Box width={6}>
                <Text bold>{label}</Text>
              </Box>
              <Box flexDirection="column">
                <Svg source={resetBar(windowElapsed(at, now, length), resetWidth)} alt={t.elapsedAlt(label)} width={resetWidth} height={8} />
                {used !== undefined && (
                  <Svg source={resetBar(used / 100, resetWidth, COLORS[heat(used)], 4)} alt={t.usedAlt(label)} width={resetWidth} height={4} />
                )}
              </Box>
            </Box>
            <Text dimColor>{t.inTime(countdown(at - now, t.units, COUNTDOWN_STEP), clock)}</Text>
            {pace?.fullAt !== undefined ? (
              <Text color={COLORS.warn}>{t.paceFull(fullClock(pace.fullAt), countdown(at - pace.fullAt, t.units, COUNTDOWN_STEP))}</Text>
            ) : (
              pace && <Text dimColor>{t.paceAtReset(Math.round(pace.atReset))}</Text>
            )}
          </Box>
        )
      }
      const groupRows = (groups: Group[]) => {
        const max = Math.max(0, ...groups.map(g => g.usd))
        return groups.map(g => (
          <Box key={`g-${g.name}`} flexDirection="row" gap={1} alignItems="center">
            <Box width={14}>
              <Text wrap="truncate">{shownName(g.name)}</Text>
            </Box>
            <Svg
              source={resetBar(max > 0 ? g.usd / max : 0, shareWidth)}
              alt={`${shownName(g.name)}: ${g.usd > 0 ? costText(g.usd) : t.noCost}`}
              width={shareWidth}
              height={8}
            />
            <Box width={7}>
              <Text bold>{g.usd > 0 ? costText(g.usd) : '-'}</Text>
            </Box>
            <Text dimColor>{t.turns(g.turns)}</Text>
          </Box>
        ))
      }
      const legend = [
        ['in', t.legendIn, t.hintIn],
        ['out', t.legendOut, t.hintOut],
        ['cacheWrite', t.legendCacheWrite, t.hintCacheWrite],
        ['cacheRead', t.legendCacheRead, t.hintCacheRead],
      ] as const
      const summary = turnsSummary(recent)
      // Column widths in cells; the bar column's header spans the bar's pixels (about 7 px a cell).
      const COL_TURN = 12
      const COL_TOKENS = 6
      const COL_COST = 7
      const COL_FIVE = 7
      // The bar column's header is drawn at the bar's own pixel width so the columns after it line up.
      const headerCell = (label: string, w: number) =>
        `<svg xmlns="http://www.w3.org/2000/svg" width="${w}" height="14"><text x="0" y="11" font-family="system-ui, sans-serif" font-size="12" fill="#888780">${label.replace(/&/g, '&amp;').replace(/</g, '&lt;')}</text></svg>`
      const legendWidth = Math.max(16, Math.floor(width / 7 / 2) - 2)
      const legendItem = ([k, label, hint]: (typeof legend)[number]) => (
        <Box key={`legend-${k}`} flexDirection="row" gap={1} width={legendWidth}>
          <Text color={SEGMENTS[k]}>■</Text>
          <Text dimColor>{`${label}: ${hint}`}</Text>
        </Box>
      )
      const fiveAt = r?.fiveHourResetsAt
      const sevenAt = r?.sevenDayResetsAt
      const level = await read($, effort)
      return (
        <Box flexDirection="column" gap={1}>
          {level !== null && (
            <Box key="jet" flexDirection="column">
              <Svg
                source={jetStrip(level, width, JET_PANE_H, JET_PANE_SCALE, t.effort(level), 'jp')}
                alt={t.effort(level)}
                width={width}
                height={JET_PANE_H}
                isInteractive
              />
              <Text dimColor>{t.effort(level)}</Text>
            </Box>
          )}
          {r === null ? (
            <Text dimColor>{t.waitingPane}</Text>
          ) : (
            <Box flexDirection="row" justifyContent="space-around">
              {r.fiveHour !== undefined && big('5h', t.win5h, r.fiveHour)}
              {r.sevenDay !== undefined && big('7d', t.win7d, r.sevenDay)}
              {big('ctx', t.ctx, r.ctxPercent, r.ctxTokens !== undefined ? `${tokens(r.ctxTokens)} / ${tokens(r.ctxWindow)}` : undefined)}
              {cache !== null && big('cache', t.cache, ringStep(cache.percent), t.ttl(ttlText(ttl, t)), cache.text, ttlColor(cache.percent))}
            </Box>
          )}
          <Box flexDirection="column">
            <Text bold>{t.lastTurns}</Text>
            <Text dimColor>{t.lastTurnsHint}</Text>
          </Box>
          {recent.length === 0 ? (
            <Text dimColor>{t.noTurns}</Text>
          ) : (
            <Box flexDirection="column">
              <Text dimColor>
                {t.turnsTotal(
                  tokens(summary.tokens),
                  summary.cost === null ? '-' : costText(summary.cost),
                  `${t.win5h} ${summary.five === null ? '-' : fiveDeltaText(summary.five, t.fiveReset)}`,
                )}
              </Text>
              <Box key="turn-head" flexDirection="row" gap={1}>
                <Box width={COL_TURN}>
                  <Text dimColor>{t.colTurn}</Text>
                </Box>
                <Svg source={headerCell(t.colSplit, barWidth)} alt={t.colSplit} width={barWidth} height={14} />
                <Box width={COL_TOKENS}>
                  <Text dimColor>{t.colTokens}</Text>
                </Box>
                <Box width={COL_COST}>
                  <Text dimColor>{t.colCost}</Text>
                </Box>
hooks/register.tsx 605〜706 行 · バンド
  on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
    if (disabled || e.props.hasSurvey) return next(e)
    if (!(await read($, isEnabled))) return next(e)
    if (e.surface === 'terminal') {
      try {
        const { Box, Text } = $.ui.resolve(e)
        const shownNow = await read($, screen)
        const r = shownNow.reading
        const cache = cacheState(shownNow.lastRequestAt, await read($, ttlMs), await $.clock.now(), t)
        const rest = await next(e)
        const level = await read($, effort)
        const parts = [
          ...terminalParts(r, cache, e.props.bodyColumns, t),
          ...(level === null ? [] : [{ text: `  ✈ ${level}`, color: JET_TERMINAL_COLOR[level] }]),
        ]
        return (
          <Box flexDirection="column">
            <Text wrap="truncate">
              {parts.map((p, i) => (
                <Text key={String(i)} color={p.color} dimColor={p.dim} bold={p.bold}>
                  {p.text}
                </Text>
              ))}
            </Text>
            {rest}
          </Box>
        )
      } catch (err) {
        logRenderError($, err)
        return next(e)
      }
    }
    if (e.surface !== 'desktop') return next(e)
    try {
      const { Box, Button, Svg, Text } = $.ui.resolve(e)
      const shownNow = await read($, screen)
      const r = shownNow.reading
      const cache = cacheState(shownNow.lastRequestAt, await read($, ttlMs), await $.clock.now(), t)
      const rest = await next(e)
      const layout = bandLayout(e.props.bodyColumns)
      const level = await read($, effort)
      const metric = (id: string, label: string, percent: number | undefined, extra?: string, value?: string, color?: string) => (
        <Box key={`m-${id}`} flexDirection="row" gap={1} alignItems="center">
          <Svg
            source={liquidRing(percent, BAND_RING, BAND_STROKE, levelFrom(`band-${id}`, percent), color)}
            alt={`${label} ${value ?? percentText(percent)}`}
            width={BAND_RING}
            height={BAND_RING}
            isInteractive
          />
          <Box flexDirection="column">
            <Text dimColor>{label}</Text>
            <Box flexDirection="row" gap={1}>
              <Text bold>{value ?? percentText(percent)}</Text>
              {extra !== undefined && <Text dimColor>{`· ${extra}`}</Text>}
            </Box>
          </Box>
        </Box>
      )
      // A finished turn means the API answered: the cache ring shows even before a measurement.
      const cacheMetric = cache !== null && metric('cache', t.cache, ringStep(cache.percent), undefined, cache.text, ttlColor(cache.percent))
      const metrics =
        r === null
          ? [
              metric('5h', t.win5h, undefined),
              metric('7d', t.win7d, undefined),
              metric('ctx', t.ctx, undefined),
              cacheMetric,
              <Text dimColor>{t.waitingBand}</Text>,
            ]
          : [
              r.fiveHour !== undefined && metric('5h', t.win5h, r.fiveHour),
              r.sevenDay !== undefined && metric('7d', t.win7d, r.sevenDay),
              metric('ctx', t.ctx, r.ctxPercent, layout.showCtxTokens && r.ctxTokens !== undefined ? tokens(r.ctxTokens) : undefined),
              cacheMetric,
              layout.showCost && r.usd !== undefined && <Text dimColor>{`$${r.usd.toFixed(2)}`}</Text>,
            ]
      return (
        <Box flexDirection="column">
          <Box flexDirection="row" gap={2} alignItems="center">
            {metrics}
            <Box flexGrow={1} />
            {level !== null && layout.showJet && (
              <Svg
                key="jet"
                source={jetStrip(level, JET_W, JET_H, JET_SCALE, t.effort(level), 'jb')}
                alt={t.effort(level)}
                width={JET_W}
                height={JET_H}
                isInteractive
              />
            )}
            <Button key="pane" label={t.panel} dimColor onPress={() => togglePane($)} />
          </Box>
          {rest}
        </Box>
      )
    } catch (err) {
      logRenderError($, err)
      return next(e)
    }
  })
ライセンスの全文(MIT)
MIT License

Copyright (c) 2026 Batuhan Çakmak

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.

コードが呼ぶもの

環境変数保存

コードから読めること

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

載せる条件: 確かめやすいコード
入口を読んだhooks/hooks.json が名指すモジュールをすべて読んだ。hooks/register.tsx
解析できるすべてのファイルが TypeScript か JavaScript として解析できる。6 ファイルを解析
コードが 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 BatuhanCakmakk/wavy-usage
/plugin install wavy-usage@wavy-usage

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

Claude に聞く

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

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

Claude から探す: MCP コネクタ

似たデザイン