modscode JA

modscode / Gallery / hop

hop

Hop: a hop game to play while Claude works, with an AI coding tip on every block / 蹦一蹦:等 Claude 干活时玩的跳一跳,每块方块带一张 AI 编程知识卡片

Code you can checkTerminal + desktopPaneBandToastBoxButtonInputSvgText

What it does

  • Draws a band above the prompt, a pane, toasts
  • Adds /hop
  • Watches tool calls
  • Hooks classic.Notification, classic.PermissionRequest, session.append, session.start and 2 more
  • Keeps its own state between turns

Good points

  • Written in TypeScript
  • Has a desktop-specific branch
  • Handles errors
  • Speaks more than one language

Code to start from

Two kinds: a starter modscode writes from the design above, and the lines of the mod's own code that draw it.

Starter (register.tsx)

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

// Drawn like hop by AGI Hunt (pane, band, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/agihunt-hop/
// 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)
    return (
      <Box flexDirection="column">
        <Box flexDirection="row" gap={1} alignItems="center">
          <Text dimColor>
            Claude is still working
          </Text>
          <Button label="Play Hop" variant="primary" />
          <Button label="Not this session" plain dimColor />
        </Box>
        {await next(e)}
      </Box>
    )
  })

  // the pane: open it with $.ui.open({ id: 'my-pane', title: "蹦一蹦" })
  on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
    const { Box, Text, Button, Svg, Input } = $.ui.resolve(e)
    const svg = '…'
    const hint = '…'
    const lbTabs = '…'
    const lbTabs2 = '…'
    const lbTabs3 = '…'
    const rank = '…'
    const nickname = '…'
    const score = '…'
    const score2 = '…'
    const score3 = '…'
    const lbMe = '…'
    const status = '…'
    const scoreLine = '…'
    return (
      <Box flexDirection="column" gap={1}>
        <Box flexDirection="row" justifyContent="space-between" alignItems="center">
          <Text bold color="#E63946">
            Claude needs you
          </Text>
          <Button label="Back to Claude" plain />
        </Box>
        <Svg source={`${svg}`} alt="蹦一蹦,当前 0 分" />
        <Box flexDirection="row" gap={1} alignItems="center">
          <Box width={34}>
            <Input value="" placeholder="Click, hold Space" autoFocus />
          </Box>
          <Text dimColor>
            {hint}
          </Text>
        </Box>
        <Box flexDirection="column" borderStyle="round" borderDimColor paddingX={1}>
          <Box flexDirection="column">
            <Box flexDirection="row" justifyContent="space-between" alignItems="center">
              <Box flexDirection="row" gap={2} alignItems="center">
                <Text bold color="#D97757">
                  {lbTabs}
                </Text>
                <Text bold color="#D97757">
                  {lbTabs2}
                </Text>
                <Text bold color="#D97757">
                  {lbTabs3}
                </Text>
              </Box>
              <Text dimColor>
                Slow network, still loading…
              </Text>
            </Box>
            <Box flexDirection="column" width={32}>
              <Box flexDirection="row" justifyContent="space-between">
                <Text color="#D97757">
                  {`${rank}  ${nickname}`}
                </Text>
                <Text color="#D97757">
                  {score}
                </Text>
              </Box>
              <Box flexDirection="row" justifyContent="space-between">
                <Text color="#D97757">
                  {`${rank}  ${nickname}`}
                </Text>
                <Text color="#D97757">
                  {score2}
                </Text>
              </Box>
              <Box flexDirection="row" justifyContent="space-between">
                <Text color="#D97757">
                  {`${rank}  ${nickname}`}
                </Text>
                <Text color="#D97757">
                  {score3}
                </Text>
              </Box>
            </Box>
            <Box flexDirection="row" justifyContent="space-between">
              <Text dimColor>
                {`${lbMe}`}
              </Text>
              <Button label="Leave leaderboard" plain dimColor />
            </Box>
          </Box>
          <Box flexDirection="row" gap={2} alignItems="center">
            <Text color="#E76F51">
              {`${status}. Showing the last results`}
            </Text>
            <Button label="Retry" plain />
          </Box>
        </Box>
        <Box flexDirection="row" justifyContent="space-between" alignItems="center">
          <Text dimColor>
            {`${scoreLine}`}
          </Text>
          <Button label="♪" plain dimColor={false} />
        </Box>
      </Box>
    )
  })

  on('session.start', async ($, e, next) => {
    await $.ui.toast(`Claude needs you`)
    await $.ui.toast(`Claude is done. Come take a look`)
    return next(e)
  })
}

