modscode EN

modscode / 図鑑 / linear-claude-mod

linear-claude-mod

A Claude Code pane of your assigned Linear tickets by status; click one to load it into the session, read its details, comment, or change its status and priority

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

何をするか

  • 欄・トーストを描く
  • /tickets を足す
  • session.startにフックする
  • プロセスを起こす

良いところ

  • ネットワークに出ない
  • TypeScript で書かれている
  • エラーを扱う
  • ファイルを書かない

作り始めるためのコード

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

雛形(register.tsx)

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

// Drawn like linear-claude-mod by rjohnt (pane, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/rjohnt-linear-claude-mod/
// 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: "Linear" })
  on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
    const { Box, Button, Text, Input, Select, Markdown } = $.ui.resolve(e)
    const id = '…'
    const title = '…'
    const meta = '…'
    const labels = '…'
    const branch = '…'
    const saving = '…'
    const stateValue = '…'
    const priority = '…'
    const detailError = '…'
    const length = '…'
    const author = '…'
    const ago = '…'
    const body = '…'
    const author2 = '…'
    const author3 = '…'
    return (
      <Box flexDirection="column" gap={1}>
        <Box justifyContent="space-between">
          <Button plain hotkey="b" label="Back to list" />
          <Box gap={2}>
            <Button plain hotkey="w" label="Work on this" />
            <Button plain hotkey="o" label="Open in Linear" />
          </Box>
        </Box>
        <Box flexDirection="column">
          <Text bold>
            {id}
            {" "}
            {title}
          </Text>
          <Text dimColor>
            {meta}
          </Text>
          <Text color="magenta">
            {labels}
          </Text>
          <Text dimColor>
            {"branch "}
            {branch}
          </Text>
        </Box>
        <Box flexDirection="column">
          <Box gap={2}>
            <Button plain hotkey="c" label="Comment" />
            <Button plain hotkey="m" label="Move" />
            <Button plain hotkey="p" label="Priority" />
            <Button plain hotkey="x" label="Cancel" />
          </Box>
          <Text dimColor>
            {saving}
          </Text>
          <Input label="Comment: " placeholder="Markdown; Enter posts it" submitLabel="post" autoFocus />
          <Text dimColor>
            Loading statuses…
          </Text>
          <Select label="Move to: " value={`${stateValue}`} autoFocus />
          <Select label="Priority: " value={`${priority}`} autoFocus />
        </Box>
        <Text dimColor>
          Loading ticket…
        </Text>
        <Text color="red">
          {"Linear: "}
          {detailError}
        </Text>
        <Markdown text="_No description._" />
        <Box flexDirection="column">
          <Text bold>
            Comments (
            {length}
            )
          </Text>
          <Text dimColor>
            None yet.
          </Text>
          <Box flexDirection="column" marginTop={1}>
            <Text color="cyan">
              {author}
              <Text dimColor>
                {`  ${ago}`}
              </Text>
            </Text>
            <Markdown text={`${body}`} />
          </Box>
          <Box flexDirection="column" marginTop={1}>
            <Text color="cyan">
              {author2}
              <Text dimColor>
                {`  ${ago}`}
              </Text>
            </Text>
            <Markdown text={`${body}`} />
          </Box>
          <Box flexDirection="column" marginTop={1}>
            <Text color="cyan">
              {author3}
              <Text dimColor>
                {`  ${ago}`}
              </Text>
            </Text>
            <Markdown text={`${body}`} />
          </Box>
        </Box>
      </Box>
    )
  })

  on('session.start', async ($, e, next) => {
    const url = '…'
    const id = '…'
    await $.ui.toast(`Couldn't open a browser: ${url}`)
    await $.ui.toast(`Loading ${id} into the session`)
    return next(e)
  })
}

Mod 自身のコード

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

