ultra11y 5.55.3 → 5.55.5

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.
@@ -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.55.3",
13
+ "version": "5.55.5",
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.55.3",
4
+ "version": "5.55.5",
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.55.3",
4
+ "version": "5.55.5",
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.55.3";
30
+ const ULTRA11Y_PLUGIN_VERSION = "5.55.5";
31
31
 
32
32
  const here = dirname(fileURLToPath(import.meta.url));
33
33
 
package/dist/cypress.mjs CHANGED
@@ -59,6 +59,16 @@ var COLLECT_SNAPSHOT = `(() => {
59
59
  els.push(child);
60
60
  const name = child.localName;
61
61
  if (RAW_TEXT.has(name)) continue;
62
+ // With scripting on, a <noscript>'s content is raw TEXT to the browser, while the reparse
63
+ // reads it as elements (#112). Parse that text with the page's own parser and count what
64
+ // it yields, in place, so every later ordinal still lines up. The inert parsed nodes have
65
+ // no computed style and an empty box, which the rules read as \xAB nothing measured \xBB.
66
+ if (name === 'noscript' && child.children.length === 0 && (child.textContent || '').includes('<')) {
67
+ const parsed = document.createElement('template');
68
+ parsed.innerHTML = child.textContent || '';
69
+ walkElements(parsed.content);
70
+ continue;
71
+ }
62
72
  walkElements(name === 'template' && child.content ? child.content : child);
63
73
  }
64
74
  };
@@ -64,6 +64,16 @@ var COLLECT_SNAPSHOT = `(() => {
64
64
  els.push(child);
65
65
  const name = child.localName;
66
66
  if (RAW_TEXT.has(name)) continue;
67
+ // With scripting on, a <noscript>'s content is raw TEXT to the browser, while the reparse
68
+ // reads it as elements (#112). Parse that text with the page's own parser and count what
69
+ // it yields, in place, so every later ordinal still lines up. The inert parsed nodes have
70
+ // no computed style and an empty box, which the rules read as \xAB nothing measured \xBB.
71
+ if (name === 'noscript' && child.children.length === 0 && (child.textContent || '').includes('<')) {
72
+ const parsed = document.createElement('template');
73
+ parsed.innerHTML = child.textContent || '';
74
+ walkElements(parsed.content);
75
+ continue;
76
+ }
67
77
  walkElements(name === 'template' && child.content ? child.content : child);
68
78
  }
69
79
  };
package/docker/runner.mjs CHANGED
@@ -3,7 +3,7 @@ import axe from "axe-core";
3
3
  const target = process.argv[2];
4
4
  const isFile = target.startsWith("/work/");
5
5
  const SNAPSHOT = process.env.ULTRA11Y_SNAPSHOT !== "0";
6
- const COLLECT = "(() => {\n const PROPS = [\"color\",\"backgroundColor\",\"backgroundImage\",\"fontSize\",\"fontWeight\",\"fontStyle\",\"textDecorationLine\",\"textTransform\",\"lineHeight\",\"letterSpacing\",\"wordSpacing\",\"whiteSpace\",\"display\",\"visibility\",\"opacity\",\"position\",\"overflowX\",\"overflowY\",\"outlineStyle\",\"outlineWidth\",\"outlineColor\",\"borderTopStyle\",\"borderRightStyle\",\"borderBottomStyle\",\"borderLeftStyle\",\"borderTopWidth\",\"borderRightWidth\",\"borderBottomWidth\",\"borderLeftWidth\",\"borderTopColor\",\"borderRightColor\",\"borderBottomColor\",\"borderLeftColor\",\"boxShadow\",\"cursor\"];\n const MAX = 5000;\n // The ordinal is a JOIN KEY against parseHtml(dom), so the walk must enumerate elements\n // exactly as a reparse of the serialisation below will (#101). querySelectorAll('*') did not:\n // - an element appended INSIDE a raw-text element (Next's dev overlay puts <nextjs-portal>\n // in a <script>) is serialised as that element's raw text, and a reparse reads text —\n // one ordinal too many, and every digest refused from there on;\n // - <template> contents are serialised and reparsed as elements, but live in\n // template.content, which querySelectorAll never traverses — one ordinal too few.\n // Pre-order, children of the raw-text elements HTML parsers (htmlparser2 included) treat as\n // text skipped, template.content descended.\n const RAW_TEXT = new Set(['script', 'style', 'title', 'textarea', 'xmp', 'iframe', 'noembed', 'noframes']);\n const els = [];\n const walkElements = (parent) => {\n for (const child of parent.children) {\n els.push(child);\n const name = child.localName;\n if (RAW_TEXT.has(name)) continue;\n walkElements(name === 'template' && child.content ? child.content : child);\n }\n };\n walkElements(document);\n const styles = [];\n const boxes = [];\n const n = Math.min(els.length, MAX);\n for (let i = 0; i < n; i++) {\n const el = els[i];\n const tag = el.tagName.toLowerCase();\n const cs = getComputedStyle(el);\n const css = {};\n for (const p of PROPS) {\n const v = cs[p];\n if (v !== undefined && v !== null && v !== '') css[p] = String(v);\n }\n styles.push({ i: i, tag: tag, css: css });\n const r = el.getBoundingClientRect();\n boxes.push({ i: i, tag: tag, x: Math.round(r.left), y: Math.round(r.top), w: Math.round(r.width), h: Math.round(r.height) });\n }\n // The page's own stylesheets. Some criteria are properties of the STYLESHEET rather than of\n // any element's computed style — focus styling removed with no replacement (2.4.7), a media\n // query that locks the orientation (1.3.4) — and this is the only place they exist.\n // A cross-origin sheet throws on .cssRules: COUNT those instead of ignoring them, so a rule\n // reading this digest can tell \"nothing there\" apart from \"I could not look\".\n // The cap is on the ORDINARY pool only, and the traversal never stops early.\n //\n // It used to return the moment the pool filled, which abandoned every remaining sheet —\n // and on a design-system app the pool fills long before the end. Measured on a real capture\n // of 38 pages: all 38 came back truncated, so rendered-focus-not-visible declined on every\n // one of them and 2.4.7 could never be decided by any number of scans. The rule was right to\n // decline (a :focus rule might have been among the dropped ones); the collector was wrong to\n // make that unavoidable.\n //\n // So the rules a rendered criterion actually READS — :focus styling, orientation locks,\n // pinned positioning, animation — are kept whatever the pool is doing, and truncated now\n // means \"some ordinary rule was dropped\", which is a much weaker statement. A rule can then\n // ask for what it needs instead of refusing on a cap that never concerned it.\n const cssRules = [];\n let unreadable = 0;\n let dropped = 0;\n const MAXR = 4000;\n const camel = (p) => p.replace(/-([a-z])/g, (_, c) => c.toUpperCase());\n const KEEP_SELECTOR = /:focus|:target|:active/i;\n const KEEP_PROP = /^(?:outline|position|animation|transition|transform)/;\n const walk = (list, media) => {\n for (const r of list) {\n if (typeof r.selectorText === 'string' && r.style) {\n const decls = {};\n for (let i = 0; i < r.style.length; i++) {\n const prop = r.style[i];\n decls[camel(prop)] = r.style.getPropertyValue(prop);\n }\n const keep = KEEP_SELECTOR.test(r.selectorText) || Object.keys(decls).some((k) => KEEP_PROP.test(k));\n if (cssRules.length >= MAXR && !keep) { dropped++; continue; }\n cssRules.push(media ? { selector: r.selectorText, media: media, decls: decls } : { selector: r.selectorText, decls: decls });\n } else if (r.cssRules) {\n const cond = r.conditionText || (r.media && r.media.mediaText) || media;\n walk(r.cssRules, cond);\n }\n }\n };\n for (const sheet of document.styleSheets) {\n try {\n walk(sheet.cssRules, undefined);\n } catch (e) {\n unreadable++;\n }\n }\n\n const truncated = els.length > MAX;\n return {\n dom: document.documentElement.outerHTML,\n css: { v: 1, rules: cssRules, unreadable: unreadable, truncated: dropped > 0, dropped: dropped },\n title: document.title,\n // The doctype is NOT part of documentElement.outerHTML, so a capture that records only\n // the DOM drops it — and RGAA 8.1 (is a doctype present, valid, and before <html>?) then\n // has nothing to look at. Recorded as its own field for that reason.\n doctype: document.doctype ? '<!DOCTYPE ' + document.doctype.name + (document.doctype.publicId ? ' PUBLIC \"' + document.doctype.publicId + '\"' : '') + (document.doctype.systemId ? ' \"' + document.doctype.systemId + '\"' : '') + '>' : '',\n lang: document.documentElement.getAttribute('lang') || '',\n url: location.href,\n viewport: { width: window.innerWidth, height: window.innerHeight },\n styles: { v: 1, entries: styles, truncated: truncated },\n boxes: { v: 1, entries: boxes, truncated: truncated }\n };\n})()";
6
+ const COLLECT = "(() => {\n const PROPS = [\"color\",\"backgroundColor\",\"backgroundImage\",\"fontSize\",\"fontWeight\",\"fontStyle\",\"textDecorationLine\",\"textTransform\",\"lineHeight\",\"letterSpacing\",\"wordSpacing\",\"whiteSpace\",\"display\",\"visibility\",\"opacity\",\"position\",\"overflowX\",\"overflowY\",\"outlineStyle\",\"outlineWidth\",\"outlineColor\",\"borderTopStyle\",\"borderRightStyle\",\"borderBottomStyle\",\"borderLeftStyle\",\"borderTopWidth\",\"borderRightWidth\",\"borderBottomWidth\",\"borderLeftWidth\",\"borderTopColor\",\"borderRightColor\",\"borderBottomColor\",\"borderLeftColor\",\"boxShadow\",\"cursor\"];\n const MAX = 5000;\n // The ordinal is a JOIN KEY against parseHtml(dom), so the walk must enumerate elements\n // exactly as a reparse of the serialisation below will (#101). querySelectorAll('*') did not:\n // - an element appended INSIDE a raw-text element (Next's dev overlay puts <nextjs-portal>\n // in a <script>) is serialised as that element's raw text, and a reparse reads text —\n // one ordinal too many, and every digest refused from there on;\n // - <template> contents are serialised and reparsed as elements, but live in\n // template.content, which querySelectorAll never traverses — one ordinal too few.\n // Pre-order, children of the raw-text elements HTML parsers (htmlparser2 included) treat as\n // text skipped, template.content descended.\n const RAW_TEXT = new Set(['script', 'style', 'title', 'textarea', 'xmp', 'iframe', 'noembed', 'noframes']);\n const els = [];\n const walkElements = (parent) => {\n for (const child of parent.children) {\n els.push(child);\n const name = child.localName;\n if (RAW_TEXT.has(name)) continue;\n // With scripting on, a <noscript>'s content is raw TEXT to the browser, while the reparse\n // reads it as elements (#112). Parse that text with the page's own parser and count what\n // it yields, in place, so every later ordinal still lines up. The inert parsed nodes have\n // no computed style and an empty box, which the rules read as « nothing measured ».\n if (name === 'noscript' && child.children.length === 0 && (child.textContent || '').includes('<')) {\n const parsed = document.createElement('template');\n parsed.innerHTML = child.textContent || '';\n walkElements(parsed.content);\n continue;\n }\n walkElements(name === 'template' && child.content ? child.content : child);\n }\n };\n walkElements(document);\n const styles = [];\n const boxes = [];\n const n = Math.min(els.length, MAX);\n for (let i = 0; i < n; i++) {\n const el = els[i];\n const tag = el.tagName.toLowerCase();\n const cs = getComputedStyle(el);\n const css = {};\n for (const p of PROPS) {\n const v = cs[p];\n if (v !== undefined && v !== null && v !== '') css[p] = String(v);\n }\n styles.push({ i: i, tag: tag, css: css });\n const r = el.getBoundingClientRect();\n boxes.push({ i: i, tag: tag, x: Math.round(r.left), y: Math.round(r.top), w: Math.round(r.width), h: Math.round(r.height) });\n }\n // The page's own stylesheets. Some criteria are properties of the STYLESHEET rather than of\n // any element's computed style — focus styling removed with no replacement (2.4.7), a media\n // query that locks the orientation (1.3.4) — and this is the only place they exist.\n // A cross-origin sheet throws on .cssRules: COUNT those instead of ignoring them, so a rule\n // reading this digest can tell \"nothing there\" apart from \"I could not look\".\n // The cap is on the ORDINARY pool only, and the traversal never stops early.\n //\n // It used to return the moment the pool filled, which abandoned every remaining sheet —\n // and on a design-system app the pool fills long before the end. Measured on a real capture\n // of 38 pages: all 38 came back truncated, so rendered-focus-not-visible declined on every\n // one of them and 2.4.7 could never be decided by any number of scans. The rule was right to\n // decline (a :focus rule might have been among the dropped ones); the collector was wrong to\n // make that unavoidable.\n //\n // So the rules a rendered criterion actually READS — :focus styling, orientation locks,\n // pinned positioning, animation — are kept whatever the pool is doing, and truncated now\n // means \"some ordinary rule was dropped\", which is a much weaker statement. A rule can then\n // ask for what it needs instead of refusing on a cap that never concerned it.\n const cssRules = [];\n let unreadable = 0;\n let dropped = 0;\n const MAXR = 4000;\n const camel = (p) => p.replace(/-([a-z])/g, (_, c) => c.toUpperCase());\n const KEEP_SELECTOR = /:focus|:target|:active/i;\n const KEEP_PROP = /^(?:outline|position|animation|transition|transform)/;\n const walk = (list, media) => {\n for (const r of list) {\n if (typeof r.selectorText === 'string' && r.style) {\n const decls = {};\n for (let i = 0; i < r.style.length; i++) {\n const prop = r.style[i];\n decls[camel(prop)] = r.style.getPropertyValue(prop);\n }\n const keep = KEEP_SELECTOR.test(r.selectorText) || Object.keys(decls).some((k) => KEEP_PROP.test(k));\n if (cssRules.length >= MAXR && !keep) { dropped++; continue; }\n cssRules.push(media ? { selector: r.selectorText, media: media, decls: decls } : { selector: r.selectorText, decls: decls });\n } else if (r.cssRules) {\n const cond = r.conditionText || (r.media && r.media.mediaText) || media;\n walk(r.cssRules, cond);\n }\n }\n };\n for (const sheet of document.styleSheets) {\n try {\n walk(sheet.cssRules, undefined);\n } catch (e) {\n unreadable++;\n }\n }\n\n const truncated = els.length > MAX;\n return {\n dom: document.documentElement.outerHTML,\n css: { v: 1, rules: cssRules, unreadable: unreadable, truncated: dropped > 0, dropped: dropped },\n title: document.title,\n // The doctype is NOT part of documentElement.outerHTML, so a capture that records only\n // the DOM drops it — and RGAA 8.1 (is a doctype present, valid, and before <html>?) then\n // has nothing to look at. Recorded as its own field for that reason.\n doctype: document.doctype ? '<!DOCTYPE ' + document.doctype.name + (document.doctype.publicId ? ' PUBLIC \"' + document.doctype.publicId + '\"' : '') + (document.doctype.systemId ? ' \"' + document.doctype.systemId + '\"' : '') + '>' : '',\n lang: document.documentElement.getAttribute('lang') || '',\n url: location.href,\n viewport: { width: window.innerWidth, height: window.innerHeight },\n styles: { v: 1, entries: styles, truncated: truncated },\n boxes: { v: 1, entries: boxes, truncated: truncated }\n };\n})()";
7
7
  const browser = await chromium.launch({ args: ["--no-sandbox", "--disable-dev-shm-usage"] });
