@holmdigital/engine 2.1.7 → 2.3.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/README.md CHANGED
@@ -14,7 +14,7 @@ Most accessibility tools give you technical errors (e.g., "Color contrast must b
14
14
  It handles the heavy lifting of:
15
15
  1. **Mapping** technical failures to specific legal clauses.
16
16
  2. **Validating** HTML structure to ensure test accuracy.
17
- 3. **Reporting** in multiple languages (EN, SV, NO, FI, DA, NL, DE, FR, ES) for non-technical stakeholders.
17
+ 3. **Reporting** in multiple languages (EN, SV, NO, FI, DA, NL, DE, FR, ES, IT, PT, PL) for non-technical stakeholders.
18
18
  4. **CI/CD Pipeline Integration** with automatic enforcement.
19
19
 
20
20
  For a comprehensive guide on CLI flags, CI/CD integration, and configuration files, see the **[Engine Library Catalog](../../docs/reference/engine.md)**.
@@ -23,7 +23,7 @@ For a comprehensive guide on CLI flags, CI/CD integration, and configuration fil
23
23
 
24
24
  - **Regulatory Mapping**: Maps technical failures to EU laws (EN 301 549, EAA).
25
25
  - **HTML Structure Validation**: Built-in `html-validate` checks to prevent false positives/negatives.
26
- - **Internationalization (i18n)**: Comprehensive support for 9 languages: English (`en`), Swedish (`sv`), Norwegian (`no`), Finnish (`fi`), Danish (`da`), German (`de`), French (`fr`), Spanish (`es`), and Dutch (`nl`).
26
+ - **Internationalization (i18n)**: Comprehensive support for 12 languages: English (`en`), Swedish (`sv`), Norwegian (`no`), Finnish (`fi`), Danish (`da`), German (`de`), French (`fr`), Spanish (`es`), Dutch (`nl`), Italian (`it`), Portuguese (`pt`), and Polish (`pl`).
27
27
  - **Template-Driven Accessibility Statements**: Generates modern, glassmorphism-styled statements using externalized JSON templates for each language, allowing for professional legal phrasing and deep customization.
28
28
  - **Multi-Company Metadata**: Easily customize statements via CLI flags or `.a11yrc` for scalable client generation.
29
29
  - **Enriched JUnit XML**: Professional CI/CD reports including scan duration, page title, engine metadata, and **detailed failing node** snippets (Target + HTML).
@@ -49,7 +49,7 @@ npx hd-a11y-scan <url> [options]
49
49
  **Options:**
50
50
  | Option | Description |
51
51
  |--------|-------------|
52
- | `--lang <code>` | Language code (`en`, `sv`, `de`, `fr`, `es`, `nl`, `no`, `fi`, `da`, `en-gb`, `en-us`, `en-ca`) |
52
+ | `--lang <code>` | Language code (`en`, `sv`, `no`, `fi`, `da`, `de`, `fr`, `es`, `nl`, `it`, `pt`, `pl`) |
53
53
  | `--threshold <level>` | Severity threshold for compliance (`critical`, `high`, `medium`, `low`). Default: `high` |
54
54
  | `--ci` | Run in CI mode (exit code 1 on failure) |
55
55
  | `--json` | Output results as JSON |
@@ -60,6 +60,8 @@ npx hd-a11y-scan <url> [options]
60
60
  | `--phone <number>` | Contact phone for the statement metadata |
61
61
  | `--response-time <val>` | Response time for the statement metadata |
62
62
  | `--publish-date <date>` | Publish date for the website (YYYY-MM-DD) |
63
+ | `--country <code>` | Country code for enforcement body (`SE`, `NO`, `DE`, `IT`, `PT`, `PL`, etc.) |
64
+ | `--sector <type>` | Sector type: `public` (WAD) or `private` (EAA). Default: `public` |
63
65
  | `--viewport <size>` | Set viewport size (`mobile`, `tablet`, `desktop`, or custom `1024x768`) |
64
66
  | `--generate-tests` | Generate Pseudo-Automation tests |
65
67
  | `--invalid-https-cert` | Allow scanning sites with invalid/self-signed HTTPS certificates ⚠️ |
@@ -138,7 +138,7 @@ var HtmlValidator = class {
138
138
  // src/core/regulatory-scanner.ts
139
139
  import { readFileSync } from "fs";
140
140
  function getEngineVersion() {
141
- return "2.1.7";
141
+ return "2.3.0";
142
142
  }
143
143
  function getStandardsVersion() {
144
144
  try {
@@ -210,13 +210,16 @@ var RegulatoryScanner = class {
210
210
  }
211
211
  pageTitle = await page.title();
212
212
  pageLanguage = await page.evaluate(() => document.documentElement.lang || void 0);
213
- const pageContent = await page.content();
214
- const htmlValidation = await this.htmlValidator.validate(pageContent);
215
- if (!htmlValidation.valid) {
216
- this.log(`HTML Validation: Found ${htmlValidation.errors.length} structural issues.`);
213
+ let htmlValidation;
214
+ if (!this.options.light) {
215
+ const pageContent = await page.content();
216
+ htmlValidation = await this.htmlValidator.validate(pageContent);
217
+ if (!htmlValidation.valid) {
218
+ this.log(`HTML Validation: Found ${htmlValidation.errors.length} structural issues.`);
219
+ }
220
+ const vDomBuilder = new VirtualDOMBuilder(page);
221
+ await vDomBuilder.build({ includeComputedStyle: ["color", "background-color"] });
217
222
  }
218
- const vDomBuilder = new VirtualDOMBuilder(page);
219
- await vDomBuilder.build({ includeComputedStyle: ["color", "background-color"] });
220
223
  await this.injectAxe(page);
221
224
  this.log("Axe injected. Running analysis...");
222
225
  const axeResults = await page.evaluate(async () => {
@@ -237,10 +240,12 @@ var RegulatoryScanner = class {
237
240
  });
238
241
  this.log(`Raw Axe Violations: ${axeResults.violations?.length || 0}`);
239
242
  passedCount = axeResults.passes?.length || 0;
240
- const regulatoryReports = await this.enrichResults(axeResults);
243
+ const regulatoryReports = this.options.light ? this.enrichResultsLight(axeResults) : await this.enrichResults(axeResults);
241
244
  const scanDuration = Date.now() - startTime;
242
245
  const result = this.generateResultPackage(regulatoryReports, passedCount, scanDuration, pageTitle, pageLanguage);
243
- result.htmlValidation = htmlValidation;
246
+ if (htmlValidation) {
247
+ result.htmlValidation = htmlValidation;
248
+ }
244
249
  return result;
245
250
  } finally {
246
251
  await this.close();
@@ -268,6 +273,53 @@ var RegulatoryScanner = class {
268
273
  const axeSource = axeCore.source;
269
274
  await page.evaluate(axeSource);
270
275
  }
276
+ /**
277
+ * Light enrichment — maps axe severity directly without standards lookup.
278
+ * Much faster: no async imports, no rule database queries.
279
+ */
280
+ enrichResultsLight(axeResults) {
281
+ const impactToRisk = {
282
+ critical: "critical",
283
+ serious: "high",
284
+ moderate: "medium",
285
+ minor: "low"
286
+ };
287
+ return axeResults.violations.map((violation) => {
288
+ const impact = violation.impact || "moderate";
289
+ const risk = impactToRisk[impact] || "medium";
290
+ return {
291
+ ruleId: violation.id,
292
+ wcagCriteria: violation.tags.find((t) => t.startsWith("wcag")) || "Unknown",
293
+ en301549Criteria: "",
294
+ dosLagenReference: "",
295
+ diggRisk: risk,
296
+ eaaImpact: risk,
297
+ remediation: {
298
+ description: violation.help,
299
+ technicalGuidance: violation.description,
300
+ component: void 0
301
+ },
302
+ holmdigitalInsight: {
303
+ diggRisk: risk,
304
+ eaaImpact: risk,
305
+ reasoning: violation.help,
306
+ swedishInterpretation: "",
307
+ priorityRationale: ""
308
+ },
309
+ testability: {
310
+ automated: true,
311
+ requiresManualCheck: false,
312
+ pseudoAutomation: false,
313
+ complexity: "simple"
314
+ },
315
+ failingNodes: violation.nodes.slice(0, 3).map((node) => ({
316
+ html: node.html,
317
+ target: node.target.join(" "),
318
+ failureSummary: node.failureSummary
319
+ }))
320
+ };
321
+ });
322
+ }
271
323
  async enrichResults(axeResults) {
272
324
  const reports = [];
273
325
  const { searchRulesByTags, generateRegulatoryReport, getConvergenceRule } = await import("@holmdigital/standards");
@@ -492,7 +544,7 @@ function generateBadgeMarkdown(score) {
492
544
  import React from "react";
493
545
  import { renderToStaticMarkup } from "react-dom/server";
494
546
  import { AccessibilityStatement } from "@holmdigital/components";
495
- import { ENFORCEMENT_BODIES } from "@holmdigital/standards";
547
+ import { getEnforcementBody, getNationalLawByFramework } from "@holmdigital/standards";
496
548
  import fs from "fs/promises";
497
549
  import path from "path";
498
550
  var EVALUATION_METHOD = {
@@ -506,6 +558,9 @@ var EVALUATION_METHOD = {
506
558
  fr: "Analyse automatis\xE9e via @holmdigital/engine",
507
559
  es: "An\xE1lisis automatizado mediante @holmdigital/engine",
508
560
  nl: "Geautomatiseerde controle via @holmdigital/engine",
561
+ it: "Scansione automatizzata tramite @holmdigital/engine",
562
+ pt: "Verifica\xE7\xE3o automatizada via @holmdigital/engine",
563
+ pl: "Automatyczne skanowanie za pomoc\u0105 @holmdigital/engine",
509
564
  "en-gb": "Automated scan via @holmdigital/engine",
510
565
  "en-us": "Automated scan via @holmdigital/engine",
511
566
  "en-ca": "Automated scan via @holmdigital/engine"
@@ -521,6 +576,9 @@ var STATUS_LABELS = {
521
576
  fr: { full: "Totalement conforme", partial: "Partiellement conforme", "non-compliant": "Non conforme" },
522
577
  es: { full: "Plenamente conforme", partial: "Parcialmente conforme", "non-compliant": "No conforme" },
523
578
  nl: { full: "Volledig conform", partial: "Gedeeltelijk conform", "non-compliant": "Niet conform" },
579
+ it: { full: "Pienamente conforme", partial: "Parzialmente conforme", "non-compliant": "Non conforme" },
580
+ pt: { full: "Totalmente conforme", partial: "Parcialmente conforme", "non-compliant": "N\xE3o conforme" },
581
+ pl: { full: "W pe\u0142ni zgodny", partial: "Cz\u0119\u015Bciowo zgodny", "non-compliant": "Niezgodny" },
524
582
  "en-gb": { full: "Fully compliant", partial: "Partially compliant", "non-compliant": "Non-compliant" },
525
583
  "en-us": { full: "Fully compliant", partial: "Partially compliant", "non-compliant": "Non-compliant" },
526
584
  "en-ca": { full: "Fully compliant", partial: "Partially compliant", "non-compliant": "Non-compliant" }
@@ -536,6 +594,9 @@ var RESPONSE_TIME_DEFAULT = {
536
594
  fr: "2 jours",
537
595
  es: "2 d\xEDas",
538
596
  nl: "2 dagen",
597
+ it: "2 giorni",
598
+ pt: "2 dias",
599
+ pl: "2 dni",
539
600
  "en-gb": "2 days",
540
601
  "en-us": "2 days",
541
602
  "en-ca": "2 days"
@@ -565,17 +626,35 @@ async function generateStatementContent(result, lang = "en", format = "html", me
565
626
  }
566
627
  });
567
628
  const nonComplianceItems = Array.from(issuesMap.values());
568
- let country = metadata?.country || "SE";
569
- if (!metadata?.country) {
570
- if (result.url.endsWith(".no")) country = "NO";
571
- if (result.url.endsWith(".dk")) country = "DK";
572
- if (result.url.endsWith(".fi")) country = "FI";
573
- if (result.url.endsWith(".de")) country = "DE";
574
- if (result.url.endsWith(".uk")) country = "GB";
575
- if (result.url.endsWith(".us")) country = "US";
576
- if (result.url.endsWith(".ca")) country = "CA";
629
+ let country = "EU";
630
+ if (metadata?.country) {
631
+ country = metadata.country;
632
+ } else {
633
+ const TLD_MAP = {
634
+ "se": "SE",
635
+ "no": "NO",
636
+ "dk": "DK",
637
+ "fi": "FI",
638
+ "de": "DE",
639
+ "fr": "FR",
640
+ "nl": "NL",
641
+ "es": "ES",
642
+ "it": "IT",
643
+ "pt": "PT",
644
+ "pl": "PL",
645
+ "uk": "GB",
646
+ "us": "US",
647
+ "ca": "CA"
648
+ };
649
+ try {
650
+ const hostname = new URL(result.url).hostname;
651
+ const tld = hostname.split(".").pop()?.toLowerCase() || "";
652
+ country = TLD_MAP[tld] ?? "EU";
653
+ } catch {
654
+ country = "EU";
655
+ }
577
656
  }
578
- const sector = "public";
657
+ const sector = metadata?.sector || "public";
579
658
  let logoUrl;
580
659
  try {
581
660
  const possiblePaths = [
@@ -707,7 +786,11 @@ async function generateStatementContent(result, lang = "en", format = "html", me
707
786
  "{<tiers externe>}": props.generatorTool?.name || "HolmDigital Engine",
708
787
  "{<tercero externo>}": props.generatorTool?.name || "HolmDigital Engine",
709
788
  "{<third party>}": props.generatorTool?.name || "HolmDigital Engine",
710
- "{<enforcement_body>}": ENFORCEMENT_BODIES[country] || ENFORCEMENT_BODIES.EU,
789
+ "{<enforcement_body>}": getEnforcementBody(country, sector),
790
+ "{<national_law>}": (() => {
791
+ const law = getNationalLawByFramework(sector === "private" ? "EAA" : "WAD", country);
792
+ return law ? `${law.fullName} (${law.law})` : "";
793
+ })(),
711
794
  "{<brister>}": nonComplianceItems.length > 0 ? nonComplianceItems.map((item) => `* ${item}`).join("\n") : lang === "sv" ? "Inga k\xE4nda brister." : "No known issues.",
712
795
  "{<puutteet>}": nonComplianceItems.length > 0 ? nonComplianceItems.map((item) => `* ${item}`).join("\n") : lang === "fi" ? "Ei tiedossa olevia puutteita." : "No known issues.",
713
796
  "{<gebreken>}": nonComplianceItems.length > 0 ? nonComplianceItems.map((item) => `* ${item}`).join("\n") : lang === "nl" ? "Geen bekende gebreken." : "No known issues.",
@@ -715,6 +798,9 @@ async function generateStatementContent(result, lang = "en", format = "html", me
715
798
  "{<d\xE9fauts>}": nonComplianceItems.length > 0 ? nonComplianceItems.map((item) => `* ${item}`).join("\n") : lang === "fr" ? "Aucun d\xE9faut connu." : "No known issues.",
716
799
  "{<deficiencias>}": nonComplianceItems.length > 0 ? nonComplianceItems.map((item) => `* ${item}`).join("\n") : lang === "es" ? "No hay deficiencias conocidas." : "No known issues.",
717
800
  "{<mangler>}": nonComplianceItems.length > 0 ? nonComplianceItems.map((item) => `* ${item}`).join("\n") : lang === "no" || lang === "da" ? "Ingen kendte mangler." : "No known issues.",
801
+ "{<carenze>}": nonComplianceItems.length > 0 ? nonComplianceItems.map((item) => `* ${item}`).join("\n") : "Nessuna carenza nota.",
802
+ "{<defici\xEAncias>}": nonComplianceItems.length > 0 ? nonComplianceItems.map((item) => `* ${item}`).join("\n") : "Nenhuma defici\xEAncia conhecida.",
803
+ "{<braki>}": nonComplianceItems.length > 0 ? nonComplianceItems.map((item) => `* ${item}`).join("\n") : "Brak znanych problem\xF3w.",
718
804
  "{<issues>}": nonComplianceItems.length > 0 ? nonComplianceItems.map((item) => `* ${item}`).join("\n") : "No known issues."
719
805
  };
720
806
  const processText = (text) => {
@@ -726,7 +812,7 @@ async function generateStatementContent(result, lang = "en", format = "html", me
726
812
  if (content2.includes("{<telefonnummer>}") || content2.includes("{<telephone number>}")) {
727
813
  return props.phoneNumber ? content2 : "";
728
814
  }
729
- if (content2.includes("{<brister>}") || content2.includes("{<mangler>}") || content2.includes("{<issues>}")) {
815
+ if (content2.includes("{<brister>}") || content2.includes("{<mangler>}") || content2.includes("{<issues>}") || content2.includes("{<carenze>}") || content2.includes("{<defici\xEAncias>}") || content2.includes("{<braki>}")) {
730
816
  return complianceLevel !== "full" ? content2 : "";
731
817
  }
732
818
  return content2;
package/dist/cli/index.js CHANGED
@@ -782,7 +782,7 @@ var HtmlValidator = class {
782
782
  // src/core/regulatory-scanner.ts
783
783
  var import_node_fs = require("fs");
784
784
  function getEngineVersion() {
785
- return "2.1.7";
785
+ return "2.3.0";
786
786
  }
787
787
  function getStandardsVersion() {
788
788
  try {
@@ -854,13 +854,16 @@ var RegulatoryScanner = class {
854
854
  }
855
855
  pageTitle = await page.title();
856
856
  pageLanguage = await page.evaluate(() => document.documentElement.lang || void 0);
857
- const pageContent = await page.content();
858
- const htmlValidation = await this.htmlValidator.validate(pageContent);
859
- if (!htmlValidation.valid) {
860
- this.log(`HTML Validation: Found ${htmlValidation.errors.length} structural issues.`);
857
+ let htmlValidation;
858
+ if (!this.options.light) {
859
+ const pageContent = await page.content();
860
+ htmlValidation = await this.htmlValidator.validate(pageContent);
861
+ if (!htmlValidation.valid) {
862
+ this.log(`HTML Validation: Found ${htmlValidation.errors.length} structural issues.`);
863
+ }
864
+ const vDomBuilder = new VirtualDOMBuilder(page);
865
+ await vDomBuilder.build({ includeComputedStyle: ["color", "background-color"] });
861
866
  }
862
- const vDomBuilder = new VirtualDOMBuilder(page);
863
- await vDomBuilder.build({ includeComputedStyle: ["color", "background-color"] });
864
867
  await this.injectAxe(page);
865
868
  this.log("Axe injected. Running analysis...");
866
869
  const axeResults = await page.evaluate(async () => {
@@ -881,10 +884,12 @@ var RegulatoryScanner = class {
881
884
  });
882
885
  this.log(`Raw Axe Violations: ${axeResults.violations?.length || 0}`);
883
886
  passedCount = axeResults.passes?.length || 0;
884
- const regulatoryReports = await this.enrichResults(axeResults);
887
+ const regulatoryReports = this.options.light ? this.enrichResultsLight(axeResults) : await this.enrichResults(axeResults);
885
888
  const scanDuration = Date.now() - startTime;
886
889
  const result = this.generateResultPackage(regulatoryReports, passedCount, scanDuration, pageTitle, pageLanguage);
887
- result.htmlValidation = htmlValidation;
890
+ if (htmlValidation) {
891
+ result.htmlValidation = htmlValidation;
892
+ }
888
893
  return result;
889
894
  } finally {
890
895
  await this.close();
@@ -912,6 +917,53 @@ var RegulatoryScanner = class {
912
917
  const axeSource = import_axe_core.default.source;
913
918
  await page.evaluate(axeSource);
914
919
  }
920
+ /**
921
+ * Light enrichment — maps axe severity directly without standards lookup.
922
+ * Much faster: no async imports, no rule database queries.
923
+ */
924
+ enrichResultsLight(axeResults) {
925
+ const impactToRisk = {
926
+ critical: "critical",
927
+ serious: "high",
928
+ moderate: "medium",
929
+ minor: "low"
930
+ };
931
+ return axeResults.violations.map((violation) => {
932
+ const impact = violation.impact || "moderate";
933
+ const risk = impactToRisk[impact] || "medium";
934
+ return {
935
+ ruleId: violation.id,
936
+ wcagCriteria: violation.tags.find((t2) => t2.startsWith("wcag")) || "Unknown",
937
+ en301549Criteria: "",
938
+ dosLagenReference: "",
939
+ diggRisk: risk,
940
+ eaaImpact: risk,
941
+ remediation: {
942
+ description: violation.help,
943
+ technicalGuidance: violation.description,
944
+ component: void 0
945
+ },
946
+ holmdigitalInsight: {
947
+ diggRisk: risk,
948
+ eaaImpact: risk,
949
+ reasoning: violation.help,
950
+ swedishInterpretation: "",
951
+ priorityRationale: ""
952
+ },
953
+ testability: {
954
+ automated: true,
955
+ requiresManualCheck: false,
956
+ pseudoAutomation: false,
957
+ complexity: "simple"
958
+ },
959
+ failingNodes: violation.nodes.slice(0, 3).map((node) => ({
960
+ html: node.html,
961
+ target: node.target.join(" "),
962
+ failureSummary: node.failureSummary
963
+ }))
964
+ };
965
+ });
966
+ }
915
967
  async enrichResults(axeResults) {
916
968
  const reports = [];
917
969
  const { searchRulesByTags, generateRegulatoryReport, getConvergenceRule } = await import("@holmdigital/standards");
@@ -1490,6 +1542,9 @@ var EVALUATION_METHOD = {
1490
1542
  fr: "Analyse automatis\xE9e via @holmdigital/engine",
1491
1543
  es: "An\xE1lisis automatizado mediante @holmdigital/engine",
1492
1544
  nl: "Geautomatiseerde controle via @holmdigital/engine",
1545
+ it: "Scansione automatizzata tramite @holmdigital/engine",
1546
+ pt: "Verifica\xE7\xE3o automatizada via @holmdigital/engine",
1547
+ pl: "Automatyczne skanowanie za pomoc\u0105 @holmdigital/engine",
1493
1548
  "en-gb": "Automated scan via @holmdigital/engine",
1494
1549
  "en-us": "Automated scan via @holmdigital/engine",
1495
1550
  "en-ca": "Automated scan via @holmdigital/engine"
@@ -1505,6 +1560,9 @@ var STATUS_LABELS = {
1505
1560
  fr: { full: "Totalement conforme", partial: "Partiellement conforme", "non-compliant": "Non conforme" },
1506
1561
  es: { full: "Plenamente conforme", partial: "Parcialmente conforme", "non-compliant": "No conforme" },
1507
1562
  nl: { full: "Volledig conform", partial: "Gedeeltelijk conform", "non-compliant": "Niet conform" },
1563
+ it: { full: "Pienamente conforme", partial: "Parzialmente conforme", "non-compliant": "Non conforme" },
1564
+ pt: { full: "Totalmente conforme", partial: "Parcialmente conforme", "non-compliant": "N\xE3o conforme" },
1565
+ pl: { full: "W pe\u0142ni zgodny", partial: "Cz\u0119\u015Bciowo zgodny", "non-compliant": "Niezgodny" },
1508
1566
  "en-gb": { full: "Fully compliant", partial: "Partially compliant", "non-compliant": "Non-compliant" },
1509
1567
  "en-us": { full: "Fully compliant", partial: "Partially compliant", "non-compliant": "Non-compliant" },
1510
1568
  "en-ca": { full: "Fully compliant", partial: "Partially compliant", "non-compliant": "Non-compliant" }
@@ -1520,6 +1578,9 @@ var RESPONSE_TIME_DEFAULT = {
1520
1578
  fr: "2 jours",
1521
1579
  es: "2 d\xEDas",
1522
1580
  nl: "2 dagen",
1581
+ it: "2 giorni",
1582
+ pt: "2 dias",
1583
+ pl: "2 dni",
1523
1584
  "en-gb": "2 days",
1524
1585
  "en-us": "2 days",
1525
1586
  "en-ca": "2 days"
@@ -1549,17 +1610,35 @@ async function generateStatementContent(result, lang = "en", format = "html", me
1549
1610
  }
1550
1611
  });
1551
1612
  const nonComplianceItems = Array.from(issuesMap.values());
1552
- let country = metadata?.country || "SE";
1553
- if (!metadata?.country) {
1554
- if (result.url.endsWith(".no")) country = "NO";
1555
- if (result.url.endsWith(".dk")) country = "DK";
1556
- if (result.url.endsWith(".fi")) country = "FI";
1557
- if (result.url.endsWith(".de")) country = "DE";
1558
- if (result.url.endsWith(".uk")) country = "GB";
1559
- if (result.url.endsWith(".us")) country = "US";
1560
- if (result.url.endsWith(".ca")) country = "CA";
1613
+ let country = "EU";
1614
+ if (metadata?.country) {
1615
+ country = metadata.country;
1616
+ } else {
1617
+ const TLD_MAP = {
1618
+ "se": "SE",
1619
+ "no": "NO",
1620
+ "dk": "DK",
1621
+ "fi": "FI",
1622
+ "de": "DE",
1623
+ "fr": "FR",
1624
+ "nl": "NL",
1625
+ "es": "ES",
1626
+ "it": "IT",
1627
+ "pt": "PT",
1628
+ "pl": "PL",
1629
+ "uk": "GB",
1630
+ "us": "US",
1631
+ "ca": "CA"
1632
+ };
1633
+ try {
1634
+ const hostname = new URL(result.url).hostname;
1635
+ const tld = hostname.split(".").pop()?.toLowerCase() || "";
1636
+ country = TLD_MAP[tld] ?? "EU";
1637
+ } catch {
1638
+ country = "EU";
1639
+ }
1561
1640
  }
1562
- const sector = "public";
1641
+ const sector = metadata?.sector || "public";
1563
1642
  let logoUrl;
1564
1643
  try {
1565
1644
  const possiblePaths = [
@@ -1691,7 +1770,11 @@ async function generateStatementContent(result, lang = "en", format = "html", me
1691
1770
  "{<tiers externe>}": props.generatorTool?.name || "HolmDigital Engine",
1692
1771
  "{<tercero externo>}": props.generatorTool?.name || "HolmDigital Engine",
1693
1772
  "{<third party>}": props.generatorTool?.name || "HolmDigital Engine",
1694
- "{<enforcement_body>}": import_standards.ENFORCEMENT_BODIES[country] || import_standards.ENFORCEMENT_BODIES.EU,
1773
+ "{<enforcement_body>}": (0, import_standards.getEnforcementBody)(country, sector),
1774
+ "{<national_law>}": (() => {
1775
+ const law = (0, import_standards.getNationalLawByFramework)(sector === "private" ? "EAA" : "WAD", country);
1776
+ return law ? `${law.fullName} (${law.law})` : "";
1777
+ })(),
1695
1778
  "{<brister>}": nonComplianceItems.length > 0 ? nonComplianceItems.map((item) => `* ${item}`).join("\n") : lang === "sv" ? "Inga k\xE4nda brister." : "No known issues.",
1696
1779
  "{<puutteet>}": nonComplianceItems.length > 0 ? nonComplianceItems.map((item) => `* ${item}`).join("\n") : lang === "fi" ? "Ei tiedossa olevia puutteita." : "No known issues.",
1697
1780
  "{<gebreken>}": nonComplianceItems.length > 0 ? nonComplianceItems.map((item) => `* ${item}`).join("\n") : lang === "nl" ? "Geen bekende gebreken." : "No known issues.",
@@ -1699,6 +1782,9 @@ async function generateStatementContent(result, lang = "en", format = "html", me
1699
1782
  "{<d\xE9fauts>}": nonComplianceItems.length > 0 ? nonComplianceItems.map((item) => `* ${item}`).join("\n") : lang === "fr" ? "Aucun d\xE9faut connu." : "No known issues.",
1700
1783
  "{<deficiencias>}": nonComplianceItems.length > 0 ? nonComplianceItems.map((item) => `* ${item}`).join("\n") : lang === "es" ? "No hay deficiencias conocidas." : "No known issues.",
1701
1784
  "{<mangler>}": nonComplianceItems.length > 0 ? nonComplianceItems.map((item) => `* ${item}`).join("\n") : lang === "no" || lang === "da" ? "Ingen kendte mangler." : "No known issues.",
1785
+ "{<carenze>}": nonComplianceItems.length > 0 ? nonComplianceItems.map((item) => `* ${item}`).join("\n") : "Nessuna carenza nota.",
1786
+ "{<defici\xEAncias>}": nonComplianceItems.length > 0 ? nonComplianceItems.map((item) => `* ${item}`).join("\n") : "Nenhuma defici\xEAncia conhecida.",
1787
+ "{<braki>}": nonComplianceItems.length > 0 ? nonComplianceItems.map((item) => `* ${item}`).join("\n") : "Brak znanych problem\xF3w.",
1702
1788
  "{<issues>}": nonComplianceItems.length > 0 ? nonComplianceItems.map((item) => `* ${item}`).join("\n") : "No known issues."
1703
1789
  };
1704
1790
  const processText = (text) => {
@@ -1710,7 +1796,7 @@ async function generateStatementContent(result, lang = "en", format = "html", me
1710
1796
  if (content2.includes("{<telefonnummer>}") || content2.includes("{<telephone number>}")) {
1711
1797
  return props.phoneNumber ? content2 : "";
1712
1798
  }
1713
- if (content2.includes("{<brister>}") || content2.includes("{<mangler>}") || content2.includes("{<issues>}")) {
1799
+ if (content2.includes("{<brister>}") || content2.includes("{<mangler>}") || content2.includes("{<issues>}") || content2.includes("{<carenze>}") || content2.includes("{<defici\xEAncias>}") || content2.includes("{<braki>}")) {
1714
1800
  return complianceLevel !== "full" ? content2 : "";
1715
1801
  }
1716
1802
  return content2;
@@ -1847,7 +1933,7 @@ function isValidUrl(urlString) {
1847
1933
  }
1848
1934
  var program = new import_commander.Command();
1849
1935
  program.name("hd-a11y-scan").description("HolmDigital Regulatory Scanner").version(getEngineVersion());
1850
- program.argument("<url>", "URL to scan").option("--lang <code>", "Language code (en, sv)").option("--ci", "Run in CI/CD mode (exit code 1 on critical failures)").option("--generate-tests", "Generate Pseudo-Automation tests").option("--json", "Output as JSON").option("--junit <path>", "Generate JUnit XML report").option("--pdf <path>", "Generate PDF report to path").option("--statement <path>", "Generate accessibility statement HTML to path").option("--format <type>", "Output format for statement (html, md)", "html").option("--viewport <size>", 'Set viewport (e.g. "mobile", "desktop", "1024x768")').option("--threshold <level>", "Severity threshold (critical, high, medium, low)").option("--api-key <key>", "API key for HolmDigital Cloud").option("--cloud-url <url>", "Cloud API URL").option("--invalid-https-cert", "Allow scanning on pages with invalid https certificate").option("--email <email>", "Contact email for accessibility statement").option("--phone <number>", "Contact phone number for accessibility statement").option("--org <name>", "Organization name for accessibility statement").option("--response-time <time>", "Expected response time for accessibility statement").option("--country <code>", "Country code for accessibility statement enforcement body").option("--publish-date <date>", "Publish date for the website (YYYY-MM-DD)").action(async (url, cliOptions) => {
1936
+ program.argument("<url>", "URL to scan").option("--lang <code>", "Language code (en, sv)").option("--ci", "Run in CI/CD mode (exit code 1 on critical failures)").option("--generate-tests", "Generate Pseudo-Automation tests").option("--json", "Output as JSON").option("--junit <path>", "Generate JUnit XML report").option("--pdf <path>", "Generate PDF report to path").option("--statement <path>", "Generate accessibility statement HTML to path").option("--format <type>", "Output format for statement (html, md)", "html").option("--viewport <size>", 'Set viewport (e.g. "mobile", "desktop", "1024x768")').option("--threshold <level>", "Severity threshold (critical, high, medium, low)").option("--api-key <key>", "API key for HolmDigital Cloud").option("--cloud-url <url>", "Cloud API URL").option("--invalid-https-cert", "Allow scanning on pages with invalid https certificate").option("--email <email>", "Contact email for accessibility statement").option("--phone <number>", "Contact phone number for accessibility statement").option("--org <name>", "Organization name for accessibility statement").option("--response-time <time>", "Expected response time for accessibility statement").option("--country <code>", "Country code for accessibility statement enforcement body").option("--sector <type>", "Sector type: public (WAD) or private (EAA)", "public").option("--publish-date <date>", "Publish date for the website (YYYY-MM-DD)").option("--light", "Light scan: fast score-only mode (skips HTML validation and detailed legal mapping)").action(async (url, cliOptions) => {
1851
1937
  const explorer = (0, import_cosmiconfig.cosmiconfig)("a11y");
1852
1938
  const configResult = await explorer.search();
1853
1939
  const fileConfig = configResult ? configResult.config : {};
@@ -1872,7 +1958,9 @@ program.argument("<url>", "URL to scan").option("--lang <code>", "Language code
1872
1958
  org: cliOptions.org || fileConfig.org,
1873
1959
  responseTime: cliOptions.responseTime || fileConfig.responseTime,
1874
1960
  country: cliOptions.country || fileConfig.country,
1875
- publishDate: cliOptions.publishDate || fileConfig.publishDate
1961
+ sector: cliOptions.sector || fileConfig.sector || "public",
1962
+ publishDate: cliOptions.publishDate || fileConfig.publishDate,
1963
+ light: cliOptions.light ?? fileConfig.light ?? false
1876
1964
  };
1877
1965
  setLanguage(options.lang);
1878
1966
  if (!isValidUrl(url)) {
@@ -1901,10 +1989,10 @@ program.argument("<url>", "URL to scan").option("--lang <code>", "Language code
1901
1989
  url,
1902
1990
  failOnCritical: options.ci,
1903
1991
  viewport,
1904
- silent: options.json,
1905
- // Suppress debug output for JSON mode
1992
+ silent: options.json || options.light,
1906
1993
  severityThreshold: options.threshold,
1907
- invalidHttpsCert: options.invalidHttpsCert
1994
+ invalidHttpsCert: options.invalidHttpsCert,
1995
+ light: options.light
1908
1996
  });
1909
1997
  if (spinner) spinner.text = t("cli.analyzing");
1910
1998
  const result = await scanner.scan();
@@ -1923,6 +2011,7 @@ program.argument("<url>", "URL to scan").option("--lang <code>", "Language code
1923
2011
  organizationName: options.org,
1924
2012
  responseTime: options.responseTime,
1925
2013
  country: options.country,
2014
+ sector: options.sector,
1926
2015
  publishDate: options.publishDate
1927
2016
  };
1928
2017
  if (options.statement.toLowerCase().endsWith(".pdf")) {
@@ -1933,8 +2022,38 @@ program.argument("<url>", "URL to scan").option("--lang <code>", "Language code
1933
2022
  }
1934
2023
  if (spinner) spinner.succeed(t("cli.statement_saved", { path: options.statement }));
1935
2024
  }
1936
- if (options.json) {
2025
+ if (options.json && options.light) {
2026
+ const lightResult = {
2027
+ url: result.url,
2028
+ score: result.score,
2029
+ complianceStatus: result.complianceStatus,
2030
+ stats: result.stats,
2031
+ scanDuration: result.metadata.scanDuration,
2032
+ topIssues: result.reports.slice(0, 5).map((r) => ({
2033
+ id: r.ruleId,
2034
+ impact: r.holmdigitalInsight.diggRisk,
2035
+ description: r.remediation.description
2036
+ }))
2037
+ };
2038
+ console.log(JSON.stringify(lightResult, null, 2));
2039
+ } else if (options.json) {
1937
2040
  console.log(JSON.stringify(result, null, 2));
2041
+ } else if (options.light) {
2042
+ const scoreColor = result.score >= 90 ? import_chalk.default.green : result.score >= 70 ? import_chalk.default.yellow : import_chalk.default.red;
2043
+ const statusColor = result.complianceStatus === "PASS" ? import_chalk.default.green : import_chalk.default.red;
2044
+ console.log("");
2045
+ console.log(import_chalk.default.bold(`Score: ${scoreColor(`${result.score}/100`)} Status: ${statusColor(result.complianceStatus)}`));
2046
+ console.log(import_chalk.default.gray(`Critical: ${result.stats.critical} | High: ${result.stats.high} | Medium: ${result.stats.medium} | Low: ${result.stats.low}`));
2047
+ if (result.reports.length > 0) {
2048
+ console.log("");
2049
+ console.log(import_chalk.default.bold("Top Issues:"));
2050
+ result.reports.slice(0, 5).forEach((r) => {
2051
+ const color = r.holmdigitalInsight.diggRisk === "critical" ? import_chalk.default.red : r.holmdigitalInsight.diggRisk === "high" ? import_chalk.default.yellow : import_chalk.default.gray;
2052
+ console.log(color(` [${r.holmdigitalInsight.diggRisk.toUpperCase()}] ${r.ruleId} \u2014 ${r.remediation.description}`));
2053
+ });
2054
+ }
2055
+ console.log(import_chalk.default.gray(`
2056
+ Scan: ${result.metadata.scanDuration}ms | ${result.metadata.engineVersion}`));
1938
2057
  } else {
1939
2058
  console.log("\n");
1940
2059
  const scoreColor = result.score >= 90 ? import_chalk.default.green : result.score >= 70 ? import_chalk.default.yellow : import_chalk.default.red;
@@ -7,7 +7,7 @@ import {
7
7
  generateStatement,
8
8
  generateStatementContent,
9
9
  getEngineVersion
10
- } from "../chunk-BXSPTSSZ.mjs";
10
+ } from "../chunk-IOEDG67O.mjs";
11
11
  import {
12
12
  getCurrentLang,
13
13
  setLanguage,
@@ -442,7 +442,7 @@ function isValidUrl(urlString) {
442
442
  }
443
443
  var program = new Command();
444
444
  program.name("hd-a11y-scan").description("HolmDigital Regulatory Scanner").version(getEngineVersion());
445
- program.argument("<url>", "URL to scan").option("--lang <code>", "Language code (en, sv)").option("--ci", "Run in CI/CD mode (exit code 1 on critical failures)").option("--generate-tests", "Generate Pseudo-Automation tests").option("--json", "Output as JSON").option("--junit <path>", "Generate JUnit XML report").option("--pdf <path>", "Generate PDF report to path").option("--statement <path>", "Generate accessibility statement HTML to path").option("--format <type>", "Output format for statement (html, md)", "html").option("--viewport <size>", 'Set viewport (e.g. "mobile", "desktop", "1024x768")').option("--threshold <level>", "Severity threshold (critical, high, medium, low)").option("--api-key <key>", "API key for HolmDigital Cloud").option("--cloud-url <url>", "Cloud API URL").option("--invalid-https-cert", "Allow scanning on pages with invalid https certificate").option("--email <email>", "Contact email for accessibility statement").option("--phone <number>", "Contact phone number for accessibility statement").option("--org <name>", "Organization name for accessibility statement").option("--response-time <time>", "Expected response time for accessibility statement").option("--country <code>", "Country code for accessibility statement enforcement body").option("--publish-date <date>", "Publish date for the website (YYYY-MM-DD)").action(async (url, cliOptions) => {
445
+ program.argument("<url>", "URL to scan").option("--lang <code>", "Language code (en, sv)").option("--ci", "Run in CI/CD mode (exit code 1 on critical failures)").option("--generate-tests", "Generate Pseudo-Automation tests").option("--json", "Output as JSON").option("--junit <path>", "Generate JUnit XML report").option("--pdf <path>", "Generate PDF report to path").option("--statement <path>", "Generate accessibility statement HTML to path").option("--format <type>", "Output format for statement (html, md)", "html").option("--viewport <size>", 'Set viewport (e.g. "mobile", "desktop", "1024x768")').option("--threshold <level>", "Severity threshold (critical, high, medium, low)").option("--api-key <key>", "API key for HolmDigital Cloud").option("--cloud-url <url>", "Cloud API URL").option("--invalid-https-cert", "Allow scanning on pages with invalid https certificate").option("--email <email>", "Contact email for accessibility statement").option("--phone <number>", "Contact phone number for accessibility statement").option("--org <name>", "Organization name for accessibility statement").option("--response-time <time>", "Expected response time for accessibility statement").option("--country <code>", "Country code for accessibility statement enforcement body").option("--sector <type>", "Sector type: public (WAD) or private (EAA)", "public").option("--publish-date <date>", "Publish date for the website (YYYY-MM-DD)").option("--light", "Light scan: fast score-only mode (skips HTML validation and detailed legal mapping)").action(async (url, cliOptions) => {
446
446
  const explorer = cosmiconfig("a11y");
447
447
  const configResult = await explorer.search();
448
448
  const fileConfig = configResult ? configResult.config : {};
@@ -467,7 +467,9 @@ program.argument("<url>", "URL to scan").option("--lang <code>", "Language code
467
467
  org: cliOptions.org || fileConfig.org,
468
468
  responseTime: cliOptions.responseTime || fileConfig.responseTime,
469
469
  country: cliOptions.country || fileConfig.country,
470
- publishDate: cliOptions.publishDate || fileConfig.publishDate
470
+ sector: cliOptions.sector || fileConfig.sector || "public",
471
+ publishDate: cliOptions.publishDate || fileConfig.publishDate,
472
+ light: cliOptions.light ?? fileConfig.light ?? false
471
473
  };
472
474
  setLanguage(options.lang);
473
475
  if (!isValidUrl(url)) {
@@ -496,10 +498,10 @@ program.argument("<url>", "URL to scan").option("--lang <code>", "Language code
496
498
  url,
497
499
  failOnCritical: options.ci,
498
500
  viewport,
499
- silent: options.json,
500
- // Suppress debug output for JSON mode
501
+ silent: options.json || options.light,
501
502
  severityThreshold: options.threshold,
502
- invalidHttpsCert: options.invalidHttpsCert
503
+ invalidHttpsCert: options.invalidHttpsCert,
504
+ light: options.light
503
505
  });
504
506
  if (spinner) spinner.text = t("cli.analyzing");
505
507
  const result = await scanner.scan();
@@ -518,6 +520,7 @@ program.argument("<url>", "URL to scan").option("--lang <code>", "Language code
518
520
  organizationName: options.org,
519
521
  responseTime: options.responseTime,
520
522
  country: options.country,
523
+ sector: options.sector,
521
524
  publishDate: options.publishDate
522
525
  };
523
526
  if (options.statement.toLowerCase().endsWith(".pdf")) {
@@ -528,8 +531,38 @@ program.argument("<url>", "URL to scan").option("--lang <code>", "Language code
528
531
  }
529
532
  if (spinner) spinner.succeed(t("cli.statement_saved", { path: options.statement }));
530
533
  }
531
- if (options.json) {
534
+ if (options.json && options.light) {
535
+ const lightResult = {
536
+ url: result.url,
537
+ score: result.score,
538
+ complianceStatus: result.complianceStatus,
539
+ stats: result.stats,
540
+ scanDuration: result.metadata.scanDuration,
541
+ topIssues: result.reports.slice(0, 5).map((r) => ({
542
+ id: r.ruleId,
543
+ impact: r.holmdigitalInsight.diggRisk,
544
+ description: r.remediation.description
545
+ }))
546
+ };
547
+ console.log(JSON.stringify(lightResult, null, 2));
548
+ } else if (options.json) {
532
549
  console.log(JSON.stringify(result, null, 2));
550
+ } else if (options.light) {
551
+ const scoreColor = result.score >= 90 ? chalk.green : result.score >= 70 ? chalk.yellow : chalk.red;
552
+ const statusColor = result.complianceStatus === "PASS" ? chalk.green : chalk.red;
553
+ console.log("");
554
+ console.log(chalk.bold(`Score: ${scoreColor(`${result.score}/100`)} Status: ${statusColor(result.complianceStatus)}`));
555
+ console.log(chalk.gray(`Critical: ${result.stats.critical} | High: ${result.stats.high} | Medium: ${result.stats.medium} | Low: ${result.stats.low}`));
556
+ if (result.reports.length > 0) {
557
+ console.log("");
558
+ console.log(chalk.bold("Top Issues:"));
559
+ result.reports.slice(0, 5).forEach((r) => {
560
+ const color = r.holmdigitalInsight.diggRisk === "critical" ? chalk.red : r.holmdigitalInsight.diggRisk === "high" ? chalk.yellow : chalk.gray;
561
+ console.log(color(` [${r.holmdigitalInsight.diggRisk.toUpperCase()}] ${r.ruleId} \u2014 ${r.remediation.description}`));
562
+ });
563
+ }
564
+ console.log(chalk.gray(`
565
+ Scan: ${result.metadata.scanDuration}ms | ${result.metadata.engineVersion}`));
533
566
  } else {
534
567
  console.log("\n");
535
568
  const scoreColor = result.score >= 90 ? chalk.green : result.score >= 70 ? chalk.yellow : chalk.red;