SLOPSHOPPER

preflight

A live pre-commit checklist above the prompt: re-runs your typecheck, lint or any command after Claude edits files.

bandguardprocesstimer
v0.3.0no licenseupdated 2026-10-22Arkboi-GG/claude-mods/mods/preflight
A shopper browsing a rack in a slop shop
Preview · a replayed session in a sandbox
claude · ~/work/app · preflight
› fix the failing auth test and add an audit log call ⏺ 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 ⟨Claude Code's own drawing⟩ · types not run ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── › ? for shortcuts

Draws

Band
⟨Claude Code's own drawing⟩ · types not run
README

claude-mods

A small collection of Claude Code mods.

Install

/plugin install <mod> --marketplace Arkboi-GG/claude-mods

The bars stack above the prompt, so you can install any combination.

Mods

  • task-progress: the band above the prompt. While Claude works on a multi-step task it shows one block per step: the running step fills as "In Progress", finished steps turn green "Completed", and a turn that stops with steps still open turns amber "Paused". When Claude is idle it shows usage rings (context, 5-hour and 7-day limits) with a Compact button. It reads the task list Claude keeps while working, so it appears for multi-step tasks. The Compact button runs /compact with instructions to keep the thread (goal, decisions, files, key values, open questions, next steps) so work carries on in the same topic; change them with the compactInstructions option. The 5-hour and 7-day rings show the time left until they reset (the ring still fills with the share used). If you also use the skins mod, run /skin band off once so its own usage band doesn't show twice.
  • repo-status: branch, ahead/behind, changed-file count and the open PR's check state (needs git; gh is optional).
  • stack-health: status dots for your Docker Compose services and any local ports you list (web=5173,api=3000).
  • preflight: a live pre-commit checklist. After Claude edits files it re-runs your typecheck/lint (auto-detected, or set checks) and shows pass/fail with an error count.
  • env-guard: a green LOCAL badge that turns red PROD when a tool call matches your production patterns, and toasts when it happens.
  • agent-crabs: a pixel-art crab for every running subagent, dressed for its role (beret, hard hat, postman cap and more), with the agent's name, what it is working on and a timer. Finished crabs cheer and leave after a few seconds; failed ones turn grey. Name an agent by starting the Agent call's description with Name: , e.g. Olivia: rewrite welcome email; map names to outfits with the outfits option. While an agent runs, a playful stage word (Waking up, Analyzing, Cooking, Wrapping up) follows what its tool calls show it doing; "Wrapping up" is a guess, since an agent reports no progress.
