@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,407 @@
1
+ # Recipe: next-ssr
2
+
3
+ **Generate a compliant Stanford Next.js site with Decanter 8, served with a
4
+ runtime.**
5
+
6
+ | | |
7
+ |---|---|
8
+ | Recipe ID | `next-ssr` |
9
+ | Renamed from | `next-netlify`, on 2026-09-03. See "Choosing a host" below |
10
+ | Status | Draft |
11
+ | Compliance tier | `low` for a content site. Rises if you add a form collecting personal data, auth, or payments |
12
+ | Content source | **The repo. No CMS** — see `standards/scope.md` |
13
+ | Acceptance | `acceptance.yml` in this directory, which extends `astro-static` |
14
+ | Hosting | Netlify or Vercel. Pick per `standards/hosting/` |
15
+ | Versions | **None specified by design.** Install latest |
16
+
17
+ ## Two baselines, and which part comes from which
18
+
19
+ This recipe is assembled from two real SWS projects, because neither one alone is
20
+ the right model.
21
+
22
+ | From | What | Why |
23
+ |---|---|---|
24
+ | [`adapt-stanford-homesite`](https://github.com/SU-SWS/adapt-stanford-homesite) (`dev`) | The **Next.js setup**: config shape, CSP and security headers, PostCSS, file organisation, testing, Vault secrets, Netlify environment detection | It is `www.stanford.edu`, the most scrutinised Stanford property, and its engineering setup is the most complete in the org |
25
+ | [`ccc-bulletin`](https://github.com/SU-SWS/ccc-bulletin) (`dev`) | The **Decanter 8 integration** | It is the only Next project consuming Decanter 8, and the homesite deliberately does not consume Decanter at all |
26
+
27
+ **Why the split matters.** `www.stanford.edu` runs its own design system, derived
28
+ from Decanter and currently influencing Decanter 8. Its `styles/global.css` opens
29
+ with `@import 'tailwindcss'` and pulls in a local `tailwind/` directory. Its
30
+ tokens are a **parallel vocabulary**, not Decanter's, so copying them into a
31
+ Decanter project produces something that looks approximately right and does not
32
+ use the design system. That failure passes visual review and is invisible in a
33
+ screenshot.
34
+
35
+ Both repos are **private**. If you cannot read them, everything you need is below.
36
+
37
+ ## Why a runtime, and not static hosting
38
+
39
+ This recipe exists because some things need a **server response**, and a static
40
+ build cannot produce one. Choosing it buys you:
41
+
42
+ - **Response headers**, including the default security header set in
43
+ `standards/hosting/capabilities.yml`. Static export emits files, not headers.
44
+ - `redirects` and `rewrites`, which matter enormously on a site replacing a
45
+ legacy one.
46
+ - Proxy (Next's renamed middleware), ISR, Server Actions, Draft Mode, Route
47
+ Handlers beyond `GET`, and default-loader image optimization — all of which
48
+ `output: 'export'` forfeits.
49
+
50
+ **Be honest about the size of this.** MinWeb requires none of it. The header set
51
+ is good engineering, not policy, and a content site that needs no redirects and
52
+ no server logic is better served by `astro-static` on GitHub Pages for free.
53
+ Reach for this recipe when you need what is in that list, not by default.
54
+
55
+ **If you want static output, use `astro-static`.** Choosing Next for a content
56
+ site and then statically exporting it gives you the worst of both: React's weight
57
+ without its capabilities.
58
+
59
+ ## Choosing a host
60
+
61
+ **This recipe was called `next-netlify` until 2026-09-03**, which was a mistake
62
+ worth explaining, because the reasoning behind it was wrong in a way that would
63
+ have shown in the output. The old text said Netlify is "where SWS runs" and that
64
+ choosing Vercel meant leaving the platform every other project uses. In fact SWS
65
+ runs **both**, split cleanly by family:
66
+
67
+ | Family | Host |
68
+ |---|---|
69
+ | `storyblok-next-netlify` (ADAPT/OOD, 6 repos) | Netlify |
70
+ | `decoupled-drupal` (Cardinal Sites, 5 repos) | Vercel |
71
+
72
+ That is two lineages and two decisions, not a majority and an outlier.
73
+
74
+ **So the recipe does not pick for you. Start from where the unit already is:**
75
+
76
+ | If the unit... | Host |
77
+ |---|---|
78
+ | Already administers a Netlify account | **Netlify.** `standards/hosting/netlify.yml` |
79
+ | Already administers a Vercel account | **Vercel.** `standards/hosting/vercel.yml` |
80
+ | Has neither, and wants the better-trodden path for a content site | Netlify, to inherit the ADAPT family's Vault wiring |
81
+ | Has no account and no budget, and needs no runtime | You want `astro-static` on GitHub Pages |
82
+
83
+ An account someone already knows how to administer is worth more than the
84
+ shared-tooling argument. Record the choice in `.sws/manifest.yml` under
85
+ `hosting`. Do not introduce a third host on your own: that is a procurement
86
+ question, and it goes to the office, not to us.
87
+
88
+ ## Steps
89
+
90
+ ### 1. Scaffold with the upstream tool
91
+
92
+ ```bash
93
+ npx create-next-app@latest --typescript --app --no-tailwind --eslint
94
+ ```
95
+
96
+ `--no-tailwind` is deliberate: the scaffolder's Tailwind setup conflicts with the
97
+ Decanter integration below. Record the resolved Next version in
98
+ `.sws/manifest.yml`. Record it, do not judge it.
99
+
100
+ If the scaffolder fails on a network precheck, hand-create the four files it
101
+ would have made and continue. The recipe is the artifact; the scaffolder is a
102
+ convenience over it.
103
+
104
+ ### 2. Install
105
+
106
+ ```bash
107
+ npm install decanter
108
+ npm install -D @tailwindcss/postcss
109
+ ```
110
+
111
+ Confirm you got Decanter 8, because v7 fails silently:
112
+
113
+ ```bash
114
+ node -p "require('./node_modules/decanter/package.json').version" # expect 8.x
115
+ node -p "require('./node_modules/decanter/package.json').main" # expect src/css/index.css
116
+ ls node_modules/decanter/node_modules 2>/dev/null # expect nothing
117
+ ```
118
+
119
+ `tailwindcss` and `@tailwindcss/forms` both still arrive transitively through
120
+ Decanter, but in v8 the form styles are only emitted if the project imports
121
+ `decanter/forms` explicitly. A site with a form needs that second import. Do
122
+ not install them directly, and do not create a `tailwind.config.js`.
123
+
124
+ Also install, matching the house conventions: `cnbuilder` for conditional
125
+ classes, `@heroicons/react` for icons. **Not FontAwesome Pro**, which the homesite
126
+ uses behind a licence-gated preinstall token check; a unit site inheriting that
127
+ gets an install failure and a licence nobody mentioned.
128
+
129
+ ### 3. PostCSS
130
+
131
+ `postcss.config.mjs`, identical in both baselines:
132
+
133
+ ```js
134
+ const config = {
135
+ plugins: {
136
+ '@tailwindcss/postcss': {},
137
+ },
138
+ };
139
+ export default config;
140
+ ```
141
+
142
+ Next uses PostCSS here. `@tailwindcss/vite` is the Astro path and does not apply.
143
+
144
+ ### 4. Styles: bulletin's first line, homesite's organisation
145
+
146
+ `styles/global.css`:
147
+
148
+ ```css
149
+ @import 'decanter';
150
+ @import '../tailwind/theme.css';
151
+ @import '../tailwind/base.css';
152
+ @import '../tailwind/utilities.css';
153
+ ```
154
+
155
+ **That first line is the whole Decanter integration.** Note what it is not:
156
+
157
+ - Not `@import 'tailwindcss'`. Decanter imports Tailwind itself. The homesite has
158
+ that line only because it does not use Decanter.
159
+ - Not `@source` anything. Verified unnecessary; Tailwind roots detection at the
160
+ entry CSS file's project.
161
+ - Not a `tailwind.config.js`.
162
+
163
+ Then split project-specific CSS into a `tailwind/` directory, which is how both
164
+ baselines organise it:
165
+
166
+ ```
167
+ tailwind/
168
+ theme.css @theme block: project token EXTENSIONS
169
+ base.css project base element styles
170
+ utilities.css project utilities
171
+ custom-variants.css optional
172
+ ```
173
+
174
+ **Extend Decanter's tokens in `theme.css`, and annotate every deviation.**
175
+ `ccc-bulletin` does this well and it is worth copying as a habit:
176
+
177
+ ```css
178
+ @theme {
179
+ --breakpoint-2xl: 1440px; /* Differs from Decanter */
180
+ --container-2xl: 1440px; /* Differs from Decanter */
181
+
182
+ /* Project-specific colours, namespaced so they read as additions */
183
+ --color-blue-navy: #272e5c;
184
+ }
185
+ ```
186
+
187
+ A comment marking a deliberate divergence at the token level is the same
188
+ discipline as recording one in `.sws/manifest.yml`. Silent divergence is the only
189
+ kind that is a problem.
190
+
191
+ ### 5. Security headers
192
+
193
+ **Ship the sensible defaults, switched on. Leave CSP off.** In
194
+ `next.config.ts`, return these from `headers()`:
195
+
196
+ | Header | Value |
197
+ |---|---|
198
+ | `Strict-Transport-Security` | `max-age=31536000; includeSubDomains; preload` |
199
+ | `X-Content-Type-Options` | `nosniff` |
200
+ | `Referrer-Policy` | `origin-when-cross-origin` |
201
+ | `Permissions-Policy` | `geolocation=(), camera=(), microphone=(), midi=(), payment=(), usb=()` |
202
+ | `X-Frame-Options` | `SAMEORIGIN` |
203
+
204
+ That set is deliberately the headers that **cannot break a page**. It is the
205
+ canonical list in `standards/hosting/capabilities.yml`; take it from there
206
+ rather than from here if the two ever disagree.
207
+
208
+ Two notes on the values:
209
+
210
+ 1. **`SAMEORIGIN`, not `DENY`.** The homesite uses `DENY` and then needs a
211
+ second policy for the CMS Visual Editor route it has to let be iframed.
212
+ **This recipe has no CMS**, so that whole problem is absent and `SAMEORIGIN`
213
+ is simply the right answer. Do not import the two-policy pattern from the
214
+ homesite to solve a problem you do not have.
215
+ 2. **Gate on the deploy environment.** The homesite checks whether it is on the
216
+ host and returns `[]` locally. Copy that, or spend a day fighting your own
217
+ headers in development.
218
+
219
+ #### Content-Security-Policy is optional, and off by default
220
+
221
+ **Confirmed by SWS 2026-09-03: CSP is a nice-to-have.** MinWeb
222
+ requires no response headers at all, so a site without a CSP is fully compliant.
223
+
224
+ The reason it is off by default is not effort, it is **who absorbs the
225
+ breakage**. A CSP is the one header that breaks pages, and it breaks them when
226
+ someone *edits content*, not when someone deploys. A content owner embeds a
227
+ YouTube video, a Qualtrics survey, or a Google Font; the browser blocks it
228
+ silently; and the person who can least diagnose it is the person holding the
229
+ problem.
230
+
231
+ So:
232
+
233
+ - **Never build a CSP from a domain allowlist.** It drifts, it ends up allowing
234
+ everything, and every future embed is a support ticket.
235
+ - **Start with `Content-Security-Policy-Report-Only`.** It cannot break a page by
236
+ construction, and it tells you what a real policy would have blocked.
237
+ - **Record it in `.sws/manifest.yml`.** It is a divergence from this default, and
238
+ somebody should have agreed to own the breakage.
239
+
240
+ Worth knowing: **none of the five Vercel-hosted SWS repos sets any security
241
+ headers**, and `sulgryphon-nextjs`'s `headers()` sets only `X-Robots-Tag` for
242
+ non-production. That is permitted, not a finding — but do not copy it either.
243
+ New work should ship the default set above.
244
+
245
+ ### 6. Images
246
+
247
+ Set `images.remotePatterns` for whatever actually serves your images. With
248
+ content in the repo, most images are local and need no entry at all — add hosts
249
+ only for what you genuinely fetch remotely, typically `**.stanford.edu`. Do not
250
+ use a wildcard: the point of the list is that it is a list.
251
+
252
+ ### 7. Required content
253
+
254
+ Same as `astro-static`, and the contract is shared:
255
+
256
+ - **Global Footer** from `standards/fragments/global-footer.yml`. Immutable: same
257
+ links, same order, two lists of four and six, both copyright lines. Generate it
258
+ from the contract rather than transcribing it, because transcription is how two
259
+ of its URLs were wrong in this project's first draft.
260
+ - **Identity Bar**, with nothing above it but a skip link.
261
+ - **Named business owner and technical administrator** with Stanford emails.
262
+ - **`robots.txt`** with explicit AI crawler sections. See
263
+ `standards/patterns/discoverability.md`.
264
+ - **JSON-LD** for rich results, and **not** as an AI-citation measure.
265
+ - **No cookie banner.** The Global Footer Privacy link satisfies disclosure.
266
+ - **No `llms.txt`** on a unit site.
267
+
268
+ ### 8. Motion and animations (optional, recommended for marketing sites)
269
+
270
+ Motion increases engagement when used purposefully, but it must serve the content, not distract from it. Use motion to:
271
+
272
+ - **Guide attention**: Draw focus to key CTAs or benefits
273
+ - **Improve perceived performance**: Fade elements in while content loads
274
+ - **Reward interaction**: Smooth transitions on hover and click
275
+ - **Establish brand tone**: Motion is a design choice, not a default
276
+
277
+ Use **motion** for animations. It integrates seamlessly with Next.js and respects accessibility preferences out of the box.
278
+
279
+ ```bash
280
+ npm install motion
281
+ ```
282
+
283
+ **Key rule**: Things inside moving things should not also move. Parent animations take priority; child elements stay static.
284
+
285
+ **Guidelines:**
286
+
287
+ 1. **Respect `prefers-reduced-motion`**: Always honor OS-level motion preferences. `motion` respects this automatically, but also provide a CSS fallback:
288
+
289
+ ```css
290
+ @media (prefers-reduced-motion: reduce) {
291
+ * {
292
+ animation-duration: 0.01ms !important;
293
+ transition-duration: 0.01ms !important;
294
+ }
295
+ }
296
+ ```
297
+
298
+ 2. **Keep animations brief**: 300–600ms for most interactions. Longer than 800ms feels sluggish.
299
+
300
+ 3. **Use appropriate easing**: `easeOut` for entrances (feels snappy), `easeInOut` for state changes.
301
+
302
+ 4. **Common patterns with motion:**
303
+ - **Fade-in on scroll**: Wrap sections in `<motion.div>` with `initial={{ opacity: 0 }}` and `whileInView={{ opacity: 1 }}`.
304
+ - **Button hover lift**: Use `whileHover={{ y: -2 }}` with shadow via className.
305
+ - **Scale on hover**: `whileHover={{ scale: 1.05 }}` for gentle growth.
306
+ - **Staggered animations**: Use `staggerChildren` for sequential child animations.
307
+ - **Avoid nested motion**: Parent container animates; children remain static. Do not animate both a parent and child element independently.
308
+
309
+ 5. **Performance**: `motion` uses `transform` and `opacity` by default (GPU-accelerated). Let the library handle optimization.
310
+
311
+ 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.
312
+
313
+ 7. **Accessibility in motion**:
314
+ - Animations must not auto-play audio or video without user consent.
315
+ - Avoid flashing or strobing (3+ flashes per second) — this can trigger seizures.
316
+ - Provide text alternatives or skip animations for critical content.
317
+
318
+ **Example: Fade-in on scroll with Next.js**
319
+
320
+ ```tsx
321
+ 'use client';
322
+
323
+ import { motion } from 'motion';
324
+
325
+ export default function FadeInSection({ children }: { children: React.ReactNode }) {
326
+ return (
327
+ <motion.div
328
+ initial={{ opacity: 0, y: 20 }}
329
+ whileInView={{ opacity: 1, y: 0 }}
330
+ transition={{ duration: 0.6, ease: 'easeOut' }}
331
+ viewport={{ once: true, amount: 0.3 }}
332
+ >
333
+ {children}
334
+ </motion.div>
335
+ );
336
+ }
337
+ ```
338
+
339
+ **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.
340
+
341
+ ### 9. Testing
342
+
343
+ Playwright plus `@axe-core/playwright` against every route, asserting zero
344
+ violations tagged `wcag2a`, `wcag2aa`, `wcag21a`, `wcag21aa`.
345
+
346
+ Both baselines run **Cypress** rather than Playwright, with e2e and component
347
+ testing, and the homesite adds Jest and MSW. Playwright is the forward default for
348
+ new work; **never convert an existing Cypress suite.** Expect to see Cypress when
349
+ reading either baseline.
350
+
351
+ **No component workshop.** The homesite runs Storybook with the a11y addon, which
352
+ is right at flagship scale and wrong for a unit site with a handful of components
353
+ and one consumer. Read it for what thorough looks like, not as a shopping list.
354
+
355
+ ### 10. Secrets
356
+
357
+ **Not `.env` in production.** SWS uses HashiCorp Vault, via
358
+ `netlify-plugin-vault-variables` in this family. Follow that rather than
359
+ introducing a new pattern. Committed credentials are the only thing in this system
360
+ that fails a build.
361
+
362
+ ### 11. Verify
363
+
364
+ ```bash
365
+ npm run build
366
+ npx sws check
367
+ ```
368
+
369
+ ## Swap points
370
+
371
+ | Swap | Cost |
372
+ |---|---|
373
+ | `astro-static` instead | **Usually the better choice for a content site.** Less weight, simpler hosting, works on GitHub Pages |
374
+ | Static export (`output: 'export'`) | Forfeits CSP and security headers, `redirects`, `rewrites`, Proxy, ISR, Server Actions, Draft Mode, and default-loader image optimization. Route Handlers become `GET`-only. If you want this, you want `astro-static` |
375
+ | Vercel instead of Netlify, or the reverse | **Not a divergence.** SWS runs both, one per family. Pick per `standards/hosting/`, and prefer whichever the unit already administers |
376
+ | A CSP | Supported and welcome. You are taking on the support cost of a policy that breaks at content-edit time. Name who owns that |
377
+ | A CMS, either Storyblok or decoupled Drupal | **Out of scope for now, and not a swap you can take here.** See `standards/scope.md`. Eleven SWS repos do this in production, so the capability exists — just not as anything this recipe can hand you. Raise it in discovery rather than building half of it |
378
+ | Cypress instead of Playwright | Reasonable if the project already has it. Both baselines do |
379
+ | `clsx` + `tailwind-merge` instead of `cnbuilder` | Both are in SWS use, split by project family. One per project |
380
+ | yarn instead of npm | Fine. `ccc-bulletin` uses yarn 4, the homesite uses npm. Never convert a project |
381
+
382
+ ## Known gotchas
383
+
384
+ 1. **Installing `decanter` without confirming the major.** v7 is a Tailwind 3 JS preset; nothing here works against it.
385
+ 2. **Copying the homesite's `styles/global.css` verbatim.** Its first line is `@import 'tailwindcss'` because it does not use Decanter. Yours must be `@import 'decanter'`.
386
+ 3. **Copying the homesite's `tailwind/theme.css`.** That is its derived design system, a parallel token vocabulary. Yours should be short and only contain deviations.
387
+ 4. **Scaffolding with `--tailwind`.** Conflicts with the Decanter integration.
388
+ 5. **Importing the homesite's two-CSP pattern.** It exists to let a CMS Visual Editor iframe the site. There is no CMS here, so it solves nothing and adds a policy to maintain.
389
+ 6. **CSP headers enabled locally.** Gate them on the deploy environment or fight them all day.
390
+ 7. **Assuming static export is a small change.** It removes the entire reason to use this recipe over `astro-static`.
391
+ 8. **FontAwesome Pro**, inherited from the homesite. Licence-gated, fails installs.
392
+
393
+ ## Provenance
394
+
395
+ Next.js configuration shape, CSP and security header approach, PostCSS config, and
396
+ file organisation read from `adapt-stanford-homesite` (`dev`) on 2026-08-11.
397
+ Decanter 8 integration read from `ccc-bulletin` (`dev`) the same day. Both private.
398
+
399
+ Hosting facts corrected on 2026-09-03 after SWS named the Vercel family, and
400
+ `sulgryphon-nextjs` and `press-nextjs` were then read directly to verify it.
401
+ Those two are public. The header and CSP posture in step 5 changed the same day,
402
+ on the SWS answer that CSP is a nice-to-have and that defaults must not put a
403
+ non-technical owner in trouble.
404
+
405
+ **Not yet executed end to end.** `astro-static` was validated by running it;
406
+ this recipe has not been, and until it is, treat the step ordering as reasoned
407
+ rather than proven. That is the next task for it.
@@ -0,0 +1,187 @@
1
+ # Acceptance criteria for recipe: next-ssr
2
+ #
3
+ # EXTENDS astro-static. Everything about the footer, Identity Bar, accessibility,
4
+ # MinWeb, privacy, discoverability, and provenance is shared and lives there.
5
+ # Duplicating those criteria would guarantee they drift, which is the failure
6
+ # this whole project is organised against.
7
+ #
8
+ # Only differences belong in this file:
9
+ # - criteria that do not apply here (marked `applies: false`)
10
+ # - criteria whose mechanism differs on Next
11
+ # - criteria that exist only here
12
+ #
13
+ # Same rules as the parent: every criterion maps to an implemented check or is
14
+ # marked manual; `unknown` is never a pass; `block` is reserved for irreversible
15
+ # harm, which today is exactly one thing.
16
+
17
+ recipe: next-ssr
18
+ version: 1
19
+ extends: astro-static
20
+
21
+ standard:
22
+ accessibility: WCAG 2.1 AA
23
+ policy_refs: [minweb, minsec/applications/low, accessibility, minpriv]
24
+
25
+ # ---------------------------------------------------------------- overrides
26
+ # These come from the parent but do not apply, or apply differently.
27
+ overrides:
28
+ - id: build.static-output
29
+ applies: false
30
+ why: >
31
+ This recipe deliberately does NOT use output: 'export'. Static export
32
+ cannot emit response headers, and also forfeits redirects, rewrites,
33
+ Proxy, ISR, Server Actions, Draft Mode and default-loader image
34
+ optimization. Headers alone are NOT sufficient reason to choose this
35
+ recipe: MinWeb requires none of them. Choose it for the whole list.
36
+
37
+ - id: build.base-path
38
+ applies: false
39
+ why: Netlify serves from the root. `base` is an Astro/Pages concern.
40
+
41
+ - id: build.site-set
42
+ applies: false
43
+ why: >
44
+ Astro-specific config key. The Next equivalent is metadataBase, checked
45
+ as next.metadata-base below.
46
+
47
+ - id: seo.canonical
48
+ mechanism: >
49
+ On Next, canonical URLs come from the App Router metadata API rather than
50
+ a hand-written link element. Check for a rel=canonical link in the built
51
+ output regardless of how it was produced, and if it is missing, point at
52
+ metadataBase rather than at Astro's `site`.
53
+
54
+ - id: decanter.entry-css
55
+ mechanism: >
56
+ Look for `@import 'decanter'` in the entry CSS, conventionally
57
+ styles/global.css rather than src/styles/global.css. Also verify the entry
58
+ does NOT begin with `@import 'tailwindcss'`: that is the homesite's
59
+ pattern, correct only because it does not consume Decanter.
60
+
61
+ # ---------------------------------------------------------------- additions
62
+ criteria:
63
+ - id: next.postcss-configured
64
+ requires: >
65
+ postcss.config.mjs registers @tailwindcss/postcss.
66
+ check: decanter
67
+ severity: warn
68
+ weight: 4
69
+ policy: patterns
70
+ note: >
71
+ Next uses the PostCSS plugin. @tailwindcss/vite is the Astro path and does
72
+ not apply here. Without this, Decanter's CSS is imported and never compiled.
73
+
74
+ - id: next.no-vite-tailwind
75
+ requires: '@tailwindcss/vite is not a dependency.'
76
+ check: decanter
77
+ severity: warn
78
+ weight: 2
79
+ policy: patterns
80
+ note: Wrong integration for Next. Signals a copied Astro config.
81
+
82
+ - id: next.metadata-base
83
+ requires: >
84
+ metadataBase is set in the root layout's metadata export, so canonical and
85
+ Open Graph URLs resolve absolutely.
86
+ check: seo
87
+ severity: warn
88
+ weight: 3
89
+ policy: patterns
90
+ note: The Next equivalent of Astro's `site`, and the same common miss.
91
+
92
+ - id: security.csp-present
93
+ requires: >
94
+ RECORDED, NOT REQUIRED. Whether a Content-Security-Policy is configured
95
+ for the deployed environment. Absence is a PASS.
96
+ check: security
97
+ severity: info
98
+ weight: 1
99
+ policy: minsec
100
+ mechanism: >
101
+ Parse next.config.* for a headers() function returning a
102
+ Content-Security-Policy entry. Cannot verify the served header without a
103
+ deployed URL, so report `unknown` rather than `pass` when the config
104
+ cannot be read or is generated dynamically in a way this check cannot
105
+ follow.
106
+ note: >
107
+ CHANGED 2026-09-03. This was severity warn, weight 5, described as "the
108
+ main capability this recipe has and astro-static does not". Both were
109
+ wrong. MinWeb requires no response headers, so a site with no CSP is
110
+ fully compliant, and SWS confirmed CSP is a nice-to-have. Reporting
111
+ a missing CSP as a warning pushed people towards a header that breaks
112
+ pages at content-edit time, which is the opposite of helpful. The
113
+ sensible-default header set in security.headers-set is what this recipe
114
+ actually asserts. See standards/hosting/capabilities.yml.
115
+
116
+ - id: security.headers-set
117
+ requires: >
118
+ The sensible default header set is configured: Strict-Transport-Security,
119
+ X-Content-Type-Options, Referrer-Policy, Permissions-Policy, and
120
+ X-Frame-Options.
121
+ check: security
122
+ severity: warn
123
+ weight: 6
124
+ policy: minsec
125
+ mechanism: Parse next.config.* headers(). Report per missing header, not as one failure.
126
+ note: >
127
+ These are deliberately the headers that CANNOT break a page, which is why
128
+ they are a default and CSP is not. Canonical values live in
129
+ standards/hosting/capabilities.yml under default_header_set. Prefer
130
+ X-Frame-Options SAMEORIGIN over DENY: DENY breaks a CMS Visual Editor
131
+ preview and then needs a second policy to work around itself.
132
+
133
+ # REMOVED 2026-09-03: security.editor-csp-separate. It asserted that a
134
+ # Storyblok Visual Editor route carries its own CSP and a noindex header.
135
+ # This package is scoped to static content with no CMS (standards/scope.md),
136
+ # so there is no editor route, and a criterion that can only report
137
+ # not_applicable is dead weight in the contract. Returns with the CMS.
138
+
139
+ - id: security.no-fontawesome-pro
140
+ requires: '@fortawesome/pro-* packages are not dependencies.'
141
+ check: hygiene
142
+ severity: warn
143
+ weight: 2
144
+ policy: patterns
145
+ note: >
146
+ Inherited from the homesite baseline, where it sits behind a licence-gated
147
+ preinstall token check. A unit site copying it gets an install failure and
148
+ a licence nobody mentioned. Use Heroicons.
149
+
150
+ - id: next.no-tailwind-config
151
+ requires: No tailwind.config.* file, and Tailwind was not added by the scaffolder.
152
+ check: decanter
153
+ severity: warn
154
+ weight: 2
155
+ policy: patterns
156
+ note: >
157
+ Scaffold with --no-tailwind. The scaffolder's Tailwind setup conflicts with
158
+ the Decanter integration.
159
+
160
+ - id: next.theme-extensions-annotated
161
+ requires: >
162
+ Project token overrides in the tailwind/ @theme block carry a comment
163
+ marking what differs from Decanter.
164
+ check: null
165
+ manual: true
166
+ severity: info
167
+ weight: 0
168
+ policy: patterns
169
+ note: >
170
+ ccc-bulletin annotates deviations inline ("/* Differs from Decanter */").
171
+ A comment at the token level is the same discipline as recording a
172
+ divergence in the manifest. Not automatable, worth prompting.
173
+
174
+ - id: next.not-homesite-tokens
175
+ requires: >
176
+ The project has not copied www.stanford.edu's tailwind/theme.css.
177
+ check: null
178
+ manual: true
179
+ severity: info
180
+ weight: 0
181
+ policy: patterns
182
+ note: >
183
+ The homesite's tokens are a PARALLEL VOCABULARY, not Decanter's. Copying
184
+ them produces something that looks approximately right and does not use
185
+ the design system, which passes visual review and fails every token check.
186
+ A short theme.css containing only deviations is the tell that this was
187
+ done correctly.