@holmdigital/engine 2.5.6 → 2.6.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/dist/{chunk-YI5WLSPC.mjs → chunk-AE5DGJCS.mjs} +2 -2
- package/dist/{chunk-FBGKWDZT.mjs → chunk-TT3JDVGJ.mjs} +189 -0
- package/dist/cli/index.js +674 -61
- package/dist/cli/index.mjs +362 -17
- package/dist/{i18n-ZLEGILHH.mjs → i18n-SE7FLXIF.mjs} +1 -1
- package/dist/index.d.mts +23 -1
- package/dist/index.d.ts +23 -1
- package/dist/index.js +190 -1
- package/dist/index.mjs +2 -2
- package/dist/plain-report-AK5QAT5P.mjs +77 -0
- package/package.json +2 -2
package/dist/cli/index.mjs
CHANGED
|
@@ -7,13 +7,15 @@ import {
|
|
|
7
7
|
generateStatement,
|
|
8
8
|
generateStatementContent,
|
|
9
9
|
getEngineVersion
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-AE5DGJCS.mjs";
|
|
11
11
|
import {
|
|
12
12
|
getCurrentLang,
|
|
13
13
|
setLanguage,
|
|
14
14
|
t
|
|
15
|
-
} from "../chunk-
|
|
16
|
-
import
|
|
15
|
+
} from "../chunk-TT3JDVGJ.mjs";
|
|
16
|
+
import {
|
|
17
|
+
__dirname
|
|
18
|
+
} from "../chunk-DIBTSSLZ.mjs";
|
|
17
19
|
|
|
18
20
|
// src/cli/index.ts
|
|
19
21
|
import { Command } from "commander";
|
|
@@ -21,6 +23,8 @@ import chalk from "chalk";
|
|
|
21
23
|
import ora from "ora";
|
|
22
24
|
|
|
23
25
|
// src/reporting/html-template.ts
|
|
26
|
+
import { readFileSync } from "fs";
|
|
27
|
+
import { join } from "path";
|
|
24
28
|
var LOCALE_TO_INTL = {
|
|
25
29
|
sv: "sv-SE",
|
|
26
30
|
en: "en-US",
|
|
@@ -37,21 +41,27 @@ var LOCALE_TO_INTL = {
|
|
|
37
41
|
"en-us": "en-US",
|
|
38
42
|
"en-ca": "en-CA"
|
|
39
43
|
};
|
|
40
|
-
function
|
|
44
|
+
function formatDate(dateString) {
|
|
45
|
+
const intlLocale = LOCALE_TO_INTL[getCurrentLang()] || "en-US";
|
|
46
|
+
return new Date(dateString).toLocaleDateString(intlLocale, {
|
|
47
|
+
year: "numeric",
|
|
48
|
+
month: "long",
|
|
49
|
+
day: "numeric",
|
|
50
|
+
hour: "2-digit",
|
|
51
|
+
minute: "2-digit"
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
function escapeHtml(str) {
|
|
55
|
+
return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
56
|
+
}
|
|
57
|
+
function generateReportHTML(result, sector = "public", audience = "developer") {
|
|
58
|
+
if (audience === "plain") {
|
|
59
|
+
return generatePlainReportHTML(result);
|
|
60
|
+
}
|
|
41
61
|
const criticalCount = result.stats.critical;
|
|
42
62
|
const highCount = result.stats.high;
|
|
43
63
|
const htmlErrorsCount = result.htmlValidation?.errors?.length ?? 0;
|
|
44
64
|
const scoreColor = result.score > 90 ? "#16a34a" : result.score > 70 ? "#eab308" : "#dc2626";
|
|
45
|
-
const formatDate = (dateString) => {
|
|
46
|
-
const intlLocale = LOCALE_TO_INTL[getCurrentLang()] || "en-US";
|
|
47
|
-
return new Date(dateString).toLocaleDateString(intlLocale, {
|
|
48
|
-
year: "numeric",
|
|
49
|
-
month: "long",
|
|
50
|
-
day: "numeric",
|
|
51
|
-
hour: "2-digit",
|
|
52
|
-
minute: "2-digit"
|
|
53
|
-
});
|
|
54
|
-
};
|
|
55
65
|
return `
|
|
56
66
|
<!DOCTYPE html>
|
|
57
67
|
<html lang="${getCurrentLang()}">
|
|
@@ -326,6 +336,336 @@ function generateReportHTML(result, sector = "public") {
|
|
|
326
336
|
</html>
|
|
327
337
|
`;
|
|
328
338
|
}
|
|
339
|
+
var PLAIN_IMPACT_ORDER = {
|
|
340
|
+
"stoppar-kop": 0,
|
|
341
|
+
"hindrar": 1,
|
|
342
|
+
"forsamrar": 2,
|
|
343
|
+
"putsning": 3
|
|
344
|
+
};
|
|
345
|
+
var PLAIN_RISK_TO_IMPACT = {
|
|
346
|
+
critical: "stoppar-kop",
|
|
347
|
+
high: "hindrar",
|
|
348
|
+
medium: "forsamrar",
|
|
349
|
+
low: "putsning"
|
|
350
|
+
};
|
|
351
|
+
var PLAIN_BADGE_CLASS = {
|
|
352
|
+
"stoppar-kop": "badge-stoppar-kop",
|
|
353
|
+
"hindrar": "badge-hindrar",
|
|
354
|
+
"forsamrar": "badge-forsamrar",
|
|
355
|
+
"putsning": "badge-putsning"
|
|
356
|
+
};
|
|
357
|
+
var PLAIN_BADGE_KEY = {
|
|
358
|
+
"stoppar-kop": "plain.badge_stoppar_kop",
|
|
359
|
+
"hindrar": "plain.badge_hindrar",
|
|
360
|
+
"forsamrar": "plain.badge_forsamrar",
|
|
361
|
+
"putsning": "plain.badge_putsning"
|
|
362
|
+
};
|
|
363
|
+
function plainLevelOf(report) {
|
|
364
|
+
return report.plainLanguage?.impactLevel ?? PLAIN_RISK_TO_IMPACT[report.holmdigitalInsight.diggRisk] ?? "putsning";
|
|
365
|
+
}
|
|
366
|
+
var cachedLogoDataUri = null;
|
|
367
|
+
function getLogoDataUri() {
|
|
368
|
+
if (cachedLogoDataUri !== null) {
|
|
369
|
+
return cachedLogoDataUri;
|
|
370
|
+
}
|
|
371
|
+
const candidates = [
|
|
372
|
+
join(__dirname, "assets", "logo.jpg"),
|
|
373
|
+
// dist/ and dist/cli/ (copy-assets.mjs)
|
|
374
|
+
join(__dirname, "..", "assets", "logo.jpg")
|
|
375
|
+
// src tree (dev/tests)
|
|
376
|
+
];
|
|
377
|
+
for (const candidate of candidates) {
|
|
378
|
+
try {
|
|
379
|
+
const buffer = readFileSync(candidate);
|
|
380
|
+
cachedLogoDataUri = `data:image/jpeg;base64,${buffer.toString("base64")}`;
|
|
381
|
+
return cachedLogoDataUri;
|
|
382
|
+
} catch {
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
cachedLogoDataUri = "";
|
|
386
|
+
return cachedLogoDataUri;
|
|
387
|
+
}
|
|
388
|
+
function generatePlainReportHTML(result) {
|
|
389
|
+
const lang = getCurrentLang();
|
|
390
|
+
const safeUrl = escapeHtml(result.url);
|
|
391
|
+
const logoDataUri = getLogoDataUri();
|
|
392
|
+
const sortedReports = [...result.reports].sort((a, b) => {
|
|
393
|
+
const aLevel = PLAIN_IMPACT_ORDER[plainLevelOf(a)] ?? 4;
|
|
394
|
+
const bLevel = PLAIN_IMPACT_ORDER[plainLevelOf(b)] ?? 4;
|
|
395
|
+
return aLevel - bLevel;
|
|
396
|
+
});
|
|
397
|
+
const count = sortedReports.length;
|
|
398
|
+
const unit = count === 1 ? t("plain.intro_unit_singular") : t("plain.intro_unit_plural");
|
|
399
|
+
const itemsHtml = sortedReports.length === 0 ? `<p>${t("plain.empty_state")}</p>` : `<ul class="issue-list">
|
|
400
|
+
${sortedReports.map((rawReport) => {
|
|
401
|
+
const report = rawReport;
|
|
402
|
+
const level = plainLevelOf(report);
|
|
403
|
+
const badgeClass = PLAIN_BADGE_CLASS[level];
|
|
404
|
+
const cardClass = `issue-item--${level}`;
|
|
405
|
+
const badgeText = escapeHtml(t(PLAIN_BADGE_KEY[level]));
|
|
406
|
+
const pl = report.plainLanguage;
|
|
407
|
+
if (pl) {
|
|
408
|
+
return ` <li class="issue-item ${cardClass}">
|
|
409
|
+
<span class="badge ${badgeClass}">${badgeText}</span>
|
|
410
|
+
<strong class="issue-id">${escapeHtml(report.ruleId)}</strong>
|
|
411
|
+
<dl class="issue-fields">
|
|
412
|
+
<dt>${t("plain.what_happens")}</dt><dd>${escapeHtml(pl.whatHappens)}</dd>
|
|
413
|
+
<dt>${t("plain.who_is_affected")}</dt><dd>${escapeHtml(pl.whoIsAffected)}</dd>
|
|
414
|
+
<dt>${t("plain.business_impact")}</dt><dd>${escapeHtml(pl.businessImpact)}</dd>
|
|
415
|
+
<dt>${t("plain.how_to_fix")}</dt><dd>${escapeHtml(pl.howToFix)}</dd>
|
|
416
|
+
</dl>
|
|
417
|
+
</li>`;
|
|
418
|
+
} else {
|
|
419
|
+
return ` <li class="issue-item ${cardClass}">
|
|
420
|
+
<span class="badge ${badgeClass}">${badgeText}</span>
|
|
421
|
+
<strong class="issue-id">${escapeHtml(report.ruleId)}</strong>
|
|
422
|
+
<p class="issue-fallback"><span class="fallback-framing">${escapeHtml(t("plain.fallback_framing"))}</span> ${escapeHtml(report.remediation.description)}</p>
|
|
423
|
+
</li>`;
|
|
424
|
+
}
|
|
425
|
+
}).join("\n")}
|
|
426
|
+
</ul>`;
|
|
427
|
+
return `<!DOCTYPE html>
|
|
428
|
+
<html lang="${lang}">
|
|
429
|
+
<head>
|
|
430
|
+
<meta charset="UTF-8">
|
|
431
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
432
|
+
<title>${t("plain.report_title", { url: safeUrl })}</title>
|
|
433
|
+
<style>
|
|
434
|
+
/* ---- Per-page margins (Task G): every printed page, incl. 2+, gets
|
|
435
|
+
breathing room at top/bottom. An author-level @page rule overrides
|
|
436
|
+
the zero margins passed to Puppeteer's pdf() call, and it travels
|
|
437
|
+
with THIS document only \u2014 the developer PDF is unaffected.
|
|
438
|
+
Bottom margin enlarged (Task H2): reserves footer height + ~8mm
|
|
439
|
+
so flowing content never overlaps the fixed per-page footer. ---- */
|
|
440
|
+
@page {
|
|
441
|
+
margin: 14mm 12mm 22mm;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
/* ---- Reset & base ---- */
|
|
445
|
+
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
|
446
|
+
body {
|
|
447
|
+
font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
|
|
448
|
+
background: #ffffff;
|
|
449
|
+
color: #334155;
|
|
450
|
+
font-size: 14px;
|
|
451
|
+
line-height: 1.6;
|
|
452
|
+
-webkit-print-color-adjust: exact;
|
|
453
|
+
print-color-adjust: exact;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
/* ---- Page-1 header (Task H1/I): light wiki style \u2014 white band, top
|
|
457
|
+
accent line, real HolmDigital logo (embedded data URI). In
|
|
458
|
+
normal flow, so it renders once on page 1 and is NOT repeated. ---- */
|
|
459
|
+
.report-header {
|
|
460
|
+
background: #ffffff;
|
|
461
|
+
border-top: 3px solid #0369a1;
|
|
462
|
+
border-bottom: 1px solid #e2e8f0;
|
|
463
|
+
padding: 1.1rem 0 1.25rem;
|
|
464
|
+
-webkit-print-color-adjust: exact;
|
|
465
|
+
print-color-adjust: exact;
|
|
466
|
+
}
|
|
467
|
+
.report-header__row {
|
|
468
|
+
display: flex;
|
|
469
|
+
justify-content: space-between;
|
|
470
|
+
align-items: flex-start;
|
|
471
|
+
gap: 2rem;
|
|
472
|
+
margin-bottom: 1.1rem;
|
|
473
|
+
}
|
|
474
|
+
.brand__logo {
|
|
475
|
+
display: block;
|
|
476
|
+
width: 160px;
|
|
477
|
+
height: auto;
|
|
478
|
+
}
|
|
479
|
+
.brand__tagline {
|
|
480
|
+
font-size: 0.6rem;
|
|
481
|
+
font-weight: 600;
|
|
482
|
+
letter-spacing: 0.14em;
|
|
483
|
+
text-transform: uppercase;
|
|
484
|
+
color: #64748b;
|
|
485
|
+
margin-top: 0.35rem;
|
|
486
|
+
}
|
|
487
|
+
.report-header__meta {
|
|
488
|
+
text-align: right;
|
|
489
|
+
font-size: 0.75rem;
|
|
490
|
+
color: #64748b;
|
|
491
|
+
line-height: 1.8;
|
|
492
|
+
white-space: nowrap;
|
|
493
|
+
flex-shrink: 0;
|
|
494
|
+
}
|
|
495
|
+
.report-header__title {
|
|
496
|
+
font-size: 1.45rem;
|
|
497
|
+
font-weight: 700;
|
|
498
|
+
color: #0f172a;
|
|
499
|
+
line-height: 1.3;
|
|
500
|
+
word-break: break-all;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
/* ---- Page body wrapper: sides + bottom now come from @page margins ---- */
|
|
504
|
+
.report-body {
|
|
505
|
+
max-width: 840px;
|
|
506
|
+
margin: 0 auto;
|
|
507
|
+
padding: 1.75rem 0 0;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
/* ---- Intro paragraph ---- */
|
|
511
|
+
.intro {
|
|
512
|
+
margin-bottom: 2rem;
|
|
513
|
+
}
|
|
514
|
+
.intro p {
|
|
515
|
+
color: #334155;
|
|
516
|
+
line-height: 1.7;
|
|
517
|
+
margin-bottom: 0.5rem;
|
|
518
|
+
}
|
|
519
|
+
.intro p:first-child {
|
|
520
|
+
font-size: 1rem;
|
|
521
|
+
font-weight: 500;
|
|
522
|
+
color: #0f172a;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
/* ---- Issue list ---- */
|
|
526
|
+
.issue-list {
|
|
527
|
+
list-style: none;
|
|
528
|
+
padding: 0;
|
|
529
|
+
margin: 0;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
/* ---- Finding card: comfortable padding + inter-card air (Task G) ---- */
|
|
533
|
+
.issue-item {
|
|
534
|
+
background: #f8fafc;
|
|
535
|
+
border: 1px solid #e2e8f0;
|
|
536
|
+
border-left: 4px solid #0369a1;
|
|
537
|
+
border-radius: 8px;
|
|
538
|
+
padding: 1.4rem 1.6rem;
|
|
539
|
+
margin-bottom: 1.6rem;
|
|
540
|
+
break-inside: avoid;
|
|
541
|
+
page-break-inside: avoid;
|
|
542
|
+
}
|
|
543
|
+
.issue-item--stoppar-kop { border-left-color: #b91c1c; }
|
|
544
|
+
.issue-item--hindrar { border-left-color: #c2410c; }
|
|
545
|
+
.issue-item--forsamrar { border-left-color: #a16207; }
|
|
546
|
+
.issue-item--putsning { border-left-color: #475569; }
|
|
547
|
+
|
|
548
|
+
/* ---- Badge chip \u2014 white text, WCAG AA contrast against solid background ---- */
|
|
549
|
+
.badge {
|
|
550
|
+
display: inline-block;
|
|
551
|
+
padding: 0.2rem 0.65rem;
|
|
552
|
+
border-radius: 9999px;
|
|
553
|
+
font-size: 0.7rem;
|
|
554
|
+
font-weight: 600;
|
|
555
|
+
letter-spacing: 0.04em;
|
|
556
|
+
text-transform: uppercase;
|
|
557
|
+
color: #ffffff;
|
|
558
|
+
margin-bottom: 0.6rem;
|
|
559
|
+
-webkit-print-color-adjust: exact;
|
|
560
|
+
print-color-adjust: exact;
|
|
561
|
+
}
|
|
562
|
+
/* All combos: white on solid \u2014 contrast ratios: #b91c1c 7.5:1, #c2410c 5.6:1, #a16207 4.6:1, #475569 5.9:1 */
|
|
563
|
+
.badge-stoppar-kop { background: #b91c1c; }
|
|
564
|
+
.badge-hindrar { background: #c2410c; }
|
|
565
|
+
.badge-forsamrar { background: #a16207; }
|
|
566
|
+
.badge-putsning { background: #475569; }
|
|
567
|
+
|
|
568
|
+
/* ---- Rule ID ---- */
|
|
569
|
+
.issue-id {
|
|
570
|
+
display: block;
|
|
571
|
+
font-size: 0.78rem;
|
|
572
|
+
font-weight: 600;
|
|
573
|
+
color: #64748b;
|
|
574
|
+
font-family: ui-monospace, 'Cascadia Code', 'Courier New', monospace;
|
|
575
|
+
margin-bottom: 0.75rem;
|
|
576
|
+
break-after: avoid;
|
|
577
|
+
page-break-after: avoid;
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
/* ---- Field label/value pairs ---- */
|
|
581
|
+
.issue-fields { margin: 0; }
|
|
582
|
+
.issue-fields dt {
|
|
583
|
+
font-weight: 600;
|
|
584
|
+
font-size: 0.78rem;
|
|
585
|
+
color: #0f172a;
|
|
586
|
+
margin-top: 0.65rem;
|
|
587
|
+
}
|
|
588
|
+
.issue-fields dd {
|
|
589
|
+
margin-left: 0;
|
|
590
|
+
font-size: 0.9rem;
|
|
591
|
+
color: #334155;
|
|
592
|
+
line-height: 1.55;
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
/* ---- Fallback (no plainLanguage data) ---- */
|
|
596
|
+
.issue-fallback {
|
|
597
|
+
font-size: 0.9rem;
|
|
598
|
+
color: #334155;
|
|
599
|
+
margin: 0.5rem 0 0;
|
|
600
|
+
line-height: 1.5;
|
|
601
|
+
}
|
|
602
|
+
.fallback-framing {
|
|
603
|
+
font-weight: 600;
|
|
604
|
+
color: #0f172a;
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
/* ---- Closing line ---- */
|
|
608
|
+
.closing {
|
|
609
|
+
margin-top: 2rem;
|
|
610
|
+
font-size: 0.95rem;
|
|
611
|
+
font-weight: 600;
|
|
612
|
+
color: #0f172a;
|
|
613
|
+
break-before: avoid;
|
|
614
|
+
page-break-before: avoid;
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
/* ---- Fixed per-page footer (Task H2): position:fixed elements are
|
|
618
|
+
repeated on every printed page in Chromium print-to-PDF. White
|
|
619
|
+
background + top border so cards never show through; the @page
|
|
620
|
+
bottom margin reserves the vertical space. ---- */
|
|
621
|
+
.page-footer {
|
|
622
|
+
position: fixed;
|
|
623
|
+
bottom: 0;
|
|
624
|
+
left: 0;
|
|
625
|
+
right: 0;
|
|
626
|
+
background: #ffffff;
|
|
627
|
+
border-top: 1px solid #e2e8f0;
|
|
628
|
+
padding: 0.45rem 0 0.35rem;
|
|
629
|
+
font-size: 0.7rem;
|
|
630
|
+
color: #64748b;
|
|
631
|
+
line-height: 1.7;
|
|
632
|
+
-webkit-print-color-adjust: exact;
|
|
633
|
+
print-color-adjust: exact;
|
|
634
|
+
}
|
|
635
|
+
</style>
|
|
636
|
+
</head>
|
|
637
|
+
<body>
|
|
638
|
+
<header class="report-header">
|
|
639
|
+
<div class="report-header__row">
|
|
640
|
+
<div class="brand">
|
|
641
|
+
${logoDataUri ? `<img class="brand__logo" src="${logoDataUri}" alt="Holm Digital logotyp">` : ""}
|
|
642
|
+
<div class="brand__tagline">${escapeHtml(t("plain.report_tagline"))}</div>
|
|
643
|
+
</div>
|
|
644
|
+
<div class="report-header__meta">
|
|
645
|
+
${formatDate(result.timestamp)}<br>v${getEngineVersion()}
|
|
646
|
+
</div>
|
|
647
|
+
</div>
|
|
648
|
+
<div class="report-header__title">${safeUrl}</div>
|
|
649
|
+
</header>
|
|
650
|
+
|
|
651
|
+
<div class="report-body">
|
|
652
|
+
<div class="intro">
|
|
653
|
+
<p>${t("plain.intro_framing")}</p>
|
|
654
|
+
<p>${t("plain.intro_found", { count, unit })}</p>
|
|
655
|
+
</div>
|
|
656
|
+
|
|
657
|
+
${itemsHtml}
|
|
658
|
+
|
|
659
|
+
<p class="closing">${t("plain.closing")}</p>
|
|
660
|
+
</div>
|
|
661
|
+
|
|
662
|
+
<footer class="page-footer">
|
|
663
|
+
${safeUrl} • ${formatDate(result.timestamp)} • v${getEngineVersion()}
|
|
664
|
+
<br>${escapeHtml(t("plain.attribution"))}
|
|
665
|
+
</footer>
|
|
666
|
+
</body>
|
|
667
|
+
</html>`;
|
|
668
|
+
}
|
|
329
669
|
|
|
330
670
|
// src/reporting/pdf-generator.ts
|
|
331
671
|
import puppeteer from "puppeteer";
|
|
@@ -446,7 +786,7 @@ function isValidUrl(urlString) {
|
|
|
446
786
|
}
|
|
447
787
|
var program = new Command();
|
|
448
788
|
program.name("hd-a11y-scan").description("HolmDigital Regulatory Scanner").version(getEngineVersion());
|
|
449
|
-
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) => {
|
|
789
|
+
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)").option("--audience <mode>", "Output audience: developer (default) or plain", "developer").option("--plain", "Alias for --audience plain (klarspr\xE5ksl\xE4ge for non-technical recipients)").action(async (url, cliOptions) => {
|
|
450
790
|
const explorer = cosmiconfig("a11y");
|
|
451
791
|
const configResult = await explorer.search();
|
|
452
792
|
const fileConfig = configResult ? configResult.config : {};
|
|
@@ -473,7 +813,9 @@ program.argument("<url>", "URL to scan").option("--lang <code>", "Language code
|
|
|
473
813
|
country: cliOptions.country || fileConfig.country,
|
|
474
814
|
sector: cliOptions.sector || fileConfig.sector || "public",
|
|
475
815
|
publishDate: cliOptions.publishDate || fileConfig.publishDate,
|
|
476
|
-
light: cliOptions.light ?? fileConfig.light ?? false
|
|
816
|
+
light: cliOptions.light ?? fileConfig.light ?? false,
|
|
817
|
+
plain: cliOptions.plain ?? fileConfig.plain ?? false,
|
|
818
|
+
audience: cliOptions.plain ? "plain" : cliOptions.audience || fileConfig.audience || "developer"
|
|
477
819
|
};
|
|
478
820
|
setLanguage(options.lang);
|
|
479
821
|
if (!isValidUrl(url)) {
|
|
@@ -512,7 +854,7 @@ program.argument("<url>", "URL to scan").option("--lang <code>", "Language code
|
|
|
512
854
|
if (spinner) spinner.succeed(t("cli.complete"));
|
|
513
855
|
if (options.pdf) {
|
|
514
856
|
if (spinner) spinner.start(t("cli.generating_pdf"));
|
|
515
|
-
const html = generateReportHTML(result, options.sector);
|
|
857
|
+
const html = options.audience === "plain" ? generateReportHTML(result, options.sector, "plain") : generateReportHTML(result, options.sector);
|
|
516
858
|
await generatePDF(html, options.pdf);
|
|
517
859
|
if (spinner) spinner.succeed(t("cli.pdf_saved", { path: options.pdf }));
|
|
518
860
|
}
|
|
@@ -567,6 +909,9 @@ program.argument("<url>", "URL to scan").option("--lang <code>", "Language code
|
|
|
567
909
|
}
|
|
568
910
|
console.log(chalk.gray(`
|
|
569
911
|
Scan: ${result.metadata.scanDuration}ms | ${result.metadata.engineVersion}`));
|
|
912
|
+
} else if (options.audience === "plain") {
|
|
913
|
+
const { renderPlainReport } = await import("../plain-report-AK5QAT5P.mjs");
|
|
914
|
+
renderPlainReport(result, options.lang);
|
|
570
915
|
} else {
|
|
571
916
|
console.log("\n");
|
|
572
917
|
const scoreColor = result.score >= 90 ? chalk.green : result.score >= 70 ? chalk.yellow : chalk.red;
|
package/dist/index.d.mts
CHANGED
|
@@ -141,9 +141,31 @@ var report = {
|
|
|
141
141
|
use: "Use",
|
|
142
142
|
footer: "Generated by @holmdigital/engine v{version} • Standards: WCAG 2.1 AA, EN 301 549, DOS-lagen"
|
|
143
143
|
};
|
|
144
|
+
var plain = {
|
|
145
|
+
what_happens: "What happens:",
|
|
146
|
+
who_is_affected: "Who is affected:",
|
|
147
|
+
business_impact: "What it costs you:",
|
|
148
|
+
how_to_fix: "How to fix it:",
|
|
149
|
+
badge_stoppar_kop: "Blocks purchases",
|
|
150
|
+
badge_hindrar: "Excludes customers",
|
|
151
|
+
badge_forsamrar: "Degrades experience",
|
|
152
|
+
badge_putsning: "Worth polishing",
|
|
153
|
+
intro_framing: "It does not mean you did anything wrong. Most people who build a website never find out that accessibility is even a thing. Now you know. Here is what is worth starting with, sorted by what costs you the most customers.",
|
|
154
|
+
sorted_by: "Sorted by business impact",
|
|
155
|
+
intro_found: "Found {count} {unit}",
|
|
156
|
+
intro_unit_singular: "issue",
|
|
157
|
+
intro_unit_plural: "issues",
|
|
158
|
+
closing: "Start at the top. The items highest up cost you the most customers.",
|
|
159
|
+
empty_state: "No barriers found this time.",
|
|
160
|
+
report_title: "Accessibility report for {url}",
|
|
161
|
+
report_tagline: "Accessibility report",
|
|
162
|
+
attribution: "Report generated by HolmDigital Engine, part of the HolmDigital accessibility ecosystem.",
|
|
163
|
+
fallback_framing: "Technical finding. Ask your developer to review this:"
|
|
164
|
+
};
|
|
144
165
|
var en = {
|
|
145
166
|
cli: cli,
|
|
146
|
-
report: report
|
|
167
|
+
report: report,
|
|
168
|
+
plain: plain
|
|
147
169
|
};
|
|
148
170
|
|
|
149
171
|
type LocaleData = typeof en;
|
package/dist/index.d.ts
CHANGED
|
@@ -141,9 +141,31 @@ var report = {
|
|
|
141
141
|
use: "Use",
|
|
142
142
|
footer: "Generated by @holmdigital/engine v{version} • Standards: WCAG 2.1 AA, EN 301 549, DOS-lagen"
|
|
143
143
|
};
|
|
144
|
+
var plain = {
|
|
145
|
+
what_happens: "What happens:",
|
|
146
|
+
who_is_affected: "Who is affected:",
|
|
147
|
+
business_impact: "What it costs you:",
|
|
148
|
+
how_to_fix: "How to fix it:",
|
|
149
|
+
badge_stoppar_kop: "Blocks purchases",
|
|
150
|
+
badge_hindrar: "Excludes customers",
|
|
151
|
+
badge_forsamrar: "Degrades experience",
|
|
152
|
+
badge_putsning: "Worth polishing",
|
|
153
|
+
intro_framing: "It does not mean you did anything wrong. Most people who build a website never find out that accessibility is even a thing. Now you know. Here is what is worth starting with, sorted by what costs you the most customers.",
|
|
154
|
+
sorted_by: "Sorted by business impact",
|
|
155
|
+
intro_found: "Found {count} {unit}",
|
|
156
|
+
intro_unit_singular: "issue",
|
|
157
|
+
intro_unit_plural: "issues",
|
|
158
|
+
closing: "Start at the top. The items highest up cost you the most customers.",
|
|
159
|
+
empty_state: "No barriers found this time.",
|
|
160
|
+
report_title: "Accessibility report for {url}",
|
|
161
|
+
report_tagline: "Accessibility report",
|
|
162
|
+
attribution: "Report generated by HolmDigital Engine, part of the HolmDigital accessibility ecosystem.",
|
|
163
|
+
fallback_framing: "Technical finding. Ask your developer to review this:"
|
|
164
|
+
};
|
|
144
165
|
var en = {
|
|
145
166
|
cli: cli,
|
|
146
|
-
report: report
|
|
167
|
+
report: report,
|
|
168
|
+
plain: plain
|
|
147
169
|
};
|
|
148
170
|
|
|
149
171
|
type LocaleData = typeof en;
|