modscode EN

modscode / 図鑑 / atlas

atlas

Adds /atlas: a file explorer in a pane beside Claude Code, with git marks, search by name or text, and micro to edit a file.

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

何をするか

  • 欄・トーストを描く
  • /atlas を足す
  • session.end・session.start・ui.close・ui.focus ほか 2 個にフックする
  • ターンをまたいで自分の状態を持つ
  • ネットワークに出る

良いところ

  • TypeScript で書かれている
  • デスクトップ専用の分岐がある
  • エラーを扱う

作り始めるためのコード

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

雛形(register.tsx)

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

// Drawn like atlas by jamubc (pane, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/jamubc-atlas/
// 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: "Atlas" })
  on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
    const { Box, Text, Button } = $.ui.resolve(e)
    const printable = '…'
    const printable2 = '…'
    const printable3 = '…'
    const changed = '…'
    const line = '…'
    const nameOf = '…'
    const name = '…'
    const relOf = '…'
    const size = '…'
    const items = '…'
    const date = '…'
    const MARK_NAMES = '…'
    const tilde = '…'
    const program = '…'
    return (
      <Box flexDirection="column">
        <Box flexDirection="row" gap={1} flexWrap="wrap">
          <Box flexShrink={0}>
            <Text bold color="cyan">
              Atlas
            </Text>
          </Box>
          <Box flexDirection="row" flexShrink={1} flexWrap="wrap">
            <Text dimColor>
              {"… "}
            </Text>
            <Box flexDirection="row">
              <Text bold>
                {printable}
              </Text>
              <Text dimColor>
                {" › "}
              </Text>
            </Box>
            <Box flexDirection="row">
              <Text bold>
                {printable2}
              </Text>
              <Text dimColor>
                {" › "}
              </Text>
            </Box>
            <Box flexDirection="row">
              <Text bold>
                {printable3}
              </Text>
              <Text dimColor>
                {" › "}
              </Text>
            </Box>
          </Box>
          <Box flexGrow={1} />
          <Text color="yellow">
            {`${changed} changed`}
          </Text>
          <Button plain hotkey="u" label="Up" />
          <Button plain hotkey="h" label="Hide dotfiles" />
          <Button plain hotkey="z" label="Collapse" />
          <Button plain hotkey="g" label="Refresh" />
        </Box>
        <Text color="yellow" wrap="truncate-end">
          {line}
        </Text>
        <Box flexDirection="row" gap={2}>
          <Box flexShrink={0} flexDirection="column" />
          <Box flexDirection="column" flexGrow={1}>
            <Text bold>
              Properties
            </Text>
            <Box flexDirection="column">
              <Box flexDirection="row">
                <Box width={10} flexShrink={0}>
                  <Text dimColor>
                    Name
                  </Text>
                </Box>
                <Text wrap="truncate-middle">
                  {nameOf}
                </Text>
              </Box>
              <Box flexDirection="row">
                <Box width={10} flexShrink={0}>
                  <Text dimColor>
                    Class
                  </Text>
                </Box>
                <Text wrap="truncate-middle">
                  {name}
                </Text>
              </Box>
              <Box flexDirection="row">
                <Box width={10} flexShrink={0}>
                  <Text dimColor>
                    Path
                  </Text>
                </Box>
                <Text wrap="truncate-middle">
                  {relOf}
                </Text>
              </Box>
              <Box flexDirection="row">
                <Box width={10} flexShrink={0}>
                  <Text dimColor>
                    Size
                  </Text>
                </Box>
                <Text wrap="truncate-middle">
                  {size}
                </Text>
              </Box>
              <Box flexDirection="row">
                <Box width={10} flexShrink={0}>
                  <Text dimColor>
                    Items
                  </Text>
                </Box>
                <Text wrap="truncate-middle">
                  {items}
                </Text>
              </Box>
              <Box flexDirection="row">
                <Box width={10} flexShrink={0}>
                  <Text dimColor>
                    Modified
                  </Text>
                </Box>
                <Text wrap="truncate-middle">
                  {date}
                </Text>
              </Box>
              <Box flexDirection="row">
                <Box width={10} flexShrink={0}>
                  <Text dimColor>
                    Git
                  </Text>
                </Box>
                <Text wrap="truncate-middle">
                  {MARK_NAMES}
                </Text>
              </Box>
              <Box flexDirection="row">
                <Box width={10} flexShrink={0}>
                  <Text dimColor>
                    Links to
                  </Text>
                </Box>
                <Text wrap="truncate-middle">
                  {tilde}
                </Text>
              </Box>
            </Box>
            <Text bold>
              Actions
            </Text>
            <Box flexDirection="row" flexWrap="wrap" columnGap={2}>
              <Button plain hotkey="e" label={`Edit in ${program}`} />
              <Button plain hotkey="o" label="Open as root" />
              <Button plain hotkey="p" label="Add to prompt" />
              <Button plain hotkey="c" label="Copy path" />
              <Button plain hotkey="a" label="Open with app" />
              <Button plain hotkey="r" label="Rename" />
              <Button plain hotkey="d" label="Duplicate" />
              <Button plain hotkey="x" label="Trash" />
              <Button plain hotkey="n" label="New file" />
              <Button plain hotkey="f" label="New folder" />
            </Box>
            <Text bold>
              Preview
            </Text>
          </Box>
        </Box>
      </Box>
    )
  })

  on('session.start', async ($, e, next) => {
    const relOf = '…'
    await $.ui.toast(`Added @${relOf} to your prompt.`)
    await $.ui.toast(`Copied the path.`)
    return next(e)
  })
}

