ultra11y 5.48.0 → 5.49.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/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/.opencode/plugins/ultra11y.js +1 -1
- package/README.md +1 -1
- package/package.json +1 -1
- package/scripts/build-guidance-wcag.mjs +2 -1
- package/scripts/build-standards.mjs +5 -3
- package/scripts/ultra11y.mjs +55 -14
- package/scripts/vendor-stamp.d.mts +6 -0
- package/scripts/vendor-stamp.mjs +36 -0
- package/skills/review-a11y/SKILL.md +1 -1
- package/skills/review-a11y/scripts/ultra11y.mjs +55 -14
- package/skills/ultra11y/SKILL.md +1 -1
- package/skills/ultra11y/references/dynamic.md +10 -0
- package/skills/ultra11y/scripts/ultra11y.mjs +55 -14
- package/skills/ultra11y/templates/gitlab-ci.yml +1 -1
- package/src/cli.ts +27 -7
- package/src/scan-local.ts +66 -8
- package/src/types.ts +1 -1
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"name": "ultra11y",
|
|
11
11
|
"source": "./",
|
|
12
12
|
"description": "RGAA 4.1.2 accessibility audits on a WCAG 2.2 AA core: automatic review before commit, push and pull request, plus dated, evidenced Markdown, HTML and per-page conformance reports in Claude Code.",
|
|
13
|
-
"version": "5.
|
|
13
|
+
"version": "5.49.0",
|
|
14
14
|
"author": { "name": "maxgfr" },
|
|
15
15
|
"homepage": "https://github.com/SocialGouv/ultra11y",
|
|
16
16
|
"repository": "https://github.com/SocialGouv/ultra11y",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ultra11y",
|
|
3
3
|
"description": "RGAA 4.1.2 accessibility audits, the French State's standard, on a WCAG 2.2 AA core: automatic review before commit, push and pull request, plus dated, evidenced Markdown, HTML and per-page conformance reports. Never declares conforming what it has not verified.",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.49.0",
|
|
5
5
|
"author": { "name": "maxgfr" },
|
|
6
6
|
"homepage": "https://github.com/SocialGouv/ultra11y",
|
|
7
7
|
"repository": "https://github.com/SocialGouv/ultra11y",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ultra11y",
|
|
3
3
|
"description": "RGAA 4.1.2 accessibility audits, the French State's standard, on a WCAG 2.2 AA core: automatic review before commit, push and pull request, plus dated, evidenced Markdown, HTML and per-page conformance reports. Never declares conforming what it has not verified.",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.49.0",
|
|
5
5
|
"author": { "name": "maxgfr", "url": "https://github.com/maxgfr" },
|
|
6
6
|
"homepage": "https://github.com/SocialGouv/ultra11y",
|
|
7
7
|
"repository": "https://github.com/SocialGouv/ultra11y",
|
|
@@ -27,7 +27,7 @@ import { fileURLToPath } from "node:url";
|
|
|
27
27
|
// Ownership marker: `ultra11y install --opencode` refuses to overwrite a plugin file that
|
|
28
28
|
// does not carry it, so a user's own ultra11y.js is never clobbered.
|
|
29
29
|
const ULTRA11Y_OPENCODE_PLUGIN = "ULTRA11Y_OPENCODE_PLUGIN";
|
|
30
|
-
const ULTRA11Y_PLUGIN_VERSION = "5.
|
|
30
|
+
const ULTRA11Y_PLUGIN_VERSION = "5.49.0";
|
|
31
31
|
|
|
32
32
|
const here = dirname(fileURLToPath(import.meta.url));
|
|
33
33
|
|
package/README.md
CHANGED
|
@@ -517,7 +517,7 @@ node scripts/ultra11y.mjs scan http://localhost:3000 --runtime local --cwd . --m
|
|
|
517
517
|
node scripts/ultra11y.mjs report --in audits/audit-latest.json --out audits
|
|
518
518
|
```
|
|
519
519
|
|
|
520
|
-
Only the Docker runtime needs Docker. `--runtime local` needs a Chromium binary (`npx playwright install chromium`) plus `@playwright/test` and `@axe-core/playwright` — which **come with the npm package**, since they are its own dependencies; the audited project's own copies take precedence when it has them. Running the engine as a **standalone skill bundle** is the exception: an installed skill has no `node_modules` beside it, so there the two packages must be in the audited project, reachable from `--cwd`. The engine bundle itself stays dependency-free either way. The Docker runner + Dockerfile are embedded in the engine and mirrored under `docker/` (with a `docker-compose.yml`). See `skills/ultra11y/references/dynamic.md`.
|
|
520
|
+
Only the Docker runtime needs Docker. `--runtime local` needs a Chromium binary (`npx playwright install chromium`, or one already on the machine named with `--browser-path /usr/bin/chromium` / `ULTRA11Y_BROWSER_PATH` — launched as given, never replaced by a fallback) plus `@playwright/test` and `@axe-core/playwright` — which **come with the npm package**, since they are its own dependencies; the audited project's own copies take precedence when it has them. Running the engine as a **standalone skill bundle** is the exception: an installed skill has no `node_modules` beside it, so there the two packages must be in the audited project, reachable from `--cwd`. The engine bundle itself stays dependency-free either way. The Docker runner + Dockerfile are embedded in the engine and mirrored under `docker/` (with a `docker-compose.yml`). See `skills/ultra11y/references/dynamic.md`.
|
|
521
521
|
|
|
522
522
|
Typical audit flow:
|
|
523
523
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ultra11y",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.49.0",
|
|
4
4
|
"description": "Audit d'accessibilité RGAA 4.1.2, le référentiel de l'État : rapport daté, grille des 106 critères, backlog et tickets. Moteur statique, navigateur et jugement IA contre-vérifié. Il ne déclare jamais conforme ce qu'il n'a pas vérifié. Socle WCAG 2.2 AA.",
|
|
5
5
|
"homepage": "https://socialgouv.github.io/ultra11y/",
|
|
6
6
|
"type": "module",
|
|
@@ -31,6 +31,7 @@ import { execFileSync } from "node:child_process";
|
|
|
31
31
|
import { dirname, join } from "node:path";
|
|
32
32
|
import { fileURLToPath } from "node:url";
|
|
33
33
|
import { tmpdir } from "node:os";
|
|
34
|
+
import { withPreviousStamp } from "./vendor-stamp.mjs";
|
|
34
35
|
|
|
35
36
|
const root = join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
36
37
|
const VENDOR = join(root, "scripts", "vendor", "wcag-2.2-techniques.json");
|
|
@@ -246,7 +247,7 @@ async function refresh() {
|
|
|
246
247
|
criteria,
|
|
247
248
|
};
|
|
248
249
|
mkdirSync(dirname(VENDOR), { recursive: true });
|
|
249
|
-
writeFileSync(VENDOR, JSON.stringify(out, null, 2) + "\n");
|
|
250
|
+
writeFileSync(VENDOR, JSON.stringify(withPreviousStamp(VENDOR, out), null, 2) + "\n");
|
|
250
251
|
const withGood = Object.values(criteria).filter((x) => x.good).length;
|
|
251
252
|
const withBad = Object.values(criteria).filter((x) => x.bad).length;
|
|
252
253
|
const withBrief = Object.values(criteria).filter((x) => x.brief).length;
|
|
@@ -20,6 +20,7 @@ import { writeFileSync, readFileSync, readdirSync, existsSync, mkdirSync } from
|
|
|
20
20
|
import { execFileSync } from "node:child_process";
|
|
21
21
|
import { dirname, join } from "node:path";
|
|
22
22
|
import { fileURLToPath } from "node:url";
|
|
23
|
+
import { sameButForTheDate, withPreviousStamp } from "./vendor-stamp.mjs";
|
|
23
24
|
|
|
24
25
|
const root = join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
25
26
|
const DATA = join(root, "src", "data");
|
|
@@ -228,7 +229,8 @@ async function deriveUniverse() {
|
|
|
228
229
|
criteria,
|
|
229
230
|
};
|
|
230
231
|
mkdirSync(dirname(VENDOR_UNIVERSE), { recursive: true });
|
|
231
|
-
|
|
232
|
+
// The dated provenance sentence is the stamp here: kept as committed when the universe is unchanged.
|
|
233
|
+
writeFileSync(VENDOR_UNIVERSE, JSON.stringify(withPreviousStamp(VENDOR_UNIVERSE, universe, { stamp: "provenance", sameStamp: sameButForTheDate }), null, 2) + "\n");
|
|
232
234
|
console.log(`build-standards --refresh-universe: ${criteria.length} SCs (all levels) derived → ${VENDOR_UNIVERSE}`);
|
|
233
235
|
return universe;
|
|
234
236
|
}
|
|
@@ -414,7 +416,7 @@ async function deriveFr() {
|
|
|
414
416
|
glossary,
|
|
415
417
|
};
|
|
416
418
|
mkdirSync(dirname(VENDOR_FR), { recursive: true });
|
|
417
|
-
writeFileSync(VENDOR_FR, JSON.stringify(out, null, 2) + "\n");
|
|
419
|
+
writeFileSync(VENDOR_FR, JSON.stringify(withPreviousStamp(VENDOR_FR, out), null, 2) + "\n");
|
|
418
420
|
console.log(
|
|
419
421
|
`build-standards --refresh-fr: ${Object.keys(criteria).length} SC + ${Object.keys(guidelines).length} guideline + ${Object.keys(principles).length} principle French titles, ` +
|
|
420
422
|
`${Object.keys(criteriaText).length} SC bodies, ${Object.keys(glossary).length} glossary terms → ${VENDOR_FR}`,
|
|
@@ -608,7 +610,7 @@ async function deriveText() {
|
|
|
608
610
|
glossary,
|
|
609
611
|
};
|
|
610
612
|
mkdirSync(dirname(VENDOR_TEXT), { recursive: true });
|
|
611
|
-
writeFileSync(VENDOR_TEXT, JSON.stringify(out, null, 2) + "\n");
|
|
613
|
+
writeFileSync(VENDOR_TEXT, JSON.stringify(withPreviousStamp(VENDOR_TEXT, out), null, 2) + "\n");
|
|
612
614
|
console.log(`build-standards --refresh-text: ${Object.keys(criteria).length} SC texts + ${Object.keys(glossary).length} glossary terms → ${VENDOR_TEXT}`);
|
|
613
615
|
return out;
|
|
614
616
|
}
|
package/scripts/ultra11y.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { join as join53, relative as relative6, resolve as resolve17, sep as sep
|
|
|
6
6
|
import { fileURLToPath as fileURLToPath5, pathToFileURL as pathToFileURL3 } from "url";
|
|
7
7
|
|
|
8
8
|
// src/types.ts
|
|
9
|
-
var VERSION = "5.
|
|
9
|
+
var VERSION = "5.49.0";
|
|
10
10
|
var SCHEMA_VERSION = 2;
|
|
11
11
|
var INAPPLICABLE_STATUS = "C";
|
|
12
12
|
|
|
@@ -68412,12 +68412,30 @@ function resolvesRuntime(cwd, spec) {
|
|
|
68412
68412
|
}
|
|
68413
68413
|
});
|
|
68414
68414
|
}
|
|
68415
|
-
|
|
68415
|
+
var BROWSER_PATH_SOURCES = "--browser-path / ULTRA11Y_BROWSER_PATH";
|
|
68416
|
+
function localTierStatus(cwd, choice = {}) {
|
|
68416
68417
|
for (const spec of [PW_SPEC, AXE_SPEC]) {
|
|
68417
68418
|
if (!resolvesRuntime(cwd, spec)) {
|
|
68418
68419
|
return { ok: false, reason: `${spec} resolves neither from ${cwd} nor from ultra11y itself` };
|
|
68419
68420
|
}
|
|
68420
68421
|
}
|
|
68422
|
+
if (choice.browserPath) {
|
|
68423
|
+
const executable = choice.browserPath;
|
|
68424
|
+
let isFile = false;
|
|
68425
|
+
try {
|
|
68426
|
+
isFile = statSync15(executable).isFile();
|
|
68427
|
+
} catch {
|
|
68428
|
+
isFile = false;
|
|
68429
|
+
}
|
|
68430
|
+
if (!isFile) {
|
|
68431
|
+
return {
|
|
68432
|
+
ok: false,
|
|
68433
|
+
executable,
|
|
68434
|
+
reason: `no browser binary at ${executable} (${BROWSER_PATH_SOURCES}) \u2014 install a browser there, or drop the path to let Playwright resolve its own`
|
|
68435
|
+
};
|
|
68436
|
+
}
|
|
68437
|
+
return { ok: true, executable };
|
|
68438
|
+
}
|
|
68421
68439
|
try {
|
|
68422
68440
|
const pw = requireRuntime(cwd, PW_SPEC);
|
|
68423
68441
|
const bin = pw.chromium?.executablePath?.();
|
|
@@ -68434,8 +68452,8 @@ function localTierStatus(cwd) {
|
|
|
68434
68452
|
return { ok: false, reason: `${PW_SPEC} failed to load: ${e.message.split("\n")[0]}` };
|
|
68435
68453
|
}
|
|
68436
68454
|
}
|
|
68437
|
-
function localAvailable(cwd) {
|
|
68438
|
-
return localTierStatus(cwd).ok;
|
|
68455
|
+
function localAvailable(cwd, choice = {}) {
|
|
68456
|
+
return localTierStatus(cwd, choice).ok;
|
|
68439
68457
|
}
|
|
68440
68458
|
function resolveLocalDeps(cwd) {
|
|
68441
68459
|
let chromium;
|
|
@@ -68482,8 +68500,18 @@ var realDir = (dir) => {
|
|
|
68482
68500
|
}
|
|
68483
68501
|
};
|
|
68484
68502
|
var MISSING_BROWSER = /Executable doesn'?t exist|playwright install|browserType\.launch/i;
|
|
68485
|
-
async function launchChromium(chromium, cwd = ".", warn = (m) => console.error(m)) {
|
|
68503
|
+
async function launchChromium(chromium, cwd = ".", warn = (m) => console.error(m), choice = {}) {
|
|
68486
68504
|
const args2 = ["--no-sandbox", "--disable-dev-shm-usage"];
|
|
68505
|
+
if (choice.browserPath) {
|
|
68506
|
+
try {
|
|
68507
|
+
return await chromium.launch({ args: args2, executablePath: choice.browserPath });
|
|
68508
|
+
} catch (e) {
|
|
68509
|
+
const msg2 = e instanceof Error ? e.message : String(e);
|
|
68510
|
+
throw new Error(
|
|
68511
|
+
`Could not launch the browser at ${choice.browserPath} (${BROWSER_PATH_SOURCES}): ${msg2.split("\n")[0]}. An explicit browser is never replaced by another \u2014 fix the path, or drop it to let Playwright resolve its own.`
|
|
68512
|
+
);
|
|
68513
|
+
}
|
|
68514
|
+
}
|
|
68487
68515
|
let first;
|
|
68488
68516
|
try {
|
|
68489
68517
|
return await chromium.launch({ args: args2 });
|
|
@@ -68849,7 +68877,7 @@ async function runScanLocal(opts) {
|
|
|
68849
68877
|
const lang = opts.lang ?? "en";
|
|
68850
68878
|
const interact = opts.interact !== false;
|
|
68851
68879
|
const { chromium, AxeBuilder } = resolveLocalDeps(opts.cwd);
|
|
68852
|
-
const browser = await launchChromium(chromium, opts.cwd);
|
|
68880
|
+
const browser = await launchChromium(chromium, opts.cwd, void 0, { browserPath: opts.browserPath });
|
|
68853
68881
|
try {
|
|
68854
68882
|
const out2 = await runOnPage(browser, AxeBuilder, opts.target, isFile, {
|
|
68855
68883
|
storageState: opts.storageState,
|
|
@@ -68868,7 +68896,7 @@ async function runScanManyLocal(urls, opts) {
|
|
|
68868
68896
|
const lang = opts.lang ?? "en";
|
|
68869
68897
|
const interact = opts.interact !== false;
|
|
68870
68898
|
const { chromium, AxeBuilder } = resolveLocalDeps(opts.cwd);
|
|
68871
|
-
const browser = await launchChromium(chromium, opts.cwd);
|
|
68899
|
+
const browser = await launchChromium(chromium, opts.cwd, void 0, { browserPath: opts.browserPath });
|
|
68872
68900
|
const findings = [];
|
|
68873
68901
|
const snapshots = [];
|
|
68874
68902
|
const outs = [];
|
|
@@ -68929,7 +68957,7 @@ async function runSampleScanLocal(pages, opts) {
|
|
|
68929
68957
|
const lang = opts.lang ?? "en";
|
|
68930
68958
|
const interact = opts.interact !== false;
|
|
68931
68959
|
const { chromium, AxeBuilder } = resolveLocalDeps(opts.cwd);
|
|
68932
|
-
const browser = await launchChromium(chromium, opts.cwd);
|
|
68960
|
+
const browser = await launchChromium(chromium, opts.cwd, void 0, { browserPath: opts.browserPath });
|
|
68933
68961
|
const findings = [];
|
|
68934
68962
|
const snapshots = [];
|
|
68935
68963
|
const outs = [];
|
|
@@ -75904,6 +75932,9 @@ Options:
|
|
|
75904
75932
|
--docker scan: alias of --runtime docker (built on first use)
|
|
75905
75933
|
--cwd <dir> scan: --runtime local resolves @playwright/test + @axe-core/playwright
|
|
75906
75934
|
(and the browser) from here (e.g. --cwd packages/app)
|
|
75935
|
+
--browser-path <file> scan / status --browser: launch THIS browser executable (e.g. a
|
|
75936
|
+
distribution's /usr/bin/chromium) instead of the one Playwright resolves.
|
|
75937
|
+
Explicit: never replaced by a fallback. Env: ULTRA11Y_BROWSER_PATH
|
|
75907
75938
|
--storage-state <file> scan: --runtime local \u2014 Playwright storageState JSON for
|
|
75908
75939
|
authenticated pages (e.g. test-results/.auth/user.json)
|
|
75909
75940
|
--no-interact scan: --runtime local \u2014 disable the STATEFUL probes (fill inputs,
|
|
@@ -76063,6 +76094,9 @@ var VALUE_FLAGS2 = /* @__PURE__ */ new Set([
|
|
|
76063
76094
|
"guidance",
|
|
76064
76095
|
"runtime",
|
|
76065
76096
|
"cwd",
|
|
76097
|
+
// `scan` / `status --browser`: an explicit browser executable (a distribution's Chromium),
|
|
76098
|
+
// launched as given and never replaced by Playwright's fallbacks. Env: ULTRA11Y_BROWSER_PATH.
|
|
76099
|
+
"browser-path",
|
|
76066
76100
|
"storage-state",
|
|
76067
76101
|
"captures",
|
|
76068
76102
|
"run",
|
|
@@ -77008,9 +77042,14 @@ function reportInstall(results, verb) {
|
|
|
77008
77042
|
}
|
|
77009
77043
|
return failed2 ? 1 : 0;
|
|
77010
77044
|
}
|
|
77045
|
+
function browserPathOf(flags2, env = process.env) {
|
|
77046
|
+
if (typeof flags2["browser-path"] === "string" && flags2["browser-path"]) return flags2["browser-path"];
|
|
77047
|
+
const fromEnv = env.ULTRA11Y_BROWSER_PATH;
|
|
77048
|
+
return typeof fromEnv === "string" && fromEnv.trim() ? fromEnv.trim() : void 0;
|
|
77049
|
+
}
|
|
77011
77050
|
function cmdStatus(p) {
|
|
77012
77051
|
const rows = statusReport({ project: p.flags.project === true });
|
|
77013
|
-
const browser = p.flags.browser === true ? localTierStatus(typeof p.flags.cwd === "string" && p.flags.cwd ? p.flags.cwd : ".") : void 0;
|
|
77052
|
+
const browser = p.flags.browser === true ? localTierStatus(typeof p.flags.cwd === "string" && p.flags.cwd ? p.flags.cwd : ".", { browserPath: browserPathOf(p.flags) }) : void 0;
|
|
77014
77053
|
if (p.flags.json === true) {
|
|
77015
77054
|
console.log(JSON.stringify({ version: VERSION, targets: rows, ...browser ? { browser } : {} }, null, 2));
|
|
77016
77055
|
return 0;
|
|
@@ -78481,6 +78520,7 @@ async function cmdScan(p) {
|
|
|
78481
78520
|
}
|
|
78482
78521
|
const cwd = typeof p.flags.cwd === "string" && p.flags.cwd ? p.flags.cwd : process.cwd();
|
|
78483
78522
|
const storageState = typeof p.flags["storage-state"] === "string" && p.flags["storage-state"] ? p.flags["storage-state"] : void 0;
|
|
78523
|
+
const browserPath = browserPathOf(p.flags);
|
|
78484
78524
|
const runtimeFlag = typeof p.flags.runtime === "string" && p.flags.runtime ? p.flags.runtime : p.flags.local === true ? "local" : p.flags.docker === true ? "docker" : "auto";
|
|
78485
78525
|
if (!["auto", "local", "docker"].includes(runtimeFlag)) {
|
|
78486
78526
|
console.error(`ultra11y scan: --runtime must be local, docker, or auto (got "${runtimeFlag}").`);
|
|
@@ -78489,10 +78529,10 @@ async function cmdScan(p) {
|
|
|
78489
78529
|
let useLocal;
|
|
78490
78530
|
if (runtimeFlag === "local") useLocal = true;
|
|
78491
78531
|
else if (runtimeFlag === "docker") useLocal = false;
|
|
78492
|
-
else if (localAvailable(cwd)) useLocal = true;
|
|
78532
|
+
else if (localAvailable(cwd, { browserPath })) useLocal = true;
|
|
78493
78533
|
else if (dockerAvailable()) {
|
|
78494
78534
|
useLocal = false;
|
|
78495
|
-
const s = localTierStatus(cwd);
|
|
78535
|
+
const s = localTierStatus(cwd, { browserPath });
|
|
78496
78536
|
console.error(
|
|
78497
78537
|
lang === "fr" ? `ultra11y scan : tier local indisponible${s.ok ? "" : ` (${s.reason})`} \u2014 bascule sur Docker. Passez --runtime local pour en faire une erreur.` : `ultra11y scan: local tier unavailable${s.ok ? "" : ` (${s.reason})`} \u2014 falling back to Docker. Pass --runtime local to make this an error instead.`
|
|
78498
78538
|
);
|
|
@@ -78548,12 +78588,12 @@ async function cmdScan(p) {
|
|
|
78548
78588
|
let dynamic;
|
|
78549
78589
|
try {
|
|
78550
78590
|
if (useSample && sampleConfig) {
|
|
78551
|
-
dynamic = useLocal ? await runSampleScanLocal(sampleConfig.pages, { cwd, storageState, lang, interact, interactClicks, snapshotRoot }) : runSampleScan(sampleConfig.pages, void 0, snapshotRoot);
|
|
78591
|
+
dynamic = useLocal ? await runSampleScanLocal(sampleConfig.pages, { cwd, storageState, lang, interact, interactClicks, snapshotRoot, browserPath }) : runSampleScan(sampleConfig.pages, void 0, snapshotRoot);
|
|
78552
78592
|
} else if (sitemap || crawl) {
|
|
78553
78593
|
const depth = typeof p.flags.depth === "string" ? Number(p.flags.depth) : void 0;
|
|
78554
78594
|
const max = typeof p.flags.max === "string" ? Number(p.flags.max) : void 0;
|
|
78555
78595
|
const onPage = (url, n) => console.error(`ultra11y scan: page ${n} \u2014 ${url}`);
|
|
78556
|
-
dynamic = useLocal ? await runCrawlScanLocal({ sitemap, crawl, depth, max, onPage, cwd, storageState, lang, interact, interactClicks, snapshotRoot }) : await runCrawlScan({ sitemap, crawl, depth, max, onPage, snapshotRoot });
|
|
78596
|
+
dynamic = useLocal ? await runCrawlScanLocal({ sitemap, crawl, depth, max, onPage, cwd, storageState, lang, interact, interactClicks, snapshotRoot, browserPath }) : await runCrawlScan({ sitemap, crawl, depth, max, onPage, snapshotRoot });
|
|
78557
78597
|
} else {
|
|
78558
78598
|
const targets = p.positionals.filter((a) => a !== "-");
|
|
78559
78599
|
if (targets.length === 0) {
|
|
@@ -78561,7 +78601,7 @@ async function cmdScan(p) {
|
|
|
78561
78601
|
return 2;
|
|
78562
78602
|
}
|
|
78563
78603
|
if (useLocal) {
|
|
78564
|
-
dynamic = targets.length === 1 ? await runScanLocal({ target: targets[0], cwd, storageState, lang, interact, interactClicks, snapshotRoot }) : await runScanManyLocal(targets, { cwd, storageState, lang, interact, interactClicks, snapshotRoot });
|
|
78604
|
+
dynamic = targets.length === 1 ? await runScanLocal({ target: targets[0], cwd, storageState, lang, interact, interactClicks, snapshotRoot, browserPath }) : await runScanManyLocal(targets, { cwd, storageState, lang, interact, interactClicks, snapshotRoot, browserPath });
|
|
78565
78605
|
} else {
|
|
78566
78606
|
dynamic = targets.length === 1 ? runScan({ target: targets[0], snapshotRoot }) : runScanMany(targets, void 0, snapshotRoot);
|
|
78567
78607
|
}
|
|
@@ -79208,6 +79248,7 @@ if (isInvokedDirectly()) {
|
|
|
79208
79248
|
export {
|
|
79209
79249
|
COMMANDS,
|
|
79210
79250
|
REMOVED_FLAGS,
|
|
79251
|
+
browserPathOf,
|
|
79211
79252
|
main,
|
|
79212
79253
|
parseArgs,
|
|
79213
79254
|
scanSnapshotRoot
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const sameButForTheDate: (a: unknown, b: unknown) => boolean;
|
|
2
|
+
export declare function withPreviousStamp<T extends Record<string, unknown>>(
|
|
3
|
+
path: string,
|
|
4
|
+
next: T,
|
|
5
|
+
opts?: { stamp?: string; sameStamp?: (prev: unknown, next: unknown) => boolean },
|
|
6
|
+
): T;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// A vendored dataset carries the day it was fetched (`fetchedAt`, or a dated `provenance`
|
|
2
|
+
// sentence). Stamping it with TODAY on every refresh made the daily cron commit eight files a
|
|
3
|
+
// day — the four vendored sources and the engine bundles that embed them, three of 3.7 MB —
|
|
4
|
+
// for a one-line diff that said nothing had changed. A stamp is a fact about the DATA: it
|
|
5
|
+
// moves when the data moves, and stays put when a refresh fetched the same bytes again.
|
|
6
|
+
import { readFileSync } from "node:fs";
|
|
7
|
+
|
|
8
|
+
/** The stamp field, by default `fetchedAt` — a bare date. */
|
|
9
|
+
const DEFAULT_STAMP = "fetchedAt";
|
|
10
|
+
|
|
11
|
+
/** A dated sentence (the universe's `provenance`) is the same stamp when only its date differs. */
|
|
12
|
+
const DATE_RE = /\d{4}-\d{2}-\d{2}/g;
|
|
13
|
+
export const sameButForTheDate = (a, b) => typeof a === "string" && typeof b === "string" && a.replace(DATE_RE, "<date>") === b.replace(DATE_RE, "<date>");
|
|
14
|
+
|
|
15
|
+
/** Return `next` carrying the stamp the committed file at `path` already has, when everything
|
|
16
|
+
* BUT the stamp is identical to that file — so a refresh that fetched the same source again
|
|
17
|
+
* writes the same bytes again. Any difference in the data, a missing or unreadable file, or
|
|
18
|
+
* a stamp that is not merely re-dated (`sameStamp`), hands back `next` untouched.
|
|
19
|
+
*
|
|
20
|
+
* Identity is the serialised object minus the stamp, in the writer's own key order: the
|
|
21
|
+
* committed file was produced by the same writer, so a byte-level comparison is exact and
|
|
22
|
+
* needs no deep-equality rules of its own. */
|
|
23
|
+
export function withPreviousStamp(path, next, { stamp = DEFAULT_STAMP, sameStamp = () => true } = {}) {
|
|
24
|
+
if (!(stamp in next)) return next;
|
|
25
|
+
let prev;
|
|
26
|
+
try {
|
|
27
|
+
prev = JSON.parse(readFileSync(path, "utf8"));
|
|
28
|
+
} catch {
|
|
29
|
+
return next;
|
|
30
|
+
}
|
|
31
|
+
if (!prev || typeof prev !== "object" || !(stamp in prev)) return next;
|
|
32
|
+
if (!sameStamp(prev[stamp], next[stamp])) return next;
|
|
33
|
+
const strip = (o) => JSON.stringify(Object.fromEntries(Object.entries(o).filter(([k]) => k !== stamp)));
|
|
34
|
+
if (strip(prev) !== strip(next)) return next;
|
|
35
|
+
return { ...next, [stamp]: prev[stamp] };
|
|
36
|
+
}
|
|
@@ -3,7 +3,7 @@ name: review-a11y
|
|
|
3
3
|
description: "Use to REVIEW changed frontend code for accessibility: staged files, a working diff, branch, or PR; prompts such as 'review a11y', 'is this accessible?', or 'anything to fix before merge?'; and hook or CI findings on a change. Run the bundled install-free engine with cross-file JSX/TSX analysis, then adjudicate candidates and return a severity-ranked WCAG 2.2 AA review with file:line fixes, residual rendering risks, and a verdict. Use `ultra11y` instead for whole-repo audits, dated conformance reports, country standards, PRD backlogs, or authoring accessible markup."
|
|
4
4
|
license: MIT
|
|
5
5
|
metadata:
|
|
6
|
-
version: 5.
|
|
6
|
+
version: 5.49.0
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
# review-a11y — accessibility review of changed code
|
|
@@ -6,7 +6,7 @@ import { join as join53, relative as relative6, resolve as resolve17, sep as sep
|
|
|
6
6
|
import { fileURLToPath as fileURLToPath5, pathToFileURL as pathToFileURL3 } from "url";
|
|
7
7
|
|
|
8
8
|
// src/types.ts
|
|
9
|
-
var VERSION = "5.
|
|
9
|
+
var VERSION = "5.49.0";
|
|
10
10
|
var SCHEMA_VERSION = 2;
|
|
11
11
|
var INAPPLICABLE_STATUS = "C";
|
|
12
12
|
|
|
@@ -68412,12 +68412,30 @@ function resolvesRuntime(cwd, spec) {
|
|
|
68412
68412
|
}
|
|
68413
68413
|
});
|
|
68414
68414
|
}
|
|
68415
|
-
|
|
68415
|
+
var BROWSER_PATH_SOURCES = "--browser-path / ULTRA11Y_BROWSER_PATH";
|
|
68416
|
+
function localTierStatus(cwd, choice = {}) {
|
|
68416
68417
|
for (const spec of [PW_SPEC, AXE_SPEC]) {
|
|
68417
68418
|
if (!resolvesRuntime(cwd, spec)) {
|
|
68418
68419
|
return { ok: false, reason: `${spec} resolves neither from ${cwd} nor from ultra11y itself` };
|
|
68419
68420
|
}
|
|
68420
68421
|
}
|
|
68422
|
+
if (choice.browserPath) {
|
|
68423
|
+
const executable = choice.browserPath;
|
|
68424
|
+
let isFile = false;
|
|
68425
|
+
try {
|
|
68426
|
+
isFile = statSync15(executable).isFile();
|
|
68427
|
+
} catch {
|
|
68428
|
+
isFile = false;
|
|
68429
|
+
}
|
|
68430
|
+
if (!isFile) {
|
|
68431
|
+
return {
|
|
68432
|
+
ok: false,
|
|
68433
|
+
executable,
|
|
68434
|
+
reason: `no browser binary at ${executable} (${BROWSER_PATH_SOURCES}) \u2014 install a browser there, or drop the path to let Playwright resolve its own`
|
|
68435
|
+
};
|
|
68436
|
+
}
|
|
68437
|
+
return { ok: true, executable };
|
|
68438
|
+
}
|
|
68421
68439
|
try {
|
|
68422
68440
|
const pw = requireRuntime(cwd, PW_SPEC);
|
|
68423
68441
|
const bin = pw.chromium?.executablePath?.();
|
|
@@ -68434,8 +68452,8 @@ function localTierStatus(cwd) {
|
|
|
68434
68452
|
return { ok: false, reason: `${PW_SPEC} failed to load: ${e.message.split("\n")[0]}` };
|
|
68435
68453
|
}
|
|
68436
68454
|
}
|
|
68437
|
-
function localAvailable(cwd) {
|
|
68438
|
-
return localTierStatus(cwd).ok;
|
|
68455
|
+
function localAvailable(cwd, choice = {}) {
|
|
68456
|
+
return localTierStatus(cwd, choice).ok;
|
|
68439
68457
|
}
|
|
68440
68458
|
function resolveLocalDeps(cwd) {
|
|
68441
68459
|
let chromium;
|
|
@@ -68482,8 +68500,18 @@ var realDir = (dir) => {
|
|
|
68482
68500
|
}
|
|
68483
68501
|
};
|
|
68484
68502
|
var MISSING_BROWSER = /Executable doesn'?t exist|playwright install|browserType\.launch/i;
|
|
68485
|
-
async function launchChromium(chromium, cwd = ".", warn = (m) => console.error(m)) {
|
|
68503
|
+
async function launchChromium(chromium, cwd = ".", warn = (m) => console.error(m), choice = {}) {
|
|
68486
68504
|
const args2 = ["--no-sandbox", "--disable-dev-shm-usage"];
|
|
68505
|
+
if (choice.browserPath) {
|
|
68506
|
+
try {
|
|
68507
|
+
return await chromium.launch({ args: args2, executablePath: choice.browserPath });
|
|
68508
|
+
} catch (e) {
|
|
68509
|
+
const msg2 = e instanceof Error ? e.message : String(e);
|
|
68510
|
+
throw new Error(
|
|
68511
|
+
`Could not launch the browser at ${choice.browserPath} (${BROWSER_PATH_SOURCES}): ${msg2.split("\n")[0]}. An explicit browser is never replaced by another \u2014 fix the path, or drop it to let Playwright resolve its own.`
|
|
68512
|
+
);
|
|
68513
|
+
}
|
|
68514
|
+
}
|
|
68487
68515
|
let first;
|
|
68488
68516
|
try {
|
|
68489
68517
|
return await chromium.launch({ args: args2 });
|
|
@@ -68849,7 +68877,7 @@ async function runScanLocal(opts) {
|
|
|
68849
68877
|
const lang = opts.lang ?? "en";
|
|
68850
68878
|
const interact = opts.interact !== false;
|
|
68851
68879
|
const { chromium, AxeBuilder } = resolveLocalDeps(opts.cwd);
|
|
68852
|
-
const browser = await launchChromium(chromium, opts.cwd);
|
|
68880
|
+
const browser = await launchChromium(chromium, opts.cwd, void 0, { browserPath: opts.browserPath });
|
|
68853
68881
|
try {
|
|
68854
68882
|
const out2 = await runOnPage(browser, AxeBuilder, opts.target, isFile, {
|
|
68855
68883
|
storageState: opts.storageState,
|
|
@@ -68868,7 +68896,7 @@ async function runScanManyLocal(urls, opts) {
|
|
|
68868
68896
|
const lang = opts.lang ?? "en";
|
|
68869
68897
|
const interact = opts.interact !== false;
|
|
68870
68898
|
const { chromium, AxeBuilder } = resolveLocalDeps(opts.cwd);
|
|
68871
|
-
const browser = await launchChromium(chromium, opts.cwd);
|
|
68899
|
+
const browser = await launchChromium(chromium, opts.cwd, void 0, { browserPath: opts.browserPath });
|
|
68872
68900
|
const findings = [];
|
|
68873
68901
|
const snapshots = [];
|
|
68874
68902
|
const outs = [];
|
|
@@ -68929,7 +68957,7 @@ async function runSampleScanLocal(pages, opts) {
|
|
|
68929
68957
|
const lang = opts.lang ?? "en";
|
|
68930
68958
|
const interact = opts.interact !== false;
|
|
68931
68959
|
const { chromium, AxeBuilder } = resolveLocalDeps(opts.cwd);
|
|
68932
|
-
const browser = await launchChromium(chromium, opts.cwd);
|
|
68960
|
+
const browser = await launchChromium(chromium, opts.cwd, void 0, { browserPath: opts.browserPath });
|
|
68933
68961
|
const findings = [];
|
|
68934
68962
|
const snapshots = [];
|
|
68935
68963
|
const outs = [];
|
|
@@ -75904,6 +75932,9 @@ Options:
|
|
|
75904
75932
|
--docker scan: alias of --runtime docker (built on first use)
|
|
75905
75933
|
--cwd <dir> scan: --runtime local resolves @playwright/test + @axe-core/playwright
|
|
75906
75934
|
(and the browser) from here (e.g. --cwd packages/app)
|
|
75935
|
+
--browser-path <file> scan / status --browser: launch THIS browser executable (e.g. a
|
|
75936
|
+
distribution's /usr/bin/chromium) instead of the one Playwright resolves.
|
|
75937
|
+
Explicit: never replaced by a fallback. Env: ULTRA11Y_BROWSER_PATH
|
|
75907
75938
|
--storage-state <file> scan: --runtime local \u2014 Playwright storageState JSON for
|
|
75908
75939
|
authenticated pages (e.g. test-results/.auth/user.json)
|
|
75909
75940
|
--no-interact scan: --runtime local \u2014 disable the STATEFUL probes (fill inputs,
|
|
@@ -76063,6 +76094,9 @@ var VALUE_FLAGS2 = /* @__PURE__ */ new Set([
|
|
|
76063
76094
|
"guidance",
|
|
76064
76095
|
"runtime",
|
|
76065
76096
|
"cwd",
|
|
76097
|
+
// `scan` / `status --browser`: an explicit browser executable (a distribution's Chromium),
|
|
76098
|
+
// launched as given and never replaced by Playwright's fallbacks. Env: ULTRA11Y_BROWSER_PATH.
|
|
76099
|
+
"browser-path",
|
|
76066
76100
|
"storage-state",
|
|
76067
76101
|
"captures",
|
|
76068
76102
|
"run",
|
|
@@ -77008,9 +77042,14 @@ function reportInstall(results, verb) {
|
|
|
77008
77042
|
}
|
|
77009
77043
|
return failed2 ? 1 : 0;
|
|
77010
77044
|
}
|
|
77045
|
+
function browserPathOf(flags2, env = process.env) {
|
|
77046
|
+
if (typeof flags2["browser-path"] === "string" && flags2["browser-path"]) return flags2["browser-path"];
|
|
77047
|
+
const fromEnv = env.ULTRA11Y_BROWSER_PATH;
|
|
77048
|
+
return typeof fromEnv === "string" && fromEnv.trim() ? fromEnv.trim() : void 0;
|
|
77049
|
+
}
|
|
77011
77050
|
function cmdStatus(p) {
|
|
77012
77051
|
const rows = statusReport({ project: p.flags.project === true });
|
|
77013
|
-
const browser = p.flags.browser === true ? localTierStatus(typeof p.flags.cwd === "string" && p.flags.cwd ? p.flags.cwd : ".") : void 0;
|
|
77052
|
+
const browser = p.flags.browser === true ? localTierStatus(typeof p.flags.cwd === "string" && p.flags.cwd ? p.flags.cwd : ".", { browserPath: browserPathOf(p.flags) }) : void 0;
|
|
77014
77053
|
if (p.flags.json === true) {
|
|
77015
77054
|
console.log(JSON.stringify({ version: VERSION, targets: rows, ...browser ? { browser } : {} }, null, 2));
|
|
77016
77055
|
return 0;
|
|
@@ -78481,6 +78520,7 @@ async function cmdScan(p) {
|
|
|
78481
78520
|
}
|
|
78482
78521
|
const cwd = typeof p.flags.cwd === "string" && p.flags.cwd ? p.flags.cwd : process.cwd();
|
|
78483
78522
|
const storageState = typeof p.flags["storage-state"] === "string" && p.flags["storage-state"] ? p.flags["storage-state"] : void 0;
|
|
78523
|
+
const browserPath = browserPathOf(p.flags);
|
|
78484
78524
|
const runtimeFlag = typeof p.flags.runtime === "string" && p.flags.runtime ? p.flags.runtime : p.flags.local === true ? "local" : p.flags.docker === true ? "docker" : "auto";
|
|
78485
78525
|
if (!["auto", "local", "docker"].includes(runtimeFlag)) {
|
|
78486
78526
|
console.error(`ultra11y scan: --runtime must be local, docker, or auto (got "${runtimeFlag}").`);
|
|
@@ -78489,10 +78529,10 @@ async function cmdScan(p) {
|
|
|
78489
78529
|
let useLocal;
|
|
78490
78530
|
if (runtimeFlag === "local") useLocal = true;
|
|
78491
78531
|
else if (runtimeFlag === "docker") useLocal = false;
|
|
78492
|
-
else if (localAvailable(cwd)) useLocal = true;
|
|
78532
|
+
else if (localAvailable(cwd, { browserPath })) useLocal = true;
|
|
78493
78533
|
else if (dockerAvailable()) {
|
|
78494
78534
|
useLocal = false;
|
|
78495
|
-
const s = localTierStatus(cwd);
|
|
78535
|
+
const s = localTierStatus(cwd, { browserPath });
|
|
78496
78536
|
console.error(
|
|
78497
78537
|
lang === "fr" ? `ultra11y scan : tier local indisponible${s.ok ? "" : ` (${s.reason})`} \u2014 bascule sur Docker. Passez --runtime local pour en faire une erreur.` : `ultra11y scan: local tier unavailable${s.ok ? "" : ` (${s.reason})`} \u2014 falling back to Docker. Pass --runtime local to make this an error instead.`
|
|
78498
78538
|
);
|
|
@@ -78548,12 +78588,12 @@ async function cmdScan(p) {
|
|
|
78548
78588
|
let dynamic;
|
|
78549
78589
|
try {
|
|
78550
78590
|
if (useSample && sampleConfig) {
|
|
78551
|
-
dynamic = useLocal ? await runSampleScanLocal(sampleConfig.pages, { cwd, storageState, lang, interact, interactClicks, snapshotRoot }) : runSampleScan(sampleConfig.pages, void 0, snapshotRoot);
|
|
78591
|
+
dynamic = useLocal ? await runSampleScanLocal(sampleConfig.pages, { cwd, storageState, lang, interact, interactClicks, snapshotRoot, browserPath }) : runSampleScan(sampleConfig.pages, void 0, snapshotRoot);
|
|
78552
78592
|
} else if (sitemap || crawl) {
|
|
78553
78593
|
const depth = typeof p.flags.depth === "string" ? Number(p.flags.depth) : void 0;
|
|
78554
78594
|
const max = typeof p.flags.max === "string" ? Number(p.flags.max) : void 0;
|
|
78555
78595
|
const onPage = (url, n) => console.error(`ultra11y scan: page ${n} \u2014 ${url}`);
|
|
78556
|
-
dynamic = useLocal ? await runCrawlScanLocal({ sitemap, crawl, depth, max, onPage, cwd, storageState, lang, interact, interactClicks, snapshotRoot }) : await runCrawlScan({ sitemap, crawl, depth, max, onPage, snapshotRoot });
|
|
78596
|
+
dynamic = useLocal ? await runCrawlScanLocal({ sitemap, crawl, depth, max, onPage, cwd, storageState, lang, interact, interactClicks, snapshotRoot, browserPath }) : await runCrawlScan({ sitemap, crawl, depth, max, onPage, snapshotRoot });
|
|
78557
78597
|
} else {
|
|
78558
78598
|
const targets = p.positionals.filter((a) => a !== "-");
|
|
78559
78599
|
if (targets.length === 0) {
|
|
@@ -78561,7 +78601,7 @@ async function cmdScan(p) {
|
|
|
78561
78601
|
return 2;
|
|
78562
78602
|
}
|
|
78563
78603
|
if (useLocal) {
|
|
78564
|
-
dynamic = targets.length === 1 ? await runScanLocal({ target: targets[0], cwd, storageState, lang, interact, interactClicks, snapshotRoot }) : await runScanManyLocal(targets, { cwd, storageState, lang, interact, interactClicks, snapshotRoot });
|
|
78604
|
+
dynamic = targets.length === 1 ? await runScanLocal({ target: targets[0], cwd, storageState, lang, interact, interactClicks, snapshotRoot, browserPath }) : await runScanManyLocal(targets, { cwd, storageState, lang, interact, interactClicks, snapshotRoot, browserPath });
|
|
78565
78605
|
} else {
|
|
78566
78606
|
dynamic = targets.length === 1 ? runScan({ target: targets[0], snapshotRoot }) : runScanMany(targets, void 0, snapshotRoot);
|
|
78567
78607
|
}
|
|
@@ -79208,6 +79248,7 @@ if (isInvokedDirectly()) {
|
|
|
79208
79248
|
export {
|
|
79209
79249
|
COMMANDS,
|
|
79210
79250
|
REMOVED_FLAGS,
|
|
79251
|
+
browserPathOf,
|
|
79211
79252
|
main,
|
|
79212
79253
|
parseArgs,
|
|
79213
79254
|
scanSnapshotRoot
|
package/skills/ultra11y/SKILL.md
CHANGED
|
@@ -3,7 +3,7 @@ name: ultra11y
|
|
|
3
3
|
description: "Use to AUDIT a site, repository, or page against RGAA 4.1.2, the French State's accessibility standard (référentiel de l'État), on a WCAG 2.2 AA core (other country standards as packs); produce a dated conformance report, criterion grid, PRD backlog, or tickets; AUTHOR accessible markup; fix accessibility; or wire a repo gate and rendered-DOM capture pipeline. The bundled install-free engine runs 95 static checks tied to success criteria, while the agent adjudicates judgment criteria and routes rendering criteria to browser scans; check/verify reject invented non-conformities and never declare conforming what was not verified. Use `review-a11y` instead for a review scoped only to a diff, branch, or PR."
|
|
4
4
|
license: MIT
|
|
5
5
|
metadata:
|
|
6
|
-
version: 5.
|
|
6
|
+
version: 5.49.0
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
# ultra11y — audit WCAG 2.2 AA and write accessible markup
|
|
@@ -14,6 +14,12 @@ content on hover (1.4.13), target size (2.5.8). The dynamic tier decides them by
|
|
|
14
14
|
Dockerfile embedded in the bundle). No host deps beyond Docker. Axe + 320px reflow only.
|
|
15
15
|
- **`--runtime auto`** (default): local if Playwright resolves **and** a browser binary is on
|
|
16
16
|
disk, else Docker, else an actionable error.
|
|
17
|
+
- **`--browser-path <file>`** (or `ULTRA11Y_BROWSER_PATH`): launch **this** executable with the
|
|
18
|
+
local runtime instead of the browser Playwright resolves — a distribution's Chromium
|
|
19
|
+
(`/usr/bin/chromium` on Debian, what a sandboxed runner image ships), which Playwright's own
|
|
20
|
+
resolution and its Google Chrome fallback never find. It is an explicit choice: the engine
|
|
21
|
+
launches that file and nothing else, and `status --browser --browser-path <file>` answers
|
|
22
|
+
about that file (`ok` + `executable`, or a reason naming the path).
|
|
17
23
|
|
|
18
24
|
## Prerequisites
|
|
19
25
|
|
|
@@ -46,6 +52,10 @@ node scripts/ultra11y.mjs scan https://example.com --json
|
|
|
46
52
|
# explicit local runtime, resolving deps + browser from a project (e.g. a monorepo package)
|
|
47
53
|
node scripts/ultra11y.mjs scan http://localhost:3000 --runtime local --cwd packages/app --json
|
|
48
54
|
|
|
55
|
+
# a browser already on the machine (a distribution's Chromium), never downloaded by Playwright
|
|
56
|
+
node scripts/ultra11y.mjs status --browser --cwd . --browser-path /usr/bin/chromium --json
|
|
57
|
+
node scripts/ultra11y.mjs scan http://localhost:3000 --runtime local --cwd . --browser-path /usr/bin/chromium --json
|
|
58
|
+
|
|
49
59
|
# authenticated pages: pass a Playwright storageState JSON (cookies/localStorage)
|
|
50
60
|
node scripts/ultra11y.mjs scan http://localhost:3000/dashboard --runtime local \
|
|
51
61
|
--cwd packages/app --storage-state packages/app/test-results/.auth/user.json --json
|
|
@@ -6,7 +6,7 @@ import { join as join53, relative as relative6, resolve as resolve17, sep as sep
|
|
|
6
6
|
import { fileURLToPath as fileURLToPath5, pathToFileURL as pathToFileURL3 } from "url";
|
|
7
7
|
|
|
8
8
|
// src/types.ts
|
|
9
|
-
var VERSION = "5.
|
|
9
|
+
var VERSION = "5.49.0";
|
|
10
10
|
var SCHEMA_VERSION = 2;
|
|
11
11
|
var INAPPLICABLE_STATUS = "C";
|
|
12
12
|
|
|
@@ -68412,12 +68412,30 @@ function resolvesRuntime(cwd, spec) {
|
|
|
68412
68412
|
}
|
|
68413
68413
|
});
|
|
68414
68414
|
}
|
|
68415
|
-
|
|
68415
|
+
var BROWSER_PATH_SOURCES = "--browser-path / ULTRA11Y_BROWSER_PATH";
|
|
68416
|
+
function localTierStatus(cwd, choice = {}) {
|
|
68416
68417
|
for (const spec of [PW_SPEC, AXE_SPEC]) {
|
|
68417
68418
|
if (!resolvesRuntime(cwd, spec)) {
|
|
68418
68419
|
return { ok: false, reason: `${spec} resolves neither from ${cwd} nor from ultra11y itself` };
|
|
68419
68420
|
}
|
|
68420
68421
|
}
|
|
68422
|
+
if (choice.browserPath) {
|
|
68423
|
+
const executable = choice.browserPath;
|
|
68424
|
+
let isFile = false;
|
|
68425
|
+
try {
|
|
68426
|
+
isFile = statSync15(executable).isFile();
|
|
68427
|
+
} catch {
|
|
68428
|
+
isFile = false;
|
|
68429
|
+
}
|
|
68430
|
+
if (!isFile) {
|
|
68431
|
+
return {
|
|
68432
|
+
ok: false,
|
|
68433
|
+
executable,
|
|
68434
|
+
reason: `no browser binary at ${executable} (${BROWSER_PATH_SOURCES}) \u2014 install a browser there, or drop the path to let Playwright resolve its own`
|
|
68435
|
+
};
|
|
68436
|
+
}
|
|
68437
|
+
return { ok: true, executable };
|
|
68438
|
+
}
|
|
68421
68439
|
try {
|
|
68422
68440
|
const pw = requireRuntime(cwd, PW_SPEC);
|
|
68423
68441
|
const bin = pw.chromium?.executablePath?.();
|
|
@@ -68434,8 +68452,8 @@ function localTierStatus(cwd) {
|
|
|
68434
68452
|
return { ok: false, reason: `${PW_SPEC} failed to load: ${e.message.split("\n")[0]}` };
|
|
68435
68453
|
}
|
|
68436
68454
|
}
|
|
68437
|
-
function localAvailable(cwd) {
|
|
68438
|
-
return localTierStatus(cwd).ok;
|
|
68455
|
+
function localAvailable(cwd, choice = {}) {
|
|
68456
|
+
return localTierStatus(cwd, choice).ok;
|
|
68439
68457
|
}
|
|
68440
68458
|
function resolveLocalDeps(cwd) {
|
|
68441
68459
|
let chromium;
|
|
@@ -68482,8 +68500,18 @@ var realDir = (dir) => {
|
|
|
68482
68500
|
}
|
|
68483
68501
|
};
|
|
68484
68502
|
var MISSING_BROWSER = /Executable doesn'?t exist|playwright install|browserType\.launch/i;
|
|
68485
|
-
async function launchChromium(chromium, cwd = ".", warn = (m) => console.error(m)) {
|
|
68503
|
+
async function launchChromium(chromium, cwd = ".", warn = (m) => console.error(m), choice = {}) {
|
|
68486
68504
|
const args2 = ["--no-sandbox", "--disable-dev-shm-usage"];
|
|
68505
|
+
if (choice.browserPath) {
|
|
68506
|
+
try {
|
|
68507
|
+
return await chromium.launch({ args: args2, executablePath: choice.browserPath });
|
|
68508
|
+
} catch (e) {
|
|
68509
|
+
const msg2 = e instanceof Error ? e.message : String(e);
|
|
68510
|
+
throw new Error(
|
|
68511
|
+
`Could not launch the browser at ${choice.browserPath} (${BROWSER_PATH_SOURCES}): ${msg2.split("\n")[0]}. An explicit browser is never replaced by another \u2014 fix the path, or drop it to let Playwright resolve its own.`
|
|
68512
|
+
);
|
|
68513
|
+
}
|
|
68514
|
+
}
|
|
68487
68515
|
let first;
|
|
68488
68516
|
try {
|
|
68489
68517
|
return await chromium.launch({ args: args2 });
|
|
@@ -68849,7 +68877,7 @@ async function runScanLocal(opts) {
|
|
|
68849
68877
|
const lang = opts.lang ?? "en";
|
|
68850
68878
|
const interact = opts.interact !== false;
|
|
68851
68879
|
const { chromium, AxeBuilder } = resolveLocalDeps(opts.cwd);
|
|
68852
|
-
const browser = await launchChromium(chromium, opts.cwd);
|
|
68880
|
+
const browser = await launchChromium(chromium, opts.cwd, void 0, { browserPath: opts.browserPath });
|
|
68853
68881
|
try {
|
|
68854
68882
|
const out2 = await runOnPage(browser, AxeBuilder, opts.target, isFile, {
|
|
68855
68883
|
storageState: opts.storageState,
|
|
@@ -68868,7 +68896,7 @@ async function runScanManyLocal(urls, opts) {
|
|
|
68868
68896
|
const lang = opts.lang ?? "en";
|
|
68869
68897
|
const interact = opts.interact !== false;
|
|
68870
68898
|
const { chromium, AxeBuilder } = resolveLocalDeps(opts.cwd);
|
|
68871
|
-
const browser = await launchChromium(chromium, opts.cwd);
|
|
68899
|
+
const browser = await launchChromium(chromium, opts.cwd, void 0, { browserPath: opts.browserPath });
|
|
68872
68900
|
const findings = [];
|
|
68873
68901
|
const snapshots = [];
|
|
68874
68902
|
const outs = [];
|
|
@@ -68929,7 +68957,7 @@ async function runSampleScanLocal(pages, opts) {
|
|
|
68929
68957
|
const lang = opts.lang ?? "en";
|
|
68930
68958
|
const interact = opts.interact !== false;
|
|
68931
68959
|
const { chromium, AxeBuilder } = resolveLocalDeps(opts.cwd);
|
|
68932
|
-
const browser = await launchChromium(chromium, opts.cwd);
|
|
68960
|
+
const browser = await launchChromium(chromium, opts.cwd, void 0, { browserPath: opts.browserPath });
|
|
68933
68961
|
const findings = [];
|
|
68934
68962
|
const snapshots = [];
|
|
68935
68963
|
const outs = [];
|
|
@@ -75904,6 +75932,9 @@ Options:
|
|
|
75904
75932
|
--docker scan: alias of --runtime docker (built on first use)
|
|
75905
75933
|
--cwd <dir> scan: --runtime local resolves @playwright/test + @axe-core/playwright
|
|
75906
75934
|
(and the browser) from here (e.g. --cwd packages/app)
|
|
75935
|
+
--browser-path <file> scan / status --browser: launch THIS browser executable (e.g. a
|
|
75936
|
+
distribution's /usr/bin/chromium) instead of the one Playwright resolves.
|
|
75937
|
+
Explicit: never replaced by a fallback. Env: ULTRA11Y_BROWSER_PATH
|
|
75907
75938
|
--storage-state <file> scan: --runtime local \u2014 Playwright storageState JSON for
|
|
75908
75939
|
authenticated pages (e.g. test-results/.auth/user.json)
|
|
75909
75940
|
--no-interact scan: --runtime local \u2014 disable the STATEFUL probes (fill inputs,
|
|
@@ -76063,6 +76094,9 @@ var VALUE_FLAGS2 = /* @__PURE__ */ new Set([
|
|
|
76063
76094
|
"guidance",
|
|
76064
76095
|
"runtime",
|
|
76065
76096
|
"cwd",
|
|
76097
|
+
// `scan` / `status --browser`: an explicit browser executable (a distribution's Chromium),
|
|
76098
|
+
// launched as given and never replaced by Playwright's fallbacks. Env: ULTRA11Y_BROWSER_PATH.
|
|
76099
|
+
"browser-path",
|
|
76066
76100
|
"storage-state",
|
|
76067
76101
|
"captures",
|
|
76068
76102
|
"run",
|
|
@@ -77008,9 +77042,14 @@ function reportInstall(results, verb) {
|
|
|
77008
77042
|
}
|
|
77009
77043
|
return failed2 ? 1 : 0;
|
|
77010
77044
|
}
|
|
77045
|
+
function browserPathOf(flags2, env = process.env) {
|
|
77046
|
+
if (typeof flags2["browser-path"] === "string" && flags2["browser-path"]) return flags2["browser-path"];
|
|
77047
|
+
const fromEnv = env.ULTRA11Y_BROWSER_PATH;
|
|
77048
|
+
return typeof fromEnv === "string" && fromEnv.trim() ? fromEnv.trim() : void 0;
|
|
77049
|
+
}
|
|
77011
77050
|
function cmdStatus(p) {
|
|
77012
77051
|
const rows = statusReport({ project: p.flags.project === true });
|
|
77013
|
-
const browser = p.flags.browser === true ? localTierStatus(typeof p.flags.cwd === "string" && p.flags.cwd ? p.flags.cwd : ".") : void 0;
|
|
77052
|
+
const browser = p.flags.browser === true ? localTierStatus(typeof p.flags.cwd === "string" && p.flags.cwd ? p.flags.cwd : ".", { browserPath: browserPathOf(p.flags) }) : void 0;
|
|
77014
77053
|
if (p.flags.json === true) {
|
|
77015
77054
|
console.log(JSON.stringify({ version: VERSION, targets: rows, ...browser ? { browser } : {} }, null, 2));
|
|
77016
77055
|
return 0;
|
|
@@ -78481,6 +78520,7 @@ async function cmdScan(p) {
|
|
|
78481
78520
|
}
|
|
78482
78521
|
const cwd = typeof p.flags.cwd === "string" && p.flags.cwd ? p.flags.cwd : process.cwd();
|
|
78483
78522
|
const storageState = typeof p.flags["storage-state"] === "string" && p.flags["storage-state"] ? p.flags["storage-state"] : void 0;
|
|
78523
|
+
const browserPath = browserPathOf(p.flags);
|
|
78484
78524
|
const runtimeFlag = typeof p.flags.runtime === "string" && p.flags.runtime ? p.flags.runtime : p.flags.local === true ? "local" : p.flags.docker === true ? "docker" : "auto";
|
|
78485
78525
|
if (!["auto", "local", "docker"].includes(runtimeFlag)) {
|
|
78486
78526
|
console.error(`ultra11y scan: --runtime must be local, docker, or auto (got "${runtimeFlag}").`);
|
|
@@ -78489,10 +78529,10 @@ async function cmdScan(p) {
|
|
|
78489
78529
|
let useLocal;
|
|
78490
78530
|
if (runtimeFlag === "local") useLocal = true;
|
|
78491
78531
|
else if (runtimeFlag === "docker") useLocal = false;
|
|
78492
|
-
else if (localAvailable(cwd)) useLocal = true;
|
|
78532
|
+
else if (localAvailable(cwd, { browserPath })) useLocal = true;
|
|
78493
78533
|
else if (dockerAvailable()) {
|
|
78494
78534
|
useLocal = false;
|
|
78495
|
-
const s = localTierStatus(cwd);
|
|
78535
|
+
const s = localTierStatus(cwd, { browserPath });
|
|
78496
78536
|
console.error(
|
|
78497
78537
|
lang === "fr" ? `ultra11y scan : tier local indisponible${s.ok ? "" : ` (${s.reason})`} \u2014 bascule sur Docker. Passez --runtime local pour en faire une erreur.` : `ultra11y scan: local tier unavailable${s.ok ? "" : ` (${s.reason})`} \u2014 falling back to Docker. Pass --runtime local to make this an error instead.`
|
|
78498
78538
|
);
|
|
@@ -78548,12 +78588,12 @@ async function cmdScan(p) {
|
|
|
78548
78588
|
let dynamic;
|
|
78549
78589
|
try {
|
|
78550
78590
|
if (useSample && sampleConfig) {
|
|
78551
|
-
dynamic = useLocal ? await runSampleScanLocal(sampleConfig.pages, { cwd, storageState, lang, interact, interactClicks, snapshotRoot }) : runSampleScan(sampleConfig.pages, void 0, snapshotRoot);
|
|
78591
|
+
dynamic = useLocal ? await runSampleScanLocal(sampleConfig.pages, { cwd, storageState, lang, interact, interactClicks, snapshotRoot, browserPath }) : runSampleScan(sampleConfig.pages, void 0, snapshotRoot);
|
|
78552
78592
|
} else if (sitemap || crawl) {
|
|
78553
78593
|
const depth = typeof p.flags.depth === "string" ? Number(p.flags.depth) : void 0;
|
|
78554
78594
|
const max = typeof p.flags.max === "string" ? Number(p.flags.max) : void 0;
|
|
78555
78595
|
const onPage = (url, n) => console.error(`ultra11y scan: page ${n} \u2014 ${url}`);
|
|
78556
|
-
dynamic = useLocal ? await runCrawlScanLocal({ sitemap, crawl, depth, max, onPage, cwd, storageState, lang, interact, interactClicks, snapshotRoot }) : await runCrawlScan({ sitemap, crawl, depth, max, onPage, snapshotRoot });
|
|
78596
|
+
dynamic = useLocal ? await runCrawlScanLocal({ sitemap, crawl, depth, max, onPage, cwd, storageState, lang, interact, interactClicks, snapshotRoot, browserPath }) : await runCrawlScan({ sitemap, crawl, depth, max, onPage, snapshotRoot });
|
|
78557
78597
|
} else {
|
|
78558
78598
|
const targets = p.positionals.filter((a) => a !== "-");
|
|
78559
78599
|
if (targets.length === 0) {
|
|
@@ -78561,7 +78601,7 @@ async function cmdScan(p) {
|
|
|
78561
78601
|
return 2;
|
|
78562
78602
|
}
|
|
78563
78603
|
if (useLocal) {
|
|
78564
|
-
dynamic = targets.length === 1 ? await runScanLocal({ target: targets[0], cwd, storageState, lang, interact, interactClicks, snapshotRoot }) : await runScanManyLocal(targets, { cwd, storageState, lang, interact, interactClicks, snapshotRoot });
|
|
78604
|
+
dynamic = targets.length === 1 ? await runScanLocal({ target: targets[0], cwd, storageState, lang, interact, interactClicks, snapshotRoot, browserPath }) : await runScanManyLocal(targets, { cwd, storageState, lang, interact, interactClicks, snapshotRoot, browserPath });
|
|
78565
78605
|
} else {
|
|
78566
78606
|
dynamic = targets.length === 1 ? runScan({ target: targets[0], snapshotRoot }) : runScanMany(targets, void 0, snapshotRoot);
|
|
78567
78607
|
}
|
|
@@ -79208,6 +79248,7 @@ if (isInvokedDirectly()) {
|
|
|
79208
79248
|
export {
|
|
79209
79249
|
COMMANDS,
|
|
79210
79250
|
REMOVED_FLAGS,
|
|
79251
|
+
browserPathOf,
|
|
79211
79252
|
main,
|
|
79212
79253
|
parseArgs,
|
|
79213
79254
|
scanSnapshotRoot
|
|
@@ -27,7 +27,7 @@ variables:
|
|
|
27
27
|
ULTRA11Y_LANG: en
|
|
28
28
|
# Exact by default: a CI report must say which engine produced it. The release script keeps
|
|
29
29
|
# this pin aligned with the package version; override only for a deliberate upgrade test.
|
|
30
|
-
ULTRA11Y_VERSION: '5.
|
|
30
|
+
ULTRA11Y_VERSION: '5.49.0'
|
|
31
31
|
# Batches of 8 amortise the prompt; each accepted verdict is checkpointed before the next
|
|
32
32
|
# batch, and later passes receive only the residue.
|
|
33
33
|
ULTRA11Y_GRAIN: batch
|
package/src/cli.ts
CHANGED
|
@@ -510,6 +510,9 @@ Options:
|
|
|
510
510
|
--docker scan: alias of --runtime docker (built on first use)
|
|
511
511
|
--cwd <dir> scan: --runtime local resolves @playwright/test + @axe-core/playwright
|
|
512
512
|
(and the browser) from here (e.g. --cwd packages/app)
|
|
513
|
+
--browser-path <file> scan / status --browser: launch THIS browser executable (e.g. a
|
|
514
|
+
distribution's /usr/bin/chromium) instead of the one Playwright resolves.
|
|
515
|
+
Explicit: never replaced by a fallback. Env: ULTRA11Y_BROWSER_PATH
|
|
513
516
|
--storage-state <file> scan: --runtime local — Playwright storageState JSON for
|
|
514
517
|
authenticated pages (e.g. test-results/.auth/user.json)
|
|
515
518
|
--no-interact scan: --runtime local — disable the STATEFUL probes (fill inputs,
|
|
@@ -673,6 +676,9 @@ const VALUE_FLAGS = new Set([
|
|
|
673
676
|
"guidance",
|
|
674
677
|
"runtime",
|
|
675
678
|
"cwd",
|
|
679
|
+
// `scan` / `status --browser`: an explicit browser executable (a distribution's Chromium),
|
|
680
|
+
// launched as given and never replaced by Playwright's fallbacks. Env: ULTRA11Y_BROWSER_PATH.
|
|
681
|
+
"browser-path",
|
|
676
682
|
"storage-state",
|
|
677
683
|
"captures",
|
|
678
684
|
"run",
|
|
@@ -2024,6 +2030,16 @@ function reportInstall(results: ReturnType<typeof installForTargets>, verb: stri
|
|
|
2024
2030
|
return failed ? 1 : 0;
|
|
2025
2031
|
}
|
|
2026
2032
|
|
|
2033
|
+
/** The browser executable the caller named, if any: `--browser-path` first, then the
|
|
2034
|
+
* `ULTRA11Y_BROWSER_PATH` environment variable — the form a runner image or an orchestrator
|
|
2035
|
+
* sets once for every engine call. Read in ONE place so `status --browser` and `scan` answer
|
|
2036
|
+
* from the same choice; `scan-local.ts` only ever sees the resolved value. */
|
|
2037
|
+
export function browserPathOf(flags: Record<string, string | boolean>, env: NodeJS.ProcessEnv = process.env): string | undefined {
|
|
2038
|
+
if (typeof flags["browser-path"] === "string" && flags["browser-path"]) return flags["browser-path"] as string;
|
|
2039
|
+
const fromEnv = env.ULTRA11Y_BROWSER_PATH;
|
|
2040
|
+
return typeof fromEnv === "string" && fromEnv.trim() ? fromEnv.trim() : undefined;
|
|
2041
|
+
}
|
|
2042
|
+
|
|
2027
2043
|
/** `status` — the doctor. Answers "is the automatic review actually going to fire?", which
|
|
2028
2044
|
* is otherwise invisible until a commit that should have been stopped goes through. */
|
|
2029
2045
|
function cmdStatus(p: ParsedArgs): number {
|
|
@@ -2036,7 +2052,10 @@ function cmdStatus(p: ParsedArgs): number {
|
|
|
2036
2052
|
// Opt-in, because resolving two packages and stat-ing a browser binary is work the harness
|
|
2037
2053
|
// doctor has no reason to do. Exit code stays 0 either way: this is a QUESTION, and a doctor
|
|
2038
2054
|
// that exits non-zero is one nobody can put in an `if`.
|
|
2039
|
-
const browser =
|
|
2055
|
+
const browser =
|
|
2056
|
+
p.flags.browser === true
|
|
2057
|
+
? localTierStatus(typeof p.flags.cwd === "string" && p.flags.cwd ? p.flags.cwd : ".", { browserPath: browserPathOf(p.flags) })
|
|
2058
|
+
: undefined;
|
|
2040
2059
|
if (p.flags.json === true) {
|
|
2041
2060
|
console.log(JSON.stringify({ version: VERSION, targets: rows, ...(browser ? { browser } : {}) }, null, 2));
|
|
2042
2061
|
return 0;
|
|
@@ -4138,6 +4157,7 @@ async function cmdScan(p: ParsedArgs): Promise<number> {
|
|
|
4138
4157
|
// Playwright (no Docker) when it resolves from --cwd, else falls back to Docker.
|
|
4139
4158
|
const cwd = typeof p.flags.cwd === "string" && p.flags.cwd ? (p.flags.cwd as string) : process.cwd();
|
|
4140
4159
|
const storageState = typeof p.flags["storage-state"] === "string" && p.flags["storage-state"] ? (p.flags["storage-state"] as string) : undefined;
|
|
4160
|
+
const browserPath = browserPathOf(p.flags);
|
|
4141
4161
|
const runtimeFlag =
|
|
4142
4162
|
typeof p.flags.runtime === "string" && p.flags.runtime
|
|
4143
4163
|
? (p.flags.runtime as string)
|
|
@@ -4153,12 +4173,12 @@ async function cmdScan(p: ParsedArgs): Promise<number> {
|
|
|
4153
4173
|
let useLocal: boolean;
|
|
4154
4174
|
if (runtimeFlag === "local") useLocal = true;
|
|
4155
4175
|
else if (runtimeFlag === "docker") useLocal = false;
|
|
4156
|
-
else if (localAvailable(cwd)) useLocal = true;
|
|
4176
|
+
else if (localAvailable(cwd, { browserPath })) useLocal = true;
|
|
4157
4177
|
else if (dockerAvailable()) {
|
|
4158
4178
|
useLocal = false;
|
|
4159
4179
|
// A silent degrade is indistinguishable from a working fallback — name what was
|
|
4160
4180
|
// missing, so the one line a reader gets answers "what do I install".
|
|
4161
|
-
const s = localTierStatus(cwd);
|
|
4181
|
+
const s = localTierStatus(cwd, { browserPath });
|
|
4162
4182
|
console.error(
|
|
4163
4183
|
lang === "fr"
|
|
4164
4184
|
? `ultra11y scan : tier local indisponible${s.ok ? "" : ` (${s.reason})`} — bascule sur Docker. Passez --runtime local pour en faire une erreur.`
|
|
@@ -4273,7 +4293,7 @@ async function cmdScan(p: ParsedArgs): Promise<number> {
|
|
|
4273
4293
|
try {
|
|
4274
4294
|
if (useSample && sampleConfig) {
|
|
4275
4295
|
dynamic = useLocal
|
|
4276
|
-
? await runSampleScanLocal(sampleConfig.pages, { cwd, storageState, lang, interact, interactClicks, snapshotRoot })
|
|
4296
|
+
? await runSampleScanLocal(sampleConfig.pages, { cwd, storageState, lang, interact, interactClicks, snapshotRoot, browserPath })
|
|
4277
4297
|
: runSampleScan(sampleConfig.pages, undefined, snapshotRoot);
|
|
4278
4298
|
} else if (sitemap || crawl) {
|
|
4279
4299
|
const depth = typeof p.flags.depth === "string" ? Number(p.flags.depth) : undefined;
|
|
@@ -4284,7 +4304,7 @@ async function cmdScan(p: ParsedArgs): Promise<number> {
|
|
|
4284
4304
|
// dropping the cap.
|
|
4285
4305
|
const onPage = (url: string, n: number): void => console.error(`ultra11y scan: page ${n} — ${url}`);
|
|
4286
4306
|
dynamic = useLocal
|
|
4287
|
-
? await runCrawlScanLocal({ sitemap, crawl, depth, max, onPage, cwd, storageState, lang, interact, interactClicks, snapshotRoot })
|
|
4307
|
+
? await runCrawlScanLocal({ sitemap, crawl, depth, max, onPage, cwd, storageState, lang, interact, interactClicks, snapshotRoot, browserPath })
|
|
4288
4308
|
: await runCrawlScan({ sitemap, crawl, depth, max, onPage, snapshotRoot });
|
|
4289
4309
|
} else {
|
|
4290
4310
|
const targets = p.positionals.filter((a) => a !== "-");
|
|
@@ -4295,8 +4315,8 @@ async function cmdScan(p: ParsedArgs): Promise<number> {
|
|
|
4295
4315
|
if (useLocal) {
|
|
4296
4316
|
dynamic =
|
|
4297
4317
|
targets.length === 1
|
|
4298
|
-
? await runScanLocal({ target: targets[0]!, cwd, storageState, lang, interact, interactClicks, snapshotRoot })
|
|
4299
|
-
: await runScanManyLocal(targets, { cwd, storageState, lang, interact, interactClicks, snapshotRoot });
|
|
4318
|
+
? await runScanLocal({ target: targets[0]!, cwd, storageState, lang, interact, interactClicks, snapshotRoot, browserPath })
|
|
4319
|
+
: await runScanManyLocal(targets, { cwd, storageState, lang, interact, interactClicks, snapshotRoot, browserPath });
|
|
4300
4320
|
} else {
|
|
4301
4321
|
dynamic = targets.length === 1 ? runScan({ target: targets[0]!, snapshotRoot }) : runScanMany(targets, undefined, snapshotRoot);
|
|
4302
4322
|
}
|
package/src/scan-local.ts
CHANGED
|
@@ -137,17 +137,52 @@ function resolvesRuntime(cwd: string, spec: string): boolean {
|
|
|
137
137
|
/** Why the LOCAL tier is (un)usable from `cwd` — the one line a reader of a
|
|
138
138
|
* `runtime: auto` log gets before the Docker fallback takes over. A silent degrade is
|
|
139
139
|
* indistinguishable from a working fallback, so the reason must NAME what to install. */
|
|
140
|
-
export type LocalTierStatus = { ok: true } | { ok: false; reason: string };
|
|
140
|
+
export type LocalTierStatus = { ok: true; executable?: string } | { ok: false; reason: string; executable?: string };
|
|
141
|
+
|
|
142
|
+
/** An explicit browser executable for the local tier — `scan --browser-path`,
|
|
143
|
+
* `status --browser --browser-path`, or `ULTRA11Y_BROWSER_PATH`.
|
|
144
|
+
*
|
|
145
|
+
* Playwright resolves its pinned headless shell, then its full Chromium build, then Google
|
|
146
|
+
* Chrome at the vendor's install path. A distribution's Chromium — `/usr/bin/chromium` on
|
|
147
|
+
* Debian, which is what a sandboxed runner image ships — is on none of those paths, so a
|
|
148
|
+
* caller that already has a browser was told to download a second one. The path is an
|
|
149
|
+
* EXPLICIT choice: it is launched as given and never replaced by a fallback, and a status
|
|
150
|
+
* probe names it rather than the binary Playwright would have wanted. */
|
|
151
|
+
export interface BrowserChoice {
|
|
152
|
+
browserPath?: string;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const BROWSER_PATH_SOURCES = "--browser-path / ULTRA11Y_BROWSER_PATH";
|
|
141
156
|
|
|
142
157
|
/** The same probe as `localAvailable`, keeping the reason instead of collapsing it to a
|
|
143
158
|
* boolean. Drives the `runtime: auto` decision AND the message printed when it degrades
|
|
144
159
|
* to Docker. */
|
|
145
|
-
export function localTierStatus(cwd: string): LocalTierStatus {
|
|
160
|
+
export function localTierStatus(cwd: string, choice: BrowserChoice = {}): LocalTierStatus {
|
|
146
161
|
for (const spec of [PW_SPEC, AXE_SPEC]) {
|
|
147
162
|
if (!resolvesRuntime(cwd, spec)) {
|
|
148
163
|
return { ok: false, reason: `${spec} resolves neither from ${cwd} nor from ultra11y itself` };
|
|
149
164
|
}
|
|
150
165
|
}
|
|
166
|
+
if (choice.browserPath) {
|
|
167
|
+
// An explicit executable replaces Playwright's own resolution entirely: the only question
|
|
168
|
+
// left is whether the file is there. Playwright still drives it, hence the package check
|
|
169
|
+
// above stays. One `stat`, no launch — same budget as the default probe.
|
|
170
|
+
const executable = choice.browserPath;
|
|
171
|
+
let isFile = false;
|
|
172
|
+
try {
|
|
173
|
+
isFile = statSync(executable).isFile();
|
|
174
|
+
} catch {
|
|
175
|
+
isFile = false;
|
|
176
|
+
}
|
|
177
|
+
if (!isFile) {
|
|
178
|
+
return {
|
|
179
|
+
ok: false,
|
|
180
|
+
executable,
|
|
181
|
+
reason: `no browser binary at ${executable} (${BROWSER_PATH_SOURCES}) — install a browser there, or drop the path to let Playwright resolve its own`,
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
return { ok: true, executable };
|
|
185
|
+
}
|
|
151
186
|
try {
|
|
152
187
|
const pw = requireRuntime(cwd, PW_SPEC) as { chromium?: { executablePath?: () => string } };
|
|
153
188
|
const bin = pw.chromium?.executablePath?.();
|
|
@@ -184,8 +219,8 @@ export function localTierStatus(cwd: string): LocalTierStatus {
|
|
|
184
219
|
* local` tests and the action's own crawl job switched themselves on in jobs that install no
|
|
185
220
|
* browser, and failed rather than degrading. `executablePath()` is a pure path computation, so
|
|
186
221
|
* this stays cheap: no launch, no download, one `stat`. */
|
|
187
|
-
export function localAvailable(cwd: string): boolean {
|
|
188
|
-
return localTierStatus(cwd).ok;
|
|
222
|
+
export function localAvailable(cwd: string, choice: BrowserChoice = {}): boolean {
|
|
223
|
+
return localTierStatus(cwd, choice).ok;
|
|
189
224
|
}
|
|
190
225
|
|
|
191
226
|
/** Load Playwright `chromium` + the `AxeBuilder` class from the target project. */
|
|
@@ -254,8 +289,27 @@ const MISSING_BROWSER = /Executable doesn'?t exist|playwright install|browserTyp
|
|
|
254
289
|
* the bundled full Chromium (`channel: "chromium"`), then the installed Google Chrome
|
|
255
290
|
* (`channel: "chrome"`), and say on stderr which one ran. Only when all three fail is it an
|
|
256
291
|
* error — and the error names the Playwright install that was resolved. */
|
|
257
|
-
export async function launchChromium(
|
|
292
|
+
export async function launchChromium(
|
|
293
|
+
chromium: Any,
|
|
294
|
+
cwd = ".",
|
|
295
|
+
warn: (msg: string) => void = (m) => console.error(m),
|
|
296
|
+
choice: BrowserChoice = {},
|
|
297
|
+
): Promise<Any> {
|
|
258
298
|
const args = ["--no-sandbox", "--disable-dev-shm-usage"];
|
|
299
|
+
if (choice.browserPath) {
|
|
300
|
+
// The caller named the browser. Launch THAT one and nothing else: a fallback onto a
|
|
301
|
+
// channel would silently audit with a browser the caller did not choose, and the error
|
|
302
|
+
// that explains the refusal has to name the path the caller can fix.
|
|
303
|
+
try {
|
|
304
|
+
return await chromium.launch({ args, executablePath: choice.browserPath });
|
|
305
|
+
} catch (e) {
|
|
306
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
307
|
+
throw new Error(
|
|
308
|
+
`Could not launch the browser at ${choice.browserPath} (${BROWSER_PATH_SOURCES}): ${msg.split("\n")[0]}. ` +
|
|
309
|
+
"An explicit browser is never replaced by another — fix the path, or drop it to let Playwright resolve its own.",
|
|
310
|
+
);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
259
313
|
let first: unknown;
|
|
260
314
|
try {
|
|
261
315
|
return await chromium.launch({ args });
|
|
@@ -853,6 +907,8 @@ export interface LocalScanOpts {
|
|
|
853
907
|
interactClicks?: boolean;
|
|
854
908
|
/** Repo root under which to persist `.ultra11y/pages/<id>/`. Unset ⇒ no snapshot. */
|
|
855
909
|
snapshotRoot?: string;
|
|
910
|
+
/** Launch this browser executable instead of the one Playwright resolves — see BrowserChoice. */
|
|
911
|
+
browserPath?: string;
|
|
856
912
|
}
|
|
857
913
|
|
|
858
914
|
/** Run the dynamic tier locally over a single URL/file (no Docker). */
|
|
@@ -865,7 +921,7 @@ export async function runScanLocal(opts: LocalScanOpts): Promise<DynamicResult>
|
|
|
865
921
|
const lang = opts.lang ?? "en";
|
|
866
922
|
const interact = opts.interact !== false;
|
|
867
923
|
const { chromium, AxeBuilder } = resolveLocalDeps(opts.cwd);
|
|
868
|
-
const browser = await launchChromium(chromium, opts.cwd);
|
|
924
|
+
const browser = await launchChromium(chromium, opts.cwd, undefined, { browserPath: opts.browserPath });
|
|
869
925
|
try {
|
|
870
926
|
const out = await runOnPage(browser, AxeBuilder, opts.target, isFile, {
|
|
871
927
|
storageState: opts.storageState,
|
|
@@ -889,6 +945,8 @@ export interface LocalManyOpts {
|
|
|
889
945
|
interactClicks?: boolean; // see LocalScanOpts.interactClicks
|
|
890
946
|
/** Repo root under which to persist `.ultra11y/pages/<id>/`. Unset ⇒ no snapshot. */
|
|
891
947
|
snapshotRoot?: string;
|
|
948
|
+
/** Launch this browser executable instead of the one Playwright resolves — see BrowserChoice. */
|
|
949
|
+
browserPath?: string;
|
|
892
950
|
}
|
|
893
951
|
|
|
894
952
|
/** Run the local dynamic tier over many URLs (one browser, one context per page). */
|
|
@@ -896,7 +954,7 @@ export async function runScanManyLocal(urls: string[], opts: LocalManyOpts): Pro
|
|
|
896
954
|
const lang = opts.lang ?? "en";
|
|
897
955
|
const interact = opts.interact !== false;
|
|
898
956
|
const { chromium, AxeBuilder } = resolveLocalDeps(opts.cwd);
|
|
899
|
-
const browser = await launchChromium(chromium, opts.cwd);
|
|
957
|
+
const browser = await launchChromium(chromium, opts.cwd, undefined, { browserPath: opts.browserPath });
|
|
900
958
|
const findings: DynamicFinding[] = [];
|
|
901
959
|
const snapshots: string[] = [];
|
|
902
960
|
// Kept so the run-level coverage stamp can be built from what each page ACTUALLY measured
|
|
@@ -992,7 +1050,7 @@ export async function runSampleScanLocal(pages: SamplePage[], opts: LocalManyOpt
|
|
|
992
1050
|
const lang = opts.lang ?? "en";
|
|
993
1051
|
const interact = opts.interact !== false;
|
|
994
1052
|
const { chromium, AxeBuilder } = resolveLocalDeps(opts.cwd);
|
|
995
|
-
const browser = await launchChromium(chromium, opts.cwd);
|
|
1053
|
+
const browser = await launchChromium(chromium, opts.cwd, undefined, { browserPath: opts.browserPath });
|
|
996
1054
|
const findings: DynamicFinding[] = [];
|
|
997
1055
|
const snapshots: string[] = [];
|
|
998
1056
|
// Kept so the run-level coverage stamp can be built from what each page ACTUALLY measured
|
package/src/types.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Single source of truth for shared types + the embedded version. sync-version.mjs
|
|
2
2
|
// rewrites VERSION at release time (kept in lockstep with package.json + SKILL.md).
|
|
3
|
-
export const VERSION = "5.
|
|
3
|
+
export const VERSION = "5.49.0";
|
|
4
4
|
export const SCHEMA_VERSION = 2;
|
|
5
5
|
|
|
6
6
|
// Lang = the UI FRAME's language — the `L` localization tables each module (report,
|