modscode EN

modscode / 図鑑 / needs-you

needs-you

Band above the prompt showing what the session needs from you and where the branch stands

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

何をするか

  • プロンプトの上の帯を描く
  • Bash・Agent の呼び出しを見張る
  • prompt.submit・session.start・turn.completeにフックする
  • プロセスを起こす

良いところ

  • ネットワークに出ない
  • 小さい(393 行)
  • TypeScript で書かれている
  • エラーを扱う

作り始めるためのコード

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

雛形(register.tsx)

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

// Drawn like needs-you by maximmaxim345 (band), as modscode read it from the mod's code:
// https://modscode.com/gallery/maximmaxim345-needs-you/
// 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, Text, Button } = $.ui.resolve(e)
    const topic = '…'
    const text = '…'
    const minutesSince = '…'
    const text2 = '…'
    const minutesSince2 = '…'
    const text3 = '…'
    const minutesSince3 = '…'
    const length = '…'
    const done = '…'
    const label = '…'
    const text4 = '…'
    const text5 = '…'
    const text6 = '…'
    const length2 = '…'
    const gitParts = '…'
    const command = '…'
    return (
      <Box flexDirection="column">
        <Text dimColor wrap="truncate-end">
          {"TLDR: "}
          {topic}
        </Text>
        <Box flexDirection="row" gap={1}>
          <Text color="yellow" wrap="truncate-end">
            {"● Needs you: "}
            {text}
            {minutesSince}
          </Text>
          <Button label="x" plain dimColor />
        </Box>
        <Box flexDirection="row" gap={1}>
          <Text color="yellow" wrap="truncate-end">
            {"● Needs you: "}
            {text2}
            {minutesSince2}
          </Text>
          <Button label="x" plain dimColor />
        </Box>
        <Box flexDirection="row" gap={1}>
          <Text color="yellow" wrap="truncate-end">
            {"● Needs you: "}
            {text3}
            {minutesSince3}
          </Text>
          <Button label="x" plain dimColor />
        </Box>
        <Text dimColor>
          +
          {length}
          {" older asks"}
        </Text>
        <Text dimColor wrap="truncate-end">
          {"Done: "}
          {done}
        </Text>
        <Box flexDirection="row" gap={1}>
          <Button label={`${label}`} hotkey={`${label}`} />
          <Button label={`${label}`} hotkey={`${label}`} />
          <Button label={`${label}`} hotkey={`${label}`} />
          <Button label="Copy draft" hotkey="c" />
        </Box>
        <Box flexDirection="row" gap={1}>
          <Text color="magenta" wrap="truncate-end">
            {"◆ Later: "}
            {text4}
          </Text>
          <Button label="x" plain dimColor />
        </Box>
        <Box flexDirection="row" gap={1}>
          <Text color="magenta" wrap="truncate-end">
            {"◆ Later: "}
            {text5}
          </Text>
          <Button label="x" plain dimColor />
        </Box>
        <Box flexDirection="row" gap={1}>
          <Text color="magenta" wrap="truncate-end">
            {"◆ Later: "}
            {text6}
          </Text>
          <Button label="x" plain dimColor />
        </Box>
        <Text dimColor>
          +
          {length2}
          {" older later"}
        </Text>
        <Text dimColor wrap="truncate-end">
          {gitParts}
        </Text>
        <Box flexDirection="row" gap={1}>
          <Button label={`${command}`} dimColor />
          <Button label={`${command}`} dimColor />
          <Button label={`${command}`} dimColor />
        </Box>
        {await next(e)}
      </Box>
    )
  })
}

Mod 自身のコード

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

