Component cycle
Full Life component cycle — pasteable build pipeline (componentize through plate) plus production-ready gates for packages/life/src. Use when taking a component from mockup or legacy code to catalog green dot.
Checklist: packages/life/design-system/docs/agent/PRODUCTION_READY.md · Index: references/production-ready-bar.md
Session prompt (build → plate)
For a new chat, start from references/session-prompt.md: paste the block, fill component name and entry path, and run stages 1–6 inline (then stage 7 below). Stages 1–6 cover build, API shape, polish, motion, stress, and catalog plating.
Production-ready (green dot)
Run the steps below when creating or promoting a Life React component. CI enforces the automated gates; the checklist still covers manual review items.
Component backlog from prototypes
Before starting a component, read the GAPS.md of the prototypes that worked around it. Each entry names the helper and the missing prop or variant. Build the component to remove that workaround, then delete the helper from the prototype in a separate commit. Current backlog from Environments & Projects: locked read-out and inline select, SettingsRows destructive hover action with reserved space, boxed compact density, boxed RadioGroup rows with a trailing slot, a framed code field, and one shared radius token.
0. Scope
- Shippable code lives in
packages/life/src/<Name>/index.tsxand is exported from@sarvam/life. - Internal primitives (
InputWrapper,OverflowMenu) live undersrc/primitives/and are not on the package barrel — see INTERNAL_PRIMITIVES.md. Product apps use field/overlay components; only promote a primitive to a public re-export (likeListbox) when apps must import it directly. - Target styling: Tailwind-only in
index.tsx(cva +sv-*utilities). Reference:Text,Badge. Use Life application wiring for the public stylesheet and package source registration. Full runway: references/tailwind-migration.md and references/migration-batches.md. - Studio catalog previews must not fork shippable styling; unported HTML recipes (if any) live in
apps/studio/src/styles/life-specimen-legacy.cssonly. - Tatva compat layer and Figma comparison sync are out of scope unless explicitly requested.
1. Implement
- Look and feel from visual-direction: flat surface roles, hairlines instead of shadows, concentric radii, muted labels, colour only in glyphs.
- Tokens from
packages/life/design-system/tokens.cssonly; light default, dark viadata-theme="dark". - Greyscale focus only (
tests/focus-css-allowed.test.mjs). - Icons:
@hugeicons-pro/core-stroke-standardorcore-solid-standardonly (ESLint +tests/icons-import-policy.test.mjs).
2. Unit tests
- Colocate
packages/life/src/<Name>/<Name>.test.tsxwith// @vitest-environment jsdom. - Cover roles, keyboard, disabled/loading, controlled vs uncontrolled, deprecated aliases.
3. Production-ready gates (required for green dot)
Add <Name>.production-ready.test.tsx beside the component or split primitive. Use the shared testProductionReady helper to run axe and capture a DOM snapshot for a representative state in each theme. Commit both snapshots and cover other relevant states in the same suite. See the Button reference.
4. Docs and changelog (required)
Follow COMPONENT_DOCS.md: create or update <Name>.docs.mdx in the section order it defines.
- Props — from exported TypeScript types (
Prop | Type | Default | Description). - Keyboard & focus —
Key | Behaviortable from the WAI-ARIA APG pattern you tested in unit/production-ready tests (Tab order and focus return on dismiss). - Tokens used — Tailwind-only: grep
index.tsxfor--sv-*in utilities; legacy: grep the recipe inbundle.cssuntil removed. - Tatva parity — from Tatva source and tatva-parity.md; record the table in the docs and in tatva-parity step 5.
- CHANGELOG —
packages/life/design-system/docs/ops/CHANGELOG.mdwhen the public API or production-ready status changes. pnpm testmust pass (includingpackages/life/tests/component-docs.test.mjsviapnpm --filter @sarvam/life test) before claiming the green dot.
5. Verify locally
pnpm test # node policy suite + vitest (packages/life/src)
pnpm lint
pnpm run tokens:validate && pnpm run tokens
packages/life/tests/production-ready-gates.test.mjs asserts the repo wiring (vitest setup, eslint icon ban, reference tests).
6. Manual bar (skills)
- Stress and accessibility: stress-test — run its state checklist and worst-case data cases alongside APG keyboard, RTL, zoom, forced-colors, and reduced-motion checks. Use its Block or Approve verdict as the result of this stage.
- Specimen parity: plate-my-component.
- Polish: polish-component — themes + focus.
- Visual direction: visual-direction — run its checklist and name the moodboard screen used.
Complete the promotion checklist and record the reviewer, date, public export, and evidence in the Life promotion registry before claiming the green dot.
Finish
Confirm each applicable stage is complete. End the final report with the stage table, then include the stress-test Block or Approve verdict and any Not verified items.
| Stage | Skill | Files changed | Left over |
|---|
Related
- Cursor rule:
.cursor/rules/production-ready-gates.mdc AGENTS.md— catalog green dot vs orange T