@su-sws/synthetic-web-team 0.1.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.
Files changed (82) hide show
  1. package/AGENTS.md +149 -0
  2. package/README.md +321 -0
  3. package/package.json +58 -0
  4. package/packages/cli/bin/sws.mjs +722 -0
  5. package/packages/cli/src/axe.mjs +164 -0
  6. package/packages/cli/src/browser.mjs +192 -0
  7. package/packages/cli/src/checks.mjs +1254 -0
  8. package/packages/cli/src/github.mjs +131 -0
  9. package/packages/cli/src/history.mjs +137 -0
  10. package/packages/cli/src/perf.mjs +245 -0
  11. package/packages/cli/src/preflight.mjs +185 -0
  12. package/packages/cli/src/report.mjs +315 -0
  13. package/packages/cli/src/states.mjs +556 -0
  14. package/packages/wizard/bin/wizard.mjs +767 -0
  15. package/packages/wizard/src/detect.mjs +135 -0
  16. package/packages/wizard/src/emit.mjs +553 -0
  17. package/skills/role-accessibility-lead/SKILL.md +183 -0
  18. package/skills/role-api-architect/SKILL.md +65 -0
  19. package/skills/role-backend-developer/SKILL.md +66 -0
  20. package/skills/role-compliance-officer/SKILL.md +73 -0
  21. package/skills/role-content-designer/SKILL.md +145 -0
  22. package/skills/role-devops/SKILL.md +200 -0
  23. package/skills/role-discoverability/SKILL.md +164 -0
  24. package/skills/role-frontend-developer/SKILL.md +167 -0
  25. package/skills/role-fullstack-developer/SKILL.md +56 -0
  26. package/skills/role-identity-engineer/SKILL.md +77 -0
  27. package/skills/role-information-architect/SKILL.md +136 -0
  28. package/skills/role-infrastructure-architect/SKILL.md +60 -0
  29. package/skills/role-qa-engineer/SKILL.md +81 -0
  30. package/skills/role-security-operations/SKILL.md +56 -0
  31. package/skills/role-software-architect/SKILL.md +75 -0
  32. package/skills/role-staff-technical-architect/SKILL.md +73 -0
  33. package/skills/role-strategist/SKILL.md +122 -0
  34. package/skills/role-user-researcher/SKILL.md +66 -0
  35. package/skills/role-ux-designer/SKILL.md +159 -0
  36. package/skills/sws-compliance-check/SKILL.md +153 -0
  37. package/skills/sws-decanter/SKILL.md +191 -0
  38. package/skills/sws-deploy/SKILL.md +162 -0
  39. package/skills/sws-diverge/SKILL.md +131 -0
  40. package/skills/sws-github/SKILL.md +171 -0
  41. package/skills/sws-install/SKILL.md +97 -0
  42. package/skills/sws-netlify/SKILL.md +110 -0
  43. package/skills/sws-onboard/SKILL.md +85 -0
  44. package/skills/sws-preflight/SKILL.md +87 -0
  45. package/skills/sws-prior-art/SKILL.md +137 -0
  46. package/skills/sws-vercel/SKILL.md +117 -0
  47. package/standards/fragments/global-footer.yml +137 -0
  48. package/standards/fragments/identity-bar.yml +180 -0
  49. package/standards/hosting/capabilities.yml +215 -0
  50. package/standards/hosting/github-pages.yml +306 -0
  51. package/standards/hosting/netlify.yml +234 -0
  52. package/standards/hosting/vercel.yml +284 -0
  53. package/standards/patterns/components.md +162 -0
  54. package/standards/patterns/content.md +130 -0
  55. package/standards/patterns/decanter.md +352 -0
  56. package/standards/patterns/discoverability.md +121 -0
  57. package/standards/patterns/forms.md +116 -0
  58. package/standards/patterns/ia.md +126 -0
  59. package/standards/patterns/motion.md +267 -0
  60. package/standards/patterns/sws-conventions.md +225 -0
  61. package/standards/policy/accessibility.md +241 -0
  62. package/standards/policy/brand.md +213 -0
  63. package/standards/policy/escalation.md +53 -0
  64. package/standards/policy/identity.md +96 -0
  65. package/standards/policy/minsec.md +119 -0
  66. package/standards/policy/minweb.md +87 -0
  67. package/standards/policy/privacy.md +114 -0
  68. package/standards/policy/procurement.md +79 -0
  69. package/standards/prior-art/README.md +205 -0
  70. package/standards/prior-art/catalog.yml +409 -0
  71. package/standards/prior-art/patterns/INDEX.md +53 -0
  72. package/standards/prior-art/repos.yml +734 -0
  73. package/standards/recipes/astro-ssr/RECIPE.md +274 -0
  74. package/standards/recipes/astro-ssr/acceptance.yml +168 -0
  75. package/standards/recipes/astro-static/RECIPE.md +468 -0
  76. package/standards/recipes/astro-static/acceptance.yml +800 -0
  77. package/standards/recipes/next-ssr/RECIPE.md +407 -0
  78. package/standards/recipes/next-ssr/acceptance.yml +187 -0
  79. package/standards/scope.md +111 -0
  80. package/standards/stack/performance-budget.yml +95 -0
  81. package/standards/stack/reference-versions.yml +168 -0
  82. package/standards/stack/requirements.yml +154 -0
