@radicool/throughline 0.18.0 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/adapters/codex/prompts/component-builder.md +24 -1
- package/adapters/codex/prompts/document-component.md +10 -1
- package/adapters/codex/prompts/icon-system-builder.md +4 -0
- package/adapters/codex/prompts/storybook-chromatic-builder.md +114 -7
- package/adapters/codex/prompts/token-builder.md +110 -3
- package/adapters/codex/prompts/token-crosswalk-builder.md +2 -0
- package/adapters/codex/prompts/token-sheet-builder.md +4 -0
- package/adapters/codex/prompts/token-sync-layer.md +140 -20
- package/adapters/cursor/.cursor/commands/document-component.md +10 -1
- package/adapters/cursor/.cursor/rules/component-builder.mdc +24 -1
- package/adapters/cursor/.cursor/rules/icon-system-builder.mdc +4 -0
- package/adapters/cursor/.cursor/rules/storybook-chromatic-builder.mdc +114 -7
- package/adapters/cursor/.cursor/rules/token-builder.mdc +110 -3
- package/adapters/cursor/.cursor/rules/token-crosswalk-builder.mdc +2 -0
- package/adapters/cursor/.cursor/rules/token-sheet-builder.mdc +4 -0
- package/adapters/cursor/.cursor/rules/token-sync-layer.mdc +140 -20
- package/adapters/generic/commands/document-component.md +10 -1
- package/adapters/generic/skills/component-builder/SKILL.md +24 -1
- package/adapters/generic/skills/icon-system-builder/SKILL.md +4 -0
- package/adapters/generic/skills/storybook-chromatic-builder/SKILL.md +114 -7
- package/adapters/generic/skills/token-builder/SKILL.md +110 -3
- package/adapters/generic/skills/token-crosswalk-builder/SKILL.md +2 -0
- package/adapters/generic/skills/token-sheet-builder/SKILL.md +4 -0
- package/adapters/generic/skills/token-sync-layer/SKILL.md +140 -20
- package/package.json +1 -1
- package/references/component-doc-schema.md +11 -1
- package/references/figma-component-standards.md +14 -2
- package/references/figma-scripting.md +12 -2
- package/references/manifest-schema.md +42 -2
- package/references/native-adapter-config.md +112 -25
- package/references/proof-bundle.md +305 -0
- package/references/sync-adapters.md +38 -53
- package/scripts/README.md +140 -6
- package/scripts/build-doc-card-builder.mjs +1 -1
- package/scripts/grep-color-usage.mjs +10 -30
- package/scripts/guard-token-removal.mjs +10 -26
- package/scripts/lib/component-states.mjs +56 -0
- package/scripts/lib/contrast.mjs +117 -0
- package/scripts/lib/dtcg.mjs +123 -4
- package/scripts/lib/native-literal.mjs +22 -2
- package/scripts/lib/proof.mjs +186 -0
- package/scripts/lib/sd-native.mjs +112 -25
- package/scripts/lib/source-scan.mjs +45 -0
- package/scripts/validate-adherence.mjs +895 -0
- package/scripts/validate-token-output.mjs +611 -46
- package/scripts/verify-check.mjs +710 -0
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
# The verification proof bundle (`design-system/proof/`)
|
|
2
|
+
|
|
3
|
+
Each stage of the system leaves a durable record of what it changed, which checks
|
|
4
|
+
ran, what each one found, and why it was allowed to advance. That record is the
|
|
5
|
+
proof bundle. It exists because "run it twice, get the same structure" proves
|
|
6
|
+
idempotency, not quality — and because the checks that do prove quality (the
|
|
7
|
+
Figma read-back, a reviewer verdict, a build result) are prose today, and prose
|
|
8
|
+
evaporates when the run ends.
|
|
9
|
+
|
|
10
|
+
The bundle is **the record, not the enforcement mechanism**. Gates enforce:
|
|
11
|
+
`docs:check` owns documentation drift, the `figma-executor` read-back owns
|
|
12
|
+
structure, `adherence:check` owns code adherence. The bundle persists what each
|
|
13
|
+
gate found. The `verify:check` gate reads it, recomputes what it can off disk,
|
|
14
|
+
and fails when a stored result and a fresh run disagree.
|
|
15
|
+
|
|
16
|
+
## Where it lives
|
|
17
|
+
|
|
18
|
+
`design-system/proof/<stage>.json` — one file per stage, in the user's working
|
|
19
|
+
folder, from the first component built. It is folder-resident exactly like
|
|
20
|
+
`design-system/docs/` (see
|
|
21
|
+
`${CLAUDE_PLUGIN_ROOT}/references/component-doc-schema.md`), so a stage can
|
|
22
|
+
record an entry during the Figma-only *folder* stage, before any repo exists.
|
|
23
|
+
The path is stable across folder→repo; files never move.
|
|
24
|
+
|
|
25
|
+
## The file shape
|
|
26
|
+
|
|
27
|
+
`{ "stage": "<name>", "subjects": { "<subject>": <entry> } }`
|
|
28
|
+
|
|
29
|
+
A **subject** is the thing the entry is about: a component name for a
|
|
30
|
+
per-component stage, or the literal `"system"` for a stage that is not
|
|
31
|
+
per-component. One entry per stage-and-subject, latest wins — the store models
|
|
32
|
+
current state, not history, the same way the manifest does.
|
|
33
|
+
|
|
34
|
+
## The entry shape
|
|
35
|
+
|
|
36
|
+
`{ at, changed, checks, screenshot?, advancedBecause }`
|
|
37
|
+
|
|
38
|
+
- `at` — ISO timestamp, **supplied by the caller**. `Date.now()` is not available
|
|
39
|
+
in every execution context a skill runs in, so the recorder never invents it.
|
|
40
|
+
- `changed` — array of one-line strings saying what this stage changed. May be
|
|
41
|
+
empty.
|
|
42
|
+
- `checks` — non-empty array of `{ name, method, result, evidence }`, where
|
|
43
|
+
`method` is `"derived"` or `"attested"`, `result` is `"pass"` or `"fail"`, and
|
|
44
|
+
`evidence` is a string.
|
|
45
|
+
- `checks[].accepted` — optional, and only on a check. An array of
|
|
46
|
+
`{ fg, bg, mode }` naming pairs a user explicitly accepted as failing. Only
|
|
47
|
+
`contrast-baseline` uses it today.
|
|
48
|
+
- `screenshot` — optional pointer: a Figma node id, or a repo-relative path.
|
|
49
|
+
- `advancedBecause` — one line saying why the stage was allowed to advance.
|
|
50
|
+
|
|
51
|
+
**`accepted`, and why its two readers disagree.** `fg` and `bg` are the dotted
|
|
52
|
+
`CONTRAST_PAIRS` paths, compared after the `normalizeText` fold, so
|
|
53
|
+
`color.text.onEmphasis` and `color.text.on-emphasis` are one role. `mode` is the
|
|
54
|
+
**Figma** mode name `token-builder` saw — `Light`, `Dark` — because at folder
|
|
55
|
+
stage no DTCG file exists yet to name a mode after. A reader that matches on
|
|
56
|
+
`mode` must translate it into that run's file label first.
|
|
57
|
+
|
|
58
|
+
Two skills read the field, and they match on different things:
|
|
59
|
+
|
|
60
|
+
- `token-sync-layer` drops from its own gate run's `color-contrast` failures
|
|
61
|
+
every one whose `(fg, bg, mode)` triple matches an entry. It is the only reader
|
|
62
|
+
that matches on the mode, because it is the only one that knows both names: it
|
|
63
|
+
read the Figma modes and it wrote the DTCG files.
|
|
64
|
+
- `storybook-chromatic-builder` compares its own live run's failures against the
|
|
65
|
+
`fg`/`bg` **roles alone**, to decide whether the `verify:check` it registers
|
|
66
|
+
carries `--skip color-contrast`. A per-mode test would decide nothing there —
|
|
67
|
+
`--skip` is rule-wide, so there is no way to skip contrast in Dark and keep it
|
|
68
|
+
in Light — and that skill could not translate a mode name anyway, having
|
|
69
|
+
neither read the Figma modes nor written the DTCG files.
|
|
70
|
+
|
|
71
|
+
The rule that keeps the field honest: **it is data a caller subtracts, never
|
|
72
|
+
something `verify-check.mjs` reads.** The gate does not know the field exists, and
|
|
73
|
+
an attested `fail` never switches a derived rule off inside it — that would be
|
|
74
|
+
the self-attestation this store exists to avoid. A triple that no longer matches
|
|
75
|
+
any failure is inert, which is how an acceptance retires itself once the pair is
|
|
76
|
+
fixed.
|
|
77
|
+
|
|
78
|
+
**Pointers, never content.** `evidence` and `screenshot` point at things; they do
|
|
79
|
+
not carry them. This is the same rule `components.meta[name].doc` follows, for
|
|
80
|
+
the same reason: the store is committed to the repo and read by humans. A diff
|
|
81
|
+
of a stage file should be legible, and a design system's history should not carry
|
|
82
|
+
inlined screenshots or file contents.
|
|
83
|
+
|
|
84
|
+
## `derived` vs. `attested`
|
|
85
|
+
|
|
86
|
+
This is the load-bearing distinction in the whole store, and the two are not
|
|
87
|
+
equal.
|
|
88
|
+
|
|
89
|
+
- **`derived`** — `verify:check` recomputes the check off disk on every run. The
|
|
90
|
+
stored result is a **cache**. When the rerun disagrees with it, the run fails as
|
|
91
|
+
`proof-contradicted`. A derived result is trustworthy because it is not
|
|
92
|
+
trusted.
|
|
93
|
+
- **`attested`** — an agent observed it live, somewhere the CLI cannot look:
|
|
94
|
+
Figma, a build it ran, a review it received. It is printed on the report's
|
|
95
|
+
informational line and is **never the reason a run passes**.
|
|
96
|
+
|
|
97
|
+
The house precedent for the honest half is `edit-unverified` in
|
|
98
|
+
`${CLAUDE_PLUGIN_ROOT}/references/component-doc-schema.md` — `docs:check` records
|
|
99
|
+
what it cannot read without pretending it verified it. Attested checks are the
|
|
100
|
+
same posture: recorded, visible, never load-bearing.
|
|
101
|
+
|
|
102
|
+
## The manifest pointer
|
|
103
|
+
|
|
104
|
+
`design-system.json` carries a top-level `verification` key — `null` until the
|
|
105
|
+
first stage records an entry. Content on disk, pointers and hashes in the
|
|
106
|
+
manifest, exactly as `components.meta[name].doc` does it. See
|
|
107
|
+
`${CLAUDE_PLUGIN_ROOT}/references/manifest-schema.md`.
|
|
108
|
+
|
|
109
|
+
```json
|
|
110
|
+
{
|
|
111
|
+
"verification": {
|
|
112
|
+
"path": "design-system/proof",
|
|
113
|
+
"stages": {
|
|
114
|
+
"component-builder": {
|
|
115
|
+
"at": "2026-09-12T18:04:00.000Z",
|
|
116
|
+
"adoptedAt": "2026-09-12T17:41:00.000Z",
|
|
117
|
+
"exempt": ["Card"],
|
|
118
|
+
"fingerprint": "3f9c1a7b2d4e6058"
|
|
119
|
+
},
|
|
120
|
+
"token-sync-layer": {
|
|
121
|
+
"at": "2026-09-12T18:20:00.000Z",
|
|
122
|
+
"adoptedAt": "2026-09-12T18:20:00.000Z",
|
|
123
|
+
"fingerprint": "8ab240df1c9e5567"
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
- `path` — the store directory.
|
|
131
|
+
- `fingerprint` — computed over the **whole stage file**, so a hand-edited entry
|
|
132
|
+
is caught (`proof-stale`), the same way `docs:check` catches a hand-edited
|
|
133
|
+
surface.
|
|
134
|
+
- `at` — the timestamp of the latest entry recorded for that stage. It moves with
|
|
135
|
+
every record.
|
|
136
|
+
- `adoptedAt` — **write-once**. Set on a stage's first recorded entry and never
|
|
137
|
+
rewritten: the human-readable "when did this system opt in". No gate reads it.
|
|
138
|
+
- `exempt` — the names this stage has not yet proven. Present only on the
|
|
139
|
+
per-component stages; a system-wide stage omits the key entirely.
|
|
140
|
+
|
|
141
|
+
**Skills write all of this only through `verify-check.mjs --record`.** No skill
|
|
142
|
+
hand-writes a stage file, and none computes a fingerprint by hand — that is how
|
|
143
|
+
the pointer and the file are kept from drifting apart.
|
|
144
|
+
|
|
145
|
+
### `exempt` is capture-once-then-shrink
|
|
146
|
+
|
|
147
|
+
Both halves of the rule are load-bearing, and a reader who implements only the
|
|
148
|
+
first grandfathers the whole adoption batch:
|
|
149
|
+
|
|
150
|
+
1. On a stage's **first** record, `exempt` captures **every** name then in
|
|
151
|
+
`components.built`, sorted.
|
|
152
|
+
2. On **every** record, the first included, the record's own subject is removed
|
|
153
|
+
from `exempt`.
|
|
154
|
+
|
|
155
|
+
The list never gains a name. It can only narrow. It is what scopes the
|
|
156
|
+
per-component `proof-missing` rule to components the stage has not yet proven:
|
|
157
|
+
an existing system that adopts the bundle does not light up with a failure for
|
|
158
|
+
every component built before the bundle existed, and a name leaves the list the
|
|
159
|
+
moment the stage actually proves that component.
|
|
160
|
+
|
|
161
|
+
Capture has to read the whole of `components.built` rather than "everything but
|
|
162
|
+
this subject", because a run's entire batch is already in `built` before the
|
|
163
|
+
record loop reaches the first component. A capture that excluded only its own
|
|
164
|
+
subject would permanently exempt its batch-mates — build four components on the
|
|
165
|
+
upgrade run and three of them are never owed proof again.
|
|
166
|
+
|
|
167
|
+
A stage listed in `verification.stages` with **no** `exempt` key at all exempts
|
|
168
|
+
**nothing**, not everything. A missing list makes the gate louder, not quieter.
|
|
169
|
+
|
|
170
|
+
### No gate compares `updatedAt` against `adoptedAt`
|
|
171
|
+
|
|
172
|
+
However natural it looks, nothing in the verification gate compares
|
|
173
|
+
`components.meta[name].updatedAt` against `adoptedAt`. That field has more than
|
|
174
|
+
one writer: `storybook-chromatic-builder` refreshes it when it promotes a
|
|
175
|
+
component to `"stable"`, which is a different stage from the one that owes the
|
|
176
|
+
entry. So a single storying run drags every pre-existing component's timestamp
|
|
177
|
+
past `component-builder`'s adoption moment, and a date gate would fail a system
|
|
178
|
+
where nothing went wrong. A captured list of names cannot be moved by another
|
|
179
|
+
stage's write, and it is readable in the manifest: the exemption is stated
|
|
180
|
+
rather than inferred.
|
|
181
|
+
|
|
182
|
+
For the same reason, neither `adoptedAt` nor `exempt` is derived from the stage
|
|
183
|
+
file. Entries are latest-wins, so "the earliest `at` in the file" slides forward
|
|
184
|
+
every time the earliest subject is rebuilt.
|
|
185
|
+
|
|
186
|
+
## The stage vocabulary (v1)
|
|
187
|
+
|
|
188
|
+
| Stage | Subject |
|
|
189
|
+
|---|---|
|
|
190
|
+
| `component-builder` | component name |
|
|
191
|
+
| `storybook-chromatic-builder` | component name |
|
|
192
|
+
| `token-sync-layer` | `"system"` |
|
|
193
|
+
| `token-builder` | `"system"` |
|
|
194
|
+
|
|
195
|
+
The machine-readable copy of that split is `PER_COMPONENT_STAGES` in
|
|
196
|
+
`scripts/lib/proof.mjs`, and the full list is `STAGES` beside it. **A change here
|
|
197
|
+
must change those constants** — they are what `verify:check` asks "is this stage
|
|
198
|
+
keyed by component?"
|
|
199
|
+
|
|
200
|
+
`/document-component` and the retrofit phases do not emit entries in v1.
|
|
201
|
+
|
|
202
|
+
## The check names (v1)
|
|
203
|
+
|
|
204
|
+
| Check | Method | Recorded by |
|
|
205
|
+
|---|---|---|
|
|
206
|
+
| `structural-read-back` | attested | `component-builder` |
|
|
207
|
+
| `state-baseline` | attested | `component-builder` |
|
|
208
|
+
| `figma-name` | attested | `component-builder` |
|
|
209
|
+
| `review` | attested | the dispatching skill |
|
|
210
|
+
| `build` | attested | `storybook-chromatic-builder` |
|
|
211
|
+
| `orphan-token` | derived | not recorded: re-derived on every `verify:check` run |
|
|
212
|
+
| `state-incomplete` | derived | `storybook-chromatic-builder` |
|
|
213
|
+
| `name-drift` | derived | `storybook-chromatic-builder` |
|
|
214
|
+
| `contrast-baseline` | attested | `token-builder` |
|
|
215
|
+
| `tokens:validate-output` | attested | `token-sync-layer` |
|
|
216
|
+
| `color-contrast` | derived | `token-sync-layer` |
|
|
217
|
+
|
|
218
|
+
**Two stages record derived results — `storybook-chromatic-builder` and
|
|
219
|
+
`token-sync-layer`** — and each qualifies for one reason and only that reason: it
|
|
220
|
+
runs `verify:check` before it records, so it has the result in hand rather than
|
|
221
|
+
asserting it. That is a property of what the stage does, not of which stage it
|
|
222
|
+
is; a stage that does not run the gate never qualifies. `component-builder` and
|
|
223
|
+
`token-builder` both run at folder stage, with no repo to scan, so they record
|
|
224
|
+
attested checks only.
|
|
225
|
+
|
|
226
|
+
A derived result sitting in a stage file is a cache the next run recomputes. A
|
|
227
|
+
disagreement is `proof-contradicted`.
|
|
228
|
+
|
|
229
|
+
### Contrast: two checks, two methods
|
|
230
|
+
|
|
231
|
+
`contrast-baseline` and `color-contrast` ask the same question in two places,
|
|
232
|
+
and neither substitutes for the other.
|
|
233
|
+
|
|
234
|
+
- **`contrast-baseline`** — attested, recorded by `token-builder`. The ratio an
|
|
235
|
+
agent computed in Figma from the resolved variable values, per mode, at the
|
|
236
|
+
moment the semantic tier was built. Attested because the CLI cannot read Figma.
|
|
237
|
+
- **`color-contrast`** — derived, recorded by `token-sync-layer`. The same
|
|
238
|
+
question recomputed off the DTCG source by `verify:check`, which can read it.
|
|
239
|
+
|
|
240
|
+
This is the `state-baseline` / `state-incomplete` pairing one layer down: the
|
|
241
|
+
agent asserts in the place where the thing is built, the CLI re-derives
|
|
242
|
+
independently off disk, and a system wants both. Catching a bad pair at creation
|
|
243
|
+
time is the point of the first; not having to take that catch on trust is the
|
|
244
|
+
point of the second.
|
|
245
|
+
|
|
246
|
+
## A worked example
|
|
247
|
+
|
|
248
|
+
One stage file with two subjects — `Button`, freshly built and reviewed, and
|
|
249
|
+
`Card`, rebuilt without a review:
|
|
250
|
+
|
|
251
|
+
```json
|
|
252
|
+
{
|
|
253
|
+
"stage": "component-builder",
|
|
254
|
+
"subjects": {
|
|
255
|
+
"Button": {
|
|
256
|
+
"at": "2026-09-12T17:41:00.000Z",
|
|
257
|
+
"changed": [
|
|
258
|
+
"Built Button as a COMPONENT_SET with 18 variants",
|
|
259
|
+
"Bound fills, strokes and radius to semantic variables"
|
|
260
|
+
],
|
|
261
|
+
"checks": [
|
|
262
|
+
{
|
|
263
|
+
"name": "structural-read-back",
|
|
264
|
+
"method": "attested",
|
|
265
|
+
"result": "pass",
|
|
266
|
+
"evidence": "COMPONENT_SET 41:207, 18 children, axes type/size/state"
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
"name": "state-baseline",
|
|
270
|
+
"method": "attested",
|
|
271
|
+
"result": "pass",
|
|
272
|
+
"evidence": "state axis: default, hover, focus, active, disabled"
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
"name": "figma-name",
|
|
276
|
+
"method": "attested",
|
|
277
|
+
"result": "pass",
|
|
278
|
+
"evidence": "Figma node named Button"
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
"name": "review",
|
|
282
|
+
"method": "attested",
|
|
283
|
+
"result": "pass",
|
|
284
|
+
"evidence": "approved"
|
|
285
|
+
}
|
|
286
|
+
],
|
|
287
|
+
"screenshot": "41:207",
|
|
288
|
+
"advancedBecause": "Read-back and review both passed; every variant resolves to bound variables."
|
|
289
|
+
},
|
|
290
|
+
"Card": {
|
|
291
|
+
"at": "2026-09-12T18:04:00.000Z",
|
|
292
|
+
"changed": ["Rebuilt Card with the elevation variant axis"],
|
|
293
|
+
"checks": [
|
|
294
|
+
{
|
|
295
|
+
"name": "structural-read-back",
|
|
296
|
+
"method": "attested",
|
|
297
|
+
"result": "pass",
|
|
298
|
+
"evidence": "COMPONENT_SET 41:418, 6 children, axes elevation/padding"
|
|
299
|
+
}
|
|
300
|
+
],
|
|
301
|
+
"advancedBecause": "Structure verified; no review requested for a variant-axis rebuild."
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
```
|
|
@@ -57,39 +57,35 @@ The cause was the transform group, not the adapter concept. That configuration
|
|
|
57
57
|
now ships as tested code at
|
|
58
58
|
`${CLAUDE_PLUGIN_ROOT}/scripts/lib/sd-native.mjs`, is installed into the
|
|
59
59
|
consumer's repo, and is verified end to end against a real source (195 emitted
|
|
60
|
-
symbols matched,
|
|
61
|
-
|
|
60
|
+
symbols matched, 107 of them with their magnitude also checked, zero rule
|
|
61
|
+
failures under the shipping ruleset, on both light and dark builds).
|
|
62
|
+
The badge is back on that basis. What "matched" does and does not check is in
|
|
63
|
+
*Verify, always* in `${CLAUDE_PLUGIN_ROOT}/references/native-adapter-config.md`.
|
|
62
64
|
|
|
63
65
|
**What the badge does not cover: nothing is compiled.** Every emitted value is
|
|
64
66
|
checked to be a well-formed Swift or Kotlin *literal* — `tokens:validate-output`'s
|
|
65
67
|
`invalid-literal` rule parses each one and fails on anything that is not
|
|
66
68
|
(#53) — but no `swiftc` or `kotlinc` runs, so a type mismatch or a call to an
|
|
67
|
-
undefined symbol would still pass.
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
undefined symbol would still pass. Which values the module quotes, and which it
|
|
70
|
+
drops for having no native form, is stated in §4 and §6 of
|
|
71
|
+
`${CLAUDE_PLUGIN_ROOT}/references/native-adapter-config.md`. A dropped token is
|
|
72
|
+
not hidden: `tokens:validate-output` reports it as unemitted — see
|
|
73
|
+
`${CLAUDE_PLUGIN_ROOT}/scripts/README.md`.
|
|
72
74
|
|
|
73
75
|
Since 0.17.0 that gap is measured rather than assumed on ThroughLine's side:
|
|
74
76
|
this project's end-to-end runs compile what they generate — `kotlinc` typechecks
|
|
75
77
|
`Tokens.kt` against Compose stubs, `swiftc -parse` checks `Tokens.swift` —
|
|
76
|
-
against a real
|
|
78
|
+
against a real 318-token system. That is evidence about the adapter shipped to
|
|
77
79
|
you, not a gate on your build, and it does not widen what the badge asserts
|
|
78
80
|
about your output.
|
|
79
81
|
|
|
80
82
|
`android-kotlin` uses the same module and stays Tier 2: its remaining unknowns
|
|
81
83
|
are on the consumption side — Compose `dp`/`sp` behaviour against a real Compose
|
|
82
84
|
app, resource-qualifier conventions, package layout — which building tokens does
|
|
83
|
-
not exercise.
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
`${CLAUDE_PLUGIN_ROOT}/references/native-adapter-config.md`: a scale primitive
|
|
88
|
-
**nothing references** carries no role and stays `dp`, named by a
|
|
89
|
-
`tokens:validate-output` `unreferenced-text-sibling` advisory; and an `em`
|
|
90
|
-
letterSpacing reaches Compose as a real `.em` TextUnit but is excluded from
|
|
91
|
-
Swift deliberately, since letter spacing there needs a font size no constant
|
|
92
|
-
Swift value could carry.
|
|
85
|
+
not exercise. Which tokens emit as `sp`, and the text-unit limits that remain on
|
|
86
|
+
each platform, are stated once, in §4 of
|
|
87
|
+
`${CLAUDE_PLUGIN_ROOT}/references/native-adapter-config.md`, which is generated
|
|
88
|
+
from the module itself.
|
|
93
89
|
`tokens:validate-output` remains what decides whether any adapter can be
|
|
94
90
|
trusted, and re-promotion is available to any adapter that passes it against a
|
|
95
91
|
real source.
|
|
@@ -144,6 +140,9 @@ emit as references to primitive vars rather than flattened literals.
|
|
|
144
140
|
Tailwind tokens; the standalone `tailwind` adapter maps tokens into the
|
|
145
141
|
Tailwind theme config directly; `mui` emits a JS theme object whose palette
|
|
146
142
|
references preserve the cascade through object structure.
|
|
143
|
+
`tokens:validate-output` checks the generated CSS against its source too, and
|
|
144
|
+
only the CSS: for `tailwind`, the file declaring the custom properties, not the
|
|
145
|
+
theme config. See `${CLAUDE_PLUGIN_ROOT}/scripts/README.md`.
|
|
147
146
|
- **Native adapters** (`ios-swift`, and generated native targets like
|
|
148
147
|
Android/Kotlin): `outputReferences: false` — references resolve to literal
|
|
149
148
|
values at build time, because the target language has no runtime var
|
|
@@ -154,45 +153,31 @@ emit as references to primitive vars rather than flattened literals.
|
|
|
154
153
|
|
|
155
154
|
## What the stock configuration gets wrong
|
|
156
155
|
|
|
157
|
-
|
|
158
|
-
transform group mishandles
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
- **CSS expressions in a value
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
-
|
|
176
|
-
|
|
177
|
-
resolver will not traverse into one, so every alias to the child fails to
|
|
178
|
-
resolve and emits as a bare literal; its collector also stops there, so the
|
|
179
|
-
child is never emitted at all. *Fix: a preprocessor that resolves aliases and
|
|
180
|
-
hoists the children.*
|
|
181
|
-
- **`%` and `em` dimensions** — parent-relative or container-relative, so there
|
|
182
|
-
genuinely is no build-time native magnitude. This one is a real limit rather
|
|
183
|
-
than a configuration gap. *Handling: filter them out of native builds — on the
|
|
184
|
-
authored value, since a `100%` token may be typed `string`, not `dimension`.*
|
|
156
|
+
Real token sources carry all of these, and a **stock** Style Dictionary
|
|
157
|
+
transform group mishandles them silently — emitting output that compiles and is
|
|
158
|
+
wrong, which is why `tokens:validate-output` exists.
|
|
159
|
+
|
|
160
|
+
The native fixes ship as a tested module at
|
|
161
|
+
`${CLAUDE_PLUGIN_ROOT}/scripts/lib/sd-native.mjs`. **Import that module** rather
|
|
162
|
+
than configuring a native adapter from a stock `transformGroup` or transcribing
|
|
163
|
+
the reference doc. What goes wrong in each case, and exactly what the module does
|
|
164
|
+
about it, is stated once, in
|
|
165
|
+
`${CLAUDE_PLUGIN_ROOT}/references/native-adapter-config.md`, which is generated
|
|
166
|
+
from the module and checked for freshness in CI. This list only points there:
|
|
167
|
+
|
|
168
|
+
- **`px`-authored dimensions** — the stock groups assume `rem` and multiply by
|
|
169
|
+
16. See §1, *Read the authored unit*.
|
|
170
|
+
- **CSS expressions in a value**, such as `color-mix()` — see §2, *Compute
|
|
171
|
+
`color-mix()` to a literal*.
|
|
172
|
+
- **Dual-node tokens**, a node carrying both a `$value` and children — see §3,
|
|
173
|
+
*Resolve aliases and hoist dual-node children*.
|
|
174
|
+
- **`%` and `em` dimensions** — see `nativeFilter` in §4, *Assemble the platform
|
|
175
|
+
from the stock list*.
|
|
185
176
|
- **A third mode axis** — this reference models theme (`.dark` /
|
|
186
177
|
`[data-theme]`) and brand (`[data-brand]`). A viewport axis carrying its own
|
|
187
178
|
spacing and type scales is common and has no mapping here; on native it is
|
|
188
179
|
size classes and resource qualifiers, resolved by a different mechanism
|
|
189
|
-
entirely.
|
|
190
|
-
|
|
191
|
-
**Native dimension transforms must read the authored unit.** The stock
|
|
192
|
-
`ios-swift` and `compose` transform groups assume `rem` input and multiply by
|
|
193
|
-
16. Against a `px`-authored source that silently produces output at sixteen
|
|
194
|
-
times scale which compiles and ships. Emit 1:1 for `px` and unitless ratios;
|
|
195
|
-
×16 only for `rem`.
|
|
180
|
+
entirely. The module does not address this one.
|
|
196
181
|
|
|
197
182
|
## Brownfield value transforms
|
|
198
183
|
|
package/scripts/README.md
CHANGED
|
@@ -10,9 +10,11 @@ tested here; copied verbatim by `token-crosswalk-builder` into the user's
|
|
|
10
10
|
| `validate-crosswalk.mjs` | Resolve every `newToken` against the DTCG token source; assert resolved value == `newValue`, N/N. The CI gate. | `tokens:validate` |
|
|
11
11
|
| `build-reverse-index.mjs` | Emit a `codeToken -> newToken` map from the crosswalk to semi-automate SCSS/Tailwind swaps. | `tokens:reverse-index` |
|
|
12
12
|
| `guard-token-removal.mjs` | Grep `.ts/.tsx` (minus generated + tests) for about-to-be-deleted symbols; blocks cleanup until zero references remain. | run during the cleanup phase |
|
|
13
|
-
| `validate-token-output.mjs` | Assert generated
|
|
13
|
+
| `validate-token-output.mjs` | Assert generated token output — Swift, Kotlin, or web CSS custom properties — matches its DTCG source: authored-unit fidelity and no mode collisions everywhere, plus no leaked CSS syntax and no bare unit literals in Swift and Kotlin. Fails when no emitted symbol matches a source token, and reports match rate, unparsed lines, and unemitted tokens on every run. | `tokens:validate-output` |
|
|
14
|
+
| `validate-adherence.mjs` | Assert the code *consuming* a design system still adheres to it: every referenced component exists, every literal variant value is one the system declares, and no colour, spacing, radius or type literal duplicates a token that already holds that value. Fails when an enabled rule had nothing to check, so a green run always means something was verified. | `adherence:check` |
|
|
15
|
+
| `lib/source-scan.mjs` | Shared source-tree walker (`walk`, `DEFAULT_EXCLUDES`, `SOURCE_EXT`) plus `normalizeName`, the display-name-to-code-identifier fold. Every gate that scans a consumer's repo reads it from here rather than carrying its own copy. | copied alongside `guard-token-removal.mjs`, and in the documentation set for `validate-adherence.mjs` and `verify-check.mjs` |
|
|
14
16
|
| `lib/crosswalk.mjs` | Shared loader + structural validation for `crosswalk.json` (used by the validator and reverse-index). | copied alongside |
|
|
15
|
-
| `lib/dtcg.mjs` | Shared DTCG flatten + `{alias}` resolution. Dual-node aware: a node carrying both a `$value` and children yields its own value **and** is descended into. Used by `validate-crosswalk.mjs
|
|
17
|
+
| `lib/dtcg.mjs` | Shared DTCG flatten + `{alias}` resolution. Dual-node aware: a node carrying both a `$value` and children yields its own value **and** is descended into. Used by `validate-crosswalk.mjs`, `validate-token-output.mjs`, `validate-adherence.mjs`, `verify-check.mjs`, and `lib/sd-native.mjs`. | copied alongside each of those |
|
|
16
18
|
| `lib/sd-native.mjs` | The Style Dictionary native configuration as code: unit-aware dimension transforms, `color-mix` computation, dual-node preprocessing, platform assembly, and a per-mode source guard. Style Dictionary is a parameter, never an import. | copied alongside `validate-token-output.mjs` |
|
|
17
19
|
| `lib/native-literal.mjs` | Shared grammar for "is this a well-formed Swift or Kotlin literal": parses rather than pattern-matches, so an unquoted string, a raw CSS function, or any other unanticipated case fails the same way. Used by `sd-native.mjs`'s output filter and by `validate-token-output.mjs`'s invalid-literal rule. | copied alongside `validate-token-output.mjs` and `lib/sd-native.mjs` |
|
|
18
20
|
| `crosswalk.schema.json` | The finalized JSON Schema for `crosswalk.json` (contract + editor support). | copied beside `crosswalk.json` |
|
|
@@ -22,6 +24,10 @@ tested here; copied verbatim by `token-crosswalk-builder` into the user's
|
|
|
22
24
|
| `lib/doc-record.mjs` | Canonical record load + `canonicalFingerprint` (sha256 over the record minus `provenance`). The fingerprint every surface is stamped with. | copied alongside docs-check.mjs |
|
|
23
25
|
| `lib/doc-card-render.figma.js` | Figma renderer template for the doc card's `Usage` band and header. Inlined into `references/doc-card-builder.md`; never executed as a module. | plugin-internal (not installed) |
|
|
24
26
|
| `lib/doc-card-plan.mjs` | Pure layout planner for the doc card's `Usage` band + `DOC_CARD_RENDERER_VERSION` (single source of the layout version). Inlined into `references/doc-card-builder.md`; imported by `docs-check.mjs`. | copied alongside docs-check.mjs; also inlined into the generated builder |
|
|
27
|
+
| `verify-check.mjs` | The verification proof bundle: records each stage's entry, and re-derives what it can rather than trusting the record. Fails on an orphaned token, a component documented without its archetype's baseline interaction states, a name that drifts between the manifest, its record and its code surface, or a recorded result the rerun contradicts. | `verify:check` |
|
|
28
|
+
| `lib/proof.mjs` | The proof store's vocabulary and mechanics: the stage list, entry validation, latest-wins merge, and the fingerprint the manifest pointer carries. | copied alongside `verify-check.mjs` |
|
|
29
|
+
| `lib/component-states.mjs` | The archetype table and resolver behind `state-incomplete` — which baseline interaction states each kind of component owes, and when to abstain. | copied alongside `verify-check.mjs` |
|
|
30
|
+
| `lib/contrast.mjs` | The WCAG contrast maths and the semantic colour pairs behind `color-contrast` — which text role must clear which surface, in every mode, and where the rule deliberately abstains. | copied alongside `verify-check.mjs` |
|
|
25
31
|
| `build-doc-card-builder.mjs` | Generate `references/doc-card-builder.md` from the planner + the Figma renderer template (`lib/doc-card-render.figma.js`). `--check` gates CI. | plugin-internal (not installed) |
|
|
26
32
|
| `build-native-adapter-config.mjs` | Generate `references/native-adapter-config.md` by slicing `lib/sd-native.mjs` on its `@doc-section` markers and interleaving each fragment under its prose. Fails when module code falls outside every section, so the doc cannot silently ship incomplete. `--check` gates CI. | plugin-internal (not installed) |
|
|
27
33
|
|
|
@@ -29,7 +35,7 @@ tested here; copied verbatim by `token-crosswalk-builder` into the user's
|
|
|
29
35
|
registering them leaves a repo with a script on disk and no entry point, which
|
|
30
36
|
is how a stale `docs:check` went unnoticed for a full release. Both
|
|
31
37
|
`storybook-chromatic-builder` (first-time setup) and `/document-component`
|
|
32
|
-
(freshness refresh) install the same
|
|
38
|
+
(freshness refresh) install the same twelve files and register the same five
|
|
33
39
|
scripts:
|
|
34
40
|
|
|
35
41
|
| File | npm script |
|
|
@@ -39,9 +45,29 @@ scripts:
|
|
|
39
45
|
| `docs-lint.mjs` | `"docs:lint": "node scripts/docs-lint.mjs"` |
|
|
40
46
|
| `lib/doc-record.mjs` | — (imported by the above) |
|
|
41
47
|
| `lib/doc-card-plan.mjs` | — (imported by the above) |
|
|
48
|
+
| `validate-adherence.mjs` | `"adherence:check": "node scripts/validate-adherence.mjs --root ../../apps --system ../.. --package <specifier> --tokens dtcg/tokens.json"` |
|
|
49
|
+
| `lib/source-scan.mjs` | — (imported by the above) |
|
|
50
|
+
| `lib/dtcg.mjs` | — (imported by the above) |
|
|
51
|
+
| `verify-check.mjs` | `"verify:check": "node scripts/verify-check.mjs --root ../.. --tokens dtcg/tokens.json"` |
|
|
52
|
+
| `lib/proof.mjs` | — (imported by the above) |
|
|
53
|
+
| `lib/component-states.mjs` | — (imported by the above) |
|
|
54
|
+
| `lib/contrast.mjs` | — (imported by the above) |
|
|
42
55
|
|
|
43
56
|
A refresh that adds a file must also add its npm script; check `package.json`
|
|
44
|
-
for all
|
|
57
|
+
for all five npm scripts every time, not just the file that changed.
|
|
58
|
+
|
|
59
|
+
`verify:check`, like `adherence:check`, carries placeholder paths the installing
|
|
60
|
+
skill substitutes for the repo's real layout. Dropping `--tokens` rather than
|
|
61
|
+
substituting it is how a repo ends up with a rule that never runs: with no token
|
|
62
|
+
source there is nothing to read, so the gate reports both `orphan-token` and
|
|
63
|
+
`color-contrast` as skipped on every run — two stop conditions disabled by their
|
|
64
|
+
own registration.
|
|
65
|
+
|
|
66
|
+
The registered form carries a single `dtcg/tokens.json`, and a system whose
|
|
67
|
+
values span modes registers **one `--tokens` per mode file**, because each source
|
|
68
|
+
file is its own mode. Registering a multi-mode system with a single `--tokens`
|
|
69
|
+
flag leaves a script that checks Light and reports that it checked one mode —
|
|
70
|
+
quieter than the dropped `--tokens` failure above it, and just as wrong.
|
|
45
71
|
|
|
46
72
|
The crosswalk contract is documented in
|
|
47
73
|
`${CLAUDE_PLUGIN_ROOT}/references/crosswalk-schema.md`.
|
|
@@ -52,15 +78,123 @@ The crosswalk contract is documented in
|
|
|
52
78
|
node validate-crosswalk.mjs --crosswalk crosswalk.json --tokens dtcg/tokens.json
|
|
53
79
|
node build-reverse-index.mjs --crosswalk crosswalk.json --out crosswalk.reverse.json
|
|
54
80
|
node guard-token-removal.mjs --root . --symbols symbols-to-remove.txt
|
|
81
|
+
node validate-adherence.mjs --root ../../apps --system ../.. --package @acme/ui --tokens dtcg/tokens.json
|
|
82
|
+
node validate-token-output.mjs --source dtcg/primitives.json --source dtcg/semantic.dark.json --output css/tokens.css --platform shadcn --block .dark --min-match 1
|
|
83
|
+
node verify-check.mjs --root ../.. --tokens dtcg/tokens.json
|
|
84
|
+
node verify-check.mjs --record --stage component-builder --subject Button --entry entry.json
|
|
55
85
|
```
|
|
56
86
|
|
|
87
|
+
`validate-adherence.mjs` takes every path explicitly because cwd is the package
|
|
88
|
+
holding the script, not the repo root. `--system` has no default: defaulting it
|
|
89
|
+
to `--root` resolves to a path that does not exist. `--tokens` is repeatable, so
|
|
90
|
+
a system whose values span mode files passes each one. An alias resolves against
|
|
91
|
+
every `--tokens` file, so a semantic file can point at primitives in another, and
|
|
92
|
+
the report's `colour:` line counts the colour tokens it skipped as unresolvable or
|
|
93
|
+
non-hex. Files inside the package
|
|
94
|
+
that owns a `--tokens` file are not scanned when that package sits beneath
|
|
95
|
+
`--root`, and the report prints an `excluded:` line naming it. A tag whose name
|
|
96
|
+
starts with a built component's name and continues with a capital letter
|
|
97
|
+
(`CardTitle` for `Card`) is read as part of that component, and the report lists
|
|
98
|
+
each one on a `parts:` line. `--skip <rule>`
|
|
99
|
+
switches a rule off entirely (a name that isn't a rule exits `2`, rather than
|
|
100
|
+
skipping nothing), and a skipped rule is absent rather than inert, which
|
|
101
|
+
is the supported answer for a repo the rule cannot apply to (a Vue, Svelte or
|
|
102
|
+
Angular app has no JSX for the component rules to read). An Angular `.html`
|
|
103
|
+
template is read through its styling attributes only: `style`, `class`,
|
|
104
|
+
`ngStyle`, `ngClass`, the SVG colour attributes (`fill`, `stroke`, `stop-color`,
|
|
105
|
+
`flood-color`, `lighting-color`, `color`), and their bindings (`[attr.fill]`,
|
|
106
|
+
`[style.color]`). Text content, `data-*`, `href`, comments and unquoted values
|
|
107
|
+
are not read. Colour is read from all of these. Dimensions are read only where a
|
|
108
|
+
property name sits beside the value: `prop: value` in `style` or `ngStyle`, and
|
|
109
|
+
an arbitrary-value class like `p-[12px]`. `[style.padding.px]="12"` is not.
|
|
110
|
+
`--skip token-exists-for-dimension`
|
|
111
|
+
is the answer for a system with no spacing, radius or type tokens, which
|
|
112
|
+
otherwise fails as `dimension-rule-inert`.
|
|
113
|
+
|
|
114
|
+
`validate-token-output.mjs` reads web output as CSS custom properties for
|
|
115
|
+
`--platform shadcn`, `tailwind` and `vanilla-css`. `mui` exits `2`: a MUI theme,
|
|
116
|
+
like a Tailwind v3 JavaScript config, has no custom properties to read, and
|
|
117
|
+
isn't checked yet (#127). Web puts every mode in one file, so run the gate once
|
|
118
|
+
per mode block, passing the sources that block was built from. `--block` names
|
|
119
|
+
the block by its enclosing at-rules and selector, joined by single spaces:
|
|
120
|
+
`:root`, `.dark`, `[data-theme="light"]`, `@media (min-width: 768px) :root`,
|
|
121
|
+
`@theme inline`. A file with one block needs no `--block`. A file with several,
|
|
122
|
+
or a `--block` that isn't there, exits `2` and lists every block with its
|
|
123
|
+
declaration count, so the exact key is in the error. A build split across files
|
|
124
|
+
passes each one as another `--output`: everything declared in any of them counts
|
|
125
|
+
as declared, and a token declared in any block counts as emitted. Six rules fail
|
|
126
|
+
a web run:
|
|
127
|
+
|
|
128
|
+
- `unit-fidelity` — the value changed magnitude, or a ratio gained a unit, or a
|
|
129
|
+
length lost one (`16` → `16rem`, `1.1` → `1.1rem`, `16px` → `16`). `16` →
|
|
130
|
+
`1rem` passes.
|
|
131
|
+
- `reference-fidelity` — a declaration's `var()`s don't name the tokens its
|
|
132
|
+
source references.
|
|
133
|
+
- `dangling-reference` — a `var()` to a variable no `--output` declares, unless
|
|
134
|
+
the source wrote that `var()` itself.
|
|
135
|
+
- `no-unresolved-reference` — a `{reference}` reached the CSS unresolved.
|
|
136
|
+
- `invalid-value` — `[object Object]`, `NaN` or `undefined` was written into the
|
|
137
|
+
CSS.
|
|
138
|
+
- `unverifiable-dimension` — a dimension came out in a form the gate can't
|
|
139
|
+
compare, so it was never checked.
|
|
140
|
+
|
|
141
|
+
Nothing fails for being CSS: `var()`, `calc()`, `color-mix()` and units are all
|
|
142
|
+
legal output. On `shadcn` and `tailwind`, a declaration with no source token
|
|
143
|
+
whose whole value is a `var()` to a declared variable is an alias layer
|
|
144
|
+
(`--background: var(--color-bg-canvas)`). The report counts aliases on their own
|
|
145
|
+
line and leaves them out of the match rate, so `--min-match 1` still holds.
|
|
146
|
+
|
|
147
|
+
`verify-check.mjs` has two modes. The **gate** — `--root <dir>`, repeatable
|
|
148
|
+
`--tokens` and `--source`, repeatable `--skip` — reads the proof store at
|
|
149
|
+
`design-system/proof/`, re-derives every check a stage recorded as `derived`, and
|
|
150
|
+
fails on `orphan-token`, `state-incomplete`, `name-drift`, `color-contrast`,
|
|
151
|
+
`proof-missing`, `proof-stale`, `proof-contradicted`, `nothing-verified`,
|
|
152
|
+
`orphan-rule-inert` and `contrast-rule-inert`.
|
|
153
|
+
`archetype-unknown` and `proof-unadopted` are informational. With no `--source`
|
|
154
|
+
the walk covers `--root`; the package that owns a `--tokens` file is set aside
|
|
155
|
+
either way, and the report prints an `excluded:` line naming it — without that,
|
|
156
|
+
generated token output binds every semantic token to itself and `orphan-token`
|
|
157
|
+
can never fire. The **recorder** — `--record --stage <name> [--subject <Name>]
|
|
158
|
+
--entry <file.json>` — merges one entry into that stage's file, recomputes its
|
|
159
|
+
fingerprint and stamps the manifest's `verification` pointer. Skills call it;
|
|
160
|
+
nothing hand-writes the store or hand-computes a hash.
|
|
161
|
+
|
|
162
|
+
`--skip <rule>` switches a rule off entirely, and a skipped rule is absent rather
|
|
163
|
+
than inert. A name that isn't one of the four rules exits `2`: `colour-contrast`
|
|
164
|
+
is a typo here, not a skip. With no `--tokens` there is no token source to read, so
|
|
165
|
+
`orphan-token` and `color-contrast` are reported as skipped rather than passed.
|
|
166
|
+
|
|
167
|
+
`color-contrast` compares the semantic colour pairs the system's own role
|
|
168
|
+
definitions already promise — `text/onEmphasis` over `bg/emphasis`, each status
|
|
169
|
+
text over its own status background, and so on. Each `--tokens` file is one
|
|
170
|
+
**mode**, and a pair has to clear WCAG AA's 4.5:1 for normal text in every one of
|
|
171
|
+
them: a system that passes in Light and fails in Dark fails. A pair whose roles
|
|
172
|
+
are absent from a mode abstains rather than passing, which is why a run that
|
|
173
|
+
recognised no role anywhere fails as `contrast-rule-inert` instead of reporting a
|
|
174
|
+
clean sweep. `text/disabled` is excluded, because WCAG 1.4.3 exempts inactive
|
|
175
|
+
components and a disabled role is deliberately low-contrast. A translucent
|
|
176
|
+
foreground is composited over its background and compared; a translucent
|
|
177
|
+
background is skipped and counted, because what sits behind it is a layout fact
|
|
178
|
+
the token tier does not hold. Every number on the report's `contrast:` line is a
|
|
179
|
+
pair, in the mode it occurred in. `--skip color-contrast` is the escape hatch for
|
|
180
|
+
a system whose roles are named differently. The orphan rule counts
|
|
181
|
+
a token as bound when its normalized key appears anywhere in a scanned file, so
|
|
182
|
+
`color.bg.primary` is bound by a mention of `color.bg.primary.hover`: every miss
|
|
183
|
+
is an orphan reported as bound, never a correct system failed. A `derived` check
|
|
184
|
+
is one the gate recomputes off disk, and its recorded result is a cache that must
|
|
185
|
+
agree — a disagreement is `proof-contradicted`. An `attested` check is an agent's
|
|
186
|
+
live observation of something the CLI cannot read, printed informationally and
|
|
187
|
+
never the reason a run passes. See
|
|
188
|
+
`${CLAUDE_PLUGIN_ROOT}/references/proof-bundle.md`.
|
|
189
|
+
|
|
57
190
|
Exit codes: `0` success, `1` validation/guard failure (mismatch, missing token,
|
|
58
191
|
conflict, or remaining reference), `2` bad CLI arguments.
|
|
59
192
|
|
|
60
193
|
## How the skill installs these
|
|
61
194
|
|
|
62
195
|
`token-crosswalk-builder` copies `lib/crosswalk.mjs`, `lib/dtcg.mjs`,
|
|
63
|
-
`
|
|
196
|
+
`lib/source-scan.mjs`, `validate-crosswalk.mjs`, `build-reverse-index.mjs`,
|
|
197
|
+
`guard-token-removal.mjs`, and
|
|
64
198
|
`crosswalk.schema.json` into the user's `packages/tokens/scripts/` (schema beside `crosswalk.json`), then
|
|
65
199
|
wires `packages/tokens/package.json`:
|
|
66
200
|
|
|
@@ -88,7 +222,7 @@ Run the suite from the repo root (no install step — uses only Node built-ins):
|
|
|
88
222
|
node --test
|
|
89
223
|
```
|
|
90
224
|
|
|
91
|
-
This auto-discovers every `**/*.test.mjs` recursively
|
|
225
|
+
This auto-discovers every `**/*.test.mjs` recursively. Don't use
|
|
92
226
|
`node --test scripts/` — a directory positional is treated as a test name on
|
|
93
227
|
Node >=21 and errors; a `scripts/*.test.mjs` glob silently skips `scripts/lib/`.
|
|
94
228
|
|
|
@@ -130,7 +130,7 @@ if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href)
|
|
|
130
130
|
});
|
|
131
131
|
if (process.argv.includes('--check')) {
|
|
132
132
|
let onDisk = null;
|
|
133
|
-
try { onDisk = readFileSync(OUT, 'utf8'); } catch
|
|
133
|
+
try { onDisk = readFileSync(OUT, 'utf8'); } catch { /* missing counts as drift */ }
|
|
134
134
|
if (onDisk !== result) {
|
|
135
135
|
console.error('✗ references/doc-card-builder.md out of date; run: node scripts/build-doc-card-builder.mjs');
|
|
136
136
|
process.exit(1);
|