opencode-agent-orchestration-kit 1.0.33 → 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 (63) hide show
  1. package/README.md +41 -3
  2. package/docs/cli.md +31 -3
  3. package/docs/releases/v1.0.34.md +59 -0
  4. package/docs/releases/v1.0.35.md +62 -0
  5. package/docs/releases/v1.0.36.md +58 -0
  6. package/docs/releases/v1.0.37.md +53 -0
  7. package/docs/supply-chain.md +2 -2
  8. package/opencode/agents/lead.md +11 -2
  9. package/opencode/agents/review_api.md +26 -9
  10. package/opencode/agents/review_coordinator.md +60 -68
  11. package/opencode/agents/review_quality.md +27 -11
  12. package/opencode/agents/review_security.md +26 -10
  13. package/opencode/agents/review_tests.md +26 -9
  14. package/opencode/agents/reviewer.md +95 -80
  15. package/opencode/commands/autonomous.md +75 -0
  16. package/opencode/commands/evolve.md +3 -1
  17. package/opencode/commands/feature.md +6 -2
  18. package/opencode/commands/loop.md +12 -8
  19. package/opencode/commands/review-orchestrated.md +26 -24
  20. package/opencode/commands/review-preflight.md +8 -7
  21. package/opencode/commands/review.md +27 -10
  22. package/opencode/docs/ai/harness/README.md +3 -0
  23. package/opencode/docs/ai/harness/agents.md +20 -3
  24. package/opencode/docs/ai/harness/checks.md +9 -0
  25. package/opencode/docs/ai/harness/commands.md +36 -0
  26. package/opencode/docs/ai/harness/orchestrated-review.md +8 -1
  27. package/opencode/docs/ai/harness/orchestration-contracts.json +34 -1
  28. package/opencode/package-lock.json +3 -3
  29. package/opencode/package.json +1 -1
  30. package/opencode/plugins/shell-export-guard.ts +23 -0
  31. package/opencode/scripts/adversarial-harness.test.mjs +5 -2
  32. package/opencode/scripts/check-harness.mjs +241 -10
  33. package/opencode/scripts/check-harness.test.mjs +190 -8
  34. package/opencode/scripts/loop-state.mjs +88 -14
  35. package/opencode/scripts/loop-state.test.mjs +82 -5
  36. package/opencode/scripts/review-orchestrated-prepare.mjs +18 -1
  37. package/opencode/scripts/review-orchestrated-prepare.test.mjs +49 -0
  38. package/opencode/scripts/shell-export-policy.d.mts +4 -0
  39. package/opencode/scripts/shell-export-policy.mjs +272 -0
  40. package/opencode/scripts/shell-export-policy.test.mjs +96 -0
  41. package/opencode/skills/code-review-and-quality/SKILL.md +63 -321
  42. package/opencode/skills/code-review-and-quality/references/profiles/backend-clean-ddd-cqrs.md +60 -0
  43. package/opencode/skills/code-review-and-quality/references/profiles/backend.md +54 -0
  44. package/opencode/skills/code-review-and-quality/references/profiles/frontend-clean-layered.md +60 -0
  45. package/opencode/skills/code-review-and-quality/references/profiles/frontend.md +62 -0
  46. package/opencode/skills/code-review-and-quality/references/review-policy.md +258 -0
  47. package/package.json +2 -2
  48. package/scripts/check-supply-chain.mjs +5 -1
  49. package/scripts/check-supply-chain.test.mjs +10 -6
  50. package/scripts/check.sh +6 -2
  51. package/scripts/oak.mjs +47 -1
  52. package/scripts/oak.test.mjs +53 -1
  53. package/scripts/package-smoke.test.mjs +2 -2
  54. package/scripts/version.test.mjs +2 -2
  55. package/supply-chain.json +1 -1
  56. package/docker/open-design/data/app.sqlite +0 -0
  57. package/docker/open-design/data/app.sqlite-shm +0 -0
  58. package/docker/open-design/data/app.sqlite-wal +0 -0
  59. package/docker/open-design/opencode-auth/log/2026-05-02T105802.log +0 -17
  60. package/docker/open-design/opencode-auth/log/2026-05-04T102127.log +0 -16
  61. package/docker/open-design/opencode-auth/opencode.db +0 -0
  62. package/docker/open-design/opencode-auth/opencode.db-shm +0 -0
  63. package/docker/open-design/opencode-auth/opencode.db-wal +0 -0
