modscode EN

modscode / 図鑑 / vome-dash

vome-dash

A Home Assistant dashboard in a side pane of Claude Code, working: live states, and controls that toggle, step and run as the dashboard's own do. Shows the dashboard Claude reads or edits, with what a save changed lit up, or one picked wit…

確かめやすいコードターミナル+デスクトップペインBoxButtonCodeMarkdownText

何をするか

  • デスクトップアプリに欄を描く
  • /dash を足す
  • ツールの呼び出しを見張る(止めることがある)
  • session.startにフックする
  • ターンをまたいで自分の状態を持つ

良いところ

  • ネットワークに出ない
  • プロセスを起こさない
  • TypeScript で書かれている
  • デスクトップ専用の分岐がある

作り始めるためのコード

2 種類あります。上のデザインから modscode が書いた雛形と、その Mod 自身のコードのうち描いている部分です。

雛形(register.tsx)

register.tsx
import type { Register } from 'claude-code'

// Drawn like vome-dash by Vortitron (pane), as modscode read it from the mod's code:
// https://modscode.com/gallery/vortitron-vome-dash/
// 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: "Dashboard" })
  on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
    const { Box, Button, Text, Markdown, Code } = $.ui.resolve(e)
    const title = '…'
    const title2 = '…'
    const spinner = '…'
    const title3 = '…'
    const spinner2 = '…'
    const title4 = '…'
    const spinner3 = '…'
    const title5 = '…'
    const spinner4 = '…'
    const title6 = '…'
    const spinner5 = '…'
    const title7 = '…'
    const spinner6 = '…'
    const title8 = '…'
    const spinner7 = '…'
    const title9 = '…'
    const spinner8 = '…'
    const title10 = '…'
    const spinner9 = '…'
    const message = '…'
    const server = '…'
    return (
      <Box flexDirection="column">
        <Box flexDirection="row" flexWrap="wrap" gap={1}>
          <Button />
          <Button />
          <Button />
        </Box>
        <Box flexDirection="row" gap={1}>
          <Box flexDirection="column" borderStyle="round" borderColor="subtle" paddingX={1}>
            <Text dimColor>
              Dashboards
            </Text>
            <Button>
              {`▸ ${title}`}
            </Button>
            <Button>
              {`▸ ${title}`}
            </Button>
            <Button>
              {`▸ ${title}`}
            </Button>
          </Box>
          <Box flexDirection="column">
            <Box flexDirection="row" gap={1} paddingRight={2}>
              <Button hotkey="m">
                Close
              </Button>
              <Box flexGrow={1} flexShrink={1} minWidth={4} overflow="hidden">
                <Text bold wrap="truncate-end">
                  {title}
                </Text>
              </Box>
              <Button hotkey="r" dimColor>
                Reload
              </Button>
            </Box>
            <Box flexDirection="row" flexWrap="wrap" gap={1}>
              <Button />
              <Button />
              <Button />
            </Box>
            <Box flexDirection="row" gap={1}>
              <Box flexDirection="column">
                <Box flexDirection="column" borderStyle="round" borderColor="subtle" paddingX={1}>
                  <Box flexDirection="row">
                    <Box flexGrow={1} flexShrink={1} overflow="hidden">
                      <Text bold wrap="truncate-end">
                        {title2}
                      </Text>
                    </Box>
                    <Box flexDirection="row" gap={1} flexShrink={0}>
                      <Text color="warning">
                        {spinner}
                        {" sending"}
                      </Text>
                      <Button>
                        ○━━
                      </Button>
                    </Box>
                  </Box>
                </Box>
                <Box flexDirection="column" borderStyle="round" borderColor="subtle" paddingX={1}>
                  <Box flexDirection="row">
                    <Box flexGrow={1} flexShrink={1} overflow="hidden">
                      <Text bold wrap="truncate-end">
                        {title3}
                      </Text>
                    </Box>
                    <Box flexDirection="row" gap={1} flexShrink={0}>
                      <Text color="warning">
                        {spinner2}
                        {" sending"}
                      </Text>
                      <Button>
                        ○━━
                      </Button>
                    </Box>
                  </Box>
                </Box>
                <Box flexDirection="column" borderStyle="round" borderColor="subtle" paddingX={1}>
                  <Box flexDirection="row">
                    <Box flexGrow={1} flexShrink={1} overflow="hidden">
                      <Text bold wrap="truncate-end">
                        {title4}
                      </Text>
                    </Box>
                    <Box flexDirection="row" gap={1} flexShrink={0}>
                      <Text color="warning">
                        {spinner3}
                        {" sending"}
                      </Text>
                      <Button>
                        ○━━
                      </Button>
                    </Box>
                  </Box>
                </Box>
              </Box>
              <Box flexDirection="column">
                <Box flexDirection="column" borderStyle="round" borderColor="subtle" paddingX={1}>
                  <Box flexDirection="row">
                    <Box flexGrow={1} flexShrink={1} overflow="hidden">
                      <Text bold wrap="truncate-end">
                        {title5}
                      </Text>
                    </Box>
                    <Box flexDirection="row" gap={1} flexShrink={0}>
                      <Text color="warning">
                        {spinner4}
                        {" sending"}
                      </Text>
                      <Button>
                        ○━━
                      </Button>
                    </Box>
                  </Box>
                </Box>
                <Box flexDirection="column" borderStyle="round" borderColor="subtle" paddingX={1}>
                  <Box flexDirection="row">
                    <Box flexGrow={1} flexShrink={1} overflow="hidden">
                      <Text bold wrap="truncate-end">
                        {title6}
                      </Text>
                    </Box>
                    <Box flexDirection="row" gap={1} flexShrink={0}>
                      <Text color="warning">
                        {spinner5}
                        {" sending"}
                      </Text>
                      <Button>
                        ○━━
                      </Button>
                    </Box>
                  </Box>
                </Box>
                <Box flexDirection="column" borderStyle="round" borderColor="subtle" paddingX={1}>
                  <Box flexDirection="row">
                    <Box flexGrow={1} flexShrink={1} overflow="hidden">
                      <Text bold wrap="truncate-end">
                        {title7}
                      </Text>
                    </Box>
                    <Box flexDirection="row" gap={1} flexShrink={0}>
                      <Text color="warning">
                        {spinner6}
                        {" sending"}
                      </Text>
                      <Button>
                        ○━━
                      </Button>
                    </Box>
                  </Box>
                </Box>
              </Box>
              <Box flexDirection="column">
                <Box flexDirection="column" borderStyle="round" borderColor="subtle" paddingX={1}>
                  <Box flexDirection="row">
                    <Box flexGrow={1} flexShrink={1} overflow="hidden">
                      <Text bold wrap="truncate-end">
                        {title8}
                      </Text>
                    </Box>
                    <Box flexDirection="row" gap={1} flexShrink={0}>
                      <Text color="warning">
                        {spinner7}
                        {" sending"}
                      </Text>
                      <Button>
                        ○━━
                      </Button>
                    </Box>
                  </Box>
                </Box>
                <Box flexDirection="column" borderStyle="round" borderColor="subtle" paddingX={1}>
                  <Box flexDirection="row">
                    <Box flexGrow={1} flexShrink={1} overflow="hidden">
                      <Text bold wrap="truncate-end">
                        {title9}
                      </Text>
                    </Box>
                    <Box flexDirection="row" gap={1} flexShrink={0}>
                      <Text color="warning">
                        {spinner8}
                        {" sending"}
                      </Text>
                      <Button>
                        ○━━
                      </Button>
                    </Box>
                  </Box>
                </Box>
                <Box flexDirection="column" borderStyle="round" borderColor="subtle" paddingX={1}>
                  <Box flexDirection="row">
                    <Box flexGrow={1} flexShrink={1} overflow="hidden">
                      <Text bold wrap="truncate-end">
                        {title10}
                      </Text>
                    </Box>
                    <Box flexDirection="row" gap={1} flexShrink={0}>
                      <Text color="warning">
                        {spinner9}
                        {" sending"}
                      </Text>
                      <Button>
                        ○━━
                      </Button>
                    </Box>
                  </Box>
                </Box>
              </Box>
            </Box>
            <Text color="warning" wrap="wrap">
              {message}
            </Text>
            <Box flexDirection="column" borderStyle="round" borderColor="warning" paddingX={1} marginTop={1}>
              <Text color="warning" wrap="wrap">
                Auto mode refused the press. Pressing a control here calls ha_call_service, and allowing that by name would let Claude …
                {" "}
                ~/.claude/settings.json
                {" if you are happy with that:"}
              </Text>
              <Markdown text="[~/.claude/settings.json](file://~/.claude/settings.json)" />
              <Code source={`"mcp__${server}__ha_call_service"`} />
              <Box flexDirection="row" gap={2}>
                <Button hotkey="c">
                  Copy
                </Button>
                <Button hotkey="t">
                  Retry the press
                </Button>
                <Button dimColor>
                  Dismiss
                </Button>
              </Box>
            </Box>
          </Box>
        </Box>
      </Box>
    )
  })
}

