@se-studio/site-check 2.19.1 → 2.22.1

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 (95) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/README.md +11 -0
  3. package/develop-published-gate.mjs +701 -0
  4. package/dist/check-pages-exist.d.ts.map +1 -1
  5. package/dist/check-pages-exist.js +2 -1
  6. package/dist/check-pages-exist.js.map +1 -1
  7. package/dist/check-rewrites.d.ts.map +1 -1
  8. package/dist/check-rewrites.js +2 -1
  9. package/dist/check-rewrites.js.map +1 -1
  10. package/dist/cli.js +8 -1
  11. package/dist/cli.js.map +1 -1
  12. package/dist/collect-markdown-urls.d.ts.map +1 -1
  13. package/dist/collect-markdown-urls.js +2 -1
  14. package/dist/collect-markdown-urls.js.map +1 -1
  15. package/dist/download.d.ts.map +1 -1
  16. package/dist/download.js +2 -1
  17. package/dist/download.js.map +1 -1
  18. package/dist/fetch-timeout.d.ts +9 -0
  19. package/dist/fetch-timeout.d.ts.map +1 -0
  20. package/dist/fetch-timeout.js +17 -0
  21. package/dist/fetch-timeout.js.map +1 -0
  22. package/dist/smoke-test/cms-page-checks.d.ts.map +1 -1
  23. package/dist/smoke-test/cms-page-checks.js +1 -0
  24. package/dist/smoke-test/cms-page-checks.js.map +1 -1
  25. package/dist/smoke-test/config.d.ts.map +1 -1
  26. package/dist/smoke-test/config.js +106 -0
  27. package/dist/smoke-test/config.js.map +1 -1
  28. package/dist/smoke-test/content-assert.d.ts +14 -1
  29. package/dist/smoke-test/content-assert.d.ts.map +1 -1
  30. package/dist/smoke-test/content-assert.js +29 -5
  31. package/dist/smoke-test/content-assert.js.map +1 -1
  32. package/dist/smoke-test/dead-links.d.ts +58 -0
  33. package/dist/smoke-test/dead-links.d.ts.map +1 -0
  34. package/dist/smoke-test/dead-links.js +180 -0
  35. package/dist/smoke-test/dead-links.js.map +1 -0
  36. package/dist/smoke-test/environment.d.ts +19 -0
  37. package/dist/smoke-test/environment.d.ts.map +1 -0
  38. package/dist/smoke-test/environment.js +55 -0
  39. package/dist/smoke-test/environment.js.map +1 -0
  40. package/dist/smoke-test/index.d.ts +7 -2
  41. package/dist/smoke-test/index.d.ts.map +1 -1
  42. package/dist/smoke-test/index.js +4 -1
  43. package/dist/smoke-test/index.js.map +1 -1
  44. package/dist/smoke-test/runner.d.ts.map +1 -1
  45. package/dist/smoke-test/runner.js +90 -18
  46. package/dist/smoke-test/runner.js.map +1 -1
  47. package/dist/smoke-test/smoke-coverage/classify.d.ts +10 -0
  48. package/dist/smoke-test/smoke-coverage/classify.d.ts.map +1 -0
  49. package/dist/smoke-test/smoke-coverage/classify.js +90 -0
  50. package/dist/smoke-test/smoke-coverage/classify.js.map +1 -0
  51. package/dist/smoke-test/smoke-coverage/evaluate.d.ts +29 -0
  52. package/dist/smoke-test/smoke-coverage/evaluate.d.ts.map +1 -0
  53. package/dist/smoke-test/smoke-coverage/evaluate.js +270 -0
  54. package/dist/smoke-test/smoke-coverage/evaluate.js.map +1 -0
  55. package/dist/smoke-test/smoke-coverage/index.d.ts +8 -0
  56. package/dist/smoke-test/smoke-coverage/index.d.ts.map +1 -0
  57. package/dist/smoke-test/smoke-coverage/index.js +7 -0
  58. package/dist/smoke-test/smoke-coverage/index.js.map +1 -0
  59. package/dist/smoke-test/smoke-coverage/model.d.ts +20 -0
  60. package/dist/smoke-test/smoke-coverage/model.d.ts.map +1 -0
  61. package/dist/smoke-test/smoke-coverage/model.js +114 -0
  62. package/dist/smoke-test/smoke-coverage/model.js.map +1 -0
  63. package/dist/smoke-test/smoke-coverage/run.d.ts +19 -0
  64. package/dist/smoke-test/smoke-coverage/run.d.ts.map +1 -0
  65. package/dist/smoke-test/smoke-coverage/run.js +123 -0
  66. package/dist/smoke-test/smoke-coverage/run.js.map +1 -0
  67. package/dist/smoke-test/smoke-coverage/sitemap.d.ts +34 -0
  68. package/dist/smoke-test/smoke-coverage/sitemap.d.ts.map +1 -0
  69. package/dist/smoke-test/smoke-coverage/sitemap.js +148 -0
  70. package/dist/smoke-test/smoke-coverage/sitemap.js.map +1 -0
  71. package/dist/smoke-test/smoke-coverage/types.d.ts +74 -0
  72. package/dist/smoke-test/smoke-coverage/types.d.ts.map +1 -0
  73. package/dist/smoke-test/smoke-coverage/types.js +13 -0
  74. package/dist/smoke-test/smoke-coverage/types.js.map +1 -0
  75. package/dist/smoke-test/static.d.ts.map +1 -1
  76. package/dist/smoke-test/static.js +69 -6
  77. package/dist/smoke-test/static.js.map +1 -1
  78. package/dist/smoke-test/types.d.ts +23 -6
  79. package/dist/smoke-test/types.d.ts.map +1 -1
  80. package/dist/smoke-test/types.js.map +1 -1
  81. package/dist/validate.d.ts.map +1 -1
  82. package/dist/validate.js +5 -3
  83. package/dist/validate.js.map +1 -1
  84. package/dist/xml-entities.d.ts +3 -0
  85. package/dist/xml-entities.d.ts.map +1 -0
  86. package/dist/xml-entities.js +10 -0
  87. package/dist/xml-entities.js.map +1 -0
  88. package/docs/develop-published.md +36 -0
  89. package/docs/llms.md +1 -0
  90. package/docs/smoke-assertions.md +72 -0
  91. package/docs/smoke-coverage.md +92 -0
  92. package/package.json +6 -2
  93. package/smoke-coverage-dry-run.mjs +61 -0
  94. package/templates/develop-published/develop-published-gate.yml +129 -0
  95. package/templates/develop-published/update-develop-published.yml +58 -0
