SLOPSHOPPER

mod-store

/mods: browse, search and install community Claude Code mods from a pane, with what each one can access shown before you install

paneguardcommandtoasttoolprocess
★ 7v0.1.1MITupdated 2026-10-12hellosverre/mod-store
A shopper browsing a rack in a slop shop
Preview · a replayed session in a sandbox
claude · ~/work/app · mod-store
│ ┃ Mod Store ✕ › fix the failing auth test and add an audit log call │ ┃ Search 2,700 mods… spotify, usage, git, pet │ ┃ ⏺ Read(src/auth.ts) │ ┃ [ ✦ Ask Claude ] [ All ] One-click Display o ⎿ Read 6 lines │ ┃ ⏺ Update(src/auth.ts) │ ┃ Loading the catalogue… Most stars ▾ ⎿ Added 2 lines, removed 1 line │ ┃ ⏺ Bash(bun test) │ ⎿ 3 pass, 1 fail │ │ ● Done. refresh now rejects expired claims and logs an audit event. │ │ ✻ Worked for 42s · done 4:20 PM │ │ › /mods │ ⎿ mod-store: Mod Store opened. │ │ ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── › ? for shortcuts

Draws

Pane · Mod Store
Search 2,700 mods… spotify, usage, git, pet ⏎ search [ ✦ Ask Claude ] [ All ] One-click Display only Panes Bands Loading the catalogue… Most stars ▾
README

Mod Store for Claude Code

An app store for Claude Code mods, inside Claude Code. Type /mods, search about 2,700 community mods, see what each one can access, and install it with one click. Or just ask Claude: "find me a mod that shows my Spotify song".

Mod Store demo

Install

claude plugin install mod-store --marketplace hellosverre/mod-store

Then run /reload-plugins and type /mods. Needs a Claude Code version with mods (tested on 2.1.292).

What it does

  • Browse and search every public mod in a side pane, sorted by stars, newest, or A to Z. Big repos with dozens of mods don't flood the top: the star sort shows each repo's best mod first.
  • Filter to one-click installs, display-only mods, side panes, or bands above the prompt.
  • See the access before you install. Every mod gets a badge, from green Display only to red Network, and its page lists what it can read, run and see, and where it shows up.
  • Install safely. Install shows the exact command and the mod's permissions, and waits for you to confirm. Mods are installed with claude plugin install, never with -y, so a marketplace's own commands are never auto-accepted.
  • Ask Claude. The mod gives Claude two tools, search_mods and show_mod. Describe what you want and Claude searches, compares a few, explains what each can access, and opens the best one. Claude can't install anything: you press Install yourself.

Keys

KeyWhereDoes
i, then ya mod's pageInstall, then confirm
ba mod's pageBack to the list
Tab / arrows, EnteranywhereMove between items, open one

How it works

