48c31dc1b3
Ten git worktrees each carried their own 225 MB node_modules (1.1 GB across five) and paid 11s per `npm ci`. pnpm hardlinks from a shared store: the same five worktrees cost ~250 MB total, and a fresh install is 4s. What changed beyond the mechanical rename: - `overrides` moved to `pnpm-workspace.yaml`. pnpm 11 does not read the `pnpm` field in package.json *or* npm's top-level `overrides`, and it fails silently — the vite/defu/language-server pins would have quietly stopped applying. - Build scripts are blocked by default in pnpm; esbuild and sharp are allowed explicitly via `allowBuilds` (renamed from `onlyBuiltDependencies` in 11). - `packageManager` + `engines` pin the toolchain. - gate.sh rejects a package-lock.json/yarn.lock/bun.lock outright, so an agent running `npm install` out of habit fails loudly instead of building a second, divergent dependency tree. - CI bootstraps pnpm with `npm install --global pnpm@11.25.0` rather than corepack (unbundled as of Node 25) or pnpm/action-setup (this self-hosted act-runner has never run a job; fetching a third-party action is not something to discover on the first one). Two pre-existing CI bugs fixed while in the file: - the gate installed with `npm install --package-lock=false`, which discarded the lockfile the previous session had just fixed. - the visual-regression step imported `playwright`, which is not a dependency, and `visual-regression.mjs` has no compare mode anyway — in CI it overwrote its own baselines and passed unconditionally. Removed with a comment; it comes back when it can diff. The `publish` job is now manual (`workflow_dispatch`). During the migration dist/ holds three HTML files against the live pages branch's ten, so publishing on every push to main would take the site down to a stub. Restore at task 20. HANDOVER.md's incident log still says npm where it describes what happened at the time; that is history, not a missed rename. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
75 lines
2.7 KiB
Markdown
75 lines
2.7 KiB
Markdown
---
|
|
name: design-tokens
|
|
description:
|
|
Extract, name, and enforce the design token layer for the ai-for-dummies site.
|
|
Use when touching any colour, font size, spacing value, or breakpoint, when
|
|
consolidating the three drifted palettes, or when a check-tokens failure needs
|
|
resolving.
|
|
---
|
|
|
|
# Design tokens
|
|
|
|
## Before anything
|
|
|
|
Read [`../../context/design-system.md`](../../context/design-system.md). This
|
|
site has **three drifting palettes** and a **broken `@font-face`**. Both are
|
|
traps. If you have not read that file, you will "preserve the styles" by copying
|
|
a bug.
|
|
|
|
## Extracting
|
|
|
|
```bash
|
|
python3 - <<'PY'
|
|
import re
|
|
files=['styles.css','chapters.css','landing.css','rules/styles.css','skills/styles.css',
|
|
'skills-review/styles.css','hands-on/starter/styles.css','hands-on/rules/styles.css']
|
|
seen={}
|
|
for f in files:
|
|
for m in re.finditer(r'--([a-z-]+):\s*([^;}]+)', open(f).read()):
|
|
seen.setdefault(m.group(1),{}).setdefault(m.group(2).strip(),[]).append(f)
|
|
for k,v in sorted(seen.items()):
|
|
print(f"--{k}:")
|
|
for val,fs in v.items(): print(f" {val:12} <- {', '.join(fs)}")
|
|
PY
|
|
```
|
|
|
|
Re-run this after any consolidation. Every token should print exactly one value.
|
|
|
|
## Consolidating a drifted token
|
|
|
|
1. List every value and where it is used (above).
|
|
2. Compute the perceptual delta. Sub-perceptual (a few units per channel) →
|
|
canonicalize freely. Visible (`--blue`: `#527f9f` vs `#215675`) → screenshot
|
|
both, get a human decision, record it in the task file.
|
|
3. Pick the canonical value. Prefer the one used on the most-visited surface.
|
|
4. Replace, then screenshot every affected page at 560/800/1100/1600 px.
|
|
5. Attach before/after images to the task report. "It looked fine to me" is not
|
|
evidence.
|
|
|
|
## Naming
|
|
|
|
Semantic, matching the existing vocabulary — `--ink`, `--paper`, `--muted`,
|
|
`--line`, `--accent`, `--gold`, `--blue`, `--deep`. Never numeric scales. New
|
|
surfaces extend semantically: `--surface-lab`, `--ink-inverse`.
|
|
|
|
## Type scale and breakpoints
|
|
|
|
Collapse the 14 ad-hoc `clamp()` triples to named steps and the 16 breakpoints
|
|
to five, per [`../../rules/theming.md`](../../rules/theming.md). When collapsing
|
|
a breakpoint, **screenshot at the old value** — that is where the regression is.
|
|
|
|
## Enforcing
|
|
|
|
```bash
|
|
node .agents/scripts/check-tokens.mjs # fails on raw hex outside tokens.css
|
|
```
|
|
|
|
Wire it into `pnpm run verify`. A rule nobody checks is a suggestion.
|
|
|
|
## The font decision
|
|
|
|
Do not self-host Manrope/DM Mono as part of a refactor task. The intended fonts
|
|
have never rendered, so adopting them is a visual redesign. Default to matching
|
|
what renders today (Arial / generic monospace) and delete the dead `@font-face`.
|
|
If a human wants the real fonts, that is its own task with its own screenshots.
|