opencode-agent-orchestration-kit 1.0.32 → 1.0.37

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 (88) hide show
  1. package/README.md +73 -4
  2. package/SECURITY.md +7 -0
  3. package/docs/cli.md +100 -0
  4. package/docs/installation.md +25 -5
  5. package/docs/quickstart.md +1 -1
  6. package/docs/releases/v1.0.33.md +72 -0
  7. package/docs/releases/v1.0.34.md +59 -0
  8. package/docs/releases/v1.0.35.md +62 -0
  9. package/docs/releases/v1.0.36.md +58 -0
  10. package/docs/releases/v1.0.37.md +53 -0
  11. package/docs/security.md +4 -0
  12. package/docs/supply-chain.md +9 -5
  13. package/docs/threat-model.md +244 -0
  14. package/docs/use-cases/README.md +31 -0
  15. package/docs/use-cases/direct-label-change/README.md +76 -0
  16. package/docs/use-cases/direct-label-change/before/package.json +8 -0
  17. package/docs/use-cases/direct-label-change/before/src/settings-label.mjs +1 -0
  18. package/docs/use-cases/direct-label-change/before/test/settings-label.test.mjs +8 -0
  19. package/docs/use-cases/direct-label-change/case.json +118 -0
  20. package/docs/use-cases/direct-label-change/expected/package.json +8 -0
  21. package/docs/use-cases/direct-label-change/expected/src/settings-label.mjs +1 -0
  22. package/docs/use-cases/direct-label-change/expected/test/settings-label.test.mjs +8 -0
  23. package/docs/use-cases/feature-tag-normalizer/README.md +78 -0
  24. package/docs/use-cases/feature-tag-normalizer/before/package.json +8 -0
  25. package/docs/use-cases/feature-tag-normalizer/before/src/normalize-tags.mjs +3 -0
  26. package/docs/use-cases/feature-tag-normalizer/before/test/normalize-tags.test.mjs +13 -0
  27. package/docs/use-cases/feature-tag-normalizer/case.json +119 -0
  28. package/docs/use-cases/feature-tag-normalizer/expected/package.json +8 -0
  29. package/docs/use-cases/feature-tag-normalizer/expected/src/normalize-tags.mjs +14 -0
  30. package/docs/use-cases/feature-tag-normalizer/expected/test/normalize-tags.test.mjs +18 -0
  31. package/docs/workflows.md +6 -0
  32. package/opencode/agents/lead.md +11 -2
  33. package/opencode/agents/review_api.md +26 -9
  34. package/opencode/agents/review_coordinator.md +60 -68
  35. package/opencode/agents/review_quality.md +27 -11
  36. package/opencode/agents/review_security.md +26 -10
  37. package/opencode/agents/review_tests.md +26 -9
  38. package/opencode/agents/reviewer.md +95 -80
  39. package/opencode/commands/autonomous.md +75 -0
  40. package/opencode/commands/evolve.md +3 -1
  41. package/opencode/commands/feature.md +6 -2
  42. package/opencode/commands/loop.md +12 -8
  43. package/opencode/commands/review-orchestrated.md +26 -24
  44. package/opencode/commands/review-preflight.md +8 -7
  45. package/opencode/commands/review.md +27 -10
  46. package/opencode/docs/ai/harness/README.md +5 -0
  47. package/opencode/docs/ai/harness/agents.md +27 -3
  48. package/opencode/docs/ai/harness/checks.md +18 -0
  49. package/opencode/docs/ai/harness/commands.md +44 -0
  50. package/opencode/docs/ai/harness/orchestrated-review.md +8 -1
  51. package/opencode/docs/ai/harness/orchestration-contracts.json +924 -0
  52. package/opencode/package-lock.json +14 -8
  53. package/opencode/package.json +1 -0
  54. package/opencode/plugins/shell-export-guard.ts +23 -0
  55. package/opencode/scripts/adversarial-harness.test.mjs +5 -2
  56. package/opencode/scripts/check-harness.mjs +873 -18
  57. package/opencode/scripts/check-harness.test.mjs +562 -0
  58. package/opencode/scripts/loop-state.mjs +88 -14
  59. package/opencode/scripts/loop-state.test.mjs +82 -5
  60. package/opencode/scripts/review-orchestrated-prepare.mjs +18 -1
  61. package/opencode/scripts/review-orchestrated-prepare.test.mjs +49 -0
  62. package/opencode/scripts/shell-export-policy.d.mts +4 -0
  63. package/opencode/scripts/shell-export-policy.mjs +272 -0
  64. package/opencode/scripts/shell-export-policy.test.mjs +96 -0
  65. package/opencode/skills/code-review-and-quality/SKILL.md +63 -321
  66. package/opencode/skills/code-review-and-quality/references/profiles/backend-clean-ddd-cqrs.md +60 -0
  67. package/opencode/skills/code-review-and-quality/references/profiles/backend.md +54 -0
  68. package/opencode/skills/code-review-and-quality/references/profiles/frontend-clean-layered.md +60 -0
  69. package/opencode/skills/code-review-and-quality/references/profiles/frontend.md +62 -0
  70. package/opencode/skills/code-review-and-quality/references/review-policy.md +258 -0
  71. package/package.json +5 -2
  72. package/scripts/check-supply-chain.mjs +16 -2
  73. package/scripts/check-supply-chain.test.mjs +52 -1
  74. package/scripts/check-threat-model.mjs +421 -0
  75. package/scripts/check-threat-model.test.mjs +304 -0
  76. package/scripts/check-use-cases.mjs +501 -0
  77. package/scripts/check-use-cases.test.mjs +225 -0
  78. package/scripts/check.sh +55 -1
  79. package/scripts/install-smoke.sh +24 -1
  80. package/scripts/manage-installation.mjs +567 -25
  81. package/scripts/manage-installation.test.mjs +418 -0
  82. package/scripts/oak.mjs +246 -0
  83. package/scripts/oak.test.mjs +329 -0
  84. package/scripts/package-smoke.mjs +57 -0
  85. package/scripts/package-smoke.test.mjs +75 -2
  86. package/scripts/version.mjs +1 -0
  87. package/scripts/version.test.mjs +3 -2
  88. package/supply-chain.json +1 -0
