SLOPSHOPPER

dokploy-statusbar

Dokploy-Deploy-Status des aktuellen Repos als Leiste über dem Eingabefeld

bandguardcommandtoastprocesstimer
A shopper browsing a rack in a slop shop
Preview · a replayed session in a sandbox
claude · ~/work/app · dokploy-statusbar
› 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 › /deploys ⎿ dokploy-statusbar: Für dieses Projekt gibt es keine Dokploy-Dienste. ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── › ? for shortcuts
README

claude-code-mods

Four Claude Code mods (plugins that change the interface itself): a deploy status bar, a tasks pane, a RAM indicator and a Git worktree overview. The three that draw above the input field share one bar.

The UI texts of all mods are in German.

ModWhat it showsWorks for you if
worktreesAll Git worktrees with open workyou use Git (nothing else needed)
dokploy-statusbarLast Dokploy deploy per appyou deploy with Dokploy and have the private dokploy CLI
todosOpen tasks of the current repo from a G-Brainyou have an MCP server claude.ai G-Brain with get_page
ramUsed memory in the baryou use macOS

Installation

claude plugin marketplace add allorders1studio/claude-code-mods
claude plugin install worktrees@claude-code-mods

Replace worktrees with dokploy-statusbar, todos or ram as needed, then run /reload-plugins inside Claude Code.

worktrees

The only mod that needs nothing but Git. /worktrees lists every worktree of the current repo and tells you which ones can be deleted.

╭──────────────────────────────────────────────────────────╮
│ feature-search  feat/search                              │
│ 3 Dateien uncommittet  ·  letzter Commit heute           │
│ Pfad kopieren                                            │
╰──────────────────────────────────────────────────────────╯
╭──────────────────────────────────────────────────────────╮
│ fix-login  fix/login                                     │
│ 2 Commits nicht in main, nicht gepusht  ·  letzter Commit gestern │
╰──────────────────────────────────────────────────────────╯
╭──────────────────────────────────────────────────────────╮
│ old-experiment  exp/cache                                │
│ nichts offen – kann weg  ·  letzter Commit vor 12 Tagen  │
╰──────────────────────────────────────────────────────────╯
Neu laden  3 Worktrees · 2 mit offener Arbeit · Stand 23:20:56

Status line while worktrees hold open work:

2 von 3 Worktrees mit offener Arbeit · /worktrees
  • Uncommitted files per worktree
  • Commits not in main (compared against origin/<default branch>)
  • Pushed or not pushed
  • "kann weg" (can go) for worktrees with nothing left to lose; "Stand unklar" when the comparison with main fails
  • Card colors: red uncommitted, yellow not pushed, cyan pushed, green can go

Command: /worktrees. Requirements: Git.

dokploy-statusbar

A bar above the input field with the last Dokploy deploy of every app belonging to the current repo.

 ● api-app  ● web-app  ● worker running 1:20  ● docs ausstehend          23:20
 > _
  • Dot: green (done), red (error), yellow (running), grey (pending), magenta (unknown)
  • App name links to its Dokploy page; on error it links to the deployments tab
  • Button "Log" on error: writes the last 80 build-log lines into the input field
  • "ausstehend" (pending): a commit since the deployed one touched the service's watch paths
  • running m:ss while a build is in progress
  • After git push, polls every 5 s for 2 minutes instead of every 30 s
  • Toast when a deploy finishes; the last fetch time is shown faintly at the far right of the shared bar (see below)

Command: /deploys (refresh now).

Requirements, honestly:

  • The official @dokploy/cli (npm i -g @dokploy/cli).
  • The wrapper dokploy-panel (/opt/homebrew/bin/dokploy-panel, from nams-claude-setup). It fetches the API key of each panel from Infisical at run time, so the machine needs an Infisical login. dokploy-panel --panels lists the panels the mod queries.
  • macOS with Homebrew paths: /opt/homebrew/bin/dokploy-panel and /opt/homebrew/bin/node are hard-coded in hooks/register.tsx.

