Codebase intelligence for AI and humans: code health scores, auto-generated docs, git analytics, dead code detection, and architectural decisions via MCP.
Python aicode-complexitycode-healthcode-intelligencecode-qualitydead-codedeveloper-toolsdocumentationgit-analyticsmcpopen-sourcepythonrefactoringstatic-analysistechnical-debt
feat(ui): give the performance queue the quiet findings-card treatment (#4165)
Raghav Chamadiya5837b2046e70
diff --git a/packages/ui/__tests__/health/performance-presentation.test.ts b/packages/ui/__tests__/health/performance-presentation.test.tsindex cb54e13da..0fd9e320f 100644--- a/packages/ui/__tests__/health/performance-presentation.test.ts+++ b/packages/ui/__tests__/health/performance-presentation.test.ts@@ -5,6 +5,7 @@ import {affectedSummary,agentHandoffCall,boundaryLabel,+ causeStandingText,facetValueLabel,humanizeToken,moduleScopeLabel,@@ -165,5 +166,22 @@ describe("module scope", () => {expect(opportunityTitle(top)).toBe("Database call inside a loop in module scope of jobs.py");expect(opportunityEvidenceLine(top)).toBe("module scope of src/jobs.py");});-});+ it("phrases a row's secondary facts as sentences from the server's values", () => {+ const text = causeStandingText(+ opportunity({+ actionability_state: "advisory",+ actionability_reason: "strategy_requires_validation",+ plan_status: "no_safe_plan",+ plan_id: null,+ plan_reason: "No stored plan addresses this cause",+ confidence: "medium",+ }),+ );+ expect(text).toBe(+ "Advisory: Strategy requires validation. No safe plan: No stored plan addresses this cause. The call path resolved with medium confidence.",+ );+ // A reason that already ends a sentence is not given a second stop.+ expect(causeStandingText(opportunity({ plan_reason: "Stored." }))).toContain("Stored plan: Stored. ");+ });+});diff --git a/packages/ui/__tests__/health/performance-view.test.tsx b/packages/ui/__tests__/health/performance-view.test.tsxindex d76338066..b70ca1935 100644--- a/packages/ui/__tests__/health/performance-view.test.tsx+++ b/packages/ui/__tests__/health/performance-view.test.tsx@@ -218,7 +218,10 @@ describe("PerformanceView queue", () => {expect(within(first!).getByText("Run the independent awaits together")).toBeTruthy();expect(within(first!).getByText("Proven safe")).toBeTruthy();expect(within(first!).getByText(/2 call sites across 2 files/)).toBeTruthy();- expect(within(first!).getByRole("button", { name: "Copy prompt for your agent" })).toBeTruthy();+ expect(within(first!).getByText("Plan ready")).toBeTruthy();+ expect(+ within(first!).getByRole("button", { name: /^Copy prompt for your agent: Database call/ }),+ ).toBeTruthy();expect(within(first!).getByRole("link", { name: "Open plan" })).toBeTruthy();// The file is one verb among the row's others, behind its menu.expect(within(first!).queryByRole("button", { name: "Open file" })).toBeNull();@@ -226,6 +229,25 @@ describe("PerformanceView queue", () => {expect(await screen.findByRole("button", { name: "Open the file" })).toBeTruthy();});+ it("keeps every prompt on the queue quiet: no filled prompt without a scope-level one", async () => {+ render(<PerformanceView adapter={adapter()} />);+ await rows();+ const filled = screen+ .getAllByRole("button", { name: /Copy prompt/ })+ .filter((button) => button.className.split(/\s+/).includes("bg-[var(--color-model-muted)]"));+ expect(filled).toEqual([]);+ expect(screen.getByRole("button", { name: /^Copy prompt for these \d+ in / })).toBeTruthy();+ });++ it("keeps the row's tip from opening the drawer, by click or by key", async () => {+ render(<PerformanceView adapter={adapter()} />);+ const [first] = await rows();+ const tip = within(first!).getByRole("button", { name: "Why this cause sits here" });+ fireEvent.click(tip);+ fireEvent.keyDown(tip, { key: "Enter" });+ expect(screen.queryByRole("dialog")).toBeNull();+ });+it("offers no plan link where there is no plan, and says there is no fix yet", async () => {render(<PerformanceView adapter={adapter()} />);const items = await rows();@@ -637,7 +659,7 @@ describe("PerformanceView drawer", () => {const served = vi.fn(async (planId: string, flavor: string) => `served ${planId} ${flavor}`);render(<PerformanceView adapter={adapter({ getRefactoringPlanPrompt: served })} />);const [first] = await rows();- fireEvent.click(within(first!).getByRole("button", { name: "Copy prompt for your agent" }));+ fireEvent.click(within(first!).getByRole("button", { name: /^Copy prompt for your agent:/ }));// No plan fetch on this host, so the evidence handoff, and no drawer.expect(await screen.findByText(/Causal performance opportunity/)).toBeTruthy();expect(screen.queryByText("Show this cause on the map")).toBeNull();@@ -647,7 +669,7 @@ describe("PerformanceView drawer", () => {it("hands a whole area to an agent as one prompt", async () => {render(<PerformanceView adapter={adapter()} />);await rows();- fireEvent.click(screen.getByRole("button", { name: "Copy prompt for these 3" }));+ fireEvent.click(screen.getByRole("button", { name: "Copy prompt for these 3 in src" }));expect(await screen.findByText(/Performance causes in `src`/)).toBeTruthy();expect(document.body.textContent).toContain("perf2_investigate");});diff --git a/packages/ui/__tests__/shared/hairline-card.test.ts b/packages/ui/__tests__/shared/hairline-card.test.tsnew file mode 100644index 000000000..0e4ecedc7--- /dev/null+++ b/packages/ui/__tests__/shared/hairline-card.test.ts@@ -0,0 +1,37 @@+import { describe, expect, it } from "vitest";++import { hairlineCardClass } from "../../src/shared/hairline-card";++const tokens = (variant?: Parameters<typeof hairlineCardClass>[0], highlighted = false) =>+ hairlineCardClass(variant, { highlighted }).split(/\s+/);++describe("hairlineCardClass", () => {+ it("draws a hairline on the page ground: no fill, no shadow", () => {+ const classes = tokens();+ expect(classes).toContain("border");+ expect(classes).toContain("border-[var(--color-border-default)]");+ expect(classes).toContain("bg-transparent");+ expect(classes.some((c) => c.startsWith("shadow"))).toBe(false);+ expect(classes.some((c) => c.startsWith("hover:"))).toBe(false);+ });++ it("strengthens the hairline on hover and focus within for a card of controls", () => {+ const classes = tokens("group");+ expect(classes).toContain("hover:border-[var(--color-border-hover)]");+ expect(classes).toContain("focus-within:border-[var(--color-border-hover)]");+ expect(classes.some((c) => c.includes("ring-"))).toBe(false);+ });++ it("puts the accent only on the focus ring of a card that is itself a control", () => {+ const classes = tokens("link");+ expect(classes).toContain("focus-visible:ring-[var(--color-accent-primary)]");+ expect(classes.filter((c) => c.includes("accent")).every((c) => c.startsWith("focus-visible:"))).toBe(true);+ });++ it("holds the strong hairline with a faint accent ring when highlighted", () => {+ const classes = tokens("group", true);+ expect(classes).toContain("border-[var(--color-border-hover)]");+ expect(classes).toContain("ring-[var(--color-accent-primary)]/40");+ expect(classes).not.toContain("border-[var(--color-border-default)]");+ });+});diff --git a/packages/ui/src/health/fix-first/fix-first-item.tsx b/packages/ui/src/health/fix-first/fix-first-item.tsxindex cb649fa66..f27c45494 100644--- a/packages/ui/src/health/fix-first/fix-first-item.tsx+++ b/packages/ui/src/health/fix-first/fix-first-item.tsx@@ -21,6 +21,7 @@ import { HighlightedCodeBlock } from "../../shared/code-block";import { CommandLine } from "../../shared/command-line";import { PlaceholderHint } from "../../refactoring/placeholder-hint";import { AiPromptButton } from "../ai-prompt-button";+import { MICRO } from "../tokens";import { AGENT_PROMPT_LABEL } from "../ai-prompt-action";import { CONFIDENCE_LABEL, EFFORT_LABEL, STATUS_LABEL } from "../labels";import { TIER_LABEL, fixLocation, fixPlanLabel, tierReason } from "./scope";@@ -39,7 +40,6 @@ const TIER_DOT: Record<FixTier, string> = {later: "border border-[var(--color-text-tertiary)]",};-const MICRO = "font-mono text-[10px] uppercase tracking-[0.12em] text-[var(--color-text-tertiary)]";const LINK ="rounded text-[var(--color-accent-primary)] underline-offset-2 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-accent-primary)]";diff --git a/packages/ui/src/health/performance/actionability-bar.tsx b/packages/ui/src/health/performance/actionability-bar.tsxindex d99c2ce2b..fb515842e 100644--- a/packages/ui/src/health/performance/actionability-bar.tsx+++ b/packages/ui/src/health/performance/actionability-bar.tsx@@ -5,7 +5,7 @@ import type { PerformanceActionabilityState } from "@repowise-dev/types/health";import { ProportionBar } from "../../shared/proportion-bar";import { Segmented, type SegmentOption } from "../../shared/segmented";import type { ActionabilityCounts } from "./grouping";-import { ACTIONABILITY_HINT, ACTIONABILITY_LABEL } from "./presentation";+import { ACTIONABILITY_HINT, ACTIONABILITY_INK, ACTIONABILITY_LABEL } from "./presentation";/*** The scope's split by actionability, as one bar and the one control that@@ -16,15 +16,6 @@ import { ACTIONABILITY_HINT, ACTIONABILITY_LABEL } from "./presentation";const STATES: PerformanceActionabilityState[] = ["plan_ready", "advisory", "investigate", "expected"];-/** One neutral family, darkest where the change is surest; the segment names- * carry the meaning, so no state borrows a health colour. */-const STATE_COLOR: Record<PerformanceActionabilityState, string> = {- plan_ready: "var(--color-text-primary)",- advisory: "var(--color-text-secondary)",- investigate: "var(--color-text-tertiary)",- expected: "var(--color-border-default)",-};-type Choice = PerformanceActionabilityState | "all";export function ActionabilityBar({@@ -65,7 +56,7 @@ export function ActionabilityBar({key: state,label: ACTIONABILITY_LABEL[state],value: counts[state],- color: STATE_COLOR[state],+ color: ACTIONABILITY_INK[state],}))}/>) : null}diff --git a/packages/ui/src/health/performance/actionability-mark.tsx b/packages/ui/src/health/performance/actionability-mark.tsxnew file mode 100644index 000000000..14cd78d8f--- /dev/null+++ b/packages/ui/src/health/performance/actionability-mark.tsx@@ -0,0 +1,22 @@+import type { PerformanceActionabilityState } from "@repowise-dev/types/health";++import { MICRO } from "../tokens";+import { ACTIONABILITY_INK, ACTIONABILITY_LABEL } from "./presentation";++/**+ * A cause's actionability as a dot and a word, the way a finding shows its+ * severity (`SeverityMark`): never a filled pill. The ink is the bar's+ * neutral family, so the row and the bar above it agree.+ */+export function ActionabilityMark({ state }: { state: PerformanceActionabilityState }) {+ return (+ <span className={`inline-flex shrink-0 items-center gap-1.5 ${MICRO}`}>+ <span+ aria-hidden+ className="h-1.5 w-1.5 shrink-0 rounded-full"+ style={{ backgroundColor: ACTIONABILITY_INK[state] }}+ />+ {ACTIONABILITY_LABEL[state]}+ </span>+ );+}diff --git a/packages/ui/src/health/performance/area-groups.tsx b/packages/ui/src/health/performance/area-groups.tsxindex 7f748e837..78db40de7 100644--- a/packages/ui/src/health/performance/area-groups.tsx+++ b/packages/ui/src/health/performance/area-groups.tsx@@ -7,6 +7,7 @@ import type { PerformanceOpportunity } from "@repowise-dev/types/health";import { bulkAgentPromptLabel } from "../ai-prompt-action";import { AiPromptButton } from "../ai-prompt-button";+import { hairlineCardClass } from "../../shared/hairline-card";import type { PerformanceViewAdapter } from "./adapter";import type { PerformanceAreaGroup } from "./grouping";import { ACTIONABILITY_LABEL } from "./presentation";@@ -132,7 +133,7 @@ const AreaCard = memo(function AreaCard({return (<sectionaria-label={`${label}, ${group.total} causes`}- className="rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-surface)]"+ className={hairlineCardClass("group")}><header className="flex flex-col items-start gap-2 px-4 py-3 sm:flex-row sm:items-center sm:gap-3"><button@@ -145,16 +146,21 @@ const AreaCard = memo(function AreaCard({aria-hidden="true"className={`h-4 w-4 shrink-0 text-[var(--color-text-tertiary)] transition-transform ${open ? "rotate-90" : ""}`}/>- <span className="min-w-0 font-mono text-sm font-semibold text-[var(--color-text-primary)] [overflow-wrap:anywhere]">+ <span className="min-w-0 font-mono text-sm font-medium text-[var(--color-text-primary)] [overflow-wrap:anywhere]">{label}</span>- <span className="shrink-0 text-xs tabular-nums text-[var(--color-text-tertiary)]">+ <span className="shrink-0 font-mono text-[11px] tabular-nums text-[var(--color-text-tertiary)]">{countsLine(group)}</span></button>+ {/* Ghost: the tab has no scope-level prompt, so no card claims the+ one filled prompt; the drawer holds it for a single cause. */}<AiPromptButton+ variant="ghost"label={bulkAgentPromptLabel(rows.length)}+ ariaLabel={`${bulkAgentPromptLabel(rows.length)} in ${label}`}onClick={() => onAreaPrompt(group.area, rows, rows.length < group.total)}+ className="-mr-2 whitespace-nowrap"/></header>{open ? (diff --git a/packages/ui/src/health/performance/presentation.ts b/packages/ui/src/health/performance/presentation.tsindex 312c8b5a6..731165a73 100644--- a/packages/ui/src/health/performance/presentation.ts+++ b/packages/ui/src/health/performance/presentation.ts@@ -49,6 +49,16 @@ export const ACTIONABILITY_LABEL: Record<PerformanceActionabilityState, string>expected: "Expected",};+/** One neutral family, darkest where the change is surest; the state's word+ * carries the meaning, so no state borrows a health colour. Shared by the+ * actionability bar and each cause's mark. */+export const ACTIONABILITY_INK: Record<PerformanceActionabilityState, string> = {+ plan_ready: "var(--color-text-primary)",+ advisory: "var(--color-text-secondary)",+ investigate: "var(--color-text-tertiary)",+ expected: "var(--color-border-default)",+};+export const ACTIONABILITY_HINT: Record<PerformanceActionabilityState, string> = {plan_ready: "A named intervention the analysis considers safe to apply.",advisory: "A coherent intervention, but the analysis cannot prove it is safe.",@@ -352,6 +362,28 @@ export function planPresentation(opportunity: PerformanceOpportunity): PlanPresereturn { label: "No safe plan", detail: opportunity.plan_reason, actionable: false };}+/** Ends a clause as a sentence, unless the server's text already does. */+function asSentence(text: string): string {+ const trimmed = text.trim();+ return /[.!?]$/.test(trimmed) ? trimmed : `${trimmed}.`;+}++/**+ * A row's secondary facts in one paragraph, for its tip: why it sits in its+ * actionability state, where its plan stands, and how well its call path+ * resolved. Every value is the server's; this only phrases them.+ */+export function causeStandingText(opportunity: PerformanceOpportunity): string {+ const plan = planPresentation(opportunity);+ return [+ `${ACTIONABILITY_LABEL[opportunity.actionability_state]}: ${humanizeToken(opportunity.actionability_reason)}`,+ plan.detail.trim() ? `${plan.label}: ${plan.detail}` : plan.label,+ `The call path resolved with ${CONFIDENCE_LABEL[opportunity.confidence].toLowerCase()} confidence`,+ ]+ .map(asSentence)+ .join(" ");+}+/** Each fix strategy as the change a person would make (`actionability.FixStrategy`). */const FIX_STRATEGY_LABEL: Record<string, string> = {parallelize_independent_awaits: "Run the independent awaits together",diff --git a/packages/ui/src/health/performance/queue.tsx b/packages/ui/src/health/performance/queue.tsxindex 8796829cd..81ca9166a 100644--- a/packages/ui/src/health/performance/queue.tsx+++ b/packages/ui/src/health/performance/queue.tsx@@ -7,13 +7,17 @@ import type { PerformanceOpportunity } from "@repowise-dev/types/health";import { Button } from "../../ui/button";import { Popover, PopoverContent, PopoverTrigger } from "../../ui/popover";+import { FilePath } from "../../shared/file-path";+import { InfoTip } from "../../shared/info-tip";import { CLICKABLE_ROW_CLS, clickableRowProps } from "../../shared/responsive-table";-import { AGENT_PROMPT_LABEL } from "../ai-prompt-action";-import { AiPromptButton } from "../ai-prompt-button";+import { RowPromptAction } from "../row-prompt-action";+import { MICRO } from "../tokens";+import { ActionabilityMark } from "./actionability-mark";import type { PerformanceViewAdapter } from "./adapter";import {affectedSummary,agentHandoffCall,+ causeStandingText,effortLabel,FIX_SAFETY_LABEL,fixStrategyLabel,@@ -53,7 +57,7 @@ export function OpportunityList({return (<ularia-label={label}- className="divide-y divide-[var(--color-border-default)] border-y border-[var(--color-border-default)]"+ className="divide-y divide-[var(--color-border-default)] border-t border-[var(--color-border-default)]">{items.map((opportunity) => (<OpportunityRow@@ -70,9 +74,8 @@ export function OpportunityList({);}-/** The fix in one line: strategy, gain, effort and safety, each only when known. */-function FixLine({ opportunity }: { opportunity: PerformanceOpportunity }) {- const effort = effortLabel(opportunity);+/** The change to make, and what it buys, in secondary ink. */+function ActionLine({ opportunity }: { opportunity: PerformanceOpportunity }) {const { fix, gain_text: gain } = opportunity;if (!fix) {return (@@ -82,22 +85,45 @@ function FixLine({ opportunity }: { opportunity: PerformanceOpportunity }) {);}return (- <p className="mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-[var(--color-text-secondary)]">- <span className="font-medium text-[var(--color-text-primary)]">- {fixStrategyLabel(fix.strategy)}- </span>- {gain ? <span>saves {gain}</span> : null}- {effort ? (- <span className="rounded border border-[var(--color-border-default)] px-1.5 font-mono text-[10px] uppercase tracking-wider text-[var(--color-text-tertiary)]">- {effort} effort- </span>- ) : null}- <span className="inline-flex items-center gap-1 text-[var(--color-text-tertiary)]">+ <p className="mt-1 text-xs text-[var(--color-text-secondary)]">+ <span className={`${MICRO} mr-1.5`}>Action</span>{" "}+ <span>{fixStrategyLabel(fix.strategy)}</span>+ {gain ? <span>, saves {gain}</span> : null}+ </p>+ );+}++/**+ * The deciding facts on one quiet mono line: effort, safety and reach, each+ * only when known. Why it sits in its state, the plan's standing and how well+ * the path resolved inform a reader but do not decide the row, so they sit+ * behind the tip.+ */+function MetaLine({ opportunity }: { opportunity: PerformanceOpportunity }) {+ const effort = effortLabel(opportunity);+ const { fix } = opportunity;+ const parts: React.ReactNode[] = [];+ if (effort) parts.push(<span key="effort">{effort} effort</span>);+ if (fix) {+ parts.push(+ <span key="safety" className="inline-flex items-center gap-1">{fix.safety === "proven" ? (<span aria-hidden="true" className="h-1.5 w-1.5 rounded-full bg-[var(--color-success)]" />) : null}{FIX_SAFETY_LABEL[fix.safety]}- </span>+ </span>,+ );+ }+ parts.push(<span key="reach">{affectedSummary(opportunity)}</span>);+ return (+ <p className="mt-1.5 flex flex-wrap items-center gap-x-1.5 gap-y-0.5 font-mono text-[11px] tabular-nums text-[var(--color-text-tertiary)]">+ {parts.flatMap((part, index) =>+ index === 0 ? [part] : [<span key={`sep-${index}`} aria-hidden>·</span>, part],+ )}+ <InfoTip+ label="Why this cause sits here"+ content={causeStandingText(opportunity)}+ /></p>);}@@ -135,6 +161,7 @@ const OpportunityRow = memo(function OpportunityRow({<lidata-performance-opportunity={opportunity.opportunity_id}aria-current={selected ? "true" : undefined}+ data-selected={selected || undefined}aria-label={`Inspect ${title}`}className={`${CLICKABLE_ROW_CLS} group/row flex flex-col gap-3 px-1 py-4 sm:flex-row sm:items-start sm:gap-4 ${selected ? "bg-[var(--color-bg-elevated)]" : "hover:bg-[var(--color-bg-elevated)]"@@ -148,17 +175,19 @@ const OpportunityRow = memo(function OpportunityRow({{(opportunity.rank_position + 1).toLocaleString()}</span><div className="min-w-0 flex-1">- <p className="text-[15px] font-semibold leading-snug text-[var(--color-text-primary)]">+ <ActionabilityMark state={opportunity.actionability_state} />+ <p className="mt-1 text-sm font-medium leading-snug text-[var(--color-text-primary)]">{opportunityCause(opportunity)} in{" "}- <code className="font-mono text-[0.85em] [overflow-wrap:anywhere]">+ <code className="font-mono text-[0.9em] [overflow-wrap:anywhere]">{opportunitySubject(opportunity)}</code></p>- <FixLine opportunity={opportunity} />- <p className="mt-1 text-xs text-[var(--color-text-tertiary)]">- <span className="break-all font-mono">{opportunity.file_path}</span> ·{" "}- <span className="tabular-nums">{affectedSummary(opportunity)}</span>+ {/* The path once, name first, the package prefix folded. */}+ <p className="mt-0.5 flex min-w-0 font-mono text-xs text-[var(--color-text-secondary)]">+ <FilePath path={opportunity.file_path} fold className="text-xs" /></p>+ <ActionLine opportunity={opportunity} />+ <MetaLine opportunity={opportunity} /><OpportunityTags opportunity={opportunity} />{planHref ? (<p className="mt-2 text-xs">@@ -175,17 +204,10 @@ const OpportunityRow = memo(function OpportunityRow({</div><div className="flex shrink-0 items-center gap-1 pl-10 sm:pl-0">- {/* Quiet per row: a ghost button shown on hover, focus and the- selected row, always in the tab order; the filled prompt lives on- the area header and in the drawer. Interim styling until the- shared row-action component (L-nav) lands, then swap to it. */}- <AiPromptButton- label={AGENT_PROMPT_LABEL}- onClick={() => onPrompt(opportunity)}- className={`border-transparent bg-transparent transition-opacity focus-visible:opacity-100 sm:group-hover/row:opacity-100 sm:group-focus-within/row:opacity-100 ${- selected ? "" : "sm:opacity-0"- }`}- />+ {/* The shared quiet row action: shown on hover, focus and the+ selected row, always in the tab order. The drawer holds the+ filled prompt. */}+ <RowPromptAction onClick={() => onPrompt(opportunity)} subject={title} /><RowOverflowopportunity={opportunity}title={title}diff --git a/packages/ui/src/health/refactoring-card.tsx b/packages/ui/src/health/refactoring-card.tsxindex bf49bf6be..a9b5a21c0 100644--- a/packages/ui/src/health/refactoring-card.tsx+++ b/packages/ui/src/health/refactoring-card.tsx@@ -4,6 +4,7 @@ import { useState } from "react";import { ArrowUpRight, ChevronDown, ChevronRight } from "lucide-react";import { InfoTip } from "../shared/info-tip";import { FilePath } from "../shared/file-path";+import { hairlineCardClass } from "../shared/hairline-card";import {biomarkerInfo,biomarkerLabel,@@ -12,7 +13,7 @@ import {isWatchOnlyBiomarker,} from "./biomarker-glossary";import type { BiomarkerDetailsRecord } from "./biomarker-details";-import type { Severity } from "./tokens";+import { MICRO, type Severity } from "./tokens";import { EFFORT_LABEL } from "./labels";import { ImpactFigure } from "./impact-figure";import { FindingOpportunityLink } from "./file-opportunity";@@ -26,8 +27,6 @@ import { AiPromptButton } from "./ai-prompt-button";import { AGENT_PROMPT_LABEL } from "./ai-prompt-action";import { cn } from "../lib/cn";-const MICRO = "font-mono text-[10px] uppercase tracking-[0.12em] text-[var(--color-text-tertiary)]";-export type EffortBucket = "S" | "M" | "L" | "XL";export interface HealthWorkItemFinding {@@ -170,12 +169,7 @@ export function HealthWorkItemCard({<divdata-health-work-item={target.file_path}data-highlighted={highlighted || undefined}- className={cn(- "overflow-hidden rounded-lg border bg-transparent transition-colors",- highlighted- ? "border-[var(--color-border-hover)] ring-1 ring-[var(--color-accent-primary)]/40"- : "border-[var(--color-border-default)] hover:border-[var(--color-border-hover)] focus-within:border-[var(--color-border-hover)]",- )}+ className={cn("overflow-hidden", hairlineCardClass("group", { highlighted }))}><div className="p-4 space-y-2"><div className="flex items-center gap-2 flex-wrap">diff --git a/packages/ui/src/health/tokens.ts b/packages/ui/src/health/tokens.tsindex a32f2ec02..2aed910ab 100644--- a/packages/ui/src/health/tokens.ts+++ b/packages/ui/src/health/tokens.ts@@ -45,6 +45,9 @@ export const SEVERITY_CHIP: Record<Severity, string> = {low: "bg-[var(--color-text-tertiary)]/15 text-[var(--color-text-tertiary)] border border-[var(--color-text-tertiary)]/30",};+/** The quiet mono label: a field name, a state word, a small tag. */+export const MICRO = "font-mono text-[10px] uppercase tracking-[0.12em] text-[var(--color-text-tertiary)]";+/** Segment fills for a severity split (ProportionBar `color`). */export const SEVERITY_SEGMENT: Record<Severity, string> = {critical: "var(--color-error)",diff --git a/packages/ui/src/shared/hairline-card.ts b/packages/ui/src/shared/hairline-card.tsnew file mode 100644index 000000000..3693e6d63--- /dev/null+++ b/packages/ui/src/shared/hairline-card.ts@@ -0,0 +1,38 @@+import { cn } from "../lib/cn";++/**+ * The quiet card: a 1px hairline on the page ground, no fill, no shadow, no+ * lift. The hairline strengthens on hover and focus; the accent appears only+ * as a focus ring. For a discrete object a person opens or acts on, never for+ * a section or a statistic (DESIGN_LANGUAGE "Sections before cards").+ *+ * - `static`: a card nothing in it reacts to.+ * - `group`: a card holding its own controls; it answers hover and keyboard+ * focus anywhere inside it.+ * - `link`: the card is itself the focusable control (an `<a>` or `<button>`),+ * so it carries the focus ring.+ *+ * `highlighted` holds the strong hairline with a faint accent ring, for a card+ * the page just scrolled to.+ */+export type HairlineCardVariant = "static" | "group" | "link";++const BASE = "rounded-lg border bg-transparent";+const REST = "border-[var(--color-border-default)]";+const STRONG = "border-[var(--color-border-hover)]";++const VARIANT: Record<HairlineCardVariant, string> = {+ static: REST,+ group: `${REST} transition-colors hover:border-[var(--color-border-hover)] focus-within:border-[var(--color-border-hover)]`,+ link: `${REST} transition-colors hover:border-[var(--color-border-hover)] focus-visible:border-[var(--color-border-hover)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-accent-primary)]`,+};++export function hairlineCardClass(+ variant: HairlineCardVariant = "static",+ { highlighted = false }: { highlighted?: boolean } = {},+): string {+ return cn(+ BASE,+ highlighted ? `${STRONG} ring-1 ring-[var(--color-accent-primary)]/40` : VARIANT[variant],+ );+}