@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,800 @@
1
+ # Acceptance criteria for recipe: astro-static
2
+ #
3
+ # This file is the contract. Because we ship recipes rather than starter code,
4
+ # these criteria are the only thing standing between "the agent generated
5
+ # something" and "the agent generated something compliant."
6
+ #
7
+ # Rules for this file:
8
+ # 1. Every criterion MUST map to an implemented check in standards/checks/.
9
+ # A criterion with no check is a wish, not a requirement. Delete it or
10
+ # implement the check.
11
+ # 2. severity: `block` is reserved for irreversible harm. Today that is
12
+ # exactly one thing: committed secrets. Everything else nags.
13
+ # 3. `manual: true` criteria are reported as prompts, never as failures.
14
+ # They exist so the launch checklist is complete and honest.
15
+ # 4. Every criterion carries a `mechanism:` describing HOW to verify it.
16
+ # Learned by executing this recipe: prose alone gets checks written
17
+ # wrong. "Nothing above the Identity Bar" was implemented as string
18
+ # slicing and produced a false FAIL on a correct site. Criteria that
19
+ # concern document structure MUST say "DOM position", not "appears
20
+ # before".
21
+ # 5. Any check that can fail to execute (needs a browser, a network, a
22
+ # built artifact) MUST be able to report `unknown`. `unknown` is never
23
+ # counted as a pass and never contributes to the score. Learned the
24
+ # same way: a harness where axe silently failed to load still printed
25
+ # "0 violations", which is a report that lies.
26
+
27
+ # Result states: pass | fail | unknown | acknowledged | not_applicable
28
+
29
+ recipe: astro-static
30
+ version: 1
31
+ standard:
32
+ accessibility: WCAG 2.1 AA
33
+ policy_refs:
34
+ - minweb
35
+ - minsec/applications/low
36
+ - accessibility
37
+ - minpriv
38
+
39
+ criteria:
40
+ # ---------------------------------------------------------------- brand
41
+ - id: footer.global.present
42
+ requires: Stanford Global Footer is present on every rendered page.
43
+ check: footer
44
+ severity: warn
45
+ weight: 5
46
+ policy: brand
47
+
48
+ - id: footer.global.exact
49
+ requires: >
50
+ Global Footer link set matches the canonical contract exactly: same
51
+ links, same order, same grouping, no additions, no removals, no altered
52
+ labels or targets.
53
+ check: footer
54
+ severity: warn
55
+ weight: 5
56
+ policy: brand
57
+ contract: standards/fragments/global-footer.yml
58
+ mechanism: >
59
+ Read the contract file; do not hardcode the link set. The links are in
60
+ TWO lists inside one <nav>, four then six, not a flat list of ten.
61
+ Report each mismatch individually: "Trademarks points at the wrong URL"
62
+ is actionable, "the footer is wrong" is not.
63
+ note: >
64
+ Highest-value automated check in the system. Contract extracted from the
65
+ upstream decanter-web component on 2026-08-10 and no longer blocked.
66
+
67
+ - id: brand.identity-bar.present
68
+ requires: Stanford Identity Bar is present on every rendered page.
69
+ check: identity
70
+ severity: warn
71
+ weight: 4
72
+ policy: brand
73
+
74
+ - id: brand.identity-bar.exact
75
+ requires: >
76
+ The Identity Bar markup matches standards/fragments/identity-bar.yml: the
77
+ container's classes, the logo link's classes, and the link target. This is
78
+ what fixes its height and the logo size.
79
+ check: identity
80
+ severity: warn
81
+ weight: 3
82
+ policy: brand
83
+ mechanism: >
84
+ Compare CLASSES against the fragment, not a measured height. A pixel
85
+ assertion would be flaky: the bar measures 28.8px at a 1280px viewport and
86
+ 30.1px at 1600px, because the line box depends on the metrics of whichever
87
+ font resolves for --font-stanford. A brand check that drifts by a pixel
88
+ gets switched off. The classes are exact and can only produce the Stanford
89
+ height on Decanter's scale.
90
+
91
+ Also reject class patterns that re-size the bar even when the required
92
+ classes are present: py-*, any pt-/pb- other than pt-5/pb-1, h-*, min-h-*,
93
+ max-h-*, and on the link any text-* other than text-20, font-serif, or a
94
+ leading-* other than leading-none.
95
+ note: >
96
+ Written after this project shipped a bar at roughly 44px -- `py-12` in a
97
+ centred max-width wrapper with `font-serif text-24 md:text-27` -- which was
98
+ visibly taller than every other Stanford site when placed beside one. The
99
+ `logo` class is the correct mechanism, not font-serif: it carries
100
+ --font-stanford and its discretionary ligatures.
101
+
102
+ - id: brand.identity-bar.font-loaded
103
+ requires: >
104
+ Wherever the Identity Bar appears, the Stanford ligature font is loaded:
105
+ an @font-face for family "Stanford" is present in the built output.
106
+ check: identity
107
+ severity: warn
108
+ weight: 3
109
+ policy: brand
110
+ mechanism: >
111
+ Scan the built CSS and HTML for an @font-face declaring font-family
112
+ Stanford, or for a reference to the font file named in
113
+ standards/fragments/identity-bar.yml. Only runs when the Identity Bar is
114
+ actually present.
115
+ note: >
116
+ Decanter's --font-stanford is
117
+ `Stanford, "Source Serif 4", Georgia, Times, ...` and Decanter 8 publishes
118
+ NO font assets -- static/fonts/stanford.woff2 is in its repository but not
119
+ in the npm package. So a project that installs Decanter and does nothing
120
+ else gets the Source Serif 4 fallback: the wordmark renders in the wrong
121
+ typeface and the bar measures 28.8px rather than 30.8px. Nothing errors,
122
+ which is why it needs checking.
123
+
124
+ Serve it from the University Communications media CDN, the same origin
125
+ Decanter v7's fonts.css used. Verified 2026-09-02: the woff2 is 3,816
126
+ bytes and the woff 7,552, both HTTP 200.
127
+
128
+ - id: brand.identity-bar.nothing-above
129
+ requires: >
130
+ Nothing precedes the Identity Bar in the document except a skip
131
+ navigation link.
132
+ check: identity
133
+ severity: warn
134
+ weight: 3
135
+ policy: brand
136
+ mechanism: >
137
+ DOM POSITION, not string order. Parse the built HTML, take the element
138
+ children of <body>, and require that the Identity Bar is at index 0, or
139
+ at index 1 where index 0 is the skip link. Do NOT implement by slicing
140
+ the raw HTML between <body> and the identity bar's id: that produces
141
+ false failures on correct markup, which is exactly what happened when
142
+ this recipe was first validated.
143
+
144
+ - id: footer.no-additions
145
+ requires: >
146
+ No links other than the ten in the contract appear inside the Global
147
+ Footer. Unit links belong in a local footer above it.
148
+ check: footer
149
+ severity: warn
150
+ weight: 3
151
+ policy: brand
152
+ contract: standards/fragments/global-footer.yml
153
+ mechanism: >
154
+ When this fails, say where the links should move to. "Remove these links"
155
+ is unhelpful; "these belong in a local footer above the Global Footer" is
156
+ actionable.
157
+
158
+ - id: footer.copyright
159
+ requires: Both copyright lines are present, including the 94305 address.
160
+ check: footer
161
+ severity: warn
162
+ weight: 2
163
+ policy: brand
164
+ contract: standards/fragments/global-footer.yml
165
+
166
+ # ---------------------------------------------------------- accessibility
167
+ - id: a11y.axe.routes
168
+ requires: >
169
+ Zero axe-core violations tagged wcag2a, wcag2aa, wcag21a, or wcag21aa
170
+ on every route in the built output.
171
+ check: a11y
172
+ severity: warn
173
+ weight: 10
174
+ policy: accessibility
175
+ mechanism: >
176
+ Requires a REAL BROWSER. `sws a11y` serves the build output over
177
+ localhost, drives Chromium via Playwright, and runs axe-core with
178
+ @axe-core/playwright on every built route, writing
179
+ .sws/axe-results.json. `sws check` reads that file; it does not run a
180
+ browser itself. So the order is: build, then `sws a11y`, then `sws
181
+ check`. axe does not run reliably in a DOM shim; attempting it produces
182
+ a silent no-op.
183
+ reports_unknown_when: >
184
+ MUST report `unknown` with the reason, never `pass`, in every one of
185
+ these cases, because an unknown withholds all 10 points rather than
186
+ awarding them:
187
+ - no results file, so axe was never run
188
+ - @playwright/test or @axe-core/playwright is not installed
189
+ - Chromium cannot launch
190
+ - a route errored, so the run is only partial
191
+ - the results predate the current build; a stale pass is not a pass
192
+ - the results cover fewer routes than the build produced
193
+ - axe returned zero classified rules, which means it did not run even
194
+ though it returned successfully. This is the historical failure the
195
+ guard in packages/cli/src/axe.mjs exists to catch
196
+ note: >
197
+ The runner waits for CSS animations to settle before auditing. Without
198
+ that wait, axe measures colour mid-fade and reports false
199
+ color-contrast failures: this project's own site produced four, at
200
+ ratios of 1.05 to 1.55, from `opacity-0` plus a delayed `fadeInUp`.
201
+ Entry animations are common, so do not remove the wait.
202
+
203
+ - id: a11y.state.hover-non-color
204
+ requires: >
205
+ Where a control has a hover state, that state changes something other
206
+ than colour. An underline appearing (or, on a link underlined at rest,
207
+ disappearing) is the standard fix.
208
+ check: a11y
209
+ severity: warn
210
+ weight: 3
211
+ policy: accessibility
212
+ wcag: 1.4.1 (technique G183)
213
+ mechanism: >
214
+ Requires a REAL BROWSER, and a real mouse: axe cannot see this at all.
215
+ axe audits one static snapshot of the DOM and a hover state does not
216
+ exist in a snapshot, so `hover:text-poppy-light` with nothing else in the
217
+ hover rule reads as a clean page. `sws a11y` runs the audit in
218
+ packages/cli/src/states.mjs after axe: it moves the pointer over each
219
+ distinct control shape with `page.hover()`, waits for the transition to
220
+ finish, and diffs computed style against the resting state, classifying
221
+ every changed property as a colour (color, background-color, border
222
+ colour, outline colour, text-decoration-color, filter, partial opacity)
223
+ or as a non-colour cue (text-decoration, outline or border width and
224
+ style, box-shadow geometry, font-weight, transform, padding, radius,
225
+ something appearing). Colour changes with no cue anywhere in the
226
+ control's own subtree, including its ::before and ::after, are the
227
+ finding. Results go to .sws/state-results.json; `sws check` reads that
228
+ file and does not run a browser itself.
229
+ reports_unknown_when: >
230
+ Same list as a11y.axe.routes, for the same reason: no results file,
231
+ Playwright missing, Chromium unable to launch, a partial run, results
232
+ that predate the build, or fewer routes covered than the build produced.
233
+ note: >
234
+ Controls are grouped by tag and class list and measured once per distinct
235
+ shape, with the instance count reported. In a utility-CSS project the
236
+ class list IS the style, so this covers every instance of a component
237
+ without hovering 200 links; the tradeoff is that a state which depends on
238
+ position rather than class (a bare `nth-child` rule) is measured only on
239
+ its first instance. A control the mouse cannot reach, because something
240
+ overlaps it, is recorded as inconclusive and scored neither way.
241
+
242
+ - id: a11y.state.focus-non-color
243
+ requires: >
244
+ Keyboard focus is signalled by something other than colour on every
245
+ focusable control.
246
+ check: a11y
247
+ severity: warn
248
+ weight: 3
249
+ policy: accessibility
250
+ wcag: 1.4.1 (technique G183), 1.4.11
251
+ mechanism: >
252
+ Measured by the same runner as a11y.state.hover-non-color, but focus is
253
+ moved by actually PRESSING TAB, not by calling `el.focus()`. This is not
254
+ a stylistic preference: Chromium only matches `:focus-visible` when focus
255
+ arrived from the keyboard, so a scripted `.focus()` reads the `:focus`
256
+ styles and reports every `focus-visible:` utility on the page as missing.
257
+ Tab traversal also measures exactly the set of controls a keyboard user
258
+ can reach, which is the set this criterion is about.
259
+ reports_unknown_when: Same list as a11y.axe.routes.
260
+
261
+ - id: a11y.state.focus-visible
262
+ requires: >
263
+ Every control reached by Tab changes visibly when it is focused.
264
+ check: a11y
265
+ severity: warn
266
+ weight: 3
267
+ policy: accessibility
268
+ wcag: 2.4.7
269
+ mechanism: >
270
+ Falls out of the same Tab traversal: a focused control whose computed
271
+ style, pseudo-elements, and descendants are all byte-identical to the
272
+ resting state has no focus indicator at all. Reported separately from
273
+ a11y.state.focus-non-color because it is a different obligation with a
274
+ different fix -- usually an outline that was removed and not replaced --
275
+ and because a control with no focus state would otherwise be invisible
276
+ to a check that only looks at whether a change was colour.
277
+ reports_unknown_when: Same list as a11y.axe.routes.
278
+
279
+ - id: a11y.skiplink
280
+ requires: A skip navigation link is the first focusable element on every page.
281
+ check: a11y
282
+ severity: warn
283
+ weight: 3
284
+ policy: accessibility
285
+
286
+ - id: a11y.heading-order
287
+ requires: Exactly one h1 per page, and no skipped heading levels.
288
+ check: a11y
289
+ severity: warn
290
+ weight: 3
291
+ policy: accessibility
292
+
293
+ - id: a11y.image-alt
294
+ requires: Every img has an alt attribute; decorative images use alt="".
295
+ check: a11y
296
+ severity: warn
297
+ weight: 3
298
+ policy: accessibility
299
+
300
+ - id: a11y.lang
301
+ requires: The html element has a valid lang attribute.
302
+ check: a11y
303
+ severity: warn
304
+ weight: 2
305
+ policy: accessibility
306
+
307
+ - id: a11y.link-present
308
+ requires: >
309
+ An Accessibility link resolving to a barrier-reporting mechanism is
310
+ present, normally https://www.stanford.edu/site/accessibility
311
+ check: footer
312
+ severity: warn
313
+ weight: 4
314
+ policy: accessibility
315
+
316
+ - id: a11y.manual-checklist
317
+ requires: >
318
+ The manual WCAG 2.1 AA checklist has been completed and recorded.
319
+ Automation covers roughly 30 percent of issues per ODA guidance.
320
+ check: null
321
+ manual: true
322
+ severity: info
323
+ weight: 0
324
+ policy: accessibility
325
+
326
+ - id: a11y.oda-review-requested
327
+ requires: >
328
+ An ODA accessibility review has been requested ahead of launch, and the
329
+ date recorded in .sws/manifest.yml.
330
+ check: manifest
331
+ manual: true
332
+ severity: info
333
+ weight: 0
334
+ policy: accessibility
335
+ note: >
336
+ Pre-launch gate, and it needs lead time. Prompt for it during the project
337
+ rather than the week before go-live. Route per standards/policy/
338
+ escalation.md: launch means REVIEW, a build question means OFFICE HOURS,
339
+ anything else means the general contact. Offer one door, not three.
340
+
341
+ # -------------------------------------------------------------- decanter
342
+ - id: decanter.installed
343
+ requires: decanter resolves to a version in the 8.x line.
344
+ check: decanter
345
+ severity: warn
346
+ weight: 4
347
+ policy: patterns
348
+ mechanism: >
349
+ Read node_modules/decanter/package.json version, not the declared range
350
+ in the project's package.json. As of 2026-09-01 dist-tag `latest` is
351
+ 7.5.3, `beta` is 8.0.0-beta.0 and `alpha` is 8.0.0-alpha.1, so a bare
352
+ `npm i decanter` yields v7. When this fails, say `npm i decanter@beta`
353
+ rather than just reporting the version, because the fix is non-obvious.
354
+ Re-read the tags before trusting these numbers; they moved once already,
355
+ when the alpha briefly occupied `latest` in August 2026.
356
+
357
+ - id: decanter.entry-css
358
+ requires: The entry CSS imports decanter.
359
+ check: decanter
360
+ severity: warn
361
+ weight: 4
362
+ policy: patterns
363
+
364
+ - id: decanter.css-first
365
+ requires: >
366
+ The installed decanter package's `main` is src/css/index.css, confirming
367
+ the CSS-first v8 architecture.
368
+ check: decanter
369
+ severity: warn
370
+ weight: 3
371
+ policy: patterns
372
+ note: >
373
+ A `main` of tailwind.config.js means v7 is installed. This is a more
374
+ reliable tell than the version string, since the git-branch install form
375
+ does not always carry a bumped version.
376
+
377
+ - id: decanter.no-nested-tailwind
378
+ requires: >
379
+ No nested node_modules/decanter/node_modules/tailwindcss exists.
380
+ check: decanter
381
+ severity: warn
382
+ weight: 3
383
+ policy: patterns
384
+ note: >
385
+ Means v7 crept in beneath a top-level Tailwind 4. Produces a build that
386
+ half works and errors that make no sense. A top-level-only version check
387
+ reports this as passing, which is why it is separate.
388
+
389
+ - id: decanter.no-redundant-tailwind-import
390
+ requires: >
391
+ The entry CSS does not import tailwindcss alongside decanter.
392
+ check: decanter
393
+ severity: info
394
+ weight: 1
395
+ policy: patterns
396
+ note: >
397
+ Decanter imports Tailwind itself. Harmless but redundant, roughly 340
398
+ bytes. Low weight deliberately: it is a tidiness signal, not a defect.
399
+ Note that www.stanford.edu DOES import tailwindcss directly, correctly,
400
+ because it does not consume Decanter.
401
+
402
+ - id: decanter.no-js-config
403
+ requires: No tailwind.config.js or tailwind.config.mjs exists.
404
+ check: decanter
405
+ severity: warn
406
+ weight: 2
407
+ policy: patterns
408
+ note: Presence indicates a Decanter 7 mental model.
409
+
410
+ - id: decanter.no-dead-integration
411
+ requires: '@astrojs/tailwind is not a dependency.'
412
+ check: decanter
413
+ severity: warn
414
+ weight: 3
415
+ policy: patterns
416
+ note: Dead package. Appears to work, then fails.
417
+
418
+ - id: decanter.tailwind-major
419
+ requires: >
420
+ Every resolved tailwindcss in the dependency tree is 4.x, including
421
+ nested copies.
422
+ check: decanter
423
+ severity: warn
424
+ weight: 3
425
+ policy: patterns
426
+ mechanism: >
427
+ Check the WHOLE TREE, not just the top level. Installing the wrong
428
+ Decanter tag produces node_modules/decanter/node_modules/tailwindcss at
429
+ 3.x underneath a top-level 4.x, which a top-level-only check reports as
430
+ passing while the build is wrong. Verified during recipe validation.
431
+ Also assert node_modules/decanter/package.json `main` is
432
+ src/css/index.css, since `tailwind.config.js` means v7.
433
+
434
+ # ------------------------------------------------------------ minweb core
435
+ - id: minweb.ownership
436
+ requires: >
437
+ A named business owner and a named technical web administrator, both with
438
+ valid Stanford affiliation and email, are discoverable in the footer or
439
+ on an About page, and recorded in .sws/manifest.yml.
440
+ check: manifest
441
+ severity: warn
442
+ weight: 5
443
+ policy: minweb
444
+
445
+ - id: minweb.no-secrets
446
+ requires: No credentials, API keys, or tokens are committed to the repository.
447
+ check: secrets
448
+ severity: block
449
+ weight: 10
450
+ policy: minweb
451
+ note: >
452
+ THE ONLY BLOCKING CRITERION IN THE SYSTEM. Justified because the harm is
453
+ irreversible once pushed and MinWeb names it explicitly.
454
+ mechanism: >
455
+ On a PULL REQUEST, blocking stops the leak from landing. On a PUSH TO
456
+ MAIN the commit is already in the remote's history, so blocking only
457
+ prevents publishing the credential on a public website. That is still
458
+ worth stopping, but the message must differ by context.
459
+ Trunk message must say, in this order: (1) rotate the credential now,
460
+ because it is already in git history and blocking the deploy does not
461
+ un-leak it, (2) then clean the history, (3) then push again. A failure
462
+ that only says "secret detected" teaches nothing and gets worked around.
463
+
464
+ - id: minweb.https-only
465
+ requires: >
466
+ No hardcoded http:// URLs to Stanford or first-party resources. Deploy
467
+ target enforces HTTPS with a live certificate.
468
+ check: hygiene
469
+ severity: warn
470
+ weight: 4
471
+ policy: minweb
472
+
473
+ - id: minweb.subdomain-approved
474
+ requires: >
475
+ The stanford.edu subdomain reflects the recognized unit name and is
476
+ approved by University Communications.
477
+ check: null
478
+ manual: true
479
+ severity: info
480
+ weight: 0
481
+ policy: minweb
482
+
483
+ - id: minweb.mfa-admin
484
+ requires: All administrative logins use MFA or SSO with MFA.
485
+ check: null
486
+ manual: true
487
+ severity: info
488
+ weight: 0
489
+ policy: minweb
490
+
491
+ - id: minweb.siteimprove
492
+ requires: >
493
+ The site is registered with Siteimprove, which is required for
494
+ public-facing Stanford sites, and the registration is recorded in
495
+ .sws/manifest.yml.
496
+ check: manifest
497
+ severity: warn
498
+ weight: 4
499
+ policy: minweb
500
+ note: Siteimprove is required. Google Analytics is not.
501
+
502
+ # --------------------------------------------------------------- privacy
503
+ - id: privacy.consent-ui-declared
504
+ requires: >
505
+ If consent UI is present in the built output, the choice is recorded in
506
+ .sws/manifest.yml under privacy.consent_tooling with a reason.
507
+ check: hygiene
508
+ severity: info
509
+ weight: 1
510
+ policy: minpriv
511
+ mechanism: >
512
+ Detect consent UI authored IN THIS REPO: a container named like a consent
513
+ banner, or a control whose own label asks the reader to accept cookies.
514
+ Pass when it is absent, and pass when it is present and declared. A
515
+ third-party consent package is covered separately by
516
+ privacy.consent-tooling-declared.
517
+
518
+ Detection must be specific. An earlier version matched the substrings
519
+ /cookie/ and /(accept|consent)/ anywhere in the document, which failed on
520
+ this project's own compliant site: "cookie" came from the MANDATED Global
521
+ Footer link title and "accept" from prose about accepted risks.
522
+ note: >
523
+ A cookie banner is NOT forbidden at Stanford, and this criterion does not
524
+ pretend otherwise. None is REQUIRED, because the Global Footer's Privacy
525
+ link carries the disclosure — so a banner is a deliberate addition, and
526
+ the only thing asked here is that the decision be written down. Severity
527
+ is `info` for that reason: the project has no standing to prohibit it.
528
+
529
+ - id: privacy.consent-tooling-declared
530
+ requires: >
531
+ If third-party consent tooling is present, it is recorded in
532
+ .sws/manifest.yml with the reason, and the University Privacy Office has
533
+ been consulted.
534
+ check: manifest
535
+ severity: info
536
+ weight: 0
537
+ policy: minpriv
538
+ note: >
539
+ Presence is LEGITIMATE. Stanford centrally licenses no cookie banner
540
+ service, but a client or funder may require one, as happened on
541
+ summer-nextjs. Undocumented presence is the only problem here.
542
+ mechanism: >
543
+ Detect known consent packages in the dependency tree. If found and not
544
+ declared in the manifest, prompt to record the reason. NEVER recommend or
545
+ rank a vendor: state the obligation and name the Privacy Office. See the
546
+ "route, don't recommend" principle in the project plan.
547
+
548
+ - id: privacy.notice-before-collection
549
+ requires: >
550
+ Any form or collection point carries a transparency notice before
551
+ collection, per MinPriv.
552
+ check: null
553
+ manual: true
554
+ severity: info
555
+ weight: 0
556
+ policy: minpriv
557
+
558
+ - id: privacy.dra-if-triggered
559
+ requires: >
560
+ If the site collects personal information or introduces third-party
561
+ services, a Data Risk Assessment is filed before deploy.
562
+ check: manifest
563
+ manual: true
564
+ severity: warn
565
+ weight: 0
566
+ policy: minpriv
567
+ applies_when: tier != low
568
+
569
+ # --------------------------------------------------- discoverability
570
+ - id: seo.title-unique
571
+ requires: Every page has a non-empty title, unique across the site.
572
+ check: seo
573
+ severity: warn
574
+ weight: 3
575
+ policy: patterns
576
+
577
+ - id: seo.meta-description
578
+ requires: Every page has a non-empty meta description.
579
+ check: seo
580
+ severity: warn
581
+ weight: 2
582
+ policy: patterns
583
+
584
+ - id: seo.canonical
585
+ requires: >
586
+ Canonical URLs resolve to the production origin, which requires `site`
587
+ to be set in astro.config.mjs.
588
+ check: seo
589
+ severity: warn
590
+ weight: 3
591
+ policy: patterns
592
+
593
+ - id: seo.sitemap
594
+ requires: sitemap-index.xml is emitted and reachable.
595
+ check: seo
596
+ severity: warn
597
+ weight: 3
598
+ policy: patterns
599
+
600
+ - id: seo.robots
601
+ requires: robots.txt exists and references the sitemap.
602
+ check: seo
603
+ severity: warn
604
+ weight: 2
605
+ policy: patterns
606
+
607
+ - id: seo.robots-ai-sections
608
+ requires: >
609
+ robots.txt addresses AI crawlers explicitly rather than by omission,
610
+ distinguishing retrieval bots from training crawlers.
611
+ check: seo
612
+ severity: info
613
+ weight: 1
614
+ policy: patterns
615
+ note: >
616
+ Only ~8% of sites with robots.txt have any AI rules. Silence is a default,
617
+ not a decision. This prompts a decision; it does not prescribe one, since
618
+ whether to allow training crawlers is a unit policy call.
619
+
620
+ - id: seo.structured-data
621
+ requires: >
622
+ JSON-LD is present and valid for the appropriate type, normally
623
+ EducationalOrganization or Organization plus BreadcrumbList.
624
+ check: seo
625
+ severity: info
626
+ weight: 2
627
+ policy: patterns
628
+ note: >
629
+ FOR RICH RESULTS ONLY. Google states (May 2026) that no special markup is
630
+ needed to appear in generative AI features. Do not report this as an
631
+ AI-visibility measure, and do not let anyone claim AI credit for it.
632
+
633
+ - id: seo.canonical-facts-in-html
634
+ requires: >
635
+ Canonical facts (deadlines, tuition, program requirements, accreditation)
636
+ appear as HTML text, not only inside PDFs or JS-rendered components.
637
+ check: null
638
+ manual: true
639
+ severity: info
640
+ weight: 0
641
+ policy: patterns
642
+ note: >
643
+ One of the few evidence-backed discoverability practices: 44.2% of LLM
644
+ citations come from the first 30% of a document, and PDF-only facts are
645
+ invisible to both search and AI retrieval.
646
+
647
+ - id: seo.no-llms-txt-on-marketing
648
+ requires: >
649
+ No llms.txt on a marketing or unit site. It belongs on documentation
650
+ sites, for the IDE coding-agent audience.
651
+ check: seo
652
+ severity: info
653
+ weight: 0
654
+ policy: patterns
655
+ note: >
656
+ Verified 2026-08: 97% of published llms.txt files receive zero requests
657
+ and AI search crawlers read HTML directly. Presence is harmless but
658
+ signals a misunderstanding worth correcting.
659
+
660
+ # ---------------------------------------------------------------- build
661
+ - id: build.succeeds
662
+ requires: astro build completes with exit code 0.
663
+ check: build
664
+ severity: warn
665
+ weight: 8
666
+ policy: null
667
+
668
+ - id: build.static-output
669
+ requires: Astro output mode is 'static'.
670
+ check: build
671
+ severity: warn
672
+ weight: 3
673
+ policy: null
674
+
675
+ - id: build.node-major
676
+ requires: Node major version is 24 or newer.
677
+ check: hygiene
678
+ severity: warn
679
+ weight: 2
680
+ policy: null
681
+
682
+ - id: build.site-set
683
+ requires: '`site` is set in astro.config.mjs to the production origin.'
684
+ check: build
685
+ severity: warn
686
+ weight: 4
687
+ policy: patterns
688
+ note: >
689
+ The most common configuration miss. Without it @astrojs/sitemap emits
690
+ nothing and canonical URLs are wrong, so it silently fails two other
691
+ criteria. Weighted accordingly.
692
+
693
+ - id: build.base-path
694
+ requires: >
695
+ If deploying to a subpath, `base` is set in astro.config.mjs to match.
696
+ check: build
697
+ severity: warn
698
+ weight: 3
699
+ policy: null
700
+ note: Works locally and breaks in production when missed.
701
+
702
+ - id: workflow.push-to-main-deploys
703
+ requires: >
704
+ The deploy workflow triggers on push to the default branch, so a direct
705
+ commit publishes without requiring a pull request.
706
+ check: workflow
707
+ severity: warn
708
+ weight: 3
709
+ policy: null
710
+ note: >
711
+ Pull requests are first-class but never required. Many campus editors
712
+ work through the GitHub web UI, which is push-to-main by construction.
713
+ A workflow that only deploys on merge locks them out.
714
+
715
+ - id: workflow.no-forced-review
716
+ requires: >
717
+ No branch protection rule, required status check, or protected
718
+ environment (other than `github-pages`) makes a pull request mandatory
719
+ on the default branch.
720
+ check: workflow
721
+ manual: true
722
+ severity: info
723
+ weight: 0
724
+ policy: null
725
+ mechanism: >
726
+ Requires repo admin scope to read protection rules, so report `unknown`
727
+ rather than `pass` when the token cannot see them. Never auto-remove a
728
+ protection rule: a team may have added one deliberately. Report and ask.
729
+
730
+ - id: workflow.report-reaches-a-reader
731
+ requires: >
732
+ The advisory report is written to the job summary and a persistent
733
+ issue on trunk pushes, and to annotations plus a PR comment on pull
734
+ requests.
735
+ check: workflow
736
+ severity: warn
737
+ weight: 2
738
+ policy: null
739
+ note: >
740
+ Needs `issues: write` and `pull-requests: write` permissions. Without
741
+ them the report is produced and nobody ever sees it, which is worse than
742
+ not running the check.
743
+
744
+ - id: perf.budget
745
+ requires: >
746
+ Every built route is within the performance budget in
747
+ standards/stack/performance-budget.yml, measured as first-party
748
+ uncompressed transfer bytes and request count.
749
+ check: perf
750
+ severity: info
751
+ weight: 3
752
+ policy: null
753
+ mechanism: >
754
+ `sws perf` serves the build over localhost, drives Chromium via
755
+ Playwright, waits for animations to settle, and records per-route
756
+ first-party bytes by type plus request counts to .sws/perf-results.json.
757
+ `sws check` reads that file. Order: build, `sws perf`, `sws check`.
758
+
759
+ NOT Lighthouse, deliberately. A Lighthouse performance score varies by
760
+ ten points or more between runs on a shared CI runner, and a self-moving
761
+ number inside a trended compliance score teaches people to ignore the
762
+ score, which is the failure the whole advisory design exists to avoid.
763
+ Bytes are exact and reproducible. Navigation timings ARE recorded as
764
+ unscored context so a person can look; they never affect the result.
765
+
766
+ Third-party bytes are excluded from the budget, because counting them
767
+ would make the check depend on the network and fail in an offline CI.
768
+ They are reported separately with their origins, which is useful twice
769
+ over: a third-party request is a performance cost AND a privacy surface
770
+ that MinPriv treats as disclosable. See standards/policy/privacy.md.
771
+ reports_unknown_when: >
772
+ MUST report `unknown` with the reason, never `pass`:
773
+ - no results file, so the budget was never measured
774
+ - @playwright/test is not installed, or Chromium cannot launch
775
+ - standards/stack/performance-budget.yml is missing or unparseable
776
+ - a route errored, so the run is only partial
777
+ - the results predate the current build
778
+ - the results cover fewer routes than the build produced
779
+ note: >
780
+ A project may override any limit in .sws/manifest.yml under
781
+ `performance_budget:` with a reason. That is a recorded divergence, not a
782
+ workaround, and the report says which limits were overridden.
783
+
784
+ # ----------------------------------------------------------- provenance
785
+ - id: manifest.present
786
+ requires: >
787
+ .sws/manifest.yml exists and records standards version, resolved tool
788
+ versions, compliance tier, editors emitted for, prior art reused, and
789
+ divergences.
790
+ check: manifest
791
+ severity: warn
792
+ weight: 4
793
+ policy: null
794
+
795
+ - id: manifest.divergences-explained
796
+ requires: Every divergence from this recipe has a recorded one-line reason.
797
+ check: manifest
798
+ severity: info
799
+ weight: 2
800
+ policy: null