SLOPSHOPPER

stack-health

Status dots above the prompt for your Docker Compose services and any local ports you name.

bandprocessnetworktimer
v0.3.0no licenseupdated 2026-10-22Arkboi-GG/claude-mods/mods/stack-health
A shopper browsing a rack in a slop shop
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 148 lines
1import { atom, read, update } from 'claude-code'
2import type { Register } from 'claude-code'
3
4import type { Dot } from '../types'
5
6const dotsAtom = atom({ plugin: 'stack-health', key: 'dots' } as const, [] as Dot[])
7
8const WIDE = 110
9
10const gateAtom = atom({ plugin: 'stack-health', 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 COLORS = { up: '#22c55e', wait: '#f59e0b', down: '#ef4444' } as const
60
61export const register: Register = (on, options) => {
62  const githubOnly = options.githubOnly !== false
63
64  // The session moved to another folder: check it again.
65  on('classic.CwdChanged', async ($, e, next) => {
66    await checkGate($, githubOnly)
67    return next(e)
68  })
69
70  const wantCompose = options.compose !== false
71  const ports = String(options.ports ?? '')
72    .split(',')
73    .map(s => s.trim())
74    .filter(Boolean)
75    .map(s => {
76      const [a, b] = s.split('=')
77      return b ? { name: a.trim(), port: b.trim() } : { name: `:${a}`, port: a }
78    })
79
80  on('session.start', async ($, e, next) => {
81    await checkGate($, githubOnly)
82    $.clock.every(15000, () => checkGate($, githubOnly))
83    const poll = async () => {
84      if (!(await read($, gateAtom))) {
85        await update($, dotsAtom, p => (p.length ? [] : p))
86        return
87      }
88      const dots: Dot[] = []
89
90      if (wantCompose) {
91        try {
92          const r = await $.process.run(['docker', 'compose', 'ps', '--all', '--format', 'json'], { timeoutMs: 10000 })
93          if (r.exitCode === 0) {
94            const text = r.stdout.trim()
95            const rows: Array<{ Service?: string; State?: string; Health?: string; Status?: string }> = text.startsWith('[')
96              ? JSON.parse(text)
97              : text.split('\n').filter(Boolean).map(l => JSON.parse(l))
98            for (const row of rows) {
99              const state =
100                row.State === 'running' ? (row.Health === 'starting' ? 'wait' : row.Health === 'unhealthy' ? 'down' : 'up')
101                : row.State === 'restarting' || row.State === 'created' ? 'wait'
102                : 'down'
103              dots.push({ name: row.Service ?? '?', state, detail: (row.Status ?? '').replace(/^Up /i, '').replace(/ \(.*\)/, '').toLowerCase() })
104            }
105          }
106        } catch {
107          // docker not installed or daemon down: no compose dots
108        }
109      }
110
111      for (const p of ports) {
112        try {
113          await $.http.fetch(`http://localhost:${p.port}/`)
114          dots.push({ name: p.name, state: 'up', detail: `:${p.port}` })
115        } catch {
116          dots.push({ name: p.name, state: 'down', detail: `:${p.port}` })
117        }
118      }
119
120      await update($, dotsAtom, () => dots)
121    }
122    await poll()
123    $.clock.every(10000, poll)
124    return next(e)
125  })
126
127  on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
128    const below = await next(e)
129    const dots = await read($, dotsAtom)
130    if (e.props.hasSurvey || dots.length === 0 || !(await read($, gateAtom))) return below
131
132    const { Box, Text } = $.ui.resolve(e)
133    const isWide = e.props.bodyColumns >= WIDE
134    const zone = (
135      <Box gap={2}>
136        {dots.map(d => (
137          <Box key={d.name} gap={1}>
138            <Text color={COLORS[d.state]}>●</Text>
139            <Text dimColor={d.state === 'up'}>{d.name}</Text>
140            {isWide && d.detail ? <Text dimColor>{d.detail}</Text> : null}
141          </Box>
142        ))}
143      </Box>
144    )
145    return addZone(below, zone, 2)
146  })
147}
148
types/index.d.ts 8 lines
1export type Dot = { name: string; state: 'up' | 'down' | 'wait'; detail: string }
2
3declare module 'claude-code' {
4  interface PluginState {
5    'stack-health': { dots: Dot[]; gate: boolean }
6  }
7}
8