Skip to content

feat: Claude Status widget with incident history strip - #553

Open
JimmySpivey wants to merge 1 commit into
sirmalloc:mainfrom
JimmySpivey:feat/claude-status-widget
Open

feat: Claude Status widget with incident history strip#553
JimmySpivey wants to merge 1 commit into
sirmalloc:mainfrom
JimmySpivey:feat/claude-status-widget

Conversation

@JimmySpivey

Copy link
Copy Markdown

What

A new claude-status widget showing live Claude/Anthropic service health from status.claude.com, with an optional incident-history strip.

  • Status word from /api/v2/status.jsonok / minor / major / critical / maintenance, severity-colored; degrades to ? on fetch/parse failure without breaking the line.
  • History strip (toggle with h in the editor): the past 48h as 8 six-hour buckets, one each, colored by the worst incident whose created_at → resolved_at window overlaps the bucket (green none / yellow minor / orange major / red critical). Built from /api/v2/incidents.json, which is only fetched when some item has history enabled.

How

  • Fetch/cache layer (src/utils/claude-service-status.ts) modeled on the existing usage prefetch: async prefetch wired next to usage prefetch in ccstatusline.ts, disk cache in ~/.cache/ccstatusline/ with 5-min TTL, 30s failure backoff, stale-cache fallback, HTTPS_PROXY support, zod-validated parsing.
  • The multi-colored strip needed the renderer's preserve-colors path, which was hardcoded to custom-command. Generalized it into an optional preservesRenderedColors() on the Widget interface (implemented by CustomCommand — behavior unchanged — and ClaudeStatus in history mode). Bars reset foreground only (ESC[39m) so powerline backgrounds survive.
  • Orange has no ansi16 slot: major maps to red there, ansi256 208 / truecolor #ff8700 otherwise. colorLevel: 0 emits plain text.

Testing

  • 24 new tests (bucket overlap incl. boundary/unresolved incidents, impact ranking, malformed JSON, degraded render, editor toggle, preserve-colors flags) — no network, all mocked.
  • bun run lint and bun run build pass; bun test 1891 pass with the same single pre-existing flake (global-command-resolution) that fails on pristine main.
  • Live smoke against the real endpoints rendered current status + the actual Aug 13–15 incidents in the strip.

🤖 Generated with Claude Code

Adds a claude-status widget showing the current Claude/Anthropic service
status from status.claude.com ("ok" for the none indicator, otherwise the
indicator word). An optional 48-hour incident-history strip (toggled with
'h' in the editor) renders eight six-hour buckets colored by the worst
incident overlapping each bucket: green none, yellow minor, orange major,
red critical; impact-none incidents are ignored.

Status and incident responses are cached on disk for ~5 minutes with a
30-second failure backoff, mirroring the usage-fetch/prefetch
architecture; on network failure the widget serves stale data or degrades
to "?" without breaking the status line.

The history strip embeds its own per-bucket foreground codes, so the
custom-command preserve-colors handling in the renderer is generalized
into an optional Widget.preservesRenderedColors() hook (backed by a
widgetPreservesColors() helper) that both widgets now implement. Bar
colors reset only the foreground so powerline backgrounds survive.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@JimmySpivey

Copy link
Copy Markdown
Author

image - each bar is the last 6 hours, 8 bars, 48 hours.
image - colors, red - major outage, yellow - partial outage, yellow green - minor incident, green - operational with no issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants