@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.
- package/CHANGELOG.md +31 -0
- package/README.md +7 -0
- package/dist/site-type-audit/adapter.d.ts +17 -0
- package/dist/site-type-audit/adapter.d.ts.map +1 -0
- package/dist/site-type-audit/adapter.js +2 -0
- package/dist/site-type-audit/adapter.js.map +1 -0
- package/dist/site-type-audit/checks.d.ts +24 -0
- package/dist/site-type-audit/checks.d.ts.map +1 -0
- package/dist/site-type-audit/checks.js +730 -0
- package/dist/site-type-audit/checks.js.map +1 -0
- package/dist/site-type-audit/cli.d.ts +3 -0
- package/dist/site-type-audit/cli.d.ts.map +1 -0
- package/dist/site-type-audit/cli.js +84 -0
- package/dist/site-type-audit/cli.js.map +1 -0
- package/dist/site-type-audit/config.d.ts +5 -0
- package/dist/site-type-audit/config.d.ts.map +1 -0
- package/dist/site-type-audit/config.js +55 -0
- package/dist/site-type-audit/config.js.map +1 -0
- package/dist/site-type-audit/crawl.d.ts +40 -0
- package/dist/site-type-audit/crawl.d.ts.map +1 -0
- package/dist/site-type-audit/crawl.js +290 -0
- package/dist/site-type-audit/crawl.js.map +1 -0
- package/dist/site-type-audit/dead-links.d.ts +5 -0
- package/dist/site-type-audit/dead-links.d.ts.map +1 -0
- package/dist/site-type-audit/dead-links.js +35 -0
- package/dist/site-type-audit/dead-links.js.map +1 -0
- package/dist/site-type-audit/dom.d.ts +23 -0
- package/dist/site-type-audit/dom.d.ts.map +1 -0
- package/dist/site-type-audit/dom.js +155 -0
- package/dist/site-type-audit/dom.js.map +1 -0
- package/dist/site-type-audit/fetcher.d.ts +20 -0
- package/dist/site-type-audit/fetcher.d.ts.map +1 -0
- package/dist/site-type-audit/fetcher.js +81 -0
- package/dist/site-type-audit/fetcher.js.map +1 -0
- package/dist/site-type-audit/handoff.d.ts +19 -0
- package/dist/site-type-audit/handoff.d.ts.map +1 -0
- package/dist/site-type-audit/handoff.js +168 -0
- package/dist/site-type-audit/handoff.js.map +1 -0
- package/dist/site-type-audit/html-adapter.d.ts +18 -0
- package/dist/site-type-audit/html-adapter.d.ts.map +1 -0
- package/dist/site-type-audit/html-adapter.js +418 -0
- package/dist/site-type-audit/html-adapter.js.map +1 -0
- package/dist/site-type-audit/index.d.ts +15 -0
- package/dist/site-type-audit/index.d.ts.map +1 -0
- package/dist/site-type-audit/index.js +13 -0
- package/dist/site-type-audit/index.js.map +1 -0
- package/dist/site-type-audit/report.d.ts +6 -0
- package/dist/site-type-audit/report.d.ts.map +1 -0
- package/dist/site-type-audit/report.js +132 -0
- package/dist/site-type-audit/report.js.map +1 -0
- package/dist/site-type-audit/roles.d.ts +13 -0
- package/dist/site-type-audit/roles.d.ts.map +1 -0
- package/dist/site-type-audit/roles.js +135 -0
- package/dist/site-type-audit/roles.js.map +1 -0
- package/dist/site-type-audit/runner.d.ts +11 -0
- package/dist/site-type-audit/runner.d.ts.map +1 -0
- package/dist/site-type-audit/runner.js +113 -0
- package/dist/site-type-audit/runner.js.map +1 -0
- package/dist/site-type-audit/score.d.ts +24 -0
- package/dist/site-type-audit/score.d.ts.map +1 -0
- package/dist/site-type-audit/score.js +239 -0
- package/dist/site-type-audit/score.js.map +1 -0
- package/dist/site-type-audit/site-checks.d.ts +19 -0
- package/dist/site-type-audit/site-checks.d.ts.map +1 -0
- package/dist/site-type-audit/site-checks.js +192 -0
- package/dist/site-type-audit/site-checks.js.map +1 -0
- package/dist/site-type-audit/types.d.ts +248 -0
- package/dist/site-type-audit/types.d.ts.map +1 -0
- package/dist/site-type-audit/types.js +20 -0
- package/dist/site-type-audit/types.js.map +1 -0
- package/dist/smoke-test/cms-page-checks.d.ts.map +1 -1
- package/dist/smoke-test/cms-page-checks.js +1 -0
- package/dist/smoke-test/cms-page-checks.js.map +1 -1
- package/dist/smoke-test/config.d.ts.map +1 -1
- package/dist/smoke-test/config.js +106 -0
- package/dist/smoke-test/config.js.map +1 -1
- package/dist/smoke-test/content-assert.d.ts +14 -1
- package/dist/smoke-test/content-assert.d.ts.map +1 -1
- package/dist/smoke-test/content-assert.js +29 -5
- package/dist/smoke-test/content-assert.js.map +1 -1
- package/dist/smoke-test/dead-links.d.ts +58 -0
- package/dist/smoke-test/dead-links.d.ts.map +1 -0
- package/dist/smoke-test/dead-links.js +180 -0
- package/dist/smoke-test/dead-links.js.map +1 -0
- package/dist/smoke-test/environment.d.ts +19 -0
- package/dist/smoke-test/environment.d.ts.map +1 -0
- package/dist/smoke-test/environment.js +55 -0
- package/dist/smoke-test/environment.js.map +1 -0
- package/dist/smoke-test/index.d.ts +7 -2
- package/dist/smoke-test/index.d.ts.map +1 -1
- package/dist/smoke-test/index.js +4 -1
- package/dist/smoke-test/index.js.map +1 -1
- package/dist/smoke-test/runner.d.ts.map +1 -1
- package/dist/smoke-test/runner.js +90 -18
- package/dist/smoke-test/runner.js.map +1 -1
- package/dist/smoke-test/smoke-coverage/classify.d.ts +10 -0
- package/dist/smoke-test/smoke-coverage/classify.d.ts.map +1 -0
- package/dist/smoke-test/smoke-coverage/classify.js +90 -0
- package/dist/smoke-test/smoke-coverage/classify.js.map +1 -0
- package/dist/smoke-test/smoke-coverage/evaluate.d.ts +29 -0
- package/dist/smoke-test/smoke-coverage/evaluate.d.ts.map +1 -0
- package/dist/smoke-test/smoke-coverage/evaluate.js +270 -0
- package/dist/smoke-test/smoke-coverage/evaluate.js.map +1 -0
- package/dist/smoke-test/smoke-coverage/index.d.ts +8 -0
- package/dist/smoke-test/smoke-coverage/index.d.ts.map +1 -0
- package/dist/smoke-test/smoke-coverage/index.js +7 -0
- package/dist/smoke-test/smoke-coverage/index.js.map +1 -0
- package/dist/smoke-test/smoke-coverage/model.d.ts +20 -0
- package/dist/smoke-test/smoke-coverage/model.d.ts.map +1 -0
- package/dist/smoke-test/smoke-coverage/model.js +114 -0
- package/dist/smoke-test/smoke-coverage/model.js.map +1 -0
- package/dist/smoke-test/smoke-coverage/run.d.ts +19 -0
- package/dist/smoke-test/smoke-coverage/run.d.ts.map +1 -0
- package/dist/smoke-test/smoke-coverage/run.js +123 -0
- package/dist/smoke-test/smoke-coverage/run.js.map +1 -0
- package/dist/smoke-test/smoke-coverage/sitemap.d.ts +34 -0
- package/dist/smoke-test/smoke-coverage/sitemap.d.ts.map +1 -0
- package/dist/smoke-test/smoke-coverage/sitemap.js +148 -0
- package/dist/smoke-test/smoke-coverage/sitemap.js.map +1 -0
- package/dist/smoke-test/smoke-coverage/types.d.ts +74 -0
- package/dist/smoke-test/smoke-coverage/types.d.ts.map +1 -0
- package/dist/smoke-test/smoke-coverage/types.js +13 -0
- package/dist/smoke-test/smoke-coverage/types.js.map +1 -0
- package/dist/smoke-test/static.d.ts.map +1 -1
- package/dist/smoke-test/static.js +69 -6
- package/dist/smoke-test/static.js.map +1 -1
- package/dist/smoke-test/types.d.ts +23 -6
- package/dist/smoke-test/types.d.ts.map +1 -1
- package/dist/smoke-test/types.js.map +1 -1
- package/docs/llms.md +1 -0
- package/docs/site-type-audit-checklists.md +200 -0
- package/docs/site-type-audit.md +117 -0
- package/docs/smoke-assertions.md +72 -0
- package/docs/smoke-coverage.md +92 -0
- package/package.json +11 -3
- package/smoke-coverage-dry-run.mjs +61 -0
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
# Site-type audit: checklists per role
|
|
2
|
+
|
|
3
|
+
Generated from `src/site-type-audit/checks.ts` and `site-checks.ts` (`site-type-audit --print-checklists`). Do not edit by hand.
|
|
4
|
+
|
|
5
|
+
Severity weights: critical 10, major 5, minor 2, info 0 (reported, not scored). `-` means the check is skipped for that site kind.
|
|
6
|
+
|
|
7
|
+
## every page
|
|
8
|
+
|
|
9
|
+
| Check | What it asks | Credibility | Funnel |
|
|
10
|
+
|---|---|---|---|
|
|
11
|
+
| `base.status-ok` | Page loads with HTTP 200 after redirects. | critical | critical |
|
|
12
|
+
| `base.rendered-content` | The delivered HTML contains real content (not an empty shell filled in by JavaScript). | major | major |
|
|
13
|
+
| `base.title` | Has a <title> of 10-70 characters. | minor | minor |
|
|
14
|
+
| `base.h1` | Exactly one <h1>. | minor | minor |
|
|
15
|
+
| `base.meta-description` | Has a meta description. | minor | minor |
|
|
16
|
+
| `base.indexable` | Page is not set to noindex. | major | major |
|
|
17
|
+
| `base.chrome` | Has a header with navigation and a footer. | major | minor |
|
|
18
|
+
| `base.alt-text` | At most 10% of images lack alt text. | minor | minor |
|
|
19
|
+
|
|
20
|
+
## home
|
|
21
|
+
|
|
22
|
+
| Check | What it asks | Credibility | Funnel |
|
|
23
|
+
|---|---|---|---|
|
|
24
|
+
| `home.value-prop` | Has an h1 and enough copy to say what the organisation does. | major | major |
|
|
25
|
+
| `home.cta-above-fold` | A clear primary call to action sits above the fold. | minor | critical |
|
|
26
|
+
| `home.cta-repeated` | The call to action is repeated further down the page or in the footer. | - | major |
|
|
27
|
+
| `home.contact-path` | A route to contact is visible (contact link, email, phone or form). | major | major |
|
|
28
|
+
| `home.proof` | Shows proof behind its claims: customers/partners, testimonials, numbers, certifications or case studies. | major | major |
|
|
29
|
+
| `home.trust-near-cta` | Trust wording (customers, rating, security, guarantee) sits near the above-the-fold call to action. | - | major |
|
|
30
|
+
| `home.who-we-are` | Links to an about/company/team page. | major | minor |
|
|
31
|
+
| `home.legal-links` | Footer links to the privacy policy. | minor | major |
|
|
32
|
+
| `home.analytics` | Analytics or tag manager is present. | minor | major |
|
|
33
|
+
| `home.org-schema` | Organization (or WebSite) structured data present. | minor | info |
|
|
34
|
+
|
|
35
|
+
## privacy
|
|
36
|
+
|
|
37
|
+
| Check | What it asks | Credibility | Funnel |
|
|
38
|
+
|---|---|---|---|
|
|
39
|
+
| `privacy.substance` | Privacy policy has real content (300+ words). | major | major |
|
|
40
|
+
| `privacy.contact-detail` | Says how to contact the organisation about data. | minor | minor |
|
|
41
|
+
|
|
42
|
+
## terms
|
|
43
|
+
|
|
44
|
+
| Check | What it asks | Credibility | Funnel |
|
|
45
|
+
|---|---|---|---|
|
|
46
|
+
| `terms.substance` | Terms/cookies page has real content (150+ words). | minor | minor |
|
|
47
|
+
|
|
48
|
+
## contact
|
|
49
|
+
|
|
50
|
+
| Check | What it asks | Credibility | Funnel |
|
|
51
|
+
|---|---|---|---|
|
|
52
|
+
| `contact.method` | Gives at least one way to reach the organisation (email, phone, address, form). | critical | major |
|
|
53
|
+
| `contact.org-details` | Shows organisation details: an address, or both phone and email. | major | minor |
|
|
54
|
+
| `contact.form-works` | Contact form (if any) has labelled fields, a submit control and a real handler. | major | critical |
|
|
55
|
+
| `contact.consent-near-form` | Privacy/consent wording sits next to the form. | minor | major |
|
|
56
|
+
| `contact.analytics` | Analytics present on the contact step. | info | major |
|
|
57
|
+
|
|
58
|
+
## not-found
|
|
59
|
+
|
|
60
|
+
| Check | What it asks | Credibility | Funnel |
|
|
61
|
+
|---|---|---|---|
|
|
62
|
+
| `notfound.status-404` | An unknown URL returns HTTP 404 (not a soft 404 with status 200). | major | major |
|
|
63
|
+
| `notfound.recovery` | The 404 page offers a way back (home, contact or search link). | minor | major |
|
|
64
|
+
| `notfound.branded` | The 404 page keeps the site header and footer and says what happened. | minor | minor |
|
|
65
|
+
|
|
66
|
+
## about
|
|
67
|
+
|
|
68
|
+
| Check | What it asks | Credibility | Funnel |
|
|
69
|
+
|---|---|---|---|
|
|
70
|
+
| `about.substance` | About page has real content (150+ words) with structure (2+ sub-headings). | major | minor |
|
|
71
|
+
| `about.people-or-history` | Names people or links to the team. | major | minor |
|
|
72
|
+
| `about.next-step` | Points to a next step (contact or enquiry). | minor | minor |
|
|
73
|
+
|
|
74
|
+
## team
|
|
75
|
+
|
|
76
|
+
| Check | What it asks | Credibility | Funnel |
|
|
77
|
+
|---|---|---|---|
|
|
78
|
+
| `team.members` | Lists three or more people. | major | minor |
|
|
79
|
+
| `team.roles` | Gives each person a role or title. | major | minor |
|
|
80
|
+
| `team.photos` | Has photos of the team (3+ images). | minor | minor |
|
|
81
|
+
|
|
82
|
+
## person
|
|
83
|
+
|
|
84
|
+
| Check | What it asks | Credibility | Funnel |
|
|
85
|
+
|---|---|---|---|
|
|
86
|
+
| `person.name` | Has an h1 with the person’s name. | major | minor |
|
|
87
|
+
| `person.bio` | Has a bio (60+ words). | major | minor |
|
|
88
|
+
| `person.role-and-photo` | Shows a role/title and a photo. | minor | minor |
|
|
89
|
+
|
|
90
|
+
## news
|
|
91
|
+
|
|
92
|
+
| Check | What it asks | Credibility | Funnel |
|
|
93
|
+
|---|---|---|---|
|
|
94
|
+
| `news.items` | Lists three or more items. | major | minor |
|
|
95
|
+
| `news.dates` | Items are dated. | minor | minor |
|
|
96
|
+
|
|
97
|
+
## post
|
|
98
|
+
|
|
99
|
+
| Check | What it asks | Credibility | Funnel |
|
|
100
|
+
|---|---|---|---|
|
|
101
|
+
| `post.substance` | Post has real content (200+ words). | major | minor |
|
|
102
|
+
| `post.date` | Post is dated. | major | minor |
|
|
103
|
+
| `post.author` | Post names an author. | major | minor |
|
|
104
|
+
| `post.schema` | Article structured data present. | minor | minor |
|
|
105
|
+
| `post.next-step` | Leads somewhere: a call to action or related links. | minor | major |
|
|
106
|
+
|
|
107
|
+
## landing
|
|
108
|
+
|
|
109
|
+
| Check | What it asks | Credibility | Funnel |
|
|
110
|
+
|---|---|---|---|
|
|
111
|
+
| `landing.value-prop` | Has one h1 and supporting copy. | minor | major |
|
|
112
|
+
| `landing.cta-above-fold` | A clear primary call to action sits above the fold. | minor | critical |
|
|
113
|
+
| `landing.cta-repeated` | The call to action is repeated lower on the page. | - | major |
|
|
114
|
+
| `landing.has-destination` | Has a form, or a call to action that points at one. | - | critical |
|
|
115
|
+
| `landing.few-exits` | Few exits: 12 or fewer header/footer links. | - | major |
|
|
116
|
+
| `landing.trust-near-cta` | Trust signals sit near the call to action. | - | major |
|
|
117
|
+
| `landing.analytics` | Analytics present on the landing page. | - | major |
|
|
118
|
+
|
|
119
|
+
## product
|
|
120
|
+
|
|
121
|
+
| Check | What it asks | Credibility | Funnel |
|
|
122
|
+
|---|---|---|---|
|
|
123
|
+
| `product.cta-above-fold` | A primary call to action sits above the fold. | minor | critical |
|
|
124
|
+
| `product.features` | Explains the offer: 3+ features/benefits. | minor | major |
|
|
125
|
+
| `product.price-signal` | Shows a price or links to pricing/plans. | - | major |
|
|
126
|
+
| `product.trust-near-cta` | Trust signals sit near the call to action. | - | major |
|
|
127
|
+
| `product.analytics` | Analytics present. | - | major |
|
|
128
|
+
|
|
129
|
+
## pricing
|
|
130
|
+
|
|
131
|
+
| Check | What it asks | Credibility | Funnel |
|
|
132
|
+
|---|---|---|---|
|
|
133
|
+
| `pricing.prices` | States prices, or says how to get one. | - | major |
|
|
134
|
+
| `pricing.plan-ctas` | Each plan/option has a call to action. | - | critical |
|
|
135
|
+
| `pricing.comparison` | Presents two or more options to compare. | - | minor |
|
|
136
|
+
| `pricing.faq` | Answers objections (FAQ). | - | minor |
|
|
137
|
+
| `pricing.analytics` | Analytics present. | - | major |
|
|
138
|
+
|
|
139
|
+
## location
|
|
140
|
+
|
|
141
|
+
| Check | What it asks | Credibility | Funnel |
|
|
142
|
+
|---|---|---|---|
|
|
143
|
+
| `location.nap` | Shows address and/or phone. | minor | major |
|
|
144
|
+
| `location.cta` | Has a call to action (book, contact, directions). | minor | critical |
|
|
145
|
+
| `location.schema` | LocalBusiness/Place structured data present. | minor | minor |
|
|
146
|
+
|
|
147
|
+
## form
|
|
148
|
+
|
|
149
|
+
| Check | What it asks | Credibility | Funnel |
|
|
150
|
+
|---|---|---|---|
|
|
151
|
+
| `form.exists` | The page has a working-looking form (2+ visible fields) or a hosted form embed. | minor | critical |
|
|
152
|
+
| `form.labels` | Every visible field has a label. | minor | major |
|
|
153
|
+
| `form.submit` | The form has a submit control. | minor | critical |
|
|
154
|
+
| `form.handler` | The form is wired to a handler (not mailto:/empty GET). Submission itself is never exercised. | minor | major |
|
|
155
|
+
| `form.length` | Short form: 8 or fewer visible fields. | - | minor |
|
|
156
|
+
| `form.consent` | Privacy/consent wording sits next to the form. | minor | major |
|
|
157
|
+
| `form.trust-near` | Trust signals sit near the form. | - | minor |
|
|
158
|
+
| `form.analytics` | Analytics present on the form step. | - | major |
|
|
159
|
+
|
|
160
|
+
## thank-you
|
|
161
|
+
|
|
162
|
+
| Check | What it asks | Credibility | Funnel |
|
|
163
|
+
|---|---|---|---|
|
|
164
|
+
| `thankyou.confirmation` | Confirms what happened and what comes next. | minor | major |
|
|
165
|
+
| `thankyou.next-step` | Offers a next step (link or call to action). | minor | major |
|
|
166
|
+
| `thankyou.tracking` | Analytics present so the conversion can be counted. | minor | critical |
|
|
167
|
+
| `thankyou.noindex` | Thank-you page is noindex (keeps conversions honest). | - | minor |
|
|
168
|
+
|
|
169
|
+
## Site level
|
|
170
|
+
|
|
171
|
+
| Check | What it asks | Credibility | Funnel |
|
|
172
|
+
|---|---|---|---|
|
|
173
|
+
| `site.role.privacy` | A privacy page exists. | major | major |
|
|
174
|
+
| `site.role.terms` | A terms or cookies page exists. | minor | minor |
|
|
175
|
+
| `site.role.contact` | A contact page exists. | critical | major |
|
|
176
|
+
| `site.role.about` | An about page exists. | major | info |
|
|
177
|
+
| `site.role.team` | A team or person page exists. | major | minor |
|
|
178
|
+
| `site.role.news` | A news/blog index or post exists. | minor | info |
|
|
179
|
+
| `site.role.offer` | A landing, product/plan or pricing page exists. | - | major |
|
|
180
|
+
| `site.role.pricing` | A pricing page exists. | - | minor |
|
|
181
|
+
| `site.role.thank-you` | A thank-you / next-step page exists (found by URL; a read-only crawl cannot submit a form to reach one). | - | major |
|
|
182
|
+
| `site.funnel.has-form` | Some page carries a form or hosted form embed. | - | critical |
|
|
183
|
+
| `site.funnel.tracking-coverage` | Every conversion-step page has analytics. | - | major |
|
|
184
|
+
| `site.broken-links` | No audited page links to a URL that failed to load (critical for a funnel when it is behind a CTA). | major | major |
|
|
185
|
+
| `site.handoff.present` | Home links to the app or sign-up hand-off (only for a site with a `handoff` config). | critical | critical |
|
|
186
|
+
| `site.handoff.resolves` | Each distinct hand-off link (up to 4) answers GET with a status below 400, or a sign-in wall (401/403, listed as protected, not verified), and is not a 404 or soft-404 page. | critical | critical |
|
|
187
|
+
| `site.handoff.coverage` | Half or more of the home, landing, product, pricing and location pages link to the hand-off. | minor | minor |
|
|
188
|
+
|
|
189
|
+
## Overlay: `enquiry-path` (light funnel layer for a credibility site)
|
|
190
|
+
|
|
191
|
+
Reported separately; not part of the credibility score.
|
|
192
|
+
|
|
193
|
+
| Check | What it asks | Severity |
|
|
194
|
+
|---|---|---|
|
|
195
|
+
| `enquiry.home-cta` | Home has an enquiry call to action in the header or above the fold. | major |
|
|
196
|
+
| `enquiry.contact-route` | Contact page offers a form, embed or email. | major |
|
|
197
|
+
| `enquiry.contact-linked-sitewide` | 90%+ of pages link to contact from header/nav/footer. | minor |
|
|
198
|
+
| `enquiry.contact-tracked` | Analytics on the contact page. | minor |
|
|
199
|
+
|
|
200
|
+
Score: page score = 100 x (1 - failed weight / scored weight). Site score = 75% weighted page average + 25% site-level checks, capped at 69 while any critical check fails.
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# Site-type audit
|
|
2
|
+
|
|
3
|
+
Audits **every page** of a site (sitemap plus a bounded crawl of internal links) against what that kind of site is for, and rolls the result up to a per-page result and a site score. Read-only: it only issues `GET` requests, submits no forms, writes nothing and fixes nothing.
|
|
4
|
+
|
|
5
|
+
Two site kinds:
|
|
6
|
+
|
|
7
|
+
| Kind | The site exists to | Needs |
|
|
8
|
+
|---|---|---|
|
|
9
|
+
| `credibility` | prove the company is real and has substance | team, customers/partners, proof behind claims, clear organisation, contact details |
|
|
10
|
+
| `funnel` | bring customers in | a clear call to action above the fold and repeated, forms that work, a thank-you / next step, trust signals near the call to action, tracking on every conversion step, landing pages with few exits |
|
|
11
|
+
|
|
12
|
+
**Severity depends on kind.** A funnel site with no call to action is `critical`; a credibility site with none is `minor`. A team page missing is `major` on a credibility site and `minor` on a funnel. Every check carries a severity for each kind (`-` = skipped for that kind). The full per-role checklist, generated from the code, is [site-type-audit-checklists.md](./site-type-audit-checklists.md).
|
|
13
|
+
|
|
14
|
+
## Running it
|
|
15
|
+
|
|
16
|
+
The runner ships in `@se-studio/site-check` (bin `site-type-audit`). From a repo checkout (no publish needed):
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
pnpm install --frozen-lockfile
|
|
20
|
+
pnpm --filter @se-studio/site-check build
|
|
21
|
+
node packages/site-check/dist/site-type-audit/cli.js \
|
|
22
|
+
--config <file-or-dir-of-site-configs> --out <output-dir> \
|
|
23
|
+
[--site key1,key2] [--max-pages 150] [--concurrency 2] [--delay-ms 300]
|
|
24
|
+
node packages/site-check/dist/site-type-audit/cli.js --print-checklists # regenerate the checklist doc
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Output per site: `<out>/<key>.json` (machine-readable, `schemaVersion: 1`), `<out>/<key>.md` (short report), plus `<out>/index.json` (one line per site).
|
|
28
|
+
|
|
29
|
+
Politeness: concurrency 2 (max 4), a default of 300 ms between requests across the run (floor 100 ms), a page cap per site (default 150, `capped: true` in the output and the report when it bites), `robots.txt` honoured (`User-agent: *` rules), one retry on 429/503 with `Retry-After` of 10 s or less. The cap samples every site section round-robin so a 600-post blog cannot crowd out `/about` and `/contact`. The fetcher (`fetcher.ts`) exposes only `get()`; a test asserts every request is a GET. The unknown-URL probe for the 404 page is a plain GET of a path that should not exist.
|
|
30
|
+
|
|
31
|
+
## Site configs (live outside core)
|
|
32
|
+
|
|
33
|
+
Core contains no customer names. Each site has one JSON file kept outside this repo (a worker config folder, or the site repo). Schema (`SiteConfig` in `types.ts`):
|
|
34
|
+
|
|
35
|
+
```jsonc
|
|
36
|
+
{
|
|
37
|
+
"key": "example", // lowercase, dashes
|
|
38
|
+
"displayName": "Example",
|
|
39
|
+
"baseUrl": "https://www.example.test", // production URL (the CMS Edit tenant registry's productionSiteUrl)
|
|
40
|
+
"kind": "funnel", // or "credibility"
|
|
41
|
+
"overlays": ["enquiry-path"], // optional: light funnel layer on a credibility site, reported separately
|
|
42
|
+
"handoff": { "hosts": ["app.example.test"], "pathPattern": "^/signup(/|$)", "maxProbes": 4 }, // optional: where the site hands over to its app or sign-up (hosts and/or path regex)
|
|
43
|
+
"roleMap": [ // first match wins, before the built-in rules
|
|
44
|
+
{ "role": "pricing", "urlPattern": "^/plans(/|$)" }, // regex on the lowercased path
|
|
45
|
+
{ "role": "post", "schemaType": "Article|BlogPosting" }, // JSON-LD @type
|
|
46
|
+
{ "role": "form", "minFormFields": 3 }, // page has a form with N+ visible fields
|
|
47
|
+
{ "role": "landing", "titlePattern": "^Offer:" } // also: ogType
|
|
48
|
+
],
|
|
49
|
+
"expectedRoles": { "add": ["location"], "remove": ["terms"] },
|
|
50
|
+
"seedPaths": ["/start"],
|
|
51
|
+
"excludePatterns": ["^/account"],
|
|
52
|
+
"maxPages": 150,
|
|
53
|
+
"notes": "why this classification"
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Page roles
|
|
58
|
+
|
|
59
|
+
Every site: `home`, `privacy`, `terms` (terms or cookies), `contact`, `not-found`. Credibility pages: `about`, `team`, `person`, `news` (index), `post`. Funnel pages: `landing`, `product` (product or plan), `pricing`, `location`, `form`, `thank-you`. Anything else is `other` and gets only the every-page checks.
|
|
60
|
+
|
|
61
|
+
Role is decided in order: home by path; the config `roleMap`; built-in path patterns (`/privacy*`, `/team/<name>`, `/blog/<slug>`, ...; a `xx-YY` locale prefix is stripped first); structured data (`Article`, `Product`, `LocalBusiness`, ...); a form in the page content. The 404 page is the probe URL.
|
|
62
|
+
|
|
63
|
+
## Scoring
|
|
64
|
+
|
|
65
|
+
- Check weights: critical 10, major 5, minor 2, info 0 (reported, never scored). `unverified` (cannot be decided read-only or statically) and `na` are never scored.
|
|
66
|
+
- Page score = 100 x (1 - failed weight / scored weight).
|
|
67
|
+
- Site score = 75% weighted page average (home, contact and the kind's key roles count 2-3x) + 25% site-level checks (is there a contact page, a privacy page, a form, ... ; broken internal links; analytics coverage on conversion steps). **Capped at 69 while any critical check fails.**
|
|
68
|
+
- Findings are grouped by check, ordered critical first then by the share of pages affected.
|
|
69
|
+
- A site with a `handoff` config is scored up to the hand-off into its app or sign-up, never beyond it: `site.handoff.present` (home links to it) and `site.handoff.resolves` (each distinct link, up to `maxProbes`, answers GET below 400 or with a sign-in wall, and is not a 404 or soft-404 page; a 401 or 403 still passes but is listed in the report as "protected, not verified", never as a plain pass) are critical, `site.handoff.coverage` is minor. A verified hand-off settles `site.funnel.has-form` when there is no on-site form. The off-site app is fetched only to check the link; it is not audited.
|
|
70
|
+
- The run output carries `deadLinks`: every dead internal link target with its status and every live page that links to it (the report renders the full table). The check message still shows three examples.
|
|
71
|
+
- The `enquiry-path` overlay (a credibility site with a light funnel layer) is reported in its own section and does not change the credibility score.
|
|
72
|
+
- Classification check: heuristic funnel-vs-credibility signals (CTA share above the fold, funnel page roles, forms, event hooks vs. credibility roles, proof, long-form content). Reported as `suggestedKind` and `mismatch`; never applied.
|
|
73
|
+
|
|
74
|
+
## What it cannot see (read-only limits)
|
|
75
|
+
|
|
76
|
+
- **Thank-you pages** are usually reachable only after a form post. They are found by URL when linked or in the sitemap; otherwise `site.role.thank-you` is `unverified`, not failed.
|
|
77
|
+
- **Form submission** is never exercised. `form.handler` flags `mailto:` actions and GET-submitted email fields; a form with no `action` is `unverified` (JS-handled).
|
|
78
|
+
- **Hosted form embeds** (HubSpot, Typeform, Calendly, ...) count as a form but are not inspected.
|
|
79
|
+
- **Tracking** is detected from tags in the delivered HTML (GTM, GA4, HubSpot, Segment, Meta, LinkedIn, ...) plus counts of `data-track` / `dataLayer.push` hooks. Whether a conversion event actually fires needs a browser and consent state.
|
|
80
|
+
- **Above the fold** is approximated as the first ~1800 visible characters in document order (`ABOVE_FOLD_CHARS`). **Trust near the CTA** is trust wording within ~900 characters of an above-the-fold CTA. Both are heuristics for HTML; a design adapter has real geometry.
|
|
81
|
+
- Client-rendered pages (empty HTML shell) will read as thin. The audit says so rather than guessing.
|
|
82
|
+
|
|
83
|
+
## Design: input-agnostic checks and the Figma seam
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
input (HTML page | Figma frame | ...)
|
|
87
|
+
│
|
|
88
|
+
▼ PageModelAdapter<TInput>.toPageModel() adapter.ts <- the seam
|
|
89
|
+
PageModel (sections, headings, CTAs, forms, links, trackers, evidence, ...) types.ts
|
|
90
|
+
│
|
|
91
|
+
▼ role + checks (pure functions of PageModel, severity by kind) roles.ts, checks.ts
|
|
92
|
+
CheckResult[] -> page score -> site roll-up -> JSON + markdown score.ts, runner.ts, report.ts
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
- Checks never see HTML. They read only `PageModel`. Adding a check, or changing a severity, needs no adapter change.
|
|
96
|
+
- Today there is one adapter: `HtmlPageAdapter` (`html-adapter.ts`, tolerant tree builder in `dom.ts`, zero dependencies). It is the only code that knows about tags, classes and `<script>` bodies.
|
|
97
|
+
- The crawler (`crawl.ts`), fetcher and robots/sitemap handling belong to the HTML side. They produce `HtmlPageInput`s; a Figma run would skip them.
|
|
98
|
+
|
|
99
|
+
**Later phase: the same checks on Figma frames before build.** Not built. What the adapter has to do:
|
|
100
|
+
|
|
101
|
+
| PageModel field | From a Figma frame |
|
|
102
|
+
|---|---|
|
|
103
|
+
| role | frame name or page convention mapped through the same `roleMap` idea (name pattern -> role) |
|
|
104
|
+
| `headings` (level, text, `aboveFold`) | text nodes by text style (H1..H6 styles); `aboveFold` from the node's y-position against the first viewport height of the frame |
|
|
105
|
+
| `ctas` (label, `strength`, `aboveFold`, `conversion`) | button/link components (by component name or variant); primary variant -> `primary`; destination from prototype link or a naming convention |
|
|
106
|
+
| `forms` (fields, `labelled`, `hasSubmit`, `consentNear`) | input components and their label text nodes; a submit button component inside the same group |
|
|
107
|
+
| `links`, `exitLinks` | link components and nav/footer component instances, region from the component's parent frame name |
|
|
108
|
+
| `trackers`, `eventHooks` | not in a design: set empty and mark tracker checks `unverified` (add a `PageModel.meta.designOnly` flag for the checks to read) |
|
|
109
|
+
| `evidence`, `trustNearCta` | text/image content by the same keyword rules; logo-strip components for `logoImages`; distance in design units for "near" |
|
|
110
|
+
| `text`, `wordCount`, `mainText` | concatenated text nodes (copy may be placeholder; word-count checks should be skipped or relaxed for placeholder text) |
|
|
111
|
+
| `landmarks` | header/nav/footer component instances |
|
|
112
|
+
|
|
113
|
+
Open points for that phase: placeholder copy (substance checks), no HTTP status or `<title>` (status/title/meta checks become `na`), and a stable way to declare a frame's role. All three are adapter or `roleMap` concerns, not check changes. `PageModel.source` already records `'html' | 'figma'` so checks and reports can tell them apart.
|
|
114
|
+
|
|
115
|
+
## Files
|
|
116
|
+
|
|
117
|
+
`packages/site-check/src/site-type-audit/`: `types.ts` (PageModel, config, results), `adapter.ts` (the seam), `dom.ts` + `html-adapter.ts` (HTML adapter), `roles.ts`, `checks.ts` (per-page checks), `site-checks.ts` (site-level checks), `score.ts` (roll-up, findings, classification signals, overlay), `fetcher.ts` (GET only), `crawl.ts` (robots, sitemap, bounded crawl, 404 probe), `runner.ts`, `report.ts`, `config.ts`, `cli.ts`. Tests: `scripts/site-type-audit.test.mjs`.
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Smoke assertions: 404 content, environments, dead links, bypass
|
|
2
|
+
|
|
3
|
+
Four opt-in additions to `smoke.cases.json` and the smoke runners. A file that uses none of them behaves exactly as before.
|
|
4
|
+
|
|
5
|
+
## 1. Vercel protection bypass
|
|
6
|
+
|
|
7
|
+
`smoke-test-live`, `smoke-test-preview` and `runPreviewStaticSmokeTest` / `runLiveSmokeTest` already send `x-vercel-protection-bypass` (token from `VERCEL_PROTECTION_BYPASS_TOKEN`, aliases `VERCEL_AUTOMATION_BYPASS_SECRET` and `VERCEL_BYPASS_TOKEN`). New:
|
|
8
|
+
|
|
9
|
+
- `runStaticSmokeTest(file, { baseUrl, protectionBypass: true })` sends the header on every request to a remote `baseUrl`. It is opt-in because `baseUrl` can be any host; with no token set it throws rather than running unprotected.
|
|
10
|
+
- A customer runner that does its own fetching (for example a locale smoke script) can reuse the exported helpers from `@se-studio/site-check/smoke-test`:
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
import { createProtectedFetch, requireProtectionBypass } from '@se-studio/site-check/smoke-test';
|
|
14
|
+
|
|
15
|
+
const fetchFn = createProtectedFetch(requireProtectionBypass(), fetch); // use fetchFn instead of fetch
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
The header is sent to every URL the wrapped fetch requests, including `imagesMustLoad` image URLs and redirect targets the platform follows for you. Do not wrap a fetch that also requests third-party hosts. The dead-link check follows redirects itself (up to 5 hops) and stops at the first hop that leaves the link's origin, so the header never goes to another host. Links are filtered against the origin of the configured page URL, and relative links resolve against the page's final URL only when a redirect stayed on that origin.
|
|
19
|
+
|
|
20
|
+
`site-check <baseUrl> --vercel-bypass` (the audit CLI) already supports the header. `smoke-test-one` and `revalidation-matrix-test` run against a local server and need none. The production SEO audit targets the public production site.
|
|
21
|
+
|
|
22
|
+
## 2. Content assertions on an expected 404
|
|
23
|
+
|
|
24
|
+
`contentAssert` is skipped on non-2xx responses. Set `allowNon2xx` on a block, together with the case's `expectHtmlStatus`, to run it when the response status equals `expectHtmlStatus`:
|
|
25
|
+
|
|
26
|
+
```json
|
|
27
|
+
{
|
|
28
|
+
"category": "not-found",
|
|
29
|
+
"label": "404 page",
|
|
30
|
+
"path": "/definitely-missing/",
|
|
31
|
+
"expectMarkdown": false,
|
|
32
|
+
"expectHtmlStatus": 404,
|
|
33
|
+
"contentAssert": { "allowNon2xx": true, "mustInclude": ["href=\"/\""] }
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
If the status is not the expected one the case fails with `html_non_2xx` and the assertions are not run. CMS chrome checks stay 2xx-only.
|
|
38
|
+
|
|
39
|
+
## 3. Environment-aware assertions
|
|
40
|
+
|
|
41
|
+
A `contentAssert` block may carry `environments` (`local`, `preview`, `production`). `contentAssert` may also be an array of blocks, so shared and environment-specific checks sit side by side:
|
|
42
|
+
|
|
43
|
+
```json
|
|
44
|
+
"contentAssert": [
|
|
45
|
+
{ "mustInclude": ["<h1"] },
|
|
46
|
+
{ "environments": ["production"], "mustInclude": ["meta-externalagent"] }
|
|
47
|
+
]
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
An invalid `SMOKE_TEST_ENVIRONMENT` fails the run only when a case uses `environments`. A scoped block runs only when the run's environment is listed. When the environment is unknown the block is skipped (the report notes the skip), so a production-only pin can never fail a preview.
|
|
51
|
+
|
|
52
|
+
The environment is, in order: `environment` option on the load/run functions, `SMOKE_TEST_ENVIRONMENT` (`local|preview|production`, anything else throws), then inferred: a localhost URL is `local`; a host equal to `PRODUCTION_SITE_URL` is `production`; `runPreviewStaticSmokeTest` / `runLiveSmokeTest` fall back to `preview`; otherwise unknown. A preview or deployment URL is never read as production. To run the production pins from CI against the live site, set `SMOKE_TEST_ENVIRONMENT=production` (or `PRODUCTION_SITE_URL`). An explicit `production` is trusted: if you set it job-wide and the same job also smokes a preview, the production pins run against the preview and fail. Set it only on the step that targets production. As a guard, a `production` environment combined with a `*.vercel.app` base URL adds a warning to the run (not an error). `environments` must be a non-empty array.
|
|
53
|
+
|
|
54
|
+
## 4. Dead internal links (`deadLinks`)
|
|
55
|
+
|
|
56
|
+
Opt-in top-level block. For each smoke page that returns 2xx (not `not-found`, `probe` or `discovery` cases), same-origin `<a href>` links are collected. Unique targets are requested with HEAD (GET if HEAD is not conclusive; a HEAD 404/410 is final), under caps. A target that is also a smoke case reuses that case's status.
|
|
57
|
+
|
|
58
|
+
```json
|
|
59
|
+
"deadLinks": { "mode": "warn", "maxLinksPerPage": 50, "maxTotal": 200, "concurrency": 4, "timeoutMs": 10000, "ignorePrefixes": ["/_next/"] }
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
| Key | Default | Meaning |
|
|
63
|
+
|---|---|---|
|
|
64
|
+
| `enabled` | `true` when the block is present | `false` switches the check off without removing the block |
|
|
65
|
+
| `mode` | `warn` | `warn` only lists dead links in Warnings (default, for a staged rollout); `error` fails each source page with `dead_internal_link`. Adopt with `warn`, then switch a repo to `error` once its warnings are clean |
|
|
66
|
+
| `maxLinksPerPage` | 50 | unique links taken from one page, in document order |
|
|
67
|
+
| `maxTotal` | 200 | unique links requested in the whole run; the rest are reported as not checked |
|
|
68
|
+
| `concurrency` | 4 | simultaneous requests |
|
|
69
|
+
| `timeoutMs` | 10000 | per request |
|
|
70
|
+
| `ignorePrefixes` | `["/_next/"]` | path prefixes never checked |
|
|
71
|
+
|
|
72
|
+
A case can opt out with `"skipDeadLinks": true`. Dead links are listed with every source page ("linked from"). Same-origin redirects are followed; a redirect to another origin counts as alive and is not followed; status 400+ or no response is dead. Fragments, `mailto:`, `tel:`, `javascript:` and other origins are ignored. Relative links resolve against `<base href>` when the page has one. Link extraction is regex-based: it reads quoted `href` on `<a>` tags in the served HTML, so it also sees anchors inside comments, scripts and `<noscript>`, and misses unquoted hrefs. Only server-rendered `<a href>` is seen; links added by client-side JavaScript are not. With `SMOKE_TEST_VERIFY_CACHE` (two passes) the check runs on pass 1 only, so pass 1 takes longer and the timing-only cache fallback (used when `x-nextjs-cache` is absent) is easier to pass. Run it against a local or preview deployment: it adds requests, so keep the caps modest on production.
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Smoke coverage (`coverage` block in `smoke.cases.json`)
|
|
2
|
+
|
|
3
|
+
Smoke routes are curated by hand, so coverage drifts: a new article type, person type or privacy page gets no case and nobody notices. The optional `coverage` block compares the cases with the site's Contentful model and sitemap, and fails (or samples) when a routable type has no case.
|
|
4
|
+
|
|
5
|
+
**Opt-in.** A `smoke.cases.json` without a `coverage` block behaves exactly as before: no sitemap request, no Contentful request, no extra cases.
|
|
6
|
+
|
|
7
|
+
## How it works
|
|
8
|
+
|
|
9
|
+
1. **Model (read-only).** GETs `content_types` and the slugs of `pageVariant`, `articleType`, `personType` and `customType` entries, plus entry counts for the other routable types. Uses `CONTENTFUL_SPACE_ID`, `CONTENTFUL_ENVIRONMENT` (or `CONTENTFUL_ENVIRONMENT_NAME`, default `master`), `CONTENTFUL_ACCESS_TOKEN` (or `CONTENTFUL_PREVIEW_ACCESS_TOKEN` when `cmsIntegrity.preview` is true) and optionally `CONTENTFUL_DEFAULT_LOCALE` (picks the slug locale on management reads). If there is no delivery token, `CONTENTFUL_MANAGEMENT_TOKEN` is used for GETs only. Nothing is written.
|
|
10
|
+
2. **Sitemap.** Reads `<baseUrl>/sitemap.xml` (or `coverage.sitemapUrl`), following sitemap indexes on the same host. Only the path is kept, so a sitemap that lists production URLs works against a dev server or preview. At most 20 sitemaps and 20,000 paths are read, and exceeding either counts as an incomplete read (see below). Requests time out after 15 s. If any sitemap (or child sitemap) cannot be read, or is `.xml.gz`, the run reports one coverage failure (a warning in `warn` mode) rather than treating the missing routes as not routable. A `coverage.sitemapUrl` on another host is fetched without the Vercel bypass header.
|
|
11
|
+
3. **Classify.** Each sitemap path and each curated case is mapped to an item using the model and `cmsIntegrity.routing` (`articleTypesBasePath`, `tagsBasePath`, `peopleBasePath`). Without `cmsIntegrity.routing` the check assumes `/articles`, `/tags`, `/people` and says so.
|
|
12
|
+
4. **Compare.** A routable item with no case is flagged, naming the content type.
|
|
13
|
+
|
|
14
|
+
### Items
|
|
15
|
+
|
|
16
|
+
| Item | Needs a case when | Satisfied by |
|
|
17
|
+
|---|---|---|
|
|
18
|
+
| `home` | model has `page` | category `home`, or path `/` |
|
|
19
|
+
| `privacy` | model has `page` | category `privacy`, or a plain page whose last path segment contains `privacy` (article, person and tag routes are never read as privacy) |
|
|
20
|
+
| `page` | model has `page` | any other page path |
|
|
21
|
+
| `pageVariant` | model has published `pageVariant` entries | a path equal to a variant slug |
|
|
22
|
+
| `articleTypeIndex:<slug>` | an `articleType` entry has a sitemap route | its index path |
|
|
23
|
+
| `article:<slug>` | the sitemap has an article under that type | a path under the type |
|
|
24
|
+
| `articlesIndex` | the sitemap has the articles base path | `<articleTypesBasePath>/` |
|
|
25
|
+
| `person`, `person:<slug>` | published `person` entries and a sitemap route | a path under the people base path or person type |
|
|
26
|
+
| `peopleIndex`, `personType:<slug>` | the sitemap has the index | a case at that path (category `person-index` is recommended; the category itself is not checked) |
|
|
27
|
+
| `tag`, `tagsIndex` | published `tag` entries and a sitemap route | a path under, or at, the tags base path |
|
|
28
|
+
| `customType:<slug>` | a `customType` entry has a sitemap route | its path |
|
|
29
|
+
|
|
30
|
+
Matching is by path, not by category; only `home` and `privacy` cases are also recognised by category. `prefix:*` wildcards also match the bare family item, so `article:*` covers `article`. An article type is recognised both under `articleTypesBasePath` and at the site root (`/<slug>/`), so a normal page with the same slug as an article type is read as that type's index.
|
|
31
|
+
|
|
32
|
+
Only `home`, `privacy` and `page` are required without sitemap evidence. Every other item is required only when the model has entries for it and the sitemap has a route, so a site that turns tag or people pages off is not flagged. Such items are listed as `not routable on this site`.
|
|
33
|
+
|
|
34
|
+
## Config
|
|
35
|
+
|
|
36
|
+
```json
|
|
37
|
+
{
|
|
38
|
+
"coverage": {
|
|
39
|
+
"mode": "warn",
|
|
40
|
+
"require": ["home", "privacy", "article:*", "articleTypeIndex:*"],
|
|
41
|
+
"sitemapUrl": "https://www.example.com/sitemap.xml",
|
|
42
|
+
"samplesPerItem": 1,
|
|
43
|
+
"maxSamples": 25,
|
|
44
|
+
"seed": "smoke"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
| Key | Default | Meaning |
|
|
50
|
+
|---|---|---|
|
|
51
|
+
| `mode` | `warn` | `warn` (default): reported, never fails (use while migrating). `enforce`: a missing item fails the run. `sample`: a missing item is filled by a sitemap sample that runs as a case; it fails only when the sitemap has nothing to sample or `maxSamples` is reached (core items `home`, `privacy`, `page` are sampled first). |
|
|
52
|
+
| `require` | all derived items | Allowlist. Only these items are checked. `prefix:*` matches a family, for example `article:*`. |
|
|
53
|
+
| `exempt` | none | Schema field only; fleet policy is that no site uses it (all sites are held to the same coverage). `reason` is required and validated. An exemption that matches nothing is reported as stale. |
|
|
54
|
+
| `sitemapUrl` | `<baseUrl>/sitemap.xml` | Override when the sitemap lives elsewhere. |
|
|
55
|
+
| `samplesPerItem` | `1` | Routes sampled per uncovered item in `sample` mode. `enforce` and `warn` suggest the first pick. |
|
|
56
|
+
| `maxSamples` | `25` | Cap on sampled routes per run. Items past the cap are reported as `sample_cap` failures. |
|
|
57
|
+
| `seed` | `smoke` | Changes which routes the sampler picks. Same seed and sitemap give the same routes. |
|
|
58
|
+
|
|
59
|
+
Sampling is deterministic: candidates are ordered by a hash of `seed`, item and path, so the pick does not depend on sitemap order. Only entries in `cases` count as curated coverage; cases added by discovery are not seen. Slugs are compared after percent-decoding, except `%2F`, `%3F`, `%23` and `%25`, which stay encoded, and escape sequences that are not valid UTF-8, which are left as written. Sampled URLs are re-encoded without touching existing `%XX` escapes, so nothing is encoded twice. Sampled cases are labelled `[coverage sample] <item>` and use `expectMarkdown: false` (HTML status and CMS chrome checks only). To keep a route permanently, copy it into `cases`.
|
|
60
|
+
|
|
61
|
+
If the model or sitemap cannot be read, the run reports one coverage failure (a warning in `warn` mode) instead of crashing. Item `privacy` matches a plain page whose last path segment contains `privacy`, including `/privacy.html`.
|
|
62
|
+
|
|
63
|
+
## Categories
|
|
64
|
+
|
|
65
|
+
`SmokeTestCategory` gains `privacy` and `person-index`.
|
|
66
|
+
|
|
67
|
+
- `privacy` is a CMS page category: nav, footer, h1, title, description and og:image checks apply.
|
|
68
|
+
- `person-index` is accepted for people and person-type indexes. It is **not** added to the CMS chrome checks, so sites that already use it see no new failures (Headwater and Pedestal use it in their `smoke.cases.json`; no checked customer repo uses `privacy` yet). Add it to `CMS_PAGE_CATEGORIES` later if wanted.
|
|
69
|
+
|
|
70
|
+
## Dry run
|
|
71
|
+
|
|
72
|
+
Read-only; runs no page cases and writes nothing. Works on a `smoke.cases.json` that has no `coverage` block yet:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
CONTENTFUL_SPACE_ID=<space> CONTENTFUL_ENVIRONMENT=master CONTENTFUL_ACCESS_TOKEN=<cda-token> \
|
|
76
|
+
node node_modules/@se-studio/site-check/smoke-coverage-dry-run.mjs \
|
|
77
|
+
--cases smoke.cases.json --base-url https://www.example.com [--mode warn]
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Exit code 1 means the check would fail.
|
|
81
|
+
|
|
82
|
+
## Migration note for customer repos
|
|
83
|
+
|
|
84
|
+
Nothing changes until a repo adds a `coverage` block, so upgrading `@se-studio/site-check` is safe on its own. The default mode is `warn`. Adoption is staged per repo: **`warn` first, then `enforce`**. Each repo gets its own PR.
|
|
85
|
+
|
|
86
|
+
1. Bump `@se-studio/site-check` to the release that contains this feature. The `cmsIntegrity.routing` block should already match the app's URL rules; coverage depends on it.
|
|
87
|
+
2. Run the dry run above. Review what it flags.
|
|
88
|
+
3. Add `"coverage": { "mode": "warn" }` (or leave `mode` out, since `warn` is the default). Make sure the CI/local env has the Contentful variables `cmsIntegrity` already needs. Do not add `exempt` entries: the fleet rule is that every site is held to the same coverage, so a gap is fixed with a case, not exempted.
|
|
89
|
+
4. Add the cases the report suggests (use the `privacy` category for the privacy page, `person-index` for people indexes). Sampled cases are HTML-only (`expectMarkdown: false`).
|
|
90
|
+
5. When the `warn` report is clean, set `"mode": "enforce"`. `enforce` is never the default; a repo opts in.
|
|
91
|
+
|
|
92
|
+
Repos with a custom live script or a vendored `smoke-test-one.mjs` (Pedestal, Highlander) only pick this up if their script calls `runStaticSmokeTest` / `runPreviewStaticSmokeTest` from `@se-studio/site-check/smoke-test`. Check that before enabling.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@se-studio/site-check",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.20.0",
|
|
4
4
|
"description": "Validate SE marketing sites (sitemap, llms.txt) and download markdown files preserving structure",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -44,6 +44,11 @@
|
|
|
44
44
|
"import": "./dist/publish-state/index.js",
|
|
45
45
|
"require": "./dist/publish-state/index.js",
|
|
46
46
|
"default": "./dist/publish-state/index.js"
|
|
47
|
+
},
|
|
48
|
+
"./site-type-audit": {
|
|
49
|
+
"types": "./dist/site-type-audit/index.d.ts",
|
|
50
|
+
"import": "./dist/site-type-audit/index.js",
|
|
51
|
+
"default": "./dist/site-type-audit/index.js"
|
|
47
52
|
}
|
|
48
53
|
},
|
|
49
54
|
"bin": {
|
|
@@ -52,6 +57,7 @@
|
|
|
52
57
|
"smoke-test-one": "./smoke-test-one.mjs",
|
|
53
58
|
"smoke-test-deploy-check": "./smoke-test-deploy-check.mjs",
|
|
54
59
|
"smoke-test-live": "./smoke-test-live.mjs",
|
|
60
|
+
"smoke-coverage-dry-run": "./smoke-coverage-dry-run.mjs",
|
|
55
61
|
"validate-build-routes": "./validate-build-routes.mjs",
|
|
56
62
|
"revalidation-matrix-test": "./revalidation-matrix-test.mjs",
|
|
57
63
|
"develop-sites-timing": "./develop-sites-timing.mjs",
|
|
@@ -60,7 +66,8 @@
|
|
|
60
66
|
"check-publish-state": "./check-publish-state.mjs",
|
|
61
67
|
"check-cms-driven": "./check-cms-driven.mjs",
|
|
62
68
|
"check-comments": "./check-comments.mjs",
|
|
63
|
-
"check-class-gaps": "./check-class-gaps.mjs"
|
|
69
|
+
"check-class-gaps": "./check-class-gaps.mjs",
|
|
70
|
+
"site-type-audit": "./dist/site-type-audit/cli.js"
|
|
64
71
|
},
|
|
65
72
|
"files": [
|
|
66
73
|
"dist",
|
|
@@ -72,6 +79,7 @@
|
|
|
72
79
|
"scripts/smoke-env.mjs",
|
|
73
80
|
"smoke-test-deploy-check.mjs",
|
|
74
81
|
"smoke-test-live.mjs",
|
|
82
|
+
"smoke-coverage-dry-run.mjs",
|
|
75
83
|
"validate-build-routes.mjs",
|
|
76
84
|
"revalidation-matrix-test.mjs",
|
|
77
85
|
"develop-sites-timing.mjs",
|
|
@@ -114,6 +122,6 @@
|
|
|
114
122
|
"type-check": "tsc --noEmit",
|
|
115
123
|
"lint": "biome lint .",
|
|
116
124
|
"clean": "rm -rf dist .turbo *.tsbuildinfo",
|
|
117
|
-
"test": "pnpm build && node --test scripts/screaming-frog-audit.test.mjs scripts/screaming-frog-config.test.mjs scripts/production-audit.test.mjs scripts/discovery.test.mjs scripts/smoke-test.test.mjs scripts/analytics-context-bundle.test.mjs scripts/check-no-context-workarounds.test.mjs scripts/check-cms-driven.test.mjs scripts/check-comments.test.mjs scripts/check-class-gaps.test.mjs scripts/revalidation-matrix.test.mjs scripts/develop-sites-timing.test.mjs scripts/markdown-accuracy-audit.test.mjs scripts/publish-state.test.mjs"
|
|
125
|
+
"test": "pnpm build && node --test scripts/screaming-frog-audit.test.mjs scripts/screaming-frog-config.test.mjs scripts/production-audit.test.mjs scripts/discovery.test.mjs scripts/smoke-test.test.mjs scripts/smoke-coverage.test.mjs scripts/smoke-followups.test.mjs scripts/analytics-context-bundle.test.mjs scripts/check-no-context-workarounds.test.mjs scripts/check-cms-driven.test.mjs scripts/check-comments.test.mjs scripts/check-class-gaps.test.mjs scripts/revalidation-matrix.test.mjs scripts/develop-sites-timing.test.mjs scripts/markdown-accuracy-audit.test.mjs scripts/publish-state.test.mjs scripts/site-type-audit.test.mjs"
|
|
118
126
|
}
|
|
119
127
|
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Read-only coverage dry run. Reads the Contentful model (GET only) and the site's sitemap, compares
|
|
5
|
+
* them with a smoke.cases.json, and prints what the coverage check would flag. It never runs page
|
|
6
|
+
* smoke cases and never writes anything.
|
|
7
|
+
*
|
|
8
|
+
* Usage: smoke-coverage-dry-run --cases <smoke.cases.json> --base-url <https://site> [--mode warn|sample|enforce]
|
|
9
|
+
* Env: CONTENTFUL_SPACE_ID, CONTENTFUL_ENVIRONMENT, and CONTENTFUL_ACCESS_TOKEN (or, read-only,
|
|
10
|
+
* CONTENTFUL_MANAGEMENT_TOKEN). Exit code is 1 when the check would fail.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { dirname, join, resolve } from 'node:path';
|
|
14
|
+
import { fileURLToPath } from 'node:url';
|
|
15
|
+
|
|
16
|
+
const packageDir = dirname(fileURLToPath(import.meta.url));
|
|
17
|
+
|
|
18
|
+
function arg(name) {
|
|
19
|
+
const index = process.argv.indexOf(`--${name}`);
|
|
20
|
+
return index === -1 ? undefined : process.argv[index + 1];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const casesPath = arg('cases');
|
|
24
|
+
const baseUrl = arg('base-url');
|
|
25
|
+
if (!casesPath || !baseUrl) {
|
|
26
|
+
console.error(
|
|
27
|
+
'Usage: smoke-coverage-dry-run --cases <smoke.cases.json> --base-url <https://site> [--mode warn|sample|enforce]',
|
|
28
|
+
);
|
|
29
|
+
process.exit(2);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const { prepareCoverage, formatCoverageReport } = await import(
|
|
33
|
+
join(packageDir, 'dist/smoke-test/smoke-coverage/index.js')
|
|
34
|
+
);
|
|
35
|
+
const { loadSmokeConfigFile } = await import(join(packageDir, 'dist/smoke-test/config.js'));
|
|
36
|
+
const { SMOKE_COVERAGE_MODES } = await import(
|
|
37
|
+
join(packageDir, 'dist/smoke-test/smoke-coverage/types.js')
|
|
38
|
+
);
|
|
39
|
+
const { joinSmokeBaseUrl } = await import(join(packageDir, 'dist/smoke-test/static.js'));
|
|
40
|
+
|
|
41
|
+
const mode = arg('mode');
|
|
42
|
+
if (mode && !SMOKE_COVERAGE_MODES.includes(mode)) {
|
|
43
|
+
console.error(`--mode must be one of ${SMOKE_COVERAGE_MODES.join(', ')}`);
|
|
44
|
+
process.exit(2);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const raw = loadSmokeConfigFile(resolve(casesPath));
|
|
48
|
+
// The dry run applies the check to files that have no coverage block yet.
|
|
49
|
+
raw.coverage = { ...(raw.coverage ?? {}), ...(mode ? { mode } : {}) };
|
|
50
|
+
|
|
51
|
+
const cases = (raw.cases ?? []).map((entry) => ({
|
|
52
|
+
category: entry.category,
|
|
53
|
+
label: entry.label,
|
|
54
|
+
pageUrl: joinSmokeBaseUrl(baseUrl, entry.path),
|
|
55
|
+
expectMarkdown: entry.expectMarkdown,
|
|
56
|
+
}));
|
|
57
|
+
|
|
58
|
+
const prepared = await prepareCoverage(raw, cases, { baseUrl, env: process.env });
|
|
59
|
+
console.log(`Coverage dry run: ${raw.siteName} (${baseUrl}), ${cases.length} curated cases`);
|
|
60
|
+
console.log(formatCoverageReport(prepared.report).join('\n'));
|
|
61
|
+
process.exit(prepared.report.failureCount > 0 ? 1 : 0);
|