Mod 自身のコード

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

plugins/atlas/hooks/register.tsx 818〜977 行 · ペイン
  on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
    const elements = $.ui.resolve(e)
    const { Box, Button, Code, Markdown, Text } = elements
    paneBody = { columns: e.props.bodyColumns, rows: e.props.scroll.bodyRows }
    // Drawn from what this process kept after a /clear; the host gets it back off the render.
    if (!(await read($, seeded))) $.clock.after(0, () => void reseed($).catch(() => {}))
    const shown = await read($, snapshot)
    const { editing: now, root: base } = shown

    if (now !== null) {
      const rel = relOf(now.path, base)
      if (now.status === 'error' || e.surface !== 'terminal') {
        editorView = null
        return (
          <Box flexDirection="column">
            <Text color="red">{now.message ?? `${program} draws only in Claude Code's terminal.`}</Text>
            <Button key="back" variant="primary" label="Back to files" onPress={() => write($, 'editing', () => null)} />
          </Box>
        )
      }
      const { Client, Raster } = $.ui.resolve(e)
      const view = { columns: e.props.bodyColumns, rows: Math.max(3, e.props.scroll.bodyRows - EDITOR_HEADER_ROWS) }
      editorView = view
      const fits = frame !== null && frame.columns === view.columns && frame.rows === view.rows
      // Ctrl+C and Ctrl+Z never reach the editor (Claude Code keeps them), and
      // Escape hands the keys back to the prompt: these send them instead.
      const send = (text: string) => () => call($, '/text', { text })
      return (
        <Box flexDirection="column">
          <Box flexDirection="row" gap={1}>
            <Button key="esc" label="Esc" onPress={send('\x1b')} />
            <Button key="copy" label="Copy" onPress={send('\x03')} />
            <Button key="undo" label="Undo" onPress={send('\x1a')} />
            <Text wrap="truncate-end">
              <Text bold>{now.status === 'starting' ? `Starting ${program}…` : program}</Text>
              <Text dimColor>{` ${rel} · click the text to type · Ctrl+S save · Ctrl+Q quit`}</Text>
            </Text>
          </Box>
          <Box width={view.columns} height={view.rows}>
            <Raster key="editor" columns={view.columns} rows={view.rows} cells={fits ? (frame as Frame).cells : blankCells(view)} />
            <Box position="absolute" top={0} left={0}>
              <Client key="terminal" module="./terminal.tsx" width={view.columns} height={view.rows} />
            </Box>
          </Box>
        </Box>
      )
    }
    editorView = null

    const hidden = shown.showHidden
    const marks = shown.git
    // Indexed once for this drawing: every folder row asks it below.
    const marksByPath = indexMarks(marks, base)
    const allListings = shown.listings
    const shownListings = hidden
      ? allListings
      : Object.fromEntries(Object.entries(allListings).map(([dir, entries]) => [dir, entries.filter(entry => !isHidden(entry.name))]))
    const tree = rows(base, shownListings, shown.expanded, TREE_LIMITS)
    const hiddenCount = (allListings[base] ?? []).filter(entry => isHidden(entry.name)).length
    const chosen = shown.selected
    const info = shown.details
    const hits = shown.results
    const named = shown.naming
    const line = shown.notice
    const typed = shown.query
    const how = shown.mode
    const pixels = shown.hasPixels
    const width = e.props.bodyColumns
    const isWide = width >= 90
    const treeWidth = isWide ? Math.min(48, Math.floor(width * 0.42)) : width
    const canType = e.surface !== 'mobile' // mobile draws no Input: naming needs one
    const changed = Object.keys(marks).length
    const setMode = async (next: SearchMode) => {
      await write($, 'mode', () => next)
      if (typed.trim()) await search($, typed)
    }
    const toggleHidden = async () => {
      const next = !hidden
      await write($, 'showHidden', () => next)
      try {
        await $.store.set('showHidden', next)
      } catch {}
    }
    const collapseAll = async () => {
      await write($, 'expanded', () => [])
      await remember($)
    }

    let finder = null
    if (e.surface !== 'mobile') {
      const { Input } = $.ui.resolve(e)
      finder = (
        <Box flexDirection="row" gap={1}>
          <Box flexGrow={1} flexShrink={1}>
            <Input key="find" label="⌕ " placeholder={how === 'text' ? 'text inside files under this folder' : 'part of a name under this folder'}
              value={typed} submitLabel="search" onSubmit={value => search($, value)} />
          </Box>
          {how === 'names'
            ? <Text bold inverse>{' names '}</Text>
            : <Button key="mode-names" plain label="names" onPress={() => setMode('names')} />}
          {how === 'text'
            ? <Text bold inverse>{' text '}</Text>
            : <Button key="mode-text" plain label="text" onPress={() => setMode('text')} />}
        </Box>
      )
    }

    let asking = null
    if (named !== null && e.surface !== 'mobile') {
      const { Input } = $.ui.resolve(e)
      const label = named.action === 'rename' ? `Rename ${nameOf(named.target)} to`
        : `New ${named.action} in ${named.target === base ? tilde(base) : relOf(named.target, base)}`
      asking = (
        <Box flexDirection="row" gap={1}>
          <Box flexGrow={1}>
            <Input key="name" label={label} autoFocus value={named.action === 'rename' ? nameOf(named.target) : ''}
              submitLabel={named.action === 'rename' ? 'rename' : 'create'} onSubmit={value => finishNaming($, value)} />
          </Box>
          <Button key="cancel" plain label="Cancel" onPress={() => write($, 'naming', () => null)} />
        </Box>
      )
    }

    let explorer
    if (hits !== null) {
      explorer = (
        <Box flexDirection="column">
          <Box flexDirection="row" gap={1}>
            <Text bold>{`${hits.length}${hits.length === SEARCH_LIMIT ? '+' : ''} found`}</Text>
            <Button key="clear" plain label="Back to the tree" onPress={() => write($, 'results', () => null)} />
          </Box>
          {hits.map((hit, index) => {
            const where = relOf(hit.path, base)
            const key = hit.line === undefined ? `r:${relative(hit.path, base)}` : `r:${relative(hit.path, base)}:${hit.line}`
            return (
              <Box key={`hit-${index}`} flexDirection="column">
                <Button key={key} plain label={hit.line === undefined ? where : `${where}:${hit.line}`} onPress={() => reveal($, hit.path, hit.line)} />
                {hit.text !== undefined && <Text dimColor wrap="truncate-end">{`    ${hit.text}`}</Text>}
              </Box>
            )
          })}
        </Box>
      )
    } else {
      // The focus ring starts in the tree, so the arrows walk it at once.
      const firstEntry = tree.find(row => row.type === 'entry')
      const ringStart = tree.some(row => row.path === chosen) ? chosen : firstEntry?.path
      explorer = (
        <Box flexDirection="column">
          {tree.length === 0 && <Text dimColor>{hiddenCount > 0 ? `Only hidden files here (${hiddenCount}).` : 'This folder is empty.'}</Text>}
          {tree.map(row => {
            const indent = '  '.repeat(row.depth)
            if (row.type === 'more') return <Text key={`more:${relative(row.path, base)}`} dimColor>{`  ${indent}… ${row.hidden} more`}</Text>
            if (row.type === 'cut') return <Text key="cut" dimColor>  … more: close some folders, or use Find</Text>
            const kind = classOf(row.entry.name, row.entry.kind, row.entry.isLink)
            const isChosen = row.path === chosen
            const mark = row.entry.kind === 'dir' ? markFor(marksByPath, row.path) : marks[row.path] ?? null
            return (
              <Box key={`row:${relative(row.path, base)}`} flexDirection="row" hover={{ backgroundColor: '#1c2730' }}>
                <Text color="cyan">{isChosen ? '▌' : ' '}</Text>
ライセンスの全文(MIT)
MIT License

Copyright (c) 2026 jamubc

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

載せる条件: 確かめやすいコード
入口を読んだhooks/hooks.json が名指すモジュールをすべて読んだ。plugins/atlas/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/atlas/hooks/register.tsx:412 find(Windows にない); plugins/atlas/hooks/register.tsx:520 cp(Windows にない)
通信fetch の送り先(https のホスト)がコードに書いてあるか。plugins/atlas/hooks/register.tsx:595 fetch(`http://atlas${route}`)
プログラム起動するプログラムの名前がコードに書いてあり、シェル・インタプリタ・通信用の道具でないか。plugins/atlas/hooks/register.tsx:438 実行時に決まるプログラム; plugins/atlas/hooks/register.tsx:495 実行時に決まるプログラム; plugins/atlas/hooks/register.tsx:547 実行時に決まるプログラム; plugins/atlas/hooks/register.tsx:580 実行時に決まるプログラム; plugins/atlas/hooks/register.tsx:637 実行時に決まるプログラム
読んで送るファイルや環境変数を読み、かつ通信するか。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 jamubc/toolbox
/plugin install atlas@toolbox

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

Claude に聞く

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

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

Claude から探す: MCP コネクタ

似たデザイン