@@ -0,0 +1,329 @@
1
+ import assert from "node:assert/strict";
2
+ import { spawnSync } from "node:child_process";
3
+ import crypto from "node:crypto";
4
+ import fs from "node:fs";
5
+ import os from "node:os";
6
+ import path from "node:path";
7
+ import { fileURLToPath } from "node:url";
8
+ import test from "node:test";
9
+
10
+ import {
11
+ OAK_COMMANDS,
12
+ OAK_ENTRYPOINTS,
13
+ OAK_REPLAY_DEFAULTS,
14
+ dispatchOak,
15
+ resolveCheckTarget,
16
+ } from "./oak.mjs";
17
+
18
+ const REPOSITORY_ROOT = path.dirname(path.dirname(fileURLToPath(import.meta.url)));
19
+
20
+ function capture() {
21
+ let value = "";
22
+ return {
23
+ write(chunk) {
24
+ value += String(chunk);
25
+ },
26
+ read() {
27
+ return value;
28
+ },
29
+ };
30
+ }
31
+
32
+ function runnerDeps(calls = [], result = { status: 0, signal: null, error: null }) {
33
+ return {
34
+ run(command, args, options) {
35
+ calls.push({ command, args, options });
36
+ return result;
37
+ },
38
+ stdout: capture(),
39
+ stderr: capture(),
40
+ env: { HOME: "/home/test" },
41
+ cwd: "/workspace",
42
+ };
43
+ }
44
+
45
+ function tempRoot(t) {
46
+ const root = fs.mkdtempSync(path.join(os.tmpdir(), "oak-cli-test-"));
47
+ t.after(() => fs.rmSync(root, { recursive: true, force: true }));
48
+ return root;
49
+ }
50
+
51
+ function snapshotTree(root) {
52
+ const result = [];
53
+ function walk(directory, prefix = "") {
54
+ for (const name of fs.readdirSync(directory).sort()) {
55
+ const relative = prefix ? `${prefix}/${name}` : name;
56
+ const fullPath = path.join(directory, name);
57
+ const stat = fs.lstatSync(fullPath);
58
+ if (stat.isDirectory()) {
59
+ result.push([relative, "directory", stat.mode & 0o777]);
60
+ walk(fullPath, relative);
61
+ } else if (stat.isFile()) {
62
+ result.push([
63
+ relative,
64
+ "file",
65
+ stat.mode & 0o777,
66
+ crypto.createHash("sha256").update(fs.readFileSync(fullPath)).digest("hex"),
67
+ ]);
68
+ } else if (stat.isSymbolicLink()) {
69
+ result.push([relative, "symlink", fs.readlinkSync(fullPath)]);
70
+ }
71
+ }
72
+ }
73
+ walk(root);
74
+ return result;
75
+ }
76
+
77
+ test("[O001] command set is closed and ordered", () => {
78
+ assert.deepEqual(OAK_COMMANDS, [
79
+ "install",
80
+ "upgrade",
81
+ "doctor",
82
+ "check",
83
+ "replay",
84
+ "state",
85
+ "uninstall",
86
+ "rollback",
87
+ "version",
88
+ ]);
89
+ });
90
+
91
+ test("[O002] global and command help are deterministic", () => {
92
+ for (const argv of [["--help"], ["help"]]) {
93
+ const deps = runnerDeps();
94
+ assert.equal(dispatchOak(argv, deps), 0);
95
+ assert.match(deps.stdout.read(), /^Usage: oak <command>/);
96
+ assert.equal(deps.stderr.read(), "");
97
+ }
98
+
99
+ const deps = runnerDeps();
100
+ assert.equal(dispatchOak(["doctor", "--help"], deps), 0);
101
+ assert.match(deps.stdout.read(), /^Usage: oak doctor /);
102
+ assert.equal(deps.stderr.read(), "");
103
+ });
104
+
105
+ test("[O003] missing, unknown, and ambiguous commands fail closed", () => {
106
+ for (const argv of [
107
+ [],
108
+ ["benchmark"],
109
+ ["live"],
110
+ ["--version", "anything"],
111
+ ["version", "anything"],
112
+ ]) {
113
+ const deps = runnerDeps();
114
+ assert.equal(dispatchOak(argv, deps), 2);
115
+ assert.match(deps.stderr.read(), /^oak: /);
116
+ assert.equal(deps.stderr.read().trim().split("\n").length, 1);
117
+ }
118
+ });
119
+
120
+ test("[O004] version forms delegate to the canonical version entrypoint", () => {
121
+ for (const argv of [["--version"], ["version"]]) {
122
+ const calls = [];
123
+ const deps = runnerDeps(calls);
124
+ assert.equal(dispatchOak(argv, deps), 0);
125
+ assert.deepEqual(calls[0].args, [OAK_ENTRYPOINTS.version]);
126
+ assert.equal(calls[0].options.shell, false);
127
+ assert.equal(calls[0].options.stdio, "inherit");
128
+ }
129
+ });
130
+
131
+ test("[O005] lifecycle commands delegate exact argv and exit state", () => {
132
+ const cases = [
133
+ ["install", ["--dry-run", "--target", "/tmp/oak-target"]],
134
+ ["upgrade", ["--dry-run"]],
135
+ ["doctor", ["--target", "/tmp/oak-target"]],
136
+ ["uninstall", ["--dry-run", "--yes"]],
137
+ ["rollback", ["--dry-run"]],
138
+ ];
139
+ for (const [command, args] of cases) {
140
+ const calls = [];
141
+ const deps = runnerDeps(calls);
142
+ assert.equal(dispatchOak([command, ...args], deps), 0);
143
+ assert.deepEqual(calls[0].args, [OAK_ENTRYPOINTS.manager, command, ...args]);
144
+ assert.equal(calls[0].options.shell, false);
145
+ assert.equal(calls[0].options.stdio, "inherit");
146
+ }
147
+
148
+ for (const status of [1, 2]) {
149
+ const deps = runnerDeps([], { status, signal: null, error: null });
150
+ assert.equal(dispatchOak(["doctor"], deps), status);
151
+ }
152
+ assert.equal(dispatchOak(
153
+ ["install"],
154
+ runnerDeps([], { status: null, signal: null, error: new Error("spawn") }),
155
+ ), 2);
156
+ assert.equal(dispatchOak(
157
+ ["upgrade"],
158
+ runnerDeps([], { status: null, signal: "SIGTERM", error: null }),
159
+ ), 2);
160
+ });
161
+
162
+ test("[O006] check target precedence matches lifecycle", () => {
163
+ assert.equal(resolveCheckTarget({ target: "/explicit" }, {
164
+ OPENCODE_CONFIG_DIR: "/environment",
165
+ HOME: "/home/test",
166
+ }), "/explicit");
167
+ assert.equal(resolveCheckTarget({}, {
168
+ OPENCODE_CONFIG_DIR: "/environment",
169
+ HOME: "/home/test",
170
+ }), "/environment");
171
+ assert.equal(resolveCheckTarget({}, {
172
+ HOME: "/home/test",
173
+ }), "/home/test/.config/opencode");
174
+ assert.throws(() => resolveCheckTarget({}, {}), /HOME/);
175
+ assert.throws(() => resolveCheckTarget({}, { OPENCODE_CONFIG_DIR: "" }), /must not be empty/);
176
+ });
177
+
178
+ test("[O007] check runs the packaged checker against a safe target", (t) => {
179
+ const root = tempRoot(t);
180
+ const target = path.join(root, "target");
181
+ fs.mkdirSync(target);
182
+ fs.mkdirSync(path.join(target, "scripts"));
183
+ fs.writeFileSync(path.join(target, "scripts", "check-harness.mjs"), "throw new Error('must not run')\n");
184
+
185
+ const calls = [];
186
+ const deps = { ...runnerDeps(calls), fsOps: fs };
187
+ assert.equal(dispatchOak(["check", "--target", target], deps), 0);
188
+ assert.deepEqual(calls[0].args, [OAK_ENTRYPOINTS.check]);
189
+ assert.equal(calls[0].options.cwd, path.resolve(target));
190
+ assert.notEqual(calls[0].args[0], path.join(target, "scripts", "check-harness.mjs"));
191
+
192
+ for (const argv of [
193
+ ["check", "--target"],
194
+ ["check", "--target", target, "--target", target],
195
+ ["check", "--unknown"],
196
+ ]) {
197
+ assert.equal(dispatchOak(argv, { ...runnerDeps(), fsOps: fs }), 2);
198
+ }
199
+
200
+ const file = path.join(root, "file");
201
+ fs.writeFileSync(file, "file\n");
202
+ assert.equal(dispatchOak(["check", "--target", file], { ...runnerDeps(), fsOps: fs }), 2);
203
+ assert.equal(dispatchOak(["check", "--target", path.join(root, "missing")], { ...runnerDeps(), fsOps: fs }), 2);
204
+
205
+ const symlink = path.join(root, "link");
206
+ fs.symlinkSync(target, symlink);
207
+ assert.equal(dispatchOak(["check", "--target", symlink], { ...runnerDeps(), fsOps: fs }), 2);
208
+ });
209
+
210
+ test("[O007] check dispatch is read-only", (t) => {
211
+ const root = tempRoot(t);
212
+ const target = path.join(root, "target");
213
+ fs.mkdirSync(target);
214
+ fs.writeFileSync(path.join(target, "canary.txt"), "unchanged\n");
215
+ const before = snapshotTree(target);
216
+ assert.equal(dispatchOak(["check", "--target", target], {
217
+ ...runnerDeps(),
218
+ fsOps: fs,
219
+ }), 0);
220
+ assert.deepEqual(snapshotTree(target), before);
221
+ });
222
+
223
+ test("[O008] replay defaults to packaged static evidence", () => {
224
+ const calls = [];
225
+ const deps = runnerDeps(calls);
226
+ assert.equal(dispatchOak(["replay"], deps), 0);
227
+ assert.deepEqual(calls[0].args, [
228
+ OAK_ENTRYPOINTS.replay,
229
+ "--corpus",
230
+ OAK_REPLAY_DEFAULTS.corpus,
231
+ "--fixtures",
232
+ OAK_REPLAY_DEFAULTS.fixtures,
233
+ ]);
234
+ assert.equal(path.isAbsolute(OAK_REPLAY_DEFAULTS.corpus), true);
235
+ assert.equal(path.isAbsolute(OAK_REPLAY_DEFAULTS.fixtures), true);
236
+ });
237
+
238
+ test("[O009] replay overrides paths and preserves closed exit codes", () => {
239
+ const calls = [];
240
+ const deps = runnerDeps(calls);
241
+ assert.equal(dispatchOak([
242
+ "replay",
243
+ "--output", "result.json",
244
+ "--fixtures", "custom-fixtures.jsonl",
245
+ "--corpus", "custom-corpus.jsonl",
246
+ ], deps), 0);
247
+ assert.deepEqual(calls[0].args, [
248
+ OAK_ENTRYPOINTS.replay,
249
+ "--corpus", "custom-corpus.jsonl",
250
+ "--fixtures", "custom-fixtures.jsonl",
251
+ "--output", "result.json",
252
+ ]);
253
+
254
+ for (const status of [0, 1, 2, 3]) {
255
+ assert.equal(dispatchOak(
256
+ ["replay"],
257
+ runnerDeps([], { status, signal: null, error: null }),
258
+ ), status);
259
+ }
260
+ for (const argv of [
261
+ ["replay", "--corpus"],
262
+ ["replay", "--unknown", "x"],
263
+ ["replay", "--corpus", "a", "--corpus", "b"],
264
+ ["benchmark"],
265
+ ]) {
266
+ assert.equal(dispatchOak(argv, runnerDeps()), 2);
267
+ }
268
+ });
269
+
270
+ test("[O010] state delegates only an explicit loop-state command and root", () => {
271
+ const calls = [];
272
+ const deps = runnerDeps(calls);
273
+ const args = [
274
+ "state",
275
+ "init",
276
+ "--root",
277
+ "/tmp/oak-target",
278
+ "--slug",
279
+ "example",
280
+ "--contract",
281
+ ".opencode/loops/example.md",
282
+ "--git-baseline",
283
+ "abc123",
284
+ "--session-id",
285
+ "session-1",
286
+ "--action-id",
287
+ "approve-1",
288
+ "--planned-iterations",
289
+ "3",
290
+ ];
291
+
292
+ assert.equal(dispatchOak(args, deps), 0);
293
+ assert.deepEqual(calls[0].args, [OAK_ENTRYPOINTS.state, ...args.slice(1)]);
294
+ assert.equal(calls[0].options.cwd, "/tmp/oak-target");
295
+ assert.equal(calls[0].options.shell, false);
296
+
297
+ for (const argv of [
298
+ ["state"],
299
+ ["state", "unknown", "--root", "/tmp/oak-target"],
300
+ ["state", "attest-review", "--root", "/tmp/oak-target"],
301
+ ["state", "init", "--slug", "example"],
302
+ ["state", "init", "--root", "/tmp/oak-target", "--root", "/tmp/other"],
303
+ ["state", "init", "--root"],
304
+ ]) {
305
+ assert.equal(dispatchOak(argv, runnerDeps()), 2);
306
+ }
307
+ });
308
+
309
+ test("[O011] symlinked oak executable runs its CLI", (t) => {
310
+ const root = tempRoot(t);
311
+ const executable = path.join(root, "oak");
312
+ fs.symlinkSync(path.join(REPOSITORY_ROOT, "scripts", "oak.mjs"), executable);
313
+
314
+ const result = spawnSync(executable, ["state", "--help"], { encoding: "utf8" });
315
+ assert.equal(result.status, 0);
316
+ assert.match(result.stdout, /^Usage: oak state /);
317
+ assert.equal(result.stderr, "");
318
+ });
319
+
320
+ test("[O012] package exposes exactly one executable oak binary", () => {
321
+ const packageJson = JSON.parse(
322
+ fs.readFileSync(path.join(REPOSITORY_ROOT, "package.json"), "utf8"),
323
+ );
324
+ assert.deepEqual(packageJson.bin, { oak: "scripts/oak.mjs" });
325
+ const stat = fs.lstatSync(path.join(REPOSITORY_ROOT, packageJson.bin.oak));
326
+ assert.equal(stat.isFile(), true);
327
+ assert.equal(stat.isSymbolicLink(), false);
328
+ assert.notEqual(stat.mode & 0o111, 0);
329
+ });
@@ -14,13 +14,19 @@ const REQUIRED_FILES = [
14
14
  "package/supply-chain.json",
15
15
  "package/install.sh",
16
16
  "package/scripts/manage-installation.mjs",
17
+ "package/scripts/oak.mjs",
17
18
  "package/scripts/package-smoke.sh",
18
19
  "package/scripts/package-smoke.mjs",
19
20
  "package/opencode/opencode.json",
20
21
  "package/opencode/package.json",
21
22
  "package/opencode/package-lock.json",
22
23
  "package/opencode/agents/lead.md",
24
+ "package/opencode/docs/ai/harness/orchestration-contracts.json",
23
25
  "package/docs/installation.md",
26
+ "package/docs/threat-model.md",
27
+ "package/docs/use-cases/README.md",
28
+ "package/docs/use-cases/direct-label-change/case.json",
29
+ "package/docs/use-cases/feature-tag-normalizer/case.json",
24
30
  "package/LICENSE",
25
31
  "package/NOTICE.md",
26
32
  ];
