@kinti/a11y-toolkit 5.25.1 → 5.26.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.
@@ -41,6 +41,8 @@ Tools:
41
41
  - a11y_wcag3_preview(report, lang?) re-group findings under the WCAG 3
42
42
  Working Draft outcomes (no score)
43
43
  - a11y_route(goal, lang?) the router: goal → ordered tools (start here)
44
+ - a11y_scope(reports, standard?, …) applicability scope: machine proposes,
45
+ human confirms (EN 301 549 clauses)
44
46
 
45
47
  Prompts: audit-page, fix-contrast, pre-deploy-check, declaration-eaa,
46
48
  conformance-wcagem, blindfold-task.
@@ -81,13 +83,14 @@ from .a11yopenacr import generate_openacr as openacr_fn # noqa: E402
81
83
  from .a11ydom import contrast_dom as contrast_dom_fn # noqa: E402
82
84
  from .a11ywcag3 import preview as wcag3_preview_fn # noqa: E402
83
85
  from .a11yroute import route as route_fn # noqa: E402
86
+ from .a11yscope import build_scope as scope_fn # noqa: E402
84
87
 
85
88
  try:
86
89
  from .arialive_js import ARIALIVE_JS # installed as a module (pip)
87
90
  except ImportError:
88
91
  ARIALIVE_JS = None # repo checkout: read the file
89
92
 
90
- VERSION = '5.25.1'
93
+ VERSION = '5.26.0'
91
94
 
92
95
  # Params renombrados a inglés en 5.11.0; se aceptan los nombres previos.
93
96
  PARAM_ALIASES = {
@@ -146,6 +149,8 @@ TOOLS = [
146
149
  'pages': {'type': 'integer', 'minimum': 1, 'maximum': 20, 'description': 'light same-domain crawl: audit up to N pages, aggregated by score and recurring signals (default 1, max 20)'},
147
150
  'lang': {'type': 'string', 'enum': ['es', 'en'], 'description': 'output language (en default)'},
148
151
  'timeout': {'type': 'number', 'description': 'fetch timeout seconds (30 default)'},
152
+ 'standard': {'type': 'string', 'enum': ['en301549'], 'description': 'add the EN 301 549 V4.1.1 (2026) clause to every finding plus a standard block (EAA procurement, Canada ICT standard)'},
153
+ 'target': {'type': 'string', 'enum': ['web', 'documents', 'software'], 'description': 'EN 301 549 target: web=9.x clauses (default), documents=10.x, software=11.x'},
149
154
  }},
150
155
  },
151
156
  {
@@ -167,6 +172,8 @@ TOOLS = [
167
172
  'auth_state': {'type': 'string', 'description': 'Path to a Playwright storage_state JSON (exported session) to audit behind login — local file, never uploaded'},
168
173
  'browser': {'type': 'string', 'enum': ['auto', 'chromium', 'firefox', 'webkit', 'chrome', 'msedge'], 'description': 'Browser engine (auto = detect the first available)'},
169
174
  'color_scheme': {'type': 'string', 'enum': ['light', 'dark'], 'description': 'Emulate prefers-color-scheme: run the contrast pass in dark mode too — dark themes fail where light passes (nobody audits both)'},
175
+ 'standard': {'type': 'string', 'enum': ['en301549'], 'description': 'add the EN 301 549 V4.1.1 (2026) clause to every finding plus a standard block'},
176
+ 'target': {'type': 'string', 'enum': ['web', 'documents', 'software'], 'description': 'EN 301 549 target: web=9.x clauses (default), documents=10.x, software=11.x'},
170
177
  },
171
178
  'required': ['url']},
172
179
  },
@@ -375,10 +382,38 @@ TOOLS = [
375
382
  'reports': {'type': 'array', 'items': {'type': 'object'},
376
383
  'description': 'audit report objects (any mode)'},
377
384
  'snapshot': {'type': 'object', 'description': 'a11y_snapshot output (optional)'},
385
+ 'scope': {'type': 'object', 'description': 'a11y_scope output: human-confirmed exclusions become not-applicable rows with their reason (machine proposals never exclude)'},
378
386
  'reviewer': {'type': 'object', 'description': '{"name":…, "credential":…, "review_date":…} to prefill the signature block'},
379
387
  'verified': {'type': 'array', 'items': {'type': 'string'}, 'description': 'Criterion codes an agent/human verified against this sample (manual checklist protocol) — they become agent-verified in the matrix; automated-fail stays fail'},
380
388
  }, 'required': ['reports']},
381
389
  },
