@se-studio/site-check 2.17.0 → 2.20.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 (136) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/README.md +7 -0
  3. package/dist/site-type-audit/adapter.d.ts +17 -0
  4. package/dist/site-type-audit/adapter.d.ts.map +1 -0
  5. package/dist/site-type-audit/adapter.js +2 -0
  6. package/dist/site-type-audit/adapter.js.map +1 -0
  7. package/dist/site-type-audit/checks.d.ts +24 -0
  8. package/dist/site-type-audit/checks.d.ts.map +1 -0
  9. package/dist/site-type-audit/checks.js +730 -0
  10. package/dist/site-type-audit/checks.js.map +1 -0
  11. package/dist/site-type-audit/cli.d.ts +3 -0
  12. package/dist/site-type-audit/cli.d.ts.map +1 -0
  13. package/dist/site-type-audit/cli.js +84 -0
  14. package/dist/site-type-audit/cli.js.map +1 -0
  15. package/dist/site-type-audit/config.d.ts +5 -0
  16. package/dist/site-type-audit/config.d.ts.map +1 -0
  17. package/dist/site-type-audit/config.js +55 -0
  18. package/dist/site-type-audit/config.js.map +1 -0
  19. package/dist/site-type-audit/crawl.d.ts +40 -0
  20. package/dist/site-type-audit/crawl.d.ts.map +1 -0
  21. package/dist/site-type-audit/crawl.js +290 -0
  22. package/dist/site-type-audit/crawl.js.map +1 -0
  23. package/dist/site-type-audit/dead-links.d.ts +5 -0
  24. package/dist/site-type-audit/dead-links.d.ts.map +1 -0
  25. package/dist/site-type-audit/dead-links.js +35 -0
  26. package/dist/site-type-audit/dead-links.js.map +1 -0
  27. package/dist/site-type-audit/dom.d.ts +23 -0
  28. package/dist/site-type-audit/dom.d.ts.map +1 -0
  29. package/dist/site-type-audit/dom.js +155 -0
  30. package/dist/site-type-audit/dom.js.map +1 -0
  31. package/dist/site-type-audit/fetcher.d.ts +20 -0
  32. package/dist/site-type-audit/fetcher.d.ts.map +1 -0
  33. package/dist/site-type-audit/fetcher.js +81 -0
  34. package/dist/site-type-audit/fetcher.js.map +1 -0
  35. package/dist/site-type-audit/handoff.d.ts +19 -0
  36. package/dist/site-type-audit/handoff.d.ts.map +1 -0
  37. package/dist/site-type-audit/handoff.js +168 -0
  38. package/dist/site-type-audit/handoff.js.map +1 -0
  39. package/dist/site-type-audit/html-adapter.d.ts +18 -0
  40. package/dist/site-type-audit/html-adapter.d.ts.map +1 -0
  41. package/dist/site-type-audit/html-adapter.js +418 -0
  42. package/dist/site-type-audit/html-adapter.js.map +1 -0
  43. package/dist/site-type-audit/index.d.ts +15 -0
  44. package/dist/site-type-audit/index.d.ts.map +1 -0
  45. package/dist/site-type-audit/index.js +13 -0
  46. package/dist/site-type-audit/index.js.map +1 -0
  47. package/dist/site-type-audit/report.d.ts +6 -0
  48. package/dist/site-type-audit/report.d.ts.map +1 -0
  49. package/dist/site-type-audit/report.js +132 -0
  50. package/dist/site-type-audit/report.js.map +1 -0
  51. package/dist/site-type-audit/roles.d.ts +13 -0
  52. package/dist/site-type-audit/roles.d.ts.map +1 -0
  53. package/dist/site-type-audit/roles.js +135 -0
  54. package/dist/site-type-audit/roles.js.map +1 -0
  55. package/dist/site-type-audit/runner.d.ts +11 -0
  56. package/dist/site-type-audit/runner.d.ts.map +1 -0
  57. package/dist/site-type-audit/runner.js +113 -0
  58. package/dist/site-type-audit/runner.js.map +1 -0
  59. package/dist/site-type-audit/score.d.ts +24 -0
  60. package/dist/site-type-audit/score.d.ts.map +1 -0
  61. package/dist/site-type-audit/score.js +239 -0
  62. package/dist/site-type-audit/score.js.map +1 -0
  63. package/dist/site-type-audit/site-checks.d.ts +19 -0
  64. package/dist/site-type-audit/site-checks.d.ts.map +1 -0
  65. package/dist/site-type-audit/site-checks.js +192 -0
  66. package/dist/site-type-audit/site-checks.js.map +1 -0
  67. package/dist/site-type-audit/types.d.ts +248 -0
  68. package/dist/site-type-audit/types.d.ts.map +1 -0
  69. package/dist/site-type-audit/types.js +20 -0
  70. package/dist/site-type-audit/types.js.map +1 -0
  71. package/dist/smoke-test/cms-page-checks.d.ts.map +1 -1
  72. package/dist/smoke-test/cms-page-checks.js +1 -0
  73. package/dist/smoke-test/cms-page-checks.js.map +1 -1
  74. package/dist/smoke-test/config.d.ts.map +1 -1
  75. package/dist/smoke-test/config.js +106 -0
  76. package/dist/smoke-test/config.js.map +1 -1
  77. package/dist/smoke-test/content-assert.d.ts +14 -1
  78. package/dist/smoke-test/content-assert.d.ts.map +1 -1
  79. package/dist/smoke-test/content-assert.js +29 -5
  80. package/dist/smoke-test/content-assert.js.map +1 -1
  81. package/dist/smoke-test/dead-links.d.ts +58 -0
  82. package/dist/smoke-test/dead-links.d.ts.map +1 -0
  83. package/dist/smoke-test/dead-links.js +180 -0
  84. package/dist/smoke-test/dead-links.js.map +1 -0
  85. package/dist/smoke-test/environment.d.ts +19 -0
  86. package/dist/smoke-test/environment.d.ts.map +1 -0
  87. package/dist/smoke-test/environment.js +55 -0
  88. package/dist/smoke-test/environment.js.map +1 -0
  89. package/dist/smoke-test/index.d.ts +7 -2
  90. package/dist/smoke-test/index.d.ts.map +1 -1
  91. package/dist/smoke-test/index.js +4 -1
  92. package/dist/smoke-test/index.js.map +1 -1
  93. package/dist/smoke-test/runner.d.ts.map +1 -1
  94. package/dist/smoke-test/runner.js +90 -18
  95. package/dist/smoke-test/runner.js.map +1 -1
  96. package/dist/smoke-test/smoke-coverage/classify.d.ts +10 -0
  97. package/dist/smoke-test/smoke-coverage/classify.d.ts.map +1 -0
  98. package/dist/smoke-test/smoke-coverage/classify.js +90 -0
  99. package/dist/smoke-test/smoke-coverage/classify.js.map +1 -0
  100. package/dist/smoke-test/smoke-coverage/evaluate.d.ts +29 -0
  101. package/dist/smoke-test/smoke-coverage/evaluate.d.ts.map +1 -0
  102. package/dist/smoke-test/smoke-coverage/evaluate.js +270 -0
  103. package/dist/smoke-test/smoke-coverage/evaluate.js.map +1 -0
  104. package/dist/smoke-test/smoke-coverage/index.d.ts +8 -0
  105. package/dist/smoke-test/smoke-coverage/index.d.ts.map +1 -0
  106. package/dist/smoke-test/smoke-coverage/index.js +7 -0
  107. package/dist/smoke-test/smoke-coverage/index.js.map +1 -0
  108. package/dist/smoke-test/smoke-coverage/model.d.ts +20 -0
  109. package/dist/smoke-test/smoke-coverage/model.d.ts.map +1 -0
  110. package/dist/smoke-test/smoke-coverage/model.js +114 -0
  111. package/dist/smoke-test/smoke-coverage/model.js.map +1 -0
  112. package/dist/smoke-test/smoke-coverage/run.d.ts +19 -0
  113. package/dist/smoke-test/smoke-coverage/run.d.ts.map +1 -0
  114. package/dist/smoke-test/smoke-coverage/run.js +123 -0
  115. package/dist/smoke-test/smoke-coverage/run.js.map +1 -0
  116. package/dist/smoke-test/smoke-coverage/sitemap.d.ts +34 -0
  117. package/dist/smoke-test/smoke-coverage/sitemap.d.ts.map +1 -0
  118. package/dist/smoke-test/smoke-coverage/sitemap.js +148 -0
  119. package/dist/smoke-test/smoke-coverage/sitemap.js.map +1 -0
  120. package/dist/smoke-test/smoke-coverage/types.d.ts +74 -0
  121. package/dist/smoke-test/smoke-coverage/types.d.ts.map +1 -0
  122. package/dist/smoke-test/smoke-coverage/types.js +13 -0
  123. package/dist/smoke-test/smoke-coverage/types.js.map +1 -0
  124. package/dist/smoke-test/static.d.ts.map +1 -1
  125. package/dist/smoke-test/static.js +69 -6
  126. package/dist/smoke-test/static.js.map +1 -1
  127. package/dist/smoke-test/types.d.ts +23 -6
  128. package/dist/smoke-test/types.d.ts.map +1 -1
  129. package/dist/smoke-test/types.js.map +1 -1
  130. package/docs/llms.md +1 -0
  131. package/docs/site-type-audit-checklists.md +200 -0
  132. package/docs/site-type-audit.md +117 -0
  133. package/docs/smoke-assertions.md +72 -0
  134. package/docs/smoke-coverage.md +92 -0
  135. package/package.json +11 -3
  136. package/smoke-coverage-dry-run.mjs +61 -0