hooks/register.tsx 216〜375 行 · ペイン
  on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
    const ui = $.ui.resolve(e)
    const { Box, Text, Button, Markdown } = ui
    // Mobile draws no Input or Select yet, so it gets no actions.
    const fields = 'Input' in ui && 'Select' in ui ? { Input: ui.Input, Select: ui.Select } : null
    const now = await $.clock.now()
    const {
      selected,
      detail,
      isLoading: isDetailLoading,
      error: detailError,
      action,
      states,
      saving,
    } = await read($, view)

    if (selected) {
      const t = detail ?? selected
      const meta = [
        t.status,
        PRIORITY_LABEL[t.priority]?.trim() || null,
        t.project,
        detail?.assignee,
        detail?.updatedAt ? `updated ${ago(now - Date.parse(detail.updatedAt))}` : null,
      ].filter(Boolean)

      return (
        <Box flexDirection="column" gap={1}>
          <Box justifyContent="space-between">
            <Button key="back" plain hotkey="b" label="Back to list" onPress={() => void backToList($)} />
            <Box gap={2}>
              <Button
                key="work"
                plain
                hotkey="w"
                label="Work on this"
                onPress={() => {
                  void $.prompt.submit({ text: workPrompt(selected), asUser: true })
                  $.ui.toast(`Loading ${selected.id} into the session`)
                }}
              />
              <Button key="open" plain hotkey="o" label="Open in Linear" onPress={() => void openUrl($, t.url)} />
            </Box>
          </Box>
          <Box flexDirection="column">
            <Text bold>
              {t.id}  {t.title}
            </Text>
            <Text dimColor>{meta.join(' · ')}</Text>
            {detail && detail.labels.length > 0 && <Text color="magenta">{detail.labels.join(', ')}</Text>}
            {detail?.branch && <Text dimColor>branch {detail.branch}</Text>}
          </Box>
          {fields && (
            <Box flexDirection="column">
              <Box gap={2}>
                <Button key="act:comment" plain hotkey="c" label="Comment" onPress={() => void openAction($, 'comment')} />
                <Button key="act:move" plain hotkey="m" label="Move" onPress={() => void openAction($, 'move')} />
                <Button key="act:priority" plain hotkey="p" label="Priority" onPress={() => void openAction($, 'priority')} />
                {action && <Button key="act:cancel" plain hotkey="x" label="Cancel" onPress={() => void closeAction($)} />}
              </Box>
              {saving && <Text dimColor>{saving}</Text>}
              {!saving && action === 'comment' && (
                <fields.Input
                  key={ACTION_KEY.comment}
                  label="Comment: "
                  placeholder="Markdown; Enter posts it"
                  submitLabel="post"
                  autoFocus
                  onSubmit={value => void postComment($, value)}
                />
              )}
              {!saving && action === 'move' && !states && <Text dimColor>Loading statuses…</Text>}
              {!saving && action === 'move' && states && states.length > 0 && (
                <fields.Select
                  key={ACTION_KEY.move}
                  label="Move to: "
                  options={states.map(s => ({ value: stateValue(s), label: s.name }))}
                  value={stateValue(states.find(s => s.name === t.status) ?? states[0]!)}
                  autoFocus
                  onSelect={value => void moveTo($, value)}
                />
              )}
              {!saving && action === 'priority' && (
                <fields.Select
                  key={ACTION_KEY.priority}
                  label="Priority: "
                  options={PRIORITY_OPTIONS}
                  value={String(t.priority)}
                  autoFocus
                  onSelect={value => void setPriority($, value)}
                />
              )}
            </Box>
          )}
          {isDetailLoading && <Text dimColor>Loading ticket…</Text>}
          {detailError && <Text color="red">Linear: {detailError}</Text>}
          {detail && (
            <Markdown key="description" text={detail.description.trim() || '_No description._'} />
          )}
          {detail && (
            <Box flexDirection="column">
              <Text bold>Comments ({detail.comments.length})</Text>
              {detail.comments.length === 0 && <Text dimColor>None yet.</Text>}
              {detail.comments.map((c, i) => (
                <Box key={`c:${i}`} flexDirection="column" marginTop={1}>
                  <Text color="cyan">
                    {c.author}
                    <Text dimColor>{c.createdAt ? `  ${ago(now - Date.parse(c.createdAt))}` : ''}</Text>
                  </Text>
                  <Markdown key={`cm:${i}`} text={c.body} />
                </Box>
              ))}
            </Box>
          )}
        </Box>
      )
    }

    const { tickets, loadedAt, isLoading, error } = await read($, board)
    const cols = e.props.bodyColumns || e.viewport?.columns || 80
    const room = Math.max(3, (e.viewport?.rows ?? 24) - 3)
    const groups = groupTickets(tickets)

    const rows: RenderNode[] = []
    let hotkey = 1
    for (const g of groups) {
      if (rows.length >= room) break
      rows.push(
        <Text key={`h:${g.status}`} bold color={g.tickets[0]?.statusType === 'started' ? 'cyan' : undefined}>
          {g.status} ({g.tickets.length})
        </Text>,
      )
      for (const t of g.tickets) {
        if (rows.length >= room) break
        const key = hotkey <= 9 ? String(hotkey++) : undefined
        const label = `${PRIORITY_LABEL[t.priority] ?? '   '} ${t.id}  ${t.title}`
        rows.push(
          <Button
            key={t.id}
            plain
            hotkey={key}
            dimColor={t.statusType === 'backlog'}
            label={label.length > cols - 6 ? `${label.slice(0, cols - 7)}…` : label}
            onPress={() => void showTicket($, t)}
          />,
        )
      }
    }
    const hidden = tickets.length + groups.length - rows.length

    return (
      <Box flexDirection="column">
        <Box justifyContent="space-between">
          <Text dimColor>
            {isLoading ? 'Refreshing…' : loadedAt ? `${tickets.length} open · ${ago(now - loadedAt)}` : ''}
          </Text>
          <Button key="refresh" plain hotkey="r" label="Refresh" onPress={() => void refresh($)} />
        </Box>
        {error && <Text color="red">Linear: {error}</Text>}
        {!isLoading && !error && loadedAt && tickets.length === 0 && <Text dimColor>No open tickets assigned to you.</Text>}
ライセンスの全文(MIT)
MIT License

Copyright (c) 2026 Ryan Timmons

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

載せる条件: 確かめやすいコード
入口を読んだhooks/hooks.json が名指すモジュールをすべて読んだ。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 のホスト)がコードに書いてあるか。通信なし
プログラム起動するプログラムの名前がコードに書いてあり、シェル・インタプリタ・通信用の道具でないか。hooks/register.tsx:92 実行時に決まるプログラム
読んで送るファイルや環境変数を読み、かつ通信するか。通信しない
ソースの鍵ソースに 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 のデザイン「rjohnt-linear-claude-mod」をコードごと読んで、同じようなペインを作って

Claude から探す: MCP コネクタ

似たデザイン