390
+ {
391
+ 'name': 'a11y_scope',
392
+ 'description': ('Semi-automatic applicability scoping — the layer between the audit '
393
+ 'and the conformance claim (the pattern of the Government of Canada '
394
+ 'CIO wizard for EN 301 549, informed by the audit instead of 118 '
395
+ 'hand-answered questions). Reads the features block of the reports '
396
+ '(media elements, form controls — positive evidence of what the audit '
397
+ 'SAW) and proposes the structural exclusions: no video anywhere → '
398
+ '1.2.x proposed-excluded, no form controls → 3.3.x proposed-excluded. '
399
+ 'The machine PROPOSES, the human CONFIRMS via answers '
400
+ '{"1.2.4": {"status": "excluded", "reason": "…"}} — only confirmed '
401
+ 'exclusions may become not-applicable downstream (a11y_evidence, '
402
+ 'a11y_generate_vpat, a11y_generate_openacr); a proposal never '
403
+ 'excludes. standard=en301549 adds the EN 301 549 V4.1.1 (2026) '
404
+ 'clause to every row (9.x web / 10.x documents / 11.x software — '
405
+ 'numbering verified 55/55 A/AA) and the EN-only families (5, 6, 7, '
406
+ '8, 12, 13) as honest applicability rows this toolkit does not '
407
+ 'evaluate. Live counter: N of 55 criteria in scope.'),
408
+ 'inputSchema': {'type': 'object', 'properties': {
409
+ 'reports': {'type': 'array', 'items': {'type': 'object'},
410
+ 'description': 'audit report objects (any mode; reports carrying the features block power the machine proposals)'},
411
+ 'standard': {'type': 'string', 'enum': ['wcag22', 'en301549'], 'description': 'wcag22 (default) or en301549: adds clause refs + EN families'},
412
+ 'target': {'type': 'string', 'enum': ['web', 'documents', 'software'], 'description': 'ICT target: web=9.x clauses (default), documents=10.x, software=11.x'},
413
+ 'answers': {'type': 'object', 'description': 'human confirmations keyed by criterion code: {"1.2.4": {"status": "excluded", "reason": "no live media"}} — status in-scope|proposed-excluded|excluded'},
414
+ 'lang': {'type': 'string', 'enum': ['es', 'en'], 'description': 'output language (en default)'},
415
+ }, 'required': ['reports']},
416
+ },
382
417
  {
383
418
  'name': 'a11y_forms',
384
419
  'description': ('Form error testing (3.3.1 Error Identification, 3.3.3 Error Suggestion) — '
@@ -535,6 +570,7 @@ TOOLS = [
535
570
  'notes': {'type': 'string', 'description': 'Additional notes to include'},
536
571
  'overrides': {'type': 'object', 'description': 'Criterion → conformance level set by a qualified human: {"1.1.1": "supports", "1.2.2": "not_applicable", …}'},
537
572
  'reviewer': {'type': 'object', 'description': '{"name":…, "credential":…, "review_date":…} to prefill the signature block'},
573
+ 'scope': {'type': 'object', 'description': 'a11y_scope output: human-confirmed exclusions become Not Applicable with their reason (machine proposals never); overrides still win'},
538
574
  'output_path': {'type': 'string', 'description': 'save the VPAT HTML here (optional)'},
539
575
  'lang': {'type': 'string', 'enum': ['es', 'en'], 'description': 'Document language (default en)'},
540
576
  }, 'required': ['product']},
@@ -566,6 +602,7 @@ TOOLS = [
566
602
  'methods': {'type': 'string', 'description': 'Evaluation methods used (default: honest automated-screening note)'},
567
603
  'notes': {'type': 'string', 'description': 'Additional notes to include'},
568
604
  'overrides': {'type': 'object', 'description': 'Criterion → adherence level set by a qualified human: {"1.1.1": "supports", "1.2.2": "not_applicable", …} (hyphenated forms accepted)'},
605
+ 'scope': {'type': 'object', 'description': 'a11y_scope output: human-confirmed exclusions become not-applicable with their reason (machine proposals never); overrides still win'},
569
606
  'output_path': {'type': 'string', 'description': 'save the OpenACR YAML here (optional)'},
570
607
  'lang': {'type': 'string', 'enum': ['es', 'en'], 'description': 'Document language (default en)'},
571
608
  }, 'required': ['product']},