@@ -1,19 +1,22 @@
1
1
  import type { SmokeCmsIntegrityConfig } from '../cms-integrity/types.js';
2
2
  import type { DiscoveryEndpointResult, DiscoverySmokeConfig, ResolvedDiscoveryConfig } from '../discovery/types.js';
3
- import type { SmokeContentAssert } from './content-assert.js';
4
- export type { DiscoverySmokeConfig, SmokeCmsIntegrityConfig, SmokeContentAssert };
3
+ import type { SmokeContentAssert, SmokeContentAssertInput, SmokeEnvironment } from './content-assert.js';
4
+ import type { DeadLinksReport, ResolvedDeadLinksConfig, SmokeDeadLinksConfig } from './dead-links.js';
5
+ import type { SmokeCoverageConfig, SmokeCoverageReport } from './smoke-coverage/types.js';
6
+ export type { DeadLinksReport, DiscoverySmokeConfig, SmokeCmsIntegrityConfig, SmokeContentAssert, SmokeContentAssertInput, SmokeCoverageConfig, SmokeDeadLinksConfig, SmokeEnvironment, };
5
7
  /** CMS chrome failures a single smoke case may ignore. Unset or empty keeps every check. */
6
8
  export type CmsPageCheckReason = 'cms_missing_nav' | 'cms_missing_footer' | 'cms_missing_h1' | 'cms_missing_title' | 'cms_missing_description' | 'cms_missing_featured_image';
