modscode / 図鑑 / dca-factory-cockpit
dca-factory-cockpit
Claude Code only, optional: the dca-factory cycle as a cockpit in a pane — the foundation (describe, set up) beside the cycle discover, backlog, run, decide, delivered — live, with a background worker. Draws what factory.sh prints; the fac…
何をするか
- 欄・ステータス行・トーストを描く
- /factory-cockpit を足す
- ツールの呼び出しを見張る(止めることがある)
- session.start・turn.completeにフックする
- プロセスを起こす
良いところ
- ネットワークに出ない
- TypeScript で書かれている
- エラーを扱う
- ファイルを書かない
作り始めるためのコード
2 種類あります。上のデザインから modscode が書いた雛形と、その Mod 自身のコードのうち描いている部分です。
雛形(register.tsx)
import type { Register } from 'claude-code'
// Drawn like dca-factory-cockpit by Christoph Bloemer (pane, status, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/domain-centric-development-dca-factory-cockpit/
// 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: "Factory cockpit" })
on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
const { Box, Text, Button } = $.ui.resolve(e)
const project = '…'
const delivered = '…'
const total = '…'
const tokens = '…'
const text = '…'
const MARK_GLYPH = '…'
const id = '…'
const label = '…'
const text2 = '…'
const label2 = '…'
const text3 = '…'
const label3 = '…'
const text4 = '…'
const label4 = '…'
const text5 = '…'
const label5 = '…'
const text6 = '…'
const label6 = '…'
const text7 = '…'
const label7 = '…'
const text8 = '…'
const label8 = '…'
const text9 = '…'
const label9 = '…'
const text10 = '…'
return (
<Box flexDirection="column" paddingX={1} paddingY={1} width="100%">
<Box flexDirection="column">
<Box borderStyle="round" paddingX={1}>
<Box flexDirection="column" flexGrow={1}>
<Box justifyContent="space-between">
<Box gap={2}>
<Box>
<Text bold>
domaincentric
</Text>
<Text bold>
.dev
</Text>
</Box>
<Text>
│
</Text>
<Text bold>
FACTORY COCKPIT
</Text>
</Box>
</Box>
<Box gap={2} marginTop={1}>
<Text bold>
PROJECT
</Text>
<Text bold>
{project}
</Text>
<Text>
{delivered}
{" of "}
{total}
{" stories delivered"}
{` · ${tokens} tokens`}
{" · worker ▶"}
</Text>
</Box>
</Box>
</Box>
<Box marginTop={1} />
<Box gap={1} marginTop={1}>
<Text bold>
Next ›
</Text>
<Text>
{text}
</Text>
</Box>
<Box gap={1}>
<Text>
This project's pipeline is older than the cockpit reads — the description and discovery views stay empty.
</Text>
<Box gap={0}>
<Button label="✦ update" plain />
<Text>
{" ›"}
</Text>
</Box>
</Box>
</Box>
<Box flexDirection="column" marginTop={1}>
<Box gap={1}>
<Text bold>
{MARK_GLYPH}
</Text>
<Text bold>
{id}
{" — "}
</Text>
</Box>
<Box flexDirection="column" marginTop={1}>
<Box gap={3}>
<Box gap={1} width={44} flexShrink={0}>
<Box width={10} flexShrink={0}>
<Text bold>
{label}
</Text>
</Box>
<Text wrap="truncate">
{text2}
</Text>
</Box>
<Box gap={1} width={44} flexShrink={0}>
<Box width={10} flexShrink={0}>
<Text bold>
{label2}
</Text>
</Box>
<Text wrap="truncate">
{text3}
</Text>
</Box>
<Box gap={1} width={44} flexShrink={0}>
<Box width={10} flexShrink={0}>
<Text bold>
{label3}
</Text>
</Box>
<Text wrap="truncate">
{text4}
</Text>
</Box>
</Box>
<Box gap={3}>
<Box gap={1} width={44} flexShrink={0}>
<Box width={10} flexShrink={0}>
<Text bold>
{label4}
</Text>
</Box>
<Text wrap="truncate">
{text5}
</Text>
</Box>
<Box gap={1} width={44} flexShrink={0}>
<Box width={10} flexShrink={0}>
<Text bold>
{label5}
</Text>
</Box>
<Text wrap="truncate">
{text6}
</Text>
</Box>
<Box gap={1} width={44} flexShrink={0}>
<Box width={10} flexShrink={0}>
<Text bold>
{label6}
</Text>
</Box>
<Text wrap="truncate">
{text7}
</Text>
</Box>
</Box>
<Box gap={3}>
<Box gap={1} width={44} flexShrink={0}>
<Box width={10} flexShrink={0}>
<Text bold>
{label7}
</Text>
</Box>
<Text wrap="truncate">
{text8}
</Text>
</Box>
<Box gap={1} width={44} flexShrink={0}>
<Box width={10} flexShrink={0}>
<Text bold>
{label8}
</Text>
</Box>
<Text wrap="truncate">
{text9}
</Text>
</Box>
<Box gap={1} width={44} flexShrink={0}>
<Box width={10} flexShrink={0}>
<Text bold>
{label9}
</Text>
</Box>
<Text wrap="truncate">
{text10}
</Text>
</Box>
</Box>
</Box>
</Box>
</Box>
)
})
on('session.start', async ($, e, next) => {
const story = '…'
const what = '…'
const stage = '…'
await $.ui.status(`factory: waits for you — ${story} ${what}`)
await $.ui.toast(`factory: ${story} — ${stage} started`)
await $.ui.toast(`factory: ${story} — ${stage} gate refused`)
return next(e)
})
}
Mod 自身のコード
Mod のライセンス(MIT)に従って載せています。全文は下にあります。写すときは著作権表示を残してください。
plugins/dca-factory-cockpit/hooks/register.tsx 441〜446 行 · ペイン
on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
const now = await read($, cockpit)
const { Text } = $.ui.resolve(e)
if (!now) return <Text color={C.muted}>No factory in this project.</Text>
return draw($, e, now)
})plugins/dca-factory-cockpit/hooks/register.tsx 452〜611 行 · ペイン
async function draw($: EngineInterface, e: RenderInput<'Pane'>, now: Cockpit) {
const { Box, Text, Button, ...rest } = $.ui.resolve(e)
// the site's paper for a light theme, its deep plates for a dark one — before anything is drawn
const theme = (await $.config.list().catch(() => [])).find(row => row.key === 'theme')
applyPalette(/light/i.test(String(theme?.value ?? '')))
const ui = components({
Box,
Text,
Button,
Input: 'Input' in rest ? rest.Input : null,
width: e.props.bodyColumns ?? e.viewport?.columns ?? 100,
})
const at = await $.clock.now()
const current = await read($, tab)
const open = await read($, detail)
const job = await read($, worker)
const rows = e.viewport?.rows ?? 40
const status = now.status
const isFocused = Boolean(e.props.isFocused)
// The links every view shares — one way to open a story, a record, a file.
const storyCell = (row: Row): Cell => ({ node: ui.marked(row.mark, `story-${row.story}`, row.story, () => void openStory($, row.story)) })
const recordCell = (record: DecisionRecord, back: Detail | null): Cell => ({
node: ui.link(`record-${record.id}`, record.id, () => void openFile($, `${now.root}/${record.path}`, record.id, back)),
})
// An unguarded epic's own act, beside its hint — the epic's name opens the epic, this writes its journey.
const guardCell = (hint: FactoryStatus['journeys'][number]): Cell => ({
node: ui.button(`guard-${hint.epic}`, 'add guard', () => send($, hint.action.skill || `/factory-backlog journey ${hint.epic}`), { byClaude: true }),
})
const ask = (key: string, label: string, placeholder: string, command: string) =>
ui.ask(key, label, placeholder, value => send($, `${command} ${value}`.trim()), () => void $.prompt.fill({ text: `${command} ` }))
const idWidth = Math.max(8, ...status.rows.map(row => row.story.length)) + 4
const recordTable = (list: DecisionRecord[], back: Detail | null) =>
ui.table(
[COL.mark, { name: 'state', width: 9 }, COL.record, COL.asked, COL.what],
list.map(record => [
ui.mark(record.kind === 'acceptance' ? 'acceptance' : 'question'),
{ text: record.state, color: record.state === 'open' ? C.wait : C.muted },
recordCell(record, back),
{ text: fmt.when(record.asked), color: C.muted },
{ text: record.text, color: C.muted },
]),
'No record.',
)
const head = (
<Box flexDirection="column">
<Box borderStyle="round" borderColor={C.accent} paddingX={1}>
<Box flexDirection="column" flexGrow={1}>
<Box justifyContent="space-between">
<Box gap={2}>
{/* side by side, not nested: a Text inside a Text takes the outer colour */}
<Box>
<Text bold color={C.bright}>
domaincentric
</Text>
<Text bold color={C.accent}>
.dev
</Text>
</Box>
<Text color={C.line}>│</Text>
<Text bold color={C.accent}>
FACTORY COCKPIT
</Text>
</Box>
{ui.button('close', '✕ close', () => void $.ui.close({ id: PANE }), { hotkey: 'q' })}
</Box>
<Box gap={2} marginTop={1}>
<Text bold color={C.accent}>
PROJECT
</Text>
<Text bold color={C.bright}>
{now.project}
</Text>
<Text color={C.muted}>
{status.delivered} of {status.total} stories delivered
{status.tokens > 0 ? ` · ${fmt.tokens(status.tokens)} tokens` : ''}
{job.state === 'running' ? ' · worker ▶' : ''}
</Text>
</Box>
</Box>
</Box>
<Box marginTop={1}>
{ui.phases(
[
{ key: 'tab-describe', label: 'Describe', hotkey: '0', isOpen: current === 'describe' && !open, onPress: () => void showTab($, 'describe') },
{ key: 'setup', label: '✦ setup', isOpen: false, onPress: () => send($, '/factory-setup') },
{ key: 'update', label: '✦ update', isOpen: false, onPress: () => send($, '/factory-update') },
],
TABS.map(one => ({
key: `tab-${one.id}`,
label: one.label,
hotkey: one.key,
isOpen: one.id === current && !open,
mark:
one.id === 'decide' && status.waiting.length > 0
? { text: String(status.waiting.length), color: C.wait }
: one.id === 'run' && (isRunning() || status.running.length > 0)
? { text: '▶', color: C.accent }
: one.id === 'delivered' && status.delivered > 0
? { text: String(status.delivered), color: C.done }
: undefined,
onPress: () => void showTab($, one.id),
})),
)}
</Box>
{status.waiting.length > 0 && ui.banner(C.wait, status.waiting.map(wait => `${MARK_GLYPH[wait.mark] ?? '?'} ${wait.story} — ${wait.what}`))}
<Box gap={1} marginTop={1}>
<Text bold color={C.accent}>
Next ›
</Text>
<Text color={C.text}>{status.next.text}</Text>
</Box>
{now.isBehind && (
<Box gap={1}>
<Text color={C.wait}>This project's pipeline is older than the cockpit reads — the description and discovery views stay empty.</Text>
{ui.link('behind-update', '✦ update', () => send($, '/factory-update'))}
</Box>
)}
</Box>
)
const page = (body: RenderElement | RenderElement[], hint: string) => (
// the painted surface fills the pane: at least the rows the surface gave its body, the whole width
<Box flexDirection="column" paddingX={1} paddingY={1} backgroundColor={C.bg} minHeight={e.props.scroll?.bodyRows ?? rows} width={e.props.bodyColumns ?? '100%'}>
{head}
<Box flexDirection="column" marginTop={1}>
{body}
</Box>
{ui.keys(isFocused, hint)}
</Box>
)
// ---- one process's output: what it read, edited and ran, a shared one's stages as headings
if (open?.kind === 'output') {
const lines = await read($, outputLines)
return page(
[
<Box gap={1}>
<Text bold color={C.bright}>
{open.story} / {open.process}
</Text>
</Box>,
ui.actions([
ui.button('back', '← back', () => void (open.back?.kind === 'story' ? openStory($, open.back.id) : update($, detail, () => open.back)), { hotkey: 'b' }),
]),
ui.framed(ui.log(lines.slice(-Math.max(10, rows - 12)), 'This process wrote nothing.')),
],
'b back',
)
}
// ---- a file: a description, a discovery report, a hand-over, a decision record
if (open?.kind === 'file') {
return page(
[
<Box gap={1}>
<Text bold color={C.bright}>
{open.title}
</Text>plugins/dca-factory-cockpit/hooks/components.tsx 259〜264 行 · ペイン
const link = (key: string, label: string, onPress: () => void) => (
<Box key={`link-${key}`} gap={0} hover={{ backgroundColor: C.line }}>
<Button key={key} label={label} plain onPress={onPress} />
<Text color={C.accent}> ›</Text>
</Box>
)plugins/dca-factory-cockpit/hooks/components.tsx 230〜255 行 · ペイン
const fields = (items: (Field | false | null | undefined | '' | 0)[], wanted = 1) => {
const present = items.filter((item): item is Field => typeof item === 'object' && item !== null && Boolean(item.text))
const perRow = Math.max(1, Math.min(wanted, pairsPerRow(width)))
const rowsOf: Field[][] = []
for (let index = 0; index < present.length; index += perRow) rowsOf.push(present.slice(index, index + perRow))
return (
<Box flexDirection="column" marginTop={1}>
{rowsOf.map(pairs => (
<Box gap={3}>
{pairs.map(item => (
<Box gap={1} width={perRow > 1 ? PAIR : undefined} flexShrink={perRow > 1 ? 0 : 1}>
<Box width={10} flexShrink={0}>
<Text bold color={C.accent}>
{item.label.toUpperCase()}
</Text>
</Box>
<Text color={item.color ?? C.text} bold={item.bold} wrap="truncate">
{item.text}
</Text>
</Box>
))}
</Box>
))}
</Box>
)
}ライセンスの全文(MIT)
MIT License Copyright (c) 2026 Christoph Bloemer and contributors 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 に読んだコミット aa96a6933a11 のソースから。最初のまとまりが載せる条件で、残りは自分で判断するための材料です。後のコミットは、次に読むまで見ていません。
| 載せる条件: 確かめやすいコード | |
|---|---|
| 入口を読んだ | hooks/hooks.json が名指すモジュールをすべて読んだ。plugins/dca-factory-cockpit/hooks/register.tsx |
| 解析できる | すべてのファイルが TypeScript か JavaScript として解析できる。3 ファイルを解析 |
| コードが 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/… などは無い)。plugins/dca-factory-cockpit/hooks/register.tsx:329 open(Windows にない); plugins/dca-factory-cockpit/hooks/register.tsx:334 xdg-open(Windows にない) |
| 通信 | fetch の送り先(https のホスト)がコードに書いてあるか。通信なし |
| プログラム | 起動するプログラムの名前がコードに書いてあり、シェル・インタプリタ・通信用の道具でないか。plugins/dca-factory-cockpit/hooks/register.tsx:40 bash(シェル・インタプリタ); plugins/dca-factory-cockpit/hooks/register.tsx:189 bash(シェル・インタプリタ) |
| 読んで送る | ファイルや環境変数を読み、かつ通信するか。読んだうえで通信する |
| ソースの鍵 | ソースに API キーや秘密鍵らしきものがあるか。ソースに鍵なし |
| ライセンス | オープンなライセンス(MIT・Apache-2.0・BSD・ISC・Unlicense・0BSD・CC0)で全文があれば、modscode にコードを載せる。違えばリンクだけ。MIT |
コードの文面を読んだだけで、安全の審査ではありません。動かしてはおらず、起動するプログラムの中で何が起きるかも見えません。入れる前の確認はあなたの役目です。 載せる条件
入れる
入れる前に、必ず自分で確かめてください。Mod はサンドボックスなしで、あなたの権限で動きます。modscode はこのコードの安全を保証しません。下のコードを読み(またはフォルダーで claude plugin validate .)、触るものを見て、読んだコミットを入れてください。
リポジトリがそのままマーケットプレイスです。このマーケットプレイスを足し(ターミナルでは次のコマンド、デスクトップアプリではプラグインの設定)、そこから Mod を入れます。
/plugin marketplace add domain-centric-development/dca-marketplace/plugin install dca-factory-cockpit@dca-marketplace入るのはマーケットプレイスの最新のコミットで、ここで読んだもの(aa96a6933a11)と違うことがあります。入れる前に見比べてください。
Claude に聞く
modscode のコネクタを入れると、Claude がこのデザイン・コードが触るもの・コードを読んで、それをもとに作れます。たとえば:
modscode のデザイン「domain-centric-development-dca-factory-cockpit」をコードごと読んで、同じようなペインを作って似たデザイン
-
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
-
Open a file first: /crit-tui file <path>Reopen this one in the crit browser view.Claude に頼む…
-
Claude に頼む…TodayOct 63 left · Mar overdueRemCTL: Sep✓ All done for today.● build3● Fix login ● ⚑Jul · build✓● Fix login ● ⚑Jul · build✓● Fix login ● ⚑Jul · build✓● build3● Fix login ● ⚑Jul · build✓● Fix login ● ⚑Jul · build✓● Fix login ● ⚑Jul · build✓● build3● Fix login ● ⚑Jul · build✓● Fix login ● ⚑Jul · build✓● Fix login ● ⚑Jul · build✓Updated 14:32UndoRefresh
-
Claude に頼む…TO graph› Fix login › Fix login › Fix loginScopeThis featureWhole projectHide done stepsReconnect
-
Claude に頼む…Replay TheaterStep Prev1/3 write Next[31][31][31]Prev pNext nClose q────────● Prev● Prev● Prev
-
Claude に頼む…great_cto: 3 gate waiting — /gatesGatesmy-app · 3 waiting · checked Gates UTCGates — Fix logina1b2c3dExpensive to undo. To approve, type Gates and press Enter.approve: Gates approveGates — Fix logina1b2c3dExpensive to undo. To approve, type Gates and press Enter.approve: Gates approveGates — Fix logina1b2c3dExpensive to undo. To approve, type Gates and press Enter.approve: Gates approve