@@ -986,6 +1023,16 @@ _PARAM_DOCS = {
986
1023
  ('a11y_generate_vpat', 'methods'): 'Evaluation methods used (default: honest automated-screening note)',
987
1024
  ('a11y_generate_vpat', 'notes'): 'Additional notes to include',
988
1025
  ('a11y_generate_vpat', 'overrides'): 'Criterion → conformance level set by a qualified human: {"1.1.1": "supports", "1.2.2": "not_applicable", …}',
1026
+ ('a11y_generate_vpat', 'scope'): 'a11y_scope output: human-confirmed exclusions become Not Applicable with their reason (proposals never)',
1027
+ ('a11y_scope', 'reports'): 'Audit report objects (any mode; the features block powers machine proposals)',
1028
+ ('a11y_scope', 'standard'): 'wcag22 (default) or en301549: clause refs + EN families (5, 6, 7, 8, 12, 13)',
1029
+ ('a11y_scope', 'target'): 'ICT target: web=9.x clauses (default), documents=10.x, software=11.x',
1030
+ ('a11y_scope', 'answers'): 'Human confirmations keyed by criterion code: {"1.2.4": {"status": "excluded", "reason": "no live media"}}',
1031
+ ('a11y_audit_url', 'standard'): 'Add the EN 301 549 V4.1.1 (2026) clause to every finding (EAA procurement, Canada ICT)',
1032
+ ('a11y_audit_url', 'target'): 'EN 301 549 target: web=9.x (default), documents=10.x, software=11.x',
1033
+ ('a11y_audit_dom', 'standard'): 'Add the EN 301 549 V4.1.1 (2026) clause to every finding',
1034
+ ('a11y_audit_dom', 'target'): 'EN 301 549 target: web=9.x (default), documents=10.x, software=11.x',
1035
+ ('a11y_evidence', 'scope'): 'a11y_scope output: human-confirmed exclusions become not-applicable rows (proposals never)',
989
1036
  ('a11y_generate_vpat', 'reviewer'): '{"name":…, "credential":…, "review_date":…} to prefill the signature block',
990
1037
  ('a11y_generate_vpat', 'output_path'): 'Local path to save the VPAT HTML (omit to receive it inline)',
991
1038
  ('a11y_generate_vpat', 'lang'): 'Document language (default en)',
@@ -1029,6 +1076,7 @@ _ROUTING = {
1029
1076
  'a11y_badge': 'Scope: the honest SVG seal for audited sites; the machine-readable bundle is a11y_evidence.',
1030
1077
  'a11y_criterion': 'Knowledge lookup; does not fetch or audit anything — includes the official Understanding WCAG 2.2 link for the criterion.',
1031
1078
  'a11y_evidence': 'The tier-3 handoff object; feed it every audit report you have.',
1079
+ 'a11y_scope': 'The applicability layer before conformance: run after the audits, confirm the machine proposals via answers, then feed the scope here — a11y_evidence/vpat/openacr turn confirmed exclusions into not-applicable with their reason.',
1032
1080
  'a11y_aria_live_snippet': 'Diagnostics aid to inject in a browser; not an audit by itself.',
1033
1081
  'a11y_generate_declaration': 'Legal statement generator; drive inaccessible_content from audit findings and a11y_evidence.',
1034
1082
  'a11y_generate_vpat': 'The US/ADA counterpart of a11y_generate_declaration; feed it the a11y_evidence pack — levels stay Not Evaluated until a qualified human sets them.',
@@ -1081,6 +1129,7 @@ _ANN = {
1081
1129
  'a11y_forced_colors': ('forced-colors survival heuristic', True, True),
1082
1130
  'a11y_wcag3_preview': ('WCAG 3 draft preview (no score)', True, False),
1083
1131
  'a11y_route': ('Tool router (goal or page to steps)', True, True),
1132
+ 'a11y_scope': ('Applicability scope (semi-automatic)', True, False),
1084
1133
  }
1085
1134
  # TDQS hygiene: annotations must match reality, and every description states
1086
1135
  # its return shape and when (not) to use the tool. a11y_ledger.record mutates
@@ -1118,6 +1167,7 @@ _RETURNS = {
1118
1167
  'a11y_contrast_dom': 'Returns JSON: {url, selector, text_color, worst_ratio, median_ratio, p95_ratio, area_passes_aa_normal_text_4_5, worst_zone?, sampled_pixels, interpretation}.',
1119
1168
  'a11y_wcag3_preview': 'Returns JSON: {mode, draft, disclaimer, mapping_note, no_score, conformance_model, outcomes [{outcome, draft_url, findings, severity, signals, criteria_22}], counts, unmapped} — never a score.',
1120
1169
  'a11y_route': 'Returns JSON: {route, steps [{step, tool, why}], alternates, prompts, cli, note} — the ordered tool sequence for the goal. Diagnosis mode (url/html passed): {mode: diagnose, vitals {score, summary, signals}, symptoms [{symptom, evidence}], steps [...], guarantee} — evidence orders the exams, severity breaks ties.',
1170
+ 'a11y_scope': 'Returns JSON: {format: a11y-scope/1, standard, target, criteria [{criterion, level, status, clause?, evidence?, reason?}], counters, en301549_families?, sha256} — statuses in-scope|proposed-excluded|excluded; only human-confirmed exclusions count downstream.',
1121
1171
  }
1122
1172
  _USAGE = {
1123
1173
  'a11y_forms': 'Use on test/staging forms, or forms you own: invalid data is REALLY submitted. Do not run against production forms that trigger real emails, orders or leads.',
@@ -1129,6 +1179,7 @@ _USAGE = {
1129
1179
  'a11y_generate_vpat': 'Run after the audits you trust; a qualified human must set the final levels (overrides) and sign before publishing — the machine fills Remarks, never the claim.',
1130
1180
  'a11y_generate_openacr': 'Run after the audits you trust; validate and render in the GSA OpenACR editor (gsa.github.io/openacr-editor) — a qualified human must set the final adherence levels before publishing.',
1131
1181
  'a11y_wcag3_preview': 'Run after any audit when the team asks "what about WCAG 3?"; re-baseline on each W3C draft publication (roughly March/September).',
1182
+ 'a11y_scope': 'Run after the audits, before any conformance artifact: confirm the machine proposals via answers, then pass the scope to a11y_evidence — only human-confirmed exclusions become not-applicable, and each exclusion carries its reason.',
1132
1183
  }
1133
1184
  for _t in TOOLS:
1134
1185
  _title, _ro, _ow = _ANN[_t['name']]
@@ -1151,6 +1202,24 @@ def _content(obj):
1151
1202
  return r
1152
1203
 
1153
1204
 
1205
+ def _enrich_standard(res, standard, target, lang):
1206
+ """Post-hoc EN 301 549 enrichment for report shapes that don't pass
1207
+ through audit_html (site crawl, rendered): adds the standard block and a
1208
+ clause ref to every finding. standard=None → res unchanged."""
1209
+ if standard != 'en301549' or not isinstance(res, dict) or 'error' in res:
1210
+ return res
1211
+ from . import a11yen301549 as _enstd
1212
+ pages = res.get('reports') if 'reports' in res else [res]
1213
+ tgt = target or _enstd.target_for_mode(res.get('mode', 'static'))
1214
+ res['standard'] = _enstd.standard_block(tgt, lang)
1215
+ for pg in pages:
1216
+ for h in pg.get('findings', []):
1217
+ cl = _enstd.clause_for(h.get('criterion', '').split(' ')[0], tgt)
1218
+ if cl:
1219
+ h['clause'] = cl
1220
+ return res
1221
+
1222
+
1154
1223
  def invoke(name, args):
1155
1224
  args = {PARAM_ALIASES.get(k, k): v for k, v in (args or {}).items()}
1156
1225
  if name == 'a11y_contrast_pair':
@@ -1184,22 +1253,31 @@ def invoke(name, args):
1184
1253
  try:
1185
1254
  if args.get('html'):
1186
1255
  return _content(audit_html_fn(args['html'], args.get('url') or '(html)',
1187
- lang=args.get('lang', 'en')))
1256
+ lang=args.get('lang', 'en'),
1257
+ standard=args.get('standard'),
1258
+ target=args.get('target')))
1188
1259
  if args.get('pages', 1) > 1:
1189
- return _content(audit_site_fn(args['url'], max_pages=args['pages'],
1190
- timeout=args.get('timeout', 30),
1191
- lang=args.get('lang', 'en')))
1260
+ res = audit_site_fn(args['url'], max_pages=args['pages'],
1261
+ timeout=args.get('timeout', 30),
1262
+ lang=args.get('lang', 'en'))
1263
+ res = _enrich_standard(res, args.get('standard'),
1264
+ args.get('target'), args.get('lang', 'en'))
1265
+ return _content(res)
1192
1266
  return _content(audit_url_fn(args['url'], timeout=args.get('timeout', 30),
1193
- lang=args.get('lang', 'en')))
1267
+ lang=args.get('lang', 'en'),
1268
+ standard=args.get('standard'),
1269
+ target=args.get('target')))
1194
1270
  except Exception as e: # noqa: BLE001
