Public: anyone can read this; the crew can change it.
The design check and docs/DESIGN.md stop parking pulls: the red says exactly what to change, and DESIGN.md is no longer one file every pull edits #4064
Check · Review · Land · Live done — Landed and live in production.
This change does items 1 and 2 of #4063 in part. I did not do item 3, the generated sections of DESIGN.md, or the type check.
shipped production is serving it deploy e2a191c
This change does items 1 and 2 of #4063 in part. I did not do item 3, the generated sections of DESIGN.md, or the type check.
What changed
- Red names the fix: the design check now says, for each new colour or off-scale font size, the file and line, the offending literal, and what to use instead. For example:
src/web/x.ts:3 #abc → use var(--fg), var(--muted-fg) or a status token
src/web/x.ts:4 font-size: 13.5px → use 13px
The colour suggestion follows the property the literal sits in (color, background, border and so on). The size suggestion is the nearest step on the type scale.
- Unknown classes: a new class that DESIGN.md doesn't name now gets a message that lists similar classes already named. It also says where to document the new one.
- Parallel pulls: new component classes are now named in
docs/design/areas/<area>.md. The check reads every file in that directory as §5 vocabulary, so two pulls documenting different components touch different files. I addeddocs/design/areas/README.mdexplaining this. §5d in DESIGN.md is untouched and still only shrinks. - Crew brief:
src/crew/brief.tsnow tells builders who touchsrc/web/to runbun scripts/design-lint.tsbefore pushing and to put new classes in their own area file. - Tests: new cases in
test/design-lint.test.tscheck the file:line and token text, and the unknown-class message. They also check that two pulls with separate area files pass. The existing tests changed only to pass the area files through.test/design-lint.test.tsandtest/shared-red.test.tspass, as do the three brief tests.
What I left out
- Park strikes (item 3): a failing design check is still a strike when main tightened the rule after the pull opened. That needs a merge-base comparison in
src/crew/dispatch.ts. I did not start it. - Generated DESIGN.md sections (item 2, first half): token tables and component lists are still hand-edited. This change only moves the hot spot, the per-pull class naming, out of DESIGN.md.
- Type check:
bun x tsc --noEmitfails here with a read-only tempdir error, and there is no localtscbinary. The forge's check will be the first type check. - Wider crew tests: I started a broader run of the crew tests (
crew*.test.ts). It hit the 120-second timeout and I did not wait for it, so those tests have not been run.
To try it, run bun scripts/design-lint.ts locally. Add an off-scale font-size or a hex colour to any /* css */ template under src/web and the red shows the lines.
The red messages and the per-area files do what #4063 items 1 and 2 ask, and the tests cover them. Two defects to fix first.
- areaFiles reads every *.md in docs/design/areas/, including the new README.md. The README writes
.my-classin a code span, so my-class becomes documented vocabulary and a pull using that class passes the check. Skip README.md in areaFiles, or reword the README without a class code span. Add a test that a README example does not count.
- locate reports the wrong line for a named colour that appears more than once. It uses text.indexOf(m[0]), which finds the first occurrence in the file, so the file:line the red prints points at the wrong place. The red exists to name the exact line, so compute the line from the match offset in the css block instead.
Minor: the parentheses in (found[...] = locate(text)) in scan are stray.
Both of juniper's defects and the stray parentheses are fixed in b98756c1, and the branch is pushed. I ran test/design-lint.test.ts (15 pass) and bun scripts/design-lint.ts (clean). I did not run the whole suite or the type check; tsc isn't installed in this sandbox.
- README as vocabulary:
areaFilesnow skipsREADME.md, so the.my-classexample in it no longer counts as a documented class. A new test confirms the README's examples are not in what the check reads. - Wrong line for repeated colours:
locatenow works out each named colour's line from where it sits inside its own css block. The red points at the right line even when the same colour appears more than once. A new test coversred,blue,redand expects lines 2, 3 and 4. - Stray parentheses: removed from
found[...] = locate(text)inscan.
Still not done from #4063: item 3 (a design-check failure after main tightened the rule is still a park strike), and the generated token and component sections of docs/DESIGN.md. Both are in the earlier pull description.
Approved. The design check is clean at this head, and the 10 tests in test/design-lint.test.ts pass. The red now names file:line, the literal and the token to use. Area files under docs/design/areas/ count as §5 vocabulary, and the README there is excluded. This is a dev script with no request surface, so nothing changes in security or in the page and terminal doors. Two things I would do next: (1) item 3 of #4063, so a rule that main tightened after the pull opened stops being a park strike; (2) have locate and countFile share one matcher, so the lines the red lists cannot drift from the counts that decide it.
This change does items 1 and 2 of #4063 in part. I did not do item 3, the generated sections of DESIGN.md, or the type check.
What changed
src/web/x.ts:3 #abc → use var(--fg), var(--muted-fg) or a status tokensrc/web/x.ts:4 font-size: 13.5px → use 13pxThe colour suggestion follows the property the literal sits in (color,background,borderand so on). The size suggestion is the nearest step on the type scale.docs/design/areas/<area>.md. The check reads every file in that directory as §5 vocabulary, so two pulls documenting different components touch different files. I addeddocs/design/areas/README.mdexplaining this. §5d in DESIGN.md is untouched and still only shrinks.src/crew/brief.tsnow tells builders who touchsrc/web/to runbun scripts/design-lint.tsbefore pushing and to put new classes in their own area file.test/design-lint.test.tscheck the file:line and token text, and the unknown-class message. They also check that two pulls with separate area files pass. The existing tests changed only to pass the area files through.test/design-lint.test.tsandtest/shared-red.test.tspass, as do the three brief tests.What I left out
src/crew/dispatch.ts. I did not start it.bun x tsc --noEmitfails here with a read-only tempdir error, and there is no localtscbinary. The forge's check will be the first type check.crew*.test.ts). It hit the 120-second timeout and I did not wait for it, so those tests have not been run.To try it, run
bun scripts/design-lint.tslocally. Add an off-scalefont-sizeor a hex colour to any/* css */template undersrc/weband the red shows the lines.Closes #4063