@kinti/a11y-toolkit 5.28.0 → 5.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/a11y_toolkit/a11yact.py +17 -8
- package/a11y_toolkit/a11yaudit.py +255 -79
- package/a11y_toolkit/a11ybudget.py +21 -1
- package/a11y_toolkit/a11ycorpus.py +8 -1
- package/a11y_toolkit/a11ycrit.py +74 -0
- package/a11y_toolkit/a11ydiff.py +24 -11
- package/a11y_toolkit/a11ydisprove.py +27 -4
- package/a11y_toolkit/a11ydocx.py +28 -4
- package/a11y_toolkit/a11ydom.py +618 -370
- package/a11y_toolkit/a11yengines.py +19 -6
- package/a11y_toolkit/a11yevidence.py +34 -11
- package/a11y_toolkit/a11yfingerprints.py +8 -5
- package/a11y_toolkit/a11yfix.py +21 -2
- package/a11y_toolkit/a11yinit.py +24 -5
- package/a11y_toolkit/a11yjourney.py +7 -0
- package/a11y_toolkit/a11yledger.py +9 -0
- package/a11y_toolkit/a11ylocate.py +7 -1
- package/a11y_toolkit/a11yopenacr.py +16 -1
- package/a11y_toolkit/a11ypatterns.py +133 -43
- package/a11y_toolkit/a11ypdf.py +26 -5
- package/a11y_toolkit/a11ysarif.py +10 -2
- package/a11y_toolkit/a11yscope.py +19 -0
- package/a11y_toolkit/a11yscroll.py +48 -23
- package/a11y_toolkit/a11ytrace.py +6 -8
- package/a11y_toolkit/a11yvpat.py +11 -1
- package/a11y_toolkit/a11yvtt.py +33 -3
- package/a11y_toolkit/arialive.js +17 -7
- package/a11y_toolkit/contrast.py +12 -5
- package/a11y_toolkit/locales/_template.json +9 -3
- package/a11y_toolkit/locales/en.json +13 -0
- package/a11y_toolkit/locales/es.json +13 -0
- package/a11y_toolkit/server.py +39 -12
- package/lib/_bootstrap.py +36 -0
- package/lib/runner.cjs +12 -4
- package/package.json +1 -1
|
@@ -27,6 +27,10 @@
|
|
|
27
27
|
"autocomplete_invalid_rem": "Usa tokens del estándar: email, tel, name, postal-code, one-time-code… (lista completa en la herramienta).",
|
|
28
28
|
"autocomplete_mismatch": "{n} campos con propósito contradicho entre type y autocomplete: {example}. El navegador no puede decidir el propósito (1.3.5).",
|
|
29
29
|
"autocomplete_mismatch_rem": "Para humanos, don't make me think; para máquinas, don't make me guess: el type y el token han de decir lo mismo. type=email lleva autocomplete de familia email (email, username); type=tel, familia tel; type=url, url.",
|
|
30
|
+
"heading_role_removed": "{n} encabezados anulados por otro rol: {example}. Un rol explícito sustituye al de heading y el encabezado desaparece de la navegación por encabezados del lector (1.3.1; el 71,6% navega primero por encabezados, WebAIM SR Survey 10).",
|
|
31
|
+
"heading_role_removed_rem": "El patrón correcto para un encabezado interactivo es el control DENTRO: <h2><button>…</button></h2> conserva encabezado y botón; sobre el elemento, usa role=heading solo si es su función real.",
|
|
32
|
+
"text_spacing_important": "{n} estilos inline con letter/line/word-spacing en !important: {example}. El usuario no puede re-espaciar el texto con su hoja de estilos (1.4.12, reglas ACT 24afc2/78fd32/9e45ec).",
|
|
33
|
+
"text_spacing_important_rem": "Quita el !important de los spacing inline (la especificidad normal basta): 1.4.12 exige que el usuario pueda aumentar el interlineado a 1,5 veces y los espaciados sin perder contenido.",
|
|
30
34
|
"autocomplete_rem": "Añade autocomplete con el token correcto (email, tel, name, postal-code…, 1.3.5): relleno automático y voz de accesibilidad con sobrecoste cero.",
|
|
31
35
|
"blank_no_warning": "{n} enlaces con target=\"_blank\" sin avisar de que abren ventana nueva.",
|
|
32
36
|
"blank_no_warning_rem": "Añade aviso en texto (o title/aria-label): «(abre en ventana nueva)», o deja que la persona usuaria decida.",
|
|
@@ -297,6 +301,8 @@
|
|
|
297
301
|
"focus_navigates_rem": "Recibir foco nunca debe cambiar el contexto (3.2.1): revisa focus→location.href, focus→form.submit(), focus→window.open().",
|
|
298
302
|
"focus_not_focusable": "{n} controles que no reciben foco con .focus(): {det}.",
|
|
299
303
|
"focus_not_focusable_rem": "Si debe ser interactivo, que sea enfocable (tabindex=\"0\"); si no, quítalo de la ruta de tabulación.",
|
|
304
|
+
"focus_static_indicator": "Un indicador de foco ambiguo en {n} controles: tienen borde/sombra que NO cambia al recibir el foco ({det}). Decoración permanente no es indicador demostrado.",
|
|
305
|
+
"focus_static_indicator_rem": "Recorre con Tab y mira si ALGO cambia visualmente en cada parada. Si nada cambia, añade un outline real en :focus (o :focus-visible) — la decoración permanente no guía a nadie por teclado.",
|
|
300
306
|
"focus_obscured": "{n} controles quedan tapados por elementos fijos/sticky al recibir el foco (cabeceras sticky, banners): {det}. Revisar (2.4.11).",
|
|
301
307
|
"focus_obscured_rem": "Un elemento fijo no debe ocultar el elemento enfocado (2.4.11, nuevo en WCAG 2.2 AA): usa scroll-padding-top igual a la altura del header fijo, o hazlo auto-colapsable.",
|
|
302
308
|
"forced_colors_svg": "{n} SVG con fill coloreado hardcoded: en forced-colors (Windows High Contrast) el fill cae al heredado y el icono puede volverse invisible.",
|
|
@@ -307,6 +313,8 @@
|
|
|
307
313
|
"form_error_no_suggestion_rem": "Cuando la corrección se conoce, dila: «Usa DD/MM/AAAA», no «Fecha inválida» (3.3.3). Sugerimos patrón: texto con formato/ejemplo cerca del campo.",
|
|
308
314
|
"form_navigated": "El formulario navega al enviar; el comportamiento del error no es medible en la página ({example}).",
|
|
309
315
|
"form_navigated_rem": "Captura la página de destino o prueba con un intercepto; el juicio del error requiere ver el DOM tras el envío.",
|
|
316
|
+
"form_untestable": "{n} formulario(s) sin ningún campo rellenable con dato inválido (solo casillas/radios o botones): la identificación de errores NO se probó en esta muestra.",
|
|
317
|
+
"form_untestable_rem": "Prueba el flujo a mano: envía el formulario con errores reales y comprueba que el error se anuncia en texto. Las casillas obligatorias también pueden invalidarse (desmárcalas).",
|
|
310
318
|
"hover_not_dismissible": "{n} tooltips/overlays aparecen al hover/focus que NO se cierran con Escape (1.4.13).",
|
|
311
319
|
"hover_not_dismissible_rem": "El contenido emergente debe poder cerrarse con Escape sin mover el puntero (1.4.13): añade keydown Escape que oculte el tooltip.",
|
|
312
320
|
"input_navigates": "Cambiar {example} provocó navegación automática (URL: {url}) — 3.2.2.",
|
|
@@ -317,6 +325,7 @@
|
|
|
317
325
|
"skip_target_hidden_rem": "Un mecanismo de bypass debe aterrizar en contenido perceivable (2.4.1): apunta el enlace a contenido visible, o haz que la página revele o expanda el destino al activarlo (hashchange o click), y dale tabindex=\"-1\" al destino para que el foco lo acompañe.",
|
|
318
326
|
"placeholder_contrast": "{n} placeholders con contraste insuficiente: {det}. El placeholder es texto que la gente con visión baja tiene que leer, y 1.4.3 no distingue pseudo-elementos (4.5:1, o 3:1 en texto grande).",
|
|
319
327
|
"placeholder_contrast_rem": "Dale color propio al placeholder con contraste ≥4.5:1 sobre el fondo del campo (el gris por defecto del navegador roza el mínimo y falla sobre fondos no blancos). Ejemplo seguro: color igual al texto del campo pero con opacity 0.7.",
|
|
328
|
+
"label_focus_note": "Label→foco: se pulsa cada <label> asociado y se comprueba que su campo reciba el foco (dato; el comportamiento es del spec y su fallo apunta a JS que lo sabotea).",
|
|
320
329
|
"limits": "Auditoría renderizada: heurística honesta, no sustituye lector de pantalla ni revisión manual. Contraste calculado sobre fondos computados; los casos con imagen de fondo se reportan como «revisar». 2.5.8 admite excepciones (inline equivalente, espaciado) que aquí se aproximan.",
|
|
321
330
|
"reduced_motion_ignored": "{n} animaciones en bucle siguen moviéndose con prefers-reduced-motion activo (antes {n}, ahora {nr}): la preferencia del usuario se ignora (2.2.2).",
|
|
322
331
|
"reduced_motion_ignored_rem": "Envuelve las animaciones en @media (prefers-reduced-motion: reduce) { animation: none } — o paúsala con la API Animation. El usuario pidió menos movimiento; respóndelo.",
|
|
@@ -331,6 +340,7 @@
|
|
|
331
340
|
"manual_remaining": "revisión humana pendiente después de la máquina, por clase (MIN 1-3, MED 5-10, MAX 15-30 min por criterio)",
|
|
332
341
|
"no_signal": "no hay señal automática para este criterio en este motor",
|
|
333
342
|
"not_flagged": "sin señal ≠ pasa: ninguna señal automática saltó en esta muestra",
|
|
343
|
+
"not_run": "ninguna prueba de este criterio se ejecutó en la muestra — falta: {modes}",
|
|
334
344
|
"notice": "Este pack es evidencia, no conformidad: dice qué encontró la máquina y qué queda para una persona. Una declaración de conformidad requiere el bloque de firma completo, de una persona cualificada que haya revisado la lista manual.",
|
|
335
345
|
"reviewer_note": "cualquier contrafirma debe referenciar pack.sha256 e indicar qué criterios revisó la persona más allá de la matriz automática",
|
|
336
346
|
"verified": "verificado sobre esta muestra según el protocolo del checklist manual",
|
|
@@ -484,6 +494,8 @@
|
|
|
484
494
|
"pattern_tabs_no_activation_rem": "Haz que la selección siga al foco (activación automática) o activa con Enter/Espacio (manual) — aria-selected debe reflejar el panel visible.",
|
|
485
495
|
"pattern_disclosure_state_frozen": "Activar «{name}» nunca cambia aria-expanded: el estado expuesto contradice lo visual.",
|
|
486
496
|
"pattern_disclosure_state_frozen_rem": "Alterna aria-expanded (true/false) en cada activación y apunta aria-controls a la región que revela.",
|
|
497
|
+
"pattern_disclosure_keyboard_dead": "«{name}» no reacciona a Enter ni Espacio con el foco en el control: el desplegable solo funciona con ratón.",
|
|
498
|
+
"pattern_disclosure_keyboard_dead_rem": "Los disclosure deben abrirse con teclado: maneja keydown de Enter y Espacio (y ArrowDown en botones de menú) exactamente como el patrón Disclosure del APG.",
|
|
487
499
|
"pattern_combobox_no_open": "Un combobox nunca abre su popup con ArrowDown (sin aria-expanded, sin listbox visible).",
|
|
488
500
|
"pattern_combobox_no_open_rem": "Abre el listbox con ArrowDown / Alt+ArrowDown y pon aria-expanded=true; mantiene el foco en el input mientras filtra.",
|
|
489
501
|
"pattern_combobox_esc_no_close": "El popup de un combobox sigue abierto tras Escape.",
|
|
@@ -634,6 +646,7 @@
|
|
|
634
646
|
"notes": "Notas",
|
|
635
647
|
"product": "Nombre del producto",
|
|
636
648
|
"signature": "Este documento es un <strong>BORRADOR</strong> generado por cribado automatizado. Los niveles marcados «No evaluado» deben ser fijados por una persona cualificada tras la revisión; la declaración de firma debe referenciar el hash del paquete de evidencia:",
|
|
649
|
+
"signature_scope": "Alcance de aplicabilidad aplicado (exclusiones confirmadas por una persona): sello del alcance <code>{sha}</code>. El sello del pack cubre los informes; este cubre las exclusiones que cambian esta matriz.",
|
|
637
650
|
"signature_empty": "Bloque de firma sin completar: nombre, credencial y fecha pendientes.",
|
|
638
651
|
"signature_title": "Firma y evidencia",
|
|
639
652
|
"standard": "<abbr lang=\"en\" title=\"Web Content Accessibility Guidelines\">WCAG</abbr> 2.2 (niveles A y AA) — Recomendación W3C de octubre de 2023.",
|
package/a11y_toolkit/server.py
CHANGED
|
@@ -97,7 +97,7 @@ try:
|
|
|
97
97
|
except ImportError:
|
|
98
98
|
ARIALIVE_JS = None # repo checkout: read the file
|
|
99
99
|
|
|
100
|
-
VERSION = '5.
|
|
100
|
+
VERSION = '5.30.0'
|
|
101
101
|
|
|
102
102
|
# Params renombrados a inglés en 5.11.0; se aceptan los nombres previos.
|
|
103
103
|
PARAM_ALIASES = {
|
|
@@ -147,7 +147,10 @@ TOOLS = [
|
|
|
147
147
|
'captions (1.2.2), autoplay audio (1.4.2), generic/duplicated link text '
|
|
148
148
|
'(2.4.4), target=_blank without warning (3.2.5), positive tabindex '
|
|
149
149
|
'(2.4.3), aria-hidden on focusable elements, tables without th, '
|
|
150
|
-
'duplicate ids, duplicate accesskeys
|
|
150
|
+
'duplicate ids, duplicate accesskeys, headings overridden by another '
|
|
151
|
+
'role (1.3.1), letter/line/word-spacing !important inline (1.4.12, '
|
|
152
|
+
'ACT 24afc2/78fd32/9e45ec), autocomplete purpose contradicting the '
|
|
153
|
+
'field type (1.3.5). Each finding includes concrete '
|
|
151
154
|
'remediation. Filter, not verdict: automation covers ~1/3 of WCAG; '
|
|
152
155
|
'query a11y_criterion for what a criterion means.'),
|
|
153
156
|
'inputSchema': {'type': 'object', 'properties': {
|
|
@@ -395,7 +398,13 @@ TOOLS = [
|
|
|
395
398
|
'name': 'a11y_scroll',
|
|
396
399
|
'description': ('Infinite-scroll accessibility audit — the documented disaster nobody '
|
|
397
400
|
'automates (Deque guidance + ARIA APG Feed pattern; criteria 2.4.3, '
|
|
398
|
-
'4.1.3, 2.2.2).
|
|
401
|
+
'4.1.3, 2.2.2). PASSIVE BY DEFAULT (external review round 5: the '
|
|
402
|
+
'load-more fallback clicked by substring match hit unrelated buttons — '
|
|
403
|
+
'the walk now scrolls only and never clicks). To ALSO test the '
|
|
404
|
+
'load-more alternative pass interactive=true together with '
|
|
405
|
+
'load_more="the exact visible text of the control" — that performs a '
|
|
406
|
+
'REAL click on that one control and nothing else. Real scrolling '
|
|
407
|
+
'batches in Chromium with a live-region '
|
|
399
408
|
'observer: does the focused element SURVIVE each batch (re-render '
|
|
400
409
|
'destroys it — the documented failure)? Is new content ANNOUNCED '
|
|
401
410
|
'(aria-live/status receives text, role=feed)? Does the feed END or '
|
|
@@ -409,6 +418,8 @@ TOOLS = [
|
|
|
409
418
|
'max_batches': {'type': 'integer', 'description': 'scroll batches (5 default)'},
|
|
410
419
|
'auth_state': {'type': 'string', 'description': 'Path to a Playwright storage_state JSON (exported session) to audit an authenticated feed'},
|
|
411
420
|
'browser': {'type': 'string', 'enum': ['auto', 'chromium', 'firefox', 'webkit', 'chrome', 'msedge'], 'description': 'Browser engine (auto = detect the first available)'},
|
|
421
|
+
'interactive': {'type': 'boolean', 'description': 'passive walk by default (scroll only, NEVER clicks); true enables the load-more click test (a real action on the page)'},
|
|
422
|
+
'load_more': {'type': 'string', 'description': 'with interactive=true: the EXACT visible text of the load-more control (full trimmed-text match, never substring)'},
|
|
412
423
|
},
|
|
413
424
|
'required': ['url']},
|
|
414
425
|
},
|
|
@@ -417,8 +428,11 @@ TOOLS = [
|
|
|
417
428
|
'description': ('Builds the verifiable evidence pack: the machine→human '
|
|
418
429
|
'handoff object for WCAG conformance work. Takes one or more audit '
|
|
419
430
|
'reports (any mode — static, rendered, reflow, keyboard, scroll) and '
|
|
420
|
-
'returns: the full 55-criterion A/AA matrix (automated-fail / '
|
|
421
|
-
'automated-review / not-flagged
|
|
431
|
+
'returns: the full 55-criterion A/AA matrix (statuses: automated-fail / '
|
|
432
|
+
'automated-review / not-flagged / not-run / manual-only / agent-verified — '
|
|
433
|
+
'never a pass; not-flagged means an ACCEPTED report of a mode that can '
|
|
434
|
+
'signal that criterion ran and found nothing, not-run names the missing '
|
|
435
|
+
'tool, and reports carrying an error never count as coverage), '
|
|
422
436
|
'each row priced with its human-effort class (MIN 1-3 / MED 5-10 / '
|
|
423
437
|
'MAX 15-30 min of human review remaining) and total remaining minutes '
|
|
424
438
|
'every artifact SHA-256-'
|
|
@@ -518,10 +532,15 @@ TOOLS = [
|
|
|
518
532
|
{
|
|
519
533
|
'name': 'a11y_sr_transcript',
|
|
520
534
|
'description': ('Screen reader TRANSCRIPT: what a blind user HEARS on this page. '
|
|
521
|
-
'Walks the accessibility tree linearly and returns
|
|
522
|
-
'
|
|
523
|
-
'
|
|
524
|
-
'
|
|
535
|
+
'Walks the accessibility tree linearly and returns announcements '
|
|
536
|
+
'as a LIST OF STRINGS (the linearized reading order — roles and '
|
|
537
|
+
'names embedded in the text, e.g. "button \"Search\"") plus '
|
|
538
|
+
'arbol_raw, the raw accessibility-tree snapshot it was read from '
|
|
539
|
+
'(external review round 6: the contract published objects with '
|
|
540
|
+
'time/politeneness/role/text — the real shape was strings; the '
|
|
541
|
+
'contract now matches reality and existing clients keep working). '
|
|
542
|
+
'Prose an agent can READ to understand the page from a blind '
|
|
543
|
+
'user\'s perspective. — Read-only: for structure '
|
|
525
544
|
'use a11y_snapshot, for keyboard traps use a11y_keyboard. '
|
|
526
545
|
'Requires Playwright.'),
|
|
527
546
|
'inputSchema': {'type': 'object', 'properties': {
|
|
@@ -536,7 +555,10 @@ TOOLS = [
|
|
|
536
555
|
'name': 'a11y_disprove',
|
|
537
556
|
'description': ('Disprover pattern (from Cloudflare\'s security-audit-skill): '
|
|
538
557
|
're-runs the audit against the live page and marks each finding '
|
|
539
|
-
'confirmed or rejected —
|
|
558
|
+
'confirmed or rejected — rendered reports are re-verified under '
|
|
559
|
+
'their ORIGINAL color scheme (a dark-only contrast fail must not '
|
|
560
|
+
'look fixed under light; reports that don\'t record their scheme '
|
|
561
|
+
'come back not-rechecked), and findings that don\'t reproduce are '
|
|
540
562
|
'rejected with the reason. Catches false positives, race '
|
|
541
563
|
'conditions, and page changes between audit and report. Returns '
|
|
542
564
|
'a fresh score over confirmed findings only. — Run this before '
|
|
@@ -1140,7 +1162,6 @@ _ANN = {
|
|
|
1140
1162
|
'a11y_keyboard': ('Keyboard-trap + skip-link landing detector', True, True),
|
|
1141
1163
|
'a11y_html_validate': ('W3C Nu validation', True, True),
|
|
1142
1164
|
'a11y_forms': ('Form error testing', True, True),
|
|
1143
|
-
'a11y_scroll': ('Infinite-scroll audit', True, True),
|
|
1144
1165
|
'a11y_snapshot': ('A11y snapshot + tab order', True, True),
|
|
1145
1166
|
'a11y_locate': ('Locate element by accessible name', True, True),
|
|
1146
1167
|
'a11y_patches': ('Sealed patch-set (sha-keyed)', True, False),
|
|
@@ -1171,6 +1192,10 @@ _ANN = {
|
|
|
1171
1192
|
'a11y_wcag3_preview': ('WCAG 3 draft preview (no score)', True, False),
|
|
1172
1193
|
'a11y_route': ('Tool router (goal or page to steps)', True, True),
|
|
1173
1194
|
'a11y_scope': ('Applicability scope (semi-automatic)', True, False),
|
|
1195
|
+
# (5ª pasada) el scroll declaraba readOnlyHint=true mientras clicaba por
|
|
1196
|
+
# subcadena; ahora pasivo por defecto y la prueba activa exige control
|
|
1197
|
+
# explícito — la anotación dice la verdad: PUEDE actuar cuando se le pide
|
|
1198
|
+
'a11y_scroll': ('Infinite-scroll audit (passive by default; interactive=true clicks the exact control you name)', False, True),
|
|
1174
1199
|
}
|
|
1175
1200
|
# TDQS hygiene: annotations must match reality, and every description states
|
|
1176
1201
|
# its return shape and when (not) to use the tool. a11y_ledger.record mutates
|
|
@@ -1376,7 +1401,9 @@ def invoke(name, args):
|
|
|
1376
1401
|
return _content(audit_scroll(args['url'], max_batches=args.get('max_batches', 5),
|
|
1377
1402
|
lang=args.get('lang', 'en'),
|
|
1378
1403
|
auth_state=args.get('auth_state'),
|
|
1379
|
-
browser=args.get('browser', 'auto')
|
|
1404
|
+
browser=args.get('browser', 'auto'),
|
|
1405
|
+
interactive=bool(args.get('interactive', False)),
|
|
1406
|
+
load_more=args.get('load_more')))
|
|
1380
1407
|
except ImportError:
|
|
1381
1408
|
return {'content': [{'type': 'text',
|
|
1382
1409
|
'text': 'Playwright not installed: pip install playwright && playwright install chromium'}],
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Arranque AISLADO del motor interno del paquete npm (@kinti/a11y-toolkit).
|
|
3
|
+
|
|
4
|
+
El lanzador ejecuta `python -I _bootstrap.py <entrada> <args…>`: -I (modo
|
|
5
|
+
aislado) saca el directorio de trabajo de sys.path — un módulo homónimo del
|
|
6
|
+
proyecto auditado (que VS Code invoca desde la raíz del workspace) jamás
|
|
7
|
+
gana a la hora de importarse — e ignora PYTHONPATH. El motor se carga aquí
|
|
8
|
+
por RUTA ABSOLUTA del paquete que viaja dentro de este npm.
|
|
9
|
+
|
|
10
|
+
Entradas: a11y_toolkit.a11y (CLI) y a11y_toolkit.server (servidor MCP).
|
|
11
|
+
"""
|
|
12
|
+
import os
|
|
13
|
+
import sys
|
|
14
|
+
|
|
15
|
+
_ENGINE = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
16
|
+
sys.path.insert(0, _ENGINE)
|
|
17
|
+
|
|
18
|
+
_ENTRY = {
|
|
19
|
+
'a11y_toolkit.a11y': 'main',
|
|
20
|
+
'a11y_toolkit.server': 'main',
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def _run(entry, args):
|
|
25
|
+
if entry not in _ENTRY:
|
|
26
|
+
print(f'unknown entry: {entry}', file=sys.stderr)
|
|
27
|
+
return 2
|
|
28
|
+
module = __import__(entry, fromlist=[_ENTRY[entry]])
|
|
29
|
+
return getattr(module, _ENTRY[entry])(args)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
if __name__ == '__main__':
|
|
33
|
+
if len(sys.argv) < 2:
|
|
34
|
+
print('usage: _bootstrap.py <entry> [args…]', file=sys.stderr)
|
|
35
|
+
sys.exit(2)
|
|
36
|
+
sys.exit(_run(sys.argv[1], sys.argv[2:]))
|
package/lib/runner.cjs
CHANGED
|
@@ -2,18 +2,27 @@
|
|
|
2
2
|
/* Launcher: runs the SELF-CONTAINED engine that ships inside this package
|
|
3
3
|
* (a11y_toolkit/, pure-stdlib Python). No downloads at runtime when a
|
|
4
4
|
* python3 (>=3.9) exists; falls back to a version-pinned uvx when it does
|
|
5
|
-
* not. Zero install, zero network, reproducible by construction.
|
|
5
|
+
* not. Zero install, zero network, reproducible by construction.
|
|
6
|
+
*
|
|
7
|
+
* Hardening (external review 2026-11-22): python used to load the engine
|
|
8
|
+
* from the CALLER's working directory, so a module named like the engine in
|
|
9
|
+
* the audited project would shadow the bundled one and execute with the
|
|
10
|
+
* user's permissions (VS Code launches this from the workspace root). Now
|
|
11
|
+
* Python runs the bundled bootstrap in ISOLATED mode (-I: no CWD on the
|
|
12
|
+
* path, no env-var paths, no user site) and the engine loads by absolute
|
|
13
|
+
* path from this package. */
|
|
6
14
|
const { spawn, spawnSync } = require('child_process');
|
|
7
15
|
const path = require('path');
|
|
8
16
|
|
|
9
17
|
const ENGINE = path.join(__dirname, '..'); // where a11y_toolkit/ lives
|
|
18
|
+
const BOOTSTRAP = path.join(__dirname, '_bootstrap.py'); // isolated entry point
|
|
10
19
|
const PY = process.platform === 'win32' ? 'python' : 'python3';
|
|
11
20
|
const UVX = process.platform === 'win32' ? 'uvx.exe' : 'uvx';
|
|
12
21
|
const VERSION = require('../package.json').version; // pinned fallback, same release
|
|
13
22
|
|
|
14
23
|
function pythonOk() {
|
|
15
24
|
try {
|
|
16
|
-
const r = spawnSync(PY, ['-c', 'import sys; sys.exit(0 if sys.version_info >= (3, 9) else 1)']);
|
|
25
|
+
const r = spawnSync(PY, ['-I', '-c', 'import sys; sys.exit(0 if sys.version_info >= (3, 9) else 1)']);
|
|
17
26
|
return r.status === 0;
|
|
18
27
|
} catch { return false; }
|
|
19
28
|
}
|
|
@@ -21,8 +30,7 @@ function pythonOk() {
|
|
|
21
30
|
function run(entry) {
|
|
22
31
|
const args = process.argv.slice(2);
|
|
23
32
|
if (pythonOk()) {
|
|
24
|
-
const child = spawn(PY, ['-
|
|
25
|
-
{ stdio: 'inherit', env: { ...process.env, PYTHONPATH: ENGINE } });
|
|
33
|
+
const child = spawn(PY, ['-I', BOOTSTRAP, entry, ...args], { stdio: 'inherit' });
|
|
26
34
|
child.on('close', (c) => process.exit(c === null ? 1 : c));
|
|
27
35
|
return;
|
|
28
36
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kinti/a11y-toolkit",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.30.0",
|
|
4
4
|
"mcpName": "io.github.kinti/a11y-toolkit",
|
|
5
5
|
"description": "Zero-dependency WCAG 2.2 accessibility engine (37 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",
|