__DESCRIPTION__

한국어 · English
__DESCRIPTION__
<!-- 스크린샷: scripts/shots/__MOD__.shot.tsx 를 만들고 node scripts/shots/render.mjs __MOD__ -->
/plugin install __MOD__ --marketplace speardragon/ray-claude-code-mods
이 mod가 보여주거나 바꾸는 것, 추가하는 슬래시 명령, 패널이나 밴드의 단축키, 설정에서 읽는 값을 여기에 적어서 설치하는 사람이 무엇을 기대하면 되는지 알 수 있게 하세요.
hooks/register.tsx 22 lines1// __MOD__: __DESCRIPTION__
2// A starting point: a band above the prompt that counts this session's tool calls.
3import { atom, read, update } from 'claude-code'
4import type { Register } from 'claude-code'
5
6// Held by the host, so a hot reload keeps it.
7const count = atom({ plugin: '__MOD__', key: 'count' } as const, 0)
8
9export const register: Register = on => {
10 on('tool.call', async ($, e, next) => {
11 await update($, count, n => n + 1)
12 return next(e)
13 })
14
15 on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
16 const n = await read($, count)
17 if (n === 0) return next(e)
18 const { Text } = $.ui.resolve(e)
19 return <Text dimColor>__MOD__: {n} tool calls</Text>
20 })
21}
22types/index.d.ts 11 lines1// The values this mod keeps in $.state, by key. Every key the hooks module names is checked against this.
2export type Count = number
3
4declare module 'claude-code' {
5 interface PluginState {
6 '__MOD__': {
7 count: Count
8 }
9 }
10}
11