@@ -0,0 +1,272 @@
1
+ const SAFE_DECISION = Object.freeze({ blocked: false, rule: null });
2
+
3
+ export const SHELL_EXPORT_RULES = Object.freeze({
4
+ ENVIRONMENT_ENUMERATION: "shell-export-environment-enumeration",
5
+ SENSITIVE_NAME: "shell-export-sensitive-name",
6
+ SECRET_SOURCE: "shell-export-secret-source",
7
+ });
8
+
9
+ const SECRET_NAME_SUFFIXES = [
10
+ "API_KEY",
11
+ "TOKEN",
12
+ "SECRET",
13
+ "PASSWORD",
14
+ "CREDENTIALS",
15
+ "PRIVATE_KEY",
16
+ "COOKIE",
17
+ "AUTH_TOKEN",
18
+ ];
19
+
20
+ const SECRET_READERS = new Set([
21
+ "aws",
22
+ "cat",
23
+ "curl",
24
+ "env",
25
+ "gcloud",
26
+ "op",
27
+ "pass",
28
+ "printenv",
29
+ "security",
30
+ "vault",
31
+ "wget",
32
+ ]);
33
+
34
+ const VARIABLE_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
35
+
36
+ function decision(rule) {
37
+ return { blocked: true, rule };
38
+ }
39
+
40
+ function isSensitiveName(name) {
41
+ const normalized = String(name).toUpperCase();
42
+ return SECRET_NAME_SUFFIXES.some(
43
+ (suffix) => normalized === suffix || normalized.endsWith(`_${suffix}`),
44
+ );
45
+ }
46
+
47
+ function splitShellCommands(command) {
48
+ const segments = [];
49
+ let start = 0;
50
+ let quote = null;
51
+ let escaped = false;
52
+ let comment = false;
53
+
54
+ for (let index = 0; index < command.length; index += 1) {
55
+ const character = command[index];
56
+
57
+ if (comment) {
58
+ if (character === "\n") {
59
+ start = index + 1;
60
+ comment = false;
61
+ }
62
+ continue;
63
+ }
64
+
65
+ if (escaped) {
66
+ escaped = false;
67
+ continue;
68
+ }
69
+
70
+ if (character === "\\" && quote !== "'") {
71
+ escaped = true;
72
+ continue;
73
+ }
74
+
75
+ if (quote) {
76
+ if (character === quote) quote = null;
77
+ continue;
78
+ }
79
+
80
+ if (character === "'" || character === '"' || character === "`") {
81
+ quote = character;
82
+ continue;
83
+ }
84
+
85
+ if (character === "#" && (index === 0 || /\s/.test(command[index - 1]))) {
86
+ segments.push(command.slice(start, index));
87
+ start = index + 1;
88
+ comment = true;
89
+ continue;
90
+ }
91
+
92
+ if (character === ";" || character === "|" || character === "&" || character === "\n") {
93
+ segments.push(command.slice(start, index));
94
+ if ((character === "|" || character === "&") && command[index + 1] === character) {
95
+ index += 1;
96
+ }
97
+ start = index + 1;
98
+ }
99
+ }
100
+
101
+ if (!comment) segments.push(command.slice(start));
102
+ return segments;
103
+ }
104
+
105
+ function tokenizeShellWords(text) {
106
+ const words = [];
107
+ let word = "";
108
+ let quote = null;
109
+ let escaped = false;
110
+
111
+ const push = () => {
112
+ if (word) words.push(word);
113
+ word = "";
114
+ };
115
+
116
+ for (const character of text) {
117
+ if (escaped) {
118
+ word += character;
119
+ escaped = false;
120
+ continue;
121
+ }
122
+
123
+ if (character === "\\" && quote !== "'") {
124
+ escaped = true;
125
+ continue;
126
+ }
127
+
128
+ if (quote) {
129
+ if (character === quote) {
130
+ quote = null;
131
+ } else {
132
+ word += character;
133
+ }
134
+ continue;
135
+ }
136
+
137
+ if (character === "'" || character === '"' || character === "`") {
138
+ quote = character;
139
+ word += character;
140
+ continue;
141
+ }
142
+
143
+ if (/\s/.test(character)) {
144
+ push();
145
+ continue;
146
+ }
147
+
148
+ word += character;
149
+ }
150
+
151
+ if (escaped) word += "\\";
152
+ push();
153
+ return words;
154
+ }
155
+
156
+ function exportCommandFromSegment(segment) {
157
+ let remaining = segment.trim();
158
+
159
+ while (true) {
160
+ const keyword = remaining.match(/^(?:then|do|else|elif)\s+/);
161
+ if (!keyword) break;
162
+ remaining = remaining.slice(keyword[0].length).trimStart();
163
+ }
164
+
165
+ const match = remaining.match(/^export(?:\s+|$)/);
166
+ if (!match) return null;
167
+ return remaining.slice(match[0].length).trim();
168
+ }
169
+
170
+ function stripSingleQuotedText(value) {
171
+ let result = "";
172
+ let quote = null;
173
+
174
+ for (const character of value) {
175
+ if (quote === "'") {
176
+ if (character === "'") quote = null;
177
+ continue;
178
+ }
179
+ if (character === "'") {
180
+ quote = "'";
181
+ continue;
182
+ }
183
+ result += character;
184
+ }
185
+
186
+ return result;
187
+ }
188
+
189
+ function containsSensitiveEnvironmentReference(value) {
190
+ const unquoted = stripSingleQuotedText(value);
191
+ const references = unquoted.matchAll(/\$\{?([A-Za-z_][A-Za-z0-9_]*)\}?/g);
192
+ for (const reference of references) {
193
+ if (isSensitiveName(reference[1])) return true;
194
+ }
195
+ return false;
196
+ }
197
+
198
+ function containsSecretReaderSubstitution(value) {
199
+ const unquoted = stripSingleQuotedText(value);
200
+ const substitutions = [
201
+ ...unquoted.matchAll(/\$\(([^()]*)\)/g),
202
+ ...unquoted.matchAll(/`([^`]*)`/g),
203
+ ];
204
+
205
+ for (const substitution of substitutions) {
206
+ const body = substitution[1];
207
+ const firstCommand = body.trim().match(/^([A-Za-z][A-Za-z0-9_-]*)\b/);
208
+ if (firstCommand && SECRET_READERS.has(firstCommand[1].toLowerCase())) return true;
209
+ if (/(?:;|\|\||&&|\|)\s*([A-Za-z][A-Za-z0-9_-]*)\b/.test(body)) {
210
+ const nestedCommands = body.matchAll(/(?:;|\|\||&&|\|)\s*([A-Za-z][A-Za-z0-9_-]*)\b/g);
211
+ for (const nested of nestedCommands) {
212
+ if (SECRET_READERS.has(nested[1].toLowerCase())) return true;
213
+ }
214
+ }
215
+ }
216
+
217
+ return false;
218
+ }
219
+
220
+ function classifyExportArguments(argumentsText) {
221
+ const words = tokenizeShellWords(argumentsText);
222
+ if (words.length === 0 || words.includes("-p")) {
223
+ return decision(SHELL_EXPORT_RULES.ENVIRONMENT_ENUMERATION);
224
+ }
225
+
226
+ const assignments = [];
227
+ const exportedNames = [];
228
+ for (const word of words) {
229
+ if (word.startsWith("-")) continue;
230
+ const equalsIndex = word.indexOf("=");
231
+ if (equalsIndex === -1) {
232
+ if (VARIABLE_RE.test(word)) exportedNames.push(word);
233
+ continue;
234
+ }
235
+
236
+ const name = word.slice(0, equalsIndex);
237
+ if (VARIABLE_RE.test(name)) {
238
+ exportedNames.push(name);
239
+ assignments.push(word.slice(equalsIndex + 1));
240
+ }
241
+ }
242
+
243
+ if (exportedNames.some(isSensitiveName)) {
244
+ return decision(SHELL_EXPORT_RULES.SENSITIVE_NAME);
245
+ }
246
+
247
+ if (
248
+ assignments.some(
249
+ (value) =>
250
+ containsSensitiveEnvironmentReference(value) ||
251
+ containsSecretReaderSubstitution(value),
252
+ )
253
+ ) {
254
+ return decision(SHELL_EXPORT_RULES.SECRET_SOURCE);
255
+ }
256
+
257
+ return SAFE_DECISION;
258
+ }
259
+
260
+ export function classifyShellExport(command) {
261
+ if (typeof command !== "string" || command.length === 0) return SAFE_DECISION;
262
+
263
+ for (const segment of splitShellCommands(command)) {
264
+ const argumentsText = exportCommandFromSegment(segment);
265
+ if (argumentsText === null) continue;
266
+
267
+ const decisionForSegment = classifyExportArguments(argumentsText);
268
+ if (decisionForSegment.blocked) return decisionForSegment;
269
+ }
270
+
271
+ return SAFE_DECISION;
272
+ }
@@ -0,0 +1,96 @@
1
+ import assert from "node:assert/strict";
2
+ import test from "node:test";
3
+ import { classifyShellExport } from "./shell-export-policy.mjs";
4
+
5
+ const sensitiveApiKeyName = ["OPENAI", "API_KEY"].join("_");
6
+
7
+ const cases = [
8
+ {
9
+ name: "blocks bare export",
10
+ command: "export",
11
+ expected: { blocked: true, rule: "shell-export-environment-enumeration" },
12
+ },
13
+ {
14
+ name: "blocks export -p",
15
+ command: "export -p",
16
+ expected: { blocked: true, rule: "shell-export-environment-enumeration" },
17
+ },
18
+ {
19
+ name: "blocks a sensitive export name",
20
+ command: `export ${sensitiveApiKeyName}=literal`,
21
+ expected: { blocked: true, rule: "shell-export-sensitive-name" },
22
+ },
23
+ {
24
+ name: "blocks a secret source after a separator",
25
+ command: "printf x; export TOKEN=\"$(cat ~/.token)\"",
26
+ expected: { blocked: true, rule: "shell-export-sensitive-name" },
27
+ },
28
+ {
29
+ name: "blocks printenv of a sensitive variable",
30
+ command: `export VALUE="$(printenv ${sensitiveApiKeyName})"`,
31
+ expected: { blocked: true, rule: "shell-export-secret-source" },
32
+ },
33
+ {
34
+ name: "allows PATH setup",
35
+ command: 'export PATH="$PATH:/tool/bin"',
36
+ expected: { blocked: false, rule: null },
37
+ },
38
+ {
39
+ name: "allows NODE_ENV setup",
40
+ command: "export NODE_ENV=test",
41
+ expected: { blocked: false, rule: null },
42
+ },
43
+ {
44
+ name: "allows a non-secret derived value",
45
+ command: 'export BUILD_ID="$(git rev-parse HEAD)"',
46
+ expected: { blocked: false, rule: null },
47
+ },
48
+ {
49
+ name: "ignores quoted prose",
50
+ command: 'echo "export TOKEN=..."',
51
+ expected: { blocked: false, rule: null },
52
+ },
53
+ {
54
+ name: "ignores source-language export",
55
+ command: 'node -e "export const value = 1"',
56
+ expected: { blocked: false, rule: null },
57
+ },
58
+ {
59
+ name: "ignores the Pi session export flag",
60
+ command: "pi --export session.html",
61
+ expected: { blocked: false, rule: null },
62
+ },
63
+ {
64
+ name: "recognizes export after then",
65
+ command: "if true; then export API_TOKEN=literal; fi",
66
+ expected: { blocked: true, rule: "shell-export-sensitive-name" },
67
+ },
68
+ {
69
+ name: "ignores export text in a comment",
70
+ command: "echo ready # export API_TOKEN=literal",
71
+ expected: { blocked: false, rule: null },
72
+ },
73
+ {
74
+ name: "ignores export text after a real assignment comment",
75
+ command: "export BUILD_CHANNEL=staging # export API_TOKEN=literal",
76
+ expected: { blocked: false, rule: null },
77
+ },
78
+ {
79
+ name: "does not block a non-sensitive exported variable",
80
+ command: "export BUILD_CHANNEL=staging",
81
+ expected: { blocked: false, rule: null },
82
+ },
83
+ ];
84
+
85
+ for (const { name, command, expected } of cases) {
86
+ test(name, () => {
87
+ const decision = classifyShellExport(command);
88
+ assert.deepEqual(decision, expected);
89
+ assert.equal(Object.hasOwn(decision, "command"), false);
90
+ });
91
+ }
92
+
93
+ test("returns a safe decision for non-string input", () => {
94
+ assert.deepEqual(classifyShellExport(null), { blocked: false, rule: null });
95
+ assert.deepEqual(classifyShellExport({}), { blocked: false, rule: null });
96
+ });