8
8
  try {
9
9
  const page = await browser.newPage();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ultra11y",
3
- "version": "5.55.3",
3
+ "version": "5.55.5",
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",
@@ -2,11 +2,11 @@
2
2
 
3
3
  // src/cli.ts
4
4
  import { realpathSync as realpathSync8, writeFileSync as writeFileSync23, mkdirSync as mkdirSync20, existsSync as existsSync41, readFileSync as readFileSync37, appendFileSync, copyFileSync as copyFileSync4 } from "fs";
5
- import { join as join54, relative as relative6, resolve as resolve18, sep as sep7, dirname as dirname21 } from "path";
5
+ import { join as join54, relative as relative6, resolve as resolve18, sep as sep7, dirname as dirname22 } from "path";
6
6
  import { fileURLToPath as fileURLToPath6, pathToFileURL as pathToFileURL3 } from "url";
7
7
 
8
8
  // src/types.ts
9
- var VERSION = "5.55.3";
9
+ var VERSION = "5.55.5";
10
10
  var SCHEMA_VERSION = 2;
11
11
  function isAdjudicated(by) {
12
12
  return by === "agent" || by === "human";
@@ -38458,6 +38458,16 @@ var COLLECT_SNAPSHOT = `(() => {
38458
38458
  els.push(child);
38459
38459
  const name = child.localName;
38460
38460
  if (RAW_TEXT.has(name)) continue;
38461
+ // With scripting on, a <noscript>'s content is raw TEXT to the browser, while the reparse
38462
+ // reads it as elements (#112). Parse that text with the page's own parser and count what
38463
+ // it yields, in place, so every later ordinal still lines up. The inert parsed nodes have
38464
+ // no computed style and an empty box, which the rules read as \xAB nothing measured \xBB.
38465
+ if (name === 'noscript' && child.children.length === 0 && (child.textContent || '').includes('<')) {
38466
+ const parsed = document.createElement('template');
38467
+ parsed.innerHTML = child.textContent || '';
38468
+ walkElements(parsed.content);
38469
+ continue;
38470
+ }
38461
38471
  walkElements(name === 'template' && child.content ? child.content : child);
38462
38472
  }
38463
38473
  };
@@ -64213,14 +64223,20 @@ function renderPackReport(r, pack, lang = "en", outDir, cropFor) {
64213
64223
  const docs = renderPackReportDocuments(r, pack, lang, outDir, cropFor);
64214
64224
  return joinReportDocuments(docs.report, docs.annex);
64215
64225
  }
64226
+ function automaticRate(derived) {
64227
+ const validated = derived.filter((d) => d.status === "C" && !isAdjudicated(d.decidedBy) && !isProvisionalJudgmentInapplicable(d)).length;
64228
+ return { pct: packConformancePct(derived), validated, decided: validated + derived.filter((d) => d.status === "NC").length };
64229
+ }
64230
+ function packReportRates(r, pack) {
64231
+ return { conformance: conformanceRate(reportTotals(packReportGroups(r, pack))), automatic: automaticRate(derivePackResults(r, pack.key)) };
64232
+ }
64216
64233
  function renderPackReportDocuments(r, pack, lang = "en", outDir, cropFor) {
64217
64234
  const derived = derivePackResults(r, pack.key);
64218
64235
  const std = `${pack.name} ${pack.baseVersion}`;
64219
64236
  const groups = packReportGroups(r, pack, lang);
64220
64237
  const rows = groups.flatMap((g) => g.rows);
64221
64238
  const tally = reportTotals(groups);
64222
- const autoValidated = derived.filter((d) => d.status === "C" && !isAdjudicated(d.decidedBy) && !isProvisionalJudgmentInapplicable(d)).length;
64223
- const autoDecided = autoValidated + derived.filter((d) => d.status === "NC").length;
64239
+ const auto = automaticRate(derived);
64224
64240
  return render(r, lang, {
64225
64241
  std,
64226
64242
  groupHead: L5[lang].byTheme,
@@ -64228,8 +64244,8 @@ function renderPackReportDocuments(r, pack, lang = "en", outDir, cropFor) {
64228
64244
  derivedOf: std,
64229
64245
  standard: pack.key,
64230
64246
  partialAudit: untestedNeedsRendering(r, establishedScs(derived)),
64231
- headerRatePct: packConformancePct(derived),
64232
- conformance: { rate: conformanceRate(tally), provenance: decisionProvenance(rows), autoDecided, autoValidated },
64247
+ headerRatePct: auto.pct,
64248
+ conformance: { rate: conformanceRate(tally), provenance: decisionProvenance(rows), autoDecided: auto.decided, autoValidated: auto.validated },
64233
64249
  // Forwarded, unlike before: without it the per-page screenshots resolved against the
64234
64250
  // CWD instead of the report's own directory, so a pack report written to `audits/`
64235
64251
  // carried links that only worked when read from the repo root.
@@ -75777,8 +75793,8 @@ ${xs.map(line).join("\n")}` : t3.none;
75777
75793
  import { createInterface as createInterface2 } from "readline";
75778
75794
 
75779
75795
  // src/mcp/handlers.ts
75780
- import { existsSync as existsSync39, mkdirSync as mkdirSync19, readFileSync as readFileSync35, realpathSync as realpathSync6, statSync as statSync19, writeFileSync as writeFileSync22 } from "fs";
75781
- import { isAbsolute as isAbsolute5, join as join52, resolve as resolve16, sep as sep5 } from "path";
75796
+ import { existsSync as existsSync39, lstatSync as lstatSync2, mkdirSync as mkdirSync19, readFileSync as readFileSync35, realpathSync as realpathSync6, statSync as statSync19, writeFileSync as writeFileSync22 } from "fs";
75797
+ import { basename as basename4, dirname as dirname20, isAbsolute as isAbsolute5, join as join52, resolve as resolve16, sep as sep5 } from "path";
75782
75798
 
75783
75799
  // src/criteria-view.ts
75784
75800
  var CriteriaLookupError = class extends Error {
@@ -76586,7 +76602,9 @@ function handleFix(args2, cwd) {
76586
76602
  }
76587
76603
  }
76588
76604
  function handleFold(args2, cwd) {
76589
- const adj = adjudicationArg(args2);
76605
+ const outArg = str2(args2.out);
76606
+ const outDir = outArg === void 0 ? cwd : containedPath(outArg, cwd, "out");
76607
+ const adj = adjudicationArg(args2, cwd);
76590
76608
  standardOf({ standard: adj.standard });
76591
76609
  const asked = str2(args2.standard);
76592
76610
  if (asked !== void 0 && standardOf(args2) !== adj.standard) {
@@ -76596,7 +76614,7 @@ function handleFold(args2, cwd) {
76596
76614
  const auditFile = str2(args2.audit_file);
76597
76615
  let base;
76598
76616
  if (auditFile) {
76599
- const path = resolve16(cwd, auditFile);
76617
+ const path = containedPath(auditFile, cwd, "audit_file");
76600
76618
  try {
76601
76619
  base = unwrapAudit(JSON.parse(readFileSync35(path, "utf8")));
76602
76620
  } catch {
@@ -76626,7 +76644,6 @@ function handleFold(args2, cwd) {
76626
76644
  next: landed ? "Dry run: nothing was written. Re-call with write:true (and ledger:true to record the accepted verdicts) to land them." : "Nothing landed. Fix the refused verdicts listed in issues \u2014 cite the evidence a C cleared, ground every NC finding \u2014 and fold again."
76627
76645
  };
76628
76646
  }
76629
- const outDir = resolve16(cwd, str2(args2.out) ?? ".");
76630
76647
  mkdirSync19(outDir, { recursive: true });
76631
76648
  const auditPath = join52(outDir, "audit-latest.json");
76632
76649
  writeFileSync22(auditPath, `${JSON.stringify(auditDocumentFor(r.audit, adj.standard, lang), null, 2)}
@@ -76647,15 +76664,44 @@ function handleFold(args2, cwd) {
76647
76664
  }
76648
76665
  return { ...summary, written: true, auditPath, ...ledger ? { ledger } : {} };
76649
76666
  }
76650
- function adjudicationArg(args2) {
76667
+ function containedPath(raw, cwd, field) {
76668
+ const refuse = () => {
76669
+ throw new ToolError(`\`${field}\` is outside the project: ${raw}. The fold reads and writes inside its cwd only.`);
76670
+ };
76671
+ const target = resolve16(cwd, raw);
76672
+ let existing = target;
76673
+ const rest = [];
76674
+ for (; ; ) {
76675
+ try {
76676
+ lstatSync2(existing);
76677
+ break;
76678
+ } catch {
76679
+ const parent = dirname20(existing);
76680
+ if (parent === existing) break;
76681
+ rest.unshift(basename4(existing));
76682
+ existing = parent;
76683
+ }
76684
+ }
76685
+ let real;
76686
+ try {
76687
+ real = join52(realpathSync6(existing), ...rest);
76688
+ } catch {
76689
+ return refuse();
76690
+ }
76691
+ const root = realpathSync6(cwd);
76692
+ if (real !== root && !real.startsWith(root + sep5)) refuse();
76693
+ return target;
76694
+ }
76695
+ function adjudicationArg(args2, cwd) {
76651
76696
  const inline = args2.adjudication;
76652
76697
  const file = str2(args2.adjudication_file);
76653
76698
  if (inline !== void 0 && file) throw new ToolError("pass `adjudication` or `adjudication_file`, not both.");
76654
76699
  let v = inline;
76655
76700
  if (file) {
76656
76701
  if (!isAbsolute5(file)) throw new ToolError("`adjudication_file` must be an absolute path.");
76702
+ const path = containedPath(file, cwd, "adjudication_file");
76657
76703
  try {
76658
- v = JSON.parse(readFileSync35(file, "utf8"));
76704
+ v = JSON.parse(readFileSync35(path, "utf8"));
76659
76705
  } catch {
76660
76706
  throw new ToolError(`\`adjudication_file\` not found or not valid JSON: ${file}`);
76661
76707
  }
@@ -77131,16 +77177,19 @@ var WRITE_TOOLS = [
77131
77177
  type: "object",
77132
77178
  description: "The filled adjudication: { kind: 'adjudication', standard, items: [...] }, as ultra11y_adjudicate's worklist with your verdicts."
77133
77179
  },
77134
- adjudication_file: { type: "string", description: "Absolute path to an adjudication JSON file to fold instead." },
77180
+ adjudication_file: { type: "string", description: "Absolute path, inside cwd, to an adjudication JSON file to fold instead." },
77135
77181
  audit_file: {
77136
77182
  type: "string",
77137
- description: "Absolute path (or relative to cwd) to the audit JSON to fold into, like `--in`. Default: audit the project now, as ultra11y_adjudicate did."
77183
+ description: "Absolute path (or relative to cwd), inside cwd, to the audit JSON to fold into, like `--in`. Default: audit the project now, as ultra11y_adjudicate did."
77138
77184
  },
77139
77185
  globs: globsProp,
77140
77186
  standard: { type: "string", description: "Must match the adjudication's own standard when given." },
77141
77187
  strict: { type: "boolean", description: "All-or-nothing: a single refused verdict discards the whole fold." },
77142
77188
  write: { type: "boolean", description: "Actually write the folded audit (default: dry-run, returns the gate's verdict)." },
77143
- out: { type: "string", description: "Directory, relative to cwd, for audit-latest.json. Default: the project root, as `verify --apply`." },
77189
+ out: {
77190
+ type: "string",
77191
+ description: "Directory, relative to cwd and inside it, for audit-latest.json. Default: the project root, as `verify --apply`."
77192
+ },
77144
77193
  ledger: { type: "boolean", description: "With write:true, also record the accepted verdicts in .ultra11y/verdicts/<standard>.json." },
77145
77194
  lang: langProp
77146
77195
  },
@@ -77477,12 +77526,12 @@ var DECLARED = new Set([...TOOLS2, ...WRITE_TOOLS].map((t3) => t3.name));
77477
77526
 
77478
77527
  // src/mcp/resources.ts
77479
77528
  import { existsSync as existsSync40, readdirSync as readdirSync8, readFileSync as readFileSync36, realpathSync as realpathSync7, statSync as statSync20 } from "fs";
77480
- import { basename as basename4, dirname as dirname20, join as join53, resolve as resolve17, sep as sep6 } from "path";
77529
+ import { basename as basename5, dirname as dirname21, join as join53, resolve as resolve17, sep as sep6 } from "path";
77481
77530
  import { fileURLToPath as fileURLToPath5 } from "url";
77482
77531
  var SKILL_NAME = "ultra11y";
77483
77532
  var URI_SCHEME = "skill://";
77484
77533
  function resolveSkillRoot(moduleDir) {
77485
- const here = moduleDir ?? dirname20(fileURLToPath5(import.meta.url));
77534
+ const here = moduleDir ?? dirname21(fileURLToPath5(import.meta.url));
77486
77535
  const candidates2 = [resolve17(here, ".."), resolve17(here, "..", "skills", SKILL_NAME), resolve17(here, "..", "..", "skills", SKILL_NAME)];
77487
77536
  return candidates2.find((dir) => existsSync40(join53(dir, "SKILL.md")));
77488
77537
  }
@@ -77494,7 +77543,7 @@ function listResources(moduleDir) {
77494
77543
  if (!existsSync40(refDir)) return out2;
77495
77544
  for (const file of readdirSync8(refDir).sort()) {
77496
77545
  if (!file.endsWith(".md")) continue;
77497
- out2.push(describe(root, join53("references", file), `${SKILL_NAME} reference: ${basename4(file, ".md")}`));
77546
+ out2.push(describe(root, join53("references", file), `${SKILL_NAME} reference: ${basename5(file, ".md")}`));
77498
77547
  }
77499
77548
  return out2;
77500
77549
  }
@@ -79014,7 +79063,7 @@ async function cmdAudit(p) {
79014
79063
  const asFile = out2.toLowerCase().endsWith(".json");
79015
79064
  const target = asFile ? out2 : join54(out2, "audit-latest.json");
79016
79065
  try {
79017
- mkdirSync20(asFile ? dirname21(out2) : out2, { recursive: true });
79066
+ mkdirSync20(asFile ? dirname22(out2) : out2, { recursive: true });
79018
79067
  writeFileSync23(target, JSON.stringify(document, null, 2) + "\n");
79019
79068
  console.error(lang === "fr" ? `\u2192 audit \xE9crit dans ${target}` : `\u2192 audit written to ${target}`);
79020
79069
  } catch {
@@ -79695,15 +79744,18 @@ async function cmdReport(p) {
79695
79744
  const untested = isCore(standard) ? [] : packPartialAudit(result, standard);
79696
79745
  const partial = untested.length > 0;
79697
79746
  if (partial && !p.flags.json) console.error(`\u{1F6A8} ${partialAuditBanner(lang, untested, { scanned: ranBrowser(result) })}`);
79747
+ const rates = isCore(standard) ? void 0 : packReportRates(result, loadPack(standard));
79698
79748
  if (p.flags.json)
79699
79749
  console.log(
79700
79750
  JSON.stringify(
79701
79751
  {
79702
79752
  path,
79703
79753
  annexPath,
79704
- conformancePct: result.conformancePct,
79754
+ conformancePct: rates ? rates.conformance.applicable === 0 ? null : rates.conformance.pct : result.conformancePct,
79755
+ ...rates ? { conformance: rates.conformance, automaticPct: rates.automatic.pct, automatic: rates.automatic } : {},
79705
79756
  date: result.date,
79706
- standard: typeof p.flags.standard === "string" ? p.flags.standard : "wcag",
79757
+ // The resolved key (`--standard RGAA` → "rgaa"), never the raw flag.
79758
+ standard,
79707
79759
  ...html ? { htmlPath: html.index, htmlSinglePath: html.composite } : {},
79708
79760
  ...partial ? { partialAudit: true, untestedCriteria: untested } : {}
79709
79761
  },
@@ -80021,7 +80073,7 @@ Fill in COMPONENTS, run it (e.g. npx tsx ${out2}), then: node scripts/ultra11y.m
80021
80073
  const rel2 = ".ultra11y/capture-setup.mjs";
80022
80074
  const out2 = join54(root, rel2);
80023
80075
  try {
80024
- mkdirSync20(dirname21(out2), { recursive: true });
80076
+ mkdirSync20(dirname22(out2), { recursive: true });
80025
80077
  writeFileSync23(out2, captureSetup());
80026
80078
  } catch (e) {
80027
80079
  console.error(`ultra11y render: could not write ${out2}: ${e instanceof Error ? e.message : String(e)}`);
@@ -80306,7 +80358,7 @@ function cmdVerify(p) {
80306
80358
  const trial = conformityTrial(p, standard, lang);
80307
80359
  const expected = [...expectedNc, ...buildConformityWorklist(trial.claims, expectedNc.length, Number.POSITIVE_INFINITY)];
80308
80360
  const r = applyVerdicts(items, expected);
80309
- const ctx = readVerifyContext(dirname21(resolve18(apply)));
80361
+ const ctx = readVerifyContext(dirname22(resolve18(apply)));
80310
80362
  const absentItems = r.failures.filter((f) => !items.includes(f));
80311
80363
  const absentC = absentItems.filter((f) => f.kind === "c").length;
80312
80364
  const sourceDiffers = ctx ? !sameConformitySource(ctx.conformities, trial.source) : absentC > 0 && !items.some((it) => it.kind === "c");
@@ -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.55.3
6
+ version: 5.55.5
7
7
  ---
8
8
 
9
9
  # review-a11y — accessibility review of changed code
@@ -2,11 +2,11 @@
2
2
 
3
3
  // src/cli.ts
4
4
  import { realpathSync as realpathSync8, writeFileSync as writeFileSync23, mkdirSync as mkdirSync20, existsSync as existsSync41, readFileSync as readFileSync37, appendFileSync, copyFileSync as copyFileSync4 } from "fs";
5
- import { join as join54, relative as relative6, resolve as resolve18, sep as sep7, dirname as dirname21 } from "path";
5
+ import { join as join54, relative as relative6, resolve as resolve18, sep as sep7, dirname as dirname22 } from "path";
6
6
  import { fileURLToPath as fileURLToPath6, pathToFileURL as pathToFileURL3 } from "url";
7
7
 
8
8
  // src/types.ts
9
- var VERSION = "5.55.3";
9
+ var VERSION = "5.55.5";
10
10
  var SCHEMA_VERSION = 2;
11
11
  function isAdjudicated(by) {
12
12
  return by === "agent" || by === "human";
@@ -38458,6 +38458,16 @@ var COLLECT_SNAPSHOT = `(() => {
38458
38458
  els.push(child);
38459
38459
  const name = child.localName;
38460
38460
  if (RAW_TEXT.has(name)) continue;
38461
+ // With scripting on, a <noscript>'s content is raw TEXT to the browser, while the reparse
38462
+ // reads it as elements (#112). Parse that text with the page's own parser and count what
38463
+ // it yields, in place, so every later ordinal still lines up. The inert parsed nodes have
38464
+ // no computed style and an empty box, which the rules read as \xAB nothing measured \xBB.
38465
+ if (name === 'noscript' && child.children.length === 0 && (child.textContent || '').includes('<')) {
38466
+ const parsed = document.createElement('template');
38467
+ parsed.innerHTML = child.textContent || '';
38468
+ walkElements(parsed.content);
38469
+ continue;
38470
+ }
38461
38471
  walkElements(name === 'template' && child.content ? child.content : child);
38462
38472
  }
38463
38473
  };
@@ -64213,14 +64223,20 @@ function renderPackReport(r, pack, lang = "en", outDir, cropFor) {
64213
64223
  const docs = renderPackReportDocuments(r, pack, lang, outDir, cropFor);
64214
64224
  return joinReportDocuments(docs.report, docs.annex);
64215
64225
  }
64226
+ function automaticRate(derived) {
64227
+ const validated = derived.filter((d) => d.status === "C" && !isAdjudicated(d.decidedBy) && !isProvisionalJudgmentInapplicable(d)).length;
64228
+ return { pct: packConformancePct(derived), validated, decided: validated + derived.filter((d) => d.status === "NC").length };
64229
+ }
64230
+ function packReportRates(r, pack) {
64231
+ return { conformance: conformanceRate(reportTotals(packReportGroups(r, pack))), automatic: automaticRate(derivePackResults(r, pack.key)) };
64232
+ }
64216
64233
  function renderPackReportDocuments(r, pack, lang = "en", outDir, cropFor) {
64217
64234
  const derived = derivePackResults(r, pack.key);
64218
64235
  const std = `${pack.name} ${pack.baseVersion}`;
64219
64236
  const groups = packReportGroups(r, pack, lang);
64220
64237
  const rows = groups.flatMap((g) => g.rows);
64221
64238
  const tally = reportTotals(groups);
64222
- const autoValidated = derived.filter((d) => d.status === "C" && !isAdjudicated(d.decidedBy) && !isProvisionalJudgmentInapplicable(d)).length;
64223
- const autoDecided = autoValidated + derived.filter((d) => d.status === "NC").length;
64239
+ const auto = automaticRate(derived);
64224
64240
  return render(r, lang, {
64225
64241
  std,
64226
64242
  groupHead: L5[lang].byTheme,
@@ -64228,8 +64244,8 @@ function renderPackReportDocuments(r, pack, lang = "en", outDir, cropFor) {
64228
64244
  derivedOf: std,
64229
64245
  standard: pack.key,
64230
64246
  partialAudit: untestedNeedsRendering(r, establishedScs(derived)),
64231
- headerRatePct: packConformancePct(derived),
64232
- conformance: { rate: conformanceRate(tally), provenance: decisionProvenance(rows), autoDecided, autoValidated },
64247
+ headerRatePct: auto.pct,
64248
+ conformance: { rate: conformanceRate(tally), provenance: decisionProvenance(rows), autoDecided: auto.decided, autoValidated: auto.validated },
64233
64249
  // Forwarded, unlike before: without it the per-page screenshots resolved against the
64234
64250
  // CWD instead of the report's own directory, so a pack report written to `audits/`
64235
64251
  // carried links that only worked when read from the repo root.
@@ -75777,8 +75793,8 @@ ${xs.map(line).join("\n")}` : t3.none;
75777
75793
  import { createInterface as createInterface2 } from "readline";
75778
75794
 
75779
75795
  // src/mcp/handlers.ts
75780
- import { existsSync as existsSync39, mkdirSync as mkdirSync19, readFileSync as readFileSync35, realpathSync as realpathSync6, statSync as statSync19, writeFileSync as writeFileSync22 } from "fs";
75781
- import { isAbsolute as isAbsolute5, join as join52, resolve as resolve16, sep as sep5 } from "path";
75796
+ import { existsSync as existsSync39, lstatSync as lstatSync2, mkdirSync as mkdirSync19, readFileSync as readFileSync35, realpathSync as realpathSync6, statSync as statSync19, writeFileSync as writeFileSync22 } from "fs";
75797
+ import { basename as basename4, dirname as dirname20, isAbsolute as isAbsolute5, join as join52, resolve as resolve16, sep as sep5 } from "path";
75782
75798
 
75783
75799
  // src/criteria-view.ts
75784
75800
  var CriteriaLookupError = class extends Error {
@@ -76586,7 +76602,9 @@ function handleFix(args2, cwd) {
76586
76602
  }
76587
76603
  }
76588
76604
  function handleFold(args2, cwd) {
76589
- const adj = adjudicationArg(args2);
76605
+ const outArg = str2(args2.out);
76606
+ const outDir = outArg === void 0 ? cwd : containedPath(outArg, cwd, "out");
76607
+ const adj = adjudicationArg(args2, cwd);
76590
76608
  standardOf({ standard: adj.standard });
76591
76609
  const asked = str2(args2.standard);
76592
76610
  if (asked !== void 0 && standardOf(args2) !== adj.standard) {
@@ -76596,7 +76614,7 @@ function handleFold(args2, cwd) {
76596
76614
  const auditFile = str2(args2.audit_file);
76597
76615
  let base;
76598
76616
  if (auditFile) {
76599
- const path = resolve16(cwd, auditFile);
76617
+ const path = containedPath(auditFile, cwd, "audit_file");
76600
76618
  try {
76601
76619
  base = unwrapAudit(JSON.parse(readFileSync35(path, "utf8")));
76602
76620
  } catch {
@@ -76626,7 +76644,6 @@ function handleFold(args2, cwd) {
76626
76644
  next: landed ? "Dry run: nothing was written. Re-call with write:true (and ledger:true to record the accepted verdicts) to land them." : "Nothing landed. Fix the refused verdicts listed in issues \u2014 cite the evidence a C cleared, ground every NC finding \u2014 and fold again."
76627
76645
  };
76628
76646
  }
76629
- const outDir = resolve16(cwd, str2(args2.out) ?? ".");
76630
76647
  mkdirSync19(outDir, { recursive: true });
76631
76648
  const auditPath = join52(outDir, "audit-latest.json");
76632
76649
  writeFileSync22(auditPath, `${JSON.stringify(auditDocumentFor(r.audit, adj.standard, lang), null, 2)}
@@ -76647,15 +76664,44 @@ function handleFold(args2, cwd) {
76647
76664
  }
76648
76665
  return { ...summary, written: true, auditPath, ...ledger ? { ledger } : {} };
76649
76666
  }
76650
- function adjudicationArg(args2) {
76667
+ function containedPath(raw, cwd, field) {
76668
+ const refuse = () => {
76669
+ throw new ToolError(`\`${field}\` is outside the project: ${raw}. The fold reads and writes inside its cwd only.`);
76670
+ };
76671
+ const target = resolve16(cwd, raw);
76672
+ let existing = target;
76673
+ const rest = [];
76674
+ for (; ; ) {
76675
+ try {
76676
+ lstatSync2(existing);
76677
+ break;
76678
+ } catch {
76679
+ const parent = dirname20(existing);
76680
+ if (parent === existing) break;
76681
+ rest.unshift(basename4(existing));
76682
+ existing = parent;
76683
+ }
76684
+ }
76685
+ let real;
76686
+ try {
76687
+ real = join52(realpathSync6(existing), ...rest);
76688
+ } catch {
76689
+ return refuse();
76690
+ }
76691
+ const root = realpathSync6(cwd);
76692
+ if (real !== root && !real.startsWith(root + sep5)) refuse();
76693
+ return target;
76694
+ }
76695
+ function adjudicationArg(args2, cwd) {
76651
76696
  const inline = args2.adjudication;
76652
76697
  const file = str2(args2.adjudication_file);
76653
76698
  if (inline !== void 0 && file) throw new ToolError("pass `adjudication` or `adjudication_file`, not both.");
76654
76699
  let v = inline;
76655
76700
  if (file) {
76656
76701
  if (!isAbsolute5(file)) throw new ToolError("`adjudication_file` must be an absolute path.");
76702
+ const path = containedPath(file, cwd, "adjudication_file");
76657
76703
  try {
76658
- v = JSON.parse(readFileSync35(file, "utf8"));
76704
+ v = JSON.parse(readFileSync35(path, "utf8"));
76659
76705
  } catch {
76660
76706
  throw new ToolError(`\`adjudication_file\` not found or not valid JSON: ${file}`);
76661
76707
  }
@@ -77131,16 +77177,19 @@ var WRITE_TOOLS = [
77131
77177
  type: "object",
77132
77178
  description: "The filled adjudication: { kind: 'adjudication', standard, items: [...] }, as ultra11y_adjudicate's worklist with your verdicts."
77133
77179
  },
77134
- adjudication_file: { type: "string", description: "Absolute path to an adjudication JSON file to fold instead." },
77180
+ adjudication_file: { type: "string", description: "Absolute path, inside cwd, to an adjudication JSON file to fold instead." },
77135
77181
  audit_file: {
77136
77182
  type: "string",
77137
- description: "Absolute path (or relative to cwd) to the audit JSON to fold into, like `--in`. Default: audit the project now, as ultra11y_adjudicate did."
77183
+ description: "Absolute path (or relative to cwd), inside cwd, to the audit JSON to fold into, like `--in`. Default: audit the project now, as ultra11y_adjudicate did."
77138
77184
  },
77139
77185
  globs: globsProp,
77140
77186
  standard: { type: "string", description: "Must match the adjudication's own standard when given." },
77141
77187
  strict: { type: "boolean", description: "All-or-nothing: a single refused verdict discards the whole fold." },
77142
77188
  write: { type: "boolean", description: "Actually write the folded audit (default: dry-run, returns the gate's verdict)." },
77143
- out: { type: "string", description: "Directory, relative to cwd, for audit-latest.json. Default: the project root, as `verify --apply`." },
77189
+ out: {
77190
+ type: "string",
77191
+ description: "Directory, relative to cwd and inside it, for audit-latest.json. Default: the project root, as `verify --apply`."
77192
+ },
77144
77193
  ledger: { type: "boolean", description: "With write:true, also record the accepted verdicts in .ultra11y/verdicts/<standard>.json." },
77145
77194
  lang: langProp
77146
77195
  },
@@ -77477,12 +77526,12 @@ var DECLARED = new Set([...TOOLS2, ...WRITE_TOOLS].map((t3) => t3.name));
77477
77526
 
77478
77527
  // src/mcp/resources.ts
77479
77528
  import { existsSync as existsSync40, readdirSync as readdirSync8, readFileSync as readFileSync36, realpathSync as realpathSync7, statSync as statSync20 } from "fs";
77480
- import { basename as basename4, dirname as dirname20, join as join53, resolve as resolve17, sep as sep6 } from "path";
77529
+ import { basename as basename5, dirname as dirname21, join as join53, resolve as resolve17, sep as sep6 } from "path";
77481
77530
  import { fileURLToPath as fileURLToPath5 } from "url";
77482
77531
  var SKILL_NAME = "ultra11y";
77483
77532
  var URI_SCHEME = "skill://";
77484
77533
  function resolveSkillRoot(moduleDir) {
77485
- const here = moduleDir ?? dirname20(fileURLToPath5(import.meta.url));
77534
+ const here = moduleDir ?? dirname21(fileURLToPath5(import.meta.url));
77486
77535
  const candidates2 = [resolve17(here, ".."), resolve17(here, "..", "skills", SKILL_NAME), resolve17(here, "..", "..", "skills", SKILL_NAME)];
77487
77536
  return candidates2.find((dir) => existsSync40(join53(dir, "SKILL.md")));
77488
77537
  }
@@ -77494,7 +77543,7 @@ function listResources(moduleDir) {
77494
77543
  if (!existsSync40(refDir)) return out2;
77495
77544
  for (const file of readdirSync8(refDir).sort()) {
77496
77545
  if (!file.endsWith(".md")) continue;
77497
- out2.push(describe(root, join53("references", file), `${SKILL_NAME} reference: ${basename4(file, ".md")}`));
77546
+ out2.push(describe(root, join53("references", file), `${SKILL_NAME} reference: ${basename5(file, ".md")}`));
77498
77547
  }
77499
77548
  return out2;
77500
77549
  }
@@ -79014,7 +79063,7 @@ async function cmdAudit(p) {
79014
79063
  const asFile = out2.toLowerCase().endsWith(".json");
79015
79064
  const target = asFile ? out2 : join54(out2, "audit-latest.json");
79016
79065
  try {
79017
- mkdirSync20(asFile ? dirname21(out2) : out2, { recursive: true });
79066
+ mkdirSync20(asFile ? dirname22(out2) : out2, { recursive: true });
79018
79067
  writeFileSync23(target, JSON.stringify(document, null, 2) + "\n");
79019
79068
  console.error(lang === "fr" ? `\u2192 audit \xE9crit dans ${target}` : `\u2192 audit written to ${target}`);
79020
79069
  } catch {
@@ -79695,15 +79744,18 @@ async function cmdReport(p) {
79695
79744
  const untested = isCore(standard) ? [] : packPartialAudit(result, standard);
79696
79745
  const partial = untested.length > 0;
79697
79746
  if (partial && !p.flags.json) console.error(`\u{1F6A8} ${partialAuditBanner(lang, untested, { scanned: ranBrowser(result) })}`);
79747
+ const rates = isCore(standard) ? void 0 : packReportRates(result, loadPack(standard));
79698
79748
  if (p.flags.json)
79699
79749
  console.log(
79700
79750
  JSON.stringify(
79701
79751
  {
79702
79752
  path,
79703
79753
  annexPath,
79704
- conformancePct: result.conformancePct,
79754
+ conformancePct: rates ? rates.conformance.applicable === 0 ? null : rates.conformance.pct : result.conformancePct,
79755
+ ...rates ? { conformance: rates.conformance, automaticPct: rates.automatic.pct, automatic: rates.automatic } : {},
79705
79756
  date: result.date,
79706
- standard: typeof p.flags.standard === "string" ? p.flags.standard : "wcag",
79757
+ // The resolved key (`--standard RGAA` → "rgaa"), never the raw flag.
79758
+ standard,
79707
79759
  ...html ? { htmlPath: html.index, htmlSinglePath: html.composite } : {},
79708
79760
  ...partial ? { partialAudit: true, untestedCriteria: untested } : {}
79709
79761
  },
@@ -80021,7 +80073,7 @@ Fill in COMPONENTS, run it (e.g. npx tsx ${out2}), then: node scripts/ultra11y.m
80021
80073
  const rel2 = ".ultra11y/capture-setup.mjs";
80022
80074
  const out2 = join54(root, rel2);
80023
80075
  try {
80024
- mkdirSync20(dirname21(out2), { recursive: true });
80076
+ mkdirSync20(dirname22(out2), { recursive: true });
80025
80077
  writeFileSync23(out2, captureSetup());
80026
80078
  } catch (e) {
80027
80079
  console.error(`ultra11y render: could not write ${out2}: ${e instanceof Error ? e.message : String(e)}`);
@@ -80306,7 +80358,7 @@ function cmdVerify(p) {
80306
80358
  const trial = conformityTrial(p, standard, lang);
80307
80359
  const expected = [...expectedNc, ...buildConformityWorklist(trial.claims, expectedNc.length, Number.POSITIVE_INFINITY)];
80308
80360
  const r = applyVerdicts(items, expected);
80309
- const ctx = readVerifyContext(dirname21(resolve18(apply)));
80361
+ const ctx = readVerifyContext(dirname22(resolve18(apply)));
80310
80362
  const absentItems = r.failures.filter((f) => !items.includes(f));
80311
80363
  const absentC = absentItems.filter((f) => f.kind === "c").length;
80312
80364
  const sourceDiffers = ctx ? !sameConformitySource(ctx.conformities, trial.source) : absentC > 0 && !items.some((it) => it.kind === "c");
@@ -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 102 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.55.3
6
+ version: 5.55.5
7
7
  ---
8
8
 
9
9
  # ultra11y — audit WCAG 2.2 AA and write accessible markup
@@ -235,9 +235,11 @@ Read exit codes from the process, **not** from a pipeline — `cmd --json | head
235
235
  counted as `failed`.
236
236
  - Under a pack standard (`--standard rgaa`), `audit-latest.json` is a `pack-audit` document:
237
237
  its root `conformancePct` is the automatic pass rate for that standard, `core` is the WCAG
238
- audit, and `report --json` and `verify --apply --json` echo the **core** rate. The
239
- standard's own conformance rate (validated ÷ validated + NC + à évaluer, NA excluded) is
240
- printed by the report; derive it from `criteria[]` if a number is needed in a pipeline.
238
+ audit, and `verify --apply --json` echoes the **core** rate. `report --json` says what the
239
+ report says: `conformancePct` is the standard's own conformance rate (validated ÷ validated
240
+ + NC + à évaluer, NA excluded; `null` when nothing is applicable), `conformance` its operands
241
+ (`validated`, `applicable`, `na`, `open`, `decided`, `total`), `automaticPct` / `automatic`
242
+ the annex's automatic rate, and `standard` the resolved key (`--standard RGAA` → `rgaa`).
241
243
  - `check --json` → `{ ok, issues[] }`.
242
244
  - `scan --merge --json` → the merged audit document, opened by a top-level `pages` summary:
243
245
  `{ sample, recorded[], refused: [{id, reason}] }` — the declared sample's size (`--sample`),
@@ -2,11 +2,11 @@
2
2
 
3
3
  // src/cli.ts
4
4
  import { realpathSync as realpathSync8, writeFileSync as writeFileSync23, mkdirSync as mkdirSync20, existsSync as existsSync41, readFileSync as readFileSync37, appendFileSync, copyFileSync as copyFileSync4 } from "fs";
5
- import { join as join54, relative as relative6, resolve as resolve18, sep as sep7, dirname as dirname21 } from "path";
5
+ import { join as join54, relative as relative6, resolve as resolve18, sep as sep7, dirname as dirname22 } from "path";
6
6
  import { fileURLToPath as fileURLToPath6, pathToFileURL as pathToFileURL3 } from "url";
7
7
 
8
8
  // src/types.ts
9
- var VERSION = "5.55.3";
9
+ var VERSION = "5.55.5";
10
10
  var SCHEMA_VERSION = 2;
11
11
  function isAdjudicated(by) {
12
12
  return by === "agent" || by === "human";
@@ -38458,6 +38458,16 @@ var COLLECT_SNAPSHOT = `(() => {
38458
38458
  els.push(child);
38459
38459
  const name = child.localName;
38460
38460
  if (RAW_TEXT.has(name)) continue;
38461
+ // With scripting on, a <noscript>'s content is raw TEXT to the browser, while the reparse
38462
+ // reads it as elements (#112). Parse that text with the page's own parser and count what
38463
+ // it yields, in place, so every later ordinal still lines up. The inert parsed nodes have
38464
+ // no computed style and an empty box, which the rules read as \xAB nothing measured \xBB.
38465
+ if (name === 'noscript' && child.children.length === 0 && (child.textContent || '').includes('<')) {
38466
+ const parsed = document.createElement('template');
38467
+ parsed.innerHTML = child.textContent || '';
38468
+ walkElements(parsed.content);
38469
+ continue;
38470
+ }
38461
38471
  walkElements(name === 'template' && child.content ? child.content : child);
38462
38472
  }
38463
38473
  };
@@ -64213,14 +64223,20 @@ function renderPackReport(r, pack, lang = "en", outDir, cropFor) {
64213
64223
  const docs = renderPackReportDocuments(r, pack, lang, outDir, cropFor);
64214
64224
  return joinReportDocuments(docs.report, docs.annex);
64215
64225
  }
64226
+ function automaticRate(derived) {
64227
+ const validated = derived.filter((d) => d.status === "C" && !isAdjudicated(d.decidedBy) && !isProvisionalJudgmentInapplicable(d)).length;
64228
+ return { pct: packConformancePct(derived), validated, decided: validated + derived.filter((d) => d.status === "NC").length };
64229
+ }
64230
+ function packReportRates(r, pack) {
64231
+ return { conformance: conformanceRate(reportTotals(packReportGroups(r, pack))), automatic: automaticRate(derivePackResults(r, pack.key)) };
64232
+ }
64216
64233
  function renderPackReportDocuments(r, pack, lang = "en", outDir, cropFor) {
64217
64234
  const derived = derivePackResults(r, pack.key);
64218
64235
  const std = `${pack.name} ${pack.baseVersion}`;
64219
64236
  const groups = packReportGroups(r, pack, lang);
64220
64237
  const rows = groups.flatMap((g) => g.rows);
64221
64238
  const tally = reportTotals(groups);
64222
- const autoValidated = derived.filter((d) => d.status === "C" && !isAdjudicated(d.decidedBy) && !isProvisionalJudgmentInapplicable(d)).length;
64223
- const autoDecided = autoValidated + derived.filter((d) => d.status === "NC").length;
64239
+ const auto = automaticRate(derived);
64224
64240
  return render(r, lang, {
64225
64241
  std,
64226
64242
  groupHead: L5[lang].byTheme,
@@ -64228,8 +64244,8 @@ function renderPackReportDocuments(r, pack, lang = "en", outDir, cropFor) {
64228
64244
  derivedOf: std,
64229
64245
  standard: pack.key,
64230
64246
  partialAudit: untestedNeedsRendering(r, establishedScs(derived)),
64231
- headerRatePct: packConformancePct(derived),
64232
- conformance: { rate: conformanceRate(tally), provenance: decisionProvenance(rows), autoDecided, autoValidated },
64247
+ headerRatePct: auto.pct,
64248
+ conformance: { rate: conformanceRate(tally), provenance: decisionProvenance(rows), autoDecided: auto.decided, autoValidated: auto.validated },
64233
64249
  // Forwarded, unlike before: without it the per-page screenshots resolved against the
64234
64250
  // CWD instead of the report's own directory, so a pack report written to `audits/`
64235
64251
  // carried links that only worked when read from the repo root.
@@ -75777,8 +75793,8 @@ ${xs.map(line).join("\n")}` : t3.none;
75777
75793
  import { createInterface as createInterface2 } from "readline";
75778
75794
 
75779
75795
  // src/mcp/handlers.ts
75780
- import { existsSync as existsSync39, mkdirSync as mkdirSync19, readFileSync as readFileSync35, realpathSync as realpathSync6, statSync as statSync19, writeFileSync as writeFileSync22 } from "fs";
75781
- import { isAbsolute as isAbsolute5, join as join52, resolve as resolve16, sep as sep5 } from "path";
75796
+ import { existsSync as existsSync39, lstatSync as lstatSync2, mkdirSync as mkdirSync19, readFileSync as readFileSync35, realpathSync as realpathSync6, statSync as statSync19, writeFileSync as writeFileSync22 } from "fs";
75797
+ import { basename as basename4, dirname as dirname20, isAbsolute as isAbsolute5, join as join52, resolve as resolve16, sep as sep5 } from "path";
75782
75798
 
75783
75799
  // src/criteria-view.ts
75784
75800
  var CriteriaLookupError = class extends Error {
@@ -76586,7 +76602,9 @@ function handleFix(args2, cwd) {
76586
76602
  }
76587
76603
  }
76588
76604
  function handleFold(args2, cwd) {
76589
- const adj = adjudicationArg(args2);
76605
+ const outArg = str2(args2.out);
76606
+ const outDir = outArg === void 0 ? cwd : containedPath(outArg, cwd, "out");
76607
+ const adj = adjudicationArg(args2, cwd);
76590
76608
  standardOf({ standard: adj.standard });
76591
76609
  const asked = str2(args2.standard);
76592
76610
  if (asked !== void 0 && standardOf(args2) !== adj.standard) {
@@ -76596,7 +76614,7 @@ function handleFold(args2, cwd) {
76596
76614
  const auditFile = str2(args2.audit_file);
76597
76615
  let base;
76598
76616
  if (auditFile) {
76599
- const path = resolve16(cwd, auditFile);
76617
+ const path = containedPath(auditFile, cwd, "audit_file");
76600
76618
  try {
76601
76619
  base = unwrapAudit(JSON.parse(readFileSync35(path, "utf8")));
76602
76620
  } catch {
@@ -76626,7 +76644,6 @@ function handleFold(args2, cwd) {
76626
76644
  next: landed ? "Dry run: nothing was written. Re-call with write:true (and ledger:true to record the accepted verdicts) to land them." : "Nothing landed. Fix the refused verdicts listed in issues \u2014 cite the evidence a C cleared, ground every NC finding \u2014 and fold again."
76627
76645
  };
76628
76646
  }
76629
- const outDir = resolve16(cwd, str2(args2.out) ?? ".");
76630
76647
  mkdirSync19(outDir, { recursive: true });
76631
76648
  const auditPath = join52(outDir, "audit-latest.json");
76632
76649
  writeFileSync22(auditPath, `${JSON.stringify(auditDocumentFor(r.audit, adj.standard, lang), null, 2)}
@@ -76647,15 +76664,44 @@ function handleFold(args2, cwd) {
76647
76664
  }
76648
76665
  return { ...summary, written: true, auditPath, ...ledger ? { ledger } : {} };
76649
76666
  }
76650
- function adjudicationArg(args2) {
76667
+ function containedPath(raw, cwd, field) {
76668
+ const refuse = () => {
76669
+ throw new ToolError(`\`${field}\` is outside the project: ${raw}. The fold reads and writes inside its cwd only.`);
76670
+ };
76671
+ const target = resolve16(cwd, raw);
76672
+ let existing = target;
76673
+ const rest = [];
76674
+ for (; ; ) {
76675
+ try {
76676
+ lstatSync2(existing);
76677
+ break;
76678
+ } catch {
76679
+ const parent = dirname20(existing);
76680
+ if (parent === existing) break;
76681
+ rest.unshift(basename4(existing));
76682
+ existing = parent;
76683
+ }
76684
+ }
76685
+ let real;
76686
+ try {
76687
+ real = join52(realpathSync6(existing), ...rest);
76688
+ } catch {
76689
+ return refuse();
76690
+ }
76691
+ const root = realpathSync6(cwd);
76692
+ if (real !== root && !real.startsWith(root + sep5)) refuse();
76693
+ return target;
76694
+ }
76695
+ function adjudicationArg(args2, cwd) {
76651
76696
  const inline = args2.adjudication;
76652
76697
  const file = str2(args2.adjudication_file);
76653
76698
  if (inline !== void 0 && file) throw new ToolError("pass `adjudication` or `adjudication_file`, not both.");
76654
76699
  let v = inline;
76655
76700
  if (file) {
76656
76701
  if (!isAbsolute5(file)) throw new ToolError("`adjudication_file` must be an absolute path.");
76702
+ const path = containedPath(file, cwd, "adjudication_file");
76657
76703
  try {
76658
- v = JSON.parse(readFileSync35(file, "utf8"));
76704
+ v = JSON.parse(readFileSync35(path, "utf8"));
76659
76705
  } catch {
76660
76706
  throw new ToolError(`\`adjudication_file\` not found or not valid JSON: ${file}`);
76661
76707
  }
@@ -77131,16 +77177,19 @@ var WRITE_TOOLS = [
77131
77177
  type: "object",
77132
77178
  description: "The filled adjudication: { kind: 'adjudication', standard, items: [...] }, as ultra11y_adjudicate's worklist with your verdicts."
77133
77179
  },
77134
- adjudication_file: { type: "string", description: "Absolute path to an adjudication JSON file to fold instead." },
77180
+ adjudication_file: { type: "string", description: "Absolute path, inside cwd, to an adjudication JSON file to fold instead." },
77135
77181
  audit_file: {
77136
77182
  type: "string",
77137
- description: "Absolute path (or relative to cwd) to the audit JSON to fold into, like `--in`. Default: audit the project now, as ultra11y_adjudicate did."
77183
+ description: "Absolute path (or relative to cwd), inside cwd, to the audit JSON to fold into, like `--in`. Default: audit the project now, as ultra11y_adjudicate did."
77138
77184
  },
77139
77185
  globs: globsProp,
77140
77186
  standard: { type: "string", description: "Must match the adjudication's own standard when given." },
77141
77187
  strict: { type: "boolean", description: "All-or-nothing: a single refused verdict discards the whole fold." },
77142
77188
  write: { type: "boolean", description: "Actually write the folded audit (default: dry-run, returns the gate's verdict)." },
77143
- out: { type: "string", description: "Directory, relative to cwd, for audit-latest.json. Default: the project root, as `verify --apply`." },
77189
+ out: {
77190
+ type: "string",
77191
+ description: "Directory, relative to cwd and inside it, for audit-latest.json. Default: the project root, as `verify --apply`."
77192
+ },
77144
77193
  ledger: { type: "boolean", description: "With write:true, also record the accepted verdicts in .ultra11y/verdicts/<standard>.json." },
77145
77194
  lang: langProp
77146
77195
  },
@@ -77477,12 +77526,12 @@ var DECLARED = new Set([...TOOLS2, ...WRITE_TOOLS].map((t3) => t3.name));
77477
77526
 
77478
77527
  // src/mcp/resources.ts
77479
77528
  import { existsSync as existsSync40, readdirSync as readdirSync8, readFileSync as readFileSync36, realpathSync as realpathSync7, statSync as statSync20 } from "fs";
77480
- import { basename as basename4, dirname as dirname20, join as join53, resolve as resolve17, sep as sep6 } from "path";
77529
+ import { basename as basename5, dirname as dirname21, join as join53, resolve as resolve17, sep as sep6 } from "path";
77481
77530
  import { fileURLToPath as fileURLToPath5 } from "url";
77482
77531
  var SKILL_NAME = "ultra11y";
77483
77532
  var URI_SCHEME = "skill://";
77484
77533
  function resolveSkillRoot(moduleDir) {
77485
- const here = moduleDir ?? dirname20(fileURLToPath5(import.meta.url));
77534
+ const here = moduleDir ?? dirname21(fileURLToPath5(import.meta.url));
77486
77535
  const candidates2 = [resolve17(here, ".."), resolve17(here, "..", "skills", SKILL_NAME), resolve17(here, "..", "..", "skills", SKILL_NAME)];
77487
77536
  return candidates2.find((dir) => existsSync40(join53(dir, "SKILL.md")));
77488
77537
  }
@@ -77494,7 +77543,7 @@ function listResources(moduleDir) {
77494
77543
  if (!existsSync40(refDir)) return out2;
77495
77544
  for (const file of readdirSync8(refDir).sort()) {
77496
77545
  if (!file.endsWith(".md")) continue;
77497
- out2.push(describe(root, join53("references", file), `${SKILL_NAME} reference: ${basename4(file, ".md")}`));
77546
+ out2.push(describe(root, join53("references", file), `${SKILL_NAME} reference: ${basename5(file, ".md")}`));
77498
77547
  }
77499
77548
  return out2;
77500
77549
  }
@@ -79014,7 +79063,7 @@ async function cmdAudit(p) {
79014
79063
  const asFile = out2.toLowerCase().endsWith(".json");
79015
79064
  const target = asFile ? out2 : join54(out2, "audit-latest.json");
79016
79065
  try {
79017
- mkdirSync20(asFile ? dirname21(out2) : out2, { recursive: true });
79066
+ mkdirSync20(asFile ? dirname22(out2) : out2, { recursive: true });
79018
79067
  writeFileSync23(target, JSON.stringify(document, null, 2) + "\n");
79019
79068
  console.error(lang === "fr" ? `\u2192 audit \xE9crit dans ${target}` : `\u2192 audit written to ${target}`);
79020
79069
  } catch {
@@ -79695,15 +79744,18 @@ async function cmdReport(p) {
79695
79744
  const untested = isCore(standard) ? [] : packPartialAudit(result, standard);
79696
79745
  const partial = untested.length > 0;
79697
79746
  if (partial && !p.flags.json) console.error(`\u{1F6A8} ${partialAuditBanner(lang, untested, { scanned: ranBrowser(result) })}`);
79747
+ const rates = isCore(standard) ? void 0 : packReportRates(result, loadPack(standard));
79698
79748
  if (p.flags.json)
79699
79749
  console.log(
79700
79750
  JSON.stringify(
79701
79751
  {
79702
79752
  path,
79703
79753
  annexPath,
79704
- conformancePct: result.conformancePct,
79754
+ conformancePct: rates ? rates.conformance.applicable === 0 ? null : rates.conformance.pct : result.conformancePct,
79755
+ ...rates ? { conformance: rates.conformance, automaticPct: rates.automatic.pct, automatic: rates.automatic } : {},
79705
79756
  date: result.date,
79706
- standard: typeof p.flags.standard === "string" ? p.flags.standard : "wcag",
79757
+ // The resolved key (`--standard RGAA` → "rgaa"), never the raw flag.
79758
+ standard,
79707
79759
  ...html ? { htmlPath: html.index, htmlSinglePath: html.composite } : {},
79708
79760
  ...partial ? { partialAudit: true, untestedCriteria: untested } : {}
79709
79761
  },
@@ -80021,7 +80073,7 @@ Fill in COMPONENTS, run it (e.g. npx tsx ${out2}), then: node scripts/ultra11y.m
80021
80073
  const rel2 = ".ultra11y/capture-setup.mjs";
80022
80074
  const out2 = join54(root, rel2);
80023
80075
  try {
80024
- mkdirSync20(dirname21(out2), { recursive: true });
80076
+ mkdirSync20(dirname22(out2), { recursive: true });
80025
80077
  writeFileSync23(out2, captureSetup());
80026
80078
  } catch (e) {
80027
80079
  console.error(`ultra11y render: could not write ${out2}: ${e instanceof Error ? e.message : String(e)}`);
@@ -80306,7 +80358,7 @@ function cmdVerify(p) {
80306
80358
  const trial = conformityTrial(p, standard, lang);
80307
80359
  const expected = [...expectedNc, ...buildConformityWorklist(trial.claims, expectedNc.length, Number.POSITIVE_INFINITY)];
80308
80360
  const r = applyVerdicts(items, expected);
80309
- const ctx = readVerifyContext(dirname21(resolve18(apply)));
80361
+ const ctx = readVerifyContext(dirname22(resolve18(apply)));
80310
80362
  const absentItems = r.failures.filter((f) => !items.includes(f));
80311
80363
  const absentC = absentItems.filter((f) => f.kind === "c").length;
80312
80364
  const sourceDiffers = ctx ? !sameConformitySource(ctx.conformities, trial.source) : absentC > 0 && !items.some((it) => it.kind === "c");
@@ -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.55.3'
30
+ ULTRA11Y_VERSION: '5.55.5'
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
@@ -23,6 +23,7 @@ import {
23
23
  pageConformanceCell,
24
24
  writeReportFiles,
25
25
  packPartialAudit,
26
+ packReportRates,
26
27
  partialAuditBanner,
27
28
  ranBrowser,
28
29
  withReportAnnexes,
@@ -128,7 +129,7 @@ import { pageCriterionRows, pagesForStandard, renderPageDocument, renderPagesDoc
128
129
  import { crawlBound, crawlUrls, extractTitle, parseSitemapUrls } from "./crawl.js";
129
130
  import { DEV_DEFAULT_PORT, nextOverlayComponent, startDevServer, type DevServer } from "./dev.js";
130
131
  import { cypressCommands, cypressPlugin, detectE2eRunner, e2eSetupPlan, playwrightFixture, type E2ePaths, type E2eRunner } from "./e2e.js";
131
- import { resolveStandard, getPack, isCore, findingsForStandard, type StandardId } from "./standards/index.js";
132
+ import { resolveStandard, getPack, isCore, loadPack, findingsForStandard, type StandardId } from "./standards/index.js";
132
133
  import { auditDocumentFor, packAuditDocument, unwrapAudit } from "./standards/document.js";
133
134
  import { loadRuntimeStandards, loadConfig, type Ultra11yConfig } from "./config.js";
134
135
  import { runPackCheck, packScaffold } from "./pack.js";
@@ -2234,15 +2235,22 @@ async function cmdReport(p: ParsedArgs): Promise<number> {
2234
2235
  const untested = isCore(standard) ? [] : packPartialAudit(result, standard);
2235
2236
  const partial = untested.length > 0;
2236
2237
  if (partial && !p.flags.json) console.error(`🚨 ${partialAuditBanner(lang, untested, { scanned: ranBrowser(result) })}`);
2238
+ // The rate the document headlines, never another one (#116): a pack report prints its own
2239
+ // conformity rate (validated ÷ applicable) over its own grid, not the WCAG core's
2240
+ // `conformancePct`. Its operands travel with it — and `null`, not 100, when nothing is
2241
+ // applicable, as the report itself refuses to print « 100 % (0 ÷ 0) ».
2242
+ const rates = isCore(standard) ? undefined : packReportRates(result, loadPack(standard));
2237
2243
  if (p.flags.json)
2238
2244
  console.log(
2239
2245
  JSON.stringify(
2240
2246
  {
2241
2247
  path,
2242
2248
  annexPath,
2243
- conformancePct: result.conformancePct,
2249
+ conformancePct: rates ? (rates.conformance.applicable === 0 ? null : rates.conformance.pct) : result.conformancePct,
2250
+ ...(rates ? { conformance: rates.conformance, automaticPct: rates.automatic.pct, automatic: rates.automatic } : {}),
2244
2251
  date: result.date,
2245
- standard: typeof p.flags.standard === "string" ? p.flags.standard : "wcag",
2252
+ // The resolved key (`--standard RGAA` → "rgaa"), never the raw flag.
2253
+ standard,
2246
2254
  ...(html ? { htmlPath: html.index, htmlSinglePath: html.composite } : {}),
2247
2255
  ...(partial ? { partialAudit: true, untestedCriteria: untested } : {}),
2248
2256
  },
package/src/collector.ts CHANGED
@@ -77,6 +77,16 @@ export const COLLECT_SNAPSHOT = `(() => {
77
77
  els.push(child);
78
78
  const name = child.localName;
79
79
  if (RAW_TEXT.has(name)) continue;
80
+ // With scripting on, a <noscript>'s content is raw TEXT to the browser, while the reparse
81
+ // reads it as elements (#112). Parse that text with the page's own parser and count what
82
+ // it yields, in place, so every later ordinal still lines up. The inert parsed nodes have
83
+ // no computed style and an empty box, which the rules read as « nothing measured ».
84
+ if (name === 'noscript' && child.children.length === 0 && (child.textContent || '').includes('<')) {
85
+ const parsed = document.createElement('template');
86
+ parsed.innerHTML = child.textContent || '';
87
+ walkElements(parsed.content);
88
+ continue;
89
+ }
80
90
  walkElements(name === 'template' && child.content ? child.content : child);
81
91
  }
82
92
  };
@@ -1,5 +1,5 @@
1
- import { existsSync, mkdirSync, readFileSync, realpathSync, statSync, writeFileSync } from "node:fs";
2
- import { isAbsolute, join, resolve, sep } from "node:path";
1
+ import { existsSync, lstatSync, mkdirSync, readFileSync, realpathSync, statSync, writeFileSync } from "node:fs";
2
+ import { basename, dirname, isAbsolute, join, resolve, sep } from "node:path";
3
3
  import { runAudit } from "../audit.js";
4
4
  import { type AdjudicationFile, applyAdjudication, buildAdjudicationWorklist, formatAdjudication, hydrateAdjudication } from "../adjudicate.js";
5
5
  import { entriesFrom, ledgerPath, mergeLedger, readLedger, unreadableCaptures, writeLedger } from "../ledger.js";
@@ -515,7 +515,11 @@ function handleFix(args: Record<string, unknown>, cwd: string): unknown {
515
515
  * audit and, on `ledger`, merge the ACCEPTED verdicts into the ledger. A refused verdict never
516
516
  * reaches the ledger: the next replay would launder it back in. */
517
517
  function handleFold(args: Record<string, unknown>, cwd: string): unknown {
518
- const adj = adjudicationArg(args);
518
+ // Every path the fold reads or writes stays inside the project, as ultra11y_read's does
519
+ // (#116) — checked before anything is read, so a dry run refuses it as a write would.
520
+ const outArg = str(args.out);
521
+ const outDir = outArg === undefined ? cwd : containedPath(outArg, cwd, "out");
522
+ const adj = adjudicationArg(args, cwd);
519
523
  // The adjudication names its standard; it must be one this project knows.
520
524
  standardOf({ standard: adj.standard });
521
525
  const asked = str(args.standard);
@@ -526,7 +530,7 @@ function handleFold(args: Record<string, unknown>, cwd: string): unknown {
526
530
  const auditFile = str(args.audit_file);
527
531
  let base: AuditResult;
528
532
  if (auditFile) {
529
- const path = resolve(cwd, auditFile);
533
+ const path = containedPath(auditFile, cwd, "audit_file");
530
534
  try {
531
535
  base = unwrapAudit(JSON.parse(readFileSync(path, "utf8"))) as AuditResult;
532
536
  } catch {
@@ -560,7 +564,6 @@ function handleFold(args: Record<string, unknown>, cwd: string): unknown {
560
564
  : "Nothing landed. Fix the refused verdicts listed in issues — cite the evidence a C cleared, ground every NC finding — and fold again.",
561
565
  };
562
566
  }
563
- const outDir = resolve(cwd, str(args.out) ?? ".");
564
567
  mkdirSync(outDir, { recursive: true });
565
568
  const auditPath = join(outDir, "audit-latest.json");
566
569
  writeFileSync(auditPath, `${JSON.stringify(auditDocumentFor(r.audit, adj.standard, lang), null, 2)}\n`);
@@ -584,17 +587,52 @@ function handleFold(args: Record<string, unknown>, cwd: string): unknown {
584
587
  return { ...summary, written: true, auditPath, ...(ledger ? { ledger } : {}) };
585
588
  }
586
589
 
590
+ /** `raw`, resolved against the project root, refused unless it lands inside it. Containment
591
+ * on the REALPATH, as ultra11y_read's: a symlink inside the project normalises cleanly as a
592
+ * string and only escapes once the filesystem resolves it. A path that does not exist yet (an
593
+ * `out` directory the fold will create) is held by its nearest existing ancestor; a dangling
594
+ * symlink resolves to nowhere and is refused. Returns the path as the caller wrote it, resolved. */
595
+ function containedPath(raw: string, cwd: string, field: string): string {
596
+ const refuse = (): never => {
597
+ throw new ToolError(`\`${field}\` is outside the project: ${raw}. The fold reads and writes inside its cwd only.`);
598
+ };
599
+ const target = resolve(cwd, raw);
600
+ let existing = target;
601
+ const rest: string[] = [];
602
+ for (;;) {
603
+ try {
604
+ lstatSync(existing);
605
+ break;
606
+ } catch {
607
+ const parent = dirname(existing);
608
+ if (parent === existing) break;
609
+ rest.unshift(basename(existing));
610
+ existing = parent;
611
+ }
612
+ }
613
+ let real: string;
614
+ try {
615
+ real = join(realpathSync(existing), ...rest);
616
+ } catch {
617
+ return refuse();
618
+ }
619
+ const root = realpathSync(cwd);
620
+ if (real !== root && !real.startsWith(root + sep)) refuse();
621
+ return target;
622
+ }
623
+
587
624
  /** The adjudication to fold: inline, or a file the caller named. Only `kind: "adjudication"`
588
625
  * is a fold — a ledger is replayed, not folded, and an array is the NC-verdicts worklist. */
589
- function adjudicationArg(args: Record<string, unknown>): AdjudicationFile {
626
+ function adjudicationArg(args: Record<string, unknown>, cwd: string): AdjudicationFile {
590
627
  const inline = args.adjudication;
591
628
  const file = str(args.adjudication_file);
592
629
  if (inline !== undefined && file) throw new ToolError("pass `adjudication` or `adjudication_file`, not both.");
593
630
  let v: unknown = inline;
594
631
  if (file) {
595
632
  if (!isAbsolute(file)) throw new ToolError("`adjudication_file` must be an absolute path.");
633
+ const path = containedPath(file, cwd, "adjudication_file");
596
634
  try {
597
- v = JSON.parse(readFileSync(file, "utf8"));
635
+ v = JSON.parse(readFileSync(path, "utf8"));
598
636
  } catch {
599
637
  throw new ToolError(`\`adjudication_file\` not found or not valid JSON: ${file}`);
600
638
  }
package/src/mcp/tools.ts CHANGED
@@ -303,17 +303,20 @@ export const WRITE_TOOLS: ToolDecl[] = [
303
303
  type: "object",
304
304
  description: "The filled adjudication: { kind: 'adjudication', standard, items: [...] }, as ultra11y_adjudicate's worklist with your verdicts.",
305
305
  },
306
- adjudication_file: { type: "string", description: "Absolute path to an adjudication JSON file to fold instead." },
306
+ adjudication_file: { type: "string", description: "Absolute path, inside cwd, to an adjudication JSON file to fold instead." },
307
307
  audit_file: {
308
308
  type: "string",
309
309
  description:
310
- "Absolute path (or relative to cwd) to the audit JSON to fold into, like `--in`. Default: audit the project now, as ultra11y_adjudicate did.",
310
+ "Absolute path (or relative to cwd), inside cwd, to the audit JSON to fold into, like `--in`. Default: audit the project now, as ultra11y_adjudicate did.",
311
311
  },
312
312
  globs: globsProp,
313
313
  standard: { type: "string", description: "Must match the adjudication's own standard when given." },
314
314
  strict: { type: "boolean", description: "All-or-nothing: a single refused verdict discards the whole fold." },
315
315
  write: { type: "boolean", description: "Actually write the folded audit (default: dry-run, returns the gate's verdict)." },
316
- out: { type: "string", description: "Directory, relative to cwd, for audit-latest.json. Default: the project root, as `verify --apply`." },
316
+ out: {
317
+ type: "string",
318
+ description: "Directory, relative to cwd and inside it, for audit-latest.json. Default: the project root, as `verify --apply`.",
319
+ },
317
320
  ledger: { type: "boolean", description: "With write:true, also record the accepted verdicts in .ultra11y/verdicts/<standard>.json." },
318
321
  lang: langProp,
319
322
  },
package/src/report.ts CHANGED
@@ -2029,6 +2029,24 @@ export function renderPackReport(r: AuditResult, pack: StandardPack, lang: Lang
2029
2029
  return joinReportDocuments(docs.report, docs.annex);
2030
2030
  }
2031
2031
 
2032
+ /** The automatic rate's own two operands, computed exactly as `packConformancePct` computes
2033
+ * its ratio — one formula, published with its numerator and its denominator so a reader can
2034
+ * tell it apart from the conformity rate above it at a glance. */
2035
+ function automaticRate(derived: ReturnType<typeof derivePackResults>): { pct: number; validated: number; decided: number } {
2036
+ const validated = derived.filter((d) => d.status === "C" && !isAdjudicated(d.decidedBy) && !isProvisionalJudgmentInapplicable(d)).length;
2037
+ return { pct: packConformancePct(derived), validated, decided: validated + derived.filter((d) => d.status === "NC").length };
2038
+ }
2039
+
2040
+ /** The two rates a pack report prints, with their operands, from the same grid the document
2041
+ * renders: the conformity rate it headlines (validated ÷ applicable) and the automatic rate of
2042
+ * its annex. `report --json` carries these, never the WCAG core's `conformancePct` (#116). */
2043
+ export function packReportRates(
2044
+ r: AuditResult,
2045
+ pack: StandardPack,
2046
+ ): { conformance: ConformanceRate; automatic: { pct: number; validated: number; decided: number } } {
2047
+ return { conformance: conformanceRate(reportTotals(packReportGroups(r, pack))), automatic: automaticRate(derivePackResults(r, pack.key)) };
2048
+ }
2049
+
2032
2050
  /** A derived report for a country standards pack (RGAA, …), projected from the WCAG audit — both
2033
2051
  * documents. */
2034
2052
  export function renderPackReportDocuments(
@@ -2047,11 +2065,7 @@ export function renderPackReportDocuments(
2047
2065
  const groups = packReportGroups(r, pack, lang);
2048
2066
  const rows = groups.flatMap((g) => g.rows);
2049
2067
  const tally = reportTotals(groups);
2050
- // The automatic rate's own two operands, computed exactly as `packConformancePct` computes
2051
- // its ratio — one formula, published with its numerator and its denominator so a reader can
2052
- // tell it apart from the conformity rate above it at a glance.
2053
- const autoValidated = derived.filter((d) => d.status === "C" && !isAdjudicated(d.decidedBy) && !isProvisionalJudgmentInapplicable(d)).length;
2054
- const autoDecided = autoValidated + derived.filter((d) => d.status === "NC").length;
2068
+ const auto = automaticRate(derived);
2055
2069
  return render(r, lang, {
2056
2070
  std,
2057
2071
  groupHead: L[lang].byTheme,
@@ -2059,8 +2073,8 @@ export function renderPackReportDocuments(
2059
2073
  derivedOf: std,
2060
2074
  standard: pack.key,
2061
2075
  partialAudit: untestedNeedsRendering(r, establishedScs(derived)),
2062
- headerRatePct: packConformancePct(derived),
2063
- conformance: { rate: conformanceRate(tally), provenance: decisionProvenance(rows), autoDecided, autoValidated },
2076
+ headerRatePct: auto.pct,
2077
+ conformance: { rate: conformanceRate(tally), provenance: decisionProvenance(rows), autoDecided: auto.decided, autoValidated: auto.validated },
2064
2078
  // Forwarded, unlike before: without it the per-page screenshots resolved against the
2065
2079
  // CWD instead of the report's own directory, so a pack report written to `audits/`
2066
2080
  // carried links that only worked when read from the repo root.
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.55.3";
3
+ export const VERSION = "5.55.5";
4
4
  export const SCHEMA_VERSION = 2;
5
5
 
6
6
  // Lang = the UI FRAME's language — the `L` localization tables each module (report,