ENFORCEMENT
The checks below run in CI or local tooling. CI scheduling and local-only coverage are stated separately.
Tokens
app/css/theme.css (@theme) is the single source of truth for brand colour.
The file declares --color-* custom properties; Tailwind generates matching utilities.
The token swatches on the Tokens page read the
same file.
| Gate | Command | Checks |
|---|---|---|
| GateContrast | Commandpnpm lint:contrast | ChecksParses --color-* from theme.css; fails if any documented pair misses WCAG AA |
| GateToken boundary | Commandpnpm lint:css-tokens | ChecksFails a raw hex or color function outside theme.css, a literal z-index outside the --z-* scale, and a focus rule that writes its own ring instead of --focus-ring |
Type and spacing are a maintained token layer in app/css/theme.css: a type scale
from --text-xs to --text-7xl with a --text-min floor that rises from 12px to
13px at 768px and up, spacing steps --spacing-1 to --spacing-16, and a 44px
--spacing-target for interactive targets. lint:contrast checks the color pairs;
the unit tests in app/(en)/design-system/_lib/theme-tokens.test.ts pin the scale, and tests/e2e/type-floor.spec.ts fails any visible text set below --text-min. Z-index, letter spacing and media-query widths are token scales too (--z-*, --tracking-*, --viewport-*); motion uses utilities and named CSS classes, including arbitrary values.
Styling
Components use Tailwind utilities and shared classes in app/css/components-*.css.
The PostCSS configuration uses @tailwindcss/postcss. Design-system component
directories have no CSS Modules.
Components
| Gate | Command | Checks |
|---|---|---|
| GateComponent docs | Commandpnpm check:component-docs | ChecksEvery directory under design-system/components has a ## Name section in components/page.mdx |
| GateUnit tests | Commandpnpm test | ChecksA *.test.tsx beside each component, run in the Vitest suite (jsdom) |
| GateBehavior in a browser | Command*.e2e.ts beside a component | ChecksRun by the four -components Playwright projects (Chromium and WebKit, desktop and mobile) |
| GateVisual regression | Commandtests/e2e/design-system-components.spec.ts | ChecksLocal Darwin component snapshots; ignored in CI by playwright.config.ts |
| GateA11y | Commandpnpm playwright test tests/a11y | Checksaxe-core scan including wcag22aa, zero violations |
Cross-cutting
| Gate | Command |
|---|---|
| GateLint + format | Commandpnpm biome ci --error-on-warnings . |
| GateTypes | Commandpnpm typecheck |
| GateContent schema | Commandpnpm validate-content |
GateClient/RSC naming (app, components, lib; excludes design-system) | Commandpnpm check:client-naming |
| GateDependency pinning | Commandpnpm check:dep-pinning |
| GateDependency vetting (purpose, license, install scripts) | Commandpnpm check:dependency-vetting |
| GateTest integrity (no focused test, assertion-less body or unexplained skip) | Commandpnpm check:test-integrity |
GateDoc drift (paths marked in ARCHITECTURE.md exist) | Commandpnpm check:doc-drift |
| GateSection order (rendered section ids match the registry) | Commandpnpm check:section-order |
| GateChange-filter paths (no orphaned CI path filter) | Commandpnpm check:detect-changes-paths |
| GateStatic analysis (CI scan is non-blocking) | Commandpnpm lint:semgrep |
| GateSecret scan | Commandpnpm gitleaks:staged before commit; the gitleaks CI job |
| GateGlobal chunk size (220KB gzip) | Commandpnpm bundle-check |
| GatePer-route first-load JS (164.2KB gzip) | Commandpnpm route-js-check |
| GateLighthouse (a11y = 100) | Commandpnpm lhci · pnpm lhci:mobile |
Adding a New Component
- Create
design-system/components/NewComponent/with.tsx,.test.tsx, andindex.ts· styled with Tailwind utilities, no.module.css. - Export it from
design-system/index.ts, unless it is a boundary exception:Fieldis deliberately client-only andBrandIconis imported by path, and neither ships through the barrel. - Add a
## NewComponentheading inapp/(en)/design-system/components/page.mdx·check:component-docsfails if it is missing. - Update the counts the docs state (
README.md, the overview and the components page);__tests__/design-system-doc-counts.test.tscompares them with the directory. - If the component gets its own page under
app/(en)/design-system/primitives/, add it toDS_NAV_GROUPSin_components/ds-nav.tsand to both Lighthouse configs;__tests__/design-system-route-coverage.test.tsfails when a page is missing from the menu, the sitemap or either config. - Add a local Darwin visual baseline in
tests/e2e/design-system-components.spec.ts. CI ignores this spec; page-section snapshots and co-located component behavior tests have separate coverage.
quality-fast runs contrast and component-heading checks. The performance job runs
Lighthouse and axe; PRs enter it when the app change filter matches. app/ and
design-system/ changes match that filter. See scripts/detect-changes-paths.mjs.