cactus-pane
A live cactus inbox pane for the session's project, answerable in place
何をするか
- 欄・トーストを描く
- /cactus-pane を足す
- Bash の呼び出しを見張る(止めることがある)
- prompt.compose・session.start・ui.focus・ui.message ほか 1 個にフックする
- プロセスを起こす
良いところ
- ネットワークに出ない
- TypeScript で書かれている
- ファイルを書かない
作り始めるためのコード
2 種類あります。上のデザインから modscode が書いた雛形と、その Mod 自身のコードのうち描いている部分です。
雛形(register.tsx)
import type { Register } from 'claude-code'
// Drawn like cactus-pane by Sean Canton (pane, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/eighteyes-cactus-pane/
// 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: "cactus" })
on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
const { Box, Text, Button, Client, Input } = $.ui.resolve(e)
const failed = '…'
const stack = '…'
const value = '…'
const key = '…'
const act = '…'
const word = '…'
const firstLine = '…'
const reflow = '…'
const filter = '…'
const para = '…'
const para2 = '…'
const para3 = '…'
const label = '…'
const confirmKey = '…'
const lines = '…'
const firstLine2 = '…'
const l = '…'
const l2 = '…'
const l3 = '…'
const lines2 = '…'
const firstLine3 = '…'
const l4 = '…'
const l5 = '…'
const l6 = '…'
const lines3 = '…'
const firstLine4 = '…'
const l7 = '…'
const l8 = '…'
const l9 = '…'
const rec = '…'
const recommend_why = '…'
const text = '…'
const n = '…'
const look_at = '…'
const run_cmd = '…'
const pass_when = '…'
const fail_when = '…'
const then_do = '…'
const exit = '…'
const l10 = '…'
const l11 = '…'
const l12 = '…'
const f = '…'
const shown = '…'
const f2 = '…'
const shown2 = '…'
const f3 = '…'
const shown3 = '…'
const verdict = '…'
const verdict2 = '…'
const verdict3 = '…'
const drafted = '…'
const length = '…'
const act2 = '…'
const firstLine5 = '…'
const reflow2 = '…'
const filter2 = '…'
const para4 = '…'
const para5 = '…'
const para6 = '…'
const lines4 = '…'
const firstLine6 = '…'
const l13 = '…'
const l14 = '…'
const l15 = '…'
const lines5 = '…'
const firstLine7 = '…'
const l16 = '…'
const l17 = '…'
const l18 = '…'
const lines6 = '…'
const firstLine8 = '…'
const l19 = '…'
const l20 = '…'
const l21 = '…'
const rec2 = '…'
const look_at2 = '…'
const run_cmd2 = '…'
const pass_when2 = '…'
const fail_when2 = '…'
const then_do2 = '…'
const exit2 = '…'
const l22 = '…'
const l23 = '…'
const l24 = '…'
const f4 = '…'
const shown4 = '…'
const f5 = '…'
const shown5 = '…'
const f6 = '…'
const shown6 = '…'
const verdict4 = '…'
const verdict5 = '…'
const verdict6 = '…'
const drafted2 = '…'
const act3 = '…'
const firstLine9 = '…'
const reflow3 = '…'
const filter3 = '…'
const para7 = '…'
const para8 = '…'
const para9 = '…'
const lines7 = '…'
const firstLine10 = '…'
const l25 = '…'
const l26 = '…'
const l27 = '…'
const lines8 = '…'
const firstLine11 = '…'
const l28 = '…'
const l29 = '…'
const l30 = '…'
const lines9 = '…'
const firstLine12 = '…'
const l31 = '…'
const l32 = '…'
const l33 = '…'
const rec3 = '…'
const look_at3 = '…'
const run_cmd3 = '…'
const pass_when3 = '…'
const fail_when3 = '…'
const then_do3 = '…'
const exit3 = '…'
const l34 = '…'
const l35 = '…'
const l36 = '…'
const f7 = '…'
const shown7 = '…'
const f8 = '…'
const shown8 = '…'
const f9 = '…'
const shown9 = '…'
const verdict7 = '…'
const verdict8 = '…'
const verdict9 = '…'
const drafted3 = '…'
return (
<Box flexDirection="column">
<Text color="red">
{failed}
</Text>
<Box flexDirection="row" columnGap={2}>
<Button label={`undo ${stack}`} hotkey={`${value}`} plain />
</Box>
<Text dimColor>
Inbox empty.
</Text>
<Box flexDirection="row" columnGap={2}>
<Button label="up" hotkey="k" plain />
<Button label="down" hotkey="j" plain />
</Box>
<Box flexDirection="column">
<Box flexDirection="row" columnGap={2}>
<Button label={`▸ ${key}`} plain />
<Text color="white">
{act}
</Text>
<Text wrap="truncate-end">
{`${word} `}
{firstLine}
</Text>
</Box>
<Box flexDirection="column" borderStyle="round" paddingX={1}>
<Text bold wrap="wrap">
{reflow}
</Text>
<Text dimColor>
{filter}
</Text>
<Box marginTop={1} flexDirection="column">
<Box marginTop={0}>
<Text dimColor wrap="wrap">
{para}
</Text>
</Box>
<Box marginTop={0}>
<Text dimColor wrap="wrap">
{para2}
</Text>
</Box>
<Box marginTop={0}>
<Text dimColor wrap="wrap">
{para3}
</Text>
</Box>
</Box>
<Text color="yellow">
waiting on a rewrite
{`: ${firstLine}`}
</Text>
<Box flexDirection="column" marginTop={1}>
<Box flexDirection="column">
<Box flexDirection="row" columnGap={2}>
<Button label={`✓ ${label}`} hotkey={`${confirmKey}`} plain variant="primary" />
<Text color="yellow">
recommended
</Text>
<Text color="blue">
chosen
</Text>
<Text dimColor wrap="wrap">
{lines}
</Text>
</Box>
<Text dimColor>
{" "}
{firstLine2}
</Text>
<Text color="green" wrap="wrap">
{" ✓ "}
{l}
</Text>
<Text color="green" wrap="wrap">
{" ✓ "}
{l2}
</Text>
<Text color="green" wrap="wrap">
{" ✓ "}
{l3}
</Text>
</Box>
<Box flexDirection="column">
<Box flexDirection="row" columnGap={2}>
<Button label={`✓ ${label}`} hotkey={`${confirmKey}`} plain variant="primary" />
<Text color="yellow">
recommended
</Text>
<Text color="blue">
chosen
</Text>
<Text dimColor wrap="wrap">
{lines2}
</Text>
</Box>
<Text dimColor>
{" "}
{firstLine3}
</Text>
<Text color="green" wrap="wrap">
{" ✓ "}
{l4}
</Text>
<Text color="green" wrap="wrap">
{" ✓ "}
{l5}
</Text>
<Text color="green" wrap="wrap">
{" ✓ "}
{l6}
</Text>
</Box>
<Box flexDirection="column">
<Box flexDirection="row" columnGap={2}>
<Button label={`✓ ${label}`} hotkey={`${confirmKey}`} plain variant="primary" />
<Text color="yellow">
recommended
</Text>
<Text color="blue">
chosen
</Text>
<Text dimColor wrap="wrap">
{lines3}
</Text>
</Box>
<Text dimColor>
{" "}
{firstLine4}
</Text>
<Text color="green" wrap="wrap">
{" ✓ "}
{l7}
</Text>
<Text color="green" wrap="wrap">
{" ✓ "}
{l8}
</Text>
<Text color="green" wrap="wrap">
{" ✓ "}
{l9}
</Text>
</Box>
</Box>
<Text color="yellow">
{"recommend "}
{rec}
{" "}
{" "}
{` — ${recommend_why}`}
</Text>
<Box flexDirection="column" marginTop={1}>
<Button label={`[x] ${text}`} hotkey={`${n}`} plain />
<Button label={`[x] ${text}`} hotkey={`${n}`} plain />
<Button label={`[x] ${text}`} hotkey={`${n}`} plain />
</Box>
<Box flexDirection="column" marginTop={1}>
<Text>
{"look at "}
<Text dimColor>
{look_at}
</Text>
</Text>
<Text>
{"run "}
<Text color="cyan">
{run_cmd}
</Text>
</Text>
<Text>
{"pass "}
<Text color="green">
{pass_when}
</Text>
</Text>
<Text>
{"fail "}
<Text color="red">
{fail_when}
</Text>
</Text>
<Text>
{"then "}
<Text dimColor>
{then_do}
</Text>
</Text>
</Box>
<Box flexDirection="column" marginTop={1}>
<Text color="green">
{"exit "}
{exit}
</Text>
<Text dimColor>
{l10}
</Text>
<Text dimColor>
{l11}
</Text>
<Text dimColor>
{l12}
</Text>
</Box>
<Box flexDirection="column" marginTop={1}>
<Box flexDirection="column">
<Box flexDirection="row" columnGap={2}>
<Button label="view" hotkey="f" plain />
<Button label="hide" hotkey="o" plain />
<Text dimColor>
{f}
</Text>
</Box>
<Text dimColor>
{shown}
</Text>
</Box>
<Box flexDirection="column">
<Box flexDirection="row" columnGap={2}>
<Button label="view" hotkey="f" plain />
<Button label="hide" hotkey="o" plain />
<Text dimColor>
{f2}
</Text>
</Box>
<Text dimColor>
{shown2}
</Text>
</Box>
<Box flexDirection="column">
<Box flexDirection="row" columnGap={2}>
<Button label="view" hotkey="f" plain />
<Button label="hide" hotkey="o" plain />
<Text dimColor>
{f3}
</Text>
</Box>
<Text dimColor>
{shown3}
</Text>
</Box>
</Box>
<Box flexDirection="column" marginTop={1}>
<Text dimColor>
{"→ "}
{verdict}
</Text>
<Text dimColor>
{"→ "}
{verdict2}
</Text>
<Text dimColor>
{"→ "}
{verdict3}
</Text>
</Box>
<Box marginTop={1}>
<Client module="./editor.tsx" />
</Box>
<Box borderStyle="single" paddingX={1} marginTop={1}>
<Text wrap="wrap">
{drafted}
</Text>
</Box>
<Input label="line" placeholder="i to type · enter adds the line · enter on an empty line sends" submitLabel="add" />
<Box flexDirection="row" columnGap={2} marginTop={1}>
<Button label="single choice" hotkey="m" plain />
<Button label={`send ${length} picked (or enter)`} hotkey="g" plain />
<Button label="type" hotkey="i" plain />
<Button label="dismiss" hotkey="d" plain />
<Button label="run" hotkey="r" plain />
<Button label="cancel" hotkey="e" plain />
<Button label="break up" hotkey="b" plain />
<Button label="close" hotkey="x" plain />
<Button label="poke" hotkey="p" plain />
</Box>
</Box>
</Box>
<Box flexDirection="column">
<Box flexDirection="row" columnGap={2}>
<Button label={`▸ ${key}`} plain />
<Text color="white">
{act2}
</Text>
<Text wrap="truncate-end">
{`${word} `}
{firstLine5}
</Text>
</Box>
<Box flexDirection="column" borderStyle="round" paddingX={1}>
<Text bold wrap="wrap">
{reflow2}
</Text>
<Text dimColor>
{filter2}
</Text>
<Box marginTop={1} flexDirection="column">
<Box marginTop={0}>
<Text dimColor wrap="wrap">
{para4}
</Text>
</Box>
<Box marginTop={0}>
<Text dimColor wrap="wrap">
{para5}
</Text>
</Box>
<Box marginTop={0}>
<Text dimColor wrap="wrap">
{para6}
</Text>
</Box>
</Box>
<Text color="yellow">
waiting on a rewrite
{`: ${firstLine}`}
</Text>
<Box flexDirection="column" marginTop={1}>
<Box flexDirection="column">
<Box flexDirection="row" columnGap={2}>
<Button label={`✓ ${label}`} hotkey={`${confirmKey}`} plain variant="primary" />
<Text color="yellow">
recommended
</Text>
<Text color="blue">
chosen
</Text>
<Text dimColor wrap="wrap">
{lines4}
</Text>
</Box>
<Text dimColor>
{" "}
{firstLine6}
</Text>
<Text color="green" wrap="wrap">
{" ✓ "}
{l13}
</Text>
<Text color="green" wrap="wrap">
{" ✓ "}
{l14}
</Text>
<Text color="green" wrap="wrap">
{" ✓ "}
{l15}
</Text>
</Box>
<Box flexDirection="column">
<Box flexDirection="row" columnGap={2}>
<Button label={`✓ ${label}`} hotkey={`${confirmKey}`} plain variant="primary" />
<Text color="yellow">
recommended
</Text>
<Text color="blue">
chosen
</Text>
<Text dimColor wrap="wrap">
{lines5}
</Text>
</Box>
<Text dimColor>
{" "}
{firstLine7}
</Text>
<Text color="green" wrap="wrap">
{" ✓ "}
{l16}
</Text>
<Text color="green" wrap="wrap">
{" ✓ "}
{l17}
</Text>
<Text color="green" wrap="wrap">
{" ✓ "}
{l18}
</Text>
</Box>
<Box flexDirection="column">
<Box flexDirection="row" columnGap={2}>
<Button label={`✓ ${label}`} hotkey={`${confirmKey}`} plain variant="primary" />
<Text color="yellow">
recommended
</Text>
<Text color="blue">
chosen
</Text>
<Text dimColor wrap="wrap">
{lines6}
</Text>
</Box>
<Text dimColor>
{" "}
{firstLine8}
</Text>
<Text color="green" wrap="wrap">
{" ✓ "}
{l19}
</Text>
<Text color="green" wrap="wrap">
{" ✓ "}
{l20}
</Text>
<Text color="green" wrap="wrap">
{" ✓ "}
{l21}
</Text>
</Box>
</Box>
<Text color="yellow">
{"recommend "}
{rec2}
{" "}
{" "}
{` — ${recommend_why}`}
</Text>
<Box flexDirection="column" marginTop={1}>
<Button label={`[x] ${text}`} hotkey={`${n}`} plain />
<Button label={`[x] ${text}`} hotkey={`${n}`} plain />
<Button label={`[x] ${text}`} hotkey={`${n}`} plain />
</Box>
<Box flexDirection="column" marginTop={1}>
<Text>
{"look at "}
<Text dimColor>
{look_at2}
</Text>
</Text>
<Text>
{"run "}
<Text color="cyan">
{run_cmd2}
</Text>
</Text>
<Text>
{"pass "}
<Text color="green">
{pass_when2}
</Text>
</Text>
<Text>
{"fail "}
<Text color="red">
{fail_when2}
</Text>
</Text>
<Text>
{"then "}
<Text dimColor>
{then_do2}
</Text>
</Text>
</Box>
<Box flexDirection="column" marginTop={1}>
<Text color="green">
{"exit "}
{exit2}
</Text>
<Text dimColor>
{l22}
</Text>
<Text dimColor>
{l23}
</Text>
<Text dimColor>
{l24}
</Text>
</Box>
<Box flexDirection="column" marginTop={1}>
<Box flexDirection="column">
<Box flexDirection="row" columnGap={2}>
<Button label="view" hotkey="f" plain />
<Button label="hide" hotkey="o" plain />
<Text dimColor>
{f4}
</Text>
</Box>
<Text dimColor>
{shown4}
</Text>
</Box>
<Box flexDirection="column">
<Box flexDirection="row" columnGap={2}>
<Button label="view" hotkey="f" plain />
<Button label="hide" hotkey="o" plain />
<Text dimColor>
{f5}
</Text>
</Box>
<Text dimColor>
{shown5}
</Text>
</Box>
<Box flexDirection="column">
<Box flexDirection="row" columnGap={2}>
<Button label="view" hotkey="f" plain />
<Button label="hide" hotkey="o" plain />
<Text dimColor>
{f6}
</Text>
</Box>
<Text dimColor>
{shown6}
</Text>
</Box>
</Box>
<Box flexDirection="column" marginTop={1}>
<Text dimColor>
{"→ "}
{verdict4}
</Text>
<Text dimColor>
{"→ "}
{verdict5}
</Text>
<Text dimColor>
{"→ "}
{verdict6}
</Text>
</Box>
<Box marginTop={1}>
<Client module="./editor.tsx" />
</Box>
<Box borderStyle="single" paddingX={1} marginTop={1}>
<Text wrap="wrap">
{drafted2}
</Text>
</Box>
<Input label="line" placeholder="i to type · enter adds the line · enter on an empty line sends" submitLabel="add" />
<Box flexDirection="row" columnGap={2} marginTop={1}>
<Button label="single choice" hotkey="m" plain />
<Button label={`send ${length} picked (or enter)`} hotkey="g" plain />
<Button label="type" hotkey="i" plain />
<Button label="dismiss" hotkey="d" plain />
<Button label="run" hotkey="r" plain />
<Button label="cancel" hotkey="e" plain />
<Button label="break up" hotkey="b" plain />
<Button label="close" hotkey="x" plain />
<Button label="poke" hotkey="p" plain />
</Box>
</Box>
</Box>
<Box flexDirection="column">
<Box flexDirection="row" columnGap={2}>
<Button label={`▸ ${key}`} plain />
<Text color="white">
{act3}
</Text>
<Text wrap="truncate-end">
{`${word} `}
{firstLine9}
</Text>
</Box>
<Box flexDirection="column" borderStyle="round" paddingX={1}>
<Text bold wrap="wrap">
{reflow3}
</Text>
<Text dimColor>
{filter3}
</Text>
<Box marginTop={1} flexDirection="column">
<Box marginTop={0}>
<Text dimColor wrap="wrap">
{para7}
</Text>
</Box>
<Box marginTop={0}>
<Text dimColor wrap="wrap">
{para8}
</Text>
</Box>
<Box marginTop={0}>
<Text dimColor wrap="wrap">
{para9}
</Text>
</Box>
</Box>
<Text color="yellow">
waiting on a rewrite
{`: ${firstLine}`}
</Text>
<Box flexDirection="column" marginTop={1}>
<Box flexDirection="column">
<Box flexDirection="row" columnGap={2}>
<Button label={`✓ ${label}`} hotkey={`${confirmKey}`} plain variant="primary" />
<Text color="yellow">
recommended
</Text>
<Text color="blue">
chosen
</Text>
<Text dimColor wrap="wrap">
{lines7}
</Text>
</Box>
<Text dimColor>
{" "}
{firstLine10}
</Text>
<Text color="green" wrap="wrap">
{" ✓ "}
{l25}
</Text>
<Text color="green" wrap="wrap">
{" ✓ "}
{l26}
</Text>
<Text color="green" wrap="wrap">
{" ✓ "}
{l27}
</Text>
</Box>
<Box flexDirection="column">
<Box flexDirection="row" columnGap={2}>
<Button label={`✓ ${label}`} hotkey={`${confirmKey}`} plain variant="primary" />
<Text color="yellow">
recommended
</Text>
<Text color="blue">
chosen
</Text>
<Text dimColor wrap="wrap">
{lines8}
</Text>
</Box>
<Text dimColor>
{" "}
{firstLine11}
</Text>
<Text color="green" wrap="wrap">
{" ✓ "}
{l28}
</Text>
<Text color="green" wrap="wrap">
{" ✓ "}
{l29}
</Text>
<Text color="green" wrap="wrap">
{" ✓ "}
{l30}
</Text>
</Box>
<Box flexDirection="column">
<Box flexDirection="row" columnGap={2}>
<Button label={`✓ ${label}`} hotkey={`${confirmKey}`} plain variant="primary" />
<Text color="yellow">
recommended
</Text>
<Text color="blue">
chosen
</Text>
<Text dimColor wrap="wrap">
{lines9}
</Text>
</Box>
<Text dimColor>
{" "}
{firstLine12}
</Text>
<Text color="green" wrap="wrap">
{" ✓ "}
{l31}
</Text>
<Text color="green" wrap="wrap">
{" ✓ "}
{l32}
</Text>
<Text color="green" wrap="wrap">
{" ✓ "}
{l33}
</Text>
</Box>
</Box>
<Text color="yellow">
{"recommend "}
{rec3}
{" "}
{" "}
{` — ${recommend_why}`}
</Text>
<Box flexDirection="column" marginTop={1}>
<Button label={`[x] ${text}`} hotkey={`${n}`} plain />
<Button label={`[x] ${text}`} hotkey={`${n}`} plain />
<Button label={`[x] ${text}`} hotkey={`${n}`} plain />
</Box>
<Box flexDirection="column" marginTop={1}>
<Text>
{"look at "}
<Text dimColor>
{look_at3}
</Text>
</Text>
<Text>
{"run "}
<Text color="cyan">
{run_cmd3}
</Text>
</Text>
<Text>
{"pass "}
<Text color="green">
{pass_when3}
</Text>
</Text>
<Text>
{"fail "}
<Text color="red">
{fail_when3}
</Text>
</Text>
<Text>
{"then "}
<Text dimColor>
{then_do3}
</Text>
</Text>
</Box>
<Box flexDirection="column" marginTop={1}>
<Text color="green">
{"exit "}
{exit3}
</Text>
<Text dimColor>
{l34}
</Text>
<Text dimColor>
{l35}
</Text>
<Text dimColor>
{l36}
</Text>
</Box>
<Box flexDirection="column" marginTop={1}>
<Box flexDirection="column">
<Box flexDirection="row" columnGap={2}>
<Button label="view" hotkey="f" plain />
<Button label="hide" hotkey="o" plain />
<Text dimColor>
{f7}
</Text>
</Box>
<Text dimColor>
{shown7}
</Text>
</Box>
<Box flexDirection="column">
<Box flexDirection="row" columnGap={2}>
<Button label="view" hotkey="f" plain />
<Button label="hide" hotkey="o" plain />
<Text dimColor>
{f8}
</Text>
</Box>
<Text dimColor>
{shown8}
</Text>
</Box>
<Box flexDirection="column">
<Box flexDirection="row" columnGap={2}>
<Button label="view" hotkey="f" plain />
<Button label="hide" hotkey="o" plain />
<Text dimColor>
{f9}
</Text>
</Box>
<Text dimColor>
{shown9}
</Text>
</Box>
</Box>
<Box flexDirection="column" marginTop={1}>
<Text dimColor>
{"→ "}
{verdict7}
</Text>
<Text dimColor>
{"→ "}
{verdict8}
</Text>
<Text dimColor>
{"→ "}
{verdict9}
</Text>
</Box>
<Box marginTop={1}>
<Client module="./editor.tsx" />
</Box>
<Box borderStyle="single" paddingX={1} marginTop={1}>
<Text wrap="wrap">
{drafted3}
</Text>
</Box>
<Input label="line" placeholder="i to type · enter adds the line · enter on an empty line sends" submitLabel="add" />
<Box flexDirection="row" columnGap={2} marginTop={1}>
<Button label="single choice" hotkey="m" plain />
<Button label={`send ${length} picked (or enter)`} hotkey="g" plain />
<Button label="type" hotkey="i" plain />
<Button label="dismiss" hotkey="d" plain />
<Button label="run" hotkey="r" plain />
<Button label="cancel" hotkey="e" plain />
<Button label="break up" hotkey="b" plain />
<Button label="close" hotkey="x" plain />
<Button label="poke" hotkey="p" plain />
</Box>
</Box>
</Box>
</Box>
)
})
on('session.start', async ($, e, next) => {
const key = '…'
const firstLine = '…'
await $.ui.toast(`cactus ${key}: ${firstLine}`)
await $.ui.toast(`cactus ${key}: answer withdrawn`)
return next(e)
})
}
Mod 自身のコード
Mod のライセンス(MIT)に従って載せています。全文は下にあります。写すときは著作権表示を残してください。
mods/cactus-pane/hooks/register.tsx 523〜682 行 · ペイン
on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
const els = $.ui.resolve(e)
const { Box, Text, Button } = els
const Input = 'Input' in els ? els.Input : undefined
const Client = 'Client' in els ? els.Client : undefined
const list = await read($, rows)
const picked = await read($, picks)
const failed = await read($, error)
const shown = await read($, previews)
const wanted = await read($, selected)
const stack = await read($, undo)
const modeOf = await read($, modes)
const flipped = await read($, flips)
const editingKey = await read($, editing)
const drafted = await read($, drafts)
const current = list.find(r => r.key === wanted) ?? list[0]
const card = (row: Row) => {
// m turns a single-choice row into pick-several for this one answer.
const canFlip = row.kind === 'choice' && row.act !== 'data' && row.act !== 'run' && row.choices.length > 1
const isFlipped = canFlip && flipped[row.key] === true
const isMulti = row.kind === 'multi' || isFlipped
const isConfirm = row.kind === 'confirm'
const isData = row.act === 'data'
const isPlan = row.act === 'plan'
const isRunAct = row.act === 'run'
const isElaborate = row.status === 'elaborate'
const isHinting = modeOf[row.key] === 'elaborate'
const canRun = isRunAct || Boolean(row.review?.run_cmd)
const hasInput =
Input !== undefined && (row.allow_free || isMulti || PERSISTENT.has(row.act) || isHinting) && !isData
const rec = row.recommend ?? []
// A multi row starts with its recommended set ticked, as the TUI does.
const mine = picked[row.key] ?? (isMulti ? rec : [])
const inputLabel = isHinting ? 'hint' : isMulti ? 'note' : PERSISTENT.has(row.act) ? 'verdict' : 'answer'
const owner = row.agent ? ['--agent', row.agent] : []
const pick = (label: string, surface: typeof e.surface) => {
if (isData) {
const body = row.choices.find(c => c.label === label)?.description ?? ''
void $.ui.copy({ text: body, surface })
void answerRow($, row.key, ['-s', label])
} else if (isMulti) {
// Park the ring on send so the next Enter submits the picks.
void toggle($, row.key, label, rec).then(() =>
$.ui.focus({ requestId: PANE, key: `${row.key}:send` }).catch(() => undefined),
)
} else if (isRunAct && label === 'approve') {
void runRow($, row.key, true)
} else {
void answerRow($, row.key, ['-s', label])
}
}
const confirmKey = (i: number) => (i === 0 ? 'y' : 'n')
return (
<Box key={`${row.key}:card`} flexDirection="column" borderStyle="round" paddingX={1}>
<Text bold wrap="wrap">{reflow(row.text)}</Text>
<Text dimColor>
{[
row.thread ? `thread ${row.thread}` : null,
row.agent ? `agent ${row.agent.slice(0, 8)}` : null,
row.blocked ? 'blocking' : null,
row.status === 'open' ? null : row.status,
row.files.length > 0 ? `${row.files.length} file(s)` : null,
]
.filter(Boolean)
.join(' · ')}
</Text>
{row.context && (
<Box marginTop={1} flexDirection="column">
{reflow(row.context).split('\n\n').map((para, j) => (
<Box key={String(j)} marginTop={j === 0 ? 0 : 1}>
<Text dimColor wrap="wrap">{para}</Text>
</Box>
))}
</Box>
)}
{isElaborate && (
<Text color="yellow">
waiting on a rewrite{row.elaborate ? `: ${firstLine(row.elaborate)}` : ''}
</Text>
)}
{row.choices.length > 0 && (
<Box flexDirection="column" marginTop={1}>
{row.choices.map((c, i) => {
const lines = (isData ? c.description ?? '' : reflow(c.description)).split('\n')
const isPicked = mine.includes(c.label)
return (
<Box key={`${row.key}:c${i}`} flexDirection="column">
<Box flexDirection="row" columnGap={2}>
<Button
key={`${row.key}:${c.label}`}
label={`${isPicked ? '✓ ' : ''}${c.label}`}
hotkey={isConfirm && i < 2 ? confirmKey(i) : i < 9 ? String(i + 1) : undefined}
plain
variant={rec.includes(c.label) ? 'primary' : undefined}
onPress={press => pick(c.label, press.surface)}
/>
{rec.includes(c.label) && <Text color="yellow">recommended</Text>}
{row.chosen === c.label && <Text color="blue">chosen</Text>}
{!isData && lines[0] && <Text dimColor wrap="wrap">{lines[0]}</Text>}
</Box>
{isData && <Text dimColor> {firstLine(c.description)}</Text>}
{!isData &&
lines.slice(1).map((l, j) =>
l.startsWith('+ ') ? (
<Text key={String(j)} color="green" wrap="wrap"> ✓ {l.slice(2)}</Text>
) : l.startsWith('- ') ? (
<Text key={String(j)} color="red" wrap="wrap"> ✗ {l.slice(2)}</Text>
) : (
<Text key={String(j)} dimColor wrap="wrap"> {l}</Text>
),
)}
</Box>
)
})}
</Box>
)}
{rec.length > 0 && (
<Text color="yellow">
recommend {rec.join(', ')} {CONFIDENCE[row.confidence ?? ''] ?? ''} {row.confidence ?? ''}
{row.recommend_why ? ` — ${row.recommend_why}` : ''}
</Text>
)}
{isPlan && row.steps.length > 0 && (
<Box flexDirection="column" marginTop={1}>
{row.steps.map(s => (
<Button
key={`${row.key}:step${s.n}`}
label={`[${s.done ? 'x' : ' '}] ${s.text}`}
hotkey={s.n <= 9 ? String(s.n) : undefined}
plain
onPress={() =>
void cactus($, row.key, ['plan', row.key, s.done ? '--undone' : '--done', String(s.n)])
}
/>
))}
</Box>
)}
{row.review && (
<Box flexDirection="column" marginTop={1}>
{row.review.look_at && <Text>look at <Text dimColor>{row.review.look_at}</Text></Text>}
{row.review.run_cmd && <Text>run <Text color="cyan">{row.review.run_cmd}</Text></Text>}
{row.review.pass_when && <Text>pass <Text color="green">{row.review.pass_when}</Text></Text>}
{row.review.fail_when && <Text>fail <Text color="red">{row.review.fail_when}</Text></Text>}
{row.review.then_do && <Text>then <Text dimColor>{row.review.then_do}</Text></Text>}
</Box>
)}
{row.result && (
<Box flexDirection="column" marginTop={1}>
<Text color={row.result.exit === 0 ? 'green' : 'red'}>exit {String(row.result.exit)}</Text>
{row.result.tail.slice(-8).map((l, j) => (
<Text key={String(j)} dimColor>{l}</Text>
))}
</Box>ライセンスの全文(MIT)
MIT License Copyright (c) 2026 eighteyes 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 に読んだコミット d8c80e0fd3f2 のソースから。最初のまとまりが載せる条件で、残りは自分で判断するための材料です。後のコミットは、次に読むまで見ていません。
| 載せる条件: 確かめやすいコード | |
|---|---|
| 入口を読んだ | hooks/hooks.json が名指すモジュールをすべて読んだ。mods/cactus-pane/hooks/register.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/… などは無い)。mods/cactus-pane/hooks/register.tsx:429 head(Windows にない); mods/cactus-pane/hooks/register.tsx:695 open(Windows にない) |
| 通信 | fetch の送り先(https のホスト)がコードに書いてあるか。通信なし |
| プログラム | 起動するプログラムの名前がコードに書いてあり、シェル・インタプリタ・通信用の道具でないか。cactus, git(通信する), head, open(通信する) |
| 読んで送る | ファイルや環境変数を読み、かつ通信するか。通信するが、ファイルも環境変数も読まない |
| ソースの鍵 | ソースに API キーや秘密鍵らしきものがあるか。ソースに鍵なし |
| ライセンス | オープンなライセンス(MIT・Apache-2.0・BSD・ISC・Unlicense・0BSD・CC0)で全文があれば、modscode にコードを載せる。違えばリンクだけ。MIT |
コードの文面を読んだだけで、安全の審査ではありません。動かしてはおらず、起動するプログラムの中で何が起きるかも見えません。入れる前の確認はあなたの役目です。 載せる条件
入れる
入れる前に、必ず自分で確かめてください。Mod はサンドボックスなしで、あなたの権限で動きます。modscode はこのコードの安全を保証しません。下のコードを読み(またはフォルダーで claude plugin validate .)、触るものを見て、読んだコミットを入れてください。
リポジトリの .claude-plugin/marketplace.json にこの Mod が載っていないため、入れる手順は出せません。コードとして読むか、作者の README に従ってください。
Claude に聞く
modscode のコネクタを入れると、Claude がこのデザイン・コードが触るもの・コードを読んで、それをもとに作れます。たとえば:
modscode のデザイン「eighteyes-cactus-pane」をコードごと読んで、同じようなペインを作って似たデザイン
-
Claude に頼む…./rows.tsx●●●●●×./rows.tsxnothing loaded yet● Fix login● Fix login● Fix login● Fix login● Fix login● Fix login● Fix login● Fix login● Fix login./rows.tsxWorkspaceWorkspaceWorkspaceselected: build● open in Databricks
-
Claude に頼む…build 3 app●●●◉●●okno Library app here yet; Library adds one●./rows.tsx./rows.tsxselected: Nerd
-
Claude に頼む…Fix loginRead↑⌂↻◉Σ⊟⊘± no git repo · git status starts after git init⑂ build ↑Darwin ↓LibraryEdit+Edit -EditBashBashBash clean/ Bash jump×./rows.tsxselected: Read● build… a1b2c3d
-
Claude に頼む…FilesEXPLORER‹ BackForward ›↑ Up Enter⏎⌫buildbuildbuild💾■ build ⎇ main · chosen(not loaded) · dockedbuildbuildbuildbuildbuildbuildbuildbuildbuildbuildbuildbuild↑ k↓ j← h→ l⏎ oFind files1–Find files3 of 3 · Invalid changed
-
Claude に頼む…────────Clear doneClaude⋯└─ buildCancelCancelCancel└─ buildCancelCancelCancel└─ buildCancelCancelCancel
-
Claude に頼む…Trajectorytrajectory · OFF · Opus · every Trajectory steps · sees chat 2 · Template covered ·nowbackfillclearsettingsclosebackfill · rebuild the phases with Opus, every Trajectory steps (both in settings)whole conversationlast 40 stepslast 100 stepscancel#3steps Template–Settings · 14:32 · amended 14:32 · Opus · 3 dec · 3 btw✕▾ Fix loginSettingsdecisions• Template ↳ Settings• Template ↳ Settings• Template ↳ Settingsstepsbtw#3steps Template–Settings · 14:32 · amended 14:32 · Opus · 3 dec · 3 btw✕▾ Fix loginSettingsdecisions• Template ↳ Settings• Template ↳ Settings• Template ↳ Settingsstepsbtw#3steps Template–Settings · 14:32 · amended 14:32 · Opus · 3 dec · 3 btw✕▾ Fix loginSettingsdecisions• Template ↳ Settings• Template ↳ Settings• Template ↳ Settingsstepsbtw