ultra11y 5.56.2 → 5.57.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.
@@ -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.56.2
6
+ version: 5.57.0
7
7
  ---
8
8
 
9
9
  # review-a11y — accessibility review of changed code
@@ -6,7 +6,7 @@ import { join as join55, relative as relative7, resolve as resolve18, sep as sep
6
6
  import { fileURLToPath as fileURLToPath6, pathToFileURL as pathToFileURL3 } from "url";
7
7
 
8
8
  // src/types.ts
9
- var VERSION = "5.56.2";
9
+ var VERSION = "5.57.0";
10
10
  var SCHEMA_VERSION = 2;
11
11
  function isAdjudicated(by) {
12
12
  return by === "agent" || by === "human";
@@ -72291,61 +72291,129 @@ function codexHooksEnabled(codexDir) {
72291
72291
  }
72292
72292
 
72293
72293
  // src/install/opencode.ts
72294
+ import { spawnSync as spawnSync2 } from "child_process";
72294
72295
  import { existsSync as existsSync36, readFileSync as readFileSync30, rmSync as rmSync8 } from "fs";
72295
72296
  import { join as join46 } from "path";
72296
72297
  var OPENCODE_MARKER = "ULTRA11Y_OPENCODE_PLUGIN";
72297
- function pluginTarget(configDir) {
72298
- return join46(configDir, "plugin", "ultra11y.js");
72298
+ var PLUGIN_DIRS = ["plugin", "plugins"];
72299
+ function dirFor(major) {
72300
+ return major === 2 ? "plugins" : "plugin";
72299
72301
  }
72300
- function installOpencode({ configDir, pluginSource, skillsSource, enginePath }) {
72301
- const target = pluginTarget(configDir);
72302
- if (existsSync36(target) && !readFileSync30(target, "utf8").includes(OPENCODE_MARKER)) {
72302
+ function opencodePinKey(major) {
72303
+ return major === 2 ? "plugins" : "plugin";
72304
+ }
72305
+ var pluginFile = (configDir, dir) => join46(configDir, dir, "ultra11y.js");
72306
+ var ours = (path) => existsSync36(path) && readFileSync30(path, "utf8").includes(OPENCODE_MARKER);
72307
+ function parseOpencodeVersion(text) {
72308
+ const m = /\bv?(\d+)\.\d+\.\d+/.exec(text);
72309
+ if (!m) return null;
72310
+ const major = Number(m[1]);
72311
+ if (major === 1) return 1;
72312
+ return major >= 2 ? 2 : null;
72313
+ }
72314
+ var runOpencodeVersion = () => {
72315
+ const r = spawnSync2("opencode", ["--version"], {
72316
+ encoding: "utf8",
72317
+ timeout: 1e4,
72318
+ stdio: ["ignore", "pipe", "pipe"],
72319
+ // npm's global shim on Windows is opencode.cmd, which only a shell resolves.
72320
+ shell: process.platform === "win32"
72321
+ });
72322
+ return { status: r.status, stdout: r.stdout ?? "", error: r.error };
72323
+ };
72324
+ function detectOpencodeMajor(run2 = runOpencodeVersion) {
72325
+ try {
72326
+ const r = run2();
72327
+ if (r.error || r.status !== 0) return null;
72328
+ return parseOpencodeVersion(r.stdout);
72329
+ } catch {
72330
+ return null;
72331
+ }
72332
+ }
72333
+ function parseOpencodeMajorFlag(value) {
72334
+ if (value === void 0) return {};
72335
+ const v = typeof value === "string" ? value.trim().replace(/^v/i, "") : "";
72336
+ if (v === "1" || v === "2") return { major: Number(v) };
72337
+ return { error: `--opencode-version takes 1 or 2 (got ${typeof value === "string" ? JSON.stringify(value) : "no value"}).` };
72338
+ }
72339
+ function isUltra11yPin(entry2) {
72340
+ const spec = typeof entry2 === "string" ? entry2 : Array.isArray(entry2) ? entry2[0] : entry2?.package;
72341
+ return typeof spec === "string" && /^ultra11y(@|$)/.test(spec);
72342
+ }
72343
+ function pinnedKeys(configDir) {
72344
+ try {
72345
+ const cfg = JSON.parse(readFileSync30(join46(configDir, "opencode.json"), "utf8"));
72346
+ return ["plugin", "plugins"].filter((k) => Array.isArray(cfg?.[k]) && cfg[k].some(isUltra11yPin));
72347
+ } catch {
72348
+ return [];
72349
+ }
72350
+ }
72351
+ function installOpencode({ configDir, pluginSource, skillsSource, enginePath, major = null }) {
72352
+ const dir = dirFor(major);
72353
+ const target = pluginFile(configDir, dir);
72354
+ if (existsSync36(target) && !ours(target)) {
72303
72355
  throw new Error(`refusing to overwrite ${target}: it is not a file ultra11y wrote. Remove it manually if you want the plugin here.`);
72304
72356
  }
72305
72357
  const reports = [writeTextWithBackup(target, readFileSync30(pluginSource, "utf8"))];
72358
+ const guidance = [];
72306
72359
  if (enginePath && existsSync36(enginePath)) {
72307
- reports.push(writeTextWithBackup(join46(configDir, "plugin", "ultra11y.mjs"), readFileSync30(enginePath, "utf8")));
72360
+ reports.push(writeTextWithBackup(join46(configDir, dir, "ultra11y.mjs"), readFileSync30(enginePath, "utf8")));
72308
72361
  }
72309
72362
  if (skillsSource) reports.push(...copySkillsInto(skillsSource, join46(configDir, "skills")));
72310
- return {
72311
- reports,
72312
- guidance: [
72313
- "opencode: restart the session \u2014 plugins load at startup.",
72314
- 'opencode: the alternative is an npm pin \u2014 add "plugin": ["ultra11y@latest"] to ~/.config/opencode/opencode.json and drop this file.',
72315
- "opencode: the gate surfaces as a blocked tool call whose error message carries the findings (OpenCode has no permission-decision channel)."
72316
- ]
72317
- };
72363
+ for (const other of PLUGIN_DIRS) {
72364
+ if (other === dir) continue;
72365
+ const stale = pluginFile(configDir, other);
72366
+ if (!ours(stale)) continue;
72367
+ rmSync8(stale, { force: true });
72368
+ rmSync8(join46(configDir, other, "ultra11y.mjs"), { force: true });
72369
+ guidance.push(`opencode: moved the plugin from ${other}/ to ${dir}/ \u2014 it is loaded from one place only.`);
72370
+ }
72371
+ const key2 = opencodePinKey(major);
72372
+ guidance.push(
72373
+ major === null ? "opencode: no `opencode` on PATH to ask its version \u2014 wired plugin/, which OpenCode 1 and 2 both read (pass --opencode-version 1|2 to choose)." : `opencode: wired for OpenCode ${major}.`,
72374
+ "opencode: restart the session \u2014 plugins load at startup.",
72375
+ `opencode: the alternative is an npm pin \u2014 add "${key2}": ["ultra11y@latest"] to ${join46(configDir, "opencode.json")} and drop this file.`,
72376
+ "opencode: the gate surfaces as a blocked tool call whose error message carries the findings (OpenCode has no permission-decision channel)."
72377
+ );
72378
+ const pins = pinnedKeys(configDir);
72379
+ if (pins.length > 0) {
72380
+ guidance.push(`opencode: opencode.json also pins ultra11y under "${pins.join('", "')}" \u2014 remove the pin or this file, or the gate runs twice.`);
72381
+ }
72382
+ return { reports, guidance };
72318
72383
  }
72319
72384
  function uninstallOpencode({ configDir }) {
72320
72385
  const reports = [];
72321
- const target = pluginTarget(configDir);
72322
- if (existsSync36(target) && readFileSync30(target, "utf8").includes(OPENCODE_MARKER)) {
72386
+ for (const dir of PLUGIN_DIRS) {
72387
+ const target = pluginFile(configDir, dir);
72388
+ if (!ours(target)) continue;
72323
72389
  rmSync8(target, { force: true });
72324
- rmSync8(join46(configDir, "plugin", "ultra11y.mjs"), { force: true });
72390
+ rmSync8(join46(configDir, dir, "ultra11y.mjs"), { force: true });
72325
72391
  reports.push({ path: target, changed: true });
72326
72392
  }
72327
72393
  const configPath = join46(configDir, "opencode.json");
72328
72394
  if (existsSync36(configPath)) {
72329
72395
  reports.push(
72330
72396
  editJsonFile(configPath, (root) => {
72331
- if (!Array.isArray(root.plugin)) return;
72332
- const kept = root.plugin.filter((p) => !/^ultra11y(@|$)/.test(String(p)));
72333
- if (kept.length > 0) root.plugin = kept;
72334
- else delete root.plugin;
72397
+ for (const key2 of ["plugin", "plugins"]) {
72398
+ if (!Array.isArray(root[key2])) continue;
72399
+ const kept = root[key2].filter((p) => !isUltra11yPin(p));
72400
+ if (kept.length > 0) root[key2] = kept;
72401
+ else delete root[key2];
72402
+ }
72335
72403
  })
72336
72404
  );
72337
72405
  }
72338
72406
  return { reports, guidance: [] };
72339
72407
  }
72408
+ function opencodePluginPath(configDir) {
72409
+ for (const dir of PLUGIN_DIRS) if (ours(pluginFile(configDir, dir))) return pluginFile(configDir, dir);
72410
+ return null;
72411
+ }
72412
+ function opencodePluginTarget(configDir, major) {
72413
+ return pluginFile(configDir, dirFor(major));
72414
+ }
72340
72415
  function opencodeWired(configDir) {
72341
- const target = pluginTarget(configDir);
72342
- if (existsSync36(target) && readFileSync30(target, "utf8").includes(OPENCODE_MARKER)) return true;
72343
- try {
72344
- const cfg = JSON.parse(readFileSync30(join46(configDir, "opencode.json"), "utf8"));
72345
- return Array.isArray(cfg.plugin) && cfg.plugin.some((p) => /^ultra11y(@|$)/.test(String(p)));
72346
- } catch {
72347
- return false;
72348
- }
72416
+ return opencodePluginPath(configDir) !== null || pinnedKeys(configDir).length > 0;
72349
72417
  }
72350
72418
 
72351
72419
  // src/install/index.ts
@@ -72399,17 +72467,19 @@ function installForTargets(opts) {
72399
72467
  break;
72400
72468
  }
72401
72469
  const configDir = opts.project === true ? join47(cwd, ".opencode") : opencodeConfigDir();
72470
+ const major = opts.opencodeVersion ?? detectOpencodeMajor();
72402
72471
  if (!opts.dryRun) {
72403
72472
  const engine = existsSync37(pinnedEnginePath()) ? pinnedEnginePath() : join47(packageRoot() ?? "", "scripts", "ultra11y.mjs");
72404
72473
  const out3 = installOpencode({
72405
72474
  configDir,
72406
72475
  pluginSource: source,
72407
72476
  skillsSource: opts.skills === false ? null : bundledSkillsDir(),
72408
- enginePath: existsSync37(engine) ? engine : null
72477
+ enginePath: existsSync37(engine) ? engine : null,
72478
+ major
72409
72479
  });
72410
72480
  r.reports.push(...out3.reports);
72411
72481
  r.guidance.push(...out3.guidance);
72412
- } else r.reports.push({ path: join47(configDir, "plugin", "ultra11y.js"), changed: false });
72482
+ } else r.reports.push({ path: opencodePluginTarget(configDir, major), changed: false });
72413
72483
  break;
72414
72484
  }
72415
72485
  case "agents-md": {
@@ -72479,7 +72549,7 @@ function statusReport(opts = {}) {
72479
72549
  // A wired hook behind a disabled feature flag never fires and looks fine. Say so.
72480
72550
  note: codexOn && !codexHooksEnabled(codexDir) ? "WIRED BUT INERT: `[features] hooks = true` is not set in config.toml" : void 0
72481
72551
  },
72482
- { target: "opencode", wired: opencodeWired(ocDir), path: join47(ocDir, "plugin", "ultra11y.js") },
72552
+ { target: "opencode", wired: opencodeWired(ocDir), path: opencodePluginPath(ocDir) ?? opencodePluginTarget(ocDir, null) },
72483
72553
  { target: "agents-md", wired: agentsMdWired(root), path: agentsMdPath(root) }
72484
72554
  ];
72485
72555
  }
@@ -78484,7 +78554,7 @@ Usage:
78484
78554
  ultra11y import --from file <report.json> | --from ara <id> [--source <adapter>] [--out <dir>] [--json]
78485
78555
  ultra11y mcp [--transport stdio|http] [--cwd <dir>] [--allow-write] [--port <n>] [--bind <addr>] [--allow-remote] [--allow-origin <o>] [--max-response-bytes <n>]
78486
78556
  ultra11y hook --claude-code|--codex|--opencode (internal: the PreToolUse hook; payload on stdin)
78487
- ultra11y install --claude-code | --codex | --opencode | --agents-md | --all [--project] [--dry-run] [--no-skills]
78557
+ ultra11y install --claude-code | --codex | --opencode | --agents-md | --all [--project] [--dry-run] [--no-skills] [--opencode-version 1|2]
78488
78558
  ultra11y uninstall --claude-code | --codex | --opencode | --agents-md | --all [--project]
78489
78559
  ultra11y status [--json] [--project] [--browser [--cwd <dir>]] (doctor: which agents run the review; --browser asks whether the scan tier resolves here)
78490
78560
  ultra11y dev [--port <n>] [--root <dir>] [--standard <pack>] [--lang auto|en|fr] (dev side-car: live overlay + per-page dashboard)
@@ -78930,6 +79000,9 @@ function isCommand(s) {
78930
79000
  return !!s && COMMANDS.includes(s);
78931
79001
  }
78932
79002
  var VALUE_FLAGS2 = /* @__PURE__ */ new Set([
79003
+ // `install --opencode --opencode-version 1|2`: the OpenCode major to wire for, instead of
79004
+ // asking the `opencode` on PATH.
79005
+ "opencode-version",
78933
79006
  // `judge --refute <VERIFY.todo.json>`: put already-written claims on trial, through the same
78934
79007
  // transport the adjudication pass uses.
78935
79008
  "refute",
@@ -79944,7 +80017,18 @@ function cmdInstall(p) {
79944
80017
  console.log(agentsMdBlock(repoRoot() ?? process.cwd()));
79945
80018
  if (targets.length === 1) return 0;
79946
80019
  }
79947
- const results = installForTargets({ targets, project: p.flags.project === true, dryRun, skills: p.flags["no-skills"] !== true });
80020
+ const oc = parseOpencodeMajorFlag(p.flags["opencode-version"]);
80021
+ if (oc.error) {
80022
+ console.error(`ultra11y install: ${oc.error}`);
80023
+ return 2;
80024
+ }
80025
+ const results = installForTargets({
80026
+ targets,
80027
+ project: p.flags.project === true,
80028
+ dryRun,
80029
+ skills: p.flags["no-skills"] !== true,
80030
+ opencodeVersion: oc.major
80031
+ });
79948
80032
  return reportInstall(results, dryRun ? "would wire" : "wired");
79949
80033
  }
79950
80034
  function cmdUninstall(p) {
@@ -81941,13 +82025,13 @@ function diffAgainstExternal(p, result, scope, standard, lang, file) {
81941
82025
  console.error(`ultra11y pages --diff: the imported audit is keyed by "${ext2.standard}" but --standard is "${standard}".`);
81942
82026
  return 2;
81943
82027
  }
81944
- const ours = /* @__PURE__ */ new Map();
82028
+ const ours2 = /* @__PURE__ */ new Map();
81945
82029
  for (const page of derivePages(result, scope)) {
81946
82030
  const m = /* @__PURE__ */ new Map();
81947
82031
  for (const c2 of pageCriterionRows(result, page, standard, lang)) m.set(c2.id, c2.status);
81948
- ours.set(page.id, m);
82032
+ ours2.set(page.id, m);
81949
82033
  }
81950
- const d = diffSides({ byPage: ours }, sideOfExternal(ext2));
82034
+ const d = diffSides({ byPage: ours2 }, sideOfExternal(ext2));
81951
82035
  if (p.flags.json) {
81952
82036
  console.log(JSON.stringify({ standard, external: ext2.source, ...d }, null, 2));
81953
82037
  return 0;
@@ -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.56.2
6
+ version: 5.57.0
7
7
  ---
8
8
 
9
9
  # ultra11y — audit WCAG 2.2 AA and write accessible markup
@@ -135,7 +135,7 @@ Domain knowledge first, then the tooling. Read the one that matches the question
135
135
  | `references/verify.md` | The `check`/`verify` gates |
136
136
  | `references/false-positives.md` | Where a finding may still be wrong, and how to refute it |
137
137
  | `references/rendered.md` · `references/automation.md` | Auditing produced HTML, captures, hooks and CI |
138
- | `references/harnesses.md` | Where this runs: Claude Code, Codex CLI, OpenCode, and the AGENTS.md fallback |
138
+ | `references/harnesses.md` | Where this runs: Claude Code, Codex CLI, OpenCode 1.x and 2.x, and the AGENTS.md fallback |
139
139
  | `references/orchestrators.md` | Driving the engine from a workflow engine / non-GitHub CI: pinning, the six-step pipeline, exit codes, the ticket set as JSON for any tracker |
140
140
  | `references/ci.md` | `--format sarif\|github`: inline PR annotations, code scanning, job summary |
141
141
  | `references/pages.md` | Page snapshots + the per-page criterion grid (`pages`), and its honesty rules |
@@ -75,20 +75,36 @@ That command uses `codex exec` with an ephemeral, read-only, offline session and
75
75
  config, repository rules and hooks. No API key is required; Codex reuses its ChatGPT login.
76
76
  For Claude CLI use `--runner claude` (`--runner cli` is the legacy alias).
77
77
 
78
- ## OpenCode
78
+ ## OpenCode (1.x and 2.x)
79
79
 
80
80
  ```
81
- ultra11y install --opencode
81
+ ultra11y install --opencode # the major is asked of `opencode --version`
82
+ ultra11y install --opencode --opencode-version 2 # …or stated
82
83
  ```
83
84
 
84
- …or pin it in `~/.config/opencode/opencode.json`: `"plugin": ["ultra11y@latest"]`.
85
+ OpenCode 2 replaced the plugin API, and V1 plugins do not run on it. ultra11y ships **one
86
+ plugin file that both majors load**: OpenCode 2 reads its default export's `{ id, setup }`,
87
+ OpenCode 1 (≥ 1.18.28) calls the `server()` on that same object, and older V1 releases call
88
+ the named `Ultra11yPlugin`. The gate runs once per shell call on every one of them.
89
+
90
+ | | OpenCode 1 | OpenCode 2 |
91
+ |---|---|---|
92
+ | `install --opencode` writes | `~/.config/opencode/plugin/ultra11y.js` | `~/.config/opencode/plugins/ultra11y.js` |
93
+ | …or pin it in `opencode.json` | `"plugin": ["ultra11y@latest"]` | `"plugins": ["ultra11y@latest"]` |
94
+ | the gate hooks | `tool.execute.before` on `bash` | `ctx.tool.hook("execute.before")` on `shell` |
95
+ | the two skills are registered by | `config.skills.paths` | `ctx.skill.transform` |
96
+
97
+ When no `opencode` is on PATH, the installer writes `plugin/`, which both majors read; an
98
+ earlier copy of ours in the other directory is removed so the gate never loads twice. A pin
99
+ in `opencode.json` and the file together would load it twice — the installer says so.
85
100
 
86
101
  The delta: OpenCode has **no permission-decision channel**. Its plugin blocks a tool call by
87
- throwing, so the review arrives as a **failed bash call whose error message carries the
102
+ throwing, so the review arrives as a **failed shell call whose error message carries the
88
103
  findings**. Same content, different envelope — read the error, do not retry blindly.
89
104
 
90
- Skills live under `~/.config/opencode/skills/`; the plugin also registers the bundled
91
- `skills/` directory via `config.skills.paths`.
105
+ The engine runs on the `node` from PATH (OpenCode itself is a Bun binary); with no Node
106
+ there the gate is silent rather than broken. Skills also live under
107
+ `~/.config/opencode/skills/` once `install --opencode` has copied them there.
92
108
 
93
109
  ## Everything else (Cursor, Amp, Zed, Gemini CLI, Windsurf, aider…)
94
110
 
@@ -129,7 +145,7 @@ tool is the blessed path**, not a workaround. Discover what exists by listing
129
145
  |---|---|---|---|---|---|
130
146
  | Claude Code | plugin / `skills add` | yes | `permissionDecision: "deny"` | yes | yes |
131
147
  | Codex CLI | plugin / `skills add` | yes | `permissionDecision: "deny"` | yes | yes |
132
- | OpenCode | plugin / `skills add` | yes | thrown tool error | yes | yes |
148
+ | OpenCode 1.x · 2.x | plugin / `skills add` | yes | thrown tool error | yes | yes |
133
149
  | Cursor, Amp, Zed, Gemini… | AGENTS.md | **no** | — | yes | yes |
134
150
 
135
151
  `ultra11y status` reports which of these are actually wired on this machine — including the
@@ -6,7 +6,7 @@ import { join as join55, relative as relative7, resolve as resolve18, sep as sep
6
6
  import { fileURLToPath as fileURLToPath6, pathToFileURL as pathToFileURL3 } from "url";
7
7
 
8
8
  // src/types.ts
9
- var VERSION = "5.56.2";
9
+ var VERSION = "5.57.0";
10
10
  var SCHEMA_VERSION = 2;
11
11
  function isAdjudicated(by) {
12
12
  return by === "agent" || by === "human";
@@ -72291,61 +72291,129 @@ function codexHooksEnabled(codexDir) {
72291
72291
  }
72292
72292
 
72293
72293
  // src/install/opencode.ts
72294
+ import { spawnSync as spawnSync2 } from "child_process";
72294
72295
  import { existsSync as existsSync36, readFileSync as readFileSync30, rmSync as rmSync8 } from "fs";
72295
72296
  import { join as join46 } from "path";
72296
72297
  var OPENCODE_MARKER = "ULTRA11Y_OPENCODE_PLUGIN";
72297
- function pluginTarget(configDir) {
72298
- return join46(configDir, "plugin", "ultra11y.js");
72298
+ var PLUGIN_DIRS = ["plugin", "plugins"];
72299
+ function dirFor(major) {
72300
+ return major === 2 ? "plugins" : "plugin";
72299
72301
  }
72300
- function installOpencode({ configDir, pluginSource, skillsSource, enginePath }) {
72301
- const target = pluginTarget(configDir);
72302
- if (existsSync36(target) && !readFileSync30(target, "utf8").includes(OPENCODE_MARKER)) {
72302
+ function opencodePinKey(major) {
72303
+ return major === 2 ? "plugins" : "plugin";
72304
+ }
72305
+ var pluginFile = (configDir, dir) => join46(configDir, dir, "ultra11y.js");
72306
+ var ours = (path) => existsSync36(path) && readFileSync30(path, "utf8").includes(OPENCODE_MARKER);
72307
+ function parseOpencodeVersion(text) {
72308
+ const m = /\bv?(\d+)\.\d+\.\d+/.exec(text);
72309
+ if (!m) return null;
72310
+ const major = Number(m[1]);
72311
+ if (major === 1) return 1;
72312
+ return major >= 2 ? 2 : null;
72313
+ }
72314
+ var runOpencodeVersion = () => {
72315
+ const r = spawnSync2("opencode", ["--version"], {
72316
+ encoding: "utf8",
72317
+ timeout: 1e4,
72318
+ stdio: ["ignore", "pipe", "pipe"],
72319
+ // npm's global shim on Windows is opencode.cmd, which only a shell resolves.
72320
+ shell: process.platform === "win32"
72321
+ });
72322
+ return { status: r.status, stdout: r.stdout ?? "", error: r.error };
72323
+ };
72324
+ function detectOpencodeMajor(run2 = runOpencodeVersion) {
72325
+ try {
72326
+ const r = run2();
72327
+ if (r.error || r.status !== 0) return null;
72328
+ return parseOpencodeVersion(r.stdout);
72329
+ } catch {
72330
+ return null;
72331
+ }
72332
+ }
72333
+ function parseOpencodeMajorFlag(value) {
72334
+ if (value === void 0) return {};
72335
+ const v = typeof value === "string" ? value.trim().replace(/^v/i, "") : "";
72336
+ if (v === "1" || v === "2") return { major: Number(v) };
72337
+ return { error: `--opencode-version takes 1 or 2 (got ${typeof value === "string" ? JSON.stringify(value) : "no value"}).` };
72338
+ }
72339
+ function isUltra11yPin(entry2) {
72340
+ const spec = typeof entry2 === "string" ? entry2 : Array.isArray(entry2) ? entry2[0] : entry2?.package;
72341
+ return typeof spec === "string" && /^ultra11y(@|$)/.test(spec);
72342
+ }
72343
+ function pinnedKeys(configDir) {
72344
+ try {
72345
+ const cfg = JSON.parse(readFileSync30(join46(configDir, "opencode.json"), "utf8"));
72346
+ return ["plugin", "plugins"].filter((k) => Array.isArray(cfg?.[k]) && cfg[k].some(isUltra11yPin));
72347
+ } catch {
72348
+ return [];
72349
+ }
72350
+ }
72351
+ function installOpencode({ configDir, pluginSource, skillsSource, enginePath, major = null }) {
72352
+ const dir = dirFor(major);
72353
+ const target = pluginFile(configDir, dir);
72354
+ if (existsSync36(target) && !ours(target)) {
72303
72355
  throw new Error(`refusing to overwrite ${target}: it is not a file ultra11y wrote. Remove it manually if you want the plugin here.`);
72304
72356
  }
72305
72357
  const reports = [writeTextWithBackup(target, readFileSync30(pluginSource, "utf8"))];
72358
+ const guidance = [];
72306
72359
  if (enginePath && existsSync36(enginePath)) {
72307
- reports.push(writeTextWithBackup(join46(configDir, "plugin", "ultra11y.mjs"), readFileSync30(enginePath, "utf8")));
72360
+ reports.push(writeTextWithBackup(join46(configDir, dir, "ultra11y.mjs"), readFileSync30(enginePath, "utf8")));
72308
72361
  }
72309
72362
  if (skillsSource) reports.push(...copySkillsInto(skillsSource, join46(configDir, "skills")));
72310
- return {
72311
- reports,
72312
- guidance: [
72313
- "opencode: restart the session \u2014 plugins load at startup.",
72314
- 'opencode: the alternative is an npm pin \u2014 add "plugin": ["ultra11y@latest"] to ~/.config/opencode/opencode.json and drop this file.',
72315
- "opencode: the gate surfaces as a blocked tool call whose error message carries the findings (OpenCode has no permission-decision channel)."
72316
- ]
72317
- };
72363
+ for (const other of PLUGIN_DIRS) {
72364
+ if (other === dir) continue;
72365
+ const stale = pluginFile(configDir, other);
72366
+ if (!ours(stale)) continue;
72367
+ rmSync8(stale, { force: true });
72368
+ rmSync8(join46(configDir, other, "ultra11y.mjs"), { force: true });
72369
+ guidance.push(`opencode: moved the plugin from ${other}/ to ${dir}/ \u2014 it is loaded from one place only.`);
72370
+ }
72371
+ const key2 = opencodePinKey(major);
72372
+ guidance.push(
72373
+ major === null ? "opencode: no `opencode` on PATH to ask its version \u2014 wired plugin/, which OpenCode 1 and 2 both read (pass --opencode-version 1|2 to choose)." : `opencode: wired for OpenCode ${major}.`,
72374
+ "opencode: restart the session \u2014 plugins load at startup.",
72375
+ `opencode: the alternative is an npm pin \u2014 add "${key2}": ["ultra11y@latest"] to ${join46(configDir, "opencode.json")} and drop this file.`,
72376
+ "opencode: the gate surfaces as a blocked tool call whose error message carries the findings (OpenCode has no permission-decision channel)."
72377
+ );
72378
+ const pins = pinnedKeys(configDir);
72379
+ if (pins.length > 0) {
72380
+ guidance.push(`opencode: opencode.json also pins ultra11y under "${pins.join('", "')}" \u2014 remove the pin or this file, or the gate runs twice.`);
72381
+ }
72382
+ return { reports, guidance };
72318
72383
  }
72319
72384
  function uninstallOpencode({ configDir }) {
72320
72385
  const reports = [];
72321
- const target = pluginTarget(configDir);
72322
- if (existsSync36(target) && readFileSync30(target, "utf8").includes(OPENCODE_MARKER)) {
72386
+ for (const dir of PLUGIN_DIRS) {
72387
+ const target = pluginFile(configDir, dir);
72388
+ if (!ours(target)) continue;
72323
72389
  rmSync8(target, { force: true });
72324
- rmSync8(join46(configDir, "plugin", "ultra11y.mjs"), { force: true });
72390
+ rmSync8(join46(configDir, dir, "ultra11y.mjs"), { force: true });
72325
72391
  reports.push({ path: target, changed: true });
72326
72392
  }
72327
72393
  const configPath = join46(configDir, "opencode.json");
72328
72394
  if (existsSync36(configPath)) {
72329
72395
  reports.push(
72330
72396
  editJsonFile(configPath, (root) => {
72331
- if (!Array.isArray(root.plugin)) return;
72332
- const kept = root.plugin.filter((p) => !/^ultra11y(@|$)/.test(String(p)));
72333
- if (kept.length > 0) root.plugin = kept;
72334
- else delete root.plugin;
72397
+ for (const key2 of ["plugin", "plugins"]) {
72398
+ if (!Array.isArray(root[key2])) continue;
72399
+ const kept = root[key2].filter((p) => !isUltra11yPin(p));
72400
+ if (kept.length > 0) root[key2] = kept;
72401
+ else delete root[key2];
72402
+ }
72335
72403
  })
72336
72404
  );
72337
72405
  }
72338
72406
  return { reports, guidance: [] };
72339
72407
  }
72408
+ function opencodePluginPath(configDir) {
72409
+ for (const dir of PLUGIN_DIRS) if (ours(pluginFile(configDir, dir))) return pluginFile(configDir, dir);
72410
+ return null;
72411
+ }
72412
+ function opencodePluginTarget(configDir, major) {
72413
+ return pluginFile(configDir, dirFor(major));
72414
+ }
72340
72415
  function opencodeWired(configDir) {
72341
- const target = pluginTarget(configDir);
72342
- if (existsSync36(target) && readFileSync30(target, "utf8").includes(OPENCODE_MARKER)) return true;
72343
- try {
72344
- const cfg = JSON.parse(readFileSync30(join46(configDir, "opencode.json"), "utf8"));
72345
- return Array.isArray(cfg.plugin) && cfg.plugin.some((p) => /^ultra11y(@|$)/.test(String(p)));
72346
- } catch {
72347
- return false;
72348
- }
72416
+ return opencodePluginPath(configDir) !== null || pinnedKeys(configDir).length > 0;
72349
72417
  }
72350
72418
 
72351
72419
  // src/install/index.ts
@@ -72399,17 +72467,19 @@ function installForTargets(opts) {
72399
72467
  break;
72400
72468
  }
72401
72469
  const configDir = opts.project === true ? join47(cwd, ".opencode") : opencodeConfigDir();
72470
+ const major = opts.opencodeVersion ?? detectOpencodeMajor();
72402
72471
  if (!opts.dryRun) {
72403
72472
  const engine = existsSync37(pinnedEnginePath()) ? pinnedEnginePath() : join47(packageRoot() ?? "", "scripts", "ultra11y.mjs");
72404
72473
  const out3 = installOpencode({
72405
72474
  configDir,
72406
72475
  pluginSource: source,
72407
72476
  skillsSource: opts.skills === false ? null : bundledSkillsDir(),
72408
- enginePath: existsSync37(engine) ? engine : null
72477
+ enginePath: existsSync37(engine) ? engine : null,
72478
+ major
72409
72479
  });
72410
72480
  r.reports.push(...out3.reports);
72411
72481
  r.guidance.push(...out3.guidance);
72412
- } else r.reports.push({ path: join47(configDir, "plugin", "ultra11y.js"), changed: false });
72482
+ } else r.reports.push({ path: opencodePluginTarget(configDir, major), changed: false });
72413
72483
  break;
72414
72484
  }
72415
72485
  case "agents-md": {
@@ -72479,7 +72549,7 @@ function statusReport(opts = {}) {
72479
72549
  // A wired hook behind a disabled feature flag never fires and looks fine. Say so.
72480
72550
  note: codexOn && !codexHooksEnabled(codexDir) ? "WIRED BUT INERT: `[features] hooks = true` is not set in config.toml" : void 0
72481
72551
  },
72482
- { target: "opencode", wired: opencodeWired(ocDir), path: join47(ocDir, "plugin", "ultra11y.js") },
72552
+ { target: "opencode", wired: opencodeWired(ocDir), path: opencodePluginPath(ocDir) ?? opencodePluginTarget(ocDir, null) },
72483
72553
  { target: "agents-md", wired: agentsMdWired(root), path: agentsMdPath(root) }
72484
72554
  ];
72485
72555
  }
@@ -78484,7 +78554,7 @@ Usage:
78484
78554
  ultra11y import --from file <report.json> | --from ara <id> [--source <adapter>] [--out <dir>] [--json]
78485
78555
  ultra11y mcp [--transport stdio|http] [--cwd <dir>] [--allow-write] [--port <n>] [--bind <addr>] [--allow-remote] [--allow-origin <o>] [--max-response-bytes <n>]
78486
78556
  ultra11y hook --claude-code|--codex|--opencode (internal: the PreToolUse hook; payload on stdin)
78487
- ultra11y install --claude-code | --codex | --opencode | --agents-md | --all [--project] [--dry-run] [--no-skills]
78557
+ ultra11y install --claude-code | --codex | --opencode | --agents-md | --all [--project] [--dry-run] [--no-skills] [--opencode-version 1|2]
78488
78558
  ultra11y uninstall --claude-code | --codex | --opencode | --agents-md | --all [--project]
78489
78559
  ultra11y status [--json] [--project] [--browser [--cwd <dir>]] (doctor: which agents run the review; --browser asks whether the scan tier resolves here)
78490
78560
  ultra11y dev [--port <n>] [--root <dir>] [--standard <pack>] [--lang auto|en|fr] (dev side-car: live overlay + per-page dashboard)
@@ -78930,6 +79000,9 @@ function isCommand(s) {
78930
79000
  return !!s && COMMANDS.includes(s);
78931
79001
  }
78932
79002
  var VALUE_FLAGS2 = /* @__PURE__ */ new Set([
79003
+ // `install --opencode --opencode-version 1|2`: the OpenCode major to wire for, instead of
79004
+ // asking the `opencode` on PATH.
79005
+ "opencode-version",
78933
79006
  // `judge --refute <VERIFY.todo.json>`: put already-written claims on trial, through the same
78934
79007
  // transport the adjudication pass uses.
78935
79008
  "refute",
@@ -79944,7 +80017,18 @@ function cmdInstall(p) {
79944
80017
  console.log(agentsMdBlock(repoRoot() ?? process.cwd()));
79945
80018
  if (targets.length === 1) return 0;
79946
80019
  }
79947
- const results = installForTargets({ targets, project: p.flags.project === true, dryRun, skills: p.flags["no-skills"] !== true });
80020
+ const oc = parseOpencodeMajorFlag(p.flags["opencode-version"]);
80021
+ if (oc.error) {
80022
+ console.error(`ultra11y install: ${oc.error}`);
80023
+ return 2;
80024
+ }
80025
+ const results = installForTargets({
80026
+ targets,
80027
+ project: p.flags.project === true,
80028
+ dryRun,
80029
+ skills: p.flags["no-skills"] !== true,
80030
+ opencodeVersion: oc.major
80031
+ });
79948
80032
  return reportInstall(results, dryRun ? "would wire" : "wired");
79949
80033
  }
79950
80034
  function cmdUninstall(p) {
@@ -81941,13 +82025,13 @@ function diffAgainstExternal(p, result, scope, standard, lang, file) {
81941
82025
  console.error(`ultra11y pages --diff: the imported audit is keyed by "${ext2.standard}" but --standard is "${standard}".`);
81942
82026
  return 2;
81943
82027
  }
81944
- const ours = /* @__PURE__ */ new Map();
82028
+ const ours2 = /* @__PURE__ */ new Map();
81945
82029
  for (const page of derivePages(result, scope)) {
81946
82030
  const m = /* @__PURE__ */ new Map();
81947
82031
  for (const c2 of pageCriterionRows(result, page, standard, lang)) m.set(c2.id, c2.status);
81948
- ours.set(page.id, m);
82032
+ ours2.set(page.id, m);
81949
82033
  }
81950
- const d = diffSides({ byPage: ours }, sideOfExternal(ext2));
82034
+ const d = diffSides({ byPage: ours2 }, sideOfExternal(ext2));
81951
82035
  if (p.flags.json) {
81952
82036
  console.log(JSON.stringify({ standard, external: ext2.source, ...d }, null, 2));
81953
82037
  return 0;
@@ -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.56.2'
30
+ ULTRA11Y_VERSION: '5.57.0'
31
31
  # Batches of 8 amortise the prompt; each accepted verdict is checkpointed before the next
32
32
  # batch, and later passes receive only the residue.
33
33
  ULTRA11Y_GRAIN: batch