Second phase of the DESIGN.md migration. Rewrites the two color
dictionaries that back most status/priority/role indicators across the
app, and adds the controlled "chart palette" exception for agent role
colors per user decision in MIGRATION-PLAN section 9.
status-colors.ts (full rewrite, 109 -> 122 lines)
- All 5 dictionaries (statusBadge, statusDot, priorityColor,
issueStatusIcon, agentStatusDot) + 5 defaults rewritten to use
semantic token classes:
* done/completed/approved -> bg-success/15 text-success border-success/30
* error/failed/terminated/rejected -> bg-destructive/15 text-destructive border-destructive/30
* pending/paused/in_review -> bg-warning/15 text-warning border-warning/30
* running/in_progress -> bg-primary/15 text-primary border-primary/30
* idle/planned/backlog/todo -> bg-muted text-muted-foreground border-border
* blocked -> bg-destructive/10 text-destructive border-destructive/25 (softer)
* cancelled/archived -> bg-muted/40 text-muted-foreground/70 border-border
* priority urgent/high/medium/low -> destructive/warning/primary/muted
- Zero raw palette utilities remain (rg verified).
- All export identifiers and signatures preserved; 11 caller files
across ui/src compile unchanged.
- Note: timed_out was not explicitly mapped in the spec but exists
in the source; agent chose warning (semantically closer than error).
agent-role-colors.ts (full rewrite, 17 -> 68 lines)
- Controlled "chart palette" exception: 5 muted desaturated hues,
passed WCAG AA for all 10 combinations (dark + light), 7/10
also pass AAA.
- 11 AgentRole entries cycle through 5 slots via mod-5:
* slot 1 (volt #faff69 dark / olive #4f5100 light): general, pm
* slot 2 (teal #6ee7b7 / #0f766e): devops, cto
* slot 3 (lavender #c4b5fd / violet #6d28d9): designer, cmo
* slot 4 (amber #fcd34d / #b45309): ceo, cfo, researcher
* slot 5 (silver #a0a0a0 / gray #6b6b6b): engineer, qa
- Hue collisions past slot 5 are intentional and documented inline;
secondary differentiation relies on icons/labels.
index.css
- Added 5 --chart-role-* vars to :root and .dark (light + dark modes).
- Mirrored as --color-chart-role-N in @theme inline so
text-chart-role-1..5 become valid Tailwind utilities.
- Minimal surgical additions — nothing else touched.
Verification
- npx tsc --noEmit in ui/: zero errors in modified files. Pre-existing
errors in unrelated files (AgentConfigForm, command.tsx, etc.)
remain unchanged.
- rg '(bg|text|border|ring)-(red|blue|green|amber|yellow|cyan|violet|pink|slate|zinc|neutral|sky|teal|emerald|indigo|rose|orange)-\d'
on modified files: zero matches.
Test follow-up (out of scope, flagged for next PR)
- ui/src/lib/agent-role-colors.test.ts asserts each role has a
"dark:" prefix (no longer true — CSS vars handle dark variants)
and that all roles have unique colors (no longer true — 11 roles,
5 slots). Both assertions need rewriting.
Phase 3 follow-ups
- Sweep agent should verify no component layers raw palette
utilities on top of dictionary output.
- Consumers that previously wrapped statusBadge output in their own
border-* class may now double-border — worth a visual audit.
- agentStatusDot's animate-pulse modifier is gone except on
"running" — if any caller expected animation on "active",
inline handling needed.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
68 lines
2.5 KiB
TypeScript
68 lines
2.5 KiB
TypeScript
import type { AgentRole } from "@paperclipai/shared";
|
|
|
|
/**
|
|
* Agent role → color class mapping.
|
|
*
|
|
* [nexus] Migrated to design system tokens — see MIGRATION-PLAN.md §6.
|
|
*
|
|
* DESIGN.md §2 restricts the palette to "black, neon, green, gray". This file
|
|
* is the one sanctioned exception: a controlled 5-hue "chart palette" so
|
|
* agent-mesh views can differentiate roles at a glance.
|
|
*
|
|
* The 5 hues are defined as CSS variables in `ui/src/index.css`
|
|
* (`--chart-role-1` .. `--chart-role-5`) and exposed as Tailwind utilities via
|
|
* `@theme inline` (`text-chart-role-1` .. `text-chart-role-5`). Each hue is
|
|
* verified to pass WCAG AA for normal text on both the dark canvas (#000) and
|
|
* light canvas (#fafafa).
|
|
*
|
|
* We have 11 agent roles but only 5 slots — we cycle with modular arithmetic.
|
|
* Collisions past 5 roles are accepted (role identity is also carried by
|
|
* labels, icons, and names — color is a secondary signal).
|
|
*/
|
|
|
|
// Ordered list of role → slot assignments. The order is intentional:
|
|
// - generalist/pm get the brand anchor (volt in dark / olive in light)
|
|
// - leadership (ceo/cto/cmo/cfo) spread across the other 4 slots
|
|
// - engineering/design/qa/devops/research reuse the cycle
|
|
// This is mechanical mod-5 over the AGENT_ROLES array order, but declared
|
|
// explicitly so future role additions get a deterministic slot.
|
|
const ROLE_SLOT: Record<AgentRole, 1 | 2 | 3 | 4 | 5> = {
|
|
// Slot 1 — volt / olive (brand anchor, generalist)
|
|
general: 1,
|
|
pm: 1,
|
|
// Slot 2 — teal (ops)
|
|
devops: 2,
|
|
cto: 2,
|
|
// Slot 3 — violet (creative)
|
|
designer: 3,
|
|
cmo: 3,
|
|
// Slot 4 — amber (data / leadership)
|
|
ceo: 4,
|
|
cfo: 4,
|
|
researcher: 4,
|
|
// Slot 5 — gray (support)
|
|
engineer: 5,
|
|
qa: 5,
|
|
};
|
|
|
|
function slotClass(slot: 1 | 2 | 3 | 4 | 5): string {
|
|
// `text-chart-role-N` is a valid Tailwind utility because `--color-chart-role-N`
|
|
// is declared in the `@theme inline` block in index.css.
|
|
return `text-chart-role-${slot}`;
|
|
}
|
|
|
|
export const agentRoleColors: Record<AgentRole, string> = {
|
|
pm: slotClass(ROLE_SLOT.pm),
|
|
engineer: slotClass(ROLE_SLOT.engineer),
|
|
ceo: slotClass(ROLE_SLOT.ceo),
|
|
general: slotClass(ROLE_SLOT.general),
|
|
designer: slotClass(ROLE_SLOT.designer),
|
|
qa: slotClass(ROLE_SLOT.qa),
|
|
researcher: slotClass(ROLE_SLOT.researcher),
|
|
devops: slotClass(ROLE_SLOT.devops),
|
|
cto: slotClass(ROLE_SLOT.cto),
|
|
cmo: slotClass(ROLE_SLOT.cmo),
|
|
cfo: slotClass(ROLE_SLOT.cfo),
|
|
};
|
|
|
|
export const agentRoleColorDefault = "text-muted-foreground";
|