How it works

Per panel, the mod runs dokploy-panel <panel> exec node hooks/discover.cjs. The wrapper puts DOKPLOY_URL and DOKPLOY_API_KEY into the script's environment only; the script reads all projects over Dokploy's tRPC API and keeps the services whose Git source matches git remote get-url origin, with id, branch and watchPaths. No configuration per repo is needed, and keys never reach the mod. If one panel fails, the others still count and the failure is shown once as a toast.

Every 30 s hooks/poll.cjs runs per panel (one process for all services of that panel) and returns the newest deployment of each service (status, commit subject, creation time, deployment id). The "Log" button reads that deployment's build log with dokploy-panel <panel> deployment read-logs.

todos

/tickets opens a pane "Aufgaben" with the open tasks of the current repo, read from a G-Brain (GBrain) knowledge store through its MCP server. The bar above the input field shows Aufgaben N (parked tasks not counted): red if one is overdue, yellow if one is due today or has high priority. A click on it opens the pane.

╭──────────────────────────────────────────────────────────╮
│ Abo-Bestellungen per Tag kennzeichnen                    │
│ überfällig · gestern                                     │
╰──────────────────────────────────────────────────────────╯
╭──────────────────────────────────────────────────────────╮
│ HubSpot-Workflow für die Ankündigungsmail                │
│ seit 2026-10-14  ·  Prio hoch                            │
╰──────────────────────────────────────────────────────────╯
Neu laden  2 offen · Stand 23:20:56

Order: tasks with a due date first (by date), then high priority, then the rest in page order, parked tasks last and dimmed. A click on a task writes it, with its detail lines, into the input field; "Details ›" opens the detail view.

How it works: the mod reads the page todo, takes the list slugs from the lines - [[todo/<name>]] — … under ## Projekte, reads each list and keeps those whose Repos: line names the repo of git remote get-url origin. A repo may be on several lists; each is shown as its own section. Loaded at session start, every 5 minutes, on /tickets and on "Neu laden".

# To-do — My project

Repos: `owner/repo`, `owner/other-repo`

## Offen
- [ ] Task title · seit 2026-10-14 · fällig 2026-10-16 · Prio hoch
  - any number of detail lines
- [ ] Waiting task · wartet auf the supplier
- [ ] Parked task · geparkt

## Erledigt
- [x] …

Parts after · in the title line are read as seit, fällig (both YYYY-MM-DD), wartet auf …, Prio hoch and geparkt; anything else stays in the text. [[a/b]] is shown as a/b.

Requirements, honestly: an MCP server whose tools include get_page, put_page and remember (the mod finds it by these tools, since its name differs between terminal and desktop app); get_page takes { slug, content_only } and answers with JSON containing compiled_truth. In auto mode a mod's MCP call is refused unless get_page is allowed in permissions.allow, e.g. "mcp__<server>__get_page". Without such a store this mod is of no use to you. No credentials are configured here; the connection is the session's own.

Command: /tickets.

ram

Used memory in the bar, polled every 10 seconds from memory_pressure -Q (macOS only): RAM 66% is 100 minus the "free percentage". Grey below 80 %, yellow from 80 %, red from 90 %. Where the command is missing or fails, the entry is left out without a message.

The shared bar

dokploy-statusbar, todos and ram draw into the same band above the input field, which only one hook can fill. Each mod reads the tree of the hooks inside it (next(e)), adds its entry under a sorted key and rebuilds the bar, so the layout does not depend on plugin order. Apps on the left, the rest on the right, separated by · , the Dokploy fetch time last:

 ● api-app  ● web-app  ● worker running 1:20            Aufgaben 3 · RAM 66% · 23:20
 > _

Without Dokploy only Aufgaben and RAM appear. hooks/bar.tsx is the same file in all three mods.

Structure

