your-turn
把最後一則回覆裡要你親手跑的指令(程式碼區塊裡 sudo 開頭的行、! <cmd>、前一句叫你自己跑的 shell 區塊)列成對話旁的清單,每段帶上回覆裡的前一句說明;按數字鍵勾完成、按 y 再按編號複製指令,全部完成後按 r 回報,送出「N/N 完成了」。只整理,不代跑
何をするか
- 欄・トーストを描く
- /your-turn を足す
- session.start・turn.completeにフックする
良いところ
- ネットワークに出ない
- プロセスを起こさない
- 小さい(337 行)
- TypeScript で書かれている
作り始めるためのコード
2 種類あります。上のデザインから modscode が書いた雛形と、その Mod 自身のコードのうち描いている部分です。
雛形(register.tsx)
import type { Register } from 'claude-code'
// Drawn like your-turn by Mango (pane, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/mangow314-your-turn/
// 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: "要你跑的指令" })
on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
const { Box, Text, Button } = $.ui.resolve(e)
const title = '…'
const body = '…'
const i = '…'
const label = '…'
const body2 = '…'
const body3 = '…'
const body4 = '…'
const body5 = '…'
const body6 = '…'
const title2 = '…'
const body7 = '…'
const body8 = '…'
const body9 = '…'
const body10 = '…'
const body11 = '…'
const body12 = '…'
const title3 = '…'
const body13 = '…'
const body14 = '…'
const body15 = '…'
const body16 = '…'
const body17 = '…'
const body18 = '…'
const done = '…'
const length = '…'
const keys = '…'
return (
<Box flexDirection="column">
<Text>
<Text bold>
your-turn
</Text>
<Text color="#928374">
{" 沒有要你跑的指令"}
</Text>
</Text>
<Box flexDirection="column" marginTop={1}>
<Text>
<Text>
╭─
</Text>
<Text bold>
{title}
</Text>
<Text>
────────╮
</Text>
</Text>
<Box flexDirection="row">
<Text>
{"│ "}
</Text>
<Text color="#928374">
{body}
</Text>
<Text>
{" │"}
</Text>
</Box>
<Box flexDirection="row">
<Text>
{"│ "}
</Text>
<Button plain hotkey={`${i}`} label={`${label}`} />
<Text bold>
{" ! "}
</Text>
<Text>
{body2}
</Text>
<Text>
{" │"}
</Text>
</Box>
<Box flexDirection="row">
<Text>
{"│ "}
</Text>
<Text color="#928374">
{body3}
</Text>
<Text>
{" │"}
</Text>
</Box>
<Box flexDirection="row">
<Text>
{"│ "}
</Text>
<Button plain hotkey={`${i}`} label={`${label}`} />
<Text bold>
{" ! "}
</Text>
<Text>
{body4}
</Text>
<Text>
{" │"}
</Text>
</Box>
<Box flexDirection="row">
<Text>
{"│ "}
</Text>
<Text color="#928374">
{body5}
</Text>
<Text>
{" │"}
</Text>
</Box>
<Box flexDirection="row">
<Text>
{"│ "}
</Text>
<Button plain hotkey={`${i}`} label={`${label}`} />
<Text bold>
{" ! "}
</Text>
<Text>
{body6}
</Text>
<Text>
{" │"}
</Text>
</Box>
<Text>
╰────────╯
</Text>
</Box>
<Box flexDirection="column" marginTop={1}>
<Text>
<Text>
╭─
</Text>
<Text bold>
{title2}
</Text>
<Text>
────────╮
</Text>
</Text>
<Box flexDirection="row">
<Text>
{"│ "}
</Text>
<Text color="#928374">
{body7}
</Text>
<Text>
{" │"}
</Text>
</Box>
<Box flexDirection="row">
<Text>
{"│ "}
</Text>
<Button plain hotkey={`${i}`} label={`${label}`} />
<Text bold>
{" ! "}
</Text>
<Text>
{body8}
</Text>
<Text>
{" │"}
</Text>
</Box>
<Box flexDirection="row">
<Text>
{"│ "}
</Text>
<Text color="#928374">
{body9}
</Text>
<Text>
{" │"}
</Text>
</Box>
<Box flexDirection="row">
<Text>
{"│ "}
</Text>
<Button plain hotkey={`${i}`} label={`${label}`} />
<Text bold>
{" ! "}
</Text>
<Text>
{body10}
</Text>
<Text>
{" │"}
</Text>
</Box>
<Box flexDirection="row">
<Text>
{"│ "}
</Text>
<Text color="#928374">
{body11}
</Text>
<Text>
{" │"}
</Text>
</Box>
<Box flexDirection="row">
<Text>
{"│ "}
</Text>
<Button plain hotkey={`${i}`} label={`${label}`} />
<Text bold>
{" ! "}
</Text>
<Text>
{body12}
</Text>
<Text>
{" │"}
</Text>
</Box>
<Text>
╰────────╯
</Text>
</Box>
<Box flexDirection="column" marginTop={1}>
<Text>
<Text>
╭─
</Text>
<Text bold>
{title3}
</Text>
<Text>
────────╮
</Text>
</Text>
<Box flexDirection="row">
<Text>
{"│ "}
</Text>
<Text color="#928374">
{body13}
</Text>
<Text>
{" │"}
</Text>
</Box>
<Box flexDirection="row">
<Text>
{"│ "}
</Text>
<Button plain hotkey={`${i}`} label={`${label}`} />
<Text bold>
{" ! "}
</Text>
<Text>
{body14}
</Text>
<Text>
{" │"}
</Text>
</Box>
<Box flexDirection="row">
<Text>
{"│ "}
</Text>
<Text color="#928374">
{body15}
</Text>
<Text>
{" │"}
</Text>
</Box>
<Box flexDirection="row">
<Text>
{"│ "}
</Text>
<Button plain hotkey={`${i}`} label={`${label}`} />
<Text bold>
{" ! "}
</Text>
<Text>
{body16}
</Text>
<Text>
{" │"}
</Text>
</Box>
<Box flexDirection="row">
<Text>
{"│ "}
</Text>
<Text color="#928374">
{body17}
</Text>
<Text>
{" │"}
</Text>
</Box>
<Box flexDirection="row">
<Text>
{"│ "}
</Text>
<Button plain hotkey={`${i}`} label={`${label}`} />
<Text bold>
{" ! "}
</Text>
<Text>
{body18}
</Text>
<Text>
{" │"}
</Text>
</Box>
<Text>
╰────────╯
</Text>
</Box>
<Box flexDirection="column" marginTop={1}>
<Text>
<Text color="#928374">
{"進度 "}
</Text>
<Text color="#b8bb26">
━━━━━━━━
</Text>
<Text color="#504945">
━━━━━━━━
</Text>
<Text color="#b8bb26">
{` ${done}/${length}`}
</Text>
</Text>
<Box flexDirection="row">
<Text>
{keys}
<Text color="#504945">
{" │ "}
</Text>
</Text>
<Button plain hotkey="y" label="取消複製" />
<Text>
<Text color="#504945">
{" │ "}
</Text>
</Text>
<Button plain hotkey="q" label="關閉" />
</Box>
</Box>
<Button variant="primary" hotkey="r" label={`回報 ${length}/${length} 完成`} />
</Box>
)
})
on('session.start', async ($, e, next) => {
const length = '…'
const i = '…'
await $.ui.toast(`your-turn:${length} 條要你親手跑的指令,終端機太窄沒畫出來,打 /your-turn 打開`)
await $.ui.toast(`your-turn:已複製第 ${i}1 條`)
return next(e)
})
}
Mod 自身のコード
Mod のライセンス(MIT)に従って載せています。全文は下にあります。写すときは著作権表示を残してください。
your-turn/hooks/register.tsx 88〜210 行 · ペイン
on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
const { Box, Button, Text } = $.ui.resolve(e)
const steps = await read($, stepsAtom)
const isYanking = await read($, yankAtom)
// 和 away-receipt 一樣按 q 關;引擎內建的 ctrl+x x 要按兩個鍵。清單空的時候也要有,不然 q 沒作用
const close = <Button key="close" plain hotkey="q" label="關閉" onPress={() => $.ui.close({ id: PANE })} />
// 標題是一般文字,不用色塊
const header = (
<Text>
<Text bold>your-turn</Text>
<Text color={GRAY}>{` ${steps.length === 0 ? '沒有要你跑的指令' : `${steps.length} 條指令待你親手跑`}`}</Text>
</Text>
)
if (steps.length === 0) {
return (
<Box flexDirection="column">
{header}
<Box marginTop={1}>{close}</Box>
</Box>
)
}
const width = e.props.bodyColumns
const room = Math.max(10, width - ROW_FIXED)
const done = steps.filter(s => s.isDone).length
const isAllDone = done === steps.length
// 按鈕只放編號與 ○/✔(按鈕文字不能加刪除線、也不能上色);$/!、指令另用 Text 畫,做完的指令加刪除線。
// 右框線前補空白,讓每列剛好 pane 寬
const row = (s: Step, i: number, color: string, frame: string) => {
const isBang = s.cmd.startsWith('!')
const body = clip(isBang ? s.cmd.slice(1).trimStart() : s.cmd, room)
const mark = s.isDone ? '✔' : '○'
const label = i < MAX_KEYS ? mark : `${i + 1}: ${mark}`
const keyCols = i < MAX_KEYS ? 3 : 0
const pad = Math.max(0, width - 7 - keyCols - cols(label) - cols(body))
const press = (p: UiPressArgument) => (isYanking ? yank($, s.cmd, i, p) : toggle($, i))
return (
<Box key={`row-${i + 1}`} flexDirection="row">
<Text color={frame}>{'│ '}</Text>
{i < MAX_KEYS
? <Button key={`step-${i + 1}`} plain hotkey={String(i + 1)} label={label} dimColor={s.isDone} onPress={press} />
: <Button key={`step-${i + 1}`} plain label={label} dimColor={s.isDone} onPress={press} />}
<Text color={color} bold dimColor={s.isDone}>{isBang ? ' ! ' : ' $ '}</Text>
<Text dimColor={s.isDone} strikethrough={s.isDone}>{body}</Text>
<Text color={frame}>{`${' '.repeat(pad)} │`}</Text>
</Box>
)
}
// 說明行:回覆裡這段指令的前一句,淡灰色、縮排 2 欄,太長截斷
const noteLine = (note: string, i: number, frame: string) => {
const body = clip(note, Math.max(10, width - NOTE_FIXED))
return (
<Box key={`note-${i + 1}`} flexDirection="row">
<Text color={frame}>{'│ '}</Text>
<Text color={GRAY}>{body}</Text>
<Text color={frame}>{`${' '.repeat(Math.max(0, width - NOTE_FIXED - cols(body)))} │`}</Text>
</Box>
)
}
// 照清單順序切框:連續在同一處跑的指令放同一框,換地方跑就開新框,所以同一組可能出現兩個框。
// 每框上方空一行,標題嵌在上框線;框裡還有沒做完的指令時框線用該組顏色
const runs: { g: (typeof GROUPS)[number]; members: { s: Step; i: number }[] }[] = []
steps.forEach((s, i) => {
const g = GROUPS.find(x => x.has(s.cmd)) ?? GROUPS[0]
const last = runs.at(-1)
if (last?.g === g) last.members.push({ s, i })
else runs.push({ g, members: [{ s, i }] })
})
const groups = runs.map(({ g, members }, n) => {
const frame = members.some(m => !m.s.isDone) ? g.color : DARK_GRAY
const title = ` ${g.icon} ${g.title} `
return (
<Box key={`box-${n}`} flexDirection="column" marginTop={1}>
<Text>
<Text color={frame}>{'╭─'}</Text>
<Text color={g.color} bold>{title}</Text>
<Text color={frame}>{`${'─'.repeat(Math.max(0, width - 3 - cols(title)))}╮`}</Text>
</Text>
{members.flatMap(m => [...(m.s.note ? [noteLine(m.s.note, m.i, frame)] : []), row(m.s, m.i, g.color, frame)])}
<Text color={frame}>{`╰${'─'.repeat(Math.max(0, width - 2))}╯`}</Text>
</Box>
)
})
// 進度條跟著 pane 寬度縮,最長 16 格
const track = Math.max(4, Math.min(TRACK_MAX, width - FOOT_FIXED))
const filled = Math.round((done / steps.length) * track)
// lazygit 式按鍵列:按鍵塗綠、說明用預設字色、項目之間用深灰 │ 隔開
const key = (s: string) => <Text color={GREEN} bold>{s}</Text>
const sep = <Text color={DARK_GRAY}>{' │ '}</Text>
const range = `1–${Math.min(MAX_KEYS, steps.length)}`
const keys = isYanking
? [key(range), ' 按編號複製那條指令']
: isAllDone
? [key('r'), ' 回報:告訴 Claude 全部完成']
: e.props.isFocused
? [key(range), ' 勾選', sep, key('再按一次'), ' 取消']
: [key('ctrl+x tab'), ' 切過來', sep, key(range), ' 勾選']
// 再按一次 y 取消複製模式
const yankButton = <Button key="yank" plain hotkey="y" label={isYanking ? '取消複製' : '複製'} onPress={() => update($, yankAtom, v => !v)} />
return (
<Box flexDirection="column">
{header}
{groups}
<Box flexDirection="column" marginTop={1}>
<Text>
<Text color={GRAY}>進度 </Text>
<Text color={GREEN}>{TRACK.repeat(filled)}</Text>
<Text color={DARK_GRAY}>{TRACK.repeat(track - filled)}</Text>
<Text color={isAllDone ? GREEN : GRAY}>{` ${done}/${steps.length}`}</Text>
</Text>
{/* 複製、關閉鈕接在按鍵列尾:引擎畫成「y: 複製」「q: 關閉」 */}
<Box flexDirection="row">
<Text>{keys}{sep}</Text>
{yankButton}
<Text>{sep}</Text>
{close}
</Box>
</Box>
{isAllDone && (
<Button key="report" variant="primary" hotkey="r" label={`回報 ${steps.length}/${steps.length} 完成`} onPress={() => report($, steps.length)} />
)}
</Box>
)
})ライセンスの全文(MIT)
MIT License Copyright (c) 2026 Mango 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 に読んだコミット dc48c1c6691c のソースから。最初のまとまりが載せる条件で、残りは自分で判断するための材料です。後のコミットは、次に読むまで見ていません。
| 載せる条件: 確かめやすいコード | |
|---|---|
| 入口を読んだ | hooks/hooks.json が名指すモジュールをすべて読んだ。your-turn/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/… などは無い)。Windows にないプログラムを使わない |
| 通信 | fetch の送り先(https のホスト)がコードに書いてあるか。通信なし |
| プログラム | 起動するプログラムの名前がコードに書いてあり、シェル・インタプリタ・通信用の道具でないか。プログラムを起動しない |
| 読んで送る | ファイルや環境変数を読み、かつ通信するか。通信しない |
| ソースの鍵 | ソースに API キーや秘密鍵らしきものがあるか。ソースに鍵なし |
| ライセンス | オープンなライセンス(MIT・Apache-2.0・BSD・ISC・Unlicense・0BSD・CC0)で全文があれば、modscode にコードを載せる。違えばリンクだけ。MIT |
コードの文面を読んだだけで、安全の審査ではありません。動かしてはおらず、起動するプログラムの中で何が起きるかも見えません。入れる前の確認はあなたの役目です。 載せる条件
入れる
入れる前に、必ず自分で確かめてください。Mod はサンドボックスなしで、あなたの権限で動きます。modscode はこのコードの安全を保証しません。下のコードを読み(またはフォルダーで claude plugin validate .)、触るものを見て、読んだコミットを入れてください。
リポジトリがそのままマーケットプレイスです。このマーケットプレイスを足し(ターミナルでは次のコマンド、デスクトップアプリではプラグインの設定)、そこから Mod を入れます。
/plugin marketplace add mangow314/mango-mods/plugin install your-turn@mango-mods入るのはマーケットプレイスの最新のコミットで、ここで読んだもの(dc48c1c6691c)と違うことがあります。入れる前に見比べてください。
Claude に聞く
modscode のコネクタを入れると、Claude がこのデザイン・コードが触るもの・コードを読んで、それをもとに作れます。たとえば:
modscode のデザイン「mangow314-your-turn」をコードごと読んで、同じようなペインを作って似たデザイン
-
Claude に頼む…Fix login▸★ build ok▸★ build ok▸★ build ok+3 moretasks 3 pending · Glob claimed · 3 doneConsensus42%
-
Claude に頼む…2h 10m · █████░░░✓ build ✓ build ✓ buildJavaKotlin3 Python■ ok 3 ■ ok 3 ■ ok 3 Razor proven 3 Razor proven 3 Razor proven 3Phases ──────── 3/3build Pythonbuild Pythonbuild Python… 3 more phasesLua ──────── 3/Kotlin■ the whole upgrade Ruby■ build build Ruby■ build build Ruby■ build build Ruby … 3 moreNext ──────── PythonRuby (by hand)Podsclick a button, or ctrl+x tab then Tab, EnterAttention ──────── 3! Scala ! Scala ! Scala … 3 moreSession ──────── okJava
-
Claude に頼む…moai-boardmoai-boardPickedx closebuild 1build 2build 3r refreshQueue not read yetokPick
-
Open a file first: /crit-tui file <path>Reopen this one in the crit browser view.Claude に頼む…
-
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