modscode EN

modscode / 図鑑 / ccmod-chronicle

ccmod-chronicle

Sidebar that analyzes how you use Claude Code: live warnings, cost, tips, standup and CLAUDE.md improvements. English and Japanese.

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

何をするか

  • 欄・トーストを描く
  • /chronicle を足す
  • ツールの呼び出しを見張る
  • agent.spawn・config.set・session.end・session.measure ほか 1 個にフックする
  • ターンをまたいで自分の状態を持つ

良いところ

  • ネットワークに出ない
  • エラーを扱う
  • ファイルを書かない

作り始めるためのコード

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

雛形(register.tsx)

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

// Drawn like ccmod-chronicle by m-aoki (pane, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/m-aoki1348125-ccmod-chronicle/
// 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: "Chronicle" })
  on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
    const { Box, Button, Link, Text, Code, Markdown, Select } = $.ui.resolve(e)
    const t = '…'
    const applyChat = '…'
    const doc = '…'
    const MARK = '…'
    const title = '…'
    const evidence = '…'
    const t2 = '…'
    const actionHead = '…'
    const action = '…'
    const promptHead = '…'
    const copyText = '…'
    const explainHead = '…'
    const text = '…'
    const usageLine = '…'
    const modelLabel = '…'
    const model = '…'
    const effort = '…'
    const sessionUsage = '…'
    const sendLocal = '…'
    return (
      <Box flexDirection="column" rowGap={1}>
        <Box flexDirection="row" columnGap={2} flexWrap="wrap">
          <Button label={`${t}`} hotkey="b" plain />
          <Button label={`${t}`} hotkey="c" plain />
          <Button label={`${applyChat}`} />
          <Link href={`${doc}`} label={`${t}`} />
        </Box>
        <Text color="success">
          {t}
        </Text>
        <Text bold>
          {`${MARK} ${title}`}
        </Text>
        <Text dimColor>
          {evidence}
        </Text>
        <Box flexDirection="column">
          <Text bold>
            {t2}
          </Text>
          <Text>
            {"  • 1"}
          </Text>
          <Text>
            {"  • 1"}
          </Text>
          <Text>
            {"  • 1"}
          </Text>
        </Box>
        <Box flexDirection="column">
          <Text bold>
            {`${actionHead}`}
          </Text>
          <Text>
            {`  ${action}`}
          </Text>
        </Box>
        <Box flexDirection="column">
          <Text bold>
            {`${promptHead}`}
          </Text>
          <Code source={`${copyText}`} />
        </Box>
        <Box flexDirection="column">
          <Box flexDirection="row" columnGap={2}>
            <Text bold>
              {`${explainHead}`}
            </Text>
            <Button label={`${t}`} hotkey="g" plain />
          </Box>
          <Markdown text={`${text}`} />
          <Text dimColor>
            {usageLine}
          </Text>
          <Box flexDirection="column">
            <Box flexDirection="row" columnGap={2} flexWrap="wrap">
              <Select label={`${modelLabel}`} value={`${model}`} />
              <Select label="effort" value={`${effort}`} />
            </Box>
            <Text dimColor>
              {`${sessionUsage}`}
            </Text>
          </Box>
          <Text dimColor>
            {`${sendLocal}`}
          </Text>
        </Box>
      </Box>
    )
  })

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

Mod 自身のコード

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

hooks/register.js 122〜126 行 · ペイン
  on('ui.render', { component: 'Pane' }, async ($, e, next) => {
    if (e.requestId !== PANE) return next(e)
    const el = $.ui.resolve(e)
    return renderPane(el, viewModel(await $.clock.now()), handlersFor($))
  })
