feat(claude): add Claude Design weekly detail metric#388
Conversation
Surface seven_day_omelette as a detail-only "Claude Design" weekly percent line, ignore local Claude settings, and document the new bucket in the provider reference. Made-with: Cursor
🤖 Augment PR SummarySummary: Adds a new Claude plugin detail metric to surface the Claude API Changes:
ctx.util.toIso to normalize resets_at into resetsAt.
🤖 Was this summary useful? React with 👍 or 👎 |
| periodDurationMs: 7 * 24 * 60 * 60 * 1000 // 7 days | ||
| })) | ||
| } | ||
| if (data.seven_day_omelette && typeof data.seven_day_omelette.utilization === "number") { |
There was a problem hiding this comment.
plugins/claude/plugin.js:726 — typeof ...utilization === "number" will also accept NaN/Infinity, which then trips the runtime progress-line validation (invalid used) and can replace metrics with an error line; consider ensuring the value is finite before pushing the line.
Severity: low
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
There was a problem hiding this comment.
Fair point, but intentionally skipping for this PR to stay consistent with the sibling five_hour, seven_day, and seven_day_sonnet blocks, which all use the same typeof === "number" guard without a finite check. The Rust runtime already surfaces non-finite utilization as an error line (see src-tauri/src/plugin_engine/runtime.rs around invalid used), so this is a pre-existing latent behavior shared across all four Claude usage lines. Happy to tighten all of them with Number.isFinite in a follow-up PR if we want the client side to defensively drop the line instead of producing an error row.
| ctx.host.http.request.mockReturnValue({ | ||
| status: 200, | ||
| bodyText: JSON.stringify({ | ||
| seven_day_omelette: { utilization: 7, resets_at: "2099-01-01T00:00:00.000Z" }, |
There was a problem hiding this comment.
Previously the fixture was already in normalized ISO form, so the assertion on `resetsAt` would pass even if `ctx.util.toIso` were bypassed. Use a spaced `UTC` input that only matches after normalization to make the test meaningful. Made-with: Cursor
Summary
seven_day_omelettebucket as a new detail-onlyClaude Designweekly percent line in the Claude plugin, mirroring the existingseven_day_sonnetshape.seven_day_omelettein the Claude provider reference..claude/settings.local.jsonso it stops appearing as untracked.Scope is intentionally narrow: no change to overview cards, primary progress selection,
primaryCandidates, tray wiring, or the local HTTP API shape.Changes
plugins/claude/plugin.json— add detail-scopedClaude Designline betweenSonnetandExtra usage spent.plugins/claude/plugin.js— push a weekly percent progress line whendata.seven_day_omelette.utilizationis numeric; usesctx.util.toIsoforresetsAt.plugins/claude/plugin.test.js— three new cases: numeric utilization renders the line with normalized ISO, missing field omits, non-numeric omits.docs/providers/claude.md— addseven_day_omeletteto the/api/oauth/usageexample..gitignore— ignore.claude/settings.local.json.Test plan
bunx vitest run plugins/claude/plugin.test.js(82/82 passing, incl. 3 new cases)Claude Designline when API returnsseven_day_omelettewith a numeric utilizationMade with Cursor
Note
Low Risk
Low risk: adds a new optional detail-only usage line driven by an additional API field, plus docs/tests and a
.gitignoreentry; no auth, request flow, or overview behavior changes.Overview
Adds a new detail-only weekly usage progress line,
Claude Design, sourced from the Claude APIseven_day_omelettebucket (rendered only whenutilizationis numeric andresets_atis normalized viatoIso).Updates the Claude plugin manifest to include the new line, extends provider docs to document the new response field, adds targeted tests for render/omit behavior, and ignores local
.claude/settings.local.json.Reviewed by Cursor Bugbot for commit 4b2e87b. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by cubic
Adds a new detail-only "Claude Design" weekly percent metric to the Claude plugin using the
seven_day_omeletteAPI bucket. No changes to overview, tray, primary progress, or local API shape.seven_day_omelette.utilizationis numeric (limit 100, 7-day window), normalizingresets_atto ISO.seven_day_omelettein the provider reference.resets_at; ignore.claude/settings.local.json.Written for commit 4b2e87b. Summary will update on new commits.