opencode-agent-orchestration-kit 1.0.27 → 1.0.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/check.yml +48 -3
- package/.github/workflows/compatibility-canary.yml +28 -0
- package/README.md +9 -6
- package/compatibility.json +19 -0
- package/docs/compatibility.md +84 -0
- package/docs/installation.md +5 -1
- package/docs/quickstart.md +1 -1
- package/docs/releases/v1.0.28.md +71 -0
- package/docs/superpowers/plans/2026-07-21-compatibility-matrix.md +1286 -0
- package/docs/superpowers/specs/2026-07-21-compatibility-matrix-design.md +452 -0
- package/opencode/package-lock.json +6 -3
- package/opencode/package.json +3 -0
- package/package.json +5 -1
- package/scripts/check-compatibility.mjs +623 -0
- package/scripts/check-compatibility.test.mjs +1271 -0
- package/scripts/check.sh +7 -1
- package/scripts/opencode-compat-smoke.sh +174 -0
- package/scripts/version.mjs +18 -5
- package/scripts/version.test.mjs +53 -3
|
@@ -0,0 +1,1286 @@
|
|
|
1
|
+
# Slice 1.4 Compatibility Matrix Implementation Plan
|
|
2
|
+
|
|
3
|
+
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
|
|
4
|
+
|
|
5
|
+
**Goal:** Publish and mechanically enforce an evidence-backed compatibility contract for Node.js, OpenCode, the plugin SDK, operating systems, and optional integrations.
|
|
6
|
+
|
|
7
|
+
**Architecture:** A small root `compatibility.json` is the canonical machine-readable contract. A dependency-free Node.js checker validates that package manifests, documentation, blocking CI, the isolated OpenCode boundary smoke, and the separate latest canary agree with that contract. Blocking jobs prove the supported Node/OpenCode boundaries; a scheduled/manual workflow observes moving upstream `latest` without changing release readiness.
|
|
8
|
+
|
|
9
|
+
**Tech Stack:** Node.js 22/24 ESM, `node:test`, Bash, npm, OpenCode CLI, GitHub Actions YAML, Markdown, JSON.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Approved inputs and boundaries
|
|
14
|
+
|
|
15
|
+
- Design spec: `docs/superpowers/specs/2026-07-21-compatibility-matrix-design.md`.
|
|
16
|
+
- Public repository only; run every relative command from its root.
|
|
17
|
+
- The active private OpenCode config remains read-only and out of scope.
|
|
18
|
+
- Current public base before implementation: `713f712`, four commits ahead of
|
|
19
|
+
`origin/master` including the prerequisite advisory fix and approved spec.
|
|
20
|
+
- Do not update the canonical kit version, OpenCode SDK pins, OpenTUI pins,
|
|
21
|
+
Superpowers reference, Docker pins, or remaining low-severity advisories.
|
|
22
|
+
- Do not push, tag, create a GitHub Release, or publish npm during this plan.
|
|
23
|
+
- The normal public leak scan remains mandatory before every handoff.
|
|
24
|
+
|
|
25
|
+
## File responsibility map
|
|
26
|
+
|
|
27
|
+
| File | Responsibility |
|
|
28
|
+
|---|---|
|
|
29
|
+
| `compatibility.json` | Canonical Node/OpenCode/SDK compatibility values only |
|
|
30
|
+
| `scripts/check-compatibility.mjs` | Pure, offline consistency validator for committed compatibility surfaces |
|
|
31
|
+
| `scripts/check-compatibility.test.mjs` | Fixture-based schema, drift, workflow, docs, and smoke-wrapper regression tests |
|
|
32
|
+
| `scripts/opencode-compat-smoke.sh` | Credential-free isolated runtime smoke for one requested OpenCode version |
|
|
33
|
+
| `scripts/check.sh` | Fast entrypoint; requires and invokes the compatibility checker |
|
|
34
|
+
| `package.json` | Root Node engine contract and compatibility check script |
|
|
35
|
+
| `opencode/package.json` | Installed harness Node engine and exact SDK/OpenTUI pins |
|
|
36
|
+
| `opencode/package-lock.json` | Deterministic root-package engine metadata; no dependency-version changes |
|
|
37
|
+
| `docs/compatibility.md` | Complete human compatibility/status/evidence contract |
|
|
38
|
+
| `README.md` | Short user-facing summary and link to the full matrix |
|
|
39
|
+
| `docs/installation.md` | Versioned Node prerequisite and pointer to compatibility policy |
|
|
40
|
+
| `.github/workflows/check.yml` | Blocking OS/Node matrix and blocking OpenCode boundary job |
|
|
41
|
+
| `.github/workflows/compatibility-canary.yml` | Scheduled/manual Node 26 + OpenCode latest observation only |
|
|
42
|
+
|
|
43
|
+
## Task 0: Capture immutable pre-implementation baselines
|
|
44
|
+
|
|
45
|
+
**Files:**
|
|
46
|
+
|
|
47
|
+
- Modify: none; the baseline artifact lives inside the public checkout's local
|
|
48
|
+
Git directory and cannot be staged.
|
|
49
|
+
|
|
50
|
+
- [ ] **Step 1: Require the private-checkout input and verify both trees**
|
|
51
|
+
|
|
52
|
+
Run from the public repository root:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
: "${OAK_PRIVATE_CHECKOUT:?Set OAK_PRIVATE_CHECKOUT to the active private checkout}"
|
|
56
|
+
git status --short --branch
|
|
57
|
+
git -C "$OAK_PRIVATE_CHECKOUT" status --short --branch
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Expected: the public tree is clean and ahead only by the already approved local
|
|
61
|
+
commits; the private tree is clean. Stop rather than overwrite or hide any
|
|
62
|
+
unexpected dirty state.
|
|
63
|
+
|
|
64
|
+
- [ ] **Step 2: Persist the exact private SHA outside the working tree**
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
private_baseline_file="$(git rev-parse --git-path oak-slice-1-4-private-baseline)"
|
|
68
|
+
git -C "$OAK_PRIVATE_CHECKOUT" rev-parse HEAD | tee "$private_baseline_file"
|
|
69
|
+
test -s "$private_baseline_file"
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Expected: one full 40-character commit SHA is stored under `.git/`, never in a
|
|
73
|
+
tracked file. Every later private-checkout gate reads this exact artifact.
|
|
74
|
+
|
|
75
|
+
- [ ] **Step 3: Record the public baseline without changing it**
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
git rev-parse HEAD
|
|
79
|
+
git log --oneline origin/master..HEAD
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Expected: HEAD is the approved plan commit and the local-only commit list is
|
|
83
|
+
understood before implementation begins.
|
|
84
|
+
|
|
85
|
+
## Task 1: Add canonical compatibility data and schema validation
|
|
86
|
+
|
|
87
|
+
**Files:**
|
|
88
|
+
|
|
89
|
+
- Create: `compatibility.json`
|
|
90
|
+
- Create: `scripts/check-compatibility.mjs`
|
|
91
|
+
- Create: `scripts/check-compatibility.test.mjs`
|
|
92
|
+
- Modify: `scripts/check.sh:9-76`
|
|
93
|
+
- Modify: `package.json:7-18`
|
|
94
|
+
|
|
95
|
+
- [ ] **Step 1: Write the failing schema tests**
|
|
96
|
+
|
|
97
|
+
Create `scripts/check-compatibility.test.mjs` with a temporary-repository
|
|
98
|
+
fixture and the first three tests:
|
|
99
|
+
|
|
100
|
+
```js
|
|
101
|
+
import assert from "node:assert/strict";
|
|
102
|
+
import fs from "node:fs";
|
|
103
|
+
import os from "node:os";
|
|
104
|
+
import path from "node:path";
|
|
105
|
+
import test from "node:test";
|
|
106
|
+
|
|
107
|
+
import { checkCompatibility } from "./check-compatibility.mjs";
|
|
108
|
+
|
|
109
|
+
const VALID_COMPATIBILITY = {
|
|
110
|
+
schema_version: 1,
|
|
111
|
+
node: {
|
|
112
|
+
engines: "^22.9.0 || ^24.0.0",
|
|
113
|
+
blocking_majors: [22, 24],
|
|
114
|
+
canary_major: 26,
|
|
115
|
+
},
|
|
116
|
+
opencode: {
|
|
117
|
+
supported_range: ">=1.14.41 <2.0.0",
|
|
118
|
+
minimum_tested: "1.14.41",
|
|
119
|
+
stable_tested: "1.18.4",
|
|
120
|
+
canary: "latest",
|
|
121
|
+
},
|
|
122
|
+
sdk: {
|
|
123
|
+
opencode_plugin: "1.14.41",
|
|
124
|
+
opentui_core: "0.2.5",
|
|
125
|
+
opentui_solid: "0.2.5",
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
function writeJson(root, relative, value) {
|
|
130
|
+
const full = path.join(root, relative);
|
|
131
|
+
fs.mkdirSync(path.dirname(full), { recursive: true });
|
|
132
|
+
fs.writeFileSync(full, `${JSON.stringify(value, null, 2)}\n`);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function makeFixture(t, compatibility = VALID_COMPATIBILITY) {
|
|
136
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "oak-compat-test-"));
|
|
137
|
+
t.after(() => fs.rmSync(root, { recursive: true, force: true }));
|
|
138
|
+
writeJson(root, "compatibility.json", compatibility);
|
|
139
|
+
return root;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
test("valid canonical compatibility schema is accepted", (t) => {
|
|
143
|
+
const root = makeFixture(t);
|
|
144
|
+
assert.equal(checkCompatibility(root, { surfaces: false }).schema_version, 1);
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
test("unknown compatibility schema versions are rejected", (t) => {
|
|
148
|
+
const root = makeFixture(t, { ...VALID_COMPATIBILITY, schema_version: 2 });
|
|
149
|
+
assert.throws(
|
|
150
|
+
() => checkCompatibility(root, { surfaces: false }),
|
|
151
|
+
/schema_version must be 1/,
|
|
152
|
+
);
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
test("non-canonical OpenCode boundaries are rejected", (t) => {
|
|
156
|
+
const root = makeFixture(t, {
|
|
157
|
+
...VALID_COMPATIBILITY,
|
|
158
|
+
opencode: { ...VALID_COMPATIBILITY.opencode, minimum_tested: "v1.14.41" },
|
|
159
|
+
});
|
|
160
|
+
assert.throws(
|
|
161
|
+
() => checkCompatibility(root, { surfaces: false }),
|
|
162
|
+
/minimum_tested must use MAJOR.MINOR.PATCH/,
|
|
163
|
+
);
|
|
164
|
+
});
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
The `surfaces: false` option is test-only API for validating the canonical
|
|
168
|
+
object before the dependent files exist. It must never weaken the default CLI.
|
|
169
|
+
|
|
170
|
+
- [ ] **Step 2: Run the test and verify the intended red state**
|
|
171
|
+
|
|
172
|
+
Run:
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
node --test scripts/check-compatibility.test.mjs
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
Expected: FAIL because `scripts/check-compatibility.mjs` does not exist.
|
|
179
|
+
|
|
180
|
+
- [ ] **Step 3: Add the canonical JSON file**
|
|
181
|
+
|
|
182
|
+
Create `compatibility.json` with exactly:
|
|
183
|
+
|
|
184
|
+
```json
|
|
185
|
+
{
|
|
186
|
+
"schema_version": 1,
|
|
187
|
+
"node": {
|
|
188
|
+
"engines": "^22.9.0 || ^24.0.0",
|
|
189
|
+
"blocking_majors": [22, 24],
|
|
190
|
+
"canary_major": 26
|
|
191
|
+
},
|
|
192
|
+
"opencode": {
|
|
193
|
+
"supported_range": ">=1.14.41 <2.0.0",
|
|
194
|
+
"minimum_tested": "1.14.41",
|
|
195
|
+
"stable_tested": "1.18.4",
|
|
196
|
+
"canary": "latest"
|
|
197
|
+
},
|
|
198
|
+
"sdk": {
|
|
199
|
+
"opencode_plugin": "1.14.41",
|
|
200
|
+
"opentui_core": "0.2.5",
|
|
201
|
+
"opentui_solid": "0.2.5"
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
- [ ] **Step 4: Implement minimal safe schema parsing**
|
|
207
|
+
|
|
208
|
+
Create `scripts/check-compatibility.mjs`. Use `parseStableVersion` and
|
|
209
|
+
`compareStableVersions` from `scripts/version.mjs`; do not add a semver
|
|
210
|
+
dependency.
|
|
211
|
+
|
|
212
|
+
```js
|
|
213
|
+
#!/usr/bin/env node
|
|
214
|
+
|
|
215
|
+
import fs from "node:fs";
|
|
216
|
+
import path from "node:path";
|
|
217
|
+
import { fileURLToPath } from "node:url";
|
|
218
|
+
|
|
219
|
+
import { compareStableVersions, parseStableVersion } from "./version.mjs";
|
|
220
|
+
|
|
221
|
+
const SCRIPT_PATH = fileURLToPath(import.meta.url);
|
|
222
|
+
const REPOSITORY_ROOT = path.dirname(path.dirname(SCRIPT_PATH));
|
|
223
|
+
const EXACT_KEYS = {
|
|
224
|
+
root: ["schema_version", "node", "opencode", "sdk"],
|
|
225
|
+
node: ["engines", "blocking_majors", "canary_major"],
|
|
226
|
+
opencode: ["supported_range", "minimum_tested", "stable_tested", "canary"],
|
|
227
|
+
sdk: ["opencode_plugin", "opentui_core", "opentui_solid"],
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
function invalid(message) {
|
|
231
|
+
const error = new Error(message);
|
|
232
|
+
error.code = "INVALID_COMPATIBILITY";
|
|
233
|
+
return error;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
function assertExactKeys(value, expected, label) {
|
|
237
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
238
|
+
throw invalid(`${label} must be an object`);
|
|
239
|
+
}
|
|
240
|
+
const actual = Object.keys(value).sort();
|
|
241
|
+
const wanted = [...expected].sort();
|
|
242
|
+
if (JSON.stringify(actual) !== JSON.stringify(wanted)) {
|
|
243
|
+
throw invalid(`${label} keys must be exactly: ${wanted.join(", ")}`);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
function readRegularText(root, relative, fsOps = fs) {
|
|
248
|
+
const full = path.join(root, relative);
|
|
249
|
+
const stat = fsOps.lstatSync(full);
|
|
250
|
+
if (stat.isSymbolicLink() || !stat.isFile()) {
|
|
251
|
+
throw invalid(`${relative} must be a safe regular file`);
|
|
252
|
+
}
|
|
253
|
+
return fsOps.readFileSync(full, "utf8");
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
function readJson(root, relative, fsOps = fs) {
|
|
257
|
+
try {
|
|
258
|
+
return JSON.parse(readRegularText(root, relative, fsOps));
|
|
259
|
+
} catch (error) {
|
|
260
|
+
if (error.code === "INVALID_COMPATIBILITY") throw error;
|
|
261
|
+
throw invalid(`${relative} is invalid JSON: ${error.message}`);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
function validateCanonicalData(data) {
|
|
266
|
+
assertExactKeys(data, EXACT_KEYS.root, "compatibility");
|
|
267
|
+
assertExactKeys(data.node, EXACT_KEYS.node, "node");
|
|
268
|
+
assertExactKeys(data.opencode, EXACT_KEYS.opencode, "opencode");
|
|
269
|
+
assertExactKeys(data.sdk, EXACT_KEYS.sdk, "sdk");
|
|
270
|
+
if (data.schema_version !== 1) throw invalid("schema_version must be 1");
|
|
271
|
+
if (data.node.engines !== "^22.9.0 || ^24.0.0") {
|
|
272
|
+
throw invalid("node.engines must be ^22.9.0 || ^24.0.0");
|
|
273
|
+
}
|
|
274
|
+
if (JSON.stringify(data.node.blocking_majors) !== JSON.stringify([22, 24])) {
|
|
275
|
+
throw invalid("node.blocking_majors must be [22,24]");
|
|
276
|
+
}
|
|
277
|
+
if (data.node.canary_major !== 26) throw invalid("node.canary_major must be 26");
|
|
278
|
+
for (const field of ["minimum_tested", "stable_tested"]) {
|
|
279
|
+
try {
|
|
280
|
+
parseStableVersion(data.opencode[field]);
|
|
281
|
+
} catch {
|
|
282
|
+
throw invalid(`${field} must use MAJOR.MINOR.PATCH`);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
if (compareStableVersions(data.opencode.minimum_tested, data.opencode.stable_tested) >= 0) {
|
|
286
|
+
throw invalid("minimum_tested must be older than stable_tested");
|
|
287
|
+
}
|
|
288
|
+
if (data.opencode.supported_range !== `>=${data.opencode.minimum_tested} <2.0.0`) {
|
|
289
|
+
throw invalid("supported_range must begin at minimum_tested and end before 2.0.0");
|
|
290
|
+
}
|
|
291
|
+
if (data.opencode.canary !== "latest") throw invalid("opencode.canary must be latest");
|
|
292
|
+
for (const [field, value] of Object.entries(data.sdk)) {
|
|
293
|
+
try {
|
|
294
|
+
parseStableVersion(value);
|
|
295
|
+
} catch {
|
|
296
|
+
throw invalid(`sdk.${field} must use MAJOR.MINOR.PATCH`);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
return data;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
export function checkCompatibility(
|
|
303
|
+
repositoryRoot = REPOSITORY_ROOT,
|
|
304
|
+
{ fsOps = fs, surfaces = true } = {},
|
|
305
|
+
) {
|
|
306
|
+
const data = validateCanonicalData(readJson(repositoryRoot, "compatibility.json", fsOps));
|
|
307
|
+
if (surfaces) validateSurfaces(repositoryRoot, data, fsOps);
|
|
308
|
+
return data;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
function validateSurfaces() {
|
|
312
|
+
// Added incrementally by Tasks 2-7. The default CLI always calls this path.
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
if (path.resolve(process.argv[1] ?? "") === SCRIPT_PATH) {
|
|
316
|
+
try {
|
|
317
|
+
const data = checkCompatibility();
|
|
318
|
+
console.log(
|
|
319
|
+
`compatibility contract ok: Node ${data.node.blocking_majors.join("/")} OpenCode ${data.opencode.supported_range}`,
|
|
320
|
+
);
|
|
321
|
+
} catch (error) {
|
|
322
|
+
console.error(`compatibility contract invalid: ${error.message}`);
|
|
323
|
+
process.exitCode = 1;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
- [ ] **Step 5: Run the focused tests**
|
|
329
|
+
|
|
330
|
+
Run:
|
|
331
|
+
|
|
332
|
+
```bash
|
|
333
|
+
node --test scripts/check-compatibility.test.mjs
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
Expected: 3 tests pass, 0 fail.
|
|
337
|
+
|
|
338
|
+
- [ ] **Step 6: Wire the checker into the fast contract**
|
|
339
|
+
|
|
340
|
+
Add these required files to `scripts/check.sh`:
|
|
341
|
+
|
|
342
|
+
```text
|
|
343
|
+
compatibility.json
|
|
344
|
+
scripts/check-compatibility.mjs
|
|
345
|
+
scripts/check-compatibility.test.mjs
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
Immediately after `node scripts/version.mjs --check`, add:
|
|
349
|
+
|
|
350
|
+
```bash
|
|
351
|
+
node scripts/check-compatibility.mjs
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
Add the package script:
|
|
355
|
+
|
|
356
|
+
```json
|
|
357
|
+
"check:compatibility": "node scripts/check-compatibility.mjs"
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
- [ ] **Step 7: Run the fast contract and commit**
|
|
361
|
+
|
|
362
|
+
Run:
|
|
363
|
+
|
|
364
|
+
```bash
|
|
365
|
+
npm run check:compatibility
|
|
366
|
+
npm run contract-check
|
|
367
|
+
git diff --check
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
Expected: all exit 0 and print the compatibility/contract success lines.
|
|
371
|
+
|
|
372
|
+
Commit only these files:
|
|
373
|
+
|
|
374
|
+
```bash
|
|
375
|
+
git add compatibility.json package.json scripts/check.sh scripts/check-compatibility.mjs scripts/check-compatibility.test.mjs
|
|
376
|
+
git commit -m "feat: add canonical compatibility contract"
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
## Task 2: Enforce package engines and exact SDK pins
|
|
380
|
+
|
|
381
|
+
**Files:**
|
|
382
|
+
|
|
383
|
+
- Modify: `scripts/check-compatibility.test.mjs`
|
|
384
|
+
- Modify: `scripts/check-compatibility.mjs`
|
|
385
|
+
- Modify: `package.json:1-20`
|
|
386
|
+
- Modify: `opencode/package.json:1-12`
|
|
387
|
+
- Modify: `opencode/package-lock.json:1-14`
|
|
388
|
+
|
|
389
|
+
- [ ] **Step 1: Extend the fixture with package manifests**
|
|
390
|
+
|
|
391
|
+
Have `makeFixture` write these minimal manifests whenever surface validation is
|
|
392
|
+
enabled:
|
|
393
|
+
|
|
394
|
+
```js
|
|
395
|
+
writeJson(root, "package.json", {
|
|
396
|
+
name: "opencode-agent-orchestration-kit",
|
|
397
|
+
engines: { node: VALID_COMPATIBILITY.node.engines },
|
|
398
|
+
});
|
|
399
|
+
writeJson(root, "opencode/package.json", {
|
|
400
|
+
engines: { node: VALID_COMPATIBILITY.node.engines },
|
|
401
|
+
dependencies: {
|
|
402
|
+
"@opencode-ai/plugin": VALID_COMPATIBILITY.sdk.opencode_plugin,
|
|
403
|
+
"@opentui/core": VALID_COMPATIBILITY.sdk.opentui_core,
|
|
404
|
+
"@opentui/solid": VALID_COMPATIBILITY.sdk.opentui_solid,
|
|
405
|
+
},
|
|
406
|
+
});
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
Add tests which independently change the root engine, packaged engine, plugin
|
|
410
|
+
pin, OpenTUI core pin, and OpenTUI solid pin, then expect an error naming the
|
|
411
|
+
drifting surface.
|
|
412
|
+
|
|
413
|
+
- [ ] **Step 2: Run the new tests and verify they fail**
|
|
414
|
+
|
|
415
|
+
Run:
|
|
416
|
+
|
|
417
|
+
```bash
|
|
418
|
+
node --test --test-name-pattern='engine|SDK|OpenTUI' scripts/check-compatibility.test.mjs
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
Expected: FAIL because package surfaces are not validated yet.
|
|
422
|
+
|
|
423
|
+
- [ ] **Step 3: Implement package-surface validation**
|
|
424
|
+
|
|
425
|
+
Add:
|
|
426
|
+
|
|
427
|
+
```js
|
|
428
|
+
function validatePackages(root, data, fsOps) {
|
|
429
|
+
const rootPackage = readJson(root, "package.json", fsOps);
|
|
430
|
+
const harnessPackage = readJson(root, "opencode/package.json", fsOps);
|
|
431
|
+
if (rootPackage.engines?.node !== data.node.engines) {
|
|
432
|
+
throw invalid("package.json engines.node drifted from compatibility.json");
|
|
433
|
+
}
|
|
434
|
+
if (harnessPackage.engines?.node !== data.node.engines) {
|
|
435
|
+
throw invalid("opencode/package.json engines.node drifted from compatibility.json");
|
|
436
|
+
}
|
|
437
|
+
const expected = {
|
|
438
|
+
"@opencode-ai/plugin": data.sdk.opencode_plugin,
|
|
439
|
+
"@opentui/core": data.sdk.opentui_core,
|
|
440
|
+
"@opentui/solid": data.sdk.opentui_solid,
|
|
441
|
+
};
|
|
442
|
+
for (const [name, version] of Object.entries(expected)) {
|
|
443
|
+
if (harnessPackage.dependencies?.[name] !== version) {
|
|
444
|
+
throw invalid(`opencode/package.json ${name} drifted from compatibility.json`);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
Call `validatePackages` first from `validateSurfaces`.
|
|
451
|
+
|
|
452
|
+
- [ ] **Step 4: Add the Node engine to both real manifests**
|
|
453
|
+
|
|
454
|
+
Use exactly:
|
|
455
|
+
|
|
456
|
+
```json
|
|
457
|
+
"engines": {
|
|
458
|
+
"node": "^22.9.0 || ^24.0.0"
|
|
459
|
+
}
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
Do not move the root canonical kit version and do not change any dependency
|
|
463
|
+
version.
|
|
464
|
+
|
|
465
|
+
- [ ] **Step 5: Refresh lock metadata without updating dependencies**
|
|
466
|
+
|
|
467
|
+
Run:
|
|
468
|
+
|
|
469
|
+
```bash
|
|
470
|
+
npm --prefix opencode install --package-lock-only --ignore-scripts
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
Inspect `opencode/package-lock.json`. The root package entry may gain the Node
|
|
474
|
+
engine; no `node_modules/*` version, resolved URL, or integrity may change.
|
|
475
|
+
|
|
476
|
+
Verify exact direct pins:
|
|
477
|
+
|
|
478
|
+
```bash
|
|
479
|
+
node - <<'NODE'
|
|
480
|
+
const lock = require('./opencode/package-lock.json')
|
|
481
|
+
const root = lock.packages['']
|
|
482
|
+
if (root.dependencies['@opencode-ai/plugin'] !== '1.14.41') process.exit(1)
|
|
483
|
+
if (root.dependencies['@opentui/core'] !== '0.2.5') process.exit(1)
|
|
484
|
+
if (root.dependencies['@opentui/solid'] !== '0.2.5') process.exit(1)
|
|
485
|
+
if (root.engines.node !== '^22.9.0 || ^24.0.0') process.exit(1)
|
|
486
|
+
NODE
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
- [ ] **Step 6: Run tests and commit**
|
|
490
|
+
|
|
491
|
+
Run:
|
|
492
|
+
|
|
493
|
+
```bash
|
|
494
|
+
node --test scripts/check-compatibility.test.mjs
|
|
495
|
+
npm run check:compatibility
|
|
496
|
+
npm run dependency-audit
|
|
497
|
+
git diff --check
|
|
498
|
+
```
|
|
499
|
+
|
|
500
|
+
Expected: all exit 0; audit reports only the already accepted low-severity
|
|
501
|
+
findings.
|
|
502
|
+
|
|
503
|
+
Commit:
|
|
504
|
+
|
|
505
|
+
```bash
|
|
506
|
+
git add package.json opencode/package.json opencode/package-lock.json scripts/check-compatibility.mjs scripts/check-compatibility.test.mjs
|
|
507
|
+
git commit -m "feat: declare supported Node engines"
|
|
508
|
+
```
|
|
509
|
+
|
|
510
|
+
## Task 3: Publish and validate the human compatibility matrix
|
|
511
|
+
|
|
512
|
+
**Files:**
|
|
513
|
+
|
|
514
|
+
- Create: `docs/compatibility.md`
|
|
515
|
+
- Modify: `README.md:229-237,758-765`
|
|
516
|
+
- Modify: `docs/installation.md:1-30`
|
|
517
|
+
- Modify: `scripts/check-compatibility.mjs`
|
|
518
|
+
- Modify: `scripts/check-compatibility.test.mjs`
|
|
519
|
+
|
|
520
|
+
- [ ] **Step 1: Add failing documentation contract tests**
|
|
521
|
+
|
|
522
|
+
Extend the fixture with README, installation, and compatibility documents. The
|
|
523
|
+
full matrix must sit between stable markers:
|
|
524
|
+
|
|
525
|
+
```markdown
|
|
526
|
+
<!-- compatibility-matrix:start -->
|
|
527
|
+
| Surface | Status | Contract |
|
|
528
|
+
|---|---|---|
|
|
529
|
+
| Node.js 22 | supported | ... |
|
|
530
|
+
<!-- compatibility-matrix:end -->
|
|
531
|
+
```
|
|
532
|
+
|
|
533
|
+
Add tests that:
|
|
534
|
+
|
|
535
|
+
1. replace `supported` with `supported boundary` and expect an unknown-status
|
|
536
|
+
failure;
|
|
537
|
+
2. change Node 26 to `tested`, Native Windows to `supported`, WSL2 to
|
|
538
|
+
`supported`, and each optional integration to `supported`; every mutation
|
|
539
|
+
must fail with the expected status for that exact surface;
|
|
540
|
+
3. remove the OpenCode supported range and expect a missing-range failure;
|
|
541
|
+
4. remove Node 22 or Node 24 and expect a missing-supported-line failure;
|
|
542
|
+
5. remove `WSL2`, `Native Windows`, or any optional integration and expect the
|
|
543
|
+
corresponding missing-boundary failure;
|
|
544
|
+
6. remove the README link to `docs/compatibility.md` and expect failure;
|
|
545
|
+
7. restore the unversioned installation text `Node.js and npm` and expect
|
|
546
|
+
failure.
|
|
547
|
+
|
|
548
|
+
- [ ] **Step 2: Run the documentation tests red**
|
|
549
|
+
|
|
550
|
+
Run:
|
|
551
|
+
|
|
552
|
+
```bash
|
|
553
|
+
node --test --test-name-pattern='documentation|status|README|installation' scripts/check-compatibility.test.mjs
|
|
554
|
+
```
|
|
555
|
+
|
|
556
|
+
Expected: FAIL because documentation validation is not implemented.
|
|
557
|
+
|
|
558
|
+
- [ ] **Step 3: Implement marker-scoped documentation validation**
|
|
559
|
+
|
|
560
|
+
Add:
|
|
561
|
+
|
|
562
|
+
```js
|
|
563
|
+
const STATUS_TERMS = new Set(["tested", "supported", "experimental", "unsupported"]);
|
|
564
|
+
const EXPECTED_MATRIX_STATUSES = new Map([
|
|
565
|
+
["Node.js 22", "supported"],
|
|
566
|
+
["Node.js 24", "supported"],
|
|
567
|
+
["Node.js 26", "experimental"],
|
|
568
|
+
["Node.js 20 and EOL/odd lines", "unsupported"],
|
|
569
|
+
["OpenCode 1.14.41", "tested"],
|
|
570
|
+
["OpenCode 1.18.4", "tested"],
|
|
571
|
+
["OpenCode >=1.14.41 <2.0.0", "supported"],
|
|
572
|
+
["OpenCode <1.14.41 or >=2.0.0", "unsupported"],
|
|
573
|
+
["@opencode-ai/plugin 1.14.41", "tested"],
|
|
574
|
+
["OpenTUI core/solid 0.2.5", "tested"],
|
|
575
|
+
["Ubuntu GitHub runner", "tested"],
|
|
576
|
+
["macOS GitHub runner", "tested"],
|
|
577
|
+
["Other mainstream Linux/macOS environments", "supported"],
|
|
578
|
+
["WSL2", "experimental"],
|
|
579
|
+
["Native Windows", "unsupported"],
|
|
580
|
+
["Token usage plugin", "experimental"],
|
|
581
|
+
["Open Design Docker adapter", "experimental"],
|
|
582
|
+
["Superpowers", "experimental"],
|
|
583
|
+
["Impeccable", "experimental"],
|
|
584
|
+
]);
|
|
585
|
+
|
|
586
|
+
function extractMarkedMatrix(text) {
|
|
587
|
+
const start = "<!-- compatibility-matrix:start -->";
|
|
588
|
+
const end = "<!-- compatibility-matrix:end -->";
|
|
589
|
+
const first = text.indexOf(start);
|
|
590
|
+
const last = text.indexOf(end);
|
|
591
|
+
if (first < 0 || last <= first) throw invalid("docs/compatibility.md matrix markers are missing");
|
|
592
|
+
return text.slice(first + start.length, last);
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
function validateDocumentation(root, data, fsOps) {
|
|
596
|
+
const docs = readRegularText(root, "docs/compatibility.md", fsOps);
|
|
597
|
+
const readme = readRegularText(root, "README.md", fsOps);
|
|
598
|
+
const installation = readRegularText(root, "docs/installation.md", fsOps);
|
|
599
|
+
const matrix = extractMarkedMatrix(docs);
|
|
600
|
+
const rows = new Map();
|
|
601
|
+
for (const line of matrix.split("\n")) {
|
|
602
|
+
if (!line.startsWith("|") || line.includes("---") || line.includes("Status")) continue;
|
|
603
|
+
const cells = line.split("|").map((cell) => cell.trim()).filter(Boolean);
|
|
604
|
+
if (cells.length >= 2 && !STATUS_TERMS.has(cells[1])) {
|
|
605
|
+
throw invalid(`unknown compatibility status: ${cells[1]}`);
|
|
606
|
+
}
|
|
607
|
+
if (cells.length >= 3) rows.set(cells[0].replaceAll("`", ""), cells[1]);
|
|
608
|
+
}
|
|
609
|
+
for (const [surface, expectedStatus] of EXPECTED_MATRIX_STATUSES) {
|
|
610
|
+
if (rows.get(surface) !== expectedStatus) {
|
|
611
|
+
throw invalid(`docs/compatibility.md must classify ${surface} as ${expectedStatus}`);
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
const requiredDocs = [
|
|
615
|
+
data.node.engines,
|
|
616
|
+
data.opencode.supported_range,
|
|
617
|
+
data.opencode.minimum_tested,
|
|
618
|
+
data.opencode.stable_tested,
|
|
619
|
+
"Node.js 22",
|
|
620
|
+
"Node.js 24",
|
|
621
|
+
"Node.js 26",
|
|
622
|
+
"WSL2",
|
|
623
|
+
"Native Windows",
|
|
624
|
+
"Token usage plugin",
|
|
625
|
+
"Open Design Docker adapter",
|
|
626
|
+
"Superpowers",
|
|
627
|
+
"Impeccable",
|
|
628
|
+
];
|
|
629
|
+
for (const token of requiredDocs) {
|
|
630
|
+
if (!matrix.includes(token) && !docs.includes(token)) {
|
|
631
|
+
throw invalid(`docs/compatibility.md must declare ${token}`);
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
if (!readme.includes("docs/compatibility.md")) {
|
|
635
|
+
throw invalid("README.md must link docs/compatibility.md");
|
|
636
|
+
}
|
|
637
|
+
if (!installation.includes(data.node.engines)) {
|
|
638
|
+
throw invalid("docs/installation.md must declare the canonical Node engine");
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
```
|
|
642
|
+
|
|
643
|
+
Call it after package validation.
|
|
644
|
+
|
|
645
|
+
- [ ] **Step 4: Write `docs/compatibility.md`**
|
|
646
|
+
|
|
647
|
+
Use the approved design's initial public matrix verbatim, but add:
|
|
648
|
+
|
|
649
|
+
- the four exact status definitions;
|
|
650
|
+
- a dated evidence section separating local evidence from blocking CI;
|
|
651
|
+
- the exact Node engine and OpenCode supported range;
|
|
652
|
+
- the SDK/OpenTUI pin table;
|
|
653
|
+
- promotion instructions: update `stable_tested`, run both boundary smokes,
|
|
654
|
+
update docs, review, and never let the canary rewrite files;
|
|
655
|
+
- the fact that provider compatibility is out of scope;
|
|
656
|
+
- the canary failure interpretation;
|
|
657
|
+
- the two matrix markers shown above.
|
|
658
|
+
|
|
659
|
+
Do not claim remote matrix jobs have passed before they actually run. Before
|
|
660
|
+
remote evidence exists, label those combinations as the blocking policy and
|
|
661
|
+
keep the exact evidence subsection honest about what was locally observed.
|
|
662
|
+
|
|
663
|
+
- [ ] **Step 5: Update README and installation docs**
|
|
664
|
+
|
|
665
|
+
Replace the unversioned quick-start requirement with:
|
|
666
|
+
|
|
667
|
+
```markdown
|
|
668
|
+
- Node.js `^22.9.0 || ^24.0.0` and npm
|
|
669
|
+
```
|
|
670
|
+
|
|
671
|
+
Replace the README compatibility section with a short summary naming Node 22
|
|
672
|
+
and 24, OpenCode `>=1.14.41 <2.0.0`, WSL2 experimental, native Windows
|
|
673
|
+
unsupported, and link `docs/compatibility.md` for evidence/status details.
|
|
674
|
+
|
|
675
|
+
Add the same canonical Node prerequisite and link near the start of
|
|
676
|
+
`docs/installation.md`.
|
|
677
|
+
|
|
678
|
+
- [ ] **Step 6: Run tests and commit**
|
|
679
|
+
|
|
680
|
+
Run:
|
|
681
|
+
|
|
682
|
+
```bash
|
|
683
|
+
node --test scripts/check-compatibility.test.mjs
|
|
684
|
+
npm run check:compatibility
|
|
685
|
+
npm run contract-check
|
|
686
|
+
git diff --check
|
|
687
|
+
```
|
|
688
|
+
|
|
689
|
+
Expected: all exit 0.
|
|
690
|
+
|
|
691
|
+
Commit:
|
|
692
|
+
|
|
693
|
+
```bash
|
|
694
|
+
git add docs/compatibility.md README.md docs/installation.md scripts/check-compatibility.mjs scripts/check-compatibility.test.mjs
|
|
695
|
+
git commit -m "docs: publish compatibility matrix"
|
|
696
|
+
```
|
|
697
|
+
|
|
698
|
+
## Task 4: Expand blocking Node and OS CI
|
|
699
|
+
|
|
700
|
+
**Files:**
|
|
701
|
+
|
|
702
|
+
- Modify: `.github/workflows/check.yml`
|
|
703
|
+
- Modify: `scripts/check-compatibility.mjs`
|
|
704
|
+
- Modify: `scripts/check-compatibility.test.mjs`
|
|
705
|
+
|
|
706
|
+
- [ ] **Step 1: Add failing blocking-matrix tests**
|
|
707
|
+
|
|
708
|
+
Write a fixture workflow using a `strategy.matrix.include` list. Add tests that
|
|
709
|
+
remove or add a pair and assert that only these exact blocking combinations are
|
|
710
|
+
accepted:
|
|
711
|
+
|
|
712
|
+
```text
|
|
713
|
+
ubuntu-latest / 22 / canonical=false
|
|
714
|
+
ubuntu-latest / 24 / canonical=true
|
|
715
|
+
macos-latest / 24 / canonical=false
|
|
716
|
+
```
|
|
717
|
+
|
|
718
|
+
Also test that:
|
|
719
|
+
|
|
720
|
+
- `fail-fast` is false;
|
|
721
|
+
- tag validation and dependency audit are guarded by `matrix.canonical`;
|
|
722
|
+
- each matrix job runs install, contract/tests, typecheck, and installation
|
|
723
|
+
smoke;
|
|
724
|
+
- the workflow has no write permission or publish command.
|
|
725
|
+
|
|
726
|
+
- [ ] **Step 2: Run the matrix tests red**
|
|
727
|
+
|
|
728
|
+
Run:
|
|
729
|
+
|
|
730
|
+
```bash
|
|
731
|
+
node --test --test-name-pattern='blocking matrix|canonical job' scripts/check-compatibility.test.mjs
|
|
732
|
+
```
|
|
733
|
+
|
|
734
|
+
Expected: FAIL against the current single Ubuntu/Node 24 job.
|
|
735
|
+
|
|
736
|
+
- [ ] **Step 3: Implement narrow workflow parsing**
|
|
737
|
+
|
|
738
|
+
Do not add a YAML dependency. Parse only the deliberately stable compatibility
|
|
739
|
+
markers added to the workflow:
|
|
740
|
+
|
|
741
|
+
```yaml
|
|
742
|
+
# compatibility-blocking:start
|
|
743
|
+
strategy:
|
|
744
|
+
fail-fast: false
|
|
745
|
+
matrix:
|
|
746
|
+
include:
|
|
747
|
+
- os: ubuntu-latest
|
|
748
|
+
node: 22
|
|
749
|
+
canonical: false
|
|
750
|
+
- os: ubuntu-latest
|
|
751
|
+
node: 24
|
|
752
|
+
canonical: true
|
|
753
|
+
- os: macos-latest
|
|
754
|
+
node: 24
|
|
755
|
+
canonical: false
|
|
756
|
+
# compatibility-blocking:end
|
|
757
|
+
```
|
|
758
|
+
|
|
759
|
+
Reuse a generic `extractMarkedSection(text, start, end)` helper. Parse each
|
|
760
|
+
three-line entry with a strict regular expression and compare the normalized
|
|
761
|
+
array to the expected combinations derived from `blocking_majors` plus the
|
|
762
|
+
approved macOS representative.
|
|
763
|
+
|
|
764
|
+
- [ ] **Step 4: Convert the blocking workflow**
|
|
765
|
+
|
|
766
|
+
Keep the existing triggers and read-only permissions. Change `runs-on` and
|
|
767
|
+
setup-node to matrix values:
|
|
768
|
+
|
|
769
|
+
```yaml
|
|
770
|
+
runs-on: ${{ matrix.os }}
|
|
771
|
+
strategy:
|
|
772
|
+
fail-fast: false
|
|
773
|
+
matrix:
|
|
774
|
+
include: # exact entries above
|
|
775
|
+
```
|
|
776
|
+
|
|
777
|
+
Add a first evidence step:
|
|
778
|
+
|
|
779
|
+
```yaml
|
|
780
|
+
- name: Report runtime evidence
|
|
781
|
+
run: |
|
|
782
|
+
uname -a || true
|
|
783
|
+
node --version
|
|
784
|
+
npm --version
|
|
785
|
+
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']}))"
|
|
786
|
+
```
|
|
787
|
+
|
|
788
|
+
Use these guards:
|
|
789
|
+
|
|
790
|
+
```yaml
|
|
791
|
+
if: matrix.canonical && startsWith(github.ref, 'refs/tags/')
|
|
792
|
+
```
|
|
793
|
+
|
|
794
|
+
for tag validation, and:
|
|
795
|
+
|
|
796
|
+
```yaml
|
|
797
|
+
if: matrix.canonical
|
|
798
|
+
```
|
|
799
|
+
|
|
800
|
+
for dependency audit. All other current checks run in every matrix job.
|
|
801
|
+
|
|
802
|
+
- [ ] **Step 5: Run local contract tests and commit**
|
|
803
|
+
|
|
804
|
+
Run:
|
|
805
|
+
|
|
806
|
+
```bash
|
|
807
|
+
node --test scripts/check-compatibility.test.mjs
|
|
808
|
+
npm run check:compatibility
|
|
809
|
+
npm run check
|
|
810
|
+
git diff --check
|
|
811
|
+
```
|
|
812
|
+
|
|
813
|
+
Expected: local tests pass. Do not claim the remote Node 22/macOS jobs pass
|
|
814
|
+
until a later authorized push produces GitHub Actions evidence.
|
|
815
|
+
|
|
816
|
+
Commit:
|
|
817
|
+
|
|
818
|
+
```bash
|
|
819
|
+
git add .github/workflows/check.yml scripts/check-compatibility.mjs scripts/check-compatibility.test.mjs
|
|
820
|
+
git commit -m "ci: test supported Node and OS matrix"
|
|
821
|
+
```
|
|
822
|
+
|
|
823
|
+
## Task 5: Build the isolated OpenCode compatibility smoke
|
|
824
|
+
|
|
825
|
+
**Files:**
|
|
826
|
+
|
|
827
|
+
- Create: `scripts/opencode-compat-smoke.sh`
|
|
828
|
+
- Modify: `scripts/check-compatibility.test.mjs`
|
|
829
|
+
- Modify: `scripts/check.sh`
|
|
830
|
+
|
|
831
|
+
- [ ] **Step 1: Write a fake-CLI isolation test**
|
|
832
|
+
|
|
833
|
+
Extend the test fixture with a decoy root `agents/lead.md` using `mode: all`, a
|
|
834
|
+
packaged `opencode/agents/lead.md` using `mode: primary`, and fake `npm`/`npx`
|
|
835
|
+
executables placed first in `PATH`. The fake `npm` must verify the isolated
|
|
836
|
+
HOME/XDG/npm-cache values and accept only `ci --ignore-scripts` for the copied
|
|
837
|
+
config. The fake `npx` must:
|
|
838
|
+
|
|
839
|
+
- fail if a test-only inherited provider-token sentinel is present;
|
|
840
|
+
- fail if HOME or any XDG/npm cache path is outside one shared temp root;
|
|
841
|
+
- return the requested version for `opencode --version`;
|
|
842
|
+
- return `{"name":"lead","mode":"primary"}` for
|
|
843
|
+
`opencode debug agent lead --pure`, but only when
|
|
844
|
+
`$OPENCODE_CONFIG_DIR/agents/lead.md` is the packaged primary agent.
|
|
845
|
+
|
|
846
|
+
The test invokes the real shell script with an inherited fake secret and
|
|
847
|
+
asserts success. Add independent negative tests where the fake CLI returns the
|
|
848
|
+
wrong version, omits the lead agent, or prints the original repository path.
|
|
849
|
+
|
|
850
|
+
Use the working-tree copy behavior as an oracle: after running, the fake CLI's
|
|
851
|
+
`OPENCODE_CONFIG_DIR` must not equal or resolve under the fixture checkout, the
|
|
852
|
+
packaged lead must exist directly below it, and a nested
|
|
853
|
+
`OPENCODE_CONFIG_DIR/opencode/agents/lead.md` must not exist. This negative
|
|
854
|
+
decoy proves the script copies `root/opencode`, not the repository root.
|
|
855
|
+
|
|
856
|
+
- [ ] **Step 2: Run the smoke-wrapper tests red**
|
|
857
|
+
|
|
858
|
+
Run:
|
|
859
|
+
|
|
860
|
+
```bash
|
|
861
|
+
node --test --test-name-pattern='OpenCode compatibility smoke' scripts/check-compatibility.test.mjs
|
|
862
|
+
```
|
|
863
|
+
|
|
864
|
+
Expected: FAIL because `scripts/opencode-compat-smoke.sh` does not exist.
|
|
865
|
+
|
|
866
|
+
- [ ] **Step 3: Implement the shell wrapper**
|
|
867
|
+
|
|
868
|
+
Create an executable Bash script with these boundaries:
|
|
869
|
+
|
|
870
|
+
```bash
|
|
871
|
+
#!/usr/bin/env bash
|
|
872
|
+
set -euo pipefail
|
|
873
|
+
|
|
874
|
+
root="$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)"
|
|
875
|
+
version="${1:-}"
|
|
876
|
+
test "$#" -eq 1 || { echo "usage: $0 <MAJOR.MINOR.PATCH|latest>" >&2; exit 2; }
|
|
877
|
+
if test "$version" != latest; then
|
|
878
|
+
node -e 'if (!/^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$/.test(process.argv[1])) process.exit(1)' "$version" \
|
|
879
|
+
|| { echo "invalid OpenCode version: $version" >&2; exit 2; }
|
|
880
|
+
fi
|
|
881
|
+
|
|
882
|
+
smoke_parent="${TMPDIR:-/tmp}"
|
|
883
|
+
smoke_parent="${smoke_parent%/}"
|
|
884
|
+
smoke_root="$(mktemp -d "$smoke_parent/oak-opencode-compat.XXXXXX")"
|
|
885
|
+
original_home="${HOME:-}"
|
|
886
|
+
|
|
887
|
+
cleanup() {
|
|
888
|
+
case "$smoke_root" in
|
|
889
|
+
"$smoke_parent"/oak-opencode-compat.*) rm -rf -- "$smoke_root" ;;
|
|
890
|
+
*) echo "Refusing unsafe smoke cleanup: $smoke_root" >&2; return 1 ;;
|
|
891
|
+
esac
|
|
892
|
+
}
|
|
893
|
+
trap cleanup EXIT
|
|
894
|
+
|
|
895
|
+
for dir in home config data cache state npm; do
|
|
896
|
+
mkdir -p "$smoke_root/$dir"
|
|
897
|
+
done
|
|
898
|
+
```
|
|
899
|
+
|
|
900
|
+
Copy exactly `"$root/opencode"` to the initially absent
|
|
901
|
+
`"$smoke_root/config/opencode"` with an inline Node script. Never pass `$root`
|
|
902
|
+
as the source. Reject symlinks and skip any path component named `node_modules`
|
|
903
|
+
or `.oak`:
|
|
904
|
+
|
|
905
|
+
```bash
|
|
906
|
+
node --input-type=module - "$root/opencode" "$smoke_root/config/opencode" <<'NODE'
|
|
907
|
+
import fs from "node:fs";
|
|
908
|
+
import path from "node:path";
|
|
909
|
+
const [source, target] = process.argv.slice(2);
|
|
910
|
+
fs.cpSync(source, target, {
|
|
911
|
+
recursive: true,
|
|
912
|
+
filter(current) {
|
|
913
|
+
const relative = path.relative(source, current);
|
|
914
|
+
if (relative.split(path.sep).some((part) => part === "node_modules" || part === ".oak")) return false;
|
|
915
|
+
if (fs.lstatSync(current).isSymbolicLink()) throw new Error(`source symlink is not allowed: ${relative}`);
|
|
916
|
+
return true;
|
|
917
|
+
},
|
|
918
|
+
});
|
|
919
|
+
NODE
|
|
920
|
+
|
|
921
|
+
test -f "$smoke_root/config/opencode/agents/lead.md"
|
|
922
|
+
test ! -e "$smoke_root/config/opencode/opencode"
|
|
923
|
+
```
|
|
924
|
+
|
|
925
|
+
Run the temporary dependency install and every CLI call through exactly this
|
|
926
|
+
allowlist:
|
|
927
|
+
|
|
928
|
+
```bash
|
|
929
|
+
run_isolated() {
|
|
930
|
+
env -i \
|
|
931
|
+
PATH="$PATH" \
|
|
932
|
+
HOME="$smoke_root/home" \
|
|
933
|
+
XDG_CONFIG_HOME="$smoke_root/config" \
|
|
934
|
+
XDG_DATA_HOME="$smoke_root/data" \
|
|
935
|
+
XDG_CACHE_HOME="$smoke_root/cache" \
|
|
936
|
+
XDG_STATE_HOME="$smoke_root/state" \
|
|
937
|
+
npm_config_cache="$smoke_root/npm" \
|
|
938
|
+
OPENCODE_CONFIG_DIR="$smoke_root/config/opencode" \
|
|
939
|
+
"$@"
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
run_isolated npm --prefix "$smoke_root/config/opencode" ci --ignore-scripts >/dev/null
|
|
943
|
+
|
|
944
|
+
run_opencode() {
|
|
945
|
+
run_isolated npx --yes --package "opencode-ai@$version" opencode "$@"
|
|
946
|
+
}
|
|
947
|
+
```
|
|
948
|
+
|
|
949
|
+
The temp `npm ci` is required because the shipped tools import
|
|
950
|
+
`@opencode-ai/plugin` while OpenCode resolves the agent. It must install only
|
|
951
|
+
inside the copied config and use the isolated npm cache; neither the source
|
|
952
|
+
checkout nor the operator's npm config may be modified or read.
|
|
953
|
+
|
|
954
|
+
Capture `run_opencode --version`, require an exact match for a concrete version
|
|
955
|
+
and canonical `MAJOR.MINOR.PATCH` for `latest`. Capture
|
|
956
|
+
`run_opencode debug agent lead --pure`, parse it as JSON with Node, and require
|
|
957
|
+
`name === "lead"` and `mode === "primary"`.
|
|
958
|
+
|
|
959
|
+
Search both captured outputs for non-empty `$original_home` and `$root`; either
|
|
960
|
+
match is a failure. Finish with:
|
|
961
|
+
|
|
962
|
+
```text
|
|
963
|
+
opencode compatibility smoke ok: requested=<request> resolved=<actual>
|
|
964
|
+
```
|
|
965
|
+
|
|
966
|
+
Do not print the agent JSON, environment, npm config, or temp paths.
|
|
967
|
+
|
|
968
|
+
- [ ] **Step 4: Register executable/required-file contracts**
|
|
969
|
+
|
|
970
|
+
Add `scripts/opencode-compat-smoke.sh` to `required_files` and the executable
|
|
971
|
+
loop in `scripts/check.sh`.
|
|
972
|
+
|
|
973
|
+
- [ ] **Step 5: Run fake and real focused smokes**
|
|
974
|
+
|
|
975
|
+
Run:
|
|
976
|
+
|
|
977
|
+
```bash
|
|
978
|
+
node --test scripts/check-compatibility.test.mjs
|
|
979
|
+
bash scripts/opencode-compat-smoke.sh 1.14.41
|
|
980
|
+
bash scripts/opencode-compat-smoke.sh 1.18.4
|
|
981
|
+
git diff --check
|
|
982
|
+
```
|
|
983
|
+
|
|
984
|
+
Expected: all exit 0; each live smoke prints only its one success line. If npm
|
|
985
|
+
or OpenCode emits unavoidable non-secret diagnostics on stderr, document the
|
|
986
|
+
exact output instead of weakening the stdout/privacy assertions.
|
|
987
|
+
|
|
988
|
+
- [ ] **Step 6: Commit**
|
|
989
|
+
|
|
990
|
+
```bash
|
|
991
|
+
git add scripts/opencode-compat-smoke.sh scripts/check.sh scripts/check-compatibility.test.mjs
|
|
992
|
+
git commit -m "test: add isolated OpenCode compatibility smoke"
|
|
993
|
+
```
|
|
994
|
+
|
|
995
|
+
## Task 6: Add blocking OpenCode boundary evidence
|
|
996
|
+
|
|
997
|
+
**Files:**
|
|
998
|
+
|
|
999
|
+
- Modify: `.github/workflows/check.yml`
|
|
1000
|
+
- Modify: `scripts/check-compatibility.mjs`
|
|
1001
|
+
- Modify: `scripts/check-compatibility.test.mjs`
|
|
1002
|
+
|
|
1003
|
+
- [ ] **Step 1: Add failing boundary-job tests**
|
|
1004
|
+
|
|
1005
|
+
Between workflow markers `# opencode-boundaries:start` and
|
|
1006
|
+
`# opencode-boundaries:end`, require a separate `opencode-compatibility` job
|
|
1007
|
+
with:
|
|
1008
|
+
|
|
1009
|
+
```yaml
|
|
1010
|
+
runs-on: ubuntu-latest
|
|
1011
|
+
strategy:
|
|
1012
|
+
fail-fast: false
|
|
1013
|
+
matrix:
|
|
1014
|
+
opencode:
|
|
1015
|
+
- "1.14.41"
|
|
1016
|
+
- "1.18.4"
|
|
1017
|
+
```
|
|
1018
|
+
|
|
1019
|
+
Add tests removing each version, changing Node 24, dropping `--pure` indirectly
|
|
1020
|
+
by changing the invoked script, or replacing the isolated script with the
|
|
1021
|
+
operator's `opencode` binary.
|
|
1022
|
+
|
|
1023
|
+
- [ ] **Step 2: Run boundary tests red**
|
|
1024
|
+
|
|
1025
|
+
Run:
|
|
1026
|
+
|
|
1027
|
+
```bash
|
|
1028
|
+
node --test --test-name-pattern='OpenCode boundary job' scripts/check-compatibility.test.mjs
|
|
1029
|
+
```
|
|
1030
|
+
|
|
1031
|
+
Expected: FAIL because the job is absent.
|
|
1032
|
+
|
|
1033
|
+
- [ ] **Step 3: Add checker enforcement**
|
|
1034
|
+
|
|
1035
|
+
Parse the marker-scoped job and require:
|
|
1036
|
+
|
|
1037
|
+
- Node `24` through `actions/setup-node`;
|
|
1038
|
+
- the exact sorted version list from `minimum_tested` and `stable_tested`;
|
|
1039
|
+
- `bash scripts/opencode-compat-smoke.sh "${{ matrix.opencode }}"`;
|
|
1040
|
+
- read-only permissions inherited from the workflow;
|
|
1041
|
+
- no `continue-on-error`, publication, credentials, or provider secrets.
|
|
1042
|
+
|
|
1043
|
+
- [ ] **Step 4: Add the blocking job**
|
|
1044
|
+
|
|
1045
|
+
The job needs only checkout, setup-node 24, and the smoke call. Do not add a
|
|
1046
|
+
checkout-level `npm ci`: the smoke itself must run `npm ci --ignore-scripts`
|
|
1047
|
+
inside its temporary copy to install the harness package dependencies, then
|
|
1048
|
+
install the requested CLI through the same isolated npm cache. Add a
|
|
1049
|
+
version-report step only if it does not duplicate or expose the captured agent
|
|
1050
|
+
output.
|
|
1051
|
+
|
|
1052
|
+
- [ ] **Step 5: Run local checks and commit**
|
|
1053
|
+
|
|
1054
|
+
```bash
|
|
1055
|
+
node --test scripts/check-compatibility.test.mjs
|
|
1056
|
+
npm run check:compatibility
|
|
1057
|
+
npm run contract-check
|
|
1058
|
+
git diff --check
|
|
1059
|
+
```
|
|
1060
|
+
|
|
1061
|
+
Expected: all exit 0 locally. Remote boundary evidence remains pending until an
|
|
1062
|
+
authorized push.
|
|
1063
|
+
|
|
1064
|
+
Commit:
|
|
1065
|
+
|
|
1066
|
+
```bash
|
|
1067
|
+
git add .github/workflows/check.yml scripts/check-compatibility.mjs scripts/check-compatibility.test.mjs
|
|
1068
|
+
git commit -m "ci: verify supported OpenCode boundaries"
|
|
1069
|
+
```
|
|
1070
|
+
|
|
1071
|
+
## Task 7: Add the separate latest canary
|
|
1072
|
+
|
|
1073
|
+
**Files:**
|
|
1074
|
+
|
|
1075
|
+
- Create: `.github/workflows/compatibility-canary.yml`
|
|
1076
|
+
- Modify: `scripts/check-compatibility.mjs`
|
|
1077
|
+
- Modify: `scripts/check-compatibility.test.mjs`
|
|
1078
|
+
- Modify: `scripts/check.sh`
|
|
1079
|
+
|
|
1080
|
+
- [ ] **Step 1: Add failing canary-contract tests**
|
|
1081
|
+
|
|
1082
|
+
Add a valid fixture and negative cases for:
|
|
1083
|
+
|
|
1084
|
+
- missing `schedule`;
|
|
1085
|
+
- missing `workflow_dispatch`;
|
|
1086
|
+
- presence of `push` or `pull_request` triggers;
|
|
1087
|
+
- Node different from `canary_major` 26;
|
|
1088
|
+
- argument different from `opencode.canary` (`latest`);
|
|
1089
|
+
- write permissions;
|
|
1090
|
+
- publish, tag, issue creation, or dependency-update commands.
|
|
1091
|
+
|
|
1092
|
+
The canary is non-blocking because it has only schedule/manual triggers and is
|
|
1093
|
+
not a branch/tag required workflow. Do not add `continue-on-error`; a scheduled
|
|
1094
|
+
canary failure should remain visibly red in its own workflow.
|
|
1095
|
+
|
|
1096
|
+
- [ ] **Step 2: Run canary tests red**
|
|
1097
|
+
|
|
1098
|
+
Run:
|
|
1099
|
+
|
|
1100
|
+
```bash
|
|
1101
|
+
node --test --test-name-pattern='canary' scripts/check-compatibility.test.mjs
|
|
1102
|
+
```
|
|
1103
|
+
|
|
1104
|
+
Expected: FAIL because the canary workflow is absent.
|
|
1105
|
+
|
|
1106
|
+
- [ ] **Step 3: Implement canary checker rules**
|
|
1107
|
+
|
|
1108
|
+
Validate marker-scoped values instead of parsing general YAML. Require these
|
|
1109
|
+
literal declarations inside the canary markers:
|
|
1110
|
+
|
|
1111
|
+
```yaml
|
|
1112
|
+
node-version: 26
|
|
1113
|
+
run: bash scripts/opencode-compat-smoke.sh latest
|
|
1114
|
+
```
|
|
1115
|
+
|
|
1116
|
+
Validate the trigger and permission restrictions over the whole workflow.
|
|
1117
|
+
|
|
1118
|
+
- [ ] **Step 4: Create the canary workflow**
|
|
1119
|
+
|
|
1120
|
+
Use:
|
|
1121
|
+
|
|
1122
|
+
```yaml
|
|
1123
|
+
name: Compatibility Canary
|
|
1124
|
+
|
|
1125
|
+
on:
|
|
1126
|
+
workflow_dispatch:
|
|
1127
|
+
schedule:
|
|
1128
|
+
- cron: "17 6 * * 1"
|
|
1129
|
+
|
|
1130
|
+
permissions:
|
|
1131
|
+
contents: read
|
|
1132
|
+
|
|
1133
|
+
jobs:
|
|
1134
|
+
latest:
|
|
1135
|
+
runs-on: ubuntu-latest
|
|
1136
|
+
steps:
|
|
1137
|
+
- name: Checkout
|
|
1138
|
+
uses: actions/checkout@v4
|
|
1139
|
+
- name: Setup experimental Node
|
|
1140
|
+
uses: actions/setup-node@v4
|
|
1141
|
+
with:
|
|
1142
|
+
node-version: 26
|
|
1143
|
+
- name: Smoke latest OpenCode
|
|
1144
|
+
run: bash scripts/opencode-compat-smoke.sh latest
|
|
1145
|
+
```
|
|
1146
|
+
|
|
1147
|
+
Wrap the Node/run declarations in the stable canary markers expected by the
|
|
1148
|
+
checker. Do not add `push`, `pull_request`, secrets, caches outside the smoke,
|
|
1149
|
+
artifact publication, or automated mutation.
|
|
1150
|
+
|
|
1151
|
+
- [ ] **Step 5: Register, validate, and commit**
|
|
1152
|
+
|
|
1153
|
+
Add the new workflow to `required_files` in `scripts/check.sh`.
|
|
1154
|
+
|
|
1155
|
+
Run:
|
|
1156
|
+
|
|
1157
|
+
```bash
|
|
1158
|
+
node --test scripts/check-compatibility.test.mjs
|
|
1159
|
+
npm run check:compatibility
|
|
1160
|
+
npm run contract-check
|
|
1161
|
+
git diff --check
|
|
1162
|
+
```
|
|
1163
|
+
|
|
1164
|
+
Expected: all exit 0.
|
|
1165
|
+
|
|
1166
|
+
Commit:
|
|
1167
|
+
|
|
1168
|
+
```bash
|
|
1169
|
+
git add .github/workflows/compatibility-canary.yml scripts/check.sh scripts/check-compatibility.mjs scripts/check-compatibility.test.mjs
|
|
1170
|
+
git commit -m "ci: add non-blocking compatibility canary"
|
|
1171
|
+
```
|
|
1172
|
+
|
|
1173
|
+
## Task 8: Run the complete validation and prepare the local handoff
|
|
1174
|
+
|
|
1175
|
+
**Files:**
|
|
1176
|
+
|
|
1177
|
+
- Modify only if evidence exposes an actual Slice 1.4 defect.
|
|
1178
|
+
- Do not add release notes or bump `package.json` version.
|
|
1179
|
+
|
|
1180
|
+
- [ ] **Step 1: Run focused compatibility validation**
|
|
1181
|
+
|
|
1182
|
+
```bash
|
|
1183
|
+
node --test scripts/check-compatibility.test.mjs
|
|
1184
|
+
node scripts/check-compatibility.mjs
|
|
1185
|
+
bash scripts/opencode-compat-smoke.sh 1.14.41
|
|
1186
|
+
bash scripts/opencode-compat-smoke.sh 1.18.4
|
|
1187
|
+
```
|
|
1188
|
+
|
|
1189
|
+
Expected: all compatibility tests pass; both exact smokes resolve the requested
|
|
1190
|
+
version and discover the `lead` agent without printing private paths.
|
|
1191
|
+
|
|
1192
|
+
- [ ] **Step 2: Run the full release suite**
|
|
1193
|
+
|
|
1194
|
+
```bash
|
|
1195
|
+
npm run check:release
|
|
1196
|
+
```
|
|
1197
|
+
|
|
1198
|
+
Expected:
|
|
1199
|
+
|
|
1200
|
+
- contract checker passes;
|
|
1201
|
+
- every `node:test` suite passes, including the new compatibility suite;
|
|
1202
|
+
- typecheck passes;
|
|
1203
|
+
- dependency audit exits 0 at `moderate` threshold;
|
|
1204
|
+
- installation smoke passes.
|
|
1205
|
+
|
|
1206
|
+
- [ ] **Step 3: Verify the compatibility values and lockfile**
|
|
1207
|
+
|
|
1208
|
+
```bash
|
|
1209
|
+
node - <<'NODE'
|
|
1210
|
+
const c = require('./compatibility.json')
|
|
1211
|
+
const root = require('./package.json')
|
|
1212
|
+
const harness = require('./opencode/package.json')
|
|
1213
|
+
if (root.engines.node !== c.node.engines) process.exit(1)
|
|
1214
|
+
if (harness.engines.node !== c.node.engines) process.exit(1)
|
|
1215
|
+
if (harness.dependencies['@opencode-ai/plugin'] !== c.sdk.opencode_plugin) process.exit(1)
|
|
1216
|
+
if (harness.dependencies['@opentui/core'] !== c.sdk.opentui_core) process.exit(1)
|
|
1217
|
+
if (harness.dependencies['@opentui/solid'] !== c.sdk.opentui_solid) process.exit(1)
|
|
1218
|
+
NODE
|
|
1219
|
+
npm --prefix opencode ci --ignore-scripts
|
|
1220
|
+
npm run dependency-audit
|
|
1221
|
+
```
|
|
1222
|
+
|
|
1223
|
+
Expected: exact pins remain `1.14.41`, `0.2.5`, and `0.2.5`; no moderate/high
|
|
1224
|
+
advisory returns.
|
|
1225
|
+
|
|
1226
|
+
- [ ] **Step 4: Run public leak and diff checks**
|
|
1227
|
+
|
|
1228
|
+
```bash
|
|
1229
|
+
git diff --check origin/master...HEAD
|
|
1230
|
+
git diff --stat origin/master...HEAD
|
|
1231
|
+
./scripts/check.sh
|
|
1232
|
+
```
|
|
1233
|
+
|
|
1234
|
+
Expected: `git diff --check` and the repository's canonical leak scan both exit
|
|
1235
|
+
0. Inspect any intentional security-term hit manually rather than hiding it
|
|
1236
|
+
with a broad exclude.
|
|
1237
|
+
|
|
1238
|
+
- [ ] **Step 5: Confirm the private checkout is unchanged**
|
|
1239
|
+
|
|
1240
|
+
```bash
|
|
1241
|
+
: "${OAK_PRIVATE_CHECKOUT:?Set OAK_PRIVATE_CHECKOUT to the active private checkout}"
|
|
1242
|
+
private_baseline_file="$(git rev-parse --git-path oak-slice-1-4-private-baseline)"
|
|
1243
|
+
test -s "$private_baseline_file"
|
|
1244
|
+
expected_private_sha="$(cat "$private_baseline_file")"
|
|
1245
|
+
actual_private_sha="$(git -C "$OAK_PRIVATE_CHECKOUT" rev-parse HEAD)"
|
|
1246
|
+
test "$actual_private_sha" = "$expected_private_sha"
|
|
1247
|
+
git -C "$OAK_PRIVATE_CHECKOUT" status --short --branch
|
|
1248
|
+
node "$OAK_PRIVATE_CHECKOUT/scripts/check-harness.mjs"
|
|
1249
|
+
```
|
|
1250
|
+
|
|
1251
|
+
Expected: exact equality with the SHA captured by Task 0, clean `master`, and a
|
|
1252
|
+
passing checker. The machine-local checkout value and baseline artifact must
|
|
1253
|
+
not be copied into public files or commits.
|
|
1254
|
+
|
|
1255
|
+
- [ ] **Step 6: Request independent implementation review**
|
|
1256
|
+
|
|
1257
|
+
Give the reviewer only:
|
|
1258
|
+
|
|
1259
|
+
- approved spec path;
|
|
1260
|
+
- this plan path;
|
|
1261
|
+
- `origin/master...HEAD` diff;
|
|
1262
|
+
- focused/full validation results;
|
|
1263
|
+
- explicit no-push/no-release boundary.
|
|
1264
|
+
|
|
1265
|
+
Require review of correctness, privacy, CI semantics, shell portability,
|
|
1266
|
+
Node/OpenCode evidence claims, and missing tests. Fix findings through focused
|
|
1267
|
+
TDD and rerun the full relevant validation. Maximum three review iterations.
|
|
1268
|
+
|
|
1269
|
+
- [ ] **Step 7: Record the final local state without publishing**
|
|
1270
|
+
|
|
1271
|
+
```bash
|
|
1272
|
+
git status --short --branch
|
|
1273
|
+
git log --oneline origin/master..HEAD
|
|
1274
|
+
```
|
|
1275
|
+
|
|
1276
|
+
Expected: clean public tree ahead of origin; private tree unchanged. Report
|
|
1277
|
+
that GitHub-hosted Node 22/macOS/boundary/canary evidence remains unproven until
|
|
1278
|
+
the user separately authorizes a push. Do not tag, release, or publish npm.
|
|
1279
|
+
|
|
1280
|
+
## Execution completion gate
|
|
1281
|
+
|
|
1282
|
+
Local implementation is complete only when all focused/full checks pass and an
|
|
1283
|
+
independent implementation reviewer returns `APPROVED`. Remote compatibility
|
|
1284
|
+
claims become current only after a separately authorized push produces the
|
|
1285
|
+
blocking GitHub Actions evidence. A failed canary is recorded but does not
|
|
1286
|
+
invalidate a passing blocking matrix.
|