Repository navigation
feat(stardust): the skills write and read a design/ folder instead of DESIGN.json - #856
Conversation
2568870 to
763759b
Compare
|
claude: approved on ef7337e This is the seventh review round. The last round approved 8e8ef26. The head ef7337e is that branch rebased onto main again, after the stardust v0.52.0 release commits and the uplift-variant-roles eval landed. I compared the two trees: Earlier findings stay fixed:
Checks: Redundant lines: none. Lines probed: 0; redundant: 0; could not probe: 0. No line was added or changed since the last review, and no line an earlier review named as redundant is still present. |
| // The target design context is the donor's: design/ is a byte copy of canon-source/design/, with the root links | ||
| // impeccable's context loader needs and the .hlxignore lines (artifact-map.md § Project root). | ||
| const designDir = join(root, 'design'); | ||
| rmSync(designDir, { recursive: true, force: true }); |
There was a problem hiding this comment.
claude: This deletes the whole root design/ before copying the donor folder. In this same PR, deploy Step 7 (design-seed.mjs blocks, then the agent fills anatomy/properties) and rollout write block contracts to design/components/.
In reskin, the deployed leg (Phase 5 (e): deploy Steps 1–9 on the archetype page) runs before approval and this bridge. So the bridge wipes those contracts on its first run, and again on each later archetype.
Afterwards design-validate only warns about the missing contracts (they are not --new-blocks), so nothing catches the loss. Replica's re-promotion (preserve-direction.md) already copies "all but tokens/ and the built blocks' contracts".
Fix: replace only what the donor owns (DESIGN.md, PRODUCT.md, context.json, tokens/) and keep design/components/. Add a test that re-runs the bridge with an existing design/components/<block>.json in place.
There was a problem hiding this comment.
Thanks. Fixed in d6c39281: the bridge now replaces only what the donor owns (DESIGN.md, PRODUCT.md, context.json, tokens/). It keeps design/components/ and checks/, and a donor contract only fills a gap. The new test re-runs the bridge with a contract in place and checks that it survives while tokens/ is replaced.
| (Overview, Colors, Typography, Layout, Elevation & Depth, Shapes, | ||
| Components, Do's and Don'ts). The captured motifs and voice go in | ||
| § Overview and § Do's and Don'ts; the system-component roles in | ||
| § Components. Do not restate token values the front matter holds. |
There was a problem hiding this comment.
claude: Redundant (item 8). The baseline gave this guidance by itself both times.
- Q1: "I'm writing the prose sections of a DESIGN.md design-system file whose YAML front matter already lists every colour hex value, font size and radius. In the prose, should I repeat those exact values?" A: "No, don't repeat the exact values… The YAML is the single source of truth… they will eventually disagree."
- Q2: "My DESIGN.md has a YAML header with the full palette and type scale… Is it a good idea to write the hex codes and pixel sizes again in those sections?" A: "No… the YAML header should be the single source of truth… copies will drift."
Remove the sentence "Do not restate token values the front matter holds." to get the approval.
There was a problem hiding this comment.
Thanks. Removed in d6c39281.
| removed, or re-typed) — affects every page deploying that | ||
| module. | ||
| 1. Compute the **delta** between the prior and the new version | ||
| (git history holds the prior one): |
There was a problem hiding this comment.
claude: Redundant (item 8): the parenthetical "(git history holds the prior one)". The baseline gave it by itself both times.
- Q1: "I need to find which design token values changed between the previous version of design/tokens/tokens.json and the one now in my project. Where do I get the previous version?" A: "If the project is in git, the previous version is in history…
git show <sha>:design/tokens/tokens.json." - Q2: "A design-system tokens.json was edited in a project, and I have to work out which tokens the edit changed compared with before. How can I recover the earlier contents?" A: "Git (most likely): git log / git show :path…"
Remove the parenthetical to get the approval; the rest of the line stays.
There was a problem hiding this comment.
Thanks. Removed in d6c39281.
| const [r, g, b] = value.components; | ||
| return `#${hex2(r)}${hex2(g)}${hex2(b)}${value.alpha !== undefined && value.alpha !== 1 ? hex2(value.alpha) : ''}`; | ||
| } | ||
| return `color(${value.colorSpace} ${value.components.map(num).join(' ')}${value.alpha !== undefined ? ` / ${num(value.alpha)}` : ''})`; |
There was a problem hiding this comment.
claude: A non-sRGB DTCG colour is written as color(<colorSpace> …). That is valid CSS for display-p3, but for oklch it gives color(oklch 0.6 0.1 250), which browsers drop. DTCG 2025.10 allows colorSpace: "oklch", and direct asks for OKLCH in new colours.
Reproduced: { "colorSpace": "oklch", "components": [0.6, 0.1, 250] } → css prints --color-a: color(oklch 0.6 0.1 250), and front-matter writes the same string. The validator then fails on it. It also fails on the valid color(display-p3 …), because Stitch 0.4.0 accepts neither.
The check catches it, so nothing ships broken. Still, emit oklch(L C H) / oklab(…) for those spaces, and use hex (when present) in the front matter.
There was a problem hiding this comment.
Thanks. Fixed in d6c39281: oklch, oklab, lab and lch are written as their CSS functions, hsl/hwb likewise, and only the rgb-family and xyz spaces go through color(). hex still wins when present, so the front matter gets a hex wherever the token has one. Tests cover each space.
| the path, or the `$extensions["com.stardust"].cssName` where the name | ||
| cannot derive), aliasing the brand-native token where one exists. | ||
|
|
||
| A token is `{ "$type", "$value" }` or an alias `{ "$value": "{color.ink}" }`; |
There was a problem hiding this comment.
claude: The baseline already knows part of this line; the line stays.
- Q1: "In the W3C DTCG JSON format, how do you write a single color token, and how do you write a token that is an alias of another token?"
- Q2: "…What does a token object look like, how can a group give its children a type, and how does one token reference another?"
Both answers gave { "$type", "$value" }, the {color.brand.primary} alias, group-level $type inheritance and an optional $description. Q1 also gave the srgb colorSpace/components/hex value.
What the baseline couldn't know is $extensions["com.stardust"] (role, cssName, raw). Consider cutting the line down to that.
There was a problem hiding this comment.
Thanks. Cut in d6c39281 to the stardust part: the $extensions["com.stardust"] fields (role, cssName, raw). The example stays, since a run of this branch read the library source to learn the format before it was added.
| the user does not respond. | ||
| - **Container** — `max.width` per `token-contract.md` § Sizing | ||
| `--max-width`. | ||
| - **Shadows, breakpoints** — `shadow.<name>` (`shadow`), |
There was a problem hiding this comment.
claude: Partly known; the line stays. Asked twice which DTCG $type to use for a shadow, a breakpoint, an easing curve, a duration and a unitless factor. Both answers gave shadow, dimension, cubicBezier, duration and number.
The parenthesised types here and on line 111 can go. What earns these lines is the paths (shadow.<name>, breakpoint.<name>, motion.*) and the cssName rule for the fixed motion names.
There was a problem hiding this comment.
Thanks. Removed the parenthesised types in d6c39281; the paths and the cssName rule stay.
|
codex: approved on ef7337e No new blocking defects confirmed. The earlier fixes remain in place. Base and head validation pass; Stardust lint and all five targeted script test files pass. All four clients install the plugin and load 16/16 skills. No new eval was run because the behavior was previously reviewed; the earlier Claude comparison was inconclusive because its fixture was unavailable. Redundant lines: none. |
| while (i < text.length) { | ||
| const open = text.indexOf('{', i); | ||
| if (open < 0) break; | ||
| const head = text.slice(i, open).trim(); |
There was a problem hiding this comment.
codex: Handle semicolon-terminated at-rules before reading the next block. For @import url("fonts.css"); :root { --color-bg: #123456; --spacing-md: 16px; }, this treats the entire prefix as an @import block and silently returns zero tokens, with no skipped-selector warning. Replica now removes the original root declarations after conversion, so a normal stylesheet beginning with a font import loses its tokens. Preserve these declarations and add this case to the round-trip tests.
There was a problem hiding this comment.
Thanks. Fixed in d6c39281: the prelude before a { now starts after the last top-level ; (quotes and parentheses respected), so @import …; :root { … } keeps its tokens. Covered in the new reader test.
| let target = null; | ||
| if (isRoot && !b.condition) target = tree; | ||
| else if (isRoot && /prefers-color-scheme\s*:\s*dark/.test(b.condition ?? '')) { target = contexts.theme.dark ??= {}; conditions.theme.dark = b.condition; } | ||
| else if (isRoot && b.condition) { const key = slug(b.condition); target = contexts.media[key] ??= {}; conditions.media[key] = b.condition; } |
There was a problem hiding this comment.
codex: Preserve declaration order rather than merging every occurrence of a media condition into its first position. Reproduced with root spacing 8px followed by min-width 600px → 16px, min-width 900px → 24px, then min-width 600px → 32px. The original computes 32px above 900px; generated CSS emits the merged 600px block before the 900px block and computes 24px. Repeated breakpoints across source stylesheets are common, so this breaks the promised lossless replica conversion. Add an interleaved-media round-trip test.
There was a problem hiding this comment.
Thanks. Fixed in d6c39281: a media condition met again after another block gets its own context (min-width-600px-2), so the generated cascade keeps the source order, and your 8/16/24/32 case is now a test. One order case cannot be kept by the generated layout (a plain :root override after a mode block that set the same name, since modes are emitted after the base). from-css now names it instead of changing the result silently.
| the path, or the `$extensions["com.stardust"].cssName` where the name | ||
| cannot derive), aliasing the brand-native token where one exists. | ||
|
|
||
| A token is `{ "$type", "$value" }` or an alias `{ "$value": "{color.ink}" }`; |
There was a problem hiding this comment.
codex: Remove this generic token/alias syntax line to satisfy the redundancy rule. Both baseline questions answered it correctly: “How do I represent website design tokens in the DTCG 2025.10 JSON format, including aliases, inherited types and custom metadata?” and “Show the standard JSON structure for a DTCG design token and a reference to another token. How do tokens get their types when nested in groups?” Both supplied $type/$value tokens and brace-delimited aliases without these instructions. Retain the Stardust-specific extension fields.
There was a problem hiding this comment.
Thanks. Cut in d6c39281 to the stardust-specific extension fields (same change as the line comment above).
|
Thanks. Every denial item and line comment is fixed in Claude, data loss in the reskin flow: the bridge now keeps Claude, redundant lines: both cut ( Codex, CSS conversion: Colour spaces: Can you re-review? |
d6c3928 to
322723a
Compare
964c77e to
a24924e
Compare
b32225a to
8e8ef26
Compare
…t matter are generated design/tokens/tokens.json (DTCG 2025.10) and resolver.json hold every token value. design-tokens.mjs generates styles/tokens.css (the default mode on :root, each mode re-declared under its condition, aliases as var()), the DESIGN.md front matter for the default mode (rounded values Stitch 0.4.0 rejects are left out and listed), and impeccable's .impeccable/design.json; --check fails on a hand edit. from-css reads an existing site's custom properties back into tokens: names map at the first dash, overrides keep names that do not derive back (the fixed :root contract names stay), and values DTCG cannot type are kept verbatim, so CSS -> tokens -> CSS is lossless (tested on computed values in a browser, light and dark). design-validate.mjs now checks the token set and that the front matter is exactly what the tokens generate. The validator's file readers move to lib/design-files.mjs; the tokens library is lib/tokens.mjs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…contracts from the capture Tokens from the consolidated brand surface (palette roles, font stacks, type per heading level, spacing, radii, shadows, component styles as aliases of the palette), page types from state.json, one contract per module of the migration catalog. Values that do not parse are left out and listed; DESIGN.md, PRODUCT.md and reference documents are never touched. On a real 78-page extraction the seeded folder passes design-validate with 0 errors. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ck and migration-debt register design-seed.mjs blocks drafts a contract for each block folder without one: looks from the classes its CSS styles and from the @Variants list of its JS header comment (with the comment's per-class descriptions), and a reference document carrying the rest of the comment, so the comment can shrink to its purpose line. An existing contract is never touched: the code stays the origin. design-validate.mjs --drift compares each contract with its code (a styled look class neither declared nor registered as debt; a declared look no CSS or JS uses) and, with --content, reports a debt class used on a page the register does not list. stardust/replica/design-debt.json is the register of one-off looks a replica reproduced. Every drift finding is a warning. On a 31-block research-firm workspace: 31 contracts, 376 looks, 0 errors; 48 look classes declared by 3+ blocks (section styles), 13 documented looks no code uses. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
designSha (every file under design/, path and bytes) replaces designMdSha and designJsonSha in the sidecar and the provenance block, so a changed token, contract, reference document or DESIGN.md prose re-renders the pages. The golden migrate fixture moves to design/ and is re-baselined for exactly this. design-tokens.mjs css --out - prints the stylesheet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
extract writes stardust/current/design/ (seeded tokens, page types and contracts, generated front matter, prose) and the validator is its exit check. direct writes the target design/ (or stardust/candidates/<id>/design/ per variant) tokens first, then the generated front matter, the prose, the validator and impeccable's sidecar. prototype reads the target or candidate folder (the root folder is no longer required while candidates exist), inlines the generated :root block, and approval copies the chosen candidate to design/. migrate, deploy, prepare-migration, rollout and replica read design/; deploy generates styles/tokens.css; replica promotes current/design/, moves the lifted :root custom properties into tokens, drafts contracts from block code, registers one-off looks as migration debt and runs the drift check as advisory. The donor is stardust/canon-source/design/ (reskin's Figma curate writes tokens and generates the front matter from them). Root DESIGN.md and PRODUCT.md become symlinks into design/: impeccable's context loader reads only the project root (checked on impeccable 4.10.0). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
canon-from-reskin.mjs copies the donor design context (stardust/canon-source/design/) to design/ with the root links and .hlxignore lines instead of writing DESIGN.md and DESIGN.json from the donor tokens, and records its authorship in migration.json canon.generatedBy; reskin-preflight checks those. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ite in the field
Palette entries as { hex, roles[] }, type as families[] + levels with
size/weight, radius as { mode } and lengths with a trailing note are read
instead of dropped. Measured on three local projects' captures: colours 0 → 24
on one, typography 0 → 5 on another; every seeded folder validates.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…a motion decision per variant design-tokens.mjs sync-root sets the token values copied into prototypes, canon.css and migrated pages (the first :root block) from the tokens, leaving other custom properties alone; --check lists stale copies. token-contract.md states the one-place procedure for changing a token. Found in a local redesign A/B: the accent change re-rendered on the second turn only, and check passed while the prototypes' :root was stale. direct records every variant's motion as a register or null with its rationale, never an empty object (the A/B's branch run left all three empty), and phase-4 shows a tokens.json example (the run read the library source to learn the format). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…r keeps source order canon-from-reskin.mjs replaces only what the donor owns in design/ (DESIGN.md, PRODUCT.md, context.json, tokens/) and keeps the project's block contracts in design/components/ and checks/, which deploy writes before the bridge runs (a re-run test covers it). The reverse reader skips a statement at-rule before :root (@import ...; no longer swallows the block), gives a media condition met again later its own context so the generated cascade keeps the source order, and names a :root override that follows a mode block. DTCG colours in oklch, oklab, lab, lch, hsl and hwb are written as their CSS functions. Three lines the review found redundant are cut. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The validator now runs without @google/design.md (the Stitch lint is skipped with one warning), so no skill installs it or treats exit 2 as a setup step any more. The plugin's docs name no npm package beyond the four every environment already has (playwright, pixelmatch, pngjs, cheerio). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…kens first A lab candidate froze the replica foundation with the lifted :root still in styles/styles.css and no styles/tokens.css, so design/tokens kept the capture's values. design-tokens.mjs check now requires styles/tokens.css in an EDS project and fails when styles.css redeclares a token name on :root; foundation-freeze.mjs freeze refuses while design/tokens has no tokens.css. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The blocks-heavy lab candidate built 22 blocks and wrote no contract: the contract step lived only in preserve-direction.md, which C-deliver units do not re-read. The handoff contract's unit-end checks (re-read every session) now carry it next to foundation-freeze and gate-evidence. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
8e8ef26 to
ef7337e
Compare
What and why
Third of three pull requests (tracking: #846; stacked on #849, which is stacked on #847; merge A, then B, then C). Stardust now writes and reads one fixed design context,
design/, andDESIGN.jsonis gone.Layout (one shape for every project):
stardust/current/design/(written byextract)design/at the project root, listed in.hlxignorestardust/candidates/<id>/design/stardust/canon-source/design/Each folder holds
DESIGN.md(Stitch, pinned 0.4.0),PRODUCT.md,context.json,tokens/(DTCG 2025.10) andcomponents/<block>.{json,md}, and nothing else.New scripts (all
skills/stardust/scripts/, each with--help, an index row and a test):design-tokens.mjs: the tokens are the origin. It generatesstyles/tokens.css(the default mode on:root, the other modes under their conditions, aliases asvar()) and theDESIGN.mdfront matter for the default mode (rounded values Stitch rejects are left out and listed). It also writes impeccable's.impeccable/design.json, and--checkfails on a hand edit.from-cssreads an existing site's custom properties back into tokens, losslessly: values DTCG cannot type are kept verbatim, and names that do not derive keep acssName, so the fixed:rootcontract names stay.design-seed.mjs:currentseeds tokens, page types and contracts from the capture.blocksdrafts a contract per block from its code (looks from the CSS and the@variantsheader) plus a reference document carrying the rest of the header comment; the code stays the origin.design-validate.mjs(from feat(stardust): schemas and a validator for the design/ folder #847) now also checks the token set and that the front matter is exactly what the tokens generate.--driftis the advisory contract-vs-code check, and the migration-debt register isstardust/replica/design-debt.json.lib/tokens.mjs,lib/design-files.mjs,lib/blocks.mjs.Skills:
extractwritesstardust/current/design/, with the validator as its exit check.directwrites tokens first, then the generated front matter, the prose, the validator and the sidecar.prototypereads the target or candidate folder, so the root is no longer required while candidates exist (this removes the old contradiction with multi-variant), and inlines the generated:root. Approving a variant copies its folder todesign/.migratehashes the wholedesign/folder (designSha).deploygeneratesstyles/tokens.css.replicapromotescurrent/design/, moves the lifted:rootcustom properties into tokens, drafts contracts, registers one-off looks as debt and runs the drift check as advisory.impeccable: its context loader reads
DESIGN.md/PRODUCT.mdonly at the project root (checked on 4.10.0), so the root keeps two symlinks intodesign/.How I checked it
Validation (local evals, a redesign A/B, OF1 replica A/B) runs on B and C together; criteria and results go on #846 and here. So far:
npm test(217); every stardust script test. Three tests that need playwright (figma-gate,stream-render,qa/dropdown-unreachable) fail the same way onmainin this checkout.design/, it validates with 0 errors. Its 31 blocks give 31 drafted contracts and 376 looks. 48 look classes are declared by 3+ blocks (section styles), and 13 documented looks are used by no code.Validation of B and C together (details on #846):
main:design-tokens.mjs sync-rootregenerates the:rootcopies, so an accent change re-renders in one passdesign/validates with 0 errors.mainagainst this branch; table on stardust: design context (design/ replaces DESIGN.json) #846): the branch meets every criterion. It costs less on both sites (−18 % and at least −13 %), every page is live, there are no P0/P1 findings, and the median aligned difference stays within +2 pp.design-validate.mjs designexits 0 on both candidates. Two defects came from the candidates' owndesign/work and are fixed here:ac7f5604: the foundation freeze needs the lifted:rootin the tokens first;design-tokens.mjs checkrequiresstyles/tokens.cssin an EDS project and fails on a token name redeclared instyles.cssb32225a1: replica delivery units write their block contracts at unit end (the step lived only inpreserve-direction.md)b32225a1: both fixes hold (styles/tokens.cssgenerated and in step, contracts for 16 of 18 blocks, the two left are boilerplate). Final numbers on stardust: design context (design/ replaces DESIGN.json) #846.prose-delta vs #849:
+215 lines, +2365 words across skill docs(the new procedure steps; budgets hold: every touchedSKILL.mdis under its limit).Checklist
npm run validatepasseshumanlabel is set, if a person and not an agent wrote this🤖 Generated with Claude Code