@plainconceptsplatform/workflows 1.0.1 → 1.0.4
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/dist/index.js +0 -0
- package/loops/scripts/compile-agent-workflows.mjs +43 -10
- package/package.json +46 -45
package/dist/index.js
CHANGED
|
File without changes
|
|
@@ -2,6 +2,28 @@
|
|
|
2
2
|
|
|
3
3
|
const OPENCODE_VERSION = '2.0.22'
|
|
4
4
|
const OPENCODE_PACKAGE = '@opencode/cli'
|
|
5
|
+
|
|
6
|
+
// The install the compiled locks carry, shared so both rewrite sites emit exactly
|
|
7
|
+
// the same command.
|
|
8
|
+
//
|
|
9
|
+
// `--allow-scripts` is the part that matters. npm now blocks a dependency's
|
|
10
|
+
// install scripts unless the package is explicitly allowed, and @opencode/cli
|
|
11
|
+
// downloads its platform binary from its own postinstall. Without the flag the
|
|
12
|
+
// install "succeeds" (exit 0, `added N packages`) while the postinstall is
|
|
13
|
+
// skipped with a warning, leaving a stub bin and the previous version in place,
|
|
14
|
+
// so the job runs OpenCode 1 against OpenCode 2 config and the gateway rejects
|
|
15
|
+
// every model. `NPM_CONFIG_ALLOW_SCRIPTS` is the spelling npm accepts for a
|
|
16
|
+
// global install; the CLI form is refused for project-scoped installs.
|
|
17
|
+
//
|
|
18
|
+
// The trailing check turns a silent bad install into a loud failure: if the
|
|
19
|
+
// version still is not there after installing, the step exits non-zero rather
|
|
20
|
+
// than letting the agent run on the wrong binary.
|
|
21
|
+
const OPENCODE_INSTALL_GUARD =
|
|
22
|
+
"opencode --version 2>/dev/null | grep -qF '" + OPENCODE_VERSION + "' || " +
|
|
23
|
+
"flock /tmp/opencode-install.lock sh -c " +
|
|
24
|
+
"'NPM_CONFIG_ALLOW_SCRIPTS=" + OPENCODE_PACKAGE + " npm install -g " + OPENCODE_PACKAGE + "@" + OPENCODE_VERSION + "' ; " +
|
|
25
|
+
"opencode --version 2>/dev/null | grep -qF '" + OPENCODE_VERSION + "' || " +
|
|
26
|
+
"{ echo \"::error::opencode " + OPENCODE_VERSION + " is not installed after the install step\"; exit 1; }"
|
|
5
27
|
import { spawnSync } from "node:child_process";
|
|
6
28
|
import { existsSync, readdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
7
29
|
import { join } from "node:path";
|
|
@@ -122,7 +144,10 @@ for (const file of readdirSync(workflowDirectory)) {
|
|
|
122
144
|
// explicitly, so the remote registry is not needed here.
|
|
123
145
|
// - --print-logs + a non-silent level: stripping --print-logs and forcing
|
|
124
146
|
// ERROR hid every engine log, so a stalled bootstrap looked like silence.
|
|
125
|
-
|
|
147
|
+
// The level must be lower case: OpenCode 2 rejects `INFO` with
|
|
148
|
+
// "Invalid value for flag --log-level", aborting before the agent runs.
|
|
149
|
+
// The old upper-case spelling was valid in v1 and is not in v2.
|
|
150
|
+
.replace(/opencode run(?: --print-logs)? --log-level (?:DEBUG|ERROR|INFO|debug|error|info)/g, "OPENCODE_DISABLE_MODELS_FETCH=1 opencode run --print-logs --log-level info")
|
|
126
151
|
.replace(/GH_AW_INFO_MODEL: "[^"]*"/g, 'GH_AW_INFO_MODEL: "per-agent"')
|
|
127
152
|
.replace(/OPENCODE_MODEL: [^\n]+/g, "OPENCODE_MODEL: ''")
|
|
128
153
|
.replace(/GH_AW_INFO_MODEL_COSTS: '[^']*'/g, 'GH_AW_INFO_MODEL_COSTS: \'{"providers":{}}\'')
|
|
@@ -155,8 +180,9 @@ for (const file of readdirSync(workflowDirectory)) {
|
|
|
155
180
|
// Install only when the pinned version is missing, and take a lock so two jobs starting at
|
|
156
181
|
// once cannot both write the global prefix.
|
|
157
182
|
// gh-aw pins opencode-ai 1.2.14 at every release checked, up to v0.90.0. That version is
|
|
158
|
-
// from 2026-02-25
|
|
159
|
-
//
|
|
183
|
+
// from 2026-02-25, and it was the pin the guard used until the OpenCode 2 migration: the
|
|
184
|
+
// harness now ships @opencode/cli at OPENCODE_VERSION above, and the pin is ours to choose
|
|
185
|
+
// because a gh-aw upgrade does not move it.
|
|
160
186
|
// gh-aw defaults NPM_CONFIG_MIN_RELEASE_AGE to 3 days, which blocks any package
|
|
161
187
|
// published in the last three days with ETARGET "No matching version found ... with a
|
|
162
188
|
// date before". Lowered to 1 so a fix released yesterday is usable. This is a
|
|
@@ -278,15 +304,22 @@ for (const file of readdirSync(workflowDirectory)) {
|
|
|
278
304
|
indent + ' env:\n' + indent + ' DOTNET_INSTALL_DIR: ${{ runner.tool_cache }}/dotnet\n')
|
|
279
305
|
// OpenCode 2 ships as @opencode/cli, not opencode-ai. gh-aw's engine manifest
|
|
280
306
|
// still names opencode-ai and installs it with --ignore-scripts, which blocks
|
|
281
|
-
// the postinstall that selects the platform binary.
|
|
282
|
-
//
|
|
283
|
-
//
|
|
307
|
+
// the postinstall that selects the platform binary.
|
|
308
|
+
//
|
|
309
|
+
// The whole guard is replaced, not just the install inside it. gh-aw emits
|
|
310
|
+
// opencode --version | grep -qF '<gh-aw pin>' || sh -c 'npm install … opencode-ai@<pin>'
|
|
311
|
+
// and rewriting only the inner install left the outer grep on gh-aw's pin while
|
|
312
|
+
// the image carries ours: the grep never matched, so the guard re-ran the install
|
|
313
|
+
// on every job, and a lock already wearing the sentinel was never revisited. The
|
|
314
|
+
// first pattern below collapses that shape — outer guard, wrapper and all — to a
|
|
315
|
+
// single clean guard; the second handles a bare install the outer guard is absent from.
|
|
284
316
|
.replace(
|
|
285
|
-
/npm install --ignore-scripts -g opencode-ai@
|
|
317
|
+
/opencode --version[^\n]*grep -qF '[0-9][0-9.]*' \|\|[^\n]*?npm install --ignore-scripts -g opencode-ai@[0-9][0-9.]*[^\n]*/g,
|
|
286
318
|
() =>
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
319
|
+
OPENCODE_INSTALL_GUARD)
|
|
320
|
+
.replace(
|
|
321
|
+
/npm install --ignore-scripts -g opencode-ai@([0-9][0-9.]*)/g,
|
|
322
|
+
() => OPENCODE_INSTALL_GUARD)
|
|
290
323
|
.replace(/opencode-ai@[0-9][0-9.]*/g, OPENCODE_PACKAGE + '@' + OPENCODE_VERSION)
|
|
291
324
|
.replace(/opencode-ai\b/g, OPENCODE_PACKAGE)
|
|
292
325
|
// One warm server per runner, on its own port, with its own data directory. Keyed on the
|
package/package.json
CHANGED
|
@@ -1,45 +1,46 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@plainconceptsplatform/workflows",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Install and update Platform GitHub agentic workflows.",
|
|
5
|
-
"keywords": [
|
|
6
|
-
"github-actions",
|
|
7
|
-
"agentic-workflows",
|
|
8
|
-
"plain-concepts"
|
|
9
|
-
],
|
|
10
|
-
"repository": {
|
|
11
|
-
"type": "git",
|
|
12
|
-
"url": "git+https://github.com/PlainConceptsPlatform/agentic-workflows.git"
|
|
13
|
-
},
|
|
14
|
-
"bugs": {
|
|
15
|
-
"url": "https://github.com/PlainConceptsPlatform/agentic-workflows/issues"
|
|
16
|
-
},
|
|
17
|
-
"homepage": "https://github.com/PlainConceptsPlatform/agentic-workflows#readme",
|
|
18
|
-
"license": "UNLICENSED",
|
|
19
|
-
"type": "module",
|
|
20
|
-
"bin": {
|
|
21
|
-
"workflows": "./dist/index.js"
|
|
22
|
-
},
|
|
23
|
-
"files": [
|
|
24
|
-
"dist",
|
|
25
|
-
"loops",
|
|
26
|
-
"README.md"
|
|
27
|
-
],
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
|
|
45
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@plainconceptsplatform/workflows",
|
|
3
|
+
"version": "1.0.4",
|
|
4
|
+
"description": "Install and update Platform GitHub agentic workflows.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"github-actions",
|
|
7
|
+
"agentic-workflows",
|
|
8
|
+
"plain-concepts"
|
|
9
|
+
],
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/PlainConceptsPlatform/agentic-workflows.git"
|
|
13
|
+
},
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/PlainConceptsPlatform/agentic-workflows/issues"
|
|
16
|
+
},
|
|
17
|
+
"homepage": "https://github.com/PlainConceptsPlatform/agentic-workflows#readme",
|
|
18
|
+
"license": "UNLICENSED",
|
|
19
|
+
"type": "module",
|
|
20
|
+
"bin": {
|
|
21
|
+
"workflows": "./dist/index.js"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist",
|
|
25
|
+
"loops",
|
|
26
|
+
"README.md"
|
|
27
|
+
],
|
|
28
|
+
"scripts": {
|
|
29
|
+
"build": "tsc --project tsconfig.build.json && node ./scripts/copy-loops.mjs",
|
|
30
|
+
"test": "vitest run",
|
|
31
|
+
"typecheck": "tsc --noEmit --project tsconfig.json",
|
|
32
|
+
"release": "pnpm build && pnpm test && npm publish --access public",
|
|
33
|
+
"prepack": "node ./scripts/copy-loops.mjs"
|
|
34
|
+
},
|
|
35
|
+
"engines": {
|
|
36
|
+
"node": ">=20.19"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"yaml": "^2.9.0"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@types/node": "^22.0.0",
|
|
43
|
+
"typescript": "^5.8.0",
|
|
44
|
+
"vitest": "^3.0.0"
|
|
45
|
+
}
|
|
46
|
+
}
|