Mod 自身のコード

Mod のライセンス(MIT)に従って載せています。全文は下にあります。写すときは著作権表示を残してください。

claude-plugin/vome-dash/hooks/register.tsx 128〜287 行 · ペイン
  on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
    const { Box, Text, Button, Code, Markdown } = $.ui.resolve(e)
    const settingsLink = <Markdown text={`[${settingsFile}](file://${settingsFile})`} />
    const current = (await $.state.get(dash)).value ?? null
    const shownView = (await $.state.get(view)).value ?? 0
    const live = (await $.state.get(states)).value ?? {}
    const lighting = (await $.state.get(lit)).value ?? null
    const texts = (await $.state.get(rendered)).value ?? {}
    const series = (await $.state.get(history)).value ?? {}
    const asking = (await $.state.get(confirm)).value ?? null
    const picking = (await $.state.get(choices)).value ?? null
    const refusal = (await $.state.get(blocked)).value ?? null
    const message = (await $.state.get(note)).value ?? null
    const presses = (await $.state.get(pending)).value ?? {}
    const isMenuOpen = (await $.state.get(sidebarOpen)).value ?? false
    const pictures = (await $.state.get(frames)).value ?? {}
    const width = Math.max(30, e.props.bodyColumns)
    const isLit = (key: string) => lighting !== null && Date.now() - lighting.at < LIT_MS && lighting.keys.some(k => key === k || key.startsWith(`${k}/`))

    const help = refusal ? (
      <Box flexDirection="column" borderStyle="round" borderColor="warning" paddingX={1} marginTop={1}>
        {refusal.tool === 'ha_call_service' ? (
          <Text color="warning" wrap="wrap">
            Auto mode refused the press. Pressing a control here calls ha_call_service, and allowing that by name would
            let Claude change things without asking too. Switch auto mode off to use the controls, or allow it in
            {' '}{settingsFile} if you are happy with that:
          </Text>
        ) : (
          <Text color="warning" wrap="wrap">
            Auto mode refused the pane's read of live states. Add these to permissions.allow in {settingsFile}; they only read:
          </Text>
        )}
        {settingsLink}
        <Code source={refusal.tool === 'ha_call_service' ? `"mcp__${refusal.server}__ha_call_service"` : READS.map(t => `"mcp__${refusal.server}__${t}"`).join(',\n')} />
        <Box flexDirection="row" gap={2}>
          <Button
            key="copy-rule"
            hotkey="c"
            onPress={press =>
              $.ui.copy({
                text: refusal.tool === 'ha_call_service' ? `"mcp__${refusal.server}__ha_call_service"` : READS.map(t => `"mcp__${refusal.server}__${t}"`).join(',\n'),
                surface: press.surface,
              })
            }
          >
            Copy
          </Button>
          <Button
            key="retry"
            hotkey="t"
            onPress={async () => {
              await $.state.set(blocked, null)
              // Allowed since: nothing stays switched off for having been refused once.
              hasSnapshot = true
              hasMaxPoints = true
              framesRetryAt = 0
              watchRetryAt = 0
              if (refusal.tool === 'ha_call_service' && lastCall) await callService($, lastCall.server, lastCall.call)
              else void poll($, true)
            }}
          >
            {refusal.tool === 'ha_call_service' ? 'Retry the press' : 'Retry'}
          </Button>
          <Button key="dismiss-rule" dimColor onPress={() => $.state.set(blocked, null)}>
            Dismiss
          </Button>
        </Box>
      </Box>
    ) : null

    const picker = picking ? (
      <Box flexDirection="column" marginTop={1}>
        <Text bold>Dashboards</Text>
        <Box flexDirection="row" flexWrap="wrap" gap={1}>
          {picking.map(choice => (
            <Button
              key={`pick-${choice.urlPath}`}
              onPress={async () => {
                await $.state.set(choices, null)
                const server = current?.server ?? (await dashServers($))[0]
                if (server) await loadDashboard($, server, choice.urlPath)
              }}
            >
              {choice.title}
            </Button>
          ))}
        </Box>
      </Box>
    ) : null

    if (!current) {
      return (
        <Box flexDirection="column">
          <Text dimColor wrap="wrap">
            No dashboard yet. It appears here, working, when Claude reads or saves one, or pick one with /dash.
          </Text>
          {picker}
          {message ? <Text color="warning" wrap="wrap">{message}</Text> : null}
          {help}
        </Box>
      )
    }

    const views = viewsOf(current.config)
    const index = Math.min(shownView, Math.max(0, views.length - 1))
    const shown: View | undefined = views[index]
    // The home's dashboards down the left, as Home Assistant's sidebar has them, until one is picked.
    const hasMenu = (picking?.length ?? 0) > 1
    const isSidebar = isMenuOpen && hasMenu && width >= 70
    // Wide enough for the longest title, its marker and a button's brackets, inside the border.
    const longest = Math.max(10, ...(picking ?? []).map(choice => choice.title.length))
    const sidebarWidth = Math.min(SIDEBAR_MAX, Math.max(SIDEBAR_MIN, longest + 2 + 4 + 4))
    const mainWidth = isSidebar ? width - sidebarWidth - 1 : width
    // Columns as Home Assistant's desktop layout has them: as many as fit, cards stacked in each.
    const columns = mainWidth >= 120 ? 3 : mainWidth >= 72 ? 2 : 1
    const cardWidth = columns > 1 ? Math.floor((mainWidth - (columns - 1)) / columns) : mainWidth
    lastCardWidth = cardWidth
    /** What a control's press is doing, for the row it is on. */
    const pressOf = (prefix: string): Pending | undefined =>
      Object.entries(presses)
        .filter(([key]) => key === prefix || key.startsWith(`${prefix}/`))
        .map(([, p]) => p)
        .sort((a, b) => b.at - a.at)[0]
    const spinner = '⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏'[Math.floor(Date.now() / 120) % 10]
    const pressNote = (p: Pending | undefined) =>
      !p ? null : p.phase === 'sending' ? (
        <Text color="warning">{spinner} sending</Text>
      ) : p.phase === 'sent' ? (
        <Text color="suggestion">{spinner} sent, waiting</Text>
      ) : p.phase === 'done' ? (
        <Text color="success">✓</Text>
      ) : p.phase === 'quiet' ? (
        <Text color="warning">no change seen</Text>
      ) : (
        <Text color="error">✗ failed</Text>
      )

    const press = async (key: string, call: ServiceCall) => {
      if (call.confirm && !(asking && asking.key === key && asking.until > Date.now())) {
        await $.state.set(confirm, { key, until: Date.now() + CONFIRM_MS })
        return
      }
      await $.state.set(confirm, null)
      await pressAndWatch($, current.server, key, call)
    }

    const entityRow = (row: Extract<Row, { kind: 'entity' }>, key: string) => {
      const now: Live | undefined = live[row.entity]
      const state = now?.state ?? '…'
      const attributes = now?.attributes ?? {}
      const name = row.name ?? (typeof attributes.friendly_name === 'string' ? steady(attributes.friendly_name) : row.entity)
      const unit = typeof attributes.unit_of_measurement === 'string' ? ` ${attributes.unit_of_measurement}` : ''
      const toggle = toggleFor(row.entity)
      const down = now ? stepFor(row.entity, attributes, state, -1) : null
      const up = now ? stepFor(row.entity, attributes, state, 1) : null
      const isOn = state === 'on'
      const shownState = row.entity.startsWith('light.') && isOn && typeof attributes.brightness === 'number' ? `on ${Math.round((attributes.brightness / 255) * 100)}%` : `${formatState(state)}${unit}`
      const going = pressOf(key)
      const isFresh = going?.phase === 'done'
      // A light that is on glows in its own colour, as brightly as it is lit.
ライセンスの全文(MIT)
MIT License

Copyright (c) 2026 Andrew Lyeklint Hancock (Vortitron)

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 に読んだコミット 780616c7a4f7 のソースから。最初のまとまりが載せる条件で、残りは自分で判断するための材料です。後のコミットは、次に読むまで見ていません。

載せる条件: 確かめやすいコード
入口を読んだhooks/hooks.json が名指すモジュールをすべて読んだ。claude-plugin/vome-dash/hooks/register.tsx
解析できるすべてのファイルが TypeScript か JavaScript として解析できる。2 ファイルを解析
コードが 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 Vortitron/home-assistant-mcp
/plugin install vome-dash@vome

入るのはマーケットプレイスの最新のコミットで、ここで読んだもの(780616c7a4f7)と違うことがあります。入れる前に見比べてください。

Claude に聞く

modscode のコネクタを入れると、Claude がこのデザイン・コードが触るもの・コードを読んで、それをもとに作れます。たとえば:

modscode のデザイン「vortitron-vome-dash」をコードごと読んで、同じようなペインを作って

Claude から探す: MCP コネクタ

似たデザイン