modscode EN

modscode / 図鑑 / reflog

reflog

A lazygit-style side pane for Claude Code: worktrees, local branches, tags and a commit graph as rows you click, with branch and commit popups for the everyday git actions (switch, merge, rebase, cherry-pick, fetch, pull, push). Docked bes…

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

何をするか

  • 欄・トーストを描く
  • /cd を足す
  • session.start・turn.complete・ui.close・ui.input ほか 1 個にフックする
  • プロセスを起こす

良いところ

  • ネットワークに出ない
  • TypeScript で書かれている
  • ファイルを書かない

作り始めるためのコード

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

雛形(register.tsx)

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

// Drawn like reflog by Nfet445 (pane, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/nfet445-reflog/
// 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: "git" })
  on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
    const { Box, Text, Button, Input } = $.ui.resolve(e)
    const basename = '…'
    const error = '…'
    const upstream = '…'
    const length = '…'
    const name = '…'
    const dirty = '…'
    const flags = '…'
    const path = '…'
    const dirty2 = '…'
    const flags2 = '…'
    const path2 = '…'
    const dirty3 = '…'
    const flags3 = '…'
    const path3 = '…'
    const marker = '…'
    const track = '…'
    const date = '…'
    const marker2 = '…'
    const name2 = '…'
    const marker3 = '…'
    const name3 = '…'
    const scope = '…'
    const commitStamp = '…'
    const sha = '…'
    const ch = '…'
    const ch2 = '…'
    const ch3 = '…'
    const map = '…'
    const value = '…'
    const tags = '…'
    const subject = '…'
    const hash = '…'
    const heads = '…'
    const remotes = '…'
    const author = '…'
    const match = '…'
    const line = '…'
    const line2 = '…'
    const line3 = '…'
    const line4 = '…'
    const line5 = '…'
    const line6 = '…'
    const ch4 = '…'
    const ch5 = '…'
    const ch6 = '…'
    const author2 = '…'
    const line7 = '…'
    const line8 = '…'
    const line9 = '…'
    const line10 = '…'
    const line11 = '…'
    const line12 = '…'
    const ch7 = '…'
    const ch8 = '…'
    const ch9 = '…'
    const author3 = '…'
    const line13 = '…'
    const line14 = '…'
    const line15 = '…'
    const line16 = '…'
    const line17 = '…'
    const line18 = '…'
    return (
      <Box flexDirection="column">
        <Text bold>
          {basename}
        </Text>
        <Text color="red">
          {error}
        </Text>
        <Box flexDirection="row" columnGap={1}>
          <Text color="yellow">
            {`push to ${upstream}?`}
          </Text>
          <Button label="yes" variant="primary" />
          <Button label="no" variant="primary" />
        </Box>
        <Box flexDirection="row" columnGap={1}>
          <Text bold color="cyan">
            {`Worktrees (${length})`}
          </Text>
          <Button label="add" variant="primary" />
        </Box>
        <Input label="branch " value="" submitLabel="add" autoFocus />
        <Box flexDirection="column">
          <Box flexDirection="row">
            <Text>
              {"  "}
            </Text>
            <Text color="green">
              {"● "}
            </Text>
            <Button plain label={`${basename}  ${name}`} />
            <Text color="yellow">
              {dirty}
            </Text>
            <Text color="red">
              {flags}
            </Text>
            <Button plain label=" …" />
          </Box>
          <Box flexDirection="column" borderStyle="round" borderDimColor paddingX={1}>
            <Text dimColor>
              {path}
            </Text>
            <Box flexDirection="row" columnGap={1}>
              <Text color="yellow">
                remove?
              </Text>
              <Button label="yes" variant="primary" />
              <Button label="no" variant="primary" />
            </Box>
          </Box>
        </Box>
        <Box flexDirection="column">
          <Box flexDirection="row">
            <Text>
              {"  "}
            </Text>
            <Text color="green">
              {"● "}
            </Text>
            <Button plain label={`${basename}  ${name}`} />
            <Text color="yellow">
              {dirty2}
            </Text>
            <Text color="red">
              {flags2}
            </Text>
            <Button plain label=" …" />
          </Box>
          <Box flexDirection="column" borderStyle="round" borderDimColor paddingX={1}>
            <Text dimColor>
              {path2}
            </Text>
            <Box flexDirection="row" columnGap={1}>
              <Text color="yellow">
                remove?
              </Text>
              <Button label="yes" variant="primary" />
              <Button label="no" variant="primary" />
            </Box>
          </Box>
        </Box>
        <Box flexDirection="column">
          <Box flexDirection="row">
            <Text>
              {"  "}
            </Text>
            <Text color="green">
              {"● "}
            </Text>
            <Button plain label={`${basename}  ${name}`} />
            <Text color="yellow">
              {dirty3}
            </Text>
            <Text color="red">
              {flags3}
            </Text>
            <Button plain label=" …" />
          </Box>
          <Box flexDirection="column" borderStyle="round" borderDimColor paddingX={1}>
            <Text dimColor>
              {path3}
            </Text>
            <Box flexDirection="row" columnGap={1}>
              <Text color="yellow">
                remove?
              </Text>
              <Button label="yes" variant="primary" />
              <Button label="no" variant="primary" />
            </Box>
          </Box>
        </Box>
        <Box flexDirection="row">
          <Text bold color="cyan">
            {`Branches (${length})`}
          </Text>
        </Box>
        <Box flexDirection="column">
          <Box flexDirection="row">
            <Text>
              {"  "}
            </Text>
            <Text color="green">
              {marker}
            </Text>
            <Text>
              {"● "}
            </Text>
            <Button plain label={`${name}`} />
            <Text color="red">
              {` ${track}`}
            </Text>
          </Box>
          <Box flexDirection="column" borderStyle="round" borderDimColor paddingX={1}>
            <Text bold>
              {name}
            </Text>
            <Text dimColor>
              {`${upstream} · ${date}`}
            </Text>
            <Text dimColor>
              checked out here
            </Text>
            <Button label="show all history" variant="primary" />
          </Box>
        </Box>
        <Box flexDirection="column">
          <Box flexDirection="row">
            <Text>
              {"  "}
            </Text>
            <Text color="green">
              {marker2}
            </Text>
            <Text>
              {"● "}
            </Text>
            <Button plain label={`${name}`} />
            <Text color="red">
              {` ${track}`}
            </Text>
          </Box>
          <Box flexDirection="column" borderStyle="round" borderDimColor paddingX={1}>
            <Text bold>
              {name2}
            </Text>
            <Text dimColor>
              {`${upstream} · ${date}`}
            </Text>
            <Text dimColor>
              checked out here
            </Text>
            <Button label="show all history" variant="primary" />
          </Box>
        </Box>
        <Box flexDirection="column">
          <Box flexDirection="row">
            <Text>
              {"  "}
            </Text>
            <Text color="green">
              {marker3}
            </Text>
            <Text>
              {"● "}
            </Text>
            <Button plain label={`${name}`} />
            <Text color="red">
              {` ${track}`}
            </Text>
          </Box>
          <Box flexDirection="column" borderStyle="round" borderDimColor paddingX={1}>
            <Text bold>
              {name3}
            </Text>
            <Text dimColor>
              {`${upstream} · ${date}`}
            </Text>
            <Text dimColor>
              checked out here
            </Text>
            <Button label="show all history" variant="primary" />
          </Box>
        </Box>
        <Box flexDirection="row">
          <Text bold color="cyan">
            {`Tags (${length})`}
          </Text>
        </Box>
        <Box flexDirection="column">
          <Box flexDirection="row">
            <Text>
              {"  "}
            </Text>
            <Text color="green">
              {"◆ "}
            </Text>
            <Button plain label={`${name}`} />
            <Text dimColor>
              {` ${date}`}
            </Text>
          </Box>
          <Box flexDirection="column" borderStyle="round" borderDimColor paddingX={1}>
            <Box flexDirection="row" columnGap={1}>
              <Text color="yellow">
                delete?
              </Text>
              <Button label="yes" variant="primary" />
              <Button label="no" variant="primary" />
            </Box>
          </Box>
        </Box>
        <Box flexDirection="column">
          <Box flexDirection="row">
            <Text>
              {"  "}
            </Text>
            <Text color="green">
              {"◆ "}
            </Text>
            <Button plain label={`${name}`} />
            <Text dimColor>
              {` ${date}`}
            </Text>
          </Box>
          <Box flexDirection="column" borderStyle="round" borderDimColor paddingX={1}>
            <Box flexDirection="row" columnGap={1}>
              <Text color="yellow">
                delete?
              </Text>
              <Button label="yes" variant="primary" />
              <Button label="no" variant="primary" />
            </Box>
          </Box>
        </Box>
        <Box flexDirection="column">
          <Box flexDirection="row">
            <Text>
              {"  "}
            </Text>
            <Text color="green">
              {"◆ "}
            </Text>
            <Button plain label={`${name}`} />
            <Text dimColor>
              {` ${date}`}
            </Text>
          </Box>
          <Box flexDirection="column" borderStyle="round" borderDimColor paddingX={1}>
            <Box flexDirection="row" columnGap={1}>
              <Text color="yellow">
                delete?
              </Text>
              <Button label="yes" variant="primary" />
              <Button label="no" variant="primary" />
            </Box>
          </Box>
        </Box>
        <Box flexDirection="row" columnGap={1}>
          <Text bold color="cyan">
            History
          </Text>
          <Text>
            {`@${scope}`}
          </Text>
          <Button label="clear" variant="primary" />
        </Box>
        <Box flexDirection="row" borderStyle="round" borderDimColor paddingX={1}>
          <Input placeholder="Filter the git tree" value="" submitLabel="apply" />
        </Box>
        <Box flexDirection="column">
          <Box flexDirection="row">
            <Box flexDirection="row" flexShrink={0}>
              <Text>
                {"  "}
              </Text>
              <Text>
                {`${commitStamp} `}
              </Text>
              <Text color="yellow">
                {`${sha} `}
              </Text>
              <Text>
                {ch}
              </Text>
              <Text>
                {ch2}
              </Text>
              <Text>
                {ch3}
              </Text>
              <Text>
                {"        "}
              </Text>
              <Text color="magenta">
                {` (${map})`}
              </Text>
              <Text color="red">
                {` {${value}}`}
              </Text>
              <Text color="green">
                {` [${tags}]`}
              </Text>
            </Box>
            <Button plain label={` ${subject}`} />
          </Box>
          <Box flexDirection="column" borderStyle="round" borderDimColor paddingX={1}>
            <Button plain label={`${hash}`} />
            <Text color="magenta" wrap="wrap">
              {`(${heads})`}
            </Text>
            <Text color="red" wrap="wrap">
              {`{${remotes}}`}
            </Text>
            <Text color="green" wrap="wrap">
              {`[${tags}]`}
            </Text>
            <Text wrap="truncate-end">
              <Text color="green">
                {author}
              </Text>
              <Text color="cyan">
                {` ${match}`}
              </Text>
              <Text dimColor>
                {` · ${date}`}
              </Text>
            </Text>
            <Text wrap="wrap">
              {line}
            </Text>
            <Text wrap="wrap">
              {line2}
            </Text>
            <Text wrap="wrap">
              {line3}
            </Text>
            <Text dimColor>
              {line4}
            </Text>
            <Text dimColor>
              {line5}
            </Text>
            <Text dimColor>
              {line6}
            </Text>
            <Box flexDirection="column">
              <Box flexDirection="row" columnGap={1}>
                <Button label="less" variant="secondary" />
                <Button label="less" variant="secondary" />
                <Button label="less" variant="secondary" />
              </Box>
              <Box flexDirection="row" columnGap={1}>
                <Button label="less" variant="secondary" />
                <Button label="less" variant="secondary" />
                <Button label="less" variant="secondary" />
              </Box>
              <Box flexDirection="row" columnGap={1}>
                <Button label="less" variant="secondary" />
                <Button label="less" variant="secondary" />
                <Button label="less" variant="secondary" />
              </Box>
            </Box>
          </Box>
        </Box>
        <Box flexDirection="column">
          <Box flexDirection="row">
            <Box flexDirection="row" flexShrink={0}>
              <Text>
                {"  "}
              </Text>
              <Text>
                {`${commitStamp} `}
              </Text>
              <Text color="yellow">
                {`${sha} `}
              </Text>
              <Text>
                {ch4}
              </Text>
              <Text>
                {ch5}
              </Text>
              <Text>
                {ch6}
              </Text>
              <Text>
                {"        "}
              </Text>
              <Text color="magenta">
                {` (${map})`}
              </Text>
              <Text color="red">
                {` {${value}}`}
              </Text>
              <Text color="green">
                {` [${tags}]`}
              </Text>
            </Box>
            <Button plain label={` ${subject}`} />
          </Box>
          <Box flexDirection="column" borderStyle="round" borderDimColor paddingX={1}>
            <Button plain label={`${hash}`} />
            <Text color="magenta" wrap="wrap">
              {`(${heads})`}
            </Text>
            <Text color="red" wrap="wrap">
              {`{${remotes}}`}
            </Text>
            <Text color="green" wrap="wrap">
              {`[${tags}]`}
            </Text>
            <Text wrap="truncate-end">
              <Text color="green">
                {author2}
              </Text>
              <Text color="cyan">
                {` ${match}`}
              </Text>
              <Text dimColor>
                {` · ${date}`}
              </Text>
            </Text>
            <Text wrap="wrap">
              {line7}
            </Text>
            <Text wrap="wrap">
              {line8}
            </Text>
            <Text wrap="wrap">
              {line9}
            </Text>
            <Text dimColor>
              {line10}
            </Text>
            <Text dimColor>
              {line11}
            </Text>
            <Text dimColor>
              {line12}
            </Text>
            <Box flexDirection="column">
              <Box flexDirection="row" columnGap={1}>
                <Button label="less" variant="secondary" />
                <Button label="less" variant="secondary" />
                <Button label="less" variant="secondary" />
              </Box>
              <Box flexDirection="row" columnGap={1}>
                <Button label="less" variant="secondary" />
                <Button label="less" variant="secondary" />
                <Button label="less" variant="secondary" />
              </Box>
              <Box flexDirection="row" columnGap={1}>
                <Button label="less" variant="secondary" />
                <Button label="less" variant="secondary" />
                <Button label="less" variant="secondary" />
              </Box>
            </Box>
          </Box>
        </Box>
        <Box flexDirection="column">
          <Box flexDirection="row">
            <Box flexDirection="row" flexShrink={0}>
              <Text>
                {"  "}
              </Text>
              <Text>
                {`${commitStamp} `}
              </Text>
              <Text color="yellow">
                {`${sha} `}
              </Text>
              <Text>
                {ch7}
              </Text>
              <Text>
                {ch8}
              </Text>
              <Text>
                {ch9}
              </Text>
              <Text>
                {"        "}
              </Text>
              <Text color="magenta">
                {` (${map})`}
              </Text>
              <Text color="red">
                {` {${value}}`}
              </Text>
              <Text color="green">
                {` [${tags}]`}
              </Text>
            </Box>
            <Button plain label={` ${subject}`} />
          </Box>
          <Box flexDirection="column" borderStyle="round" borderDimColor paddingX={1}>
            <Button plain label={`${hash}`} />
            <Text color="magenta" wrap="wrap">
              {`(${heads})`}
            </Text>
            <Text color="red" wrap="wrap">
              {`{${remotes}}`}
            </Text>
            <Text color="green" wrap="wrap">
              {`[${tags}]`}
            </Text>
            <Text wrap="truncate-end">
              <Text color="green">
                {author3}
              </Text>
              <Text color="cyan">
                {` ${match}`}
              </Text>
              <Text dimColor>
                {` · ${date}`}
              </Text>
            </Text>
            <Text wrap="wrap">
              {line13}
            </Text>
            <Text wrap="wrap">
              {line14}
            </Text>
            <Text wrap="wrap">
              {line15}
            </Text>
            <Text dimColor>
              {line16}
            </Text>
            <Text dimColor>
              {line17}
            </Text>
            <Text dimColor>
              {line18}
            </Text>
            <Box flexDirection="column">
              <Box flexDirection="row" columnGap={1}>
                <Button label="less" variant="secondary" />
                <Button label="less" variant="secondary" />
                <Button label="less" variant="secondary" />
              </Box>
              <Box flexDirection="row" columnGap={1}>
                <Button label="less" variant="secondary" />
                <Button label="less" variant="secondary" />
                <Button label="less" variant="secondary" />
              </Box>
              <Box flexDirection="row" columnGap={1}>
                <Button label="less" variant="secondary" />
                <Button label="less" variant="secondary" />
                <Button label="less" variant="secondary" />
              </Box>
            </Box>
          </Box>
        </Box>
        <Box flexDirection="row">
          <Text>
            {"  "}
          </Text>
          <Button label="load 50 more" variant="primary" />
        </Box>
      </Box>
    )
  })

  on('session.start', async ($, e, next) => {
    const what = '…'
    const firstLine = '…'
    await $.ui.toast(`cc-reflog: uncommitted changes here; commit or stash before ${what}`)
    await $.ui.toast(`cc-reflog: ${what} failed and was aborted: ${firstLine}`)
    return next(e)
  })
}

