opencode-agent-orchestration-kit 1.0.27 → 1.0.29

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.
Files changed (39) hide show
  1. package/README.md +27 -14
  2. package/compatibility.json +19 -0
  3. package/docker/open-design/Dockerfile +2 -2
  4. package/docs/compatibility.md +104 -0
  5. package/docs/docker-open-design.md +8 -0
  6. package/docs/installation.md +13 -3
  7. package/docs/quickstart.md +6 -3
  8. package/docs/releases/v1.0.28.md +71 -0
  9. package/docs/releases/v1.0.29.md +78 -0
  10. package/docs/security.md +9 -0
  11. package/docs/superpowers/plans/2026-07-21-compatibility-matrix.md +1286 -0
  12. package/docs/superpowers/specs/2026-07-21-compatibility-matrix-design.md +452 -0
  13. package/docs/superpowers.md +11 -4
  14. package/docs/supply-chain.md +145 -0
  15. package/docs/workflows.md +15 -0
  16. package/opencode/opencode.json +1 -1
  17. package/opencode/package-lock.json +96 -96
  18. package/opencode/package.json +5 -1
  19. package/package.json +29 -3
  20. package/scripts/check-compatibility.mjs +676 -0
  21. package/scripts/check-compatibility.test.mjs +1467 -0
  22. package/scripts/check-supply-chain.mjs +635 -0
  23. package/scripts/check-supply-chain.test.mjs +944 -0
  24. package/scripts/check.sh +15 -5
  25. package/scripts/install-smoke.sh +1 -1
  26. package/scripts/opencode-compat-smoke.sh +264 -0
  27. package/scripts/package-smoke.mjs +357 -0
  28. package/scripts/package-smoke.sh +5 -0
  29. package/scripts/package-smoke.test.mjs +256 -0
  30. package/scripts/version.mjs +18 -5
  31. package/scripts/version.test.mjs +53 -3
  32. package/supply-chain.json +34 -0
  33. package/.github/CODEOWNERS +0 -1
  34. package/.github/ISSUE_TEMPLATE/bug_report.yml +0 -65
  35. package/.github/ISSUE_TEMPLATE/config.yml +0 -11
  36. package/.github/ISSUE_TEMPLATE/documentation.yml +0 -22
  37. package/.github/ISSUE_TEMPLATE/feature_request.yml +0 -43
  38. package/.github/PULL_REQUEST_TEMPLATE.md +0 -25
  39. package/.github/workflows/check.yml +0 -47