.claude-plugin/marketplace.json   marketplace "claude-code-mods"
<plugin>/
  .claude-plugin/plugin.json      manifest (name, version)
  hooks/register.tsx              the mod: panes, bands, commands, atoms
  hooks/*.ts                      pure logic (parsing, scanning) plus tests
  types/index.d.ts                state types per plugin

Mods use the claude-code mod API. Tests of the pure logic sit next to the code (*.test.ts); UI behavior can be tested with claude-code/testing.

License

MIT, see LICENSE.

Source 4 files
hooks/register.tsx 199 lines
1import { atom, read, update } from 'claude-code'
2import type { EngineInterface, Register } from 'claude-code'
3
4import type { Deploy, Target } from '../types'
5import { addToBar } from './bar'
6import { clock, deployedCommit, elapsed, pathspecs, linkOf, parseLatest, parsePoll, parseWhen, tailLog, targetsFor } from './parse'
7import type { PollEntry } from './parse'
8
9const PANEL = '/opt/homebrew/bin/dokploy-panel'
10const NODE = '/opt/homebrew/bin/node'
11const deploys = atom({ plugin: 'dokploy-statusbar', key: 'deploys' } as const, [])
12const checkedAt = atom({ plugin: 'dokploy-statusbar', key: 'checkedAt' } as const, '')
13const services = atom({ plugin: 'dokploy-statusbar', key: 'services' } as const, [])
14// Sekundentakt nur für die laufende Zeit; ohne Atom würde die Leiste zwischen zwei Polls stehen.
15const now = atom({ plugin: 'dokploy-statusbar', key: 'now' } as const, 0)
16
17const COLOR: Record<string, string> = { done: 'green', error: 'red', running: 'yellow', idle: 'gray' }
18const SLOW = 30000
19const FAST = 5000
20const FAST_FOR = 120000
21const DISCOVER_EVERY = 600000
22
23// Modulzustand statt Atom: nur der Takt braucht ihn, gezeichnet wird er nicht.
24let polling = false
25let lastPoll = 0
26let lastDiscover = 0
27let fastUntil = 0
28
29// Fehlerbilder, die schon gemeldet wurden: eine dauerhafte Störung soll nicht alle 10 min einen Toast auslösen.
30type Service = Target & { repo: string }
31const toasted = new Set<string>()
32const toastOnce = ($: EngineInterface, text: string) => {
33  if (toasted.has(text)) return
34  toasted.add(text)
35  void $.ui.toast(text)
36}
37
38// Dienste samt Repo aus allen Dokploy-Panels. `dokploy-panel <panel> exec` setzt URL und Key nur für das Skript;
39// discover.cjs gibt nur öffentliche Felder aus, nie Keys. Fällt ein Panel aus, zählen die anderen trotzdem.
40async function discover($: EngineInterface) {
41  lastDiscover = Date.now()
42  try {
43    const list = await $.process.run([PANEL, '--panels'], { timeoutMs: 10000 })
44    if (list.exitCode !== 0) throw new Error((list.stderr || list.stdout).trim().split('\n')[0] || `Exit ${list.exitCode}`)
45    const panels = list.stdout.split('\n').map(p => p.trim()).filter(Boolean)
46    const found = await Promise.all(
47      panels.map(async p => {
48        try {
49          const r = await $.process.run([PANEL, p, 'exec', NODE, `${$.plugin.root}/hooks/discover.cjs`], { timeoutMs: 60000 })
50          if (r.exitCode !== 0) throw new Error((r.stderr || r.stdout).trim().split('\n')[0] || `Exit ${r.exitCode}`)
51          return { ok: true, list: JSON.parse(r.stdout) as Service[] }
52        } catch (err) {
53          toastOnce($, `Dokploy-Zuordnung (${p}) fehlgeschlagen: ${err}`)
54          return { ok: false, list: [] as Service[] }
55        }
56      }),
57    )
58    // Ein ausgefallenes Panel behält seine bisherigen Dienste, statt sie aus der Leiste zu streichen.
59    const old = await read($, services)
60    const merged = found.flatMap((f, i) => (f.ok ? f.list : old.filter(o => o.panel === panels[i])))
61    await update($, services, () => merged)
62  } catch (err) {
63    toastOnce($, `Dokploy-Zuordnung fehlgeschlagen: ${err}`)
64  }
65}
66
67// Liest das Repo bei jedem Lauf neu, damit ein Projektwechsel in der Session sofort greift.
68async function poll($: EngineInterface) {
69  if (polling) return
70  polling = true
71  lastPoll = Date.now()
72  try {
73    const cwd = await $.session.cwd()
74    const remote = await $.process.run(['git', 'remote', 'get-url', 'origin'], { cwd })
75    const targets = targetsFor(await read($, services), remote.exitCode === 0 ? remote.stdout : '')
76    const before = await read($, deploys)
77    // Pro Panel ein Prozess für alle Dienste: ein Infisical-Abruf statt einem je Dienst.
78    const panels = [...new Set(targets.map(t => t.panel))]
79    const entries = new Map<string, PollEntry[] | string>()
80    await Promise.all(
81      panels.map(async p => {
82        const specs = targets.filter(t => t.panel === p).map(t => `${t.kind}:${t.id}`)
83        try {
84          const r = await $.process.run([PANEL, p, 'exec', NODE, `${$.plugin.root}/hooks/poll.cjs`, ...specs], { timeoutMs: 30000 })
85          const list = r.exitCode === 0 ? parsePoll(r.stdout) : null
86          entries.set(p, list ?? ((r.stderr || r.stdout).trim().split('\n')[0] || 'keine Ausgabe'))
87        } catch (err) {
88          entries.set(p, String(err))
89        }
90      }),
91    )
92    const next = await Promise.all(
93      targets.map(async t => {
94        const e = entries.get(t.panel)
95        const d = Array.isArray(e) ? parseLatest(t, e.find(x => x.id === t.id)) : parseLatest(t, undefined, e)
96        // Ohne `git fetch`: ein Push aktualisiert origin/<branch> lokal. Git-Fehler oder kein Treffer → keine Markierung.
97        // Ausstehend heißt: seit dem deployten Commit kam einer, der die watchPaths des Dienstes berührt.
98        let pending = false
99        try {
100          if (d.status === 'done') {
101            const ref = `origin/${t.branch}`
102            const g = await $.process.run(['git', 'log', '-200', '--format=%H%x09%s', ref], { cwd })
103            const hash = g.exitCode === 0 ? deployedCommit(g.stdout, d.title) : ''
104            if (hash) {
105              const c = await $.process.run(['git', 'rev-list', '--count', `${hash}..${ref}`, ...pathspecs(t.watchPaths)], { cwd })
106              pending = c.exitCode === 0 && Number(c.stdout) > 0
107            }
108          }
109        } catch {
110          pending = false
111        }
112        return { ...d, pending }
113      }),
114    )
115    for (const d of next) {
116      const old = before.find(b => b.panel === d.panel && b.app === d.app)
117      if (old && old.status === 'running' && d.status !== 'running') void $.ui.toast(`${d.app}: Deploy ${d.status}`)
118    }
119    await update($, deploys, () => next)
120    await update($, checkedAt, () => new Date().toLocaleTimeString('de-DE'))
121  } finally {
122    polling = false
123  }
124}
125
126async function showLog($: EngineInterface, d: Deploy) {
127  try {
128    if (!d.deploymentId) throw new Error('keine Deployment-ID')
129    const r = await $.process.run([PANEL, d.panel, 'deployment', 'read-logs', '--deploymentId', d.deploymentId, '--tail', '300'], { timeoutMs: 30000 })
130    if (r.exitCode !== 0) throw new Error((r.stderr || r.stdout).trim().split('\n')[0] || `Exit ${r.exitCode}`)
131    const text = `Build-Log von ${d.app} (${d.panel}), letzter Deploy fehlgeschlagen:\n\`\`\`\n${tailLog(r.stdout)}\n\`\`\`\n`
132    await $.prompt.fill({ text })
133  } catch (err) {
134    void $.ui.toast(`Build-Log von ${d.app} nicht abrufbar: ${err}`)
135  }
136}
137
138const runTime = (d: Deploy, tick: number) =>
139  d.status === 'running' && !Number.isNaN(parseWhen(d.when)) ? elapsed(tick - parseWhen(d.when)) : clock(d.when)
140
141export const register: Register = on => {
142  on('session.start', async ($, e, next) => {
143    await $.command.register({ name: 'deploys', description: 'Deploy-Status des Projekts sofort neu abfragen' })
144    void discover($).then(() => poll($))
145    // Ein Sekundentakt für alles: Poll (30 s, nach Push 5 s), Discovery (10 min), laufende Zeit.
146    // shortcut: in Projekten ohne Zuordnung kostet ein Poll nur `git remote`, bei Bedarf Takt je Aufgabe trennen.
147    $.clock.every(1000, async () => {
148      const t = Date.now()
149      if (t - lastDiscover >= DISCOVER_EVERY) void discover($)
150      if (t - lastPoll >= (t < fastUntil ? FAST : SLOW)) void poll($)
151      if ((await read($, deploys)).some(d => d.status === 'running')) await update($, now, () => t)
152    })
153    return next(e)
154  })
155
156  // Nach erfolgreichem `git push` zwei Minuten schneller pollen; der Aufruf bleibt unverändert.
157  // `tool.call` statt PostToolUse, weil `next(e)` das Ergebnis liefert (isError) und der Aufruf unberührt bleibt.
158  on('tool.call', { tool: 'Bash' }, async ($, e, next) => {
159    const r = await next(e)
160    if (e.tool === 'Bash' && /\bgit\s+push\b/.test(e.command) && !r.deny && !r.isError) {
161      fastUntil = Date.now() + FAST_FOR
162      lastPoll = 0
163    }
164    return r
165  })
166
167  on('command.run', { command: 'deploys' }, async $ => {
168    await poll($)
169    const n = (await read($, deploys)).length
170    return { text: n ? 'Deploy-Status aktualisiert.' : 'Für dieses Projekt gibt es keine Dokploy-Dienste.' }
171  })
172
173  on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
174    const inner = await next(e)
175    const list = await read($, deploys)
176    if (e.props.hasSurvey || list.length === 0) return inner
177    const ui = $.ui.resolve(e)
178    const { Box, Button, Link, Text } = ui
179    const at = await read($, checkedAt)
180    const tick = await read($, now)
181    const apps = (
182      <Box gap={1}>
183        {list.map(d => (
184          <Box key={`app:${d.panel}/${d.app}`}>
185            <Text color={d.pending ? 'gray' : (COLOR[d.status] ?? 'magenta')}>● </Text>
186            <Link href={linkOf(d)}>{d.app}</Link>
187            {d.status === 'error' && <Button key={`log:${d.panel}/${d.app}`} plain label=" Log" onPress={() => showLog($, d)} />}
188            {/* „done“ sagt schon der grüne Punkt; Status und Zeit nur, wenn etwas anderes los ist */}
189            <Text dimColor>{d.error ? ' Fehler beim Abruf' : d.pending ? ' ausstehend' : d.status !== 'done' ? ` ${d.status} ${runTime(d, tick)}` : ''}</Text>
190          </Box>
191        ))}
192      </Box>
193    )
194    // Abrufzeit ganz rechts (Schlüssel „9“) und nur als Randnotiz; eine Schriftgröße kennt die Oberfläche nicht, daher nur blasser
195    const withApps = addToBar(ui, inner, 'left', '1-dokploy', apps)
196    return addToBar(ui, withApps, 'right', '9-zeit', <Text color="subtle">{at.slice(0, 5)}</Text>)
197  })
198}
199
hooks/bar.tsx 35 lines
1import type { EngineInterface, RenderElement } from 'claude-code'
2
3type Tree = { props?: { key?: string }; children?: Tree[] }
4type UI = ReturnType<EngineInterface['ui']['resolve']>
5
6// Gemeinsame Leiste über dem Eingabefeld, byte-gleich in dokploy-statusbar, todos und ram (Plugins sind getrennt).
7// `AbovePrompt` ist eine Instanz, die Hooks nesten (erster = äußerster) und deren `next(e)` den Baum der inneren liefert.
8// Jeder Mod liest daher den Baum der inneren, hängt seinen Eintrag unter einem Schlüssel ein und baut die Leiste neu;
9// links/rechts und Reihenfolge ergeben sich aus dem Schlüssel (Sortierung), nicht aus der Plugin-Reihenfolge.
10// shortcut: erkennt nur Bäume mit `key="bar"`; fremde Inhalte stehen darüber, bei Bedarf gezielter einordnen.
11export function addToBar(ui: UI, inner: RenderElement, side: 'left' | 'right', key: string, node: RenderElement): RenderElement {
12  const { Box, Text } = ui
13  const tree = (inner ?? {}) as Tree // falls `next(e)` doch nichts liefert
14  const isBar = tree.props?.key === 'bar'
15  const part = (k: string) => (isBar ? (tree.children?.find(c => c.props?.key === k)?.children ?? []) : [])
16  const entry = (<Box key={`bar:${key}`}>{node}</Box>) as Tree
17  const place = (k: string, items: Tree[]) =>
18    [...items.filter(c => c.props?.key !== `bar:${key}` && c.props?.key !== 'bar:sep'), ...(side === k ? [entry] : [])].sort((a, b) =>
19      String(a.props?.key).localeCompare(String(b.props?.key)),
20    ) as RenderElement[]
21  const left = place('left', part('bar:left'))
22  const right = place('right', part('bar:right'))
23  const bar = (
24    <Box key="bar" justifyContent="space-between">
25      <Box key="bar:left" gap={1}>
26        {left}
27      </Box>
28      <Box key="bar:right">
29        {right.flatMap((c, i) => (i ? [<Box key="bar:sep"><Text color="subtle"> · </Text></Box>, c] : [c]))}
30      </Box>
31    </Box>
32  )
33  return !isBar && (tree.children?.length ?? 0) > 0 ? <Box flexDirection="column">{inner}{bar}</Box> : bar
34}
35
hooks/parse.ts 74 lines
1import type { Deploy, Target } from '../types'
2
3// Eintrag aus poll.cjs: neuestes Deployment eines Dienstes oder ein Fehler.
4export type PollEntry = { id: string; status?: string; title?: string; createdAt?: string; deploymentId?: string; error?: string }
5
6// Dokploy speichert als Titel die ganze Commit-Nachricht; gebraucht wird nur der Betreff.
7// `when` ist der ISO-Zeitstempel von createdAt.
8export const parseLatest = (t: Target, e: PollEntry | undefined, fallbackError = 'keine Ausgabe'): Deploy =>
9  e && e.status
10    ? { ...t, status: e.status, when: e.createdAt ?? '', title: (e.title ?? '').split('\n')[0].trim(), deploymentId: e.deploymentId }
11    : { ...t, status: '?', when: '', title: '', error: e?.error || fallbackError }
12
13// Ausgabe von poll.cjs (JSON-Liste) → Einträge; kein gültiges JSON → null.
14export const parsePoll = (out: string): PollEntry[] | null => {
15  try {
16    const v: unknown = JSON.parse(out)
17    return Array.isArray(v) ? (v as PollEntry[]) : null
18  } catch {
19    return null
20  }
21}
22
23// Wohin ein Klick führt: bei Fehler direkt zu den Deployments mit dem Build-Log, sonst auf die Dienst-Seite.
24export const linkOf = (d: Deploy) => (d.status === 'error' || d.error ? `${d.url}?tab=deployments` : d.url)
25
26export const repoOf = (remoteUrl: string) =>
27  remoteUrl.trim().toLowerCase().replace(/\.git$/, '').match(/github\.com[:/]([^/]+\/[^/]+)$/)?.[1] ?? ''
28
29// Dienste (Ausgabe von discover.cjs) zum Remote. Am Remote statt am Ordnernamen, weil OMS / OMS-2.0 sich sonst verwechseln.
30// Nur der Repo-Name zählt, nicht der Owner: Dokploy behält nach einer Umbenennung des GitHub-Accounts den alten Owner.
31const nameOf = (repo: string) => repo.toLowerCase().split('/')[1] ?? ''
32export const targetsFor = (services: (Target & { repo: string })[], remoteUrl: string): Target[] => {
33  const name = nameOf(repoOf(remoteUrl))
34  return name ? services.filter(s => nameOf(s.repo) === name).sort((a, b) => a.app.localeCompare(b.app)) : []
35}
36
37// Tolerant, weil Dokploy den Titel evtl. kürzt: getrimmt, gleich oder Präfix in eine Richtung.
38const sameTitle = (a: string, b: string) => {
39  const x = a.trim()
40  const y = b.trim()
41  return x !== '' && y !== '' && (x.startsWith(y) || y.startsWith(x))
42}
43
44// Hash des deployten Commits: erster Eintrag aus `git log --format=%H%x09%s` mit passendem Betreff; '' wenn keiner passt.
45export const deployedCommit = (logOut: string, title: string) => {
46  for (const line of logOut.split('\n')) {
47    const [hash, ...rest] = line.split('\t')
48    if (hash && sameTitle(rest.join('\t'), title)) return hash
49  }
50  return ''
51}
52
53// watchPaths → Git-Pathspecs; leer = jeder Commit deployt, also kein `--`.
54export const pathspecs = (watchPaths: string[]) => (watchPaths.length ? ['--', ...watchPaths.map(w => `:(glob)${w}`)] : [])
55
56// ISO-Zeitstempel → ms; NaN, wenn das Format nicht passt.
57export const parseWhen = (when: string) => (/^\d{4}-\d\d-\d\dT/.test(when) ? Date.parse(when) : NaN)
58
59// Uhrzeit HH:MM in lokaler Zeit; '' bei ungültigem Zeitstempel.
60export const clock = (when: string) => {
61  const ms = parseWhen(when)
62  return Number.isNaN(ms) ? '' : new Date(ms).toLocaleTimeString('de-DE', { hour: '2-digit', minute: '2-digit' })
63}
64
65// m:ss; negative oder ungültige Spannen als 0:00 (Uhrenabweichung zum Server).
66export const elapsed = (ms: number) => {
67  const s = Number.isFinite(ms) && ms > 0 ? Math.floor(ms / 1000) : 0
68  return `${Math.floor(s / 60)}:${String(s % 60).padStart(2, '0')}`
69}
70
71// Letzte `n` Zeilen ohne ANSI-Farbcodes.
72export const tailLog = (out: string, n = 80) =>
73  out.replace(/\x1b\[[0-9;?]*[A-Za-z]/g, '').trimEnd().split('\n').slice(-n).join('\n')
74
types/index.d.ts 9 lines
1export type Target = { panel: string; app: string; kind: 'application' | 'compose'; id: string; branch: string; watchPaths: string[]; url: string }
2export type Deploy = Target & { status: string; when: string; title: string; deploymentId?: string; error?: string; pending?: boolean }
3
4declare module 'claude-code' {
5  interface PluginState {
6    'dokploy-statusbar': { deploys: Deploy[]; checkedAt: string; services: (Target & { repo: string })[]; now: number }
7  }
8}
9