Source 2 files
hooks/register.tsx 196 lines
1import { atom, read, update } from 'claude-code'
2import type { Register } from 'claude-code'
3
4import type { Check } from '../types'
5
6const checksAtom = atom({ plugin: 'preflight', key: 'checks' } as const, [] as Check[])
7
8const WIDE = 110
9
10const gateAtom = atom({ plugin: 'preflight', key: 'gate' } as const, false)
11
12// The bars only show in a GitHub repository: true when the session's folder is inside a git
13// repository whose remote is on GitHub (any git repository when `githubOnly` is off).
14async function inGithubRepo($: any, githubOnly: boolean): Promise<boolean> {
15  try {
16    const r = await $.process.run(['git', 'remote', '-v'], { timeoutMs: 5000 })
17    if (r.exitCode !== 0) return false
18    return !githubOnly || /github\.com/i.test(r.stdout)
19  } catch {
20    return false
21  }
22}
23
24async function checkGate($: any, githubOnly: boolean) {
25  const ok = await inGithubRepo($, githubOnly)
26  await update($, gateAtom, p => (p === ok ? p : ok))
27}
28
29// Shared "dev row" protocol (the same helper sits in every mod of this repo):
30// each mod adds a keyed zone to one row, so the mods fill a single line together
31// and still work alone. Zones sort by their key, `zone-<order>`.
32function addZone(below: any, zone: any, order: number): any {
33  const tagged = { ...zone, props: { ...zone.props, key: `zone-${order}`, flexShrink: 0 } }
34  const byKey = (a: any, b: any) => String(a?.props?.key).localeCompare(String(b?.props?.key))
35  const merge = (node: any): any => {
36    if (!node || typeof node !== 'object') return null
37    if (node.props?.key === 'devrow') return { ...node, children: [...(node.children ?? []), tagged].sort(byKey) }
38    const kids: any[] = node.children ?? []
39    for (let i = 0; i < kids.length; i++) {
40      const hit = merge(kids[i])
41      if (hit) return { ...node, children: kids.map((k, j) => (j === i ? hit : k)) }
42    }
43    return null
44  }
45  const merged = merge(below)
46  if (merged) return merged
47  const row = {
48    type: 'Box',
49    props: { key: 'devrow', paddingX: 1, justifyContent: 'space-between', flexWrap: 'wrap', columnGap: 3 },
50    children: [tagged],
51  }
52  return {
53    type: 'Box',
54    props: { flexDirection: 'column' },
55    children: below ? [below, row] : [row],
56  }
57}
58
59const EDIT_TOOLS = new Set(['Edit', 'Write', 'MultiEdit', 'NotebookEdit'])
60const GLYPH = { idle: '·', running: '…', pass: '✓', fail: '✗' } as const
61const COLOR = { idle: '#6b7280', running: '#f59e0b', pass: '#22c55e', fail: '#ef4444' } as const
62
63type Def = { name: string; command: string }
64
65let defs: Def[] = []
66let timer: { cancel: () => void } | null = null
67let isRunning = false
68let isDirty = false
69
70async function shell($: any, command: string) {
71  try {
72    return await $.process.run(['sh', '-c', command], { timeoutMs: 300000 })
73  } catch {
74    return await $.process.run(['cmd', '/c', command], { timeoutMs: 300000 })
75  }
76}
77
78// No setting given: use tsc when there is a tsconfig, and any lint script.
79async function detect($: any): Promise<Def[]> {
80  const found: Def[] = []
81  try {
82    const probe = await shell($, 'test -f tsconfig.json || dir tsconfig.json')
83    if (probe.exitCode === 0) found.push({ name: 'types', command: 'npx tsc -b' })
84  } catch {
85    // no shell: skip
86  }
87  try {
88    const r = await shell($, 'npm pkg get scripts.lint')
89    if (r.exitCode === 0 && r.stdout.trim() && r.stdout.trim() !== '{}') found.push({ name: 'lint', command: 'npm run lint' })
90  } catch {
91    // no npm: skip
92  }
93  return found
94}
95
96async function runAll($: any) {
97  if (isRunning) {
98    isDirty = true
99    return
100  }
101  isRunning = true
102  do {
103    isDirty = false
104    await update($, checksAtom, () => defs.map(d => ({ name: d.name, state: 'running' as const, issues: 0, at: 0 })))
105    for (let i = 0; i < defs.length; i++) {
106      let r
107      try {
108        r = await shell($, defs[i].command)
109      } catch {
110        r = { exitCode: 1, stdout: '', stderr: 'error: could not run' }
111      }
112      const out = `${r.stdout}\n${r.stderr}`
113      const issues = r.exitCode === 0 ? 0 : Math.max(1, (out.match(/\berror\b/gi) ?? []).length)
114      await update($, checksAtom, prev =>
115        prev.map((c, k) => (k === i ? { ...c, state: r.exitCode === 0 ? ('pass' as const) : ('fail' as const), issues, at: Date.now() } : c)),
116      )
117    }
118  } while (isDirty)
119  isRunning = false
120}
121
122const parse = (s: string): Def[] =>
123  s
124    .split(';')
125    .map(p => p.trim())
126    .filter(Boolean)
127    .map(p => {
128      const i = p.indexOf('=')
129      return i > 0 ? { name: p.slice(0, i).trim(), command: p.slice(i + 1).trim() } : { name: p.split(' ')[0], command: p }
130    })
131
132// The checks to run: the ones named in the `checks` option, else the ones found in the session's folder.
133async function refresh($: any, setting: string) {
134  defs = setting.trim() ? parse(setting) : await detect($)
135  await update($, checksAtom, () => defs.map(d => ({ name: d.name, state: 'idle' as const, issues: 0, at: 0 })))
136}
137
138export const register: Register = (on, options) => {
139  const githubOnly = options.githubOnly !== false
140
141  const delayMs = Math.max(1, Number(options.delaySeconds ?? 8)) * 1000
142
143  on('session.start', async ($, e, next) => {
144    await checkGate($, githubOnly)
145    $.clock.every(15000, () => checkGate($, githubOnly))
146    await refresh($, String(options.checks ?? ''))
147    const result = await next(e)
148    $.clock.after(1000, async () => {
149      if (await read($, gateAtom)) runAll($)
150    })
151    return result
152  })
153
154  // The session moved to another folder (/cd, the host's folder picker, a worktree): look for its checks again.
155  on('classic.CwdChanged', async ($, e, next) => {
156    timer?.cancel()
157    await checkGate($, githubOnly)
158    await refresh($, String(options.checks ?? ''))
159    if (defs.length > 0 && (await read($, gateAtom))) timer = $.clock.after(1000, () => runAll($))
160    return next(e)
161  })
162
163  on('tool.call', async ($, e, next) => {
164    const result = await next(e)
165    if (EDIT_TOOLS.has(String(e.tool)) && defs.length > 0 && (await read($, gateAtom))) {
166      timer?.cancel()
167      timer = $.clock.after(delayMs, () => runAll($))
168    }
169    return result
170  })
171
172  on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
173    const below = await next(e)
174    const checks = await read($, checksAtom)
175    if (e.props.hasSurvey || checks.length === 0 || !(await read($, gateAtom))) return below
176
177    const { Box, Text } = $.ui.resolve(e)
178    const isWide = e.props.bodyColumns >= WIDE
179    const clock = (at: number) => (at ? new Date(at).toTimeString().slice(0, 5) : '')
180    const zone = (
181      <Box gap={2}>
182        {checks.map(c => (
183          <Box key={c.name} gap={1}>
184            <Text color={COLOR[c.state]}>{GLYPH[c.state]}</Text>
185            <Text dimColor={c.state === 'pass' || c.state === 'idle'}>{c.name}</Text>
186            {c.state === 'fail' ? <Text color="#ef4444">{c.issues}</Text> : null}
187            {c.state === 'idle' ? <Text dimColor>not run</Text> : null}
188            {isWide && c.at ? <Text dimColor>{clock(c.at)}</Text> : null}
189          </Box>
190        ))}
191      </Box>
192    )
193    return addZone(below, zone, 3)
194  })
195}
196
types/index.d.ts 8 lines
1export type Check = { name: string; state: 'idle' | 'running' | 'pass' | 'fail'; issues: number; at: number }
2
3declare module 'claude-code' {
4  interface PluginState {
5    preflight: { checks: Check[]; gate: boolean }
6  }
7}
8