1195
1271
  return {'content': [{'type': 'text', 'text': f'error: {e}'}], 'isError': True}
1196
1272
  if name == 'a11y_audit_dom':
1197
1273
  try:
1198
- return _content(audit_dom_url(args['url'], timeout=args.get('timeout', 45),
1199
- lang=args.get('lang', 'en'),
1200
- auth_state=args.get('auth_state'),
1201
- browser=args.get('browser', 'auto'),
1202
- color_scheme=args.get('color_scheme', 'light')))
1274
+ res = audit_dom_url(args['url'], timeout=args.get('timeout', 45),
1275
+ lang=args.get('lang', 'en'),
1276
+ auth_state=args.get('auth_state'),
1277
+ browser=args.get('browser', 'auto'),
1278
+ color_scheme=args.get('color_scheme', 'light'))
1279
+ return _content(_enrich_standard(res, args.get('standard'),
1280
+ args.get('target'), args.get('lang', 'en')))
1203
1281
  except ImportError:
1204
1282
  return {'content': [{'type': 'text',
1205
1283
  'text': 'Playwright not installed: pip install playwright && playwright install chromium (or use a11y_audit_url for the zero-dependency static audit)'}],
@@ -1274,7 +1352,16 @@ def invoke(name, args):
1274
1352
  try:
1275
1353
  return _content(build_pack_fn(args['reports'], snapshot=args.get('snapshot'),
1276
1354
  reviewer=args.get('reviewer'),
1277
- verified=args.get('verified')))
1355
+ verified=args.get('verified'),
1356
+ scope=args.get('scope')))
1357
+ except Exception as e: # noqa: BLE001
1358
+ return {'content': [{'type': 'text', 'text': f'error: {e}'}], 'isError': True}
1359
+ if name == 'a11y_scope':
1360
+ try:
1361
+ return _content(scope_fn(args['reports'], standard=args.get('standard', 'wcag22'),
1362
+ target=args.get('target', 'web'),
1363
+ answers=args.get('answers'),
1364
+ lang=args.get('lang', 'en')))
1278
1365
  except Exception as e: # noqa: BLE001
