modscode / 図鑑 / better-statusline
better-statusline
The status line above the prompt: the session's status and the music playing, one design
何をするか
- プロンプトの上の帯を描く
- /fold を足す
- ツールの呼び出しを見張る
- classic.CwdChanged・classic.PostModelSwitch・classic.PostToolBatch・classic.SessionStart ほか 7 個にフックする
- ターンをまたいで自分の状態を持つ
良いところ
- ネットワークに出ない
- TypeScript で書かれている
- デスクトップ専用の分岐がある
- ファイルを書かない
作り始めるためのコード
2 種類あります。上のデザインから modscode が書いた雛形と、その Mod 自身のコードのうち描いている部分です。
雛形(register.tsx)
import type { Register } from 'claude-code'
// Drawn like better-statusline by Ewen Gao (band), as modscode read it from the mod's code:
// https://modscode.com/gallery/autumn1337-better-statusline/
// 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 band above the prompt; what else goes there is drawn under it
on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
const { Box, Client, Svg } = $.ui.resolve(e)
const source = '…'
const alt = '…'
return (
<Box flexDirection="column">
<Box>
<Box height={1} flexGrow={1}>
<Box height="1" />
<Client module="../ui/mini-player.tsx" flexGrow={1} />
</Box>
<Box marginLeft={0}>
<Svg source={`${source}`} alt={`${alt}`} />
</Box>
</Box>
{await next(e)}
</Box>
)
})
}
Mod 自身のコード
Mod のライセンス(MIT)に従って載せています。全文は下にあります。写すときは著作権表示を残してください。
hooks/register.tsx 464〜521 行 · バンド
on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
if (e.props.hasSurvey || (e.surface !== 'terminal' && e.surface !== 'desktop')) return next(e)
const [current, trackLook, machine, folded, figures, cached] = await Promise.all([
read($, player),
read($, cover),
read($, environment),
read($, isCompact),
read($, status),
read($, cachedAt),
])
if (machine === null || figures === null) return next(e)
if (machine.drawsPictures) watchViewport($, e.viewport)
const view = current === null ? null : viewOf(current, trackLook)
const art = trackLook?.art ?? null
const now = Date.now()
const { Box, Client } = $.ui.resolve(e)
if (e.surface === 'desktop') {
const usage = pills($, e, figures, now)
if (view === null && usage === null) return next(e)
return (
<Box width={e.props.bodyColumns}>
{view !== null && mini($, e, view, machine, art)}
{usage !== null && <Box marginLeft={view === null ? 0 : SPACE}>{usage}</Box>}
</Box>
)
}
const isCoverless = current !== null && trackLook?.id === current.track.id && art === null
const canvas = canvasOf(machine)
const columns = canvas === null || isCoverless ? 0 : coverOf(canvas).columns
const music = view === null ? 0 : cardColumns(columns, view.duration) + SPACE
const drawn = statusOf(figures, machine, cached, e.props.isWorking, now)
const isFolded = folded || e.props.maxRows < CARD.rows || e.props.bodyColumns - music < NARROWEST + RESERVE
if (isFolded) {
const width = view === null ? 0 : Math.min(MINI, Math.floor(e.props.bodyColumns / 2))
return (
<Box width={e.props.bodyColumns} height={1}>
{view !== null && <Box width={width}>{mini($, e, view, machine, art)}</Box>}
<Box marginLeft={view === null ? 0 : SPACE}>
<Client
key="status"
module="../ui/status.tsx"
props={{ ...drawn, isCompact: true }}
width={e.props.bodyColumns - (view === null ? 0 : width + SPACE)}
height={1}
/>
</Box>
</Box>
)
}
return (
<Box width={e.props.bodyColumns} height={CARD.rows}>
{view !== null && card($, e, view, machine, columns, art)}
<Box marginLeft={view === null ? 0 : SPACE}>
<Client key="status" module="../ui/status.tsx" props={drawn} width={e.props.bodyColumns - music} height={CARD.rows} />
</Box>
</Box>
)
})hooks/register.tsx 320〜329 行 · バンド
function mini($: EngineInterface, e: RenderInput<'AbovePrompt', 'terminal' | 'desktop'>, view: View, machine: Environment, art: number | null) {
const props: PlayerProps = { ...view, icons: machine.icons, isMotionReduced: machine.isMotionReduced }
const { Box, Client } = $.ui.resolve(e)
return (
<Box height={1} flexGrow={1}>
{view.hasCover && art !== null && picture($, e, `${machine.folder}/mini.png`, art, 2, 1)}
<Client key="mini" module="../ui/mini-player.tsx" props={props} flexGrow={1} />
</Box>
)
}hooks/register.tsx 283〜291 行 · バンド
function picture($: EngineInterface, e: ResolveInput, file: string, generation: number, columns: number, rows: number) {
if (e.surface !== 'terminal') return $.ui.resolve(e).Box({ width: columns, height: rows })
const { Box, Image } = $.ui.resolve(e)
return (
<Box width={columns} height={rows}>
<Image source={{ file, format: 'png', generation }} columns={columns} rows={rows} alt=" " />
</Box>
)
}hooks/register.tsx 331〜336 行 · バンド
function pills($: EngineInterface, e: RenderInput<'AbovePrompt', 'desktop'>, { usage, tokens }: Status, now: number) {
if (usage.rateLimits.length === 0 && tokens.received === 0) return null
const { Svg } = $.ui.resolve(e)
const drawn = strip(usage.rateLimits, tokens, usage.cost?.usd ?? 0, now)
return <Svg source={drawn.source} alt={drawn.alt} width={drawn.width} height={drawn.height} />
}ライセンスの全文(MIT)
MIT License Copyright (c) 2026 Ewen Gao 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 を動かすツール呼び出し保存
コードから読めること
2026-10-06 に読んだコミット e3984077afd5 のソースから。最初のまとまりが載せる条件で、残りは自分で判断するための材料です。後のコミットは、次に読むまで見ていません。
| 載せる条件: 確かめやすいコード | |
|---|---|
| 入口を読んだ | hooks/hooks.json が名指すモジュールをすべて読んだ。hooks/register.tsx |
| 解析できる | すべてのファイルが TypeScript か JavaScript として解析できる。6 ファイルを解析 |
| コードが 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:162 defaults(Windows にない); hooks/register.tsx:163 mkdir(Windows にない); hooks/register.tsx:378 rm(Windows にない) |
| 通信 | fetch の送り先(https のホスト)がコードに書いてあるか。通信なし |
| プログラム | 起動するプログラムの名前がコードに書いてあり、シェル・インタプリタ・通信用の道具でないか。hooks/register.tsx:126 python3(シェル・インタプリタ); hooks/register.tsx:206 実行時に決まるプログラム; hooks/register.tsx:212 osascript(シェル・インタプリタ); hooks/register.tsx:226 osascript(シェル・インタプリタ); hooks/register.tsx:266 osascript(シェル・インタプリタ) |
| 読んで送る | ファイルや環境変数を読み、かつ通信するか。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 Autumn1337/better-statusline/plugin install better-statusline@better-statusline入るのはマーケットプレイスの最新のコミットで、ここで読んだもの(e3984077afd5)と違うことがあります。入れる前に見比べてください。
Claude に聞く
modscode のコネクタを入れると、Claude がこのデザイン・コードが触るもの・コードを読んで、それをもとに作れます。たとえば:
modscode のデザイン「autumn1337-better-statusline」をコードごと読んで、同じようなペインを作って似たデザイン
-
5h▰▰▰▰▰▰▰▰▱▱▱▱▱▱▱▱3%Winding downWinding downWinding down7d▰▰▰▰▰▰▰▰▱▱▱▱▱▱▱▱3%Winding downWinding downWinding downctx3 / 3Winding downWinding downWinding downWinding downWinding downWinding down./click-probe.tsx●RetryingRefreshing…Long run ✓Winding downWinding downWinding downClaude に頼む…
-
Claude に頼む…Timer● MonAprNo timer runningStopResume last CollapseFri week./meter.tsxUnbilled Wed h$1.24 · expenses MarMayToday, Oct 6This week
-
Claude に頼む…Notes⚠ A team of Never uses your Claude usage much faster.Showing:buildbuildbuildHide completed:buildbuildbuildSet team size:DefaultDefaultDefaultSet model:NotesNotesNotesWorkflowYour next prompt can hand work to Never Notes helpers.● Fix login · Tool agents42% AllCopy failed2h 10m● Fix login · Tool agents42% AllCopy failed2h 10m● Fix login · Tool agents42% AllCopy failed2h 10m
-
Claude に頼む…Historyf ◂ expand⚙ settingsFix loginbuildRemindAuto Remind ConcisebuildRemindAuto Remind ConcisebuildRemindAuto Remind Concise$1.24 this session · auto-compact at 3wrap-up 5h Remind · 7d Remind · /compact Learningwrap-up in 2h 10m CancelFix loginauto 2h 10m ■ Stop stotal 2h 10m · think 2h 10m0 · write 2h 10m0 · tools 2h 10m03 out · 12.4 tok/s◌ build 2h 10m◌ build 2h 10m◌ build 2h 10mFix login● 2h 10m · think 2h 10m · Explanatory tok/s · 3 tools · stopped● 2h 10m · think 2h 10m · Explanatory tok/s · 3 tools · stopped● 2h 10m · think 2h 10m · Explanatory tok/s · 3 tools · stoppedFix loginbuild 3 · Remind%build 3 · Remind%build 3 · Remind%
-
Claude に頼む…Helm⋯buildhead.readingbuildbuild────────✗ English
-
何をするか
- プロンプトの上の帯を描く
- /avatar を足す
- ツールの呼び出しを見張る(止めることがある)
- prompt.submit・session.start・turn.complete・turn.start ほか 1 個にフックする