@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,87 @@
1
+ ---
2
+ name: sws-preflight
3
+ description: Check whether this machine has the tools needed to build and deploy a Stanford site, install whatever is missing, and verify it worked. Use at the start of work on a new machine, before a first deploy, when a build or test fails in a way that smells like a missing tool, or when someone asks what they need installed.
4
+ ---
5
+
6
+ # Check the machine before you build on it
7
+
8
+ ```bash
9
+ npx sws preflight
10
+ ```
11
+
12
+ One command. It reads `standards/stack/requirements.yml`, probes for each tool,
13
+ and tells you what is missing and why it matters. Use `--format json` if you are
14
+ acting on the result programmatically.
15
+
16
+ **It does not install anything, and it deliberately does not tell you how to.**
17
+ That part is yours: you know what platform you are on and what package manager
18
+ exists, and a hardcoded install matrix would be a guess about someone else's
19
+ machine that is wrong on a good fraction of them.
20
+
21
+ ## The loop
22
+
23
+ 1. **Check.** `npx sws preflight`.
24
+ 2. **Install what it names**, however you normally would on this machine.
25
+ 3. **Check again.** This is the step people skip, and it is the whole reason the
26
+ command exists. An installer that printed success without putting the binary
27
+ on `PATH` is the common failure, and it stays invisible until something
28
+ unrelated breaks with a confusing error.
29
+
30
+ Do not report a machine as ready on the strength of an install command exiting
31
+ 0. Report it ready when the check says so.
32
+
33
+ ## Reading the result
34
+
35
+ | State | Means |
36
+ |---|---|
37
+ | `ok` | Present, and new enough |
38
+ | `MISSING` | Not installed. Install it |
39
+ | `TOO OLD` | Installed below the version floor. Upgrade it |
40
+ | `unknown` | Present but the probe failed. **Not a pass** — investigate rather than assuming it is fine |
41
+ | `-` | Not needed for this project, usually because of the recorded host |
42
+
43
+ `unknown` deserves attention. It means the binary exists and did not answer as
44
+ expected, which is a different problem from absence and usually has a different
45
+ cause: a broken install, a shim, a PATH collision, or a wrapper that swallowed
46
+ the flag.
47
+
48
+ ## What it checks, and what it will not
49
+
50
+ The list lives in `standards/stack/requirements.yml`, which is the single source
51
+ of truth — read that rather than trusting a list here, because this file will
52
+ drift and that one is executed.
53
+
54
+ Two things worth knowing without opening it:
55
+
56
+ - **`git` is the one with no substitute.** No API and no MCP server replaces it:
57
+ the GitHub API can create a repo and write single files, but it cannot init a
58
+ repo, commit locally, add a remote, or push a working tree.
59
+ - **Playwright's browser is a separate download from its npm packages.** The
60
+ packages can be installed and the browser absent, and the failure then looks
61
+ like a broken test rather than a missing binary. A missing browser must never
62
+ read as a clean accessibility result: a check that did not run is `unknown`,
63
+ not a pass.
64
+
65
+ Some checks are **conditional on the recorded host**, from `hosting.provider` in
66
+ `.sws/manifest.yml`. If that is not set yet, host-specific tools report `-` and
67
+ say so. Record the host and re-run to get a real answer for it.
68
+
69
+ The file also lists what is **deliberately not required** — Docker, Homebrew,
70
+ any particular package manager, a GitHub MCP server — so their absence is not
71
+ mistaken for an oversight. **Do not install Homebrew to obtain one binary.**
72
+
73
+ ## Two courtesies
74
+
75
+ **Warn before running `git --version` on macOS.** If the Command Line Tools are
76
+ absent, it pops a GUI installer dialog. A person has to click that; you cannot.
77
+ Say it is about to happen rather than letting a box appear from nowhere.
78
+
79
+ **Never convert a project's package manager.** If there is a `yarn.lock`, yarn is
80
+ the requirement and npm is not. The check reports whichever the project actually
81
+ uses, and both are in production at SWS.
82
+
83
+ ## Exit codes
84
+
85
+ Exits `0` even when tools are missing, because nothing in this toolchain blocks
86
+ by default. Pass `--strict` to exit non-zero when a required tool is missing,
87
+ which is what you want in CI or in a scripted install-then-verify loop.
@@ -0,0 +1,137 @@
1
+ ---
2
+ name: sws-prior-art
3
+ description: Consult existing Stanford Web Services work before building something new. Use at the start of any build task, when choosing an information architecture or content model, when picking a library, or when the user asks "have we done this before" or "how do we usually do this".
4
+ ---
5
+
6
+ # Prior art
7
+
8
+ SWS has built a lot of Stanford sites. Most of what a new site needs is solved
9
+ somewhere. Reinventing it produces worse work slower.
10
+
11
+ Your job here is to find the relevant precedent, **label what kind of evidence
12
+ it is**, and hand back something the person can act on. Not to conclude.
13
+
14
+ ## The precedence rule, all three clauses
15
+
16
+ Read these before reporting anything. Applying only the first clause is the
17
+ most common way to get this wrong.
18
+
19
+ **1. Dated execution is drift. Standards win.**
20
+ A repo on Decanter 7 and Tailwind 3 is not a CSS reference. A repo on Next 13 is
21
+ not a framework reference. Take the problem shape, leave the implementation.
22
+
23
+ **2. Repeated identical choices are a convention. Adopt them.**
24
+ `cnbuilder ^3.1.0` pinned across seven repos is knowledge, not drift. When
25
+ production repos consistently agree with each other and disagree with our
26
+ standards, our standards are probably wrong.
27
+
28
+ The test: *is this repo doing something old, or is the org doing something
29
+ consistently?* One repo on Decanter 7 is dated. Nine repos avoiding a tool we
30
+ recommend is a signal about the tool.
31
+
32
+ **3. Prior art cannot tell you why, or where the org is going.**
33
+ Repos record decisions already executed. Intent lives only in people's heads.
34
+
35
+ This clause was learned expensively. A first inspection pass produced four
36
+ proposed corrections to our standards and **three were wrong**:
37
+
38
+ - `sa11y` in five repos looked like a developer tooling convention. It is a
39
+ **content-author** tool used in Visual Editor overlays. The data said *what*
40
+ and a *why* was invented.
41
+ - Cypress in three repos and Playwright in zero looked decisive. SWS is moving
42
+ to Playwright. The right answer was invisible to the analysis by construction.
43
+ - `sws-astro` on an older Astro major looked like a constraint to adopt. The
44
+ real answer was to stop naming versions at all.
45
+
46
+ ## Obligations
47
+
48
+ 1. **Never infer purpose from presence.** If a dependency's role is not obvious
49
+ from how it is used, say "five repos include X, purpose unconfirmed."
50
+ 2. **Never present current practice as intent.** "Three repos use Cypress" is a
51
+ fact. "SWS standardises on Cypress" is a claim about a decision.
52
+ 3. **Watch for questions to dissolve rather than answer.** If prior art and
53
+ standards disagree on a version, first ask whether the version needed
54
+ specifying.
55
+ 4. **End with a check, not a conclusion.** Label each finding as fact or
56
+ inference and let the person confirm.
57
+ 5. **Correlations are traps.** `sa11y` correlated perfectly with Storyblok,
58
+ five for five and six for six. That pattern was the answer; the count was
59
+ not. When a dependency correlates tightly with another, it probably belongs
60
+ to that dependency's domain.
61
+ 6. **Absence is often a decision.** `www.stanford.edu` has no `decanter`
62
+ dependency. That is a deliberate architecture (a derived design system), not
63
+ an oversight. Ask before calling a gap a gap.
64
+
65
+ ## Lookup order
66
+
67
+ ```
68
+ 1. standards/prior-art/patterns/INDEX.md distilled, fastest, has judgment
69
+ 2. .sws/prior-art.local.yml the user's own disk, free, private
70
+ 3. standards/prior-art/repos.yml 11 inspected source repos
71
+ 4. standards/prior-art/catalog.yml 17 live exemplars + tools
72
+ 5. live GitHub org search uncurated fallback
73
+ 6. nothing found say so plainly
74
+ ```
75
+
76
+ Step 6 matters. "No prior art found" is a legitimate and common answer. A tool
77
+ that always finds something is a tool that is sometimes wrong without saying so.
78
+
79
+ ## Reference types, and what each is good for
80
+
81
+ **Source repos** (`repos.yml`) have readable code, so `era` is verified. Check
82
+ the `ref` field: default branches are `main` for `sws-astro`, `dev` for the
83
+ ADAPT and OOD family, and `1.x` for the decoupled Drupal repos. A pointer
84
+ without an explicit ref silently reads the wrong branch.
85
+
86
+ **Live exemplars** (`catalog.yml`) are URLs with no public source for most.
87
+ Authoritative for rendered page furniture, IA, content patterns, and a real
88
+ shipped accessibility baseline. Useless for build config, versions, or component
89
+ source. A rendered page gives no signal about which Decanter era produced it, so
90
+ clause 1 applies at full strength.
91
+
92
+ **Local scan** is the user's own disk. Highest signal, zero curation, never
93
+ transmitted. Metadata only.
94
+
95
+ ## Lineage, which is not the same as era
96
+
97
+ `era` implies a straight line where newer is better. That breaks on the first
98
+ important repo.
99
+
100
+ | Lineage | Meaning | How to use it |
101
+ |---|---|---|
102
+ | Consumer | Installs Decanter at some version | Era applies normally |
103
+ | Derived | Own system, descended from Decanter | Brand furniture authoritative. Tokens and CSS are a **parallel vocabulary** |
104
+ | Upstream | Feeding patterns back into Decanter | A preview of direction. Adopt ideas, not implementations |
105
+
106
+ `www.stanford.edu` is derived **and** upstream at once. The specific trap:
107
+ copying CSS from a derived system into a Decanter project produces something
108
+ that **looks approximately right and does not use the design system**. It passes
109
+ visual review and fails every token check, and the failure is invisible in a
110
+ screenshot.
111
+
112
+ ## Copy-forking is legitimate
113
+
114
+ `cardinalsites-nextjs` and `csp-nextjs` are intentional sibling instances: two
115
+ clients, one copied from the other. `relationship: sibling-instance` is a
116
+ **recognised pattern**, not a finding. Report it as context, never as drift.
117
+
118
+ Copy-forking a previous client site is the existing, working solution to reuse
119
+ at SWS. It is fast and carries decisions no document captured. What it cannot do
120
+ is tell you what has moved since. Recipes are the diff a fork cannot give you.
121
+ Never frame a fork as a mistake.
122
+
123
+ ## Reporting format
124
+
125
+ ```
126
+ Found: <what>, in <repo/site> (<ref>), era <era>, rated <rating>
127
+ Use it for: <specific thing>
128
+ Do not use it for: <specific thing, usually CSS or versions>
129
+ Confidence: fact | inference
130
+ ```
131
+
132
+ Then record what was actually reused in `.sws/manifest.yml` under `prior_art`,
133
+ so the next person can trace where a pattern came from.
134
+
135
+ Full detail in `standards/prior-art/README.md`. The record of the four
136
+ corrections, kept deliberately as a record of error, is in
137
+ `standards/patterns/sws-conventions.md`.
@@ -0,0 +1,117 @@
1
+ ---
2
+ name: sws-vercel
3
+ description: Move a Stanford site from GitHub Pages to Vercel, or provision it there from the start, driven from the terminal where possible. Use when a project wants Next.js features on release day, is a decoupled Drupal front end, or the unit has or wants a Vercel account.
4
+ ---
5
+
6
+ # Get it onto Vercel
7
+
8
+ **Same shape of job as `sws-netlify`, and the same honest limit.** Vercel's
9
+ git-based continuous deployment runs through a GitHub App too, and installing
10
+ that app for an account or org the first time is a browser OAuth consent
11
+ screen — there is no API call that substitutes for it. `vercel git connect`
12
+ handles the case where the grant already exists; it does not remove the
13
+ first-time step. Say this up front rather than promising a fully scripted path.
14
+
15
+ The exact commands, and what is verified versus reasoned, are in
16
+ `standards/hosting/vercel.yml` under `provisioning`. Read that; this file is
17
+ the order, the questions, and the judgment.
18
+
19
+ ## First, ask
20
+
21
+ 1. **"Do you already have a Vercel account, and is it a team or personal?"**
22
+ Prefer a team, for the same reason as every other host here: a site whose
23
+ only deploy access belongs to one person breaks MinWeb's
24
+ named-administrator requirement the day that person leaves. If they have no
25
+ team access, that is an access request for a team owner, not something to
26
+ work around — route per `standards/policy/escalation.md`.
27
+ 2. **"Does the repo already exist on GitHub?"** Vercel connects to a repo, it
28
+ does not create one. If there is no repo yet, run `sws-github` first, or at
29
+ least get the code pushed, before starting here.
30
+ 3. **"Why Vercel and not Netlify?"** Read `standards/hosting/vercel.yml` and
31
+ `standards/hosting/netlify.yml` together before answering for them. The
32
+ right answer is almost always "the unit already administers one of these
33
+ two," and Next.js features landing here first is the other legitimate
34
+ reason — ask rather than picking on shared-tooling grounds alone.
35
+
36
+ ## Preflight
37
+
38
+ ```bash
39
+ npx sws preflight # then install what it names, then run it again
40
+ ```
41
+
42
+ **The Vercel CLI is optional here**, same as Netlify's —
43
+ `standards/stack/requirements.yml` marks `vercel-cli` `optional: true` because
44
+ Vercel deploys from its git integration, not from the CLI. Install it anyway
45
+ for linking, environment variables, and verification; just do not treat its
46
+ absence as a blocker the way a missing `gh` is one.
47
+
48
+ `git` is still mandatory regardless of host, for the same reason as always.
49
+
50
+ ## Then run the steps in order
51
+
52
+ Follow `provisioning.steps` in `standards/hosting/vercel.yml`: `auth`,
53
+ `choose-team`, `link-project`, `connect-repo`, `build-config`, `verify`.
54
+
55
+ **`link-project` is scriptable; `connect-repo` might not be, and that
56
+ difference is worth stating out loud.** `vercel link --yes --scope <team>`
57
+ accepts Vercel's detected framework defaults and creates a project without a
58
+ prompt. `vercel git connect` then wires that project to the GitHub repo — and
59
+ if this is the team's first repo on Vercel, it walks a GitHub App installation
60
+ that is an OAuth consent screen with no API substitute. Tell the person this
61
+ is coming before running it, the same way `sws-github` warns about the macOS
62
+ Xcode Command Line Tools dialog appearing unannounced. Once a team's GitHub
63
+ App grant covers new repos in that org, later projects on the same team skip
64
+ the consent screen entirely.
65
+
66
+ **Config belongs in the repo, not the dashboard.** Commit `vercel.json` for
67
+ headers, redirects, and build overrides per
68
+ `standards/recipes/astro-ssr/RECIPE.md` step 8b, for the same reason secrets
69
+ go in Vault rather than a host UI. Reserve `vercel env add` for values that
70
+ must not be committed, and prefer `node-vault` — the host-portable option and
71
+ the decoupled-drupal family convention — over hand-set dashboard values.
72
+
73
+ **Secrets do not live in `.env` in production.** If the unit's Vault access is
74
+ not yet set up, that is its own request to the Vault administrator, not
75
+ something this skill can provision.
76
+
77
+ **Watch for the `*.vercel.app` trap.** A project that never connects a custom
78
+ domain quietly ships on a preview-style URL. That is fine pre-launch and not
79
+ fine at launch — `standards/hosting/vercel.yml` names `press-nextjs`'s
80
+ `stanford-university-press.vercel.app` as the live example of this being
81
+ missed. Confirm the production domain before calling a project launched.
82
+
83
+ ## Never add branch protection or required status checks
84
+
85
+ Same rule as `sws-github` and `sws-netlify`, for the same reason: many campus
86
+ editors work through the GitHub web UI, which is push-to-main by construction,
87
+ and branch protection quietly turns that into a pull-request requirement.
88
+ Vercel's git integration already deploys on push to `main`; keep any GitHub
89
+ Actions workflow for checks only, never as a deploy gate.
90
+
91
+ ## Verify, then say what you have not done
92
+
93
+ ```bash
94
+ vercel project ls
95
+ vercel inspect <deployment-url>
96
+ ```
97
+
98
+ There is no single boolean confirmed here against a live API response the way
99
+ `gh api .../pages` returns `https_enforced`. Vercel's automatic HTTPS is close
100
+ to unconditional for a Vercel-managed or correctly CNAMEd custom domain, but
101
+ confirm the certificate is actually live on first real use rather than
102
+ assuming it, and confirm the production URL is a real subdomain rather than a
103
+ `*.vercel.app` preview domain.
104
+
105
+ **Provisioning is not launching.** Close by naming what remains, same list as
106
+ `sws-github` and `sws-netlify` and with the same lead times:
107
+
108
+ - **The `stanford.edu` subdomain** — University Communications approves the name.
109
+ - **The ODA accessibility review** — a pre-launch gate; raise it now.
110
+ - **Siteimprove registration** — required for public sites, its own intake.
111
+ - **Business owner and technical administrator** in `.sws/manifest.yml`, both
112
+ with valid Stanford affiliation.
113
+ - **MFA attested** on the Vercel team dashboard — an administrative login
114
+ under MinWeb, and not on by default.
115
+
116
+ Record what you did in `.sws/manifest.yml` under `hosting`: `provider:
117
+ vercel`, the `production_url`, and the date MFA was confirmed.
@@ -0,0 +1,137 @@
1
+ # Stanford Global Footer: the normative content contract
2
+ #
3
+ # Source of truth: SU-SWS/decanter-web components/GlobalFooter/GlobalFooter.tsx
4
+ # https://github.com/SU-SWS/decanter-web/blob/main/components/GlobalFooter/GlobalFooter.tsx
5
+ # Rendered: https://decanter.stanford.edu/examples/global-footer
6
+ # Extracted: 2026-08-10
7
+ #
8
+ # ==============================================================================
9
+ # THIS FILE IS THE CHECK. `sws check` reads it directly.
10
+ #
11
+ # The Global Footer is immutable: per the Identity Guide its links may not be
12
+ # altered, reordered, or added to, and nothing else may go inside it. Unit
13
+ # links belong in a LOCAL footer above it.
14
+ #
15
+ # Do not edit this file to make a project pass. Edit it only when the upstream
16
+ # component changes, and record the date.
17
+ # ==============================================================================
18
+
19
+ version: 1
20
+ extracted: 2026-08-10
21
+ upstream:
22
+ repo: SU-SWS/decanter-web
23
+ path: components/GlobalFooter/GlobalFooter.tsx
24
+ ref: main
25
+
26
+ structure:
27
+ element: footer
28
+ # NOTE: the links are in TWO lists inside one <nav>, not one list of ten.
29
+ # An earlier draft of this project assumed a single list. A check written
30
+ # against a flat list will produce false failures on correct markup.
31
+ nav:
32
+ aria_label: global footer menu
33
+ list_count: 2
34
+ logo:
35
+ present: true
36
+ type: stacked
37
+ color: white
38
+ is_link: true
39
+
40
+ # ------------------------------------------------------------------ list one
41
+ # Stanford-wide wayfinding. Four links, this order.
42
+ resource_links:
43
+ - label: Stanford Home
44
+ href: https://www.stanford.edu
45
+ - label: Maps & Directions
46
+ href: https://visit.stanford.edu/plan/
47
+ - label: Search Stanford
48
+ href: https://www.stanford.edu/search/
49
+ - label: Emergency Info
50
+ href: https://emergency.stanford.edu
51
+
52
+ # ------------------------------------------------------------------ list two
53
+ # Policy and compliance. Six links, this order. `title` attributes are part of
54
+ # the upstream component and should be reproduced.
55
+ policy_links:
56
+ - label: Terms of Use
57
+ href: https://www.stanford.edu/site/terms/
58
+ title: Terms of use for sites
59
+ - label: Privacy
60
+ href: https://www.stanford.edu/site/privacy/
61
+ title: Privacy and cookie policy
62
+ note: >
63
+ This is how a Stanford site satisfies its cookie disclosure obligation.
64
+ The upstream title says "Privacy and cookie policy" explicitly, which is
65
+ why no consent banner is required. Not required is not forbidden: a unit
66
+ may add one, and if it does the choice belongs in .sws/manifest.yml rather
67
+ than in an argument.
68
+ - label: Copyright
69
+ href: https://uit.stanford.edu/security/copyright-infringement
70
+ title: Report alleged copyright infringement
71
+ - label: Trademarks
72
+ href: https://adminguide.stanford.edu/chapter-1/subchapter-5/policy-1-5-4
73
+ title: Ownership and use of Stanford trademarks and images
74
+ note: >
75
+ CORRECTION: an earlier draft of this project used trademarks.stanford.edu.
76
+ The canonical target is Admin Guide policy 1.5.4.
77
+ - label: Non-Discrimination
78
+ href: https://studentservices.stanford.edu/more-resources/student-policies/non-academic/non-discrimination
79
+ title: Non-discrimination policy
80
+ note: >
81
+ CORRECTION: an earlier draft used equity.stanford.edu. The canonical
82
+ target is Student Services.
83
+ - label: Accessibility
84
+ href: https://www.stanford.edu/site/accessibility
85
+ title: Report web accessibility issues
86
+ note: >
87
+ Satisfies the MinWeb barrier-reporting requirement. Required on every
88
+ public-facing Stanford site.
89
+
90
+ copyright:
91
+ # Two spans upstream. Both lines are part of the fragment.
92
+ lines:
93
+ - "© Stanford University."
94
+ - "Stanford, California 94305."
95
+
96
+ # ------------------------------------------------------------------ the check
97
+ check:
98
+ severity: warn # advisory, like everything except secrets
99
+ weight: 5
100
+ assertions:
101
+ - id: footer.element
102
+ requires: A <footer> element is present on every rendered page.
103
+ - id: footer.nav-label
104
+ requires: 'The footer contains <nav aria-label="global footer menu">.'
105
+ - id: footer.link-set
106
+ requires: >
107
+ All ten links are present with exact labels and exact hrefs, in the
108
+ order given, grouped as 4 then 6.
109
+ mechanism: >
110
+ Parse the DOM. Compare label text and href per list. Report each
111
+ mismatch individually rather than as one failure, because "the footer
112
+ is wrong" is not actionable and "Trademarks points at the wrong URL"
113
+ is.
114
+ - id: footer.no-additions
115
+ requires: >
116
+ No links other than these ten appear inside the Global Footer.
117
+ mechanism: >
118
+ Unit links belong in a local footer ABOVE the global footer. When this
119
+ fails, say that, and say where the links should move to.
120
+ - id: footer.copyright
121
+ requires: Both copyright lines are present.
122
+
123
+ # ----------------------------------------------------------------- known gaps
124
+ open_questions:
125
+ - >
126
+ The upstream component appends an <SrOnlyText /> element to every link with
127
+ no props. Purpose unconfirmed: likely external-link or "opens in new
128
+ window" screen-reader text. Confirm with SWS before reproducing or omitting
129
+ it, since it is an accessibility affordance and guessing either way is bad.
130
+ - >
131
+ The FlexBox wrapper carries title="Common Stanford resources" on a div.
132
+ A `title` on a non-interactive element is not reliably announced by screen
133
+ readers. Worth raising with the Decanter team rather than propagating.
134
+ - >
135
+ Classes in the reference HTML are Decanter 7 era (basefont-20, rs-py-1,
136
+ type-3, list-unstyled, hocus:*). Verify against Decanter 8 before shipping.
137
+ The CONTENT contract above is version-independent; the classes are not.
@@ -0,0 +1,180 @@
1
+ # Stanford Identity Bar: the normative markup contract
2
+ #
3
+ # Source of truth: Decanter 8 beta examples
4
+ # https://deploy-preview-162--decanter.netlify.app/examples/identity-bar/
5
+ # Extracted: 2026-09-02
6
+ #
7
+ # ==============================================================================
8
+ # THIS FILE IS THE CHECK. `sws check` reads it directly.
9
+ #
10
+ # The Identity Bar is brand furniture, not a design opportunity. Its height and
11
+ # its logo size are fixed, because it appears on every Stanford site and an
12
+ # inconsistent one is immediately visible when two sites sit side by side.
13
+ #
14
+ # The classes below are the contract. They are not a suggestion about how to get
15
+ # a similar result: `pt-5 pb-1` is a five-pixel top and one-pixel bottom padding
16
+ # on Decanter's scale, and anything else produces a bar of the wrong height.
17
+ #
18
+ # Do not edit this file to make a project pass. Edit it only when the upstream
19
+ # example changes, and record the date.
20
+ # ==============================================================================
21
+
22
+ version: 1
23
+ extracted: 2026-09-02
24
+ upstream:
25
+ site: Decanter 8 beta documentation
26
+ path: /examples/identity-bar/
27
+
28
+ # ------------------------------------------------------------------- markup
29
+ # Reproduced verbatim from the upstream example, including the sr-only suffix,
30
+ # which exists because the link leaves the current site.
31
+ markup: |
32
+ <div class="bg-cardinal-red px-20 pt-5 pb-1 sm:px-30 md:px-50 lg:px-30">
33
+ <a class="logo inline-block text-20 leading-none text-white no-underline hocus:text-white hocus:underline" href="https://www.stanford.edu">Stanford University<span class="sr-only"> (link is external)</span></a>
34
+ </div>
35
+
36
+ container:
37
+ element: div
38
+ # Every class, in the upstream order. The vertical padding is the part people
39
+ # get wrong, and it is the part that decides the height.
40
+ classes:
41
+ - bg-cardinal-red
42
+ - px-20
43
+ - pt-5
44
+ - pb-1
45
+ - sm:px-30
46
+ - md:px-50
47
+ - lg:px-30
48
+ # Classes that indicate someone has re-sized the bar. Any of these on the
49
+ # container means the height is no longer the Stanford height.
50
+ disallowed_class_patterns:
51
+ - '^py-' # symmetric vertical padding is never correct here
52
+ - '^pt-(?!5$)' # any top padding other than pt-5
53
+ - '^pb-(?!1$)' # any bottom padding other than pb-1
54
+ - '^h-' # a fixed height
55
+ - '^min-h-'
56
+ - '^max-h-'
57
+
58
+ link:
59
+ href: https://www.stanford.edu
60
+ text: Stanford University
61
+ # `logo` is a Decanter component class, not a utility. It applies
62
+ # --font-stanford with discretionary ligatures, and it forces cardinal red on
63
+ # hover and focus -- which is why `text-white hocus:text-white` is needed to
64
+ # override it inside the red bar.
65
+ #
66
+ # NOT font-serif. That renders in Source Serif 4 and loses the ligatures, and
67
+ # it is the substitution this project shipped before being corrected.
68
+ classes:
69
+ - logo
70
+ - inline-block
71
+ - text-20
72
+ - leading-none
73
+ - text-white
74
+ - no-underline
75
+ - 'hocus:text-white'
76
+ - 'hocus:underline'
77
+ disallowed_class_patterns:
78
+ - '^font-serif$' # wrong mechanism; use .logo
79
+ - '^font-sans$'
80
+ # Numeric text sizes only. An earlier version of this pattern was
81
+ # `^text-(?!20$)`, which also matched `text-white` -- a COLOUR, and a
82
+ # required one -- so the check failed the very markup this file mandates.
83
+ - '^text-(?!20$)\d+$' # any numeric size other than text-20
84
+ - '^(sm|md|lg|xl|2xl):text-\d+$' # and no responsive size overrides
85
+ - '^leading-(?!none$)'
86
+ sr_only_suffix: ' (link is external)'
87
+
88
+ # Derived, not authored. Measured in Chromium at 1280x720 against the markup
89
+ # above with Decanter 8.0.0-beta.0, recorded so a change in height is visible in
90
+ # a diff rather than only in someone's eye.
91
+ measured:
92
+ browser: Chromium 151
93
+ date: 2026-09-02
94
+ with_stanford_font_loaded: true
95
+ bar_height_px: 30.8 # at 1280x720
96
+ bar_height_range_px: [30.1, 30.8] # 375, 640, 1024, 1280, 1600
97
+ padding_top_px: 5
98
+ padding_bottom_px: 1
99
+ logo_font_size_px: 20
100
+ logo_line_height_px: 20
101
+ note: >
102
+ Two corrections are recorded here rather than quietly overwritten. An early
103
+ draft asserted 26px before anyone measured. The first real measurement gave
104
+ 28.8px -- but that was with the Stanford family ABSENT, so the line box came
105
+ from the Source Serif 4 fallback. With the ligature font actually loaded the
106
+ bar is 30.8px, and the spread across viewports tightens from 1.4px to 0.7px.
107
+ 30.8px is the Stanford height. A `py-12` container measures about 44px, which
108
+ is the error this fragment exists to stop repeating.
109
+ why_the_check_is_class_based: >
110
+ Even correct, the height still drifts 0.7px across viewports. A pixel
111
+ assertion would be flaky and a flaky brand check gets switched off. The
112
+ classes are exact and deterministic, and on Decanter's scale they can only
113
+ produce the Stanford height -- provided the font is loaded, which is checked
114
+ separately.
115
+
116
+ # ------------------------------------------------------------------- font
117
+ # REQUIRED wherever this bar appears. Not optional, and not something to skip
118
+ # because upstream's own docs site happens to omit it.
119
+ #
120
+ # Decanter's --font-stanford is
121
+ # `Stanford, "Source Serif 4", Georgia, Times, "Times New Roman", serif`, and
122
+ # Decanter 8 publishes no font assets: static/fonts/stanford.woff2 exists in its
123
+ # repository but is not in the npm package. So a project that does nothing gets
124
+ # the Source Serif 4 fallback, and the wordmark renders in the wrong typeface --
125
+ # a brand defect that looks like a rendering quirk rather than a mistake.
126
+ font:
127
+ family: Stanford
128
+ required: true
129
+ weight: 300
130
+ # Verified 2026-09-02: both HTTP 200 with valid magic bytes. woff2 is 3,816
131
+ # bytes and woff is 7,552, so woff2 goes first. Decanter v7's own fonts.css
132
+ # lists only woff and ttf; the woff2 exists and is half the size.
133
+ sources:
134
+ - url: https://www-media.stanford.edu/assets/fonts/stanford.woff2
135
+ format: woff2
136
+ bytes: 3816
137
+ - url: https://www-media.stanford.edu/assets/fonts/stanford.woff
138
+ format: woff
139
+ bytes: 7552
140
+ origin: University Communications media CDN, the same origin Decanter v7 uses
141
+ css: |
142
+ @font-face {
143
+ font-family: 'Stanford';
144
+ src:
145
+ url('https://www-media.stanford.edu/assets/fonts/stanford.woff2') format('woff2'),
146
+ url('https://www-media.stanford.edu/assets/fonts/stanford.woff') format('woff');
147
+ font-weight: 300;
148
+ font-display: swap;
149
+ }
150
+ also: >
151
+ Add `<link rel="preconnect" href="https://www-media.stanford.edu" crossorigin>`.
152
+ It is a separate origin and the Identity Bar is the first thing painted.
153
+ privacy_note: >
154
+ This is a third-party origin and `sws perf` will list it. It is a Stanford
155
+ origin serving one 3.8 KB font, so it is not a MinPriv concern, but it is
156
+ worth knowing it appears in that list rather than being surprised by it.
157
+ measured_effect: >
158
+ With the font loaded the bar is 30.8px; without it, 28.8px. So the font is
159
+ not only a typeface question -- omitting it changes the bar's height.
160
+
161
+ # --------------------------------------------------------------------- notes
162
+ placement:
163
+ rule: >
164
+ Nothing may appear above the Identity Bar except a skip navigation link.
165
+ Checked separately by brand.identity-bar.nothing-above, which tests DOM
166
+ position rather than string order.
167
+ full_width: >
168
+ The padding sits directly on the red container. Do NOT wrap the link in a
169
+ centred max-width container: upstream does not, and doing so changes where
170
+ the logo sits relative to every other Stanford site.
171
+
172
+ fonts_correction: >
173
+ An earlier version of this file said "do not add a font file to fix it",
174
+ reasoning that the Decanter documentation site itself loads only Google Fonts
175
+ and therefore renders the fallback too. That was wrong, and wrong in a
176
+ characteristic way: it took current practice on one site as intent. The
177
+ wordmark is the Stanford wordmark, the ligature font is what makes it that,
178
+ and Decanter v7 shipped a fonts.css that loaded it from exactly the CDN named
179
+ above. See standards/patterns/sws-conventions.md on inferring intent from
180
+ presence.