SLOPSHOPPER

mjg-test

mjg-test description

newpanecommandpromptmodelprocess
v0.0.2no licenseupdated 2026-10-15mgusmano/gusmano-marketplace/plugins/mjg-test
A shopper browsing a rack in a slop shop
Preview · a replayed session in a sandbox
claude · ~/work/app · mjg-test
│ ┃ mjg-test ✕ › fix the failing auth test and add an audit log call │ ┃ hi2b ┌────────────────────────────────────── │ ┃ │ http ● mjg-test: config: { "model": "haiku", "system": "Reply with one │ ┃ └────────────────────────────────────── ● mjg-test: r: { "isAnswered": true, "text": "OK", "usage": { │ ⏺ Read(src/auth.ts) │ ⎿ Read 6 lines │ ⏺ Update(src/auth.ts) │ ⎿ 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 │ │ › /sayhi │ ⎿ mjg-test: hi │ │ ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── › ? for shortcuts

Draws

Pane · mjg-test
hi2b ┌────────────────────────────────────────────────────── │ http └──────────────────────────────────────────────────────
Source 1 files
hooks/register.tsx 93 lines
1import type { EngineInterface, Frozen, Next, On, Register, SessionStartInput, Timer } from 'claude-code'
2
3const PANE = 'mjg-test'
4
5let checksTimer: Timer | null = null
6
7export const register: Register = (on: On) => {
8
9  on('session.start', async ($: EngineInterface, e: Frozen<SessionStartInput>, next: Next<'session.start'>) => {
10    //$.ui.log(`session.start: At ${new Date().toLocaleString()}`)
11    await $.command.register({ name: 'sayhi', description: 'say hi' })
12    await $.command.register({ name: 'testit', description: 'Test calling a model' })
13    $.clock.after(100, () => {
14      void $.ui.open({ id: PANE, title: 'MJG Test' })
15    })
16
17    return next(e)
18  })
19  on('command.run', { command: 'sayhi' }, async ($, e, next) => {
20    return { text: 'hi' }
21  })
22
23  on('command.run', { command: 'testit' }, async ($, e, next) => {
24    const config = {
25      model: 'haiku',
26      system: 'Reply with one word: bug, feature, or question.',
27      prompt: e.args.trim() || 'classify this',
28      maxTokens: 20,
29      timeoutMs: 15000,
30    }
31    $.ui.log(`config: ${JSON.stringify(config, null, 2)}`)
32    const r = await $.model.complete(config)
33    $.ui.log(`r: ${JSON.stringify(r, null, 2)}`)
34    const label = r.isAnswered ? r.text.trim() : 'unknown'
35    return { text: 'Label: ' + label }
36  })
37
38  on('skill.prompt', async ($, e, next) => {
39    $.ui.log(`skill.*: At ${new Date().toLocaleString()}`)
40    return next(e)
41  })
42
43  const onPress = (log: any) => {
44    log(`onPress`)
45  }
46
47  on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
48    const { Box, Text, Button } = $.ui.resolve(e)
49    const timerLabel = checksTimer ? 'stop timer' : 'start timer'
50    return (
51      <Box flexDirection="row" marginTop={0}>
52        <Text>hi2b</Text>
53        <Box borderStyle='single' marginLeft={1} paddingX={1} paddingY={0}>
54          <Button plain={true} key="http" label="http" onPress={async () => {
55            //const LATEST_URL = 'https://raw.githubusercontent.com/hellosverre/claude-skins/main/.claude-plugin/plugin.json'
56            const LATEST_URL = 'https://raw.githubusercontent.com/mgusmano/reextnext/main/package.json'
57            const response = await $.http.fetch(LATEST_URL)
58            if (!response.ok) {
59              throw new Error(`update check: ${LATEST_URL} answered ${response.status}`)
60            }
61            const parsed: any = JSON.parse(response.text)
62            const version: string = parsed.version
63            $.ui.log(`press: At ${new Date().toLocaleString()} version: ${version}`)
64          }}></Button>
65        </Box>
66
67        <Box borderStyle='single' marginLeft={1} paddingX={1} paddingY={0}>
68          <Button plain={true} key="timer" label={timerLabel} onPress={async () => {
69            if (checksTimer) {
70              checksTimer.cancel()
71              checksTimer = null
72              $.ui.log('checks: stopped')
73              $.ui.invalidate('ui.render')
74              return
75            }
76            checksTimer = $.clock.every(5_000, async () => {
77              const status = await $.process.run(['gh', 'pr', 'checks', '--json', 'state'])
78              $.ui.log('checks: ' + JSON.stringify(status))
79            })
80            $.ui.log('checks: started')
81            $.ui.invalidate('ui.render')
82          }}></Button>
83        </Box>
84
85        <Box borderStyle='single' marginLeft={1} paddingX={1} paddingY={0}>
86          <Button plain={true} key="a" label="a" onPress={() => onPress((msg: string) => $.ui.log(msg))}></Button>
87        </Box>
88
89      </Box>
90    )
91  })
92
93}