cutroom
Cutroom: a cutting-room pane for HyperFrames projects inside Claude Code — frame preview, timeline, trim/split/move/delete/undo, Studio selection bridge, and point-and-ask edits sent to Claude.
何をするか
- 欄・トーストを描く
- /cut を足す
- prompt.submit・session.start・turn.complete・ui.closeにフックする
- ターンをまたいで自分の状態を持つ
- ネットワークに出る
良いところ
- TypeScript で書かれている
- デスクトップ専用の分岐がある
- エラーを扱う
作り始めるためのコード
2 種類あります。上のデザインから modscode が書いた雛形と、その Mod 自身のコードのうち描いている部分です。
雛形(register.tsx)
import type { Register } from 'claude-code'
// Drawn like cutroom by leepokai (pane, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/leepokai-cutroom/
// 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: "Cutroom" })
on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
const { Box, Text, Button, Link, Input } = $.ui.resolve(e)
const base = '…'
const fmt = '…'
const studioUrl = '…'
const fmt2 = '…'
const where = '…'
const length = '…'
const msg = '…'
const kind = '…'
const id = '…'
const bar = '…'
const fmt3 = '…'
const fmt4 = '…'
const bar2 = '…'
const fmt5 = '…'
const fmt6 = '…'
const bar3 = '…'
const fmt7 = '…'
const fmt8 = '…'
const kind2 = '…'
const bar4 = '…'
const fmt9 = '…'
const fmt10 = '…'
const bar5 = '…'
const fmt11 = '…'
const fmt12 = '…'
const bar6 = '…'
const fmt13 = '…'
const fmt14 = '…'
const kind3 = '…'
const bar7 = '…'
const fmt15 = '…'
const fmt16 = '…'
const bar8 = '…'
const fmt17 = '…'
const fmt18 = '…'
const bar9 = '…'
const fmt19 = '…'
const fmt20 = '…'
return (
<Box flexDirection="column">
<Box gap={1}>
<Text bold>
{base}
</Text>
<Text dimColor>
{"· "}
{fmt}
{"s · Studio "}
●
</Text>
<Button plain hotkey="g" label="[open Studio ↗]" />
<Link href={`${studioUrl}`} label={`${studioUrl}`} />
</Box>
<Box gap={1}>
<Button plain hotkey="p" label="■" />
<Button plain hotkey="a" label="|◀" />
<Button plain hotkey="j" label="-1s" />
<Button plain hotkey="h" label="-.1" />
<Text bold>
{" "}
{fmt2}
{"s "}
</Text>
<Button plain hotkey="l" label="+.1" />
<Button plain hotkey="k" label="+1s" />
<Button plain hotkey="f" label="▶|" />
<Button plain hotkey="r" label="⟳" />
<Input placeholder="t=" submitLabel="seek" />
</Box>
<Text dimColor>
{where}
</Text>
<Box gap={1} flexWrap="wrap">
<Button hotkey="i" label="Trim in→┃" />
<Button hotkey="o" label="┃←Trim out" />
<Button hotkey="s" label="Split @┃" />
<Button hotkey="m" label="Move→┃" />
<Button hotkey="d" label="Duplicate" />
<Button hotkey="x" label="Delete" />
<Button hotkey="u" label={`Undo (${length})`} />
<Button hotkey="c" label="Check" />
<Button hotkey="v" label="Render draft" />
<Button hotkey="z" label="Reload" />
<Button plain hotkey="t" label="prompt context: on" />
</Box>
<Input label="Ask Claude ›" placeholder="change what? e.g. 把這段標題放大、進場再慢一點 (or just type in the main prompt)" submitLabel="send" />
<Text dimColor>
{msg}
</Text>
<Box flexDirection="column">
<Box flexDirection="column">
<Text dimColor>
{kind}
</Text>
<Box>
<Text>
▸
</Text>
<Button plain label={`${id}`} />
<Text>
{" "}
{bar}
{" "}
</Text>
<Text dimColor>
{fmt3}
–
{fmt4}
</Text>
</Box>
<Box>
<Text>
▸
</Text>
<Button plain label={`${id}`} />
<Text>
{" "}
{bar2}
{" "}
</Text>
<Text dimColor>
{fmt5}
–
{fmt6}
</Text>
</Box>
<Box>
<Text>
▸
</Text>
<Button plain label={`${id}`} />
<Text>
{" "}
{bar3}
{" "}
</Text>
<Text dimColor>
{fmt7}
–
{fmt8}
</Text>
</Box>
</Box>
<Box flexDirection="column">
<Text dimColor>
{kind2}
</Text>
<Box>
<Text>
▸
</Text>
<Button plain label={`${id}`} />
<Text>
{" "}
{bar4}
{" "}
</Text>
<Text dimColor>
{fmt9}
–
{fmt10}
</Text>
</Box>
<Box>
<Text>
▸
</Text>
<Button plain label={`${id}`} />
<Text>
{" "}
{bar5}
{" "}
</Text>
<Text dimColor>
{fmt11}
–
{fmt12}
</Text>
</Box>
<Box>
<Text>
▸
</Text>
<Button plain label={`${id}`} />
<Text>
{" "}
{bar6}
{" "}
</Text>
<Text dimColor>
{fmt13}
–
{fmt14}
</Text>
</Box>
</Box>
<Box flexDirection="column">
<Text dimColor>
{kind3}
</Text>
<Box>
<Text>
▸
</Text>
<Button plain label={`${id}`} />
<Text>
{" "}
{bar7}
{" "}
</Text>
<Text dimColor>
{fmt15}
–
{fmt16}
</Text>
</Box>
<Box>
<Text>
▸
</Text>
<Button plain label={`${id}`} />
<Text>
{" "}
{bar8}
{" "}
</Text>
<Text dimColor>
{fmt17}
–
{fmt18}
</Text>
</Box>
<Box>
<Text>
▸
</Text>
<Button plain label={`${id}`} />
<Text>
{" "}
{bar9}
{" "}
</Text>
<Text dimColor>
{fmt19}
–
{fmt20}
</Text>
</Box>
</Box>
</Box>
</Box>
)
})
on('session.start', async ($, e, next) => {
const out = '…'
await $.ui.toast(`Cutroom: draft rendered → ${out}`)
return next(e)
})
}
Mod 自身のコード
Mod のライセンス(MIT)に従って載せています。全文は下にあります。写すときは著作権表示を残してください。
hooks/register.tsx 626〜785 行 · ペイン
on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
if (e.surface === 'mobile') {
const { Box, Text } = $.ui.resolve(e)
return (
<Box>
<Text dimColor>Cutroom needs the terminal or desktop surface.</Text>
</Box>
)
}
const { Box, Text, Button, Input, Link } = $.ui.resolve(e)
const width = Math.max(48, e.props.bodyColumns - 1)
const [dir, tl, selId, t, pv, srv, sel, msg, job, rc, cands, ctxOn, isPlaying] = await Promise.all([
read($, project),
read($, timeline),
read($, selected),
read($, playhead),
read($, preview),
read($, studio),
read($, selection),
read($, status),
read($, busy),
read($, receipts),
read($, candidates),
read($, autoContext),
read($, playing),
])
if (!dir) {
return (
<Box flexDirection="column" gap={1}>
<Text bold>Cutroom</Text>
{cands.length > 0 ? (
<Text dimColor>Pick a project:</Text>
) : (
<Text dimColor>No HyperFrames project under this directory. Run /cut <project-dir>.</Text>
)}
{cands.map((c, i) => (
<Button
key={`cand:${c}`}
plain
{...(i < 9 ? { hotkey: String(i + 1) } : {})}
label={c}
onPress={() => void openProject($, c, true)}
/>
))}
{msg !== '' && <Text dimColor>{msg}</Text>}
</Box>
)
}
const clips = tl?.clips ?? []
const clip = clips.find(c => c.id === selId)
const duration = tl?.duration ?? 0
// the frame: kitty pixels, half-block cells, or an Svg on the desktop
let frame: JSX.Element
if (!pv || !pv.rgb) {
frame = <Text dimColor>{job || 'no frame yet — press ⟳ (r)'}</Text>
} else if (e.surface === 'terminal') {
const inline = e.props.placement === 'inline'
if (hasPixels) {
const { Image } = $.ui.resolve(e)
const b64 = await cachedBase64($, pv.png, pv.gen)
const { width: w, height: h } = pngSize(b64)
const maxRows = inline ? 10 : 30
const cols = Math.max(8, Math.min(255, width - 2, Math.round((maxRows * 2.1 * w) / h)))
const rows = Math.max(2, Math.min(255, Math.round((cols * h) / w / 2.1)))
frame = <Image key="frame" source={{ png: b64 }} columns={cols} rows={rows} alt={`frame @ ${fmt(pv.at)}s → ${pv.png}`} />
} else {
const { Raster } = $.ui.resolve(e)
const bytes = fromB64(await cachedBase64($, pv.rgb, pv.gen))
const srcW = pv.rgbW
const srcH = Math.floor(bytes.length / (srcW * 3))
if (srcH < 2) {
frame = <Text dimColor>frame @ {fmt(pv.at)}s → {pv.png}</Text>
} else {
const maxRows = inline ? 10 : 28
const cols = Math.max(8, Math.min(width - 2, 512, Math.round((maxRows * 2 * srcW) / srcH)))
const rows = Math.max(1, Math.min(256, Math.round((cols * srcH) / srcW / 2)))
frame = <Raster key="frame" columns={cols} rows={rows} cells={rasterCells(bytes, srcW, srcH, cols, rows)} />
}
}
} else {
const { Svg } = $.ui.resolve(e)
const b64 = await cachedBase64($, pv.jpg, pv.gen)
const png = await cachedBase64($, pv.png, pv.gen)
const { width: w0, height: h0 } = pngSize(png)
const w = 480
const h = Math.max(1, Math.round((w * h0) / w0))
frame = (
<Svg
source={`<svg xmlns="http://www.w3.org/2000/svg" width="${w}" height="${h}" viewBox="0 0 ${w} ${h}"><image href="data:image/jpeg;base64,${b64}" width="${w}" height="${h}"/></svg>`}
alt={`frame @ ${fmt(pv.at)}s`}
width={w}
height={h}
/>
)
}
// compact clip list, grouped by track kind
const kinds = [...TRACK_ORDER.filter(k => clips.some(c => c.trackKind === k)), ...clips.map(c => c.trackKind).filter(k => !TRACK_ORDER.includes(k))].filter(
(k, i, all) => all.indexOf(k) === i,
)
const barW = Math.max(10, width - 36)
let n = 0
const rows = kinds.map(kind => (
<Box flexDirection="column">
<Text dimColor>{kind}</Text>
{clips
.filter(c => c.trackKind === kind)
.map(c => {
const i = n++
const isSel = c.id === selId
return (
<Box>
<Text bold={isSel}>{isSel ? '▸' : ' '}</Text>
<Button
key={`clip:${c.id}`}
plain
dimColor={!isSel}
{...(i < 9 ? { hotkey: String(i + 1) } : {})}
label={pad(c.id, 15)}
onPress={() => void selectClip($, dir, c)}
/>
<Text dimColor={!isSel}> {bar(barW, duration, c.absStart, c.absEnd, t)} </Text>
<Text dimColor>
{fmt(c.absStart)}–{fmt(c.absEnd)}
</Text>
</Box>
)
})}
</Box>
))
const go = (to: number) => () => void seek($, dir, to)
const op = (label: string, args: (clip: HfClip, t: number) => string[] | string) => () =>
void withClip($, async (c, at) => {
const a = args(c, at)
if (typeof a === 'string') {
await say($, a)
return
}
await edit($, dir, label, a)
})
const where = sel
? `Studio: ${sel.label ?? sel.id ?? sel.selector ?? '?'}${sel.file ? ` · ${sel.file}` : ''}${clip && clip.id !== sel.id ? ` · in clip ${clip.id}` : ''}`
: clip
? `clip ${clip.id} · ${fmt(clip.absStart)}–${fmt(clip.absEnd)}s · ${clip.file}${clip.src ? ` · ${clip.src}` : ''}`
: 'nothing selected — click something in Studio, or a row below'
return (
<Box flexDirection="column">
<Box gap={1}>
<Text bold>{base(dir)}</Text>
<Text dimColor>
· {fmt(duration)}s · Studio {srv ? '●' : '○'}
</Text>
<Button key="studio-open" plain hotkey="g" label={srv ? '[open Studio ↗]' : '[start Studio]'} onPress={() => void ensureStudio($, dir, true)} />
{srv !== null && <Link href={srv.studioUrl} label={srv.studioUrl.replace(/^https?:\/\//, '')} />}ライセンスの全文(MIT)
MIT License Copyright (c) 2026 leepokai 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 に読んだコミット 3757beae6e2d のソースから。最初のまとまりが載せる条件で、残りは自分で判断するための材料です。後のコミットは、次に読むまで見ていません。
| 載せる条件: 確かめやすいコード | |
|---|---|
| 入口を読んだ | hooks/hooks.json が名指すモジュールをすべて読んだ。hooks/register.tsx |
| 解析できる | すべてのファイルが TypeScript か JavaScript として解析できる。1 ファイルを解析 |
| コードが 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/… などは無い)。hooks/register.tsx:187 open(Windows にない); hooks/register.tsx:188 xdg-open(Windows にない); hooks/register.tsx:324 mv(Windows にない) |
| 通信 | fetch の送り先(https のホスト)がコードに書いてあるか。hooks/register.tsx:202 fetch(url) |
| プログラム | 起動するプログラムの名前がコードに書いてあり、シェル・インタプリタ・通信用の道具でないか。hooks/register.tsx:66 実行時に決まるプログラム; hooks/register.tsx:312 curl(通信する) |
| 読んで送る | ファイルや環境変数を読み、かつ通信するか。reads environment variables and files and reaches the network |
| ソースの鍵 | ソースに API キーや秘密鍵らしきものがあるか。ソースに鍵なし |
| ライセンス | オープンなライセンス(MIT・Apache-2.0・BSD・ISC・Unlicense・0BSD・CC0)で全文があれば、modscode にコードを載せる。違えばリンクだけ。MIT |
コードの文面を読んだだけで、安全の審査ではありません。動かしてはおらず、起動するプログラムの中で何が起きるかも見えません。入れる前の確認はあなたの役目です。 載せる条件
入れる
入れる前に、必ず自分で確かめてください。Mod はサンドボックスなしで、あなたの権限で動きます。modscode はこのコードの安全を保証しません。下のコードを読み(またはフォルダーで claude plugin validate .)、触るものを見て、読んだコミットを入れてください。
リポジトリがそのままマーケットプレイスです。このマーケットプレイスを足し(ターミナルでは次のコマンド、デスクトップアプリではプラグインの設定)、そこから Mod を入れます。
/plugin marketplace add leepokai/claude-mod-cutroom/plugin install cutroom@claude-mod-cutroom入るのはマーケットプレイスの最新のコミットで、ここで読んだもの(3757beae6e2d)と違うことがあります。入れる前に見比べてください。
Claude に聞く
modscode のコネクタを入れると、Claude がこのデザイン・コードが触るもの・コードを読んで、それをもとに作れます。たとえば:
modscode のデザイン「leepokai-cutroom」をコードごと読んで、同じようなペインを作って似たデザイン
-
Claude に頼む…Rook♜ R O O Kr · refresh r────────31 · chat 2 31 · chat 2 31 · chat 2Search “Older” on Oldera · all sessions asearch words or a regex, then enter · empty shows the newest searchworking…✓ Services✗ SitesNo session matches that.┌ buildLatest messages────────● Fix login LIVERook “…Handoffs…”● Fix login LIVERook “…Handoffs…”● Fix login LIVERook “…Handoffs…”┌ buildLatest messages────────● Fix login LIVERook “…Handoffs…”● Fix login LIVERook “…Handoffs…”● Fix login LIVERook “…Handoffs…”┌ buildLatest messages────────● Fix login LIVERook “…Handoffs…”● Fix login LIVERook “…Handoffs…”● Fix login LIVERook “…Handoffs…”────────tab / arrows move · enter opens · esc returns to the prompt · ✻ claude ◆ codex
-
何をするか
- プロンプトの上の帯・欄を描く
- ツールの呼び出しを見張る(止めることがある)
- config.describe・session.start・turn.complete・ui.closeにフックする
- ターンをまたいで自分の状態を持つ
-
Claude に頼む…GitHub inboxGitHubloading…Refresh rbuildbuildbuildClose xStealth IssuesNo open issues in this view.#3 Fix login · Pinned notice · 2h 10m · Top row commentsWork on itopen#3 Fix login · Pinned notice · 2h 10m · Top row commentsWork on itopen#3 Fix login · Pinned notice · 2h 10m · Top row commentsWork on itopenPull requestsNo open pull requests.#3 Fix login · main · draft · build · HiddenChecksReviewopen#3 Fix login · main · draft · build · HiddenChecksReviewopen#3 Fix login · main · draft · build · HiddenChecksReviewopenChecks for #3Plain
-
Claude に頼む…ReviewPR #3 Fix loginbranche couranteà traiter ▸3 ▸3 ▸3 · en relecture ▸3 ▸3 ▸3▸◉3 a1b2c3d ↩ répondu obsolète → Claude Review▸◉3 a1b2c3d ↩ répondu obsolète → Claude Review▸◉3 a1b2c3d ↩ répondu obsolète → Claude Review────────fil 31/3 Review ↗ GitHub
Review@alexReview@alexReview@alexReviewRéponse : Review publierEntrée publie · Esc annule la réponse · les touches n, p… tapent dans le champ… ReviewLe panneau n'a pas le clavier : ctrl+x tab ou un clic, et les touches marchent.p préc. n suiv. t PR suiv. x démarquer a tout démarquer f corriger (3) r répondre v résoudre o web q fermer -
Claude に頼む…◉ Subcommands◆ acme/app● Backlog build▲ Backlog build⇄ Backlog build✗ Backlog buildPriorityBacklog 3%◌ syncing… r⚙ Set up build for the board◌ Reading the repo, its project and its issues…Couldn't read what setup needs: Item closed/issues check says what is missing and how to fix it.Projectnone is linked to buildFix login (#3)buildApply will:● Fix login Item closed● Fix login Item closed● Fix login Item closedarea labels to create: Off track updateWhich Status is whichInbox (folds)Inbox (folds)Inbox (folds)In the project's Workflows settings, by hand: · turn on Off track · turn off Inactive: it marks every closed issue Done, even an abandoned one; the board moves issues closed as comp… · new issues arrive with Status Todo, GitHub's default, so they skip the Inbox: open Item added to project and set it…↗ WorkflowsNo issue template has an Acceptance list.◌ Applying…build █████░░░ Off trackbuild █████░░░ Off tracklast 12 weeks✗ Setup needed⋯Fix loginSubcommandsSubcommands↗ example.comFix loginSubcommandsSubcommands↗ example.comFix loginSubcommandsSubcommands↗ example.com
-
Claude に頼む…LensRecently reviewedThis folder is not in a git repository. Pick a repo (its number), or name one: /lens ~/Code/my-repo build EnterThread reopenedbuildbuildacme/app · 2h 10m✕ forgetThread reopenedbuildbuildacme/app · 2h 10m✕ forgetThread reopenedbuildbuildacme/app · 2h 10mbuild Enter✕ forgetThread reopenedbuildbuildacme/app · 2h 10m✕ forgetThread reopenedbuildbuildacme/app · 2h 10m✕ forgetThread reopenedbuildbuildacme/app · 2h 10mbuild Enter✕ forgetThread reopenedbuildbuildacme/app · 2h 10m✕ forgetThread reopenedbuildbuildacme/app · 2h 10m✕ forgetThread reopenedbuildbuildacme/app · 2h 10m✕ forget