7
9
  export declare const CMS_PAGE_CHECK_REASONS: readonly CmsPageCheckReason[];
8
- export type SmokeTestCategory = 'home' | 'page' | 'article-type-index' | 'article' | 'person' | 'people-listing' | 'tag' | 'article-type-tag-listing' | 'tags-index' | 'articles-index' | 'custom-type-listing' | 'not-found' | 'probe' | 'discovery';
10
+ export type SmokeTestCategory = 'home' | 'privacy' | 'page' | 'article-type-index' | 'article' | 'person' | 'people-listing' | 'person-index' | 'tag' | 'article-type-tag-listing' | 'tags-index' | 'articles-index' | 'custom-type-listing' | 'not-found' | 'probe' | 'discovery';
9
11
  export interface SmokeTestCase {
10
12
  category: SmokeTestCategory;
11
13
  label: string;
12
14
  pageUrl: string;
13
15
  expectMarkdown: boolean;
14
16
  expectHtmlStatus?: number;
15
- contentAssert?: SmokeContentAssert;
17
+ contentAssert?: SmokeContentAssertInput;
16
18
  cmsPageCheckExceptions?: CmsPageCheckReason[];
19
+ skipDeadLinks?: boolean;
17
20
  }
18
21
  /** One row in app-level smoke.cases.json (path is site-relative). */