@@ -112,6 +118,30 @@ export function validatePackedFileSet(names) {
112
118
  }
113
119
  }
114
120
 
121
+ export function validatePackedOak({ packed, packedRoot, fsOps = fs }) {
122
+ if (
123
+ !packed?.bin
124
+ || typeof packed.bin !== "object"
125
+ || Array.isArray(packed.bin)
126
+ || JSON.stringify(Object.keys(packed.bin).sort()) !== JSON.stringify(["oak"])
127
+ || packed.bin.oak !== "scripts/oak.mjs"
128
+ ) {
129
+ throw smokeError("packed package bin must expose exactly oak at scripts/oak.mjs");
130
+ }
131
+ let stat;
132
+ try {
133
+ stat = fsOps.lstatSync(path.join(packedRoot, packed.bin.oak));
134
+ } catch {
135
+ throw smokeError("packed oak entrypoint is missing");
136
+ }
137
+ if (stat.isSymbolicLink() || !stat.isFile()) {
138
+ throw smokeError("packed oak entrypoint must be a regular non-symlink file");
139
+ }
140
+ if ((stat.mode & 0o111) === 0) {
141
+ throw smokeError("packed oak entrypoint must be executable");
142
+ }
143
+ }
144
+
115
145
  function inspectRegularFile(file) {
116
146
  let stat;
117
147
  try {
@@ -278,6 +308,7 @@ export async function smokeTarball(options = {}) {
278
308
  }
279
309
 
280
310
  const packedRoot = path.join(extracted, "package");
311
+ validatePackedOak({ packed, packedRoot });
281
312
  const opencodeRoot = path.join(packedRoot, "opencode");
282
313
  run("npm", ["ci", "--ignore-scripts"], {
283
314
  cwd: opencodeRoot,
@@ -294,6 +325,32 @@ export async function smokeTarball(options = {}) {
294
325
  env: environment,
295
326
  label: "packed installation smoke failed",
296
327
  });
328
+ const version = run(process.execPath, ["scripts/oak.mjs", "--version"], {
329
+ cwd: packedRoot,
330
+ env: environment,
331
+ label: "packed oak version failed",
332
+ });
333
+ if (version.stdout !== `${canonical.name} ${canonical.version}\n`) {
334
+ throw smokeError("packed oak version output is invalid");
335
+ }
336
+ const help = run(process.execPath, ["scripts/oak.mjs", "--help"], {
337
+ cwd: packedRoot,
338
+ env: environment,
339
+ label: "packed oak help failed",
340
+ });
341
+ if (!help.stdout.startsWith("Usage: oak <command>")) {
342
+ throw smokeError("packed oak help output is invalid");
343
+ }
344
+ run(process.execPath, ["scripts/oak.mjs", "check", "--target", "opencode"], {
345
+ cwd: packedRoot,
346
+ env: environment,
347
+ label: "packed oak check failed",
348
+ });
349
+ run(process.execPath, ["scripts/oak.mjs", "replay"], {
350
+ cwd: packedRoot,
351
+ env: environment,
352
+ label: "packed oak replay failed",
353
+ });
297
354
  return {
298
355
  basename,
299
356
  size: stat.size,
@@ -11,24 +11,31 @@ import {
11
11
  parseChecksumFile,
12
12
  smokeTarball,
13
13
  validateArchiveEntries,
14
+ validatePackedOak,
14
15
  validatePackedFileSet,
15
16
  } from "./package-smoke.mjs";
16
17
 
17
18
  const ROOT = path.dirname(path.dirname(fileURLToPath(import.meta.url)));
18
19
  const HASH = "a".repeat(64);
19
- const BASENAME = "opencode-agent-orchestration-kit-1.0.32.tgz";
20
+ const BASENAME = "opencode-agent-orchestration-kit-1.0.37.tgz";
20
21
  const REQUIRED = [
21
22
  "package/package.json",
22
23
  "package/supply-chain.json",
23
24
  "package/install.sh",
24
25
  "package/scripts/manage-installation.mjs",
26
+ "package/scripts/oak.mjs",
25
27
  "package/scripts/package-smoke.sh",
26
28
  "package/scripts/package-smoke.mjs",
27
29
  "package/opencode/opencode.json",
28
30
  "package/opencode/package.json",
29
31
  "package/opencode/package-lock.json",
30
32
  "package/opencode/agents/lead.md",
33
+ "package/opencode/docs/ai/harness/orchestration-contracts.json",
31
34
  "package/docs/installation.md",
35
+ "package/docs/threat-model.md",
36
+ "package/docs/use-cases/README.md",
37
+ "package/docs/use-cases/direct-label-change/case.json",
38
+ "package/docs/use-cases/feature-tag-normalizer/case.json",
32
39
  "package/LICENSE",
33
40
  "package/NOTICE.md",
34
41
  ];
@@ -102,6 +109,72 @@ test("validatePackedFileSet reports a missing required representative", () => {
102
109
  );
103
110
  });
104
111
 
112
+ test("validatePackedFileSet requires the oak entrypoint", () => {
113
+ assert.throws(
114
+ () => validatePackedFileSet(REQUIRED.filter((name) => name !== "package/scripts/oak.mjs")),
115
+ /scripts\/oak\.mjs/,
116
+ );
117
+ });
118
+
119
+ test("validatePackedFileSet requires the orchestration contract", () => {
120
+ assert.throws(
121
+ () => validatePackedFileSet(
122
+ REQUIRED.filter(
123
+ (name) => name !== "package/opencode/docs/ai/harness/orchestration-contracts.json",
124
+ ),
125
+ ),
126
+ /orchestration-contracts\.json/,
127
+ );
128
+ });
129
+
130
+ test("validatePackedFileSet requires the canonical threat model", () => {
131
+ assert.throws(
132
+ () => validatePackedFileSet(
133
+ REQUIRED.filter((name) => name !== "package/docs/threat-model.md"),
134
+ ),
135
+ /docs\/threat-model\.md/,
136
+ );
137
+ });
138
+
139
+ for (const required of [
140
+ "package/docs/use-cases/README.md",
141
+ "package/docs/use-cases/direct-label-change/case.json",
142
+ "package/docs/use-cases/feature-tag-normalizer/case.json",
143
+ ]) {
144
+ test(`validatePackedFileSet requires packaged use-case file ${required}`, () => {
145
+ assert.throws(
146
+ () =>
147
+ validatePackedFileSet(
148
+ REQUIRED.filter((name) => name !== required),
149
+ ),
150
+ new RegExp(required.slice("package/".length).replaceAll(".", "\\.")),
151
+ );
152
+ });
153
+ }
154
+
155
+ test("validatePackedOak requires exact metadata and executable regular file", (t) => {
156
+ const root = fs.mkdtempSync(path.join(os.tmpdir(), "oak-packed-bin-test-"));
157
+ t.after(() => fs.rmSync(root, { recursive: true, force: true }));
158
+ fs.mkdirSync(path.join(root, "scripts"));
159
+ fs.writeFileSync(path.join(root, "scripts/oak.mjs"), "#!/usr/bin/env node\n", { mode: 0o755 });
160
+ assert.doesNotThrow(() => validatePackedOak({
161
+ packed: { bin: { oak: "scripts/oak.mjs" } },
162
+ packedRoot: root,
163
+ }));
164
+ for (const bin of [
165
+ undefined,
166
+ { oak: "scripts/other.mjs" },
167
+ { oak: "scripts/oak.mjs", other: "scripts/other.mjs" },
168
+ ]) {
169
+ assert.throws(() => validatePackedOak({ packed: { bin }, packedRoot: root }), /bin/i);
170
+ }
171
+ fs.chmodSync(path.join(root, "scripts/oak.mjs"), 0o644);
172
+ assert.throws(() => validatePackedOak({
173
+ packed: { bin: { oak: "scripts/oak.mjs" } },
174
+ packedRoot: root,
175
+ }), /executable/i);
176
+ });
177
+
105
178
  for (const forbidden of [
106
179
  "package/.env",
107
180
  "package/config/.env.production",
@@ -135,7 +208,7 @@ test("smokeTarball validates both archive listings before extraction", async ()
135
208
  await assert.rejects(
136
209
  smokeTarball({
137
210
  repositoryRoot: ROOT,
138
- tarball: "/public/opencode-agent-orchestration-kit-1.0.32.tgz",
211
+ tarball: "/public/opencode-agent-orchestration-kit-1.0.37.tgz",
139
212
  captureTarball(_source, destination) {
140
213
  fs.writeFileSync(destination, "fixture");
141
214
  return { size: 1 };
@@ -10,6 +10,7 @@ const CONCRETE_STABLE_VERSION = /(?<![0-9])(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|
10
10
  const OPERATIONAL_VERSION_SURFACES = [
11
11
  "scripts/version.mjs",
12
12
  "scripts/manage-installation.mjs",
13
+ "scripts/oak.mjs",
13
14
  "install.sh",
14
15
  "upgrade.sh",
15
16
  "doctor.sh",
@@ -30,6 +30,7 @@ function makeRepository(t, packageOverrides = {}) {
30
30
  const OPERATIONAL_VERSION_SURFACES = [
31
31
  "scripts/version.mjs",
32
32
  "scripts/manage-installation.mjs",
33
+ "scripts/oak.mjs",
33
34
  "install.sh",
34
35
  "upgrade.sh",
35
36
  "doctor.sh",
@@ -108,7 +109,7 @@ test("[V004] direct version entrypoints are exact and mutation-free", (t) => {
108
109
  for (const args of [["scripts/version.mjs"], ["scripts/manage-installation.mjs", "--version"]]) {
109
110
  const result = run(process.execPath, args, { HOME: home });
110
111
  assert.equal(result.status, 0, result.stderr);
111
- assert.equal(result.stdout, "opencode-agent-orchestration-kit 1.0.32\n");
112
+ assert.equal(result.stdout, "opencode-agent-orchestration-kit 1.0.37\n");
112
113
  assert.equal(fs.existsSync(target), false);
113
114
  }
114
115
  });
@@ -117,7 +118,7 @@ test("[V005] all lifecycle wrappers expose the canonical version", () => {
117
118
  for (const wrapper of ["install.sh", "upgrade.sh", "doctor.sh", "uninstall.sh", "rollback.sh"]) {
118
119
  const result = run(path.join(REPOSITORY_ROOT, wrapper), ["--version"]);
119
120
  assert.equal(result.status, 0, `${wrapper}: ${result.stderr}`);
120
- assert.equal(result.stdout, "opencode-agent-orchestration-kit 1.0.32\n", wrapper);
121
+ assert.equal(result.stdout, "opencode-agent-orchestration-kit 1.0.37\n", wrapper);
121
122
  }
122
123
  });
123
124
 
package/supply-chain.json CHANGED
@@ -29,6 +29,7 @@
29
29
  },
30
30
  "npm_overrides": {
31
31
  "@babel/core": "7.29.7",
32
+ "brace-expansion": "5.0.9",
32
33
  "uuid": "14.0.0"
33
34
  }
34
35
  }