@kinti/a11y-toolkit 5.21.0 → 5.22.1

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.
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- /* MCP server launcher: starts the a11y-toolkit MCP server (stdio). */
3
- require('../lib/runner.cjs').run('a11y-toolkit-mcp');
2
+ /* MCP server launcher (self-contained engine, stdio). */
3
+ require('../lib/runner.cjs').run('a11y_toolkit.server');
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- /* CLI launcher: a11y-toolkit <cli args> -> a11ytoolkit <args> */
3
- require('../lib/runner.cjs').run('a11ytoolkit');
2
+ /* CLI launcher (self-contained engine). */
3
+ require('../lib/runner.cjs').run('a11y_toolkit.a11y');
package/lib/runner.cjs CHANGED
@@ -1,36 +1,44 @@
1
1
  #!/usr/bin/env node
2
- /* Shared launcher: runs the a11y-toolkit engine through uv (uvx).
3
- * The engine is Python (stdlib-only); this wrapper only opens the Node
4
- * door. If uv is missing, we say exactly how to get it — no cryptic
5
- * spawn errors. */
6
- const { spawn } = require('child_process');
2
+ /* Launcher: runs the SELF-CONTAINED engine that ships inside this package
3
+ * (a11y_toolkit/, pure-stdlib Python). No downloads at runtime when a
4
+ * python3 (>=3.9) exists; falls back to a version-pinned uvx when it does
5
+ * not. Zero install, zero network, reproducible by construction. */
6
+ const { spawn, spawnSync } = require('child_process');
7
+ const path = require('path');
7
8
 
9
+ const ENGINE = path.join(__dirname, '..'); // where a11y_toolkit/ lives
10
+ const PY = process.platform === 'win32' ? 'python' : 'python3';
8
11
  const UVX = process.platform === 'win32' ? 'uvx.exe' : 'uvx';
9
- // Pin de versión: el launcher SIEMPRE ejecuta la versión del motor con la
10
- // que se publicó (la de este package.json, que versionar bumbea con cada
11
- // release). Reproducible y auditable: nada de "descarga la última" en
12
- // tiempo de ejecución.
13
- const VERSION = require('../package.json').version;
12
+ const VERSION = require('../package.json').version; // pinned fallback, same release
13
+
14
+ function pythonOk() {
15
+ try {
16
+ const r = spawnSync(PY, ['-c', 'import sys; sys.exit(0 if sys.version_info >= (3, 9) else 1)']);
17
+ return r.status === 0;
18
+ } catch { return false; }
19
+ }
14
20
 
15
21
  function run(entry) {
16
- const args = ['--from', `a11y-toolkit==${VERSION}`, entry, ...process.argv.slice(2)];
17
- const child = spawn(UVX, args, { stdio: 'inherit' });
22
+ const args = process.argv.slice(2);
23
+ if (pythonOk()) {
24
+ const child = spawn(PY, ['-m', entry, ...args],
25
+ { stdio: 'inherit', env: { ...process.env, PYTHONPATH: ENGINE } });
26
+ child.on('close', (c) => process.exit(c === null ? 1 : c));
27
+ return;
28
+ }
29
+ const SCRIPTS = { 'a11y_toolkit.a11y': 'a11ytoolkit', 'a11y_toolkit.server': 'a11y-toolkit-mcp' };
30
+ const child = spawn(UVX, ['--from', `a11y-toolkit==${VERSION}`, SCRIPTS[entry] || entry], { stdio: 'inherit' });
18
31
  child.on('error', (e) => {
19
32
  if (e.code === 'ENOENT') {
20
- console.error('a11y-toolkit: "uvx" (uv) is not installed.');
21
- console.error('');
22
- console.error('The engine is Python; this launcher runs it via uv. Install uv (one line):');
23
- console.error(' macOS/Linux: curl -LsSf https://astral.sh/uv/install.sh | sh');
24
- console.error(' macOS (brew): brew install uv');
25
- console.error(' Windows (PowerShell): powershell -c "irm https://astral.sh/uv/install.ps1 | iex"');
26
- console.error(' or: pip install uv');
27
- console.error('');
28
- console.error('Then run this command again. https://github.com/kinti/a11y-toolkit');
33
+ console.error('a11y-toolkit: needs python3 (>=3.9) or uv.');
34
+ console.error(' uv (one line): curl -LsSf https://astral.sh/uv/install.sh | sh');
35
+ console.error(' or python3: https://www.python.org/downloads/');
36
+ console.error('https://github.com/kinti/a11y-toolkit');
29
37
  process.exit(1);
30
38
  }
31
39
  throw e;
32
40
  });
33
- child.on('close', (code) => process.exit(code === null ? 1 : code));
41
+ child.on('close', (c) => process.exit(c === null ? 1 : c));
34
42
  }
35
43
 
36
44
  module.exports = { run };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kinti/a11y-toolkit",
3
- "version": "5.21.0",
3
+ "version": "5.22.1",
4
4
  "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. Node launcher; the engine itself is Python via uv.",
5
5
  "license": "MIT",
6
6
  "repository": {