claude/mods/needs-you/hooks/register.tsx 260〜392 行 · バンド
  on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
    if (e.props.hasSurvey) return next(e)

    const open = await read($, items)
    const latest = e.props.isWorking ? null : await read($, reply)
    const asks = latest === null ? [] : open.filter(i => i.kind !== 'later')
    const later = open.filter(i => i.kind === 'later')
    const facts = await read($, git)
    const ran = await read($, checks)
    const current = await read($, now)
    const topic = await read($, tldr)
    if (open.length === 0 && latest === null && facts === null && topic === null) return next(e)

    const { Box, Button, Text } = $.ui.resolve(e)

    const fill = async (text: string) => {
      const box = await $.prompt.read()
      const isEmpty = box.text.trim() === ''
      await $.prompt.fill(
        isEmpty ? { text, mode: 'replace' } : { text: `\n${text}`, mode: 'append' },
      )
    }

    const start = async (command: string) => {
      const typed = (await $.prompt.read()).text.trim()
      const previous = COMMANDS.find(c => typed === c || typed.startsWith(`${c} `))
      const args = previous === undefined ? typed : typed.slice(previous.length).trim()
      await $.prompt.fill({ text: `${command} ${args}`, mode: 'replace' })
    }

    const dismiss = (item: Item) => (
      <Button
        key={`dismiss-${item.id}`}
        label="x"
        plain
        dimColor
        onPress={() => void update($, items, (list: Item[]) => list.filter(i => i.id !== item.id))}
      />
    )

    const replyButtons =
      latest === null
        ? []
        : [
            ...latest.options.map((o, i) => (
              <Button
                key={`opt-${i}`}
                label={o.label}
                hotkey={/^[1-9]$/.test(o.label) ? o.label : undefined}
                onPress={() => void fill(o.fill)}
              />
            )),
            ...(latest.draft === null
              ? []
              : [
                  <Button
                    key="copy"
                    label="Copy draft"
                    hotkey="c"
                    onPress={p => void $.ui.copy({ text: latest.draft!, surface: p.surface })}
                  />,
                ]),
          ]

    const gitParts: string[] = []
    if (facts !== null) {
      gitParts.push(facts.branch)
      if (facts.unpushed > 0) {
        gitParts.push(`${facts.unpushed} unpushed${facts.hasUpstream ? '' : ' (no upstream)'}`)
      }
      if (facts.uncommitted > 0) gitParts.push(`${facts.uncommitted} uncommitted`)
      if (facts.unpushed > 0) {
        gitParts.push(ran.audit ? 'audit ran' : 'audit not run')
        if (facts.needsSage) gitParts.push(ran.sage ? 'ohf-sage ran' : 'ohf-sage not run')
      }
    }

    return (
      <Box flexDirection="column">
        {topic !== null && (
          <Text dimColor wrap="truncate-end">
            TLDR: {topic}
          </Text>
        )}
        {asks.slice(-SHOWN).map(item => (
          <Box key={`ask-${item.id}`} flexDirection="row" gap={1}>
            <Text color="yellow" wrap="truncate-end">
              ● Needs you: {item.text}
              {minutesSince(item.at, current)}
            </Text>
            {dismiss(item)}
          </Box>
        ))}
        {asks.length > SHOWN && <Text dimColor>+{asks.length - SHOWN} older asks</Text>}
        {latest?.done != null && (
          <Text dimColor wrap="truncate-end">
            Done: {latest.done}
          </Text>
        )}
        {replyButtons.length > 0 && (
          <Box flexDirection="row" gap={1}>
            {replyButtons}
          </Box>
        )}
        {later.slice(-SHOWN).map(item => (
          <Box key={`later-${item.id}`} flexDirection="row" gap={1}>
            <Text color="magenta" wrap="truncate-end">
              ◆ Later: {item.text}
            </Text>
            {dismiss(item)}
          </Box>
        ))}
        {later.length > SHOWN && <Text dimColor>+{later.length - SHOWN} older later</Text>}
        {gitParts.length > 0 && (
          <Text dimColor wrap="truncate-end">
            {gitParts.join(' · ')}
          </Text>
        )}
        {!e.props.isWorking && (
          <Box flexDirection="row" gap={1}>
            {COMMANDS.map(command => (
              <Button
                key={`cmd-${command}`}
                label={command}
                dimColor
                onPress={() => void start(command)}
              />
            ))}
          </Box>
        )}
      </Box>
    )
  })
ライセンスの全文(MIT)
The MIT License

Copyright (c) Maxim Raznatovski

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

載せる条件: 確かめやすいコード
入口を読んだhooks/hooks.json が名指すモジュールをすべて読んだ。claude/mods/needs-you/hooks/register.tsx
解析できるすべてのファイルが 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 のホスト)がコードに書いてあるか。通信なし
プログラム起動するプログラムの名前がコードに書いてあり、シェル・インタプリタ・通信用の道具でないか。git(通信する)
読んで送るファイルや環境変数を読み、かつ通信するか。通信するが、ファイルも環境変数も読まない
ソースの鍵ソースに API キーや秘密鍵らしきものがあるか。ソースに鍵なし
ライセンスオープンなライセンス(MIT・Apache-2.0・BSD・ISC・Unlicense・0BSD・CC0)で全文があれば、modscode にコードを載せる。違えばリンクだけ。MIT

コードの文面を読んだだけで、安全の審査ではありません。動かしてはおらず、起動するプログラムの中で何が起きるかも見えません。入れる前の確認はあなたの役目です。 載せる条件

入れる

入れる前に、必ず自分で確かめてください。Mod はサンドボックスなしで、あなたの権限で動きます。modscode はこのコードの安全を保証しません。下のコードを読み(またはフォルダーで claude plugin validate .)、触るものを見て、読んだコミットを入れてください。

リポジトリの .claude-plugin/marketplace.json にこの Mod が載っていないため、入れる手順は出せません。コードとして読むか、作者の README に従ってください。

Claude に聞く

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

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

Claude から探す: MCP コネクタ

似たデザイン