tracer
Merged is not deployed: follow a merged PR or commit through its workflow runs, deployments and an optional live URL with gh, on a pixel-art level map, and wake the session once when it is live or a stage fails.
何をするか
- 欄・トーストを描く
- /trace を足す
- session.startにフックする
- ターンをまたいで自分の状態を持つ
- ネットワークに出る
良いところ
- TypeScript で書かれている
- エラーを扱う
- ファイルを書かない
作り始めるためのコード
2 種類あります。上のデザインから modscode が書いた雛形と、その Mod 自身のコードのうち描いている部分です。
雛形(register.tsx)
import type { Register } from 'claude-code'
// Drawn like tracer by Pourya (pane, status, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/pourya7-tracer/
// 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: "TRACER" })
on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
const { Box, Text, Button } = $.ui.resolve(e)
const intervalMs = '…'
const wake = '…'
const timeoutMs = '…'
const shortSha = '…'
const title = '…'
const label = '…'
const shortSha2 = '…'
const elapsed = '…'
const text = '…'
const text2 = '…'
const text3 = '…'
const text4 = '…'
const text5 = '…'
const text6 = '…'
const text7 = '…'
const text8 = '…'
const text9 = '…'
const text10 = '…'
const text11 = '…'
const text12 = '…'
const text13 = '…'
const text14 = '…'
const text15 = '…'
const text16 = '…'
const text17 = '…'
const text18 = '…'
const GLYPH = '…'
const stageLabel = '…'
const GLYPH2 = '…'
const stageLabel2 = '…'
const GLYPH3 = '…'
const stageLabel3 = '…'
const error = '…'
const shortSha3 = '…'
const title2 = '…'
const label2 = '…'
const shortSha4 = '…'
const elapsed2 = '…'
const text19 = '…'
const text20 = '…'
const text21 = '…'
const text22 = '…'
const text23 = '…'
const text24 = '…'
const text25 = '…'
const text26 = '…'
const text27 = '…'
const text28 = '…'
const text29 = '…'
const text30 = '…'
const text31 = '…'
const text32 = '…'
const text33 = '…'
const text34 = '…'
const text35 = '…'
const text36 = '…'
const GLYPH4 = '…'
const stageLabel4 = '…'
const GLYPH5 = '…'
const stageLabel5 = '…'
const GLYPH6 = '…'
const stageLabel6 = '…'
const error2 = '…'
const shortSha5 = '…'
const title3 = '…'
const label3 = '…'
const shortSha6 = '…'
const elapsed3 = '…'
const text37 = '…'
const text38 = '…'
const text39 = '…'
const text40 = '…'
const text41 = '…'
const text42 = '…'
const text43 = '…'
const text44 = '…'
const text45 = '…'
const text46 = '…'
const text47 = '…'
const text48 = '…'
const text49 = '…'
const text50 = '…'
const text51 = '…'
const text52 = '…'
const text53 = '…'
const text54 = '…'
const GLYPH7 = '…'
const stageLabel7 = '…'
const GLYPH8 = '…'
const stageLabel8 = '…'
const GLYPH9 = '…'
const stageLabel9 = '…'
const error3 = '…'
return (
<Box flexDirection="column">
<Box flexDirection="row">
<Text bold color="#FFEC27">
T R A C E R
</Text>
<Text dimColor>
{" "}
{"POLL "}
{intervalMs}
{"S / WAKE "}
{wake}
{" / GIVE UP "}
{timeoutMs}
M
</Text>
</Box>
<Box marginTop={1}>
<Text color="#C2C3C7">
NO COURSE LOADED. /trace 42 TO INSERT COIN
</Text>
</Box>
<Box flexDirection="column" marginTop={1}>
<Box flexDirection="row">
<Text bold color="#FFEC27">
{shortSha}
{" "}
</Text>
<Text wrap="truncate-end">
{title}
</Text>
</Box>
<Box flexDirection="row">
<Box>
<Text bold>
{label}
</Text>
</Box>
<Text dimColor>
{" "}
{"WORLD "}
{shortSha2}
{" · "}
{elapsed}
M
</Text>
</Box>
<Box flexDirection="column" marginTop={1}>
<Box flexDirection="row">
<Text>
{text}
</Text>
<Text>
{text2}
</Text>
<Text>
{text3}
</Text>
</Box>
<Box flexDirection="row">
<Text>
{text4}
</Text>
<Text>
{text5}
</Text>
<Text>
{text6}
</Text>
</Box>
<Box flexDirection="row">
<Text>
{text7}
</Text>
<Text>
{text8}
</Text>
<Text>
{text9}
</Text>
</Box>
<Box flexDirection="row">
<Text>
{text10}
</Text>
<Text>
{text11}
</Text>
<Text>
{text12}
</Text>
</Box>
<Box flexDirection="row">
<Text>
{text13}
</Text>
<Text>
{text14}
</Text>
<Text>
{text15}
</Text>
</Box>
<Box flexDirection="row">
<Text>
{text16}
</Text>
<Text>
{text17}
</Text>
<Text>
{text18}
</Text>
</Box>
</Box>
<Text color="#FF004D">
{GLYPH}
{" "}
{stageLabel}
{` ${shortSha}`}
</Text>
<Text color="#FF004D">
{GLYPH2}
{" "}
{stageLabel2}
{` ${shortSha}`}
</Text>
<Text color="#FF004D">
{GLYPH3}
{" "}
{stageLabel3}
{` ${shortSha}`}
</Text>
<Text color="#FF004D">
{error}
</Text>
<Box flexDirection="row">
<Button label="STOP" dimColor />
</Box>
</Box>
<Box flexDirection="column" marginTop={1}>
<Box flexDirection="row">
<Text bold color="#FFEC27">
{shortSha3}
{" "}
</Text>
<Text wrap="truncate-end">
{title2}
</Text>
</Box>
<Box flexDirection="row">
<Box>
<Text bold>
{label2}
</Text>
</Box>
<Text dimColor>
{" "}
{"WORLD "}
{shortSha4}
{" · "}
{elapsed2}
M
</Text>
</Box>
<Box flexDirection="column" marginTop={1}>
<Box flexDirection="row">
<Text>
{text19}
</Text>
<Text>
{text20}
</Text>
<Text>
{text21}
</Text>
</Box>
<Box flexDirection="row">
<Text>
{text22}
</Text>
<Text>
{text23}
</Text>
<Text>
{text24}
</Text>
</Box>
<Box flexDirection="row">
<Text>
{text25}
</Text>
<Text>
{text26}
</Text>
<Text>
{text27}
</Text>
</Box>
<Box flexDirection="row">
<Text>
{text28}
</Text>
<Text>
{text29}
</Text>
<Text>
{text30}
</Text>
</Box>
<Box flexDirection="row">
<Text>
{text31}
</Text>
<Text>
{text32}
</Text>
<Text>
{text33}
</Text>
</Box>
<Box flexDirection="row">
<Text>
{text34}
</Text>
<Text>
{text35}
</Text>
<Text>
{text36}
</Text>
</Box>
</Box>
<Text color="#FF004D">
{GLYPH4}
{" "}
{stageLabel4}
{` ${shortSha}`}
</Text>
<Text color="#FF004D">
{GLYPH5}
{" "}
{stageLabel5}
{` ${shortSha}`}
</Text>
<Text color="#FF004D">
{GLYPH6}
{" "}
{stageLabel6}
{` ${shortSha}`}
</Text>
<Text color="#FF004D">
{error2}
</Text>
<Box flexDirection="row">
<Button label="STOP" dimColor />
</Box>
</Box>
<Box flexDirection="column" marginTop={1}>
<Box flexDirection="row">
<Text bold color="#FFEC27">
{shortSha5}
{" "}
</Text>
<Text wrap="truncate-end">
{title3}
</Text>
</Box>
<Box flexDirection="row">
<Box>
<Text bold>
{label3}
</Text>
</Box>
<Text dimColor>
{" "}
{"WORLD "}
{shortSha6}
{" · "}
{elapsed3}
M
</Text>
</Box>
<Box flexDirection="column" marginTop={1}>
<Box flexDirection="row">
<Text>
{text37}
</Text>
<Text>
{text38}
</Text>
<Text>
{text39}
</Text>
</Box>
<Box flexDirection="row">
<Text>
{text40}
</Text>
<Text>
{text41}
</Text>
<Text>
{text42}
</Text>
</Box>
<Box flexDirection="row">
<Text>
{text43}
</Text>
<Text>
{text44}
</Text>
<Text>
{text45}
</Text>
</Box>
<Box flexDirection="row">
<Text>
{text46}
</Text>
<Text>
{text47}
</Text>
<Text>
{text48}
</Text>
</Box>
<Box flexDirection="row">
<Text>
{text49}
</Text>
<Text>
{text50}
</Text>
<Text>
{text51}
</Text>
</Box>
<Box flexDirection="row">
<Text>
{text52}
</Text>
<Text>
{text53}
</Text>
<Text>
{text54}
</Text>
</Box>
</Box>
<Text color="#FF004D">
{GLYPH7}
{" "}
{stageLabel7}
{` ${shortSha}`}
</Text>
<Text color="#FF004D">
{GLYPH8}
{" "}
{stageLabel8}
{` ${shortSha}`}
</Text>
<Text color="#FF004D">
{GLYPH9}
{" "}
{stageLabel9}
{` ${shortSha}`}
</Text>
<Text color="#FF004D">
{error3}
</Text>
<Box flexDirection="row">
<Button label="STOP" dimColor />
</Box>
</Box>
</Box>
)
})
on('session.start', async ($, e, next) => {
const drop = '…'
await $.ui.toast(`TRACER: wake refused: ${drop}`)
await $.ui.toast(`TRACER: could not submit the wake prompt`)
return next(e)
})
}
Mod 自身のコード
Mod のライセンス(MIT)に従って載せています。全文は下にあります。写すときは著作権表示を残してください。
tracer/hooks/register.tsx 334〜418 行 · ペイン
on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
const { Box, Button, Text } = $.ui.resolve(e)
const list = await read($, traces)
const now = await $.clock.now()
const width = Math.max(20, e.props.bodyColumns - 6)
return (
<Box flexDirection="column">
<Box flexDirection="row">
<Text bold color={SIGNATURE}>
T R A C E R
</Text>
<Text dimColor>
{' '}POLL {Math.round(settings.intervalMs / 1000)}S / WAKE {settings.wake.toUpperCase()} / GIVE UP {Math.round(settings.timeoutMs / 60_000)}M
</Text>
</Box>
{list.length === 0 && (
<Box key="empty" marginTop={1}>
<Text color={PICO.lightGrey}>NO COURSE LOADED. /trace 42 TO INSERT COIN</Text>
</Box>
)}
{list.map(trace => {
const map = levelMap(trace.stages, trace.outcome === 'tracing', e.props.bodyColumns)
const outcome = OUTCOME[trace.outcome]
const elapsed = (trace.outcome === 'tracing' ? now : trace.checkedAt) - trace.startedAt
const title = trace.title.length > width ? `${trace.title.slice(0, width - 1)}~` : trace.title
const current = currentStage(trace.stages)
return (
<Box key={`trace-${trace.sha}`} flexDirection="column" marginTop={1}>
<Box flexDirection="row">
<Text bold color={SIGNATURE}>
{trace.pr === null ? shortSha(trace.sha) : `#${trace.pr}`}{' '}
</Text>
<Text wrap="truncate-end">{title}</Text>
</Box>
<Box flexDirection="row">
<Box key={`outcome-${trace.sha}`}>
<Text bold color={outcome.color}>
{outcome.label(trace)}
</Text>
</Box>
<Text dimColor>
{' '}WORLD {shortSha(trace.sha)} · {Math.floor(elapsed / 60_000)}M
</Text>
</Box>
{map.pixels.length > 0 && (
<Box key={`map-${trace.sha}`} flexDirection="column" marginTop={1}>
{map.pixels.map(runs => (
<Box flexDirection="row">
{runs.map(run => (
<Text color={run.color} backgroundColor={run.backgroundColor}>
{run.text}
</Text>
))}
</Box>
))}
{map.labels.map(cells => (
<Box flexDirection="row">
{cells.map(cell => (
<Text color={cell.color}>{cell.text}</Text>
))}
</Box>
))}
</Box>
)}
{trace.stages.map(stage => (
<Text color={stage.state === 'failed' ? PICO.red : stage === current && trace.outcome === 'tracing' ? PICO.blue : PICO.lightGrey}>
{GLYPH[stage.state]} {stageLabel(stage)}{stage.kind === 'merged' ? ` ${shortSha(trace.sha)}` : `: ${stage.detail}`}
</Text>
))}
{trace.error !== null && <Text color={PICO.red}>{trace.error}</Text>}
<Box flexDirection="row">
<Button
key={`stop-${trace.sha}`}
label={trace.outcome === 'tracing' ? 'STOP' : 'CLEAR'}
dimColor
onPress={() => removeTrace($, trace)}
/>
</Box>
</Box>
)
})}
</Box>
)
})ライセンスの全文(MIT)
MIT License Copyright (c) 2026 Pourya 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 に読んだコミット 2c7f62935f56 のソースから。最初のまとまりが載せる条件で、残りは自分で判断するための材料です。後のコミットは、次に読むまで見ていません。
| 載せる条件: 確かめやすいコード | |
|---|---|
| 入口を読んだ | hooks/hooks.json が名指すモジュールをすべて読んだ。tracer/hooks/register.tsx |
| 解析できる | すべてのファイルが TypeScript か JavaScript として解析できる。4 ファイルを解析 |
| コードが 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 のホスト)がコードに書いてあるか。tracer/hooks/register.tsx:116 fetch(liveUrlFor(settings.liveUrl, sha)) |
| プログラム | 起動するプログラムの名前がコードに書いてあり、シェル・インタプリタ・通信用の道具でないか。tracer/hooks/register.tsx:73 実行時に決まるプログラム |
| 読んで送る | ファイルや環境変数を読み、かつ通信するか。通信するが、ファイルも環境変数も読まない |
| ソースの鍵 | ソースに API キーや秘密鍵らしきものがあるか。ソースに鍵なし |
| ライセンス | オープンなライセンス(MIT・Apache-2.0・BSD・ISC・Unlicense・0BSD・CC0)で全文があれば、modscode にコードを載せる。違えばリンクだけ。MIT |
コードの文面を読んだだけで、安全の審査ではありません。動かしてはおらず、起動するプログラムの中で何が起きるかも見えません。入れる前の確認はあなたの役目です。 載せる条件
入れる
入れる前に、必ず自分で確かめてください。Mod はサンドボックスなしで、あなたの権限で動きます。modscode はこのコードの安全を保証しません。下のコードを読み(またはフォルダーで claude plugin validate .)、触るものを見て、読んだコミットを入れてください。
リポジトリがそのままマーケットプレイスです。このマーケットプレイスを足し(ターミナルでは次のコマンド、デスクトップアプリではプラグインの設定)、そこから Mod を入れます。
/plugin marketplace add pourya7/claude-code-mods/plugin install tracer@claude-code-mods入るのはマーケットプレイスの最新のコミットで、ここで読んだもの(2c7f62935f56)と違うことがあります。入れる前に見比べてください。
Claude に聞く
modscode のコネクタを入れると、Claude がこのデザイン・コードが触るもの・コードを読んで、それをもとに作れます。たとえば:
modscode のデザイン「pourya7-tracer」をコードごと読んで、同じようなペインを作って似たデザイン
-
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