@plainconceptsplatform/workflows 1.0.2 → 1.0.5
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.
|
@@ -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":{}}\'')
|
|
@@ -291,15 +316,10 @@ for (const file of readdirSync(workflowDirectory)) {
|
|
|
291
316
|
.replace(
|
|
292
317
|
/opencode --version[^\n]*grep -qF '[0-9][0-9.]*' \|\|[^\n]*?npm install --ignore-scripts -g opencode-ai@[0-9][0-9.]*[^\n]*/g,
|
|
293
318
|
() =>
|
|
294
|
-
|
|
295
|
-
"flock /tmp/opencode-install.lock npm install -g " + OPENCODE_PACKAGE + "@" + OPENCODE_VERSION +
|
|
296
|
-
" # " + OPENCODE_PACKAGE + "@" + OPENCODE_VERSION)
|
|
319
|
+
OPENCODE_INSTALL_GUARD)
|
|
297
320
|
.replace(
|
|
298
321
|
/npm install --ignore-scripts -g opencode-ai@([0-9][0-9.]*)/g,
|
|
299
|
-
() =>
|
|
300
|
-
"opencode --version 2>/dev/null | grep -qF '" + OPENCODE_VERSION + "' || " +
|
|
301
|
-
"flock /tmp/opencode-install.lock npm install -g " + OPENCODE_PACKAGE + "@" + OPENCODE_VERSION +
|
|
302
|
-
" # " + OPENCODE_PACKAGE + "@" + OPENCODE_VERSION)
|
|
322
|
+
() => OPENCODE_INSTALL_GUARD)
|
|
303
323
|
.replace(/opencode-ai@[0-9][0-9.]*/g, OPENCODE_PACKAGE + '@' + OPENCODE_VERSION)
|
|
304
324
|
.replace(/opencode-ai\b/g, OPENCODE_PACKAGE)
|
|
305
325
|
// One warm server per runner, on its own port, with its own data directory. Keyed on the
|
|
@@ -360,9 +360,25 @@ jobs:
|
|
|
360
360
|
with:
|
|
361
361
|
client-id: ${{ secrets.BOT_APP_ID }}
|
|
362
362
|
private-key: ${{ secrets.BOT_PRIVATE_KEY }}
|
|
363
|
-
#
|
|
364
|
-
#
|
|
365
|
-
#
|
|
363
|
+
# Path B needs this step, exactly as triage and merge-gate have it. `staged: true` above
|
|
364
|
+
# means the framework writes nothing, so without an apply the run validates everything and
|
|
365
|
+
# publishes nothing: the agent's comment and the refined body stay in the artifact, conclude
|
|
366
|
+
# reports success, and the issue keeps `refine` forever. That is how a refine came back green
|
|
367
|
+
# and untouched.
|
|
368
|
+
#
|
|
369
|
+
# It is not redundant with safe_outputs: staged, safe_outputs never writes. The comment that
|
|
370
|
+
# used to sit here said this action filed a duplicate of every split child, which is what
|
|
371
|
+
# happens when it runs *without* staging. Staged, the children exist only in the artifact
|
|
372
|
+
# and this step is the only thing that creates them.
|
|
373
|
+
- name: Apply agent output
|
|
374
|
+
uses: ./.github/actions/apply-agent-output
|
|
375
|
+
with:
|
|
376
|
+
artifact-name: ${{ needs.activation.outputs.artifact_prefix }}agent
|
|
377
|
+
token: ${{ steps.app-token.outputs.token }}
|
|
378
|
+
apply-labels: 'false'
|
|
379
|
+
update-issues: 'true'
|
|
380
|
+
create-issues: 'true'
|
|
381
|
+
fallback-issue-number: ${{ inputs.issue-number }}
|
|
366
382
|
- name: Apply complete refinement labels
|
|
367
383
|
if: needs.validate_output.outputs.outcome == 'complete'
|
|
368
384
|
uses: ./.github/actions/add-issue-labels
|