The mod's own code

Shown under the mod's licence (MIT); its text is below. Keep the notice if you copy these lines.

plugins/hop/hooks/register.tsx lines 439–468 · Band
  on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
    const { value: c = IDLE } = await $.state.get(CLAUDE)
    if (!c.hint || c.needsYou || !c.busy || hintMuted || e.props.hasSurvey) return next(e)
    const panes = await $.ui.panes().catch(() => [])
    if (panes.some(p => p.id === PANE && p.isPlaced)) return next(e)
    const { Box, Text, Button } = $.ui.resolve(e)
    return (
      <Box flexDirection="row" gap={1} alignItems="center">
        <Text dimColor>{tr().bandBusy}</Text>
        <Button
          key="hop-open"
          label={tr().bandPlay}
          variant="primary"
          onPress={() =>
            void $.ui.open({ id: PANE, title: TITLE, focus: true }).then(() => $.state.set(CLAUDE, { ...c, hint: false }))
          }
        />
        <Button
          key="hop-mute"
          label={tr().bandMute}
          plain
          dimColor
          onPress={() => {
            hintMuted = true
            void $.state.set(CLAUDE, { ...c, hint: false })
          }}
        />
      </Box>
    )
  })
plugins/hop/hooks/register.tsx lines 470–629 · Pane
  on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
    // 画面板出了错就把原因直接画出来,免得桌面端只显示一句「Nothing to show yet」
    try {
    const t = $.ui.resolve(e)
    const { Box, Text, Button } = t
    paneFocused = e.props.isFocused
    // 画布跟着面板大小走:面板越大,场景越大、看得越远;方块和小人保持原大小(不是把图片拉伸)
    // 面板只告诉插件格数,按一格约 7.5 像素、一行约 20 像素估算
    const { value: peek = EMPTY } = await $.state.get(VIEW)
    const { value: lbPeek = NO_BOARD } = await $.state.get(BOARD)
    // 画面下面的控件要占几行:状态行、输入框、分数行,结束时再加排行榜
    const controlRows = 6 + (peek.game?.isOver ? (lbPeek.joined ? 17 : 7) : 0)
    const canvasW = Math.min(1400, (e.props.bodyColumns || 60) * 7.5 - 24)
    const roomH = e.viewport?.rows ? (e.viewport.rows - controlRows) * 20 : 360
    // 不要竖着拉长:高度最多是宽度的 0.82 倍(原画面的比例)
    const canvasH = Math.min(canvasW * 0.82, roomH, 900)
    setCanvas(canvasW, canvasH)
    const sceneW = Math.max(440, Math.round(canvasW))
    const sceneH = Math.max(360, Math.round(canvasH))
    const { value: view = EMPTY } = await $.state.get(VIEW)
    const { value: board = NO_BOARD } = await $.state.get(BOARD)
    const { value: claude = IDLE } = await $.state.get(CLAUDE)
    const game = view.game

    if (!game) return <Text dimColor>{tr().loading}</Text>
    await $.state.get(TICK)
    const now = await $.clock.now()
    const svg =
      view.phase === 'charge'
        ? chargeFrame(game, now - view.chargeAt)
        : view.phase === 'jump' && view.before && view.jump && now - view.jumpAt < ANIM_MS
          ? jumpFrame(view.before, game, view.jump, now - view.jumpAt, now)
          : stillFrame(game, now)
    if (e.surface === 'terminal' || !('Svg' in t) || !('Input' in t)) {
      return <Text dimColor>{tr().desktopOnly}</Text>
    }

    // 输入框里每多一个空格(按住时系统会不停地打)都会走到这里
    const press = () =>
      void $.clock.now().then(async now => {
        if (holdStart === 0) {
          const { value: v = EMPTY } = await $.state.get(VIEW)
          if (!v.game || v.game.isOver) return
          holdStart = now
          lastPress = now
          presses = 1
          await $.state.set(VIEW, { ...v, phase: 'charge', chargeAt: now, startedAt: v.startedAt || now })
          if (!muted) {
            const s = $.process.spawn({ argv: ['afplay', '-v', VOLUME, `${$.plugin.root}/sounds/charge.wav`] })
            chargeSound = s
            void (async () => {
              try {
                for await (const _ of s) {
                  // 只是让它响着;松手时 return() 结束循环,afplay 随之退出
                }
              } catch {
                // 播不了就算了
              }
            })()
          }
          return
        }
        lastPress = now
        presses += 1
      })

    const restart = () =>
      void $.clock.now().then(async now => {
        isOverNow = false
        const seed = Math.floor(now % 2147483647)
        const seen = ((await $.store.get('seen')) ?? []) as string[]
        const best = Math.max(game.best, Number((await $.store.get('best')) ?? 0))
        await $.state.set(VIEW, {
          ...EMPTY,
          game: newGame(seed, best, queueFor(seen, seed).slice(0, QUEUE)),
          pad: view.pad + 1,
        })
        await $.state.get(BOARD).then(({ value: b = NO_BOARD }) => $.state.set(BOARD, { ...b, status: '' }))
      })

    return (
      <Box flexDirection="column" gap={1}>
        {(claude.needsYou || claude.done) && (
          <Box flexDirection="row" justifyContent="space-between" alignItems="center">
            <Text bold color={claude.needsYou ? '#E63946' : '#2A9D8F'}>
              {claude.needsYou ? tr().needsYou : tr().doneNow}
            </Text>
            <Button
              key="back"
              label={tr().backToClaude}
              plain
              onPress={() =>
                void $.state
                  .set(CLAUDE, { ...claude, done: false })
                  .then(() => $.ui.close({ id: PANE }))
                  .catch(() => undefined)
              }
            />
          </Box>
        )}
        {/* 不加 isInteractive:当普通图片显示,换图不闪 */}
        <t.Svg source={svg} alt={`蹦一蹦,当前 ${game.score} 分`} width={sceneW} height={sceneH} />
        <Box flexDirection="row" gap={1} alignItems="center">
          {game.isOver ? (
             <Button key="restart" label={tr().restart} hotkey={board.joined ? 'r' : undefined} variant="primary" autoFocus onPress={restart} />
          ) : (
            // 只有输入框收得到按住空格时的连续输入;宽度固定,空格攒多了也不会把框撑长
            <Box width={34}>
              <t.Input
                key={`pad-${view.pad}`}
                value=""
                placeholder={tr().placeholder}
                autoFocus
                onInput={() => press()}
                onSubmit={() => undefined}
              />
            </Box>
          )}
          <Text dimColor>{view.hint}</Text>
        </Box>
        {game.isOver && (
          <Box flexDirection="column" borderStyle="round" borderDimColor paddingX={1}>
            {board.joined ? (
              <Box flexDirection="column">
                {/* 当前榜单用醒目的字,其余两个是可点的按钮;右边是加载状态 */}
                <Box flexDirection="row" justifyContent="space-between" alignItems="center">
                  <Box flexDirection="row" gap={2} alignItems="center">
                    {(['today', 'week', 'all'] as const).map(tab =>
                      board.tab === tab ? (
                        <Text key={`tab-${tab}`} bold color="#D97757">
                          {tr().lbTabs[tab]}
                        </Text>
                      ) : (
                        <Button
                          key={`tab-${tab}`}
                          label={tr().lbTabs[tab]}
                          plain
                          dimColor
                          onPress={() => void lb?.refresh(tab)}
                        />
                      ),
                    )}
                  </Box>
                  {board.busy && <Text dimColor>{board.slow ? tr().lbSlow : tr().lbBusy}</Text>}
                </Box>
                {board.entries.length === 0 ? (
                  <Text dimColor>{board.busy ? tr().lbLoading : board.status !== '' ? '' : tr().lbEmpty}</Text>
                ) : (
                  <Box flexDirection="column" width={32}>
                    {board.entries.map(en => (
                      <Box key={`row-${en.rank}-${en.nickname}`} flexDirection="row" justifyContent="space-between">
                        <Text bold={en.isMe} color={en.isMe ? '#D97757' : undefined} dimColor={board.busy && !en.isMe}>
                          {`${String(en.rank).padStart(2, ' ')}  ${en.nickname}`}
                        </Text>
                        <Text bold={en.isMe} color={en.isMe ? '#D97757' : undefined} dimColor={board.busy && !en.isMe}>
                          {String(en.score)}
                        </Text>
                      </Box>
                    ))}
                  </Box>
Licence text (MIT)
MIT License

Copyright (c) 2026 AGI Hunt

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.

What its code calls

networkruns programsreads filestool callsremembers

The design, read from code

Drawn from the mod's source at the commit read, not from a run: a list is drawn three times, a condition takes its first branch that draws in the desktop app, and a value only the run time knows is shown as a made-up sample (dotted underline) or left out. Colours and type are this site's.

What its code shows

Read from the source at commit 2acd59d46f2f on 2026-10-06. The first group decides whether a mod is listed; the rest is for you to weigh. A later commit is not read until the next crawl.

Decides the listing: code you can check
Entry readEvery module hooks/hooks.json names was read.plugins/hop/hooks/register.tsx
ParsesEvery file parses as TypeScript or JavaScript.5 files parsed
All its code is in the modEvery import is a file of the mod or the engine's own module; no packages, no require.all its code is in the mod
ReadableNo minified lines, no eval or new Function, no import of a computed path, no encoded blobs.no minified code, no eval, no encoded blobs
Calls in the openNetwork and programs are reached as $.http.fetch and $.process.run in place, never passed around.every call outside goes through $ in the open
For you to weigh before installing
Where it drawsThe terminal, the desktop app, both, or nothing (hooks only: a guard or a prompt rewriter), as its code says. Shown, never a reason to leave a mod out.draws in the terminal and the desktop app, the same in both
Install lineWhether its repository's own .claude-plugin/marketplace.json lists it, so it installs from that marketplace with the lines on its page.listed in its repository's .claude-plugin/marketplace.json: installs from there
Programs on WindowsWhether every program it starts through $.process exists on Windows (tail, date, open, osascript, /usr/… do not).plugins/hop/hooks/register.tsx:86 defaults (not on Windows); plugins/hop/hooks/register.tsx:94 defaults (not on Windows); plugins/hop/hooks/register.tsx:352 afplay (not on Windows); plugins/hop/hooks/register.tsx:363 afplay (not on Windows); plugins/hop/hooks/register.tsx:518 afplay (not on Windows)
NetworkWhether every fetch names its https host in the code.plugins/hop/hooks/register.tsx:112 fetch(`${LB_BASE}${path}`)
ProgramsWhether every program it starts is named in the code and is not a shell, an interpreter or a network tool.defaults, afplay
Reads and sendsWhether it both reads files or environment variables and reaches the network.reads files and reaches the network
Keys in the sourceWhether the source holds what looks like an API key or a private key.no keys in the source
LicenceAn open licence (MIT, Apache-2.0, BSD, ISC, Unlicense, 0BSD, CC0) with its text lets modscode show its code; otherwise the code is linked.MIT

This is a reading of the code text, not a security review: it does not run the mod, and it cannot see what a program the mod starts does. The check before installing is yours. How mods are chosen

Install it

Check it yourself before you install it. Mods run unsandboxed, with your permissions, and modscode does not vouch for what this code does. Read the code below (or run claude plugin validate . in its folder), weigh what it reaches, and install the commit you read.

Its repository is its marketplace. Add that marketplace (in the terminal with these commands, or in the desktop app's plugin settings) and install the mod from it:

/plugin marketplace add AGIHunt/cc-mods
/plugin install hop@agihunt

This installs the marketplace's latest commit, which may not be the one read here (2acd59d46f2f). Compare them before you install.

Ask Claude about it

With the modscode connector added, Claude can read this design, what its code reaches and its code, and build on them. Ask it like this:

Read the modscode design "agihunt-hop" with its code and make me a pane like it

Search them from Claude: the MCP connector

Similar designs