The catalogue comes from mods.aidojo.si, which indexes public mods on GitHub, checks them with claude plugin validate, and works out what each one can reach. Mod Store downloads it in pieces (it's 7.5 MB), keeps a slimmed copy for six hours, and checks claude plugin list to mark what you already have.

Mod Store itself uses the network (to fetch the catalogue) and runs claude plugin list and claude plugin install. It reads nothing else on your machine.

Develop

claude plugin validate .
claude plugin test .

More mods

  • skins: tool rows with icons, diff and chart cards, fifteen themes
  • redgreen: test results in a pane beside the chat
  • smart-compact: compacts after a commit, green tests, before the prompt cache expires, or when Claude asks

License

MIT

Source 2 files
hooks/register.tsx 641 lines
1import { atom, read, update } from 'claude-code'
2import type { EngineInterface, Register } from 'claude-code'
3
4import type { Filter, Mod, Sort } from '../types'
5
6const PANE = 'mod-store'
7const CATALOG_URL = 'https://mods.aidojo.si/mods.json'
8// v2: v1 copies dropped the catalogue's `other:` access labels.
9const CACHE_KEY = 'catalog-v2'
10const MAX_AGE_MS = 6 * 60 * 60 * 1000
11/** The host cuts long bodies short, so the 7.5 MB catalogue comes in ranges. */
12const CHUNK_BYTES = 2_000_000
13const PER_PAGE = 12
14
15const query = atom({ plugin: 'mod-store', key: 'query' } as const, '')
16const sort = atom({ plugin: 'mod-store', key: 'sort' } as const, 'stars')
17const filter = atom({ plugin: 'mod-store', key: 'filter' } as const, 'all')
18const page = atom({ plugin: 'mod-store', key: 'page' } as const, 0)
19const selected = atom({ plugin: 'mod-store', key: 'selected' } as const, null)
20const isConfirming = atom({ plugin: 'mod-store', key: 'isConfirming' } as const, false)
21const isBusy = atom({ plugin: 'mod-store', key: 'isBusy' } as const, false)
22const status = atom({ plugin: 'mod-store', key: 'status' } as const, '')
23const loadedAt = atom({ plugin: 'mod-store', key: 'loadedAt' } as const, 0)
24const installed = atom({ plugin: 'mod-store', key: 'installed' } as const, [])
25
26/** Access levels, least to most: what the badge says and its color. */
27const LEVELS = [
28  { badge: 'Display only', color: 'green' },
29  { badge: 'Reads', color: 'cyan' },
30  { badge: 'Writes & runs', color: 'yellow' },
31  { badge: 'Network', color: 'red' },
32]
33
34const SORTS = [
35  { value: 'stars', label: 'Most stars' },
36  { value: 'new', label: 'Newest' },
37  { value: 'name', label: 'A to Z' },
38]
39const CHIPS: { value: Filter; label: string }[] = [
40  { value: 'all', label: 'All' },
41  { value: 'installable', label: 'One-click' },
42  { value: 'safe', label: 'Display only' },
43  { value: 'pane', label: 'Panes' },
44  { value: 'band', label: 'Bands' },
45]
46
47/** Where a mod shows up, in words. */
48const PLACES: Record<string, string> = {
49  Pane: 'a side pane',
50  AbovePrompt: 'a band above the prompt',
51  PromptHint: 'the prompt hint',
52  SessionMode: 'the session mode line',
53  AssistantMessage: "Claude's replies",
54  UserMessage: 'your messages',
55  Spinner: 'the spinner',
56  ToolUse: 'tool rows',
57  ToolResult: 'tool results',
58  CommandOutput: 'command output',
59}
60
61/** The catalogue, slimmed. A module variable: rebuilt from the store on reload. */
62let catalog: Mod[] = []
63
64/**
65 * The catalogue files APIs it has no grade for under `other: $.api`. They are kept,
66 * reworded, so a mod that spawns processes never reads as "draw only".
67 */
68export const accessLabel = (label: string): string =>
69  label.startsWith('other:') ? `also uses ${label.slice('other:'.length).trim()}` : label
70
71/** Turns one catalogue record into the fields the pane draws. */
72export function slim(record: any): Mod | null {
73  if (record?.kind !== 'mod' || record.archived) return null
74  const root = (record.marketplaces ?? []).find(
75    (m: any) => m.path === '.claude-plugin/marketplace.json' && m.status !== 'failed',
76  )
77  return {
78    id: String(record.id),
79    name: String(record.name),
80    repo: String(record.repo),
81    description: String(record.description ?? '').slice(0, 240),
82    author: String(record.author ?? record.repo.split('/')[0]),
83    url: String(record.url ?? `https://github.com/${record.repo}`),
84    stars: Number(record.stars ?? 0),
85    createdAt: String(record.createdAt ?? ''),
86    level: Number(record.reach?.level ?? 2),
87    levelName: String(record.reach?.name ?? 'unknown'),
88    labels: (record.reach?.labels ?? []).map(accessLabel),
89    sees: record.sees ?? [],
90    draws: record.draws ?? [],
91    validate: String(record.validate?.status ?? 'unknown'),
92    marketplace: root ? String(root.name) : null,
93  }
94}
95
96/** The mods a query, filter and sort select, in order. */
97export function select(mods: Mod[], q: string, f: Filter, s: Sort): Mod[] {
98  const words = q.toLowerCase().split(/\s+/).filter(Boolean)
99  const kept = mods.filter(mod => {
100    if (f === 'installable' && !mod.marketplace) return false
101    if (f === 'safe' && mod.level > 0) return false
102    if (f === 'pane' && !mod.draws.includes('Pane')) return false
103    if (f === 'band' && !mod.draws.includes('AbovePrompt')) return false
104    const hay = `${mod.name} ${mod.description} ${mod.author} ${mod.repo}`.toLowerCase()
105    return words.every(w => hay.includes(w))
106  })
107  const order: Record<Sort, (a: Mod, b: Mod) => number> = {
108    stars: (a, b) => b.stars - a.stars || a.name.localeCompare(b.name),
109    new: (a, b) => b.createdAt.localeCompare(a.createdAt),
110    name: (a, b) => a.name.localeCompare(b.name),
111  }
112  const sorted = kept.sort(order[s])
113  if (s !== 'stars') return sorted
114  // Stars belong to a repo, not a mod: one big repo with 45 mods would fill
115  // every page. Take each repo's best first, then each one's second, and so on.
116  const seen = new Map<string, number>()
117  const turn = new Map(sorted.map(mod => {
118    const n = seen.get(mod.repo) ?? 0
119    seen.set(mod.repo, n + 1)
120    return [mod, n] as const
121  }))
122  return sorted.sort((a, b) => turn.get(a)! - turn.get(b)! || order.stars(a, b))
123}
124
125/** The id `claude plugin list` names an installed mod by. */
126const pluginId = (mod: Mod) => `${mod.name}@${mod.marketplace}`
127
128const level = (mod: Mod) => LEVELS[mod.level] ?? LEVELS[2]!
129
130/** What the confirmation says when the catalogue lists no access. Only a display-only mod is "draw only". */
131export const noLabels = (mod: Mod): string =>
132  mod.level === 0 ? 'draw only' : `${(LEVELS[mod.level] ?? LEVELS[2]!).badge.toLowerCase()} (the catalogue lists no details)`
133
134const plural = (n: number, word: string) => `${n.toLocaleString('en-US')} ${word}${n === 1 ? '' : 's'}`
135
136const clip = (text: string, max: number) => (text.length > max ? `${text.slice(0, max - 1).trimEnd()}…` : text)
137
138/** UTF-8 bytes `text` takes. */
139const utf8Bytes = (text: string): number => {
140  let n = 0
141  for (const char of text) {
142    const code = char.codePointAt(0)!
143    n += code < 0x80 ? 1 : code < 0x800 ? 2 : code < 0x10000 ? 3 : 4
144  }
145  return n
146}
147
148/**
149 * Reads the whole catalogue a range at a time, since one body is cut short. The host
150 * decodes each range on its own, so a character split across two ranges comes back as
151 * U+FFFD at the end of the first. That tail is dropped and the next range starts at the
152 * first byte not yet read whole.
153 */
154export async function fetchCatalogText($: Pick<EngineInterface, 'http'>): Promise<string> {
155  let text = ''
156  let total = Infinity
157  let start = 0
158  while (start < total) {
159    const res = await $.http.fetch(CATALOG_URL, {
160      headers: { Range: `bytes=${start}-${start + CHUNK_BYTES - 1}`, 'Accept-Encoding': 'identity' },
161    })
162    if (res.status === 200) return res.text
163    if (res.status !== 206) throw new Error(`HTTP ${res.status}`)
164    const size = /\/(\d+)\s*$/.exec(res.headers['content-range'] ?? '')
165    if (!size) throw new Error('the server sent no Content-Range')
166    total = Number(size[1])
167    const isLast = start + CHUNK_BYTES >= total
168    const whole = isLast ? res.text : res.text.replace(/�+$/, '')
169    if (whole === '') throw new Error(`no readable text at byte ${start}`)
170    text += whole
171    start += isLast ? CHUNK_BYTES : utf8Bytes(whole)
172  }
173  return text
174}
175
176async function loadCatalog($: EngineInterface, force = false) {
177  const cached = (await $.store.get(CACHE_KEY)) as { at: number; mods: Mod[] } | undefined
178  if (cached && catalog.length === 0) {
179    catalog = cached.mods
180    await update($, loadedAt, () => cached.at)
181  }
182  const now = await $.clock.now()
183  if (!force && cached && now - cached.at < MAX_AGE_MS) return
184
185  await update($, status, () => (catalog.length ? 'Refreshing…' : ''))
186  try {
187    const data = JSON.parse(await fetchCatalogText($))
188    const mods: Mod[] = []
189    const seen = new Set<string>()
190    for (const record of data.mods ?? []) {
191      const mod = slim(record)
192      if (!mod || seen.has(mod.id)) continue
193      seen.add(mod.id)
194      mods.push(mod)
195    }
196    catalog = mods
197    await $.store.set(CACHE_KEY, { at: now, mods })
198    await update($, loadedAt, () => now)
199    await update($, status, () => '')
200  } catch (error) {
201    const why = error instanceof Error ? error.message : String(error)
202    await update($, status, () => `Couldn't load the catalogue (${why})`)
203  }
204}
205
206async function loadInstalled($: EngineInterface) {
207  try {
208    const { exitCode, stdout } = await $.process.run(['claude', 'plugin', 'list', '--json'])
209    if (exitCode !== 0) return
210    const ids = (JSON.parse(stdout) as { id: string }[]).map(p => p.id)
211    await update($, installed, () => ids)
212  } catch {
213    // Not fatal: the pane just shows no "installed" marks.
214  }
215}
216
217async function install($: EngineInterface, mod: Mod) {
218  if (!mod.marketplace) return
219  await update($, isBusy, () => true)
220  await update($, status, () => '')
221  try {
222    const { exitCode, stdout, stderr } = await $.process.run(
223      ['claude', 'plugin', 'install', mod.name, '--marketplace', mod.repo],
224      { timeoutMs: 120_000 },
225    )
226    if (exitCode === 0) {
227      $.ui.toast(`Installed ${mod.name}. Run /reload-plugins to load it.`)
228      await loadInstalled($)
229    } else {
230      const why = (stderr || stdout).trim().split('\n').slice(-3).join(' ')
231      await update($, status, () => `Install failed: ${why}`)
232    }
233  } catch (error) {
234    await update($, status, () => `Install failed: ${error instanceof Error ? error.message : error}`)
235  }
236  await update($, isConfirming, () => false)
237  await update($, isBusy, () => false)
238}
239
240/** One mod as Claude reads it in a tool result. */
241function describe(mod: Mod, owned: Set<string>): string {
242  const tier = level(mod)
243  const how = !mod.marketplace ? 'manual install' : owned.has(pluginId(mod)) ? 'installed' : 'one-click install'
244  return [
245    `- ${mod.name} (id ${mod.id}) by ${mod.author}, ★${mod.stars} for ${mod.repo}, ${how}`,
246    `  access: ${tier.badge}${mod.labels.length ? ` (${mod.labels.join(', ')})` : ''}${mod.draws.length ? `; shows in ${mod.draws.map(d => PLACES[d] ?? d).join(', ')}` : ''}`,
247    `  ${mod.description || 'No description.'}`,
248  ].join('\n')
249}
250
251export const register: Register = on => {
252  on('session.start', async ($, e, next) => {
253    await $.command.register({
254      name: 'mods',
255      description: 'Browse and install community Claude Code mods',
256      argumentHint: '[search]',
257    })
258    await $.tool.register({
259      name: 'search_mods',
260      description:
261        'Search the community catalogue of Claude Code mods (plugins that add panes, bands, commands and hooks). ' +
262        'Use it when the person wants a mod for something, or asks what mods exist. Every word of the query must match ' +
263        "a mod's name, description, author or repo, so search with one or two short keywords and try synonyms. " +
264        "Results list each mod's id, stars (the whole repo's, shared by its mods), what it can access, and whether it installs in one click. " +
265        'Then call show_mod with the best fit, so the person can read it and press Install themselves.',
266      inputSchema: {
267        type: 'object',
268        properties: {
269          query: { type: 'string', description: 'Keywords, e.g. "spotify" or "git branch". Empty lists the most starred.' },
270          filter: {
271            type: 'string',
272            enum: ['all', 'installable', 'safe', 'pane', 'band'],
273            description: 'installable: one-click only; safe: display-only mods; pane: side panes; band: bands above the prompt',
274          },
275          limit: { type: 'number', description: 'How many to return, 1 to 25 (default 10)' },
276        },
277        required: ['query'],
278      },
279    })
280    await $.tool.register({
281      name: 'show_mod',
282      description:
283        "Opens a mod's page in the Mod Store pane, where the person sees what it can access and installs it with a button. " +
284        'Takes an id from search_mods. It never installs anything.',
285      inputSchema: { type: 'object', properties: { id: { type: 'string' } }, required: ['id'] },
286    })
287    void loadCatalog($)
288
289    return next(e)
290  })
291
292  on('tool.call', { tool: 'mcp__mod-store__search_mods' }, async ($, e) => {
293    const input = e as unknown as { query?: string; filter?: Filter; limit?: number }
294    await loadCatalog($)
295    if (catalog.length === 0) return { deny: (await read($, status)) || 'The mod catalogue is not loaded yet.' }
296    const limit = Math.min(25, Math.max(1, Math.round(input.limit ?? 10)))
297    const found = select(catalog, input.query ?? '', input.filter ?? 'all', 'stars')
298    const owned = new Set(await read($, installed))
299    const text = found.length
300      ? `${found.length} match${found.length === 1 ? '' : 'es'}, best ${Math.min(limit, found.length)}:\n` +
301        found.slice(0, limit).map(mod => describe(mod, owned)).join('\n')
302      : 'No mods match. Try one shorter keyword or a synonym.'
303    return { result: text }
304  })
305
306  on('tool.call', { tool: 'mcp__mod-store__show_mod' }, async ($, e) => {
307    const { id } = e as unknown as { id: string }
308    await loadCatalog($)
309    const mod = catalog.find(m => m.id === id) ?? catalog.find(m => m.name === id)
310    if (!mod) return { deny: `No mod with id ${id}. Use an id from search_mods.` }
311    await update($, isConfirming, () => false)
312    await update($, selected, () => mod.id)
313    await $.ui.open({ id: PANE, title: 'Mod Store', columns: 96, rows: 32 })
314    return { result: `Opened ${mod.name} in the Mod Store pane. The person installs it from there.` }
315  })
316
317  on('command.run', { command: 'mods' }, async ($, e) => {
318    const q = (e.args ?? '').trim()
319    await update($, query, () => q)
320    await update($, page, () => 0)
321    await update($, selected, () => null)
322    await $.ui.open({ id: PANE, title: 'Mod Store', focus: true, columns: 96, rows: 32 })
323    void loadCatalog($)
324    void loadInstalled($)
325
326    return { text: q ? `Mod Store: searching "${q}".` : 'Mod Store opened.' }
327  })
328
329  on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
330    const elements = $.ui.resolve(e)
331    const { Box, Text, Button, Link } = elements
332    // The mobile app draws no fields yet: it gets the list and paging alone.
333    const Input = 'Input' in elements ? elements.Input : undefined
334    const Select = 'Select' in elements ? elements.Select : undefined
335
336    await read($, loadedAt)
337    const note = await read($, status)
338    const isTerminal = e.surface === 'terminal'
339    const width = Math.max(30, e.props.bodyColumns ?? e.viewport?.columns ?? 60)
340    const owned = new Set(await read($, installed))
341    const pickedId = await read($, selected)
342    const picked = pickedId ? catalog.find(m => m.id === pickedId) : undefined
343
344    // ── Details ──────────────────────────────────────────────────────────
345    if (picked) {
346      const tier = level(picked)
347      const isOwned = picked.marketplace !== null && owned.has(pluginId(picked))
348      const confirming = await read($, isConfirming)
349      const busy = await read($, isBusy)
350      const places = picked.draws.map(d => PLACES[d] ?? d)
351
352      return (
353        <Box flexDirection="column" gap={1}>
354          <Button
355            key="back"
356            label="← All mods"
357            plain
358            dimColor
359            hotkey="b"
360            onPress={async () => {
361              await update($, isConfirming, () => false)
362              await update($, selected, () => null)
363              await update($, status, () => '')
364            }}
365          />
366
367          <Box flexDirection="column">
368            <Text bold>{picked.name}</Text>
369            <Text dimColor>
370              {picked.author} · <Text color="yellow">★ {picked.stars.toLocaleString('en-US')}</Text>
371              {picked.createdAt ? ` · ${picked.createdAt.slice(0, 10)}` : ''}
372            </Text>
373          </Box>
374
375          <Text wrap="wrap">{picked.description}</Text>
376
377          <Box gap={2} alignItems="center">
378            {isOwned ? (
379              <Text color="green" bold>
380                ✓ Installed
381              </Text>
382            ) : !picked.marketplace ? (
383              <Text dimColor>Manual install: see its README</Text>
384            ) : busy ? (
385              <Text color="cyan">Installing…</Text>
386            ) : confirming ? (
387              <Button key="confirm" label="Confirm install" variant="primary" hotkey="y" autoFocus onPress={() => install($, picked)} />
388            ) : (
389              <Button key="install" label="Install" variant="primary" hotkey="i" onPress={() => update($, isConfirming, () => true)} />
390            )}
391            {confirming && !busy && (
392              <Button key="cancel" label="Cancel" plain dimColor onPress={() => update($, isConfirming, () => false)} />
393            )}
394            <Link href={picked.url} label="View source ↗" />
395          </Box>
396
397          {confirming && (
398            <Box flexDirection="column" borderStyle="round" borderColor={tier.color} paddingX={1}>
399              <Text bold>Install {picked.name}?</Text>
400              <Text dimColor wrap="wrap">
401                Runs: claude plugin install {picked.name} --marketplace {picked.repo}
402              </Text>
403              <Text wrap="wrap">
404                It will be able to: <Text color={tier.color}>{picked.labels.join(', ') || noLabels(picked)}</Text>
405              </Text>
406            </Box>
407          )}
408
409          {note !== '' && (
410            <Text color="red" wrap="wrap">
411              {note}
412            </Text>
413          )}
414
415          <Box flexDirection="column" borderStyle="round" borderDimColor paddingX={1}>
416            <Box justifyContent="space-between">
417              <Text bold>What it can access</Text>
418              <Text color={tier.color} bold>
419                ● {tier.badge}
420              </Text>
421            </Box>
422            {picked.labels.length === 0 && <Text dimColor>{picked.level === 0 ? 'Nothing beyond drawing.' : `${tier.badge}: the catalogue lists no details.`}</Text>}
423            {picked.labels.map(label => (
424              <Text key={`can-${label}`} dimColor>
425                {'  '}• {label}
426              </Text>
427            ))}
428            {picked.sees.length > 0 && (
429              <Text dimColor wrap="wrap">
430                {'  '}• sees {picked.sees.join(', ')}
431              </Text>
432            )}
433            {places.length > 0 && (
434              <Text dimColor wrap="wrap">
435                {'  '}• shows up in {places.join(', ')}
436              </Text>
437            )}
438            <Text dimColor>
439              {'  '}• validation{' '}
440              <Text color={picked.validate === 'passed' ? 'green' : 'yellow'}>{picked.validate}</Text>
441            </Text>
442          </Box>
443        </Box>
444      )
445    }
446
447    // ── List ─────────────────────────────────────────────────────────────
448    const q = await read($, query)
449    const f = (await read($, filter)) as Filter
450    const s = (await read($, sort)) as Sort
451    const matches = select(catalog, q, f, s)
452    const pages = Math.max(1, Math.ceil(matches.length / PER_PAGE))
453    const at = Math.min(await read($, page), pages - 1)
454    const shown = matches.slice(at * PER_PAGE, (at + 1) * PER_PAGE)
455    const isLoading = catalog.length === 0 && note === ''
456    // A card's inside: the pane less its border and padding. Labels are padded to
457    // it so the whole card, not just the words, is a click target.
458    const inner = width - 4
459    const fill = (text: string, cells: number) => (isTerminal ? text.padEnd(cells, '\u00a0') : text)
460
461    return (
462      <Box flexDirection="column" gap={1}>
463        {Input && (
464          <Box flexDirection="column" width="100%">
465            <Input
466              key="search"
467              placeholder="Search 2,700 mods…  spotify, usage, git, pet"
468              value={q}
469              submitLabel="search"
470              autoFocus
471              onInput={async value => {
472                await update($, query, () => value)
473                await update($, page, () => 0)
474              }}
475              onSubmit={value => update($, query, () => value)}
476            />
477          </Box>
478        )}
479
480        <Box flexWrap="wrap" columnGap={1}>
481          <Button
482            key="ask"
483            label="✦ Ask Claude"
484            onPress={() =>
485              q.trim()
486                ? $.prompt.submit({
487                    text: `Help me find a Claude Code mod for: ${q.trim()}. Search the mod catalogue, compare the best few (what each does and can access), then open your top pick.`,
488                  })
489                : $.prompt.fill({ text: 'Find me a Claude Code mod that ', mode: 'replace' })
490            }
491          />
492          {CHIPS.map(chip =>
493            chip.value === f ? (
494              <Button key={`chip-${chip.value}`} label={chip.label} variant="primary" onPress={() => {}} />
495            ) : (
496              <Button
497                key={`chip-${chip.value}`}
498                label={chip.label}
499                plain
500                dimColor
501                onPress={async () => {
502                  await update($, filter, () => chip.value)
503                  await update($, page, () => 0)
504                }}
505              />
506            ),
507          )}
508        </Box>
509
510        <Box justifyContent="space-between" alignItems="center">
511          <Text dimColor>
512            {isLoading ? 'Loading the catalogue…' : catalog.length === 0 ? '' : plural(matches.length, 'mod')}
513          </Text>
514          {Select && (
515            <Select
516              key="sort"
517              options={SORTS}
518              value={s}
519              onSelect={async v => {
520                await update($, sort, () => v as Sort)
521                await update($, page, () => 0)
522              }}
523            />
524          )}
525        </Box>
526
527        {note !== '' && (
528          <Box gap={2}>
529            <Text color={catalog.length ? 'yellow' : 'red'} wrap="wrap">
530              {note}
531            </Text>
532            {catalog.length === 0 && <Button key="retry" label="Retry" onPress={() => loadCatalog($, true)} />}
533          </Box>
534        )}
535
536        {!isLoading && catalog.length > 0 && matches.length === 0 && (
537          <Text dimColor>No mods match. Try fewer words or another filter.</Text>
538        )}
539
540        <Box flexDirection="column" gap={0}>
541          {shown.map(mod => {
542            const tier = level(mod)
543            const isOwned = mod.marketplace !== null && owned.has(pluginId(mod))
544            const open = () => update($, selected, () => mod.id)
545            const stars = `★ ${mod.stars.toLocaleString('en-US')}`
546            const badge = `● ${tier.badge}   `
547            const owns = isOwned ? '✓ Installed   ' : ''
548            const footRoom = inner - badge.length - owns.length
549            return (
550              <Box
551                key={`card-${mod.id}`}
552                flexDirection="column"
553                borderStyle="round"
554                borderDimColor
555                paddingX={1}
556                hover={{ borderColor: 'cyan', borderDimColor: false }}
557              >
558                {!isTerminal ? (
559                  <>
560                    <Box justifyContent="space-between">
561                      <Button key={`open-${mod.id}`} label={clip(mod.name, 40)} plain onPress={open} />
562                      <Text color="yellow">{stars}</Text>
563                    </Box>
564                    <Text dimColor wrap="wrap">
565                      {clip(mod.description || 'No description.', 140)}
566                    </Text>
567                    <Box justifyContent="space-between">
568                      <Box columnGap={2}>
569                        <Text color={tier.color}>● {tier.badge}</Text>
570                        <Text dimColor>{clip(mod.author, 22)}</Text>
571                        {isOwned && <Text color="green">✓ Installed</Text>}
572                      </Box>
573                      <Button key={`more-${mod.id}`} label="Details ›" plain dimColor onPress={open} />
574                    </Box>
575                  </>
576                ) : (
577                  <>
578                <Box>
579                  <Button key={`open-${mod.id}`} label={fill(clip(mod.name, inner - stars.length - 2), inner - stars.length)} plain onPress={open} />
580                  <Text color="yellow">{stars}</Text>
581                </Box>
582                <Button
583                  key={`desc-${mod.id}`}
584                  label={fill(clip(mod.description || 'No description.', inner), inner)}
585                  plain
586                  dimColor
587                  onPress={open}
588                />
589                <Box>
590                  <Text color={tier.color}>{badge}</Text>
591                  {isOwned && <Text color="green">{owns}</Text>}
592                  <Button
593                    key={`more-${mod.id}`}
594                    label={fill(clip(mod.author, Math.max(4, footRoom - 12)), footRoom - 9) + 'Details ›'}
595                    plain
596                    dimColor
597                    onPress={open}
598                  />
599                </Box>
600                  </>
601                )}
602              </Box>
603            )
604          })}
605        </Box>
606
607        {pages > 1 && (
608          <Box justifyContent="space-between" alignItems="center">
609            <Button
610              key="prev"
611              label="‹ Prev"
612              plain
613              dimColor={at === 0}
614              onPress={() => update($, page, n => Math.max(0, n - 1))}
615            />
616            <Text dimColor>
617              {at * PER_PAGE + 1}–{Math.min(matches.length, (at + 1) * PER_PAGE)} of {matches.length.toLocaleString('en-US')}
618            </Text>
619            <Button
620              key="next"
621              label="Next ›"
622              plain
623              dimColor={at >= pages - 1}
624              onPress={() => update($, page, n => Math.min(pages - 1, n + 1))}
625            />
626          </Box>
627        )}
628
629        {catalog.length > 0 && (
630          <Box justifyContent="space-between">
631            <Text dimColor>
632              Catalogue by <Link href="https://mods.aidojo.si" label="mods.aidojo.si" />
633            </Text>
634            <Button key="refresh" label="↻ Refresh" plain dimColor onPress={() => loadCatalog($, true)} />
635          </Box>
636        )}
637      </Box>
638    )
639  })
640}
641
types/index.d.ts 41 lines
1/** One mod, slimmed from the catalogue's record. */
2export type Mod = {
3  id: string
4  name: string
5  repo: string
6  description: string
7  author: string
8  url: string
9  stars: number
10  createdAt: string
11  /** 0 draws and remembers, 1 reads, 2 writes or runs, 3 network */
12  level: number
13  levelName: string
14  labels: string[]
15  sees: string[]
16  draws: string[]
17  validate: string
18  /** The marketplace name to install from, when the repo root has one. */
19  marketplace: string | null
20}
21
22export type Sort = 'stars' | 'new' | 'name'
23export type Filter = 'all' | 'installable' | 'safe' | 'pane' | 'band'
24
25declare module 'claude-code' {
26  interface PluginState {
27    'mod-store': {
28      query: string
29      sort: Sort
30      filter: Filter
31      page: number
32      selected: string | null
33      isConfirming: boolean
34      isBusy: boolean
35      status: string
36      loadedAt: number
37      installed: string[]
38    }
39  }
40}
41