19
22
  export interface StaticSmokeCaseDefinition {
@@ -22,8 +25,9 @@ export interface StaticSmokeCaseDefinition {
22
25
  path: string;
23
26
  expectMarkdown: boolean;
24
27
  expectHtmlStatus?: number;
25
- contentAssert?: SmokeContentAssert;
28
+ contentAssert?: SmokeContentAssertInput;
26
29
  cmsPageCheckExceptions?: CmsPageCheckReason[];
30
+ skipDeadLinks?: boolean;
27
31
  }
28
32
  /** Committed per app; regenerate via se-marketing-sites-smoke-test-setup skill. */
29
33
  export interface StaticSmokeConfigFile {
@@ -34,8 +38,10 @@ export interface StaticSmokeConfigFile {
34
38
  minMarkdownLength?: number;
35
39
  requestDelayMs?: number;
36
40
  cmsIntegrity?: SmokeCmsIntegrityConfig;
41
+ coverage?: SmokeCoverageConfig;
42
+ deadLinks?: SmokeDeadLinksConfig;
37
43
  }
38
- export type SmokeFailureReason = 'html_non_2xx' | 'markdown_missing' | 'markdown_wrong_content_type' | 'markdown_too_short' | 'discovery_missing' | 'discovery_wrong_content_type' | 'discovery_invalid_content' | 'discovery_broken_link' | 'content_missing_include' | 'content_missing_selector' | 'content_image_failed' | CmsPageCheckReason;
44
+ export type SmokeFailureReason = 'html_non_2xx' | 'markdown_missing' | 'markdown_wrong_content_type' | 'markdown_too_short' | 'discovery_missing' | 'discovery_wrong_content_type' | 'discovery_invalid_content' | 'discovery_broken_link' | 'content_missing_include' | 'content_missing_selector' | 'content_image_failed' | 'dead_internal_link' | CmsPageCheckReason;
39
45
  export type NextJsCacheStatus = 'HIT' | 'MISS' | 'STALE';
40
46
  export interface SmokeTestCaseResult {
41
47
  case: SmokeTestCase;
@@ -47,6 +53,7 @@ export interface SmokeTestCaseResult {
47
53
  markdownBodySnippet: string | null;
48
54
  discoveryDetails?: string[];
49
55
  contentAssertDetails?: string[];
56
+ deadLinkDetails?: string[];
50
57
  cmsPageDetails?: string[];
51
58
  htmlNextCache: NextJsCacheStatus | null;
52
59
  markdownNextCache: NextJsCacheStatus | null;
@@ -58,6 +65,11 @@ export interface SmokeTestResult {
58
65
  cases: SmokeTestCaseResult[];
59
66
  discovery: DiscoveryEndpointResult[];
60
67
  warnings: string[];
68
+ coverage?: SmokeCoverageReport;
69
+ deadLinks?: DeadLinksReport & {
70
+ mode: 'error' | 'warn';
71
+ };
72
+ environment?: SmokeEnvironment;
61
73
  errorCount: number;
62
74
  warnCount: number;
63
75
  }
@@ -69,16 +81,21 @@ export interface SmokeTestRunnerConfig {
69
81
  minMarkdownLength?: number;
70
82
  requestDelayMs?: number;
71
83
  fetch?: typeof fetch;
84
+ environment?: SmokeEnvironment;
85
+ deadLinks?: ResolvedDeadLinksConfig;
72
86
  }
73
87
  export interface LoadStaticSmokeConfigOptions {
74
88
  cwd?: string;
75
89
  portOverride?: number;
76
90
  baseUrl?: string;
77
91
  env?: NodeJS.ProcessEnv;
92
+ environment?: SmokeEnvironment;
93
+ fallbackEnvironment?: SmokeEnvironment;
78
94
  }
79
95
  export interface RunStaticSmokeTestOptions extends LoadStaticSmokeConfigOptions {
80
96
  fetch?: typeof fetch;
81
97
  verifyCache?: boolean;
98
+ protectionBypass?: boolean;
82
99
  }
83
100
  export interface RunPreviewStaticSmokeTestOptions extends RunStaticSmokeTestOptions {
84
101
  requireBypass?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/smoke-test/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,KAAK,EACV,uBAAuB,EACvB,oBAAoB,EACpB,uBAAuB,EACxB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAE9D,YAAY,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,CAAC;AAElF,4FAA4F;AAC5F,MAAM,MAAM,kBAAkB,GAC1B,iBAAiB,GACjB,oBAAoB,GACpB,gBAAgB,GAChB,mBAAmB,GACnB,yBAAyB,GACzB,4BAA4B,CAAC;AAEjC,eAAO,MAAM,sBAAsB,EAAE,SAAS,kBAAkB,EAO/D,CAAC;AAEF,MAAM,MAAM,iBAAiB,GACzB,MAAM,GACN,MAAM,GACN,oBAAoB,GACpB,SAAS,GACT,QAAQ,GACR,gBAAgB,GAChB,KAAK,GACL,0BAA0B,GAC1B,YAAY,GACZ,gBAAgB,GAChB,qBAAqB,GACrB,WAAW,GACX,OAAO,GACP,WAAW,CAAC;AAEhB,MAAM,WAAW,aAAa;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C,EAAE,OAAO,KAAK,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,gCAAiC,SAAQ,yBAAyB;IACjF,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,0BAA0B;IACzC,KAAK,EAAE,eAAe,CAAC;IACvB,KAAK,EAAE,eAAe,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,mBAAmB,EAAE,MAAM,EAAE,CAAC;CAC/B"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/smoke-test/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,KAAK,EACV,uBAAuB,EACvB,oBAAoB,EACpB,uBAAuB,EACxB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EACV,kBAAkB,EAClB,uBAAuB,EACvB,gBAAgB,EACjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EACV,eAAe,EACf,uBAAuB,EACvB,oBAAoB,EACrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAE1F,YAAY,EACV,eAAe,EACf,oBAAoB,EACpB,uBAAuB,EACvB,kBAAkB,EAClB,uBAAuB,EACvB,mBAAmB,EACnB,oBAAoB,EACpB,gBAAgB,GACjB,CAAC;AAEF,4FAA4F;AAC5F,MAAM,MAAM,kBAAkB,GAC1B,iBAAiB,GACjB,oBAAoB,GACpB,gBAAgB,GAChB,mBAAmB,GACnB,yBAAyB,GACzB,4BAA4B,CAAC;AAEjC,eAAO,MAAM,sBAAsB,EAAE,SAAS,kBAAkB,EAO/D,CAAC;AAEF,MAAM,MAAM,iBAAiB,GACzB,MAAM,GACN,SAAS,GACT,MAAM,GACN,oBAAoB,GACpB,SAAS,GACT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,oBAAoB;IACpB,gBAAgB;IAChB,mBAAmB;IACnB,yBAAyB;IACzB,4BAA4B;CAC7B,CAAC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/smoke-test/types.ts"],"names":[],"mappings":"AAsCA,MAAM,CAAC,MAAM,sBAAsB,GAAkC;IACnE,iBAAiB;IACjB,oBAAoB;IACpB,gBAAgB;IAChB,mBAAmB;IACnB,yBAAyB;IACzB,4BAA4B;CAC7B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,yBAAyB,EAG/B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAEjE,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE;QAAE,EAAE,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3D,mBAAmB,EAAE;QAAE,EAAE,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;IACtF,OAAO,EAAE;QAAE,EAAE,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;IAC1E,SAAS,EAAE,yBAAyB,CAAC;IACrC,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,wBAAwB,CAAC,EAAE,MAAM,EAAE,CAAC;IACpC,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,2BAA2B,CAAC,EAAE,MAAM,EAAE,CAAC;CACxC;AAED,MAAM,WAAW,eAAe;IAC9B,0BAA0B,CAAC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AAM,EAAE,CAAC;CACxC;AAED,MAAM,WAAW,eAAe;IAC9B,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,SAAS,CAAC,EAAE,oBAAoB,CAAC;IACjC,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;CACtB;AA4ED,wBAAsB,QAAQ,CAC5B,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,WAAW,EACtB,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,gBAAgB,CAAC,CAgE3B;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,EAAE,eAAe,UAAQ,GAAG,OAAO,CAQ3F"}
package/dist/validate.js CHANGED
@@ -1,4 +1,6 @@
1
1
  import { resolveDiscoveryConfig, validateDiscoveryEndpoints, } from './discovery/index.js';
2
+ import { fetchWithTimeout } from './fetch-timeout.js';
3
+ import { decodeXmlEntities } from './xml-entities.js';
2
4
  function hasLocTag(body) {
3
5
  return /<loc>[^<]+<\/loc>/.test(body);
4
6
  }
@@ -6,7 +8,7 @@ function extractLocUrls(xmlBody) {
6
8
  const urls = [];
7
9
  const re = /<loc>([^<]+)<\/loc>/g;
8
10
  for (let m = re.exec(xmlBody); m !== null; m = re.exec(xmlBody)) {
9
- const u = m[1]?.trim();
11
+ const u = decodeXmlEntities(m[1]?.trim() ?? '');
10
12
  if (u)
11
13
  urls.push(u);
12
14
  }
@@ -29,7 +31,7 @@ async function resolveSitemapToPageUrls(body, fetchInit, options) {
29
31
  const childUrls = extractLocUrls(body);
30
32
  const allPageUrls = [];
31
33
  for (const childUrl of childUrls) {
32
- const res = await fetch(childUrl, fetchInit);
34
+ const res = await fetchWithTimeout(childUrl, fetchInit);
33
35
  if (!res.ok) {
34
36
  if (skip404Children && res.status === 404) {
35
37
  skippedMissingChildSitemaps.push(childUrl);
@@ -67,7 +69,7 @@ function syncLegacyLlmsTxt(result, strictDiscovery) {
67
69
  export async function validate(baseUrl, fetchInit, options) {
68
70
  const base = baseUrl.replace(/\/$/, '');
69
71
  const strictDiscovery = options?.strictDiscovery === true;
70
- const fetchFn = options?.fetch ?? fetch;
72
+ const fetchFn = options?.fetch ?? fetchWithTimeout;
71
73
  const result = {
72
74
  sitemapXml: { ok: false, status: 0 },
73
75
  sitemapUnindexedXml: { ok: false, status: 0 },
@@ -1 +1 @@
1
- {"version":3,"file":"validate.js","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,sBAAsB,EACtB,0BAA0B,GAC3B,MAAM,sBAAsB,CAAC;AAqB9B,SAAS,SAAS,CAAC,IAAY;IAC7B,OAAO,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACxC,CAAC;AAED,SAAS,cAAc,CAAC,OAAe;IACrC,MAAM,IAAI,GAAa,EAAE,CAAC;IAC1B,MAAM,EAAE,GAAG,sBAAsB,CAAC;IAClC,KAAK,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,IAAI,EAAE,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QAChE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC;QACvB,IAAI,CAAC;YAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACtB,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,cAAc,CAAC,IAAY;IAClC,OAAO,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;AACvE,CAAC;AAED,KAAK,UAAU,wBAAwB,CACrC,IAAY,EACZ,SAAsB,EACtB,OAAyB;IAEzB,MAAM,2BAA2B,GAAa,EAAE,CAAC;IACjD,MAAM,eAAe,GAAG,OAAO,EAAE,0BAA0B,KAAK,IAAI,CAAC;IAErE,IA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IACd,CAAC;IACD,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC;AACtD,CAAC"}
@@ -0,0 +1,3 @@
1
+ /** Decode the five predefined XML entities in a sitemap `<loc>` value. */
2
+ export declare function decodeXmlEntities(value: string): string;
3
+ //# sourceMappingURL=xml-entities.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xml-entities.d.ts","sourceRoot":"","sources":["../src/xml-entities.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAOvD"}
@@ -0,0 +1,10 @@
1
+ /** Decode the five predefined XML entities in a sitemap `<loc>` value. */
2
+ export function decodeXmlEntities(value) {
3
+ return value
4
+ .replace(/&lt;/g, '<')
5
+ .replace(/&gt;/g, '>')
6
+ .replace(/&quot;/g, '"')
7
+ .replace(/&apos;/g, "'")
8
+ .replace(/&amp;/g, '&');
9
+ }
10
+ //# sourceMappingURL=xml-entities.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xml-entities.js","sourceRoot":"","sources":["../src/xml-entities.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,MAAM,UAAU,iBAAiB,CAAC,KAAa;IAC7C,OAAO,KAAK;SACT,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC;SACrB,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC;SACrB,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC;SACvB,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC;SACvB,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;AAC5B,CAAC"}
@@ -0,0 +1,36 @@
1
+ # develop-published: a published-content build of develop, and the promote gate
2
+
3
+ One persistent Vercel preview build of a site's integration branch that reads **published** Contentful content only. It is the production-style safety net before a promote. Normal `develop` previews keep serving drafts.
4
+
5
+ ## Pieces
6
+
7
+ | Piece | Where |
8
+ |---|---|
9
+ | Fast-forward workflow | `templates/develop-published/update-develop-published.yml` |
10
+ | Gate workflow | `templates/develop-published/develop-published-gate.yml` (fill `__PROJECT_NAME__`, `__PROD_URL__`, `__DRAFT_CANARY__`) |
11
+ | Gate CLI | `develop-published-gate` (this package) |
12
+
13
+ ## Set-up per site
14
+
15
+ 1. Copy both templates to `.github/workflows/`. Check the integration branch name (`develop`). The gate workflow needs the repo secret `VERCEL_PROTECTION_BYPASS_TOKEN` and `statuses: write`.
16
+ 2. Merge them. The first push creates `develop-published` at develop's head. The branch only ever fast-forwards: the job uses a plain push and fails, pushing nothing, if it cannot. Never edit the branch or force-push it.
17
+ 3. In the Vercel project, add a **branch-scoped Preview** env var for git branch `develop-published` that switches the site to published content. Find the flag in the app (for example `DRAFT_ONLY=false`; read the app's server config). The CDA token usually already exists as a Preview var. Vercel only accepts a branch-scoped var once the branch exists, so this comes after step 2. Never touch Production env vars.
18
+ 4. **Trigger the build.** Vercel's Git integration does not build a second branch that points at a commit it already built (verified twice on the pilot site, with a new develop-published pushed by the Action and a probe branch pushed by a person, both at a SHA develop had already built: no deployment either time). So the first build, and every refresh, needs an explicit trigger: a Vercel **deploy hook** for ref `develop-published`, or the deployments API with `gitSource {ref: develop-published, sha}`. The update workflow template has a commented trigger step for the deploy-hook route. Until a trigger is set up, the template alone creates no deployment. (Pilot: API call from the worker; a deploy hook is the proposal for automation.)
19
+ **One gate run per commit:** the push and the deploy hook usually produce two READY deployments of the same SHA, and each sends its own `vercel.deployment.ready` event, so the gate would run twice. The template's `concurrency` group is keyed on the commit (and the Vercel project): the newer run cancels the older, and a cancelled run posts no status. Every compare and sitemap fetch has a 30s timeout that counts as a transient failure (3 tries); the spawned `site-check` compare is killed after 25 minutes (a healthy compare of a large sitemap takes about 20) and is not retried. The gate job has `timeout-minutes: 35` so a hung run cannot hold a runner for hours (a timed-out job counts as cancelled and posts no status). **Already green, skipped:** the first step of a Vercel-triggered run reads the commit statuses on the promoted SHA and, if the newest `develop-published gate` status (the `GATE_CONTEXT` job env; where one repo gates several apps, give each app's workflow copy its own context) is `success`, skips every later step and posts no new status, so a third deploy of the same SHA cannot re-run the gate. A `failure`, `error`, `pending` or missing status, or an API error, runs the gate; a manual `workflow_dispatch` always runs it.
20
+ 5. Revalidation: content changes reach the build through the site's Contentful webhook, not rebuilds. The existing webhooks target production and the develop branch alias, so they do not reach develop-published. A webhook for the `develop-published` branch alias (same topics and filter as the production one) is a Contentful write: it needs an owner's go.
21
+
22
+ ## The gate
23
+
24
+ ```bash
25
+ develop-published-gate --url https://<project>-git-develop-published-<team>.vercel.app \
26
+ --prod-url https://www.example.com --host-prefix <project>- \
27
+ --deployment-sha <built sha> --expect-sha <promoted sha> --draft-canary /a-draft-only-path/
28
+ ```
29
+
30
+ Stages (exit 0 only if all pass): exact commit (built from the promoted SHA, or from an ancestor when every file changed since is in `vercel.json`'s `ignoreCommand` pathspec); noindex; draft canary 404s; full smoke; content smoke (cases with `contentAssert`); prod compare (every production sitemap page that is live (200) on production exists on the build; a page that is 404/410 on production too is a "prod sitemap lists dead URL" warning, not a failure; transient fetch errors are retried 3 times with backoff; and the visible text of up to 5 representative pages matches, similarity >= 0.9). `--sitemap-roots <paths>` (comma-separated or repeated, default none) limits the sitemap compare to the sitemap roots this app owns, e.g. `--sitemap-roots /marketing/sitemap.xml` when the production domain is shared with other apps; without it the full production sitemap index (`/sitemap.xml` and `/sitemap-unindexed.xml`) is compared. An index root is followed one level; an unreadable, nested-index or empty root fails the stage. `--json` writes the result. `--host-prefix` is required. The bypass token goes only to the deployment host, which must be `<host-prefix>*.vercel.app`, the gate's own requests follow redirects by hand so a redirect off that host never carries it, and in compare mode `site-check` sends the bypass to the deployment only, never to production. (`site-check` itself still follows redirects automatically, so a deployment that redirects a sitemap path to another host would carry the header there; the Vercel deployment hosts do not.) Noindex is read from `robots.txt` (disallow all) or the home page (`x-robots-tag` or meta robots).
31
+
32
+ The workflow template runs this when Vercel reports a `develop-published` deployment ready and posts commit status `develop-published gate` on the promoted SHA, which a develop -> main promote PR shows (its head is develop's head).
33
+
34
+ `ignoreCommand`: when develop's latest commits touch only paths in `vercel.json`'s `ignoreCommand`, Vercel skips the build for develop and for develop-published (canceled deployments), including API-triggered ones. The gate's exact-commit stage then accepts the last real build when it is an ancestor and only those paths changed (verified on the pilot). A fast-forward push of a commit that edits `.github/workflows/**` is accepted with `GITHUB_TOKEN`, because the commit already exists in the repo (verified on the pilot).
35
+
36
+ A draft canary is a path that exists only as a draft in the CMS (404 in production). If it returns 404 on the build, drafts are not being served. Pick one per site and re-pick it if it is ever published.
package/docs/llms.md CHANGED
@@ -105,6 +105,7 @@ import { runArticleLinkIntegrityFromSmokeConfig } from '@se-studio/site-check/cm
105
105
  | `PREVIEW_SITE_URL` | Preview smoke base URL |
106
106
  | `DEPLOYMENT_URL` | Live deployment smoke URL |
107
107
  | `VERCEL_PROTECTION_BYPASS_TOKEN` | Deployment Protection bypass |
108
+ | `SMOKE_TEST_ENVIRONMENT` | `local` / `preview` / `production`: scopes `contentAssert.environments` blocks (see smoke-assertions.md) |
108
109
  | `SMOKE_TEST_REQUIRE_BYPASS` | `false` lets `smoke-test-live` run with no bypass token (site has Deployment Protection off); default requires one |
109
110
 
110
111
  ### Analytics context bundle check
@@ -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.19.1",
3
+ "version": "2.22.1",
4
4
  "description": "Validate SE marketing sites (sitemap, llms.txt) and download markdown files preserving structure",
5
5
  "repository": {
6
6
  "type": "git",
@@ -57,6 +57,8 @@
57
57
  "smoke-test-one": "./smoke-test-one.mjs",
58
58
  "smoke-test-deploy-check": "./smoke-test-deploy-check.mjs",
59
59
  "smoke-test-live": "./smoke-test-live.mjs",
60
+ "develop-published-gate": "./develop-published-gate.mjs",
61
+ "smoke-coverage-dry-run": "./smoke-coverage-dry-run.mjs",
60
62
  "validate-build-routes": "./validate-build-routes.mjs",
61
63
  "revalidation-matrix-test": "./revalidation-matrix-test.mjs",
62
64
  "develop-sites-timing": "./develop-sites-timing.mjs",
@@ -78,6 +80,8 @@
78
80
  "scripts/smoke-env.mjs",
79
81
  "smoke-test-deploy-check.mjs",
80
82
  "smoke-test-live.mjs",
83
+ "develop-published-gate.mjs",
84
+ "smoke-coverage-dry-run.mjs",
81
85
  "validate-build-routes.mjs",
82
86
  "revalidation-matrix-test.mjs",
83
87
  "develop-sites-timing.mjs",
@@ -120,6 +124,6 @@
120
124
  "type-check": "tsc --noEmit",
121
125
  "lint": "biome lint .",
122
126
  "clean": "rm -rf dist .turbo *.tsbuildinfo",
123
- "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 scripts/site-type-audit.test.mjs"
127
+ "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 scripts/develop-published-gate.test.mjs scripts/fetch-timeout.test.mjs scripts/xml-entities.test.mjs scripts/compare-bypass.test.mjs"
124
128
  }
125
129
  }
@@ -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);