@@ -0,0 +1,730 @@
1
+ const pass = (message, evidence) => ({
2
+ status: 'pass',
3
+ message,
4
+ evidence,
5
+ });
6
+ const fail = (message, evidence) => ({
7
+ status: 'fail',
8
+ message,
9
+ evidence,
10
+ });
11
+ const unverified = (message, evidence) => ({
12
+ status: 'unverified',
13
+ message,
14
+ evidence,
15
+ });
16
+ const ok = (cond, passMsg, failMsg, evidence) => cond ? pass(passMsg, evidence) : fail(failMsg, evidence);
17
+ const ANALYTICS_KINDS = new Set(['consent-manager']);
18
+ export const analyticsTrackers = (m) => m.trackers.filter((t) => !ANALYTICS_KINDS.has(t.kind));
19
+ export const consentGated = (m) => analyticsTrackers(m).length === 0 && m.trackers.some((t) => t.kind === 'consent-manager');
20
+ function analytics(m, passMsg, failMsg, evidence) {
21
+ if (analyticsTrackers(m).length > 0)
22
+ return pass(passMsg, evidence);
23
+ if (consentGated(m))
24
+ return unverified('A consent manager is present and no analytics tag is in the HTML: tags probably load after consent, which a read-only fetch cannot see.');
25
+ return fail(failMsg, evidence);
26
+ }
27
+ const primaryCtas = (m) => m.ctas.filter((c) => c.strength === 'primary');
28
+ const topPrimary = (m) => primaryCtas(m).filter((c) => c.aboveFold);
29
+ const h1s = (m) => m.headings.filter((h) => h.level === 1);
30
+ const ROLE_WORDS = /\b(ceo|cto|cfo|coo|founder|co-founder|director|partner|head of|vp|vice president|chief|manager|engineer|analyst|officer|lead|advisor|adviser|president|principal|associate|designer|strategist|producer|developer|consultant|md|managing)\b/gi;
31
+ const hasRoleWord = (t) => (t.match(ROLE_WORDS) ?? []).length > 0;
32
+ const real = (m) => m.forms.filter((f) => f.fields.length >= 2);
33
+ const hasForm = (m) => real(m).length > 0 || m.formEmbeds.length > 0;
34
+ const linkMatches = (m, re) => m.links.filter((l) => l.internal && (re.test(l.text) || re.test(safePath(l.href))));
35
+ function safePath(href) {
36
+ try {
37
+ return new URL(href).pathname;
38
+ }
39
+ catch {
40
+ return href;
41
+ }
42
+ }
43
+ const names = (xs, n = 3) => xs
44
+ .slice(0, n)
45
+ .map((x) => x.label ?? x.text ?? '')
46
+ .join(' | ');
47
+ export const CHECKS = [
48
+ {
49
+ id: 'base.status-ok',
50
+ roles: 'all',
51
+ except: ['not-found'],
52
+ description: 'Page loads with HTTP 200 after redirects.',
53
+ severity: { credibility: 'critical', funnel: 'critical' },
54
+ run: (m) => ok(m.status === 200, 'Loads with HTTP 200.', `HTTP ${m.status}.`),
55
+ },
56
+ {
57
+ id: 'base.rendered-content',
58
+ roles: 'all',
59
+ except: ['not-found', 'thank-you'],
60
+ description: 'The delivered HTML contains real content (not an empty shell filled in by JavaScript).',
61
+ severity: { credibility: 'major', funnel: 'major' },
62
+ run: (m) => ok(!m.renderedShell, 'Content is in the delivered HTML.', 'Almost no content in the delivered HTML; the page is filled in by JavaScript, so crawlers and this audit see an empty shell. Role checks are skipped.'),
63
+ },
64
+ {
65
+ id: 'base.title',
66
+ roles: 'all',
67
+ description: 'Has a <title> of 10-70 characters.',
68
+ severity: { credibility: 'minor', funnel: 'minor' },
69
+ run: (m) => ok(m.title.length >= 10 && m.title.length <= 70, 'Title length is fine.', m.title ? 'Title length is outside 10-70 characters.' : 'No <title>.', m.title),
70
+ },
71
+ {
72
+ id: 'base.h1',
73
+ roles: 'all',
74
+ except: ['not-found'],
75
+ description: 'Exactly one <h1>.',
76
+ severity: { credibility: 'minor', funnel: 'minor' },
77
+ run: (m) => ok(h1s(m).length === 1, 'One h1.', `${h1s(m).length} h1 elements.`, h1s(m)[0]?.text),
78
+ },
79
+ {
80
+ id: 'base.meta-description',
81
+ roles: 'all',
82
+ except: ['not-found', 'thank-you'],
83
+ description: 'Has a meta description.',
84
+ severity: { credibility: 'minor', funnel: 'minor' },
85
+ run: (m) => ok(m.metaDescription.trim().length >= 30, 'Meta description present.', 'Meta description missing or very short.'),
86
+ },
87
+ {
88
+ id: 'base.indexable',
89
+ roles: 'all',
90
+ except: ['not-found', 'thank-you'],
91
+ description: 'Page is not set to noindex.',
92
+ severity: { credibility: 'major', funnel: 'major' },
93
+ run: (m) => ok(!m.noindex, 'Indexable.', 'Page is noindex.'),
94
+ },
95
+ {
96
+ id: 'base.chrome',
97
+ roles: 'all',
98
+ except: ['landing', 'thank-you', 'form'],
99
+ description: 'Has a header with navigation and a footer.',
100
+ severity: { credibility: 'major', funnel: 'minor' },
101
+ run: (m) => ok(m.landmarks.header && m.landmarks.nav && m.landmarks.footer, 'Header, nav and footer present.', `Missing: ${['header', 'nav', 'footer'].filter((k) => !m.landmarks[k]).join(', ')}.`),
102
+ },
103
+ {
104
+ id: 'base.alt-text',
105
+ roles: 'all',
106
+ except: ['not-found'],
107
+ description: 'At most 10% of images lack alt text.',
108
+ severity: { credibility: 'minor', funnel: 'minor' },
109
+ run: (m) => ok(m.images.total === 0 || m.images.missingAlt / m.images.total <= 0.1, 'Images have alt text.', `${m.images.missingAlt} of ${m.images.total} images have no alt attribute.`),
110
+ },
111
+ {
112
+ id: 'home.value-prop',
113
+ roles: ['home'],
114
+ description: 'Has an h1 and enough copy to say what the organisation does.',
115
+ severity: { credibility: 'major', funnel: 'major' },
116
+ run: (m) => ok(h1s(m).length > 0 && m.mainWordCount >= 40, 'h1 and supporting copy present.', h1s(m).length ? 'Very little copy on the page.' : 'No h1.', h1s(m)[0]?.text),
117
+ },
118
+ {
119
+ id: 'home.cta-above-fold',
120
+ roles: ['home'],
121
+ description: 'A clear primary call to action sits above the fold.',
122
+ severity: { credibility: 'minor', funnel: 'critical' },
123
+ run: (m) => ok(topPrimary(m).length > 0, 'Primary CTA above the fold.', 'No primary call to action above the fold.', names(topPrimary(m))),
124
+ },
125
+ {
126
+ id: 'home.cta-repeated',
127
+ roles: ['home'],
128
+ description: 'The call to action is repeated further down the page or in the footer.',
129
+ severity: { credibility: 'na', funnel: 'major' },
130
+ run: (m) => {
131
+ const lower = primaryCtas(m).filter((c) => !c.aboveFold);
132
+ return ok(lower.length > 0 && topPrimary(m).length > 0, 'CTA repeated below the fold.', 'CTA is not repeated below the fold.', `${topPrimary(m).length} above, ${lower.length} below`);
133
+ },
134
+ },
135
+ {
136
+ id: 'home.contact-path',
137
+ roles: ['home'],
138
+ description: 'A route to contact is visible (contact link, email, phone or form).',
139
+ severity: { credibility: 'major', funnel: 'major' },
140
+ run: (m) => ok(linkMatches(m, /contact|get in touch|talk to|enquir/i).length > 0 ||
141
+ m.contacts.emails.length > 0 ||
142
+ m.contacts.phones.length > 0 ||
143
+ hasForm(m), 'Contact route present.', 'No contact link, email, phone or form found.'),
144
+ },
145
+ {
146
+ id: 'home.proof',
147
+ roles: ['home'],
148
+ description: 'Shows proof behind its claims: customers/partners, testimonials, numbers, certifications or case studies.',
149
+ severity: { credibility: 'major', funnel: 'major' },
150
+ run: (m) => {
151
+ const e = m.evidence;
152
+ const found = ['customerOrPartner', 'testimonial', 'stats', 'certification', 'caseStudy'].filter((k) => e[k]);
153
+ return ok(found.length > 0, 'Proof signals present.', 'No customers, testimonials, numbers, certifications or case studies found.', found.join(', '));
154
+ },
155
+ },
156
+ {
157
+ id: 'home.trust-near-cta',
158
+ roles: ['home'],
159
+ description: 'Trust wording (customers, rating, security, guarantee) sits near the above-the-fold call to action.',
160
+ severity: { credibility: 'na', funnel: 'major' },
161
+ run: (m) => topPrimary(m).length === 0
162
+ ? unverified('No above-the-fold CTA to measure against.')
163
+ : ok(m.trustNearCta, 'Trust signal near the CTA.', 'No trust wording near the above-the-fold CTA.'),
164
+ },
165
+ {
166
+ id: 'home.who-we-are',
167
+ roles: ['home'],
168
+ description: 'Links to an about/company/team page.',
169
+ severity: { credibility: 'major', funnel: 'minor' },
170
+ run: (m) => ok(linkMatches(m, /\babout\b|company|our team|\bteam\b|leadership|who we are|our story/i)
171
+ .length > 0, 'About/team link present.', 'No link to an about, company or team page.'),
172
+ },
173
+ {
174
+ id: 'home.legal-links',
175
+ roles: ['home'],
176
+ description: 'Footer links to the privacy policy.',
177
+ severity: { credibility: 'minor', funnel: 'major' },
178
+ run: (m) => ok(m.links.some((l) => l.region === 'footer' && /privacy/i.test(`${l.text} ${l.href}`)), 'Privacy link in footer.', 'No privacy link in the footer.'),
179
+ },
180
+ {
181
+ id: 'home.analytics',
182
+ roles: ['home'],
183
+ description: 'Analytics or tag manager is present.',
184
+ severity: { credibility: 'minor', funnel: 'major' },
185
+ run: (m) => analytics(m, 'Analytics present.', 'No analytics or tag manager detected in the page.', analyticsTrackers(m)
186
+ .map((t) => t.kind)
187
+ .join(', ')),
188
+ },
189
+ {
190
+ id: 'home.org-schema',
191
+ roles: ['home'],
192
+ description: 'Organization (or WebSite) structured data present.',
193
+ severity: { credibility: 'minor', funnel: 'info' },
194
+ run: (m) => ok(m.structuredDataTypes.some((t) => /Organization|WebSite|Corporation|LocalBusiness/i.test(t)), 'Organization structured data present.', 'No Organization/WebSite structured data.'),
195
+ },
196
+ {
197
+ id: 'privacy.substance',
198
+ roles: ['privacy'],
199
+ description: 'Privacy policy has real content (300+ words).',
200
+ severity: { credibility: 'major', funnel: 'major' },
201
+ run: (m) => ok(m.mainWordCount >= 300, 'Substantive.', `Only ${m.mainWordCount} words.`),
202
+ },
203
+ {
204
+ id: 'privacy.contact-detail',
205
+ roles: ['privacy'],
206
+ description: 'Says how to contact the organisation about data.',
207
+ severity: { credibility: 'minor', funnel: 'minor' },
208
+ run: (m) => ok(/@|contact us|data protection officer|privacy@|email us|write to/i.test(m.mainText), 'Contact detail present.', 'No contact route for privacy questions.'),
209
+ },
210
+ {
211
+ id: 'terms.substance',
212
+ roles: ['terms'],
213
+ description: 'Terms/cookies page has real content (150+ words).',
214
+ severity: { credibility: 'minor', funnel: 'minor' },
215
+ run: (m) => ok(m.mainWordCount >= 150, 'Substantive.', `Only ${m.mainWordCount} words.`),
216
+ },
217
+ {
218
+ id: 'contact.method',
219
+ roles: ['contact'],
220
+ description: 'Gives at least one way to reach the organisation (email, phone, address, form).',
221
+ severity: { credibility: 'critical', funnel: 'major' },
222
+ run: (m) => {
223
+ const parts = [
224
+ m.contacts.emails.length ? 'email' : '',
225
+ m.contacts.phones.length ? 'phone' : '',
226
+ m.contacts.hasAddress ? 'address' : '',
227
+ hasForm(m) ? 'form' : '',
228
+ ].filter(Boolean);
229
+ return ok(parts.length > 0, 'Contact method present.', 'No email, phone, address or form.', parts.join(', '));
230
+ },
231
+ },
232
+ {
233
+ id: 'contact.org-details',
234
+ roles: ['contact'],
235
+ description: 'Shows organisation details: an address, or both phone and email.',
236
+ severity: { credibility: 'major', funnel: 'minor' },
237
+ run: (m) => ok(m.contacts.hasAddress || (m.contacts.phones.length > 0 && m.contacts.emails.length > 0), 'Organisation details present.', 'No address, and not both phone and email.'),
238
+ },
239
+ {
240
+ id: 'contact.form-works',
241
+ roles: ['contact'],
242
+ description: 'Contact form (if any) has labelled fields, a submit control and a real handler.',
243
+ severity: { credibility: 'major', funnel: 'critical' },
244
+ run: (m) => formWorks(m, true),
245
+ },
246
+ {
247
+ id: 'contact.consent-near-form',
248
+ roles: ['contact'],
249
+ description: 'Privacy/consent wording sits next to the form.',
250
+ severity: { credibility: 'minor', funnel: 'major' },
251
+ run: (m) => real(m).length === 0
252
+ ? { status: 'na', message: 'No form.' }
253
+ : ok(real(m).some((f) => f.consentNear), 'Consent wording near form.', 'No privacy/consent wording near the form.'),
254
+ },
255
+ {
256
+ id: 'contact.analytics',
257
+ roles: ['contact'],
258
+ description: 'Analytics present on the contact step.',
259
+ severity: { credibility: 'info', funnel: 'major' },
260
+ run: (m) => analytics(m, 'Analytics present.', 'No analytics detected on the contact page.'),
261
+ },
262
+ {
263
+ id: 'notfound.status-404',
264
+ roles: ['not-found'],
265
+ description: 'An unknown URL returns HTTP 404 (not a soft 404 with status 200).',
266
+ severity: { credibility: 'major', funnel: 'major' },
267
+ run: (m) => ok(m.status === 404, 'Returns 404.', `Unknown URL returned HTTP ${m.status}.`),
268
+ },
269
+ {
270
+ id: 'notfound.recovery',
271
+ roles: ['not-found'],
272
+ description: 'The 404 page offers a way back (home, contact or search link).',
273
+ severity: { credibility: 'minor', funnel: 'major' },
274
+ run: (m) => ok(m.links.some((l) => l.internal) || m.landmarks.nav, 'Has a way back.', 'No internal link or navigation.'),
275
+ },
276
+ {
277
+ id: 'notfound.branded',
278
+ roles: ['not-found'],
279
+ description: 'The 404 page keeps the site header and footer and says what happened.',
280
+ severity: { credibility: 'minor', funnel: 'minor' },
281
+ run: (m) => ok(m.landmarks.header &&
282
+ m.landmarks.footer &&
283
+ /not found|404|doesn.t exist|can.t find|couldn.t find|no longer/i.test(`${m.title} ${m.text}`), 'Branded 404.', 'Missing header/footer or a clear "not found" message.'),
284
+ },
285
+ {
286
+ id: 'about.substance',
287
+ roles: ['about'],
288
+ description: 'About page has real content (150+ words) with structure (2+ sub-headings).',
289
+ severity: { credibility: 'major', funnel: 'minor' },
290
+ run: (m) => ok(m.mainWordCount >= 150 && m.headings.filter((h) => h.level === 2).length >= 2, 'Substantive and structured.', `${m.mainWordCount} words, ${m.headings.filter((h) => h.level === 2).length} h2.`),
291
+ },
292
+ {
293
+ id: 'about.people-or-history',
294
+ roles: ['about'],
295
+ description: 'Names people or links to the team.',
296
+ severity: { credibility: 'major', funnel: 'minor' },
297
+ run: (m) => ok(m.evidence.teamMentions || linkMatches(m, /team|people|leadership|founder/i).length > 0, 'People/team referenced.', 'No team, founder or leadership reference.'),
298
+ },
299
+ {
300
+ id: 'about.next-step',
301
+ roles: ['about'],
302
+ description: 'Points to a next step (contact or enquiry).',
303
+ severity: { credibility: 'minor', funnel: 'minor' },
304
+ run: (m) => ok(linkMatches(m, /contact|get in touch|talk|enquir/i).length > 0 ||
305
+ m.ctas.some((c) => c.conversion), 'Next step present.', 'No contact or enquiry link on the about page.'),
306
+ },
307
+ {
308
+ id: 'team.members',
309
+ roles: ['team'],
310
+ description: 'Lists three or more people.',
311
+ severity: { credibility: 'major', funnel: 'minor' },
312
+ run: (m) => {
313
+ const n = m.headings.filter((h) => h.level >= 2 && h.level <= 4 && h.region === 'main').length;
314
+ return ok(n >= 3 || m.listItems >= 3, 'Several people listed.', 'Fewer than three people/cards found.', `${n} sub-headings, ${m.listItems} list items`);
315
+ },
316
+ },
317
+ {
318
+ id: 'team.roles',
319
+ roles: ['team'],
320
+ description: 'Gives each person a role or title.',
321
+ severity: { credibility: 'major', funnel: 'minor' },
322
+ run: (m) => ok((m.mainText.match(ROLE_WORDS) ?? []).length >= 3, 'Roles/titles present.', 'Few or no role titles found.'),
323
+ },
324
+ {
325
+ id: 'team.photos',
326
+ roles: ['team'],
327
+ description: 'Has photos of the team (3+ images).',
328
+ severity: { credibility: 'minor', funnel: 'minor' },
329
+ run: (m) => ok(m.images.total >= 3, 'Photos present.', `${m.images.total} images.`),
330
+ },
331
+ {
332
+ id: 'person.name',
333
+ roles: ['person'],
334
+ description: 'Has an h1 with the person’s name.',
335
+ severity: { credibility: 'major', funnel: 'minor' },
336
+ run: (m) => ok(h1s(m).length === 1 && h1s(m)[0].text.split(/\s+/).length >= 2, 'Named.', 'No two-word h1.', h1s(m)[0]?.text),
337
+ },
338
+ {
339
+ id: 'person.bio',
340
+ roles: ['person'],
341
+ description: 'Has a bio (60+ words).',
342
+ severity: { credibility: 'major', funnel: 'minor' },
343
+ run: (m) => ok(m.mainWordCount >= 60, 'Bio present.', `${m.mainWordCount} words.`),
344
+ },
345
+ {
346
+ id: 'person.role-and-photo',
347
+ roles: ['person'],
348
+ description: 'Shows a role/title and a photo.',
349
+ severity: { credibility: 'minor', funnel: 'minor' },
350
+ run: (m) => ok(hasRoleWord(m.mainText) && m.images.total >= 1, 'Role and photo present.', 'Missing a role title or a photo.'),
351
+ },
352
+ {
353
+ id: 'news.items',
354
+ roles: ['news'],
355
+ description: 'Lists three or more items.',
356
+ severity: { credibility: 'major', funnel: 'minor' },
357
+ run: (m) => ok(m.mainInternalLinks >= 3, 'Several items listed.', `${m.mainInternalLinks} internal links in the listing.`),
358
+ },
359
+ {
360
+ id: 'news.dates',
361
+ roles: ['news'],
362
+ description: 'Items are dated.',
363
+ severity: { credibility: 'minor', funnel: 'minor' },
364
+ run: (m) => ok(m.hasDate, 'Dates present.', 'No dates found.'),
365
+ },
366
+ {
367
+ id: 'post.substance',
368
+ roles: ['post'],
369
+ description: 'Post has real content (200+ words).',
370
+ severity: { credibility: 'major', funnel: 'minor' },
371
+ run: (m) => ok(m.mainWordCount >= 200, 'Substantive.', `${m.mainWordCount} words.`),
372
+ },
373
+ {
374
+ id: 'post.date',
375
+ roles: ['post'],
376
+ description: 'Post is dated.',
377
+ severity: { credibility: 'major', funnel: 'minor' },
378
+ run: (m) => ok(m.hasDate, 'Dated.', 'No publication date found.'),
379
+ },
380
+ {
381
+ id: 'post.author',
382
+ roles: ['post'],
383
+ description: 'Post names an author.',
384
+ severity: { credibility: 'major', funnel: 'minor' },
385
+ run: (m) => ok(m.hasAuthor, 'Author named.', 'No author found.'),
386
+ },
387
+ {
388
+ id: 'post.schema',
389
+ roles: ['post'],
390
+ description: 'Article structured data present.',
391
+ severity: { credibility: 'minor', funnel: 'minor' },
392
+ run: (m) => ok(m.structuredDataTypes.some((t) => /Article|BlogPosting|NewsArticle/i.test(t)), 'Article schema present.', 'No Article structured data.'),
393
+ },
394
+ {
395
+ id: 'post.next-step',
396
+ roles: ['post'],
397
+ description: 'Leads somewhere: a call to action or related links.',
398
+ severity: { credibility: 'minor', funnel: 'major' },
399
+ run: (m) => ok(m.ctas.some((c) => c.conversion && c.region !== 'nav') || m.mainInternalLinks >= 2, 'Next step present.', 'No call to action or related links.'),
400
+ },
401
+ {
402
+ id: 'landing.value-prop',
403
+ roles: ['landing'],
404
+ description: 'Has one h1 and supporting copy.',
405
+ severity: { credibility: 'minor', funnel: 'major' },
406
+ run: (m) => ok(h1s(m).length === 1 && m.mainWordCount >= 30, 'Headline and copy present.', 'Missing single h1 or supporting copy.', h1s(m)[0]?.text),
407
+ },
408
+ {
409
+ id: 'landing.cta-above-fold',
410
+ roles: ['landing'],
411
+ description: 'A clear primary call to action sits above the fold.',
412
+ severity: { credibility: 'minor', funnel: 'critical' },
413
+ run: (m) => ok(topPrimary(m).length > 0 || real(m).some((f) => f.aboveFold) || m.formEmbeds.length > 0, 'CTA or form above the fold.', 'No call to action above the fold.', names(topPrimary(m))),
414
+ },
415
+ {
416
+ id: 'landing.cta-repeated',
417
+ roles: ['landing'],
418
+ description: 'The call to action is repeated lower on the page.',
419
+ severity: { credibility: 'na', funnel: 'major' },
420
+ run: (m) => ok(primaryCtas(m).filter((c) => !c.aboveFold).length > 0, 'CTA repeated.', 'CTA is not repeated below the fold.'),
421
+ },
422
+ {
423
+ id: 'landing.has-destination',
424
+ roles: ['landing'],
425
+ description: 'Has a form, or a call to action that points at one.',
426
+ severity: { credibility: 'na', funnel: 'critical' },
427
+ run: (m) => ok(hasForm(m) || m.ctas.some((c) => c.conversion && c.region !== 'nav'), 'Conversion destination present.', 'No form and no conversion call to action.'),
428
+ },
429
+ {
430
+ id: 'landing.few-exits',
431
+ roles: ['landing'],
432
+ description: 'Few exits: 12 or fewer header/footer links.',
433
+ severity: { credibility: 'na', funnel: 'major' },
434
+ run: (m) => ok(m.exitLinks.headerFooter <= 12, 'Few exits.', `${m.exitLinks.headerFooter} header/footer links compete with the call to action.`),
435
+ },
436
+ {
437
+ id: 'landing.trust-near-cta',
438
+ roles: ['landing'],
439
+ description: 'Trust signals sit near the call to action.',
440
+ severity: { credibility: 'na', funnel: 'major' },
441
+ run: (m) => ok(m.trustNearCta, 'Trust signal near the CTA.', 'No trust wording near the above-the-fold CTA.'),
442
+ },
443
+ {
444
+ id: 'landing.analytics',
445
+ roles: ['landing'],
446
+ description: 'Analytics present on the landing page.',
447
+ severity: { credibility: 'na', funnel: 'major' },
448
+ run: (m) => analytics(m, 'Analytics present.', 'No analytics detected.'),
449
+ },
450
+ {
451
+ id: 'product.cta-above-fold',
452
+ roles: ['product'],
453
+ description: 'A primary call to action sits above the fold.',
454
+ severity: { credibility: 'minor', funnel: 'critical' },
455
+ run: (m) => ok(topPrimary(m).length > 0, 'CTA above the fold.', 'No call to action above the fold.', names(topPrimary(m))),
456
+ },
457
+ {
458
+ id: 'product.features',
459
+ roles: ['product'],
460
+ description: 'Explains the offer: 3+ features/benefits.',
461
+ severity: { credibility: 'minor', funnel: 'major' },
462
+ run: (m) => ok(m.listItems >= 3 ||
463
+ m.headings.filter((h) => h.level >= 2 && h.region === 'main').length >= 3, 'Offer explained.', 'Fewer than three features/benefits.'),
464
+ },
465
+ {
466
+ id: 'product.price-signal',
467
+ roles: ['product'],
468
+ description: 'Shows a price or links to pricing/plans.',
469
+ severity: { credibility: 'na', funnel: 'major' },
470
+ run: (m) => ok(m.priceMentions > 0 || linkMatches(m, /pricing|plans|cost|quote/i).length > 0, 'Price signal present.', 'No price and no link to pricing.'),
471
+ },
472
+ {
473
+ id: 'product.trust-near-cta',
474
+ roles: ['product'],
475
+ description: 'Trust signals sit near the call to action.',
476
+ severity: { credibility: 'na', funnel: 'major' },
477
+ run: (m) => ok(m.trustNearCta, 'Trust signal near the CTA.', 'No trust wording near the CTA.'),
478
+ },
479
+ {
480
+ id: 'product.analytics',
481
+ roles: ['product'],
482
+ description: 'Analytics present.',
483
+ severity: { credibility: 'na', funnel: 'major' },
484
+ run: (m) => analytics(m, 'Analytics present.', 'No analytics detected.'),
485
+ },
486
+ {
487
+ id: 'pricing.prices',
488
+ roles: ['pricing'],
489
+ description: 'States prices, or says how to get one.',
490
+ severity: { credibility: 'na', funnel: 'major' },
491
+ run: (m) => ok(m.priceMentions > 0 ||
492
+ /contact (us|sales)|custom pricing|request a quote|get a quote|talk to/i.test(m.mainText), 'Pricing stated.', 'No prices and no way to get a price.'),
493
+ },
494
+ {
495
+ id: 'pricing.plan-ctas',
496
+ roles: ['pricing'],
497
+ description: 'Each plan/option has a call to action.',
498
+ severity: { credibility: 'na', funnel: 'critical' },
499
+ run: (m) => ok(primaryCtas(m).filter((c) => c.region !== 'nav' && c.region !== 'header').length > 0, 'Plan CTA present.', 'No call to action on the pricing page.'),
500
+ },
501
+ {
502
+ id: 'pricing.comparison',
503
+ roles: ['pricing'],
504
+ description: 'Presents two or more options to compare.',
505
+ severity: { credibility: 'na', funnel: 'minor' },
506
+ run: (m) => ok(m.headings.filter((h) => h.level >= 2 && h.level <= 4 && h.region === 'main').length >= 2, 'Options presented.', 'Fewer than two options/headings.'),
507
+ },
508
+ {
509
+ id: 'pricing.faq',
510
+ roles: ['pricing'],
511
+ description: 'Answers objections (FAQ).',
512
+ severity: { credibility: 'na', funnel: 'minor' },
513
+ run: (m) => ok(/\bfaq\b|frequently asked|common questions/i.test(m.mainText) ||
514
+ m.headings.some((h) => /faq|questions/i.test(h.text)), 'FAQ present.', 'No FAQ found.'),
515
+ },
516
+ {
517
+ id: 'pricing.analytics',
518
+ roles: ['pricing'],
519
+ description: 'Analytics present.',
520
+ severity: { credibility: 'na', funnel: 'major' },
521
+ run: (m) => analytics(m, 'Analytics present.', 'No analytics detected.'),
522
+ },
523
+ {
524
+ id: 'location.nap',
525
+ roles: ['location'],
526
+ description: 'Shows address and/or phone.',
527
+ severity: { credibility: 'minor', funnel: 'major' },
528
+ run: (m) => ok(m.contacts.hasAddress || m.contacts.phones.length > 0, 'Address or phone present.', 'No address or phone.'),
529
+ },
530
+ {
531
+ id: 'location.cta',
532
+ roles: ['location'],
533
+ description: 'Has a call to action (book, contact, directions).',
534
+ severity: { credibility: 'minor', funnel: 'critical' },
535
+ run: (m) => ok(primaryCtas(m).filter((c) => c.region !== 'nav').length > 0 || hasForm(m), 'CTA present.', 'No call to action.'),
536
+ },
537
+ {
538
+ id: 'location.schema',
539
+ roles: ['location'],
540
+ description: 'LocalBusiness/Place structured data present.',
541
+ severity: { credibility: 'minor', funnel: 'minor' },
542
+ run: (m) => ok(m.structuredDataTypes.some((t) => /LocalBusiness|Place|Organization|MedicalBusiness|Store/i.test(t)), 'Local schema present.', 'No local structured data.'),
543
+ },
544
+ {
545
+ id: 'form.exists',
546
+ roles: ['form'],
547
+ description: 'The page has a working-looking form (2+ visible fields) or a hosted form embed.',
548
+ severity: { credibility: 'minor', funnel: 'critical' },
549
+ run: (m) => !hasForm(m) && primaryCtas(m).some((c) => c.conversion && c.region !== 'nav')
550
+ ? unverified('No form in the delivered HTML, but the page has conversion calls to action; the form may be JavaScript-rendered or on another page or domain.', names(primaryCtas(m)))
551
+ : ok(hasForm(m), 'Form present.', 'No form found.', `${real(m).length} forms, ${m.formEmbeds.length} embeds`),
552
+ },
553
+ {
554
+ id: 'form.labels',
555
+ roles: ['form'],
556
+ description: 'Every visible field has a label.',
557
+ severity: { credibility: 'minor', funnel: 'major' },
558
+ run: (m) => {
559
+ const f = real(m).flatMap((x) => x.fields);
560
+ if (f.length === 0)
561
+ return { status: 'na', message: 'No inline form (embed or none).' };
562
+ const bad = f.filter((x) => !x.labelled && !/^(hidden|checkbox|radio)$/.test(x.type));
563
+ return ok(bad.length === 0, 'All fields labelled.', `${bad.length} of ${f.length} fields have no label.`, bad
564
+ .slice(0, 4)
565
+ .map((x) => x.name || x.type)
566
+ .join(', '));
567
+ },
568
+ },
569
+ {
570
+ id: 'form.submit',
571
+ roles: ['form'],
572
+ description: 'The form has a submit control.',
573
+ severity: { credibility: 'minor', funnel: 'critical' },
574
+ run: (m) => {
575
+ if (real(m).length === 0)
576
+ return { status: 'na', message: 'No inline form (embed or none).' };
577
+ return ok(real(m).every((f) => f.hasSubmit), 'Submit control present.', 'A form has no submit button.');
578
+ },
579
+ },
580
+ {
581
+ id: 'form.handler',
582
+ roles: ['form'],
583
+ description: 'The form is wired to a handler (not mailto:/empty GET). Submission itself is never exercised.',
584
+ severity: { credibility: 'minor', funnel: 'major' },
585
+ run: (m) => formWorks(m, false),
586
+ },
587
+ {
588
+ id: 'form.length',
589
+ roles: ['form'],
590
+ description: 'Short form: 8 or fewer visible fields.',
591
+ severity: { credibility: 'na', funnel: 'minor' },
592
+ run: (m) => {
593
+ const max = Math.max(0, ...real(m).map((f) => f.fields.length));
594
+ return real(m).length === 0
595
+ ? { status: 'na', message: 'No inline form.' }
596
+ : ok(max <= 8, 'Reasonable length.', `${max} fields.`);
597
+ },
598
+ },
599
+ {
600
+ id: 'form.consent',
601
+ roles: ['form'],
602
+ description: 'Privacy/consent wording sits next to the form.',
603
+ severity: { credibility: 'minor', funnel: 'major' },
604
+ run: (m) => real(m).length === 0
605
+ ? { status: 'na', message: 'No inline form.' }
606
+ : ok(real(m).some((f) => f.consentNear), 'Consent wording near form.', 'No privacy/consent wording near the form.'),
607
+ },
608
+ {
609
+ id: 'form.trust-near',
610
+ roles: ['form'],
611
+ description: 'Trust signals sit near the form.',
612
+ severity: { credibility: 'na', funnel: 'minor' },
613
+ run: (m) => ok(m.trustNearCta ||
614
+ m.evidence.testimonial ||
615
+ m.evidence.certification ||
616
+ m.evidence.customerOrPartner, 'Trust signal present.', 'No trust signal on the form page.'),
617
+ },
618
+ {
619
+ id: 'form.analytics',
620
+ roles: ['form'],
621
+ description: 'Analytics present on the form step.',
622
+ severity: { credibility: 'na', funnel: 'major' },
623
+ run: (m) => analytics(m, 'Analytics present.', 'No analytics detected on the form page.', m.eventHooks ? `${m.eventHooks} event hooks` : undefined),
624
+ },
625
+ {
626
+ id: 'thankyou.confirmation',
627
+ roles: ['thank-you'],
628
+ description: 'Confirms what happened and what comes next.',
629
+ severity: { credibility: 'minor', funnel: 'major' },
630
+ run: (m) => ok(/thank|received|submitted|confirm|we.ll|we will|on its way|check your (email|inbox)/i.test(m.mainText), 'Confirmation copy present.', 'No confirmation copy.'),
631
+ },
632
+ {
633
+ id: 'thankyou.next-step',
634
+ roles: ['thank-you'],
635
+ description: 'Offers a next step (link or call to action).',
636
+ severity: { credibility: 'minor', funnel: 'major' },
637
+ run: (m) => ok(m.links.some((l) => l.internal && l.region === 'main') ||
638
+ m.ctas.some((c) => c.region === 'main'), 'Next step present.', 'No next step on the thank-you page.'),
639
+ },
640
+ {
641
+ id: 'thankyou.tracking',
642
+ roles: ['thank-you'],
643
+ description: 'Analytics present so the conversion can be counted.',
644
+ severity: { credibility: 'minor', funnel: 'critical' },
645
+ run: (m) => analytics(m, 'Analytics present.', 'No analytics on the thank-you page: conversions cannot be counted.', m.eventHooks ? `${m.eventHooks} event hooks` : undefined),
646
+ },
647
+ {
648
+ id: 'thankyou.noindex',
649
+ roles: ['thank-you'],
650
+ description: 'Thank-you page is noindex (keeps conversions honest).',
651
+ severity: { credibility: 'na', funnel: 'minor' },
652
+ run: (m) => ok(m.noindex, 'noindex.', 'Thank-you page is indexable.'),
653
+ },
654
+ ];
655
+ function formWorks(m, contact) {
656
+ const forms = real(m);
657
+ if (forms.length === 0) {
658
+ return m.formEmbeds.length > 0
659
+ ? unverified('Hosted form embed; not inspected.', m.formEmbeds[0])
660
+ : { status: 'na', message: contact ? 'No form on the contact page.' : 'No form.' };
661
+ }
662
+ const problems = [];
663
+ let handlerUnknown = false;
664
+ for (const f of forms) {
665
+ if (!f.hasSubmit)
666
+ problems.push('no submit control');
667
+ const unl = f.fields.filter((x) => !x.labelled && !/^(hidden|checkbox|radio)$/.test(x.type)).length;
668
+ if (unl > 0 && contact)
669
+ problems.push(`${unl} unlabelled fields`);
670
+ if (f.action && /^mailto:/i.test(f.action))
671
+ problems.push('action is mailto:');
672
+ if (f.method === 'get' && f.fields.some((x) => x.type === 'email') && f.action)
673
+ problems.push('email field submitted by GET');
674
+ if (!f.action)
675
+ handlerUnknown = true;
676
+ }
677
+ if (problems.length > 0)
678
+ return fail(`Form problems: ${[...new Set(problems)].join('; ')}.`);
679
+ if (handlerUnknown && !contact)
680
+ return unverified('No form action: assumed handled by JavaScript; submission is not exercised in a read-only audit.');
681
+ return pass('Form looks wired.');
682
+ }
683
+ export function checksForRole(role) {
684
+ return CHECKS.filter((c) => c.roles === 'all' ? !(c.except ?? []).includes(role) : c.roles.includes(role));
685
+ }
686
+ export function runPageChecks(model, role, kind) {
687
+ const out = [];
688
+ const shell = model.renderedShell && role !== 'thank-you' && role !== 'not-found';
689
+ const shellOnly = new Set(['base.status-ok', 'base.title', 'base.rendered-content']);
690
+ for (const def of checksForRole(role)) {
691
+ if (shell && !shellOnly.has(def.id))
692
+ continue;
693
+ const severity = def.severity[kind];
694
+ if (severity === 'na')
695
+ continue;
696
+ const r = def.run(model);
697
+ if (r.status === 'na')
698
+ continue;
699
+ out.push({ id: def.id, status: r.status, severity, message: r.message, evidence: r.evidence });
700
+ }
701
+ return out;
702
+ }
703
+ export function describeRoleChecklists() {
704
+ const roles = [
705
+ 'every page',
706
+ 'home',
707
+ 'privacy',
708
+ 'terms',
709
+ 'contact',
710
+ 'not-found',
711
+ 'about',
712
+ 'team',
713
+ 'person',
714
+ 'news',
715
+ 'post',
716
+ 'landing',
717
+ 'product',
718
+ 'pricing',
719
+ 'location',
720
+ 'form',
721
+ 'thank-you',
722
+ ];
723
+ return roles.map((role) => ({
724
+ role,
725
+ checks: role === 'every page'
726
+ ? CHECKS.filter((c) => c.roles === 'all')
727
+ : CHECKS.filter((c) => c.roles !== 'all' && c.roles.includes(role)),
728
+ }));
729
+ }
730
+ //# sourceMappingURL=checks.js.map