hooks/view.js 24〜32 行 · ペイン
export function renderPane(el, model, h) {
  const { Box } = el
  if (model.detail) return renderDetail(el, model, h)
  return Box({
    flexDirection: 'column',
    rowGap: 1,
    children: [tabRow(el, model, h), statusLine(el, model, h), ...body(el, model, h), aiBlock(el, model, h)].filter(Boolean),
  })
}
hooks/view.js 140〜161 行 · ペイン
function renderDetail(el, model, h) {
  const { Box, Text, Code } = el
  const { t } = model
  const f = model.detail
  const details = f.details || []
  const shown = details.slice(0, DETAIL_MAX).map((d) => Text({ children: [clean('  • ' + d)] }))
  if (details.length > DETAIL_MAX) shown.push(Text({ dimColor: true, children: [t('more', { n: details.length - DETAIL_MAX })] }))
  return Box({
    flexDirection: 'column',
    rowGap: 1,
    children: [
      detailActions(el, t, f, h),
      f.isResolved ? Text({ color: 'success', children: [t('resolved')] }) : null,
      Text({ bold: true, ...(COLOR[f.severity] ? { color: COLOR[f.severity] } : {}), children: [clean(`${MARK[f.severity]} ${f.title}`)] }),
      Text({ dimColor: true, children: [clean(f.evidence)] }),
      shown.length ? Box({ flexDirection: 'column', children: [Text({ bold: true, children: [t('breakdown')] }), ...shown] }) : null,
      Box({ flexDirection: 'column', children: [Text({ bold: true, children: [t('actionHead')] }), Text({ children: [clean('  ' + f.action)] })] }),
      Box({ flexDirection: 'column', children: [Text({ bold: true, children: [t('promptHead')] }), Code({ source: clean(f.copyText) })] }),
      explainBlock(el, model, h),
    ].filter(Boolean),
  })
}
hooks/view.js 163〜176 行 · ペイン
function detailActions(el, t, f, h) {
  const { Box, Button, Link } = el
  return Box({
    flexDirection: 'row',
    columnGap: 2,
    flexWrap: 'wrap',
    children: [
      Button({ key: 'back', label: t('back'), hotkey: 'b', plain: true, onPress: () => h.onBack() }),
      Button({ key: 'copy-' + f.id, label: t('copy'), hotkey: 'c', plain: true, onPress: (press) => h.onCopy(f.copyText, press) }),
      f.applyPrompt ? Button({ key: 'apply-' + f.id, label: t('applyChat'), onPress: () => h.onApply(f) }) : null,
      f.doc ? Link({ href: f.doc, label: t('docs') }) : null,
    ].filter(Boolean),
  })
}
hooks/view.js 178〜196 行 · ペイン
function explainBlock(el, model, h) {
  const { Box, Text, Button, Markdown } = el
  const { t } = model
  const f = model.detail
  const ex = model.explain
  const body = ex?.loading ? [Text({ dimColor: true, children: [t('explaining', { model: ex.model })] })]
    : ex?.error ? [Text({ color: 'error', children: [clean(t('explainFailed', { error: ex.error }))] })]
    : ex?.text ? [Markdown({ key: 'explain-' + f.id, text: clean(ex.text).slice(0, 9000) }), Text({ dimColor: true, children: [usageLine(t, ex)] })]
    : [Text({ dimColor: true, children: [generateHint(t, model.settings)] })]
  return Box({
    flexDirection: 'column',
    children: [
      Box({ flexDirection: 'row', columnGap: 2, children: [Text({ bold: true, children: [t('explainHead')] }), Button({ key: 'explain-again', label: t(ex?.text ? 'regenerate' : 'generate'), hotkey: 'g', plain: true, onPress: () => h.onExplainAgain(f) })] }),
      ...body,
      settingsRow(el, model, h),
      Text({ dimColor: true, children: [t(f.localDetails ? 'sendLocal' : 'sendDetail')] }),
    ],
  })
}
hooks/view.js 211〜229 行 · ペイン
function settingsRow(el, model, h) {
  const { Box, Text, Select } = el
  const { t, settings, aiUsage } = model
  return Box({
    flexDirection: 'column',
    children: [
      Box({
        flexDirection: 'row',
        columnGap: 2,
        flexWrap: 'wrap',
        children: [
          Select({ key: 'ai-model', label: t('modelLabel'), value: settings.model, options: MODEL_OPTIONS.map((m) => ({ value: m, label: CREDIT_MODELS.has(m) ? t('creditLabel', { model: m }) : m })), onSelect: (v) => h.onSetting('aiModel', v) }),
          Select({ key: 'ai-effort', label: 'effort', value: settings.effort, options: EFFORT_OPTIONS.map((x) => ({ value: x, label: x })), onSelect: (v) => h.onSetting('aiEffort', v) }),
        ],
      }),
      Text({ dimColor: true, children: [t('sessionUsage', aiUsage)] }),
    ],
  })
}
ライセンスの全文(MIT)
MIT License

Copyright (c) 2026 m-aoki

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

載せる条件: 確かめやすいコード
入口を読んだhooks/hooks.json が名指すモジュールをすべて読んだ。hooks/register.js
解析できるすべてのファイルが TypeScript か JavaScript として解析できる。9 ファイルを解析
コードが 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.js:429 実行時に決まるプログラム; hooks/register.js:511 実行時に決まるプログラム
読んで送るファイルや環境変数を読み、かつ通信するか。通信しない
ソースの鍵ソースに API キーや秘密鍵らしきものがあるか。ソースに鍵なし
ライセンスオープンなライセンス(MIT・Apache-2.0・BSD・ISC・Unlicense・0BSD・CC0)で全文があれば、modscode にコードを載せる。違えばリンクだけ。MIT

コードの文面を読んだだけで、安全の審査ではありません。動かしてはおらず、起動するプログラムの中で何が起きるかも見えません。入れる前の確認はあなたの役目です。 載せる条件

入れる

入れる前に、必ず自分で確かめてください。Mod はサンドボックスなしで、あなたの権限で動きます。modscode はこのコードの安全を保証しません。下のコードを読み(またはフォルダーで claude plugin validate .)、触るものを見て、読んだコミットを入れてください。

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

/plugin marketplace add m-aoki1348125/ccmod-chronicle
/plugin install ccmod-chronicle@ccmod-chronicle

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

Claude に聞く

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

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

Claude から探す: MCP コネクタ

似たデザイン