Design tokens: docs, agent guide, skills, audit checks
- docs/design-tokens.md (new module page), README index, CHANGELOG - AGENT.md §0b row 19, §6.11 rewritten for the standard, §6.11a, §7, §10, §12, §14 - ipal-setup stage 5, ipal-block section-code (Section with data-surface, Button, card on token utilities), ipal-site phase 8, ipal-reference (+ api.md /tokens section), ipal-upgrade 1.15.0 note, ipal-audit SKILL + audit.sh token checks - theme.md, consent.md, accessibility.md (a11y.css), lightbox.md, PROGRAMISTA §2.5 - /tokens entry lists its exports explicitly; docs coverage test includes it Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
ca8e93eaf4
commit
cf205c59ef
@@ -152,6 +152,15 @@ if [ -n "$UI" ]; then
|
||||
report ERROR "hex colors in classes" "§6.11 use design tokens (bg-primary…)" \
|
||||
"$(g '(bg|text|border|from|to|via|fill|stroke)-\[#' $UI --include=*.tsx)"
|
||||
|
||||
report WARNING "dark: on colour utilities" "§6.11 the --ipal-* roles switch with the theme — bg-surface/text-fg, no dark:bg-…" \
|
||||
"$(g '\bdark:(hover:|focus:)?(bg|text|border|from|to|via|fill|stroke|ring|outline)-' $UI --include=*.tsx)"
|
||||
|
||||
report WARNING "old colour variables in classes" "§6.11 use the preset utilities (bg-primary, text-fg) — not var(--color-…)" \
|
||||
"$(g '\[var\(--color-' $UI --include=*.tsx)"
|
||||
|
||||
report ERROR "hex colors in inline styles" "§6.11 use design tokens — IPAL_TOKENS / ipalVar() for a dynamic style" \
|
||||
"$(g "style=\{\{[^}]*['\"]#[0-9a-fA-F]{3,8}['\"]" $UI --include=*.tsx)"
|
||||
|
||||
report ERROR "barrel index.ts" "§6.12 import files directly" \
|
||||
"$(find $UI -name 'index.ts' 2>/dev/null)"
|
||||
|
||||
@@ -162,6 +171,26 @@ if [ -n "$UI" ]; then
|
||||
done
|
||||
fi
|
||||
|
||||
# --- Design tokens (§6.11, design-tokens.md) ---
|
||||
STYLES=$(find src/app -name 'styles.css' -not -path '*/node_modules/*' 2>/dev/null | head -1)
|
||||
if [ -n "$STYLES" ]; then
|
||||
report WARNING "design-token standard not wired" "§6.11 styles.css imports @intecion/ipal-kit/tokens.css + tailwind.css + ../../design/tokens.css" \
|
||||
"$(grep -q 'ipal-kit/tokens.css' "$STYLES" || echo "$STYLES: no @import \"@intecion/ipal-kit/tokens.css\"")"
|
||||
report WARNING "next/font in the Tailwind font slot" "§6.11 next/font variable '--font-family-body' / '--font-family-heading' (--font-body cycles with the font-body utility)" \
|
||||
"$(grep -q 'ipal-kit/tailwind.css' "$STYLES" && g "variable: ['\"]--font-(body|heading|mono)['\"]" src/app --include=*.ts --include=*.tsx)"
|
||||
fi
|
||||
if [ -f src/design/tokens.ts ]; then
|
||||
[ -f DESIGN.md ] || report WARNING "no DESIGN.md" "§6.11 the brand is described in DESIGN.md (template: ipal-setup/resources/DESIGN.md)" "DESIGN.md missing"
|
||||
TOKENS_BIN=node_modules/@intecion/ipal-kit/bin/ipal-tokens.mjs
|
||||
if [ -f "$TOKENS_BIN" ]; then
|
||||
TOKENS_OUT=$(node "$TOKENS_BIN" --check 2>&1)
|
||||
[ $? -ne 0 ] && report ERROR "ipal-tokens --check" "§6.11 run pnpm exec ipal-tokens: the CSS is stale or a contrast pair fails WCAG AA" \
|
||||
"$(printf '%s\n' "$TOKENS_OUT" | grep -E '✗|out of date|ipal-tokens:' || echo 'ipal-tokens --check failed')"
|
||||
else
|
||||
report WARNING "ipal-tokens not installed" "§6.11 @intecion/ipal-kit 1.15+ ships the ipal-tokens bin" "$TOKENS_BIN missing"
|
||||
fi
|
||||
fi
|
||||
|
||||
# --- Collections (§5.3) ---
|
||||
if [ -d src/collections ]; then
|
||||
report ERROR "forbidden collection" "§5.3 settings/nav/footer are globals; FAQ/hero are blocks" \
|
||||
|
||||
Reference in New Issue
Block a user