Mod 自身のコード

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

cc-reflog/hooks/cc-reflog.tsx 515〜674 行 · ペイン
  on('ui.render', { component: 'Pane' }, async ($, e, next) => {
    if (e.requestId !== PANE) return next(e)
    const { Box, Text, Button, Input } = $.ui.resolve(e)
    const width = Math.max(20, e.props.bodyColumns - 1)
    const noop = () => {}
    if (!snap) {
      return (
        <Box flexDirection="column">
          <Text color="red">{fit(error ?? 'reading the repository…', width)}</Text>
        </Box>
      )
    }

    const s = snap
    const here = currentWorktree(s)
    const current = s.branches.find(b => b.name === here?.branch)
    const chosen = selected ? s.branches.find(b => b.name === selected) : undefined
    // lanes are padded to one width so the hashes line up in a column
    const laneWidth = Math.max(0, ...graph.map(row => row.cells.length))
    const now = new Date()
    const stampWidth = Math.max(0, ...graph.map(row => (row.commit ? commitStamp(row.commit.time, now).length : 0)))
    const shaWidth = Math.max(0, ...graph.map(row => row.commit?.sha.length ?? 0))
    // the buttons of a branch popup; `switch` and `open` keep their own keys, the hotkeys of the pane
    const ops = (b: Branch) => {
      const act = branchAction(s, b)
      if (act.kind === 'current') return null
      if (pending?.name === b.name) {
        return (
          <Box key="ops" flexDirection="row" columnGap={1}>
            <Text color="yellow">{`${pending.op} ${b.name}?`}</Text>
            <Button key="yes" label="yes" variant="primary" onPress={noop} />
            <Button key="no" label="no" variant="primary" onPress={noop} />
          </Box>
        )
      }
      if (renaming?.name === b.name) {
        return <Input key="rename" label="name " value={b.name} submitLabel="rename" autoFocus onSubmit={noop} />
      }
      const go = act.kind === 'switch' ? 'switch' : 'open'
      const goLabel = go === 'switch' ? 'switch' : 'open worktree'
      return (
        <Box key="ops" flexDirection="row" columnGap={1}>
          <Button key={go} label={goLabel} hotkey={go === 'switch' ? 's' : 'o'} variant="primary" onPress={noop} />
          <Button key={`do:rename:${b.name}`} label="rename" variant="primary" onPress={noop} />
          <Button key="opsmore:branch" label={moreOps ? 'less' : 'more'} variant="secondary" onPress={noop} />
          {moreOps
            ? (['delete', 'merge', 'rebase'] as const).map(op => (
                <Button key={`do:${op}:${b.name}`} label={op} variant="primary" onPress={noop} />
              ))
            : null}
        </Box>
      )
    }

    return (
      <Box flexDirection="column">
        <Text bold>{fit(basename(s.worktrees[0]?.path ?? s.root), width)}</Text>
        {error ? <Text color="red">{fit(error, width)}</Text> : null}
        {pushAsk ? (
          <Box key="push-ask" flexDirection="row" columnGap={1}>
            <Text color="yellow">{`push to ${current?.upstream ?? s.remotes[0] ?? '?'}?`}</Text>
            <Button key="yes" label="yes" variant="primary" onPress={noop} />
            <Button key="no" label="no" variant="primary" onPress={noop} />
          </Box>
        ) : (
          <Box key="sync" flexDirection="row" columnGap={1}>
            {s.remotes.length > 0 ? <Button key="fetch" label="fetch" variant="primary" onPress={noop} /> : null}
            {current?.upstream ? <Button key="pull" label="pull" variant="primary" onPress={noop} /> : null}
            {current && (current.upstream || s.remotes.length > 0) ? <Button key="push" label="push" variant="primary" onPress={noop} /> : null}
          </Box>
        )}

        <Box key="wt-head" flexDirection="row" columnGap={1}>
          <Text bold color="cyan">{`Worktrees (${s.worktrees.length})`}</Text>
          {addingWt ? null : <Button key="wtadd" label="add" variant="primary" onPress={noop} />}
        </Box>
        {addingWt ? <Input key="wtnew" label="branch " value="" submitLabel="add" autoFocus onSubmit={noop} /> : null}
        {s.worktrees.map((wt, i) => {
          const isHere = wt === here
          const name = wt.branch ?? (wt.bare ? '(bare)' : `(${wt.head.slice(0, 7)})`)
          const dirty = wt.dirty ? ` ~${wt.dirty}` : ''
          const flags = `${wt.locked ? ' locked' : ''}${wt.prunable ? ' prunable' : ''}`
          return (
            <Box key={`wt-row:${i}`} flexDirection="column">
              <Box key="row" flexDirection="row">
                <Text>{'  '}</Text>
                <Text color="green">{isHere ? ICONS.here : ICONS.other}</Text>
                <Button
                  key={`wt:${i}`}
                  plain
                  dimColor={!isHere}
                  label={`${basename(wt.path)}  ${name}`}
                  onPress={noop}
                />
                {dirty ? <Text color="yellow">{dirty}</Text> : null}
                {flags ? <Text color="red">{flags}</Text> : null}
                {i > 0 ? <Button key={`wtm:${i}`} plain dimColor={wtMenu !== i} label=" …" onPress={noop} /> : null}
              </Box>
              {wtMenu === i ? (
                <Box key="wt-detail" flexDirection="column" borderStyle="round" borderDimColor paddingX={1}>
                  <Text dimColor>{fit(wt.path, width - 4)}</Text>
                  {wtAsk ? (
                    <Box key="wt-ask" flexDirection="row" columnGap={1}>
                      <Text color="yellow">remove?</Text>
                      <Button key="yes" label="yes" variant="primary" onPress={noop} />
                      <Button key="no" label="no" variant="primary" onPress={noop} />
                    </Box>
                  ) : (
                    <Box key="wt-ops" flexDirection="row" columnGap={1}>
                      <Button key="wtlock" label={wt.locked ? 'unlock' : 'lock'} variant="primary" onPress={noop} />
                      {isHere ? null : <Button key="wtdel" label="remove" variant="primary" onPress={noop} />}
                    </Box>
                  )}
                </Box>
              ) : null}
            </Box>
          )
        })}

        <Box key="br-head" flexDirection="row">
          <Text bold color="cyan">{`Branches (${s.branches.length})`}</Text>
        </Box>
        {s.branches.map((b, i) => {
          const isHere = here?.branch === b.name
          const marker = isHere ? ICONS.current : b.worktree ? ICONS.elsewhere : ICONS.plain
          const track = trackLabel(b)
          return (
            <Box key={`br-row:${i}`} flexDirection="column">
              <Box key="row" flexDirection="row">
                <Text>{'  '}</Text>
                <Text color={isHere ? 'green' : 'blue'}>{marker}</Text>
                <Text color={branchColor(b.name)}>● </Text>
                <Button
                  key={`br:${i}`}
                  plain
                  dimColor={!isHere && selected !== b.name}
                  label={b.name}
                  onPress={noop}
                />
                {track ? <Text color={b.gone ? 'red' : 'magenta'}>{` ${track}`}</Text> : null}
              </Box>
              {chosen === b ? (
                <Box key="detail" flexDirection="column" borderStyle="round" borderDimColor paddingX={1}>
                  <Text bold>{fit(b.name, width - 4)}</Text>
                  <Text dimColor>{fit(`${b.upstream ?? 'no upstream'} · ${b.date}`, width - 4)}</Text>
                  {ops(b) ?? <Text dimColor>checked out here</Text>}
                  <Button key="scope" label={scope === b.name ? 'show all history' : 'history of this branch'} variant="primary" onPress={noop} />
                </Box>
              ) : null}
            </Box>
          )
        })}

        {s.tags.length > 0 ? (
          <Box key="tg-head" flexDirection="row">
            <Text bold color="cyan">{`Tags (${s.tags.length})`}</Text>
          </Box>
        ) : null}
        {s.tags.map((t, i) => (
          <Box key={`tg-row:${i}`} flexDirection="column">
ライセンスの全文(MIT)
MIT License

Copyright (c) 2026 c2h5oh

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.

コードが呼ぶもの

プログラム起動

コードから読み取ったデザイン

読み取ったコミットのソースから描いたもので、動かした結果ではありません。一覧は 3 回描き、条件はデスクトップアプリで描く最初の分岐を取り、動かしたときにだけ決まる値は仮の例(点線の下線)にするか省きます。色と書体はこのサイトのものです。

コードから読めること

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

載せる条件: 確かめやすいコード
入口を読んだhooks/hooks.json が名指すモジュールをすべて読んだ。cc-reflog/hooks/cc-reflog.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/… などは無い)。Windows にないプログラムを使わない
通信fetch の送り先(https のホスト)がコードに書いてあるか。通信なし
プログラム起動するプログラムの名前がコードに書いてあり、シェル・インタプリタ・通信用の道具でないか。cc-reflog/hooks/cc-reflog.tsx:206 実行時に決まるプログラム; cc-reflog/hooks/cc-reflog.tsx:226 実行時に決まるプログラム; cc-reflog/hooks/cc-reflog.tsx:243 実行時に決まるプログラム; cc-reflog/hooks/cc-reflog.tsx:254 実行時に決まるプログラム; cc-reflog/hooks/cc-reflog.tsx:289 実行時に決まるプログラム
読んで送るファイルや環境変数を読み、かつ通信するか。通信しない
ソースの鍵ソースに API キーや秘密鍵らしきものがあるか。ソースに鍵なし
ライセンスオープンなライセンス(MIT・Apache-2.0・BSD・ISC・Unlicense・0BSD・CC0)で全文があれば、modscode にコードを載せる。違えばリンクだけ。MIT

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

入れる

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

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

/plugin marketplace add Nfet445/cc-reflog
/plugin install reflog@cc-reflog

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

Claude に聞く

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

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

Claude から探す: MCP コネクタ

似たデザイン