@@ -0,0 +1,1467 @@
1
+ import assert from "node:assert/strict";
2
+ import fs from "node:fs";
3
+ import os from "node:os";
4
+ import path from "node:path";
5
+ import test from "node:test";
6
+ import { spawnSync } from "node:child_process";
7
+ import { fileURLToPath } from "node:url";
8
+
9
+ import { checkCompatibility } from "./check-compatibility.mjs";
10
+
11
+ const REPOSITORY_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
12
+
13
+ const VALID_COMPATIBILITY = {
14
+ schema_version: 1,
15
+ node: {
16
+ engines: "^22.9.0 || ^24.0.0",
17
+ blocking_majors: [22, 24],
18
+ canary_major: 26,
19
+ },
20
+ opencode: {
21
+ supported_range: ">=1.14.41 <2.0.0",
22
+ minimum_tested: "1.14.41",
23
+ stable_tested: "1.18.4",
24
+ canary: "latest",
25
+ },
26
+ sdk: {
27
+ opencode_plugin: "1.14.41",
28
+ opentui_core: "0.2.5",
29
+ opentui_solid: "0.2.5",
30
+ },
31
+ };
32
+
33
+ const REVISED_COMPATIBILITY = {
34
+ schema_version: 1,
35
+ node: {
36
+ engines: "^22.10.0 || ^25.0.0",
37
+ blocking_majors: [22, 25],
38
+ canary_major: 27,
39
+ },
40
+ opencode: {
41
+ supported_range: ">=1.15.0 <2.0.0",
42
+ minimum_tested: "1.15.0",
43
+ stable_tested: "1.19.0",
44
+ canary: "latest",
45
+ },
46
+ sdk: {
47
+ opencode_plugin: "1.15.0",
48
+ opentui_core: "0.3.0",
49
+ opentui_solid: "0.3.0",
50
+ },
51
+ };
52
+
53
+ const ROOT_PACKAGE = {
54
+ name: "opencode-agent-orchestration-kit",
55
+ engines: { node: VALID_COMPATIBILITY.node.engines },
56
+ scripts: {
57
+ "check:supply-chain": "node scripts/check-supply-chain.mjs",
58
+ "dependency-audit": "npm --prefix opencode audit --omit=dev --audit-level=low",
59
+ "dependency-signature-audit": "npm --prefix opencode audit signatures",
60
+ "installation-smoke": "bash scripts/install-smoke.sh",
61
+ "package-smoke": "bash scripts/package-smoke.sh",
62
+ "check:release": "npm --prefix opencode ci --ignore-scripts && npm run check && npm run typecheck && npm run dependency-audit && npm run dependency-signature-audit && npm run installation-smoke && npm run package-smoke",
63
+ },
64
+ };
65
+
66
+ const PACKAGED_PACKAGE = {
67
+ engines: { node: VALID_COMPATIBILITY.node.engines },
68
+ dependencies: {
69
+ "@opencode-ai/plugin": VALID_COMPATIBILITY.sdk.opencode_plugin,
70
+ "@opentui/core": VALID_COMPATIBILITY.sdk.opentui_core,
71
+ "@opentui/solid": VALID_COMPATIBILITY.sdk.opentui_solid,
72
+ },
73
+ };
74
+
75
+ const PACKAGED_LOCK = {
76
+ lockfileVersion: 3,
77
+ packages: {
78
+ "": {
79
+ engines: { node: VALID_COMPATIBILITY.node.engines },
80
+ dependencies: { ...PACKAGED_PACKAGE.dependencies },
81
+ },
82
+ },
83
+ };
84
+
85
+ const COMPATIBILITY_MATRIX = `# Compatibility
86
+
87
+ Canonical Node engine: \`${VALID_COMPATIBILITY.node.engines}\`.
88
+
89
+ <!-- compatibility-matrix:start -->
90
+ | Surface | Status | Contract |
91
+ |---|---|---|
92
+ | Node.js 22 | supported | 22.9.0 or newer within major 22; blocking CI |
93
+ | Node.js 24 | supported | major 24; blocking CI |
94
+ | Node.js 26 | experimental | non-blocking canary only |
95
+ | Node.js 20 and EOL/odd lines | unsupported | no release guarantee |
96
+ | OpenCode 1.14.41 | tested | minimum boundary in the blocking core smoke |
97
+ | OpenCode 1.18.4 | tested | pinned stable boundary in the blocking core smoke |
98
+ | OpenCode >=1.14.41 <2.0.0 | supported | boundary-tested compatibility promise |
99
+ | OpenCode <1.14.41 or >=2.0.0 | unsupported | requires a reviewed policy change |
100
+ | \`@opencode-ai/plugin\` 1.14.41 | tested | exact pin with install, import, and typecheck evidence |
101
+ | OpenTUI core/solid 0.2.5 | tested | exact pins with install, import, and typecheck evidence |
102
+ | Ubuntu GitHub runner | tested | blocking Node 22 and 24 jobs |
103
+ | macOS GitHub runner | tested | blocking Node 24 job; runner details recorded |
104
+ | Other mainstream Linux/macOS environments | supported | Bash, Node, and OpenCode must support the host |
105
+ | WSL2 | experimental | recommended upstream path, no kit-owned runner |
106
+ | Native Windows | unsupported | Bash lifecycle wrappers have no native contract |
107
+ | Token usage plugin | experimental | compile/import is tested; runtime session-tree behavior is not stable API evidence |
108
+ | Open Design Docker adapter | experimental | optional pinned image inputs, no blocking integration smoke |
109
+ | Superpowers | experimental | optional upstream Git plugin, not part of core smoke |
110
+ | Impeccable | experimental | optional externally installed skill |
111
+ <!-- compatibility-matrix:end -->
112
+ `;
113
+
114
+ const README = "See [compatibility details](docs/compatibility.md).\n";
115
+ const INSTALLATION = `- Node.js \`${VALID_COMPATIBILITY.node.engines}\` and npm\n`;
116
+ const PROVIDER_SECRET = ["OPEN", "AI_API_KEY"].join("");
117
+
118
+ const OPENCODE_BOUNDARY_JOB = `
119
+ # opencode-boundaries:start
120
+ opencode-compatibility:
121
+ runs-on: ubuntu-latest
122
+ strategy:
123
+ fail-fast: false
124
+ matrix:
125
+ include:
126
+ - mode: core
127
+ opencode: "1.14.41"
128
+ - mode: core
129
+ opencode: "1.18.4"
130
+ - mode: default
131
+ opencode: "1.18.4"
132
+ steps:
133
+ - name: Checkout
134
+ uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
135
+
136
+ - name: Setup Node
137
+ uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
138
+ with:
139
+ node-version: 24
140
+
141
+ - name: Smoke OpenCode boundary
142
+ run: bash scripts/opencode-compat-smoke.sh "\${{ matrix.mode }}" "\${{ matrix.opencode }}"
143
+ # opencode-boundaries:end
144
+ `;
145
+
146
+ const VALID_WORKFLOW = `name: Check
147
+
148
+ on:
149
+ pull_request:
150
+ push:
151
+ branches:
152
+ - master
153
+ tags:
154
+ - "v*"
155
+
156
+ permissions:
157
+ contents: read
158
+
159
+ jobs:
160
+ check:
161
+ # compatibility-blocking:start
162
+ strategy:
163
+ fail-fast: false
164
+ matrix:
165
+ include:
166
+ - os: ubuntu-latest
167
+ node: 22
168
+ canonical: false
169
+ - os: ubuntu-latest
170
+ node: 24
171
+ canonical: true
172
+ - os: macos-latest
173
+ node: 24
174
+ canonical: false
175
+ # compatibility-blocking:end
176
+ runs-on: \${{ matrix.os }}
177
+ steps:
178
+ - name: Checkout
179
+ uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
180
+
181
+ - name: Setup Node
182
+ uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
183
+ with:
184
+ node-version: \${{ matrix.node }}
185
+
186
+ - name: Record runner evidence
187
+ run: |
188
+ uname -a || true
189
+ node --version
190
+ npm --version
191
+ node -e 'const p=require("./opencode/package.json"); console.log(JSON.stringify({arch:process.arch,platform:process.platform,plugin:p.dependencies["@opencode-ai/plugin"],opentuiCore:p.dependencies["@opentui/core"],opentuiSolid:p.dependencies["@opentui/solid"]}))'
192
+
193
+ - name: Validate release tag
194
+ if: matrix.canonical && startsWith(github.ref, 'refs/tags/')
195
+ run: node scripts/version.mjs --check-tag "$GITHUB_REF_NAME"
196
+
197
+ - name: Contract check
198
+ run: npm run contract-check
199
+
200
+ - name: Unit and script tests
201
+ run: npm run unit-and-script-tests
202
+
203
+ - name: Install OpenCode tool dependencies
204
+ working-directory: opencode
205
+ run: npm ci --ignore-scripts
206
+
207
+ - name: Audit OpenCode tool dependencies
208
+ if: matrix.canonical
209
+ run: npm run dependency-audit
210
+
211
+ - name: Verify dependency signatures
212
+ if: matrix.canonical
213
+ run: npm run dependency-signature-audit
214
+
215
+ - name: Typecheck TUI token plugin
216
+ run: npm run typecheck
217
+
218
+ - name: Installation smoke
219
+ run: npm run installation-smoke
220
+
221
+ - name: Smoke npm package
222
+ if: matrix.canonical
223
+ run: npm run package-smoke
224
+ ${OPENCODE_BOUNDARY_JOB}`;
225
+
226
+ const VALID_CANARY_WORKFLOW = `name: Compatibility Canary
227
+
228
+ on:
229
+ workflow_dispatch:
230
+ schedule:
231
+ - cron: "17 6 * * 1"
232
+
233
+ permissions:
234
+ contents: read
235
+
236
+ jobs:
237
+ # compatibility-canary:start
238
+ latest:
239
+ runs-on: ubuntu-latest
240
+ steps:
241
+ - name: Checkout
242
+ uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
243
+ with:
244
+ persist-credentials: false
245
+
246
+ - name: Setup Node
247
+ uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
248
+ with:
249
+ node-version: 26
250
+
251
+ - name: Smoke latest OpenCode
252
+ run: bash scripts/opencode-compat-smoke.sh core latest
253
+ # compatibility-canary:end
254
+ `;
255
+
256
+ const SINGLE_JOB_WORKFLOW = `name: Check
257
+ permissions:
258
+ contents: read
259
+ jobs:
260
+ check:
261
+ runs-on: ubuntu-latest
262
+ steps:
263
+ - name: Setup Node
264
+ uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
265
+ with:
266
+ node-version: 24
267
+ - name: Validate release tag
268
+ if: startsWith(github.ref, 'refs/tags/')
269
+ run: node scripts/version.mjs --check-tag "$GITHUB_REF_NAME"
270
+ - name: Contract check
271
+ run: npm run contract-check
272
+ - name: Unit and script tests
273
+ run: npm run unit-and-script-tests
274
+ - name: Install OpenCode tool dependencies
275
+ working-directory: opencode
276
+ run: npm ci --ignore-scripts
277
+ - name: Audit OpenCode tool dependencies
278
+ run: npm run dependency-audit
279
+ - name: Typecheck TUI token plugin
280
+ run: npm run typecheck
281
+ - name: Installation smoke
282
+ run: npm run installation-smoke
283
+ `;
284
+
285
+ function writeJson(root, relative, value) {
286
+ const full = path.join(root, relative);
287
+ fs.mkdirSync(path.dirname(full), { recursive: true });
288
+ fs.writeFileSync(full, `${JSON.stringify(value, null, 2)}\n`);
289
+ }
290
+
291
+ function writeText(root, relative, value) {
292
+ const full = path.join(root, relative);
293
+ fs.mkdirSync(path.dirname(full), { recursive: true });
294
+ fs.writeFileSync(full, value);
295
+ }
296
+
297
+ function makeFixture(t, compatibility = VALID_COMPATIBILITY) {
298
+ const root = fs.mkdtempSync(path.join(os.tmpdir(), "oak-compat-test-"));
299
+ t.after(() => fs.rmSync(root, { recursive: true, force: true }));
300
+ writeJson(root, "compatibility.json", compatibility);
301
+ writeJson(root, "package.json", ROOT_PACKAGE);
302
+ writeJson(root, "opencode/package.json", PACKAGED_PACKAGE);
303
+ writeJson(root, "opencode/package-lock.json", PACKAGED_LOCK);
304
+ writeText(root, "docs/compatibility.md", COMPATIBILITY_MATRIX);
305
+ writeText(root, "README.md", README);
306
+ writeText(root, "docs/installation.md", INSTALLATION);
307
+ writeText(root, ".github/workflows/check.yml", VALID_WORKFLOW);
308
+ writeText(root, ".github/workflows/compatibility-canary.yml", VALID_CANARY_WORKFLOW);
309
+ writeText(root, "scripts/install-smoke.sh", "#!/usr/bin/env bash\nnpm ci --ignore-scripts\n");
310
+ return root;
311
+ }
312
+
313
+ function assertInvalidCompatibility(action, message) {
314
+ assert.throws(action, (error) => {
315
+ assert.equal(error.code, "INVALID_COMPATIBILITY");
316
+ assert.match(error.message, message);
317
+ return true;
318
+ });
319
+ }
320
+
321
+ test("valid canonical compatibility schema is accepted", (t) => {
322
+ const root = makeFixture(t);
323
+ assert.equal(checkCompatibility(root, { surfaces: false }).schema_version, 1);
324
+ });
325
+
326
+ test("a coherent revised compatibility contract is accepted without surfaces", (t) => {
327
+ const root = makeFixture(t, REVISED_COMPATIBILITY);
328
+ assert.deepEqual(checkCompatibility(root, { surfaces: false }), REVISED_COMPATIBILITY);
329
+ });
330
+
331
+ test("unknown compatibility schema versions are rejected", (t) => {
332
+ const root = makeFixture(t, { ...VALID_COMPATIBILITY, schema_version: 2 });
333
+ assert.throws(
334
+ () => checkCompatibility(root, { surfaces: false }),
335
+ /schema_version must be 1/,
336
+ );
337
+ });
338
+
339
+ test("non-canonical OpenCode boundaries are rejected", (t) => {
340
+ const root = makeFixture(t, {
341
+ ...VALID_COMPATIBILITY,
342
+ opencode: { ...VALID_COMPATIBILITY.opencode, minimum_tested: "v1.14.41" },
343
+ });
344
+ assert.throws(
345
+ () => checkCompatibility(root, { surfaces: false }),
346
+ /minimum_tested must use MAJOR.MINOR.PATCH/,
347
+ );
348
+ });
349
+
350
+ test("alternative supported OpenCode range is rejected", (t) => {
351
+ const root = makeFixture(t, {
352
+ ...VALID_COMPATIBILITY,
353
+ opencode: { ...VALID_COMPATIBILITY.opencode, supported_range: ">=1.14.41 <3.0.0" },
354
+ });
355
+ assert.throws(
356
+ () => checkCompatibility(root, { surfaces: false }),
357
+ /supported_range must begin at minimum_tested and end before 2.0.0/,
358
+ );
359
+ });
360
+
361
+ for (const [label, node, message] of [
362
+ ["non-caret engine", { engines: ">=22", blocking_majors: [22], canary_major: 26 }, /node\.engines/],
363
+ ["engine major drift", { engines: "^22.10.0 || ^25.0.0", blocking_majors: [22, 24], canary_major: 27 }, /blocking_majors/],
364
+ ["duplicate blocking major", { engines: "^22.10.0 || ^22.11.0", blocking_majors: [22, 22], canary_major: 27 }, /blocking_majors/],
365
+ ["blocking canary major", { engines: "^22.10.0 || ^25.0.0", blocking_majors: [22, 25], canary_major: 25 }, /canary_major/],
366
+ ]) {
367
+ test(`Node compatibility rejects ${label}`, (t) => {
368
+ const root = makeFixture(t, {
369
+ ...VALID_COMPATIBILITY,
370
+ node,
371
+ });
372
+ assertInvalidCompatibility(
373
+ () => checkCompatibility(root, { surfaces: false }),
374
+ message,
375
+ );
376
+ });
377
+ }
378
+
379
+ test("root Node engine drift names the root package surface", (t) => {
380
+ const root = makeFixture(t);
381
+ writeJson(root, "package.json", {
382
+ ...ROOT_PACKAGE,
383
+ engines: { node: ">=22" },
384
+ });
385
+
386
+ assertInvalidCompatibility(
387
+ () => checkCompatibility(root),
388
+ /package\.json engines\.node must match compatibility\.json node\.engines/,
389
+ );
390
+ });
391
+
392
+ test("packaged Node engine drift names the packaged surface", (t) => {
393
+ const root = makeFixture(t);
394
+ writeJson(root, "opencode/package.json", {
395
+ ...PACKAGED_PACKAGE,
396
+ engines: { node: ">=22" },
397
+ });
398
+
399
+ assertInvalidCompatibility(
400
+ () => checkCompatibility(root),
401
+ /opencode\/package\.json engines\.node must match compatibility\.json node\.engines/,
402
+ );
403
+ });
404
+
405
+ test("packaged SDK plugin pin drift names the plugin dependency surface", (t) => {
406
+ const root = makeFixture(t);
407
+ writeJson(root, "opencode/package.json", {
408
+ ...PACKAGED_PACKAGE,
409
+ dependencies: {
410
+ ...PACKAGED_PACKAGE.dependencies,
411
+ "@opencode-ai/plugin": "1.14.42",
412
+ },
413
+ });
414
+
415
+ assertInvalidCompatibility(
416
+ () => checkCompatibility(root),
417
+ /opencode\/package\.json dependency @opencode-ai\/plugin must match compatibility\.json sdk\.opencode_plugin/,
418
+ );
419
+ });
420
+
421
+ test("packaged OpenTUI core pin drift names the core dependency surface", (t) => {
422
+ const root = makeFixture(t);
423
+ writeJson(root, "opencode/package.json", {
424
+ ...PACKAGED_PACKAGE,
425
+ dependencies: {
426
+ ...PACKAGED_PACKAGE.dependencies,
427
+ "@opentui/core": "0.2.6",
428
+ },
429
+ });
430
+
431
+ assertInvalidCompatibility(
432
+ () => checkCompatibility(root),
433
+ /opencode\/package\.json dependency @opentui\/core must match compatibility\.json sdk\.opentui_core/,
434
+ );
435
+ });
436
+
437
+ test("packaged OpenTUI solid pin drift names the solid dependency surface", (t) => {
438
+ const root = makeFixture(t);
439
+ writeJson(root, "opencode/package.json", {
440
+ ...PACKAGED_PACKAGE,
441
+ dependencies: {
442
+ ...PACKAGED_PACKAGE.dependencies,
443
+ "@opentui/solid": "0.2.6",
444
+ },
445
+ });
446
+
447
+ assertInvalidCompatibility(
448
+ () => checkCompatibility(root),
449
+ /opencode\/package\.json dependency @opentui\/solid must match compatibility\.json sdk\.opentui_solid/,
450
+ );
451
+ });
452
+
453
+ test("lockfile Node engine drift names the lock surface", (t) => {
454
+ const root = makeFixture(t);
455
+ writeJson(root, "opencode/package-lock.json", {
456
+ ...PACKAGED_LOCK,
457
+ packages: {
458
+ "": { ...PACKAGED_LOCK.packages[""], engines: { node: ">=22" } },
459
+ },
460
+ });
461
+
462
+ assertInvalidCompatibility(
463
+ () => checkCompatibility(root),
464
+ /opencode\/package-lock\.json engines\.node must match compatibility\.json node\.engines/,
465
+ );
466
+ });
467
+
468
+ for (const [dependency, sdkField, driftedVersion] of [
469
+ ["@opencode-ai/plugin", "opencode_plugin", "1.14.42"],
470
+ ["@opentui/core", "opentui_core", "0.2.6"],
471
+ ["@opentui/solid", "opentui_solid", "0.2.6"],
472
+ ]) {
473
+ test(`lockfile drift names the ${dependency} dependency surface`, (t) => {
474
+ const root = makeFixture(t);
475
+ writeJson(root, "opencode/package-lock.json", {
476
+ ...PACKAGED_LOCK,
477
+ packages: {
478
+ "": {
479
+ ...PACKAGED_LOCK.packages[""],
480
+ dependencies: {
481
+ ...PACKAGED_LOCK.packages[""].dependencies,
482
+ [dependency]: driftedVersion,
483
+ },
484
+ },
485
+ },
486
+ });
487
+
488
+ assertInvalidCompatibility(
489
+ () => checkCompatibility(root),
490
+ new RegExp(`opencode/package-lock\\.json dependency ${dependency.replaceAll("/", "\\/")} must match compatibility\\.json sdk\\.${sdkField}`),
491
+ );
492
+ });
493
+ }
494
+
495
+ test("documentation rejects an unknown matrix status", (t) => {
496
+ const root = makeFixture(t);
497
+ writeText(
498
+ root,
499
+ "docs/compatibility.md",
500
+ COMPATIBILITY_MATRIX.replace("| Node.js 22 | supported |", "| Node.js 22 | supported boundary |"),
501
+ );
502
+
503
+ assertInvalidCompatibility(
504
+ () => checkCompatibility(root),
505
+ /unknown compatibility status: supported boundary/,
506
+ );
507
+ });
508
+
509
+ test("documentation and boundary workflow follow a promoted stable OpenCode version", (t) => {
510
+ const compatibility = {
511
+ ...VALID_COMPATIBILITY,
512
+ opencode: { ...VALID_COMPATIBILITY.opencode, stable_tested: "1.19.0" },
513
+ };
514
+ const root = makeFixture(t, compatibility);
515
+ writeText(root, "docs/compatibility.md", COMPATIBILITY_MATRIX.replaceAll("1.18.4", "1.19.0"));
516
+ writeText(root, ".github/workflows/check.yml", VALID_WORKFLOW.replaceAll("1.18.4", "1.19.0"));
517
+
518
+ assert.equal(checkCompatibility(root).opencode.stable_tested, "1.19.0");
519
+ });
520
+
521
+ for (const [surface, currentStatus, replacement, expectedStatus] of [
522
+ ["Node.js 26", "experimental", "tested", "experimental"],
523
+ ["Native Windows", "unsupported", "supported", "unsupported"],
524
+ ["WSL2", "experimental", "supported", "experimental"],
525
+ ["Token usage plugin", "experimental", "supported", "experimental"],
526
+ ["Open Design Docker adapter", "experimental", "supported", "experimental"],
527
+ ["Superpowers", "experimental", "supported", "experimental"],
528
+ ["Impeccable", "experimental", "supported", "experimental"],
529
+ ]) {
530
+ test(`documentation rejects the wrong status for ${surface}`, (t) => {
531
+ const root = makeFixture(t);
532
+ writeText(
533
+ root,
534
+ "docs/compatibility.md",
535
+ COMPATIBILITY_MATRIX.replace(
536
+ `| ${surface} | ${currentStatus} |`,
537
+ `| ${surface} | ${replacement} |`,
538
+ ),
539
+ );
540
+
541
+ assertInvalidCompatibility(
542
+ () => checkCompatibility(root),
543
+ new RegExp(`docs/compatibility\\.md must classify ${surface.replaceAll(".", "\\.")} as ${expectedStatus}`),
544
+ );
545
+ });
546
+ }
547
+
548
+ for (const surface of [
549
+ "OpenCode >=1.14.41 <2.0.0",
550
+ "Node.js 22",
551
+ "Node.js 24",
552
+ "WSL2",
553
+ "Native Windows",
554
+ "Token usage plugin",
555
+ "Open Design Docker adapter",
556
+ "Superpowers",
557
+ "Impeccable",
558
+ ]) {
559
+ test(`documentation requires the ${surface} boundary`, (t) => {
560
+ const root = makeFixture(t);
561
+ const line = COMPATIBILITY_MATRIX.split("\n").find((candidate) =>
562
+ candidate.startsWith(`| ${surface} |`),
563
+ );
564
+ assert.ok(line);
565
+ writeText(root, "docs/compatibility.md", COMPATIBILITY_MATRIX.replace(`${line}\n`, ""));
566
+
567
+ assertInvalidCompatibility(
568
+ () => checkCompatibility(root),
569
+ new RegExp(`docs/compatibility\\.md must classify ${surface.replaceAll(".", "\\.")} as`),
570
+ );
571
+ });
572
+ }
573
+
574
+ test("README must link the compatibility documentation", (t) => {
575
+ const root = makeFixture(t);
576
+ writeText(root, "README.md", "Compatibility details are available.\n");
577
+
578
+ assertInvalidCompatibility(
579
+ () => checkCompatibility(root),
580
+ /README\.md must link docs\/compatibility\.md/,
581
+ );
582
+ });
583
+
584
+ test("installation must declare the canonical Node engine", (t) => {
585
+ const root = makeFixture(t);
586
+ writeText(root, "docs/installation.md", "- Node.js and npm\n");
587
+
588
+ assertInvalidCompatibility(
589
+ () => checkCompatibility(root),
590
+ /docs\/installation\.md must declare the canonical Node engine/,
591
+ );
592
+ });
593
+
594
+ test("documentation cannot escape the repository through a symlinked directory", (t) => {
595
+ const root = makeFixture(t);
596
+ const external = fs.mkdtempSync(path.join(os.tmpdir(), "oak-compat-external-"));
597
+ t.after(() => fs.rmSync(external, { recursive: true, force: true }));
598
+ writeText(external, "compatibility.md", COMPATIBILITY_MATRIX);
599
+ writeText(external, "installation.md", INSTALLATION);
600
+ fs.rmSync(path.join(root, "docs"), { recursive: true });
601
+ fs.symlinkSync(external, path.join(root, "docs"), "dir");
602
+
603
+ assertInvalidCompatibility(
604
+ () => checkCompatibility(root),
605
+ /docs\/compatibility\.md must be a safe regular file|escape/,
606
+ );
607
+ });
608
+
609
+ test("documentation requires exactly one start marker", (t) => {
610
+ const root = makeFixture(t);
611
+ writeText(
612
+ root,
613
+ "docs/compatibility.md",
614
+ COMPATIBILITY_MATRIX.replace(
615
+ "<!-- compatibility-matrix:start -->",
616
+ "<!-- compatibility-matrix:start -->\n<!-- compatibility-matrix:start -->",
617
+ ),
618
+ );
619
+
620
+ assertInvalidCompatibility(
621
+ () => checkCompatibility(root),
622
+ /docs\/compatibility\.md must contain exactly one start and one end marker/,
623
+ );
624
+ });
625
+
626
+ test("documentation rejects a duplicated surface before status resolution", (t) => {
627
+ const root = makeFixture(t);
628
+ writeText(
629
+ root,
630
+ "docs/compatibility.md",
631
+ COMPATIBILITY_MATRIX.replace(
632
+ "| Node.js 22 | supported |",
633
+ "| Node.js 22 | unsupported | duplicate |\n| Node.js 22 | supported |",
634
+ ),
635
+ );
636
+
637
+ assertInvalidCompatibility(
638
+ () => checkCompatibility(root),
639
+ /docs\/compatibility\.md must not duplicate surface Node\.js 22/,
640
+ );
641
+ });
642
+
643
+ test("blocking workflow accepts exactly the supported Node and OS matrix", (t) => {
644
+ const root = makeFixture(t);
645
+ assert.equal(checkCompatibility(root).schema_version, 1);
646
+ });
647
+
648
+ test("blocking workflow rejects mutable Action major tags", (t) => {
649
+ const root = makeFixture(t);
650
+ writeText(
651
+ root,
652
+ ".github/workflows/check.yml",
653
+ VALID_WORKFLOW.replaceAll(
654
+ "actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6",
655
+ "actions/checkout@v6",
656
+ ),
657
+ );
658
+ assertInvalidCompatibility(() => checkCompatibility(root), /workflow|OpenCode boundary job/);
659
+ });
660
+
661
+ test("the previous single Ubuntu Node 24 job is rejected", (t) => {
662
+ const root = makeFixture(t);
663
+ writeText(root, ".github/workflows/check.yml", SINGLE_JOB_WORKFLOW);
664
+
665
+ assertInvalidCompatibility(
666
+ () => checkCompatibility(root),
667
+ /workflow must contain exactly one compatibility blocking marker pair/,
668
+ );
669
+ });
670
+
671
+ for (const [label, mutate] of [
672
+ ["missing Ubuntu Node 22 entry", (workflow) => workflow.replace(" - os: ubuntu-latest\n node: 22\n canonical: false\n", "")],
673
+ ["missing Ubuntu Node 24 entry", (workflow) => workflow.replace(" - os: ubuntu-latest\n node: 24\n canonical: true\n", "")],
674
+ ["missing macOS Node 24 entry", (workflow) => workflow.replace(" - os: macos-latest\n node: 24\n canonical: false\n", "")],
675
+ ["extra entry", (workflow) => workflow.replace(" # compatibility-blocking:end", " - os: ubuntu-latest\n node: 26\n canonical: false\n # compatibility-blocking:end")],
676
+ ["duplicated entry", (workflow) => workflow.replace(" # compatibility-blocking:end", " - os: ubuntu-latest\n node: 24\n canonical: true\n # compatibility-blocking:end")],
677
+ ]) {
678
+ test(`blocking workflow rejects a ${label}`, (t) => {
679
+ const root = makeFixture(t);
680
+ writeText(root, ".github/workflows/check.yml", mutate(VALID_WORKFLOW));
681
+ assertInvalidCompatibility(() => checkCompatibility(root), /workflow blocking matrix must be exactly/);
682
+ });
683
+ }
684
+
685
+ test("blocking workflow requires fail-fast false", (t) => {
686
+ const root = makeFixture(t);
687
+ writeText(root, ".github/workflows/check.yml", VALID_WORKFLOW.replace("fail-fast: false", "fail-fast: true"));
688
+ assertInvalidCompatibility(() => checkCompatibility(root), /workflow strategy must set fail-fast to false/);
689
+ });
690
+
691
+ test("release gate requires the exact reproducible artifact command order", (t) => {
692
+ const root = makeFixture(t);
693
+ const packageData = { ...ROOT_PACKAGE, scripts: { ...ROOT_PACKAGE.scripts } };
694
+ packageData.scripts["check:release"] = packageData.scripts["check:release"].replace(
695
+ "npm run dependency-signature-audit && ",
696
+ "",
697
+ );
698
+ writeJson(root, "package.json", packageData);
699
+ assertInvalidCompatibility(() => checkCompatibility(root), /check:release.*exact/i);
700
+ });
701
+
702
+ test("release scripts require the supply-chain checker", (t) => {
703
+ const root = makeFixture(t);
704
+ const packageData = { ...ROOT_PACKAGE, scripts: { ...ROOT_PACKAGE.scripts } };
705
+ delete packageData.scripts["check:supply-chain"];
706
+ writeJson(root, "package.json", packageData);
707
+ assertInvalidCompatibility(() => checkCompatibility(root), /check:supply-chain.*exact/i);
708
+ });
709
+
710
+ for (const [label, current, replacement, message] of [
711
+ ["tag validation", "if: matrix.canonical && startsWith(github.ref, 'refs/tags/')", "if: startsWith(github.ref, 'refs/tags/')", /tag validation guard/],
712
+ ["dependency audit", "if: matrix.canonical\n run: npm run dependency-audit", "if: success()\n run: npm run dependency-audit", /dependency audit guard/],
713
+ ["dependency signature audit", "if: matrix.canonical\n run: npm run dependency-signature-audit", "if: success()\n run: npm run dependency-signature-audit", /dependency signature audit guard/],
714
+ ["package smoke", "if: matrix.canonical\n run: npm run package-smoke", "if: success()\n run: npm run package-smoke", /package smoke guard/],
715
+ ]) {
716
+ test(`blocking workflow requires the exact ${label} guard`, (t) => {
717
+ const root = makeFixture(t);
718
+ writeText(root, ".github/workflows/check.yml", VALID_WORKFLOW.replace(current, replacement));
719
+ assertInvalidCompatibility(() => checkCompatibility(root), message);
720
+ });
721
+ }
722
+
723
+ for (const [label, current, message] of [
724
+ ["matrix runner", "runs-on: ${{ matrix.os }}", /matrix\.os/],
725
+ ["matrix Node setup", "node-version: ${{ matrix.node }}", /matrix\.node/],
726
+ ["dependency installation", "working-directory: opencode\n run: npm ci --ignore-scripts", /install OpenCode tool dependencies/],
727
+ ["contract check", "run: npm run contract-check", /contract check/],
728
+ ["unit and script tests", "run: npm run unit-and-script-tests", /unit and script tests/],
729
+ ["token plugin typecheck", "run: npm run typecheck", /token plugin typecheck/],
730
+ ["installation smoke", "run: npm run installation-smoke", /installation smoke/],
731
+ ]) {
732
+ test(`every blocking matrix job retains ${label}`, (t) => {
733
+ const root = makeFixture(t);
734
+ writeText(root, ".github/workflows/check.yml", VALID_WORKFLOW.replace(current, "# removed by test"));
735
+ assertInvalidCompatibility(() => checkCompatibility(root), message);
736
+ });
737
+ }
738
+
739
+ test("installation smoke requires the frozen npm ci command", (t) => {
740
+ const root = makeFixture(t);
741
+ writeText(root, "scripts/install-smoke.sh", "#!/usr/bin/env bash\nnpm ci\n");
742
+ assertInvalidCompatibility(
743
+ () => checkCompatibility(root),
744
+ /installation smoke must use npm ci --ignore-scripts/,
745
+ );
746
+ });
747
+
748
+ test("a sidecar job cannot satisfy a required blocking check step", (t) => {
749
+ const root = makeFixture(t);
750
+ const workflow = VALID_WORKFLOW
751
+ .replace(" run: npm run typecheck", " run: echo skipped-typecheck")
752
+ .concat(`
753
+ sidecar:
754
+ runs-on: ubuntu-latest
755
+ steps:
756
+ - name: Typecheck TUI token plugin
757
+ run: npm run typecheck
758
+ `);
759
+ writeText(root, ".github/workflows/check.yml", workflow);
760
+
761
+ assertInvalidCompatibility(
762
+ () => checkCompatibility(root),
763
+ /workflow blocking job must retain token plugin typecheck/,
764
+ );
765
+ });
766
+
767
+ for (const [label, workflow] of [
768
+ ["missing", VALID_WORKFLOW.replace(" check:\n", " renamed:\n")],
769
+ ["duplicated", `${VALID_WORKFLOW}\n check:\n runs-on: ubuntu-latest\n`],
770
+ ["ambiguous", `${VALID_WORKFLOW}\njobs:\n sidecar:\n runs-on: ubuntu-latest\n`],
771
+ ]) {
772
+ test(`workflow rejects a ${label} jobs.check body`, (t) => {
773
+ const root = makeFixture(t);
774
+ writeText(root, ".github/workflows/check.yml", workflow);
775
+ assertInvalidCompatibility(
776
+ () => checkCompatibility(root),
777
+ /workflow must contain exactly one unambiguous jobs\.check body/,
778
+ );
779
+ });
780
+ }
781
+
782
+ for (const command of [
783
+ "uname -a || true",
784
+ "node --version",
785
+ "npm --version",
786
+ "arch:process.arch",
787
+ "platform:process.platform",
788
+ 'p.dependencies["@opencode-ai/plugin"]',
789
+ 'p.dependencies["@opentui/core"]',
790
+ 'p.dependencies["@opentui/solid"]',
791
+ ]) {
792
+ test(`runner evidence requires ${command}`, (t) => {
793
+ const root = makeFixture(t);
794
+ writeText(root, ".github/workflows/check.yml", VALID_WORKFLOW.replace(command, "removed-by-test"));
795
+ assertInvalidCompatibility(() => checkCompatibility(root), /runner evidence/);
796
+ });
797
+ }
798
+
799
+ test("workflow rejects write permissions", (t) => {
800
+ const root = makeFixture(t);
801
+ writeText(root, ".github/workflows/check.yml", VALID_WORKFLOW.replace("contents: read", "contents: write"));
802
+ assertInvalidCompatibility(() => checkCompatibility(root), /read-only permissions/);
803
+ });
804
+
805
+ for (const [job, workflow] of [
806
+ [
807
+ "check",
808
+ VALID_WORKFLOW.replace(
809
+ " check:\n",
810
+ " check:\n permissions:\n contents: read\n",
811
+ ),
812
+ ],
813
+ [
814
+ "opencode-compatibility",
815
+ VALID_WORKFLOW.replace(
816
+ " opencode-compatibility:\n",
817
+ " opencode-compatibility:\n permissions:\n contents: read\n",
818
+ ),
819
+ ],
820
+ ]) {
821
+ test(`workflow requires jobs.${job} to inherit top-level permissions`, (t) => {
822
+ const root = makeFixture(t);
823
+ writeText(root, ".github/workflows/check.yml", workflow);
824
+ assertInvalidCompatibility(
825
+ () => checkCompatibility(root),
826
+ /job-level permissions are forbidden/,
827
+ );
828
+ });
829
+ }
830
+
831
+ test("workflow rejects publish commands", (t) => {
832
+ const root = makeFixture(t);
833
+ writeText(root, ".github/workflows/check.yml", `${VALID_WORKFLOW} - run: npm publish\n`);
834
+ assertInvalidCompatibility(() => checkCompatibility(root), /must not publish/);
835
+ });
836
+
837
+ for (const [label, command] of [
838
+ ["GitHub release upload", "gh release upload v1 artifact.tgz"],
839
+ ["GitHub release edit", "gh release edit v1 --draft=false"],
840
+ ["GitHub release delete", "gh release delete v1 --yes"],
841
+ ["GitHub API PATCH", "gh api repos/example/project/releases/1 -X PATCH -f draft=false"],
842
+ ["GitHub API DELETE", "gh api --method=DELETE repos/example/project/releases/1"],
843
+ ["npm dist-tag add", "npm dist-tag add pkg@1 latest"],
844
+ ["npm dist-tag rm", "npm dist-tag rm pkg latest"],
845
+ ["npm unpublish", "npm unpublish pkg@1"],
846
+ ["npm deprecate", "npm deprecate pkg@1 obsolete"],
847
+ ["repository push", "git push origin HEAD"],
848
+ ["cache action", "uses: actions/cache@v4"],
849
+ ["artifact action", "uses: actions/upload-artifact@v4"],
850
+ ]) {
851
+ test(`workflow rejects ${label}`, (t) => {
852
+ const root = makeFixture(t);
853
+ writeText(
854
+ root,
855
+ ".github/workflows/check.yml",
856
+ VALID_WORKFLOW.replace(
857
+ " # opencode-boundaries:start",
858
+ ` - run: ${command}\n\n # opencode-boundaries:start`,
859
+ ),
860
+ );
861
+ assertInvalidCompatibility(() => checkCompatibility(root), /must not publish, release, upload, mutate, cache, or use artifacts/);
862
+ });
863
+ }
864
+
865
+ for (const [label, command] of [
866
+ ["GitHub release view", "gh release view v1"],
867
+ ["GitHub API GET", "gh api repos/example/project/releases/1"],
868
+ ["npm view", "npm view pkg@1 dist.integrity"],
869
+ ]) {
870
+ test(`workflow accepts read-only ${label}`, (t) => {
871
+ const root = makeFixture(t);
872
+ writeText(
873
+ root,
874
+ ".github/workflows/check.yml",
875
+ VALID_WORKFLOW.replace(
876
+ " # opencode-boundaries:start",
877
+ ` - run: ${command}\n\n # opencode-boundaries:start`,
878
+ ),
879
+ );
880
+ assert.equal(checkCompatibility(root).schema_version, 1);
881
+ });
882
+ }
883
+
884
+ test("workflow requires exactly one ordered blocking marker pair", (t) => {
885
+ const root = makeFixture(t);
886
+ writeText(
887
+ root,
888
+ ".github/workflows/check.yml",
889
+ VALID_WORKFLOW.replace("# compatibility-blocking:start", "# compatibility-blocking:start\n # compatibility-blocking:start"),
890
+ );
891
+ assertInvalidCompatibility(
892
+ () => checkCompatibility(root),
893
+ /workflow must contain exactly one compatibility blocking marker pair/,
894
+ );
895
+ });
896
+
897
+ test("workflow requires blocking markers in order", (t) => {
898
+ const root = makeFixture(t);
899
+ writeText(
900
+ root,
901
+ ".github/workflows/check.yml",
902
+ VALID_WORKFLOW
903
+ .replace("# compatibility-blocking:start", "# compatibility-blocking:temporary")
904
+ .replace("# compatibility-blocking:end", "# compatibility-blocking:start")
905
+ .replace("# compatibility-blocking:temporary", "# compatibility-blocking:end"),
906
+ );
907
+ assertInvalidCompatibility(
908
+ () => checkCompatibility(root),
909
+ /workflow compatibility blocking markers must be in order/,
910
+ );
911
+ });
912
+
913
+ test("OpenCode boundary job accepts the exact blocking matrix", (t) => {
914
+ const root = makeFixture(t);
915
+ assert.equal(checkCompatibility(root).schema_version, 1);
916
+ });
917
+
918
+ for (const [label, mutate] of [
919
+ ["minimum core tested version", (workflow) => workflow.replace(' - mode: core\n opencode: "1.14.41"\n', "")],
920
+ ["stable core tested version", (workflow) => workflow.replace(' - mode: core\n opencode: "1.18.4"\n', "")],
921
+ ["stable default tested version", (workflow) => workflow.replace(' - mode: default\n opencode: "1.18.4"\n', "")],
922
+ ["Node 24 setup", (workflow) => workflow.replace(" node-version: 24", " node-version: 22")],
923
+ [
924
+ "matrix-version wrapper invocation",
925
+ (workflow) => workflow.replace(
926
+ 'run: bash scripts/opencode-compat-smoke.sh "${{ matrix.mode }}" "${{ matrix.opencode }}"',
927
+ "run: bash scripts/opencode-compat-smoke.sh 1.18.4",
928
+ ),
929
+ ],
930
+ [
931
+ "isolated wrapper instead of the operator binary",
932
+ (workflow) => workflow.replace(
933
+ 'run: bash scripts/opencode-compat-smoke.sh "${{ matrix.mode }}" "${{ matrix.opencode }}"',
934
+ "run: opencode --version",
935
+ ),
936
+ ],
937
+ [
938
+ "blocking failure behavior",
939
+ (workflow) => workflow.replace(
940
+ " opencode-compatibility:\n",
941
+ " opencode-compatibility:\n continue-on-error: true\n",
942
+ ),
943
+ ],
944
+ [
945
+ "non-publishing behavior",
946
+ (workflow) => workflow.replace(
947
+ " # opencode-boundaries:end",
948
+ " - name: Publish\n run: npm publish\n # opencode-boundaries:end",
949
+ ),
950
+ ],
951
+ [
952
+ "credential-free behavior",
953
+ (workflow) => workflow.replace(
954
+ " runs-on: ubuntu-latest\n strategy:",
955
+ ' runs-on: ubuntu-latest\n env:\n GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n strategy:',
956
+ ),
957
+ ],
958
+ [
959
+ "provider-secret-free behavior",
960
+ (workflow) => workflow.replace(
961
+ " runs-on: ubuntu-latest\n strategy:",
962
+ ` runs-on: ubuntu-latest\n env:\n ${PROVIDER_SECRET}: \${{ secrets.${PROVIDER_SECRET} }}\n strategy:`,
963
+ ),
964
+ ],
965
+ [
966
+ "checkout-level dependency install",
967
+ (workflow) => workflow.replace(
968
+ OPENCODE_BOUNDARY_JOB,
969
+ OPENCODE_BOUNDARY_JOB.replace(
970
+ " - name: Setup Node\n uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6",
971
+ " - name: Install dependencies\n run: npm ci\n\n - name: Setup Node\n uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6",
972
+ ),
973
+ ),
974
+ ],
975
+ ]) {
976
+ test(`OpenCode boundary job requires ${label}`, (t) => {
977
+ const root = makeFixture(t);
978
+ writeText(root, ".github/workflows/check.yml", mutate(VALID_WORKFLOW));
979
+ assertInvalidCompatibility(() => checkCompatibility(root), /OpenCode boundary job/);
980
+ });
981
+ }
982
+
983
+ test("OpenCode boundary job cannot borrow its smoke from another job", (t) => {
984
+ const root = makeFixture(t);
985
+ const workflow = VALID_WORKFLOW
986
+ .replace(
987
+ ' run: bash scripts/opencode-compat-smoke.sh "${{ matrix.mode }}" "${{ matrix.opencode }}"',
988
+ " run: echo skipped-boundary-smoke",
989
+ )
990
+ .concat(`
991
+ sidecar-smoke:
992
+ runs-on: ubuntu-latest
993
+ steps:
994
+ - run: bash scripts/opencode-compat-smoke.sh "\${{ matrix.mode }}" "\${{ matrix.opencode }}"
995
+ `);
996
+ writeText(root, ".github/workflows/check.yml", workflow);
997
+ assertInvalidCompatibility(() => checkCompatibility(root), /OpenCode boundary job/);
998
+ });
999
+
1000
+ test("OpenCode boundary job markers must wrap the job inside jobs", (t) => {
1001
+ const root = makeFixture(t);
1002
+ const workflow = VALID_WORKFLOW
1003
+ .replace(OPENCODE_BOUNDARY_JOB, " opencode-compatibility:\n runs-on: macos-latest\n")
1004
+ .concat(`
1005
+ outside:
1006
+ ${OPENCODE_BOUNDARY_JOB}`);
1007
+ writeText(root, ".github/workflows/check.yml", workflow);
1008
+ assertInvalidCompatibility(() => checkCompatibility(root), /OpenCode boundary job/);
1009
+ });
1010
+
1011
+ for (const [label, trailingYaml] of [
1012
+ ["trailing continue-on-error", " continue-on-error: true\n"],
1013
+ [
1014
+ "trailing provider secret",
1015
+ ' env:\n TEST_TOKEN: ${{ secrets.TEST_TOKEN }}\n',
1016
+ ],
1017
+ ["trailing job key", " timeout-minutes: 5\n"],
1018
+ [
1019
+ "trailing steps key",
1020
+ " steps:\n - name: Bypass\n run: echo bypass\n",
1021
+ ],
1022
+ ]) {
1023
+ test(`OpenCode boundary job rejects ${label} after its end marker`, (t) => {
1024
+ const root = makeFixture(t);
1025
+ writeText(
1026
+ root,
1027
+ ".github/workflows/check.yml",
1028
+ VALID_WORKFLOW.replace(
1029
+ " # opencode-boundaries:end\n",
1030
+ ` # opencode-boundaries:end\n${trailingYaml}`,
1031
+ ),
1032
+ );
1033
+ assertInvalidCompatibility(() => checkCompatibility(root), /OpenCode boundary job/);
1034
+ });
1035
+ }
1036
+
1037
+ test("OpenCode boundary job requires exactly one marker pair", (t) => {
1038
+ const root = makeFixture(t);
1039
+ writeText(
1040
+ root,
1041
+ ".github/workflows/check.yml",
1042
+ VALID_WORKFLOW.replace(
1043
+ " # opencode-boundaries:start",
1044
+ " # opencode-boundaries:start\n # opencode-boundaries:start",
1045
+ ),
1046
+ );
1047
+ assertInvalidCompatibility(() => checkCompatibility(root), /OpenCode boundary job/);
1048
+ });
1049
+
1050
+ test("OpenCode boundary job requires markers in order", (t) => {
1051
+ const root = makeFixture(t);
1052
+ writeText(
1053
+ root,
1054
+ ".github/workflows/check.yml",
1055
+ VALID_WORKFLOW
1056
+ .replace("# opencode-boundaries:start", "# opencode-boundaries:temporary")
1057
+ .replace("# opencode-boundaries:end", "# opencode-boundaries:start")
1058
+ .replace("# opencode-boundaries:temporary", "# opencode-boundaries:end"),
1059
+ );
1060
+ assertInvalidCompatibility(() => checkCompatibility(root), /OpenCode boundary job/);
1061
+ });
1062
+
1063
+ test("compatibility canary accepts the exact scheduled and manual latest smoke", (t) => {
1064
+ const root = makeFixture(t);
1065
+ assert.equal(checkCompatibility(root).schema_version, 1);
1066
+ });
1067
+
1068
+ test("compatibility canary rejects mutable Action major tags", (t) => {
1069
+ const root = makeFixture(t);
1070
+ writeText(
1071
+ root,
1072
+ ".github/workflows/compatibility-canary.yml",
1073
+ VALID_CANARY_WORKFLOW.replace(
1074
+ "actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6",
1075
+ "actions/setup-node@v6",
1076
+ ),
1077
+ );
1078
+ assertInvalidCompatibility(() => checkCompatibility(root), /compatibility canary/i);
1079
+ });
1080
+
1081
+ for (const [label, mutate] of [
1082
+ ["schedule trigger", (workflow) => workflow.replace(' schedule:\n - cron: "17 6 * * 1"\n', "")],
1083
+ ["workflow_dispatch trigger", (workflow) => workflow.replace(" workflow_dispatch:\n", "")],
1084
+ ["push trigger", (workflow) => workflow.replace(" workflow_dispatch:\n", " workflow_dispatch:\n push:\n")],
1085
+ ["pull_request trigger", (workflow) => workflow.replace(" workflow_dispatch:\n", " workflow_dispatch:\n pull_request:\n")],
1086
+ ["canonical canary Node", (workflow) => workflow.replace(" node-version: 26", " node-version: 24")],
1087
+ ["canonical latest argument", (workflow) => workflow.replace("opencode-compat-smoke.sh core latest", "opencode-compat-smoke.sh core 1.18.4")],
1088
+ ["read-only permissions", (workflow) => workflow.replace("contents: read", "contents: write")],
1089
+ ["blocking failure behavior", (workflow) => workflow.replace(" runs-on: ubuntu-latest", " continue-on-error: true\n runs-on: ubuntu-latest")],
1090
+ ["credential-free behavior", (workflow) => workflow.replace(" runs-on: ubuntu-latest", ' env:\n GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n runs-on: ubuntu-latest')],
1091
+ ["npm publish ban", (workflow) => workflow.replace(" - name: Smoke latest OpenCode", " - run: npm publish\n\n - name: Smoke latest OpenCode")],
1092
+ ["tag creation ban", (workflow) => workflow.replace(" - name: Smoke latest OpenCode", " - run: git tag canary\n\n - name: Smoke latest OpenCode")],
1093
+ ["issue creation ban", (workflow) => workflow.replace(" - name: Smoke latest OpenCode", " - run: gh issue create --title canary\n\n - name: Smoke latest OpenCode")],
1094
+ ["dependency update ban", (workflow) => workflow.replace(" - name: Smoke latest OpenCode", " - run: npm update\n\n - name: Smoke latest OpenCode")],
1095
+ ["npm ci ban", (workflow) => workflow.replace(" - name: Smoke latest OpenCode", " - run: npm ci\n\n - name: Smoke latest OpenCode")],
1096
+ ["checkout cache ban", (workflow) => workflow.replace(" uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6", " uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6\n with:\n cache: npm")],
1097
+ ["cache action ban", (workflow) => workflow.replace(" - name: Smoke latest OpenCode", " - uses: actions/cache@v4\n\n - name: Smoke latest OpenCode")],
1098
+ ["artifact action ban", (workflow) => workflow.replace(" - name: Smoke latest OpenCode", " - uses: actions/upload-artifact@v4\n\n - name: Smoke latest OpenCode")],
1099
+ ["repository mutation ban", (workflow) => workflow.replace(" - name: Smoke latest OpenCode", " - run: git push origin HEAD\n\n - name: Smoke latest OpenCode")],
1100
+ ]) {
1101
+ test(`compatibility canary requires ${label}`, (t) => {
1102
+ const root = makeFixture(t);
1103
+ writeText(root, ".github/workflows/compatibility-canary.yml", mutate(VALID_CANARY_WORKFLOW));
1104
+ assertInvalidCompatibility(() => checkCompatibility(root), /compatibility canary/i);
1105
+ });
1106
+ }
1107
+
1108
+ for (const [label, mutate] of [
1109
+ [
1110
+ "missing persist-credentials",
1111
+ (workflow) => workflow.replace(" with:\n persist-credentials: false\n", ""),
1112
+ ],
1113
+ [
1114
+ "persist-credentials true",
1115
+ (workflow) => workflow.replace("persist-credentials: false", "persist-credentials: true"),
1116
+ ],
1117
+ [
1118
+ "duplicate persist-credentials",
1119
+ (workflow) => workflow.replace(
1120
+ " persist-credentials: false",
1121
+ " persist-credentials: false\n persist-credentials: false",
1122
+ ),
1123
+ ],
1124
+ ]) {
1125
+ test(`compatibility canary rejects ${label}`, (t) => {
1126
+ const root = makeFixture(t);
1127
+ writeText(root, ".github/workflows/compatibility-canary.yml", mutate(VALID_CANARY_WORKFLOW));
1128
+ assertInvalidCompatibility(() => checkCompatibility(root), /compatibility canary/i);
1129
+ });
1130
+ }
1131
+
1132
+ test("compatibility canary latest job must inherit top-level permissions", (t) => {
1133
+ const root = makeFixture(t);
1134
+ writeText(
1135
+ root,
1136
+ ".github/workflows/compatibility-canary.yml",
1137
+ VALID_CANARY_WORKFLOW.replace(
1138
+ " latest:\n",
1139
+ " latest:\n permissions:\n contents: read\n",
1140
+ ),
1141
+ );
1142
+
1143
+ assertInvalidCompatibility(
1144
+ () => checkCompatibility(root),
1145
+ /compatibility canary job-level permissions are forbidden/,
1146
+ );
1147
+ });
1148
+
1149
+ for (const [label, workflow] of [
1150
+ ["missing latest job", VALID_CANARY_WORKFLOW.replace(" latest:\n", " renamed:\n")],
1151
+ ["duplicate latest job", `${VALID_CANARY_WORKFLOW}\n latest:\n runs-on: ubuntu-latest\n`],
1152
+ ["duplicate jobs mapping", `${VALID_CANARY_WORKFLOW}\njobs:\n sidecar:\n runs-on: ubuntu-latest\n`],
1153
+ ["duplicate start marker", VALID_CANARY_WORKFLOW.replace(" # compatibility-canary:start", " # compatibility-canary:start\n # compatibility-canary:start")],
1154
+ ["duplicate end marker", VALID_CANARY_WORKFLOW.replace(" # compatibility-canary:end", " # compatibility-canary:end\n # compatibility-canary:end")],
1155
+ [
1156
+ "reversed markers",
1157
+ VALID_CANARY_WORKFLOW
1158
+ .replace("# compatibility-canary:start", "# compatibility-canary:temporary")
1159
+ .replace("# compatibility-canary:end", "# compatibility-canary:start")
1160
+ .replace("# compatibility-canary:temporary", "# compatibility-canary:end"),
1161
+ ],
1162
+ ["trailing job key", VALID_CANARY_WORKFLOW.replace(" # compatibility-canary:end", " # compatibility-canary:end\n timeout-minutes: 5")],
1163
+ ["trailing steps key", VALID_CANARY_WORKFLOW.replace(" # compatibility-canary:end", " # compatibility-canary:end\n steps:\n - run: echo bypass")],
1164
+ ]) {
1165
+ test(`compatibility canary rejects ${label}`, (t) => {
1166
+ const root = makeFixture(t);
1167
+ writeText(root, ".github/workflows/compatibility-canary.yml", workflow);
1168
+ assertInvalidCompatibility(() => checkCompatibility(root), /compatibility canary/i);
1169
+ });
1170
+ }
1171
+
1172
+ function shellQuote(value) {
1173
+ return `'${value.replaceAll("'", `'\\''`)}'`;
1174
+ }
1175
+
1176
+ function writeExecutable(root, relative, contents) {
1177
+ writeText(root, relative, contents);
1178
+ fs.chmodSync(path.join(root, relative), 0o755);
1179
+ }
1180
+
1181
+ function makeCompatibilitySmokeFixture(t, options = {}) {
1182
+ const root = fs.mkdtempSync(path.join(os.tmpdir(), "oak-compat-smoke-test-"));
1183
+ t.after(() => fs.rmSync(root, { recursive: true, force: true }));
1184
+
1185
+ const sourceScript = path.join(REPOSITORY_ROOT, "scripts/opencode-compat-smoke.sh");
1186
+ if (fs.existsSync(sourceScript)) {
1187
+ fs.mkdirSync(path.join(root, "scripts"), { recursive: true });
1188
+ fs.copyFileSync(sourceScript, path.join(root, "scripts/opencode-compat-smoke.sh"));
1189
+ fs.chmodSync(path.join(root, "scripts/opencode-compat-smoke.sh"), 0o755);
1190
+ }
1191
+
1192
+ writeJson(root, "package.json", {
1193
+ name: "compat-smoke-fixture",
1194
+ version: "1.0.0",
1195
+ files: ["opencode"],
1196
+ });
1197
+ writeText(root, "agents/lead.md", "---\nmode: all\n---\n");
1198
+ if (options.packagedLead !== "missing") {
1199
+ writeText(
1200
+ root,
1201
+ "opencode/agents/lead.md",
1202
+ `---\nmode: ${options.packagedLead ?? "primary"}\n---\n`,
1203
+ );
1204
+ }
1205
+ writeJson(root, "opencode/package.json", { name: "fixture", private: true });
1206
+ writeJson(root, "opencode/package-lock.json", {
1207
+ name: "fixture",
1208
+ lockfileVersion: 3,
1209
+ packages: { "": { name: "fixture" } },
1210
+ });
1211
+ writeText(root, "opencode/node_modules/excluded", "must not be copied\n");
1212
+ writeText(root, "opencode/.oak/excluded", "must not be copied\n");
1213
+ writeText(root, "opencode/plugins/token-tree-usage.tsx", "export default {};\n");
1214
+ writeJson(root, "opencode/opencode.json", {
1215
+ default_agent: "lead",
1216
+ plugin: [
1217
+ "superpowers@git+https://github.com/obra/superpowers.git#d884ae04edebef577e82ff7c4e143debd0bbec99",
1218
+ ],
1219
+ });
1220
+
1221
+ const quotedRoot = shellQuote(root);
1222
+ const realNpm = spawnSync("which", ["npm"], { encoding: "utf8" }).stdout.trim();
1223
+ writeExecutable(root, "fake-bin/npm", `#!/bin/sh
1224
+ set -eu
1225
+ if [ "\${1-}" = pack ]; then
1226
+ touch ${shellQuote(path.join(root, "npm-pack-called"))}
1227
+ ${options.packFailure ? "exit 51" : `exec ${shellQuote(realNpm)} "$@"`}
1228
+ fi
1229
+ touch ${shellQuote(path.join(root, "npm-ci-called"))}
1230
+ smoke_root=\${HOME%/home}
1231
+ smoke_home="$(CDPATH= cd "$HOME" && pwd -P)"
1232
+ test "$(pwd -P)" = "$smoke_home"
1233
+ test "\${PWD-}" = "$smoke_home"
1234
+ test "$#" -eq 4
1235
+ test "$1" = --prefix
1236
+ test "$2" = "$smoke_root/config/opencode"
1237
+ test "$3" = ci
1238
+ test "$4" = --ignore-scripts
1239
+ test "$HOME" = "$smoke_root/home"
1240
+ test "$XDG_CONFIG_HOME" = "$smoke_root/config"
1241
+ test "$XDG_DATA_HOME" = "$smoke_root/data"
1242
+ test "$XDG_CACHE_HOME" = "$smoke_root/cache"
1243
+ test "$XDG_STATE_HOME" = "$smoke_root/state"
1244
+ test "$npm_config_cache" = "$smoke_root/npm"
1245
+ test "$OPENCODE_CONFIG_DIR" = "$smoke_root/config/opencode"
1246
+ case "$2" in ${quotedRoot}|${quotedRoot}/*) exit 31;; esac
1247
+ case "$OPENCODE_CONFIG_DIR" in ${quotedRoot}|${quotedRoot}/*) exit 32;; esac
1248
+ test -f "$2/agents/lead.md"
1249
+ test ! -e "$2/opencode"
1250
+ test ! -e "$2/node_modules"
1251
+ test ! -e "$2/.oak"
1252
+ case "${options.mode ?? "core"}" in
1253
+ core)
1254
+ test ! -e "$2/plugins"
1255
+ node -e 'const c=require(process.argv[1]); if (!Array.isArray(c.plugin) || c.plugin.length !== 0) process.exit(1)' "$2/opencode.json"
1256
+ ;;
1257
+ default)
1258
+ test -f "$2/plugins/token-tree-usage.tsx"
1259
+ node -e 'const c=require(process.argv[1]); const p=c.plugin; if (!Array.isArray(p) || p.length !== 1 || p[0] !== "superpowers@git+https://github.com/obra/superpowers.git#d884ae04edebef577e82ff7c4e143debd0bbec99") process.exit(1)' "$2/opencode.json"
1260
+ ;;
1261
+ esac
1262
+ `);
1263
+
1264
+ const request = options.request ?? "1.14.41";
1265
+ const version = options.resolvedVersion ?? (options.wrongVersion ? "9.9.9" : request);
1266
+ const stdoutLeakPath = options.stdoutLeak === "root" ? root : options.stdoutLeak;
1267
+ const leak = stdoutLeakPath ? `,\"source\":${JSON.stringify(stdoutLeakPath)}` : "";
1268
+ const stderrLeakPath = options.stderrLeak === "root" ? root : options.stderrLeak;
1269
+ let stderrLeak = ":";
1270
+ if (stderrLeakPath === "smoke") {
1271
+ stderrLeak = `printf '%s\\n' "$smoke_root/SMOKE_TEMP_MARKER" >&2`;
1272
+ } else if (stderrLeakPath) {
1273
+ stderrLeak = `printf '%s\\n' ${shellQuote(stderrLeakPath)} >&2`;
1274
+ }
1275
+ writeExecutable(root, "fake-bin/npx", `#!/bin/sh
1276
+ set -eu
1277
+ touch ${shellQuote(path.join(root, "npx-called"))}
1278
+ if env | grep -q '^FAKE_PROVIDER_TOKEN='; then exit 41; fi
1279
+ smoke_root=\${HOME%/home}
1280
+ smoke_home="$(CDPATH= cd "$HOME" && pwd -P)"
1281
+ test "$(pwd -P)" = "$smoke_home"
1282
+ test "\${PWD-}" = "$smoke_home"
1283
+ test "$HOME" = "$smoke_root/home"
1284
+ test "$XDG_CONFIG_HOME" = "$smoke_root/config"
1285
+ test "$XDG_DATA_HOME" = "$smoke_root/data"
1286
+ test "$XDG_CACHE_HOME" = "$smoke_root/cache"
1287
+ test "$XDG_STATE_HOME" = "$smoke_root/state"
1288
+ test "$npm_config_cache" = "$smoke_root/npm"
1289
+ test "$OPENCODE_CONFIG_DIR" = "$smoke_root/config/opencode"
1290
+ case "$OPENCODE_CONFIG_DIR" in ${quotedRoot}|${quotedRoot}/*) exit 42;; esac
1291
+ test "$1" = --yes
1292
+ test "$2" = --package
1293
+ test "$3" = opencode-ai@${request}
1294
+ test "$4" = opencode
1295
+ shift 4
1296
+ case "$1" in
1297
+ --version)
1298
+ test "$#" -eq 1
1299
+ ${stderrLeak}
1300
+ printf '%s\\n' '${version}'
1301
+ ;;
1302
+ debug)
1303
+ test "$#" -eq 4
1304
+ test "$2" = agent
1305
+ test "$3" = lead
1306
+ test "$4" = --pure
1307
+ grep -q '^mode: primary$' "$OPENCODE_CONFIG_DIR/agents/lead.md"
1308
+ printf '{\"name\":\"lead\",\"mode\":\"primary\",\"config\":\"%s\"${leak}}\\n' "$OPENCODE_CONFIG_DIR"
1309
+ ;;
1310
+ *) exit 43;;
1311
+ esac
1312
+ `);
1313
+ return root;
1314
+ }
1315
+
1316
+ function runCompatibilitySmoke(root, args = ["core", "1.14.41"]) {
1317
+ return spawnSync(
1318
+ "bash",
1319
+ [path.join(root, "scripts/opencode-compat-smoke.sh"), ...args],
1320
+ {
1321
+ cwd: root,
1322
+ env: {
1323
+ ...process.env,
1324
+ PATH: `${path.join(root, "fake-bin")}:${process.env.PATH}`,
1325
+ FAKE_PROVIDER_TOKEN: "must-not-reach-opencode",
1326
+ },
1327
+ encoding: "utf8",
1328
+ },
1329
+ );
1330
+ }
1331
+
1332
+ test("core OpenCode compatibility smoke strips optional plugins from the working-tree copy", (t) => {
1333
+ const root = makeCompatibilitySmokeFixture(t);
1334
+ const result = runCompatibilitySmoke(root);
1335
+
1336
+ assert.equal(result.status, 0, result.stderr || result.error?.message);
1337
+ assert.equal(
1338
+ result.stdout,
1339
+ "opencode compatibility smoke ok: mode=core requested=1.14.41 resolved=1.14.41\n",
1340
+ );
1341
+ });
1342
+
1343
+ test("default OpenCode compatibility smoke packs and loads the unmodified package config", (t) => {
1344
+ const root = makeCompatibilitySmokeFixture(t, { mode: "default", request: "1.18.4" });
1345
+ const result = runCompatibilitySmoke(root, ["default", "1.18.4"]);
1346
+
1347
+ assert.equal(result.status, 0, result.stderr || result.error?.message);
1348
+ assert.equal(fs.existsSync(path.join(root, "npm-pack-called")), true);
1349
+ assert.equal(
1350
+ result.stdout,
1351
+ "opencode compatibility smoke ok: mode=default requested=1.18.4 resolved=1.18.4\n",
1352
+ );
1353
+ });
1354
+
1355
+ test("default OpenCode compatibility smoke does not fall back when npm pack fails", (t) => {
1356
+ const root = makeCompatibilitySmokeFixture(t, {
1357
+ mode: "default",
1358
+ request: "1.18.4",
1359
+ packFailure: true,
1360
+ });
1361
+ const result = runCompatibilitySmoke(root, ["default", "1.18.4"]);
1362
+
1363
+ assert.notEqual(result.status, 0);
1364
+ assert.equal(fs.existsSync(path.join(root, "npm-pack-called")), true);
1365
+ assert.equal(fs.existsSync(path.join(root, "npm-ci-called")), false);
1366
+ assert.equal(fs.existsSync(path.join(root, "npx-called")), false);
1367
+ });
1368
+
1369
+ test("OpenCode compatibility smoke suppresses temporary stderr paths without failing", (t) => {
1370
+ const root = makeCompatibilitySmokeFixture(t, { stderrLeak: "smoke" });
1371
+ const result = runCompatibilitySmoke(root);
1372
+
1373
+ assert.equal(result.status, 0, result.stderr || result.error?.message);
1374
+ assert.equal(
1375
+ result.stdout,
1376
+ "opencode compatibility smoke ok: mode=core requested=1.14.41 resolved=1.14.41\n",
1377
+ );
1378
+ assert.equal(result.stderr.includes("SMOKE_TEMP_MARKER"), false);
1379
+ });
1380
+
1381
+ test("OpenCode compatibility smoke rejects a non-canonical explicit version before tools run", (t) => {
1382
+ const root = makeCompatibilitySmokeFixture(t, { request: "01.14.41" });
1383
+ const result = runCompatibilitySmoke(root, ["core", "01.14.41"]);
1384
+
1385
+ assert.equal(result.status, 2);
1386
+ assert.equal(result.stdout, "");
1387
+ assert.equal(fs.existsSync(path.join(root, "npm-called")), false);
1388
+ assert.equal(fs.existsSync(path.join(root, "npx-called")), false);
1389
+ });
1390
+
1391
+ test("OpenCode compatibility smoke rejects a non-canonical latest resolution", (t) => {
1392
+ const root = makeCompatibilitySmokeFixture(t, {
1393
+ request: "latest",
1394
+ resolvedVersion: "01.18.4",
1395
+ });
1396
+ const result = runCompatibilitySmoke(root, ["core", "latest"]);
1397
+
1398
+ assert.notEqual(result.status, 0);
1399
+ assert.equal(result.stdout, "");
1400
+ assert.equal(fs.existsSync(path.join(root, "npx-called")), true);
1401
+ });
1402
+
1403
+ for (const [label, leakPath] of [
1404
+ ["original repository", "root"],
1405
+ ["original home", process.env.HOME],
1406
+ ]) {
1407
+ if (!leakPath && label === "original home") continue;
1408
+
1409
+ test(`OpenCode compatibility smoke suppresses an ${label} path leaked on stderr`, (t) => {
1410
+ const root = makeCompatibilitySmokeFixture(t, {
1411
+ stderrLeak: leakPath,
1412
+ });
1413
+ const forbiddenPath = leakPath === "root" ? root : leakPath;
1414
+ const result = runCompatibilitySmoke(root);
1415
+
1416
+ assert.notEqual(result.status, 0);
1417
+ assert.equal(result.stdout, "");
1418
+ assert.equal(result.stderr.includes(forbiddenPath), false);
1419
+ });
1420
+ }
1421
+
1422
+ for (const args of [
1423
+ [],
1424
+ ["core"],
1425
+ ["unknown", "1.14.41"],
1426
+ ["default", "latest"],
1427
+ ["core", "1.14.41", "extra"],
1428
+ ]) {
1429
+ test(`OpenCode compatibility smoke rejects invalid interface: ${JSON.stringify(args)}`, (t) => {
1430
+ const root = makeCompatibilitySmokeFixture(t);
1431
+ const result = runCompatibilitySmoke(root, args);
1432
+
1433
+ assert.equal(result.status, 2);
1434
+ assert.equal(fs.existsSync(path.join(root, "npm-pack-called")), false);
1435
+ assert.equal(fs.existsSync(path.join(root, "npm-ci-called")), false);
1436
+ assert.equal(fs.existsSync(path.join(root, "npx-called")), false);
1437
+ });
1438
+ }
1439
+
1440
+ for (const [label, leakPath] of [
1441
+ ["original repository", "root"],
1442
+ ["original home", process.env.HOME],
1443
+ ]) {
1444
+ if (!leakPath && label === "original home") continue;
1445
+
1446
+ test(`OpenCode compatibility smoke rejects an ${label} path leaked on stdout`, (t) => {
1447
+ const root = makeCompatibilitySmokeFixture(t, { stdoutLeak: leakPath });
1448
+ const result = runCompatibilitySmoke(root);
1449
+
1450
+ assert.notEqual(result.status, 0);
1451
+ assert.equal(result.stdout, "");
1452
+ });
1453
+ }
1454
+
1455
+ for (const [name, options] of [
1456
+ ["a mismatched resolved version", { wrongVersion: true }],
1457
+ ["a missing packaged lead", { packagedLead: "missing" }],
1458
+ ["an incorrect packaged lead mode", { packagedLead: "all" }],
1459
+ ]) {
1460
+ test(`OpenCode compatibility smoke rejects ${name}`, (t) => {
1461
+ const root = makeCompatibilitySmokeFixture(t, options);
1462
+ const result = runCompatibilitySmoke(root);
1463
+
1464
+ assert.notEqual(result.status, 0);
1465
+ assert.equal(result.stdout, "");
1466
+ });
1467
+ }