@@ -0,0 +1,468 @@
1
+ # Recipe: astro-static
2
+
3
+ **Generate a compliant Stanford static site with Astro, Decanter 8, and GitHub Pages.**
4
+
5
+ | | |
6
+ |---|---|
7
+ | Recipe ID | `astro-static` |
8
+ | Status | Draft. Executed end to end on 2026-08-10 |
9
+ | Versions | **None specified by design.** Install latest. See below |
10
+ | Compliance tier | Low risk. Escalate to `moderate` overlay if the site collects personal data |
11
+ | Acceptance | `acceptance.yml` in this directory |
12
+
13
+ ## When to use this
14
+
15
+ Public-facing informational Stanford site: department, lab, program, project, event, or documentation. **Content is authored in the repo** — as Markdown, MDX, or Astro templates — and reviewed through git. No CMS, no user accounts, no personal data collection, no server-side logic.
16
+
17
+ **Do not use this for:** anything requiring authentication (needs the identity overlay, not yet written), anything storing personal or research data (needs a DRA first), or a site a non-technical unit will maintain alone (point them at Stanford Sites instead, it is free and already compliant).
18
+
19
+ ## Before you generate anything
20
+
21
+ **Step 0 is not optional: check prior art.** SWS has built a lot of sites. Most of what a new site needs has been solved, and reinventing it produces worse work slower.
22
+
23
+ ```
24
+ 1. Run: sws prior-art find "<what you are about to build>"
25
+ 2. Read what it returns before writing code.
26
+ 3. Record what you reused in .sws/manifest.yml under `prior_art`.
27
+ ```
28
+
29
+ For this recipe specifically, start with these three:
30
+
31
+ | Reference | For |
32
+ |---|---|
33
+ | [`sws-astro`](https://github.com/SU-SWS/sws-astro) (`main`) | The canonical Astro + Decanter 8 + Tailwind 4 wiring |
34
+ | [`ccc-bulletin`](https://github.com/SU-SWS/ccc-bulletin) (`dev`) | Decanter 8 on Next, plus current Storyblok and a full test setup |
35
+ | [`adapt-stanford-homesite`](https://github.com/SU-SWS/adapt-stanford-homesite) (`dev`) | `www.stanford.edu` itself. The reference for testing rigour and shipped page furniture |
36
+
37
+ **Mind the default branch.** It is `main` for `sws-astro`, `dev` for the ADAPT and OOD family, and `1.x` for the decoupled Drupal repos. A pointer without an explicit ref reads the wrong branch silently.
38
+
39
+ **Precedence rule, absolute:** prior art tells you *how we solved a shape of problem*. Current standards tell you *what to build with*. When they disagree, standards win, every time, with no exceptions. An SWS site from 2023 is a legitimate reference for navigation structure, content modelling, and component composition. It is never a reference for Decanter version, Tailwind syntax, WCAG target, or build tooling. See `standards/prior-art/README.md`.
40
+
41
+ ## Constraints
42
+
43
+ Cite these, not version numbers. Verify at generation time and record what resolved.
44
+
45
+ **The canonical reference for this recipe is [`SU-SWS/sws-astro`](https://github.com/SU-SWS/sws-astro).** It is SWS's own Astro + Decanter + Tailwind implementation. When this recipe and that repo disagree, investigate before assuming the recipe is right.
46
+
47
+ ### Install latest. Do not pin.
48
+
49
+ This recipe deliberately **does not specify versions**. Install the current release of everything and let the resolver do its job. Version numbers in a document start rotting the day they are written, and a recipe that names them turns into a starter template with extra steps.
50
+
51
+ There is exactly one exception, and it exists because a dist-tag makes it easy to get wrong:
52
+
53
+ | Constraint | Why it is load-bearing |
54
+ |---|---|
55
+ | **Decanter 8, not 7** | v7 is a Tailwind 3 JS preset and v8 is CSS-first. This is a breaking architecture change, and `npm i decanter` currently resolves to v7. Everything else in this recipe follows from getting this right |
56
+
57
+ Tailwind 4 needs no separate constraint: it arrives transitively through Decanter 8. Node needs no constraint: whatever the current Astro requires is what you need. Astro majors need no constraint: use the latest.
58
+
59
+ Three things to **avoid** rather than pin:
60
+
61
+ - **No `@astrojs/tailwind`.** Dead package. Use `@tailwindcss/vite`.
62
+ - **No `tailwind.config.js`.** Decanter 8 has no JS config; creating one signals a v7 mental model.
63
+ - **No `output: 'hybrid'`.** Removed from Astro. Use `'static'`.
64
+
65
+ If a resolved major turns out to break this recipe, that is a finding for the recipe canary to report and a sentence for us to change, not a reason to freeze consumers on old versions.
66
+
67
+ ## Steps
68
+
69
+ ### 1. Scaffold with the upstream tool
70
+
71
+ Do not hand-write project boilerplate and do not copy a template. Run the official scaffolder at current latest:
72
+
73
+ ```bash
74
+ npm create astro@latest -- --template minimal --typescript strict --no-install --no-git
75
+ ```
76
+
77
+ Then record what resolved, for the manifest rather than for a gate:
78
+
79
+ ```bash
80
+ node -p "require('./node_modules/astro/package.json').version" # after install
81
+ ```
82
+
83
+ Record it, do not judge it. The point is that the manifest and the compliance report can say what this project actually runs. There is no version to compare against.
84
+
85
+ **If the scaffolder fails, do not abandon the recipe.** `create-astro` performs a connectivity precheck and fetches templates from `codeload.github.com`, which is blocked on some Stanford networks, in CI sandboxes, and behind some proxies. Observed failure mode is `error Unable to connect to the internet` even when the npm registry is reachable.
86
+
87
+ Fallback, in order:
88
+
89
+ 1. Retry on a different network, or set `HTTPS_PROXY` appropriately.
90
+ 2. If still blocked, hand-create the four files the minimal template contains: `package.json` with `astro` plus a `build` script, `astro.config.mjs`, `tsconfig.json` extending `astro/tsconfigs/strict`, and `src/pages/index.astro`. That is a documented fallback, not a template we maintain, and steps 2 through 8 are unchanged.
91
+
92
+ The recipe is the artifact and the scaffolder is a convenience over it. Never block a user because an upstream tool could not reach the network.
93
+
94
+ ### 2. Install dependencies
95
+
96
+ ```bash
97
+ npm install
98
+ npm install -D @tailwindcss/vite @astrojs/sitemap
99
+ npm install decanter
100
+ ```
101
+
102
+ **Confirm you got Decanter 8, because getting 7 fails silently.** v7 is a Tailwind 3 JS preset and v8 is CSS-first, so nothing else in this recipe works against v7. If `latest` has not moved to 8.x in your environment, install `decanter@^8` explicitly.
103
+
104
+ You will also see the **git form** in existing SWS projects, and it is valid:
105
+
106
+ ```json
107
+ "decanter": "github:SU-SWS/decanter#v8" // sws-astro
108
+ "decanter": "https://github.com/SU-SWS/decanter.git#v8" // ccc-bulletin
109
+ ```
110
+
111
+ Both predate the npm publish. Prefer the npm form for new work, since it is versioned and lockfile-friendly, but never flag the git form as an error.
112
+
113
+ Verify, because the failure is silent:
114
+
115
+ ```bash
116
+ node -p "require('./node_modules/decanter/package.json').version" # expect 8.x
117
+ node -p "require('./node_modules/decanter/package.json').main" # expect src/css/index.css
118
+ ls node_modules/decanter/node_modules 2>/dev/null # expect nothing
119
+ ```
120
+
121
+ If `main` is `tailwind.config.js` you have v7. If `node_modules/decanter/node_modules/tailwindcss` exists, you have v7 **and** a nested Tailwind 3 sitting underneath a top-level Tailwind 4, which produces a build that half works and error messages that make no sense. Delete `node_modules` and the lockfile and reinstall with the right tag.
122
+
123
+ `tailwindcss` arrives transitively through Decanter 8. Verified. Do not install it directly.
124
+
125
+ **Accessibility and performance testing.** Install `@playwright/test` and `@axe-core/playwright`, then `npx playwright install chromium`. After every build and before `sws check`, run both measurements:
126
+
127
+ ```bash
128
+ npm run build
129
+ sws a11y # axe-core over every route, then hover and focus states
130
+ sws perf # first-party byte budget per route
131
+ sws check # reads both
132
+ ```
133
+
134
+ **Do not write your own files into the build output between the build and
135
+ `sws check`.** Both measurements record the build's newest mtime and report
136
+ `unknown` if the build is newer — a stale pass is not a pass — so a step that
137
+ drops a file into `dist/` after `sws a11y` silently costs you those points. Write
138
+ generated reports outside `dist`. (`sws check --badge dist/badge.json` is the one
139
+ exception: the CLI knows it wrote that file and excludes it. This bit this
140
+ project's own Pages workflow before the exception existed.)
141
+
142
+ `sws a11y` is two measurements in one browser launch: axe, then an interactive-state audit that moves a real mouse and presses a real Tab key to catch a hover or focus state whose only change is a colour. axe cannot see that at all — it audits one static snapshot of the DOM, and a hover state does not exist in a snapshot. The fix is nearly always one class, `hover:underline` or `hover:no-underline`; see `standards/patterns/components.md`.
143
+
144
+ Each serves the build over localhost, drives Chromium, and waits for animations to settle. **Add `**/.sws/axe-results.json`, `**/.sws/state-results.json`, and `**/.sws/perf-results.json` to `.gitignore`** — both are derived from a build, and `sws check` treats results older than the build as `unknown` so a stale pass cannot travel with the repo. Use the `**/` prefix: a leading-slash pattern only matches at the repo root, which bit this project when its own site moved into a subdirectory.
145
+
146
+ The budget lives in `standards/stack/performance-budget.yml` and is bytes rather than Lighthouse scores, for reasons given in that file. Override any limit in `.sws/manifest.yml` under `performance_budget:` with a reason if this site genuinely needs different numbers.
147
+
148
+ `@tailwindcss/forms` also still arrives transitively, but in Decanter 8 its reset
149
+ and the form classes are **only emitted if the project imports them**. If this
150
+ site has a form, the entry CSS needs a second line,
151
+ `@import 'decanter/forms';`, or the form classes and the form-element reset are
152
+ silently absent. See `standards/patterns/forms.md`.
153
+
154
+ ### 3. Wire Tailwind and Decanter
155
+
156
+ `astro.config.mjs`:
157
+
158
+ ```js
159
+ import { defineConfig } from 'astro/config';
160
+ import tailwindcss from '@tailwindcss/vite';
161
+ import sitemap from '@astrojs/sitemap';
162
+
163
+ export default defineConfig({
164
+ site: 'https://<unit>.stanford.edu', // required for sitemap + canonical URLs
165
+ output: 'static',
166
+ trailingSlash: 'ignore',
167
+ integrations: [sitemap()],
168
+ vite: { plugins: [tailwindcss()] },
169
+ });
170
+ ```
171
+
172
+ `src/styles/global.css` is **one line**:
173
+
174
+ ```css
175
+ @import 'decanter';
176
+ ```
177
+
178
+ That is the entire integration. Specifically:
179
+
180
+ - Do **not** add `@import 'tailwindcss'`. Decanter's `index.css` already does it. Doing both is harmless but redundant, costing about 340 bytes.
181
+ - Do **not** add `@source`. Verified unnecessary: Tailwind roots source detection at the entry CSS file's project, not at the file containing the `tailwindcss` import. Adding it produces byte-identical output.
182
+ - Do **not** create `tailwind.config.js`.
183
+ - Use `decanter/minimal` **only** when something else already owns base element styling, which for a fresh Astro site it does not. The only difference is a lighter base reset (623 bytes versus 3,286), not a reduced token or component set.
184
+
185
+ `site` is not optional. Without it `@astrojs/sitemap` emits nothing and canonical URLs are wrong, which fails two acceptance criteria.
186
+
187
+ ### 4. Build the required page furniture
188
+
189
+ Every page uses one layout containing, in this order:
190
+
191
+ 1. Skip navigation link. The only thing permitted above the Identity Bar.
192
+ 2. **Stanford Identity Bar.** Use `standards/fragments/identity-bar.yml` verbatim. Nothing may go above it except the skip link.
193
+ 3. Local header, navigation, and page content. Unit-specific, design freely within Decanter.
194
+ 4. Optional local footer.
195
+ 5. **Stanford Global Footer.** Generate it from `standards/fragments/global-footer.yml`.
196
+
197
+ **The Identity Bar has a fixed height, and two things decide it.**
198
+
199
+ ```html
200
+ <div class="bg-cardinal-red px-20 pt-5 pb-1 sm:px-30 md:px-50 lg:px-30">
201
+ <a class="logo inline-block text-20 leading-none text-white no-underline hocus:text-white hocus:underline"
202
+ href="https://www.stanford.edu">Stanford University<span class="sr-only"> (link is external)</span></a>
203
+ </div>
204
+ ```
205
+
206
+ - `pt-5 pb-1`, never `py-*`, and no centred `max-w-*` wrapper — the padding sits on the red container. A `py-12` version measures about 44px against the correct 30.8px.
207
+ - `logo`, never `font-serif`. It is a Decanter *component* class carrying `--font-stanford` and its ligatures, and it forces cardinal red on hover and focus, which is why `hocus:text-white` is needed inside the red bar.
208
+
209
+ **Load the Stanford ligature font.** Decanter 8 publishes no font assets, so without this the wordmark silently falls back to Source Serif 4 and the bar loses 2px. Add to your entry CSS:
210
+
211
+ ```css
212
+ @font-face {
213
+ font-family: 'Stanford';
214
+ src:
215
+ url('https://www-media.stanford.edu/assets/fonts/stanford.woff2') format('woff2'),
216
+ url('https://www-media.stanford.edu/assets/fonts/stanford.woff') format('woff');
217
+ font-weight: 300;
218
+ font-display: swap;
219
+ }
220
+ ```
221
+
222
+ and `<link rel="preconnect" href="https://www-media.stanford.edu" crossorigin>` in the head. Source Sans 3 and Source Serif 4 come from Google Fonts; Decanter ships neither, and v8 has no `fonts.css` to import.
223
+
224
+ `brand.identity-bar.exact` and `brand.identity-bar.font-loaded` check all of the above.
225
+
226
+ **The Global Footer is immutable.** Per the Stanford Identity Guide its links may not be altered, reordered, or added to, and nothing else may go inside it. Unit links belong in the local footer above it. This is the single highest-value automated check in the system, so expect `sws check` to be strict about it.
227
+
228
+ **The contract is `standards/fragments/global-footer.yml`**, extracted from the upstream `decanter-web` component and read directly by `sws check`. Three things there that are easy to get wrong:
229
+
230
+ - The links are in **two lists inside one `<nav>`**, four then six, not a single list of ten.
231
+ - Trademarks points at **Admin Guide policy 1.5.4**, not `trademarks.stanford.edu`.
232
+ - Non-Discrimination points at **Student Services**, not `equity.stanford.edu`.
233
+
234
+ The last two were wrong in this project's first draft, which is a good argument for reading the fragment rather than typing the footer from memory. The copyright block is two lines, including the Stanford, California 94305 address.
235
+
236
+ ### 5. Required content
237
+
238
+ | What | Where | Notes |
239
+ |---|---|---|
240
+ | Accessibility link | Global Footer | Points at `https://www.stanford.edu/site/accessibility`. Satisfies the barrier-reporting requirement |
241
+ | Privacy link | Global Footer | Points at the central policy and carries the cookie disclosure, so **no banner is required**. None is forbidden either: if a unit wants one, record it in `.sws/manifest.yml` under `privacy.consent_tooling`. Do not evaluate or rank consent vendors — send that to the [University Privacy Office](https://privacy.stanford.edu) |
242
+ | Business owner + technical admin | `src/pages/about.astro` footer or About page | MinWeb requires both be identifiable, with valid Stanford affiliation and email |
243
+ | Page title + meta description | Every page | Unique per page |
244
+ | `robots.txt` | `public/robots.txt` | Sitemap reference, plus explicit AI crawler sections. Allow retrieval bots (`OAI-SearchBot`, `Claude-SearchBot`, `PerplexityBot`, `Googlebot`, `Bingbot`); treat training crawlers as a unit policy decision. See `standards/patterns/discoverability.md` |
245
+ | JSON-LD | Layout | `EducationalOrganization` or `Organization`, plus `BreadcrumbList`. **For rich results, not for AI citation** — Google states no special markup is needed for generative AI features |
246
+ | `llms.txt` | Skip it | **Do not add one to a marketing site.** Verified: 97% of published `llms.txt` files receive zero requests and AI search crawlers read HTML directly. It is fetched by IDE coding agents, so it belongs on documentation sites only |
247
+
248
+ ### 6. Motion and animations (optional, recommended for marketing sites)
249
+
250
+ Motion increases engagement when used purposefully, but it must serve the content, not distract from it. Use motion to:
251
+
252
+ - **Guide attention**: Draw focus to key CTAs or benefits
253
+ - **Improve perceived performance**: Fade elements in while content loads
254
+ - **Reward interaction**: Smooth transitions on hover and click
255
+ - **Establish brand tone**: Motion is a design choice, not a default
256
+
257
+ Use **motion** for animations. It integrates cleanly with Astro islands and respects accessibility preferences out of the box.
258
+
259
+ ```bash
260
+ npm install motion
261
+ ```
262
+
263
+ **Key rule**: Things inside moving things should not also move. Parent animations take priority; child elements stay static.
264
+
265
+ **Guidelines:**
266
+
267
+ 1. **Respect `prefers-reduced-motion`**: Always honor OS-level motion preferences. `motion` respects this automatically, but also provide a CSS fallback:
268
+
269
+ ```css
270
+ @media (prefers-reduced-motion: reduce) {
271
+ * {
272
+ animation-duration: 0.01ms !important;
273
+ transition-duration: 0.01ms !important;
274
+ }
275
+ }
276
+ ```
277
+
278
+ 2. **Keep animations brief**: 300–600ms for most interactions. Longer than 800ms feels sluggish.
279
+
280
+ 3. **Use appropriate easing**: `easeOut` for entrances (feels snappy), `easeInOut` for state changes.
281
+
282
+ 4. **Common patterns with motion:**
283
+ - **Fade-in on scroll**: Wrap sections in `<motion.div>` with `initial={{ opacity: 0 }}` and `whileInView={{ opacity: 1 }}`.
284
+ - **Button hover lift**: Use `whileHover={{ y: -2 }}` with shadow via className.
285
+ - **Scale on hover**: `whileHover={{ scale: 1.05 }}` for gentle growth.
286
+ - **Staggered animations**: Use `staggerChildren` for sequential child animations.
287
+ - **Avoid nested motion**: Parent container animates; children remain static. Do not animate both a parent and child element independently.
288
+
289
+ 5. **Performance**: `motion` uses `transform` and `opacity` by default (GPU-accelerated). Let the library handle optimization.
290
+
291
+ 6. **Testing**: Verify animations work smoothly at typical device speeds. A 60fps target means 16.67ms per frame. Test on real devices, not just desktop browsers.
292
+
293
+ 7. **Accessibility in motion**:
294
+ - Animations must not auto-play audio or video without user consent.
295
+ - Avoid flashing or strobing (3+ flashes per second) — this can trigger seizures.
296
+ - Provide text alternatives or skip animations for critical content.
297
+
298
+ **Example: Fade-in on scroll with Astro island**
299
+
300
+ ```tsx
301
+ 'use client';
302
+
303
+ import { motion } from 'motion';
304
+
305
+ export default function FadeInSection({ children }: { children: React.ReactNode }) {
306
+ return (
307
+ <motion.div
308
+ initial={{ opacity: 0, y: 20 }}
309
+ whileInView={{ opacity: 1, y: 0 }}
310
+ transition={{ duration: 0.6, ease: 'easeOut' }}
311
+ viewport={{ once: true, amount: 0.3 }}
312
+ >
313
+ {children}
314
+ </motion.div>
315
+ );
316
+ }
317
+ ```
318
+
319
+ **When not to use motion**: Static informational or documentation sites gain little from animations and risk appearing less serious or harder to scan. Opt out by simply not defining animations.
320
+
321
+ ### 7. Accessibility harness
322
+
323
+ Target is **WCAG 2.1 AA**.
324
+
325
+ ```bash
326
+ npm install -D @playwright/test @axe-core/playwright
327
+ npx playwright install --with-deps chromium
328
+ ```
329
+
330
+ Add a test that walks every route in the built output and asserts zero violations tagged `wcag2a`, `wcag2aa`, `wcag21a`, `wcag21aa`.
331
+
332
+ **Playwright is the forward direction** even though existing SWS repos use Cypress. `adapt-stanford-homesite`, `adapt-directory`, and `ccc-bulletin` all run Cypress with e2e and component testing, so expect to see it, and do not convert an existing project. New work uses Playwright.
333
+
334
+ Two things this harness does **not** cover, and the report must say so:
335
+
336
+ - Roughly 70 percent of accessibility issues, per ODA guidance. A green run is a floor, not conformance. The manual checklist in `role-accessibility-lead` covers the rest.
337
+ - **Content authored after launch.** Everything here tests the built site at build time. Under this package's static-content scope that is a much smaller gap than it sounds: content lives in the repo, so every edit is a commit that runs this harness before it is public. What CI still cannot see is **embedded third-party content** — a Qualtrics form, a YouTube player, an iframed map — whose accessibility is not yours to control and belongs in a procurement conversation with a VPAT. See `standards/scope.md`.
338
+
339
+ Siteimprove applies further criteria after launch, and its registration is a MinWeb requirement.
340
+
341
+ **No component workshop.** This recipe does not set up a browsable component library. A department program site has a handful of components and one consumer, so the workshop costs more to maintain than it returns, and Astro support for the usual tooling is community-maintained anyway. Test the rendered pages.
342
+
343
+ If you later need **component-level** a11y assertions, Vitest plus `axe-core` against rendered components gets you there without a workshop. Reach for that when a component library gains real reuse across projects, not before.
344
+
345
+ State plainly in the project's own docs that automated testing catches roughly 30 percent of accessibility issues, per ODA guidance. The manual checklist in `role-accessibility-lead` covers the rest, and Siteimprove applies further criteria after launch.
346
+
347
+ ### 8. Deploy to GitHub Pages
348
+
349
+ **Push to `main` deploys. Pull requests are supported but never required.**
350
+
351
+ Trigger on both, and let the deploy job decide:
352
+
353
+ ```yaml
354
+ on:
355
+ push:
356
+ branches: [main]
357
+ pull_request:
358
+ workflow_dispatch:
359
+ ```
360
+
361
+ Then gate only the deploy: `if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'`. A pull request gets a build plus `sws check`; a push to `main` gets a build, `sws check`, and a deploy.
362
+
363
+ **Do not set up branch protection, required status checks, or a protected environment beyond `github-pages`.** Each one quietly turns push-to-main into a pull-request requirement, and this recipe's audience includes people editing a page through the GitHub web UI who will not open a pull request to fix a typo.
364
+
365
+ Note that GitHub Pages serves **one site**, so a pull request gets checks but **no preview URL**. Netlify and Vercel give per-PR previews for free, which is a real reason to move once review matters. Say so rather than letting someone expect previews here.
366
+
367
+ Use the first-party actions in the documented **two-job** pattern: a `build` job running `configure-pages` → build → `upload-pages-artifact`, and a `deploy` job with `needs: build` running `deploy-pages`.
368
+
369
+ Current majors, updated 2026-09-03 to match this project's own live Pages deploy: `actions/checkout@v7`, `actions/setup-node@v7`, `actions/configure-pages@v6`, `actions/upload-pages-artifact@v5`, `actions/deploy-pages@v4`. Check the release pages at generation time rather than trusting this line.
370
+
371
+ **To provision the repo and switch Pages on, use the `sws-github` skill.** It drives `gh` through auth, org choice, repo creation, push, and the Pages API, including the source-setting step below that is otherwise easy to forget.
372
+
373
+ Two version traps. `upload-pages-artifact@v4` requires `deploy-pages@v4` or newer, and **artifact actions v3 are no longer supported for Pages** as of a December 2024 deprecation. Separately, **older action majors emit a Node 20 deprecation warning**: Node 24 became the default JavaScript action runtime in 2026 and Node 20 is being removed from hosted runners, so `checkout@v4` and `setup-node@v4` produce noise even though they still run. Use the current majors.
374
+
375
+ Required, and not optional:
376
+
377
+ ```yaml
378
+ permissions:
379
+ contents: read # checkout
380
+ pages: write # create the Pages deployment
381
+ id-token: write # OIDC token that deploy-pages verifies
382
+ issues: write # update the persistent "Site health" issue on trunk
383
+ pull-requests: write # PR comment, when a PR is what fired
384
+ concurrency:
385
+ group: pages
386
+ cancel-in-progress: false
387
+ # on the deploy job only:
388
+ environment:
389
+ name: github-pages
390
+ url: ${{ steps.deployment.outputs.page_url }}
391
+ ```
392
+
393
+ `issues: write` and `pull-requests: write` exist so the advisory report can reach a reader in either mode. Drop either one and the corresponding report destination silently stops working.
394
+
395
+ On `cancel-in-progress: false`: this follows GitHub's Pages guidance and means queued runs all execute in order, so nothing gets skipped. If your editors make many rapid small edits and only the latest matters, `true` is faster. Either is defensible; know which you chose.
396
+
397
+ **Set repo Settings → Pages → Source to "GitHub Actions" before the first run.** This is outside the workflow, it is the single most commonly forgotten step, and the failure it produces does not obviously point at it:
398
+
399
+ ```
400
+ Branch "main" is not allowed to deploy to github-pages
401
+ due to environment protection rules.
402
+ ```
403
+
404
+ That message reads like a permissions problem. It usually means Pages source is still "Deploy from a branch", so the `github-pages` environment kept its default deployment-branch protection. Switching the source reconfigures the environment. If it persists, check Settings → Environments → github-pages → Deployment branches and allow your default branch.
405
+
406
+ Worth knowing that this project forgot it on the first run of its own Pages workflow, having written the warning one paragraph earlier.
407
+
408
+ **Two gotchas that will cost you an afternoon:**
409
+
410
+ 1. **`upload-pages-artifact@v4` excludes dotfiles.** If the build output needs `.nojekyll`, `.well-known/`, or any other hidden file, verify it survives the artifact or build the tar yourself. Astro does not normally need `.nojekyll`, but anything serving `.well-known` will.
411
+ 2. **Subpath deploys need `base`** set in `astro.config.mjs`. Without it, internal links work locally and break in production.
412
+
413
+ Branch-based deploys and `peaceiris/actions-gh-pages` still function but are the legacy path; that action's own README points users to the official one. Prefer artifact-based deployment for new work.
414
+
415
+ ### 9. Verify
416
+
417
+ ```bash
418
+ npx astro build
419
+ sws check
420
+ ```
421
+
422
+ Fix what the report flags, or record a deliberate exception in `.sws/acknowledged.yml` with a reason and a `review_by` date. Everything is advisory except committed secrets.
423
+
424
+ ## Swap points
425
+
426
+ Deviation is expected and supported. Each swap below is legitimate; the cost column is what you take on by choosing it.
427
+
428
+ | Swap | Cost |
429
+ |---|---|
430
+ | Next.js instead of Astro | Use the **`next-ssr`** recipe, and do not statically export it: `output: 'export'` forfeits `redirects`, `headers`, `rewrites`, Proxy, ISR, Server Actions, and default-loader image optimization, and Route Handlers become `GET`-only. Next with a static export is the worst of both options |
431
+ | **`astro-ssr` instead of static** | The smaller step, and usually the right one if all you need is response headers or redirects. Keeps Astro and Decanter identical; adds a host adapter and a paid host. See `standards/recipes/astro-ssr/` |
432
+ | yarn instead of npm | Fine. npm is primary at SWS, yarn secondary, and both are in production use. Respect whatever the project already has and never convert it. Advice touching dependency overrides must be manager-aware, since npm `overrides` and yarn `resolutions` differ |
433
+ | Netlify or Vercel instead of Pages | Expected as the second step, and it buys response headers, per-PR preview URLs, and real redirects. **SWS runs both**, one per family, so neither is a divergence: pick whichever the unit already administers, per `standards/hosting/`. A static build deploys to either unchanged; you only need `astro-ssr` if you want a runtime |
434
+ | Cypress instead of Playwright | Reasonable if the project already has Cypress, which three SWS repos do. Playwright is the forward default; do not convert an existing Cypress suite just to match |
435
+ | `clsx` + `tailwind-merge` instead of `cnbuilder` | Both are in SWS use. `cnbuilder` in the Astro and Storyblok families, `clsx` + `tailwind-merge` in the decoupled Drupal family. Pick one per project, not per file |
436
+ | No Decanter | Identity Bar and Global Footer become hand-maintained, and every brand and a11y check still applies with nothing helping you pass them. Rarely worth it |
437
+ | `decanter/minimal` | Only if something else owns base element styles. On a fresh Astro site this just removes needed resets |
438
+ | A CMS for content | **Out of scope for now, and not a swap you can take here.** See `standards/scope.md`. This package has no tested CMS path. Six SWS repos run Storyblok and five run decoupled Drupal, all in production, so the capability plainly exists at SWS — but not as anything this recipe can hand you. If a unit needs a CMS, raise it in discovery and say so plainly rather than building half a content backend to avoid the conversation |
439
+ | Algolia DocSearch for search | Recommended default. Free for public education content, no crawler to run |
440
+ | Coveo instead of Algolia | Enterprise licensing and sales-gated. Atomic web components drop into Astro islands cleanly, but it is over-scoped for most unit sites |
441
+ | Tailwind 3 | **Not a supported swap.** Decanter 8 requires Tailwind 4 |
442
+
443
+ Record every swap in `.sws/manifest.yml` under `divergences`, with a one-line reason. That record is what lets the next person understand the project, and it is what `sws doctor` reads to stop nagging about a choice you already made deliberately.
444
+
445
+ ## Known gotchas
446
+
447
+ 1. **Installing `decanter` without a tag.** Gets v7. The single most likely way to fail this recipe. See step 2.
448
+ 2. **A nested `node_modules/decanter/node_modules/tailwindcss`.** Means v7 crept in under a v4 top level. Half-working build, nonsensical errors.
449
+ 3. **Missing `site` in config.** Silently breaks the sitemap and canonical URLs.
450
+ 4. **Subpath deploys without `base`.** Works locally, breaks in production.
451
+ 5. **Reaching for `tailwind.config.js`.** Signals a Decanter 7 mental model. There is no JS config in v8.
452
+ 6. **Installing `@astrojs/tailwind`.** Dead package. Will appear to work, then fail.
453
+ 7. **Adding unit links to the Global Footer.** They go in the local footer above it.
454
+ 8. **Building a cookie consent banner.** Not required at Stanford, and a homegrown one is worse than none.
455
+
456
+ 9. **Assuming a green axe run means conformance.** It means roughly 30 percent of issues are absent.
457
+ 10. **Trusting an a11y result that never ran.** axe needs a real browser. If Chromium is unavailable the result is "unknown," not "clean." `sws check` reports those differently and so should you.
458
+ 11. **Wiring up a CMS because a unit asked for one.** Out of scope; see `standards/scope.md`. Say it is not covered yet, and point them at Stanford Sites if they will maintain the site alone. Half a content backend is worse than an honest no.
459
+
460
+ ## Provenance
461
+
462
+ **This recipe has been executed end to end**, not just written. On 2026-08-10, following it literally produced a building two-page Astro site with Decanter 8 and Tailwind 4 at then-current versions, and 18 of the 20 automatable acceptance criteria were verified passing against the built output. Confirmed applying correctly: Decanter tokens (`text-cardinal-red`, `text-black-70`), Decanter utilities (`type-2`, `type-3`), Decanter components (`.button`), and arbitrary Tailwind utilities from `.astro` markup (`mt-[19px]`).
463
+
464
+ The Decanter 8 integration in step 3 was separately verified with a controlled test confirming `@source` has no effect on output. See Appendix B of the project plan.
465
+
466
+ Defects found by executing rather than reviewing, all now fixed above: the wrong Decanter dist-tag (`@next` does not exist), the nested-Tailwind trap, the scaffolder's network precheck, and two acceptance criteria whose prose was too loose to check correctly.
467
+
468
+ **Not yet verified:** the Global Footer link set in `standards/fragments/global-footer.yml` against the current Identity Guide, and the GitHub Pages action versions. Both are marked in place.