1279
1366
  return {'content': [{'type': 'text', 'text': f'error: {e}'}], 'isError': True}
1280
1367
  if name == 'a11y_autofix':
@@ -1405,7 +1492,8 @@ def invoke(name, args):
1405
1492
  description=args.get('product_description'),
1406
1493
  contact=args.get('contact'), methods=args.get('methods'),
1407
1494
  notes=args.get('notes'), overrides=args.get('overrides'),
1408
- reviewer=args.get('reviewer'), lang=args.get('lang', 'en'),
1495
+ reviewer=args.get('reviewer'), scope=args.get('scope'),
1496
+ lang=args.get('lang', 'en'),
1409
1497
  output_path=args.get('output_path'))
1410
1498
  if 'error' in res:
1411
1499
  return {'content': [{'type': 'text', 'text': res['error']}], 'isError': True}
@@ -1425,7 +1513,8 @@ def invoke(name, args):
1425
1513
  description=args.get('product_description'),
1426
1514
  author=args.get('author'), contact=args.get('contact'),
1427
1515
  methods=args.get('methods'), notes=args.get('notes'),
1428
- overrides=args.get('overrides'), lang=args.get('lang', 'en'),
1516
+ overrides=args.get('overrides'), scope=args.get('scope'),
1517
+ lang=args.get('lang', 'en'),
1429
1518
  output_path=args.get('output_path'))
1430
1519
  if 'error' in res:
1431
1520
  return {'content': [{'type': 'text', 'text': res['error']}], 'isError': True}
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@kinti/a11y-toolkit",
3
- "version": "5.25.1",
3
+ "version": "5.26.0",
4
4
  "mcpName": "io.github.kinti/a11y-toolkit",
5
- "description": "Zero-dependency WCAG 2.2 accessibility engine (34 MCP tools + CLI): audits, contrast fixing, SHA-256-sealed evidence packs, SARIF, EARL/ACT, CI ratchet. Self-contained: the pure-stdlib Python engine ships inside and runs via python3 \u2014 no downloads, no installs.",
5
+ "description": "Zero-dependency WCAG 2.2 accessibility engine (35 MCP tools + CLI): audits, contrast fixing, SHA-256-sealed evidence packs, SARIF, EARL/ACT, CI ratchet. Self-contained: the pure-stdlib Python engine ships inside and runs via python3 \u2014 no downloads, no installs.",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",