mod-manager
A /mod-manager side pane: every installed mod and plugin with update, auto-update, uninstall, enable/disable, reload and open actions, a background check that flags outdated mods, and adding marketplaces from a GitHub or GitLab URL
何をするか
- 欄・ステータス行・トーストを描く
- classic.SessionStart・session.start・ui.focusにフックする
- ターンをまたいで自分の状態を持つ
- プロセスを起こす
良いところ
- ネットワークに出ない
- エラーを扱う
- ファイルを書かない
作り始めるためのコード
2 種類あります。上のデザインから modscode が書いた雛形と、その Mod 自身のコードのうち描いている部分です。
雛形(register.tsx)
import type { Register } from 'claude-code'
// Drawn like mod-manager by djmid (pane, status, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/netgfx-mod-manager/
// 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: "Mods" })
on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
const { Box, Button, Text, Link } = $.ui.resolve(e)
const name = '…'
const description = '…'
const homepage = '…'
return (
<Box flexDirection="column">
<Button label={`b ‹ Back to list`} hotkey="b" plain />
<Text>
{" "}
</Text>
<Text bold>
{name}
</Text>
<Text dimColor wrap="wrap">
{description}
</Text>
<Text>
{" "}
</Text>
<Box flexDirection="row">
<Text dimColor>
Status
</Text>
<Text wrap="truncate-middle">
—
</Text>
</Box>
<Box flexDirection="row">
<Text dimColor />
<Text wrap="truncate-middle">
—
</Text>
</Box>
<Box flexDirection="row">
<Text dimColor>
Installed
</Text>
<Text wrap="truncate-middle">
—
</Text>
</Box>
<Box flexDirection="row">
<Text dimColor>
Latest
</Text>
<Text wrap="truncate-middle">
—
</Text>
</Box>
<Box flexDirection="row">
<Text dimColor>
Marketplace
</Text>
<Text wrap="truncate-middle">
—
</Text>
</Box>
<Box flexDirection="row">
<Text dimColor>
Scope
</Text>
<Text wrap="truncate-middle">
—
</Text>
</Box>
<Box flexDirection="row">
<Text dimColor>
Enabled
</Text>
<Text wrap="truncate-middle">
—
</Text>
</Box>
<Box flexDirection="row">
<Text dimColor>
Auto-update
</Text>
<Text wrap="truncate-middle">
—
</Text>
</Box>
<Box flexDirection="row">
<Text dimColor>
Updated
</Text>
<Text wrap="truncate-middle">
—
</Text>
</Box>
<Box flexDirection="row">
<Text dimColor>
Folder
</Text>
<Text wrap="truncate-middle">
—
</Text>
</Box>
<Box flexDirection="row">
<Text dimColor>
Homepage
</Text>
<Link href={`${homepage}`} label={`${homepage}`} />
</Box>
<Text>
{" "}
</Text>
<Text dimColor>
────────
</Text>
<Box flexDirection="row" columnGap={2} flexWrap="wrap" />
<Box flexDirection="row" columnGap={2} flexWrap="wrap" />
</Box>
)
})
on('session.start', async ($, e, next) => {
const outdated = '…'
const length = '…'
await $.ui.status(`▲ ${outdated} mod update · /mod-manager`)
await $.ui.toast(`Auto-updated ${length} mod`)
await $.ui.toast(`Wait for the current action to finish`)
return next(e)
})
}
Mod 自身のコード
Mod のライセンス(MIT)に従って載せています。全文は下にあります。写すときは著作権表示を残してください。
hooks/register.js 797〜956 行 · ペイン
on('ui.render', { component: 'Pane' }, async ($, e, next) => {
if (e.requestId !== PANE) return next(e)
const { Box, Text, Button, Input, Link } = $.ui.resolve(e)
const width = Math.max(30, Number(e.props?.bodyColumns ?? PANE_COLUMNS))
const wide = width >= 52
const mods = await read($, modsAtom)
const scan = await read($, scanAtom)
const notice = await read($, noticeAtom)
const busy = await read($, busyAtom)
const pending = await read($, pendingAtom)
const now = $.clock.now()
const redraw = () => $.ui.invalidate('ui.render')
const visible = mods.filter((m) => matches(m, filter))
const order = ['outdated', 'installed', 'disabled', 'dev']
const sorted = [...visible].sort(
(a, b) => order.indexOf(sectionOf(a)) - order.indexOf(sectionOf(b)) || a.name.localeCompare(b.name),
)
if (!sorted.some((m) => m.uid === selected)) selected = sorted[0]?.uid ?? ''
const current = mods.find((m) => m.uid === selected)
if (view === 'detail' && !current) view = 'list'
const outdated = mods.filter((m) => m.status === 'outdated')
const key = (k, label, onPress, isOff) =>
Button({ key: 'act-' + k, label: k + ' ' + label, hotkey: k, plain: true, dimColor: Boolean(isOff), onPress })
// ---- Header: counts and what the background check is doing
const scanText =
scan.phase === 'listing'
? Text({ color: 'cyan', children: ['⟳ reading…'] })
: scan.phase === 'fetching'
? Text({ color: 'cyan', children: ['⟳ checking marketplaces…'] })
: scan.error
? Text({ color: 'red', wrap: 'truncate-end', children: ['✕ ' + scan.error] })
: scan.at
? Text({ dimColor: true, children: ['✓ checked ' + ago(scan.at, now)] })
: Text({ dimColor: true, children: ['not checked yet'] })
const counts = [
Text({ bold: true, children: [mods.length + ' installed'] }),
...(outdated.length ? [Text({ color: 'yellow', children: [' · ' + outdated.length + ' update' + (outdated.length === 1 ? '' : 's')] })] : []),
]
const header = Box({
flexDirection: 'column',
children: [Box({ flexDirection: 'row', children: counts }), scanText],
})
const banners = []
if (busy) {
const m = mods.find((x) => x.uid === busy.uid)
const verbing = { update: 'Updating', uninstall: 'Uninstalling', enable: 'Enabling', disable: 'Disabling' }[busy.verb]
banners.push(Text({ color: 'cyan', wrap: 'truncate-end', children: ['⟳ ' + (busy.label ?? verbing + ' ' + (m?.name ?? '')) + '…'] }))
}
if (notice) {
const color = notice.kind === 'error' ? 'red' : notice.kind === 'ok' ? 'green' : undefined
banners.push(Text({ color, wrap: 'wrap', children: [(notice.kind === 'error' ? '✕ ' : notice.kind === 'ok' ? '✓ ' : '• ') + notice.text] }))
}
if (pending && !busy) {
banners.push(
Box({
flexDirection: 'row',
columnGap: 1,
children: [
Text({ color: 'yellow', children: ['Changes apply after a reload.'] }),
Button({ key: 'reload-now', label: 'Reload now', plain: true, onPress: () => reloadPlugins($) }),
],
}),
)
}
if (confirm) {
const m = mods.find((x) => x.uid === confirm.uid)
const question =
confirm.kind === 'update-all'
? 'Update ' + outdated.length + ' mod' + (outdated.length === 1 ? '' : 's') + '?'
: 'Uninstall ' + (m?.id ?? '') + (m?.name === 'mod-manager' ? ' (this pane)' : '') + '?'
const yes = async () => {
const c = confirm
confirm = null
redraw()
if (c.kind === 'update-all') await updateAll($)
else await runAction($, c.uid, 'uninstall')
}
banners.push(
Box({
flexDirection: 'column',
borderStyle: 'round',
borderColor: 'yellow',
paddingX: 1,
children: [
Text({ bold: true, children: [question] }),
Box({
flexDirection: 'row',
columnGap: 3,
children: [
Button({ key: 'confirm-yes', label: 'y Yes', hotkey: 'y', plain: true, autoFocus: true, onPress: yes }),
Button({ key: 'confirm-no', label: 'n Cancel', hotkey: 'n', plain: true, onPress: () => { confirm = null; redraw() } }),
],
}),
],
}),
)
}
const rule = Text({ dimColor: true, children: ['─'.repeat(width)] })
// Action keys for the highlighted mod
const canUpdate = current && current.status === 'outdated' && !current.isDev
const modKeys = current
? [
key('u', 'Update', () => runAction($, current.uid, 'update'), !canUpdate),
key('x', 'Uninstall', () => { if (current.isDev) return runAction($, current.uid, 'uninstall'); confirm = { uid: current.uid, kind: 'uninstall' }; redraw() }, current.isDev),
key('e', current.enabled ? 'Disable' : 'Enable', () => runAction($, current.uid, current.enabled ? 'disable' : 'enable'), current.isDev),
key('o', 'Open folder', () => openMod($, current.uid, 'folder'), !current.installPath),
key('t', current.auto ? 'Auto-update: on' : 'Auto-update: off', () => toggleAuto($, current.uid), current.isDev),
]
: []
const globalKeys = [
key('a', 'Update all' + (outdated.length ? ' (' + outdated.length + ')' : ''), () => {
if (!outdated.length) return setNotice($, 'Everything is up to date.', 'info')
confirm = { uid: '', kind: 'update-all' }
redraw()
}, !outdated.length),
key('c', 'Check now', () => startCheck($), scan.phase !== 'idle'),
key('r', 'Reload', () => reloadPlugins($)),
key('f', filterOpen ? 'Close filter' : 'Filter', () => { filterOpen = !filterOpen; if (!filterOpen) filter = ''; redraw() }),
key('m', 'Add marketplace', () => { view = 'add'; addError = ''; confirm = null; redraw() }),
]
const keyRows = (keys) => Box({ flexDirection: 'row', columnGap: 2, flexWrap: 'wrap', children: keys })
const backButton = (label, onPress) =>
Button({ key: 'back', label: 'b ‹ ' + label, hotkey: 'b', plain: true, onPress })
// ---- Add view: paste a repository, it becomes a marketplace
if (view === 'add') {
return Box({
flexDirection: 'column',
children: [
backButton('Back to list', () => { view = 'list'; addError = ''; redraw() }),
Text({ children: [' '] }),
Text({ bold: true, children: ['ADD A MARKETPLACE'] }),
Text({
dimColor: true,
wrap: 'wrap',
children: ['Paste a GitHub or GitLab repository. It must have .claude-plugin/marketplace.json at its root. You pick which of its plugins to install next.'],
}),
Text({ children: [' '] }),
Input({
key: 'repo',
label: 'Repository',
placeholder: 'github.com/owner/repo',
value: addDraft,
autoFocus: true,
submitLabel: 'add',
onInput: (v) => { addDraft = v },
onSubmit: (v) => { addDraft = v; return addMarketplace($, v) },
}),
...(addError ? [Text({ color: 'red', wrap: 'wrap', children: ['✕ ' + addError] })] : []),
...banners,
Text({ children: [' '] }),
Text({ dimColor: true, children: ['Accepted forms:'] }),ライセンスの全文(MIT)
MIT License Copyright (c) 2026 Michael Dobekidis 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.
コードが呼ぶもの
プログラム起動ファイル読み取り環境変数保存
コードから読み取ったデザイン
読み取ったコミットのソースから描いたもので、動かした結果ではありません。一覧は 3 回描き、条件はデスクトップアプリで描く最初の分岐を取り、動かしたときにだけ決まる値は仮の例(点線の下線)にするか省きます。色と書体はこのサイトのものです。
コードから読めること
2026-10-06 に読んだコミット 615a20b5761d のソースから。最初のまとまりが載せる条件で、残りは自分で判断するための材料です。後のコミットは、次に読むまで見ていません。
| 載せる条件: 確かめやすいコード | |
|---|---|
| 入口を読んだ | hooks/hooks.json が名指すモジュールをすべて読んだ。hooks/register.js |
| 解析できる | すべてのファイルが 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 のホスト)がコードに書いてあるか。通信なし |
| プログラム | 起動するプログラムの名前がコードに書いてあり、シェル・インタプリタ・通信用の道具でないか。hooks/register.js:67 実行時に決まるプログラム; hooks/register.js:93 実行時に決まるプログラム |
| 読んで送る | ファイルや環境変数を読み、かつ通信するか。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 netgfx/claude-mod-manager/plugin install mod-manager@claude-mod-manager入るのはマーケットプレイスの最新のコミットで、ここで読んだもの(615a20b5761d)と違うことがあります。入れる前に見比べてください。
Claude に聞く
modscode のコネクタを入れると、Claude がこのデザイン・コードが触るもの・コードを読んで、それをもとに作れます。たとえば:
modscode のデザイン「netgfx-mod-manager」をコードごと読んで、同じようなペインを作って似たデザイン
-
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 に頼む…◉ 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
-
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 に頼む…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
-
Claude に頼む…agent-discoverbuildbuildbuildRefreshMCP Browse/3Tab / shift+Tab move · Enter presses · ↑↓ scroll · Esc back to the promptBrowse...Audit asks:DeclineAcceptDeclineCancelAudit asks:DeclineAcceptDeclineCancelAudit asks:DeclineAcceptDeclineCancel