opencode-agent-harness 0.0.0-stage → 0.2.0

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 (169) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/LICENSE +21 -0
  3. package/README.md +590 -2
  4. package/bin/agent-harness.js +3059 -0
  5. package/contrib/global-plugins/README.md +49 -0
  6. package/contrib/global-plugins/harness-freshness.ts +355 -0
  7. package/package.json +48 -4
  8. package/templates/.agents/AGENTS.md +204 -0
  9. package/templates/.agents/features/INDEX.md +10 -0
  10. package/templates/.agents/handoffs/README.md +87 -0
  11. package/templates/.agents/memory/dev-loop.md +59 -0
  12. package/templates/.agents/memory/domain-map.md +29 -0
  13. package/templates/.agents/memory/environments.md +35 -0
  14. package/templates/.agents/memory/flow-map.md +23 -0
  15. package/templates/.agents/memory/history.md +7 -0
  16. package/templates/.agents/memory/locations.md +14 -0
  17. package/templates/.agents/memory/model-routing.md +261 -0
  18. package/templates/.agents/memory/orchestration.md +183 -0
  19. package/templates/.agents/memory/owned-files.md +19 -0
  20. package/templates/.agents/memory/product-principles.md +37 -0
  21. package/templates/.agents/memory/quality-parameters.md +37 -0
  22. package/templates/.agents/memory/stack-versions.md +35 -0
  23. package/templates/.agents/memory/test-design-parameters.md +36 -0
  24. package/templates/.agents/nightly.json +17 -0
  25. package/templates/.agents/qa-plans/README.md +70 -0
  26. package/templates/.agents/qa-runs/README.md +21 -0
  27. package/templates/.agents/reviews/README.md +47 -0
  28. package/templates/.agents/rules/00-operating.md +199 -0
  29. package/templates/.agents/skills/data-engineer/SKILL.md +31 -0
  30. package/templates/.agents/skills/devops-engineer/SKILL.md +50 -0
  31. package/templates/.agents/skills/diagnostics-expert/SKILL.md +44 -0
  32. package/templates/.agents/skills/docs/SKILL.md +140 -0
  33. package/templates/.agents/skills/features/SKILL.md +187 -0
  34. package/templates/.agents/skills/frontend-engineer/SKILL.md +81 -0
  35. package/templates/.agents/skills/handoff/SKILL.md +85 -0
  36. package/templates/.agents/skills/mobile-engineer/SKILL.md +101 -0
  37. package/templates/.agents/skills/planner/SKILL.md +112 -0
  38. package/templates/.agents/skills/product-manager/SKILL.md +115 -0
  39. package/templates/.agents/skills/qa-architect/SKILL.md +224 -0
  40. package/templates/.agents/skills/qa-runner/SKILL.md +64 -0
  41. package/templates/.agents/skills/security-engineer/SKILL.md +53 -0
  42. package/templates/.agents/skills/system-architect/SKILL.md +42 -0
  43. package/templates/.agents/skills/ui-designer/SKILL.md +71 -0
  44. package/templates/.github/workflows/ci.yml +148 -0
  45. package/templates/.github/workflows/deploy-uat.yml +95 -0
  46. package/templates/.github/workflows/nightly.yml +83 -0
  47. package/templates/.github/workflows/uat-health.yml +41 -0
  48. package/templates/.husky/pre-push +23 -0
  49. package/templates/.ignore +28 -0
  50. package/templates/.opencode/agents/data-engineer.md +37 -0
  51. package/templates/.opencode/agents/devops-engineer.md +37 -0
  52. package/templates/.opencode/agents/diagnostics-expert.md +37 -0
  53. package/templates/.opencode/agents/docs.md +37 -0
  54. package/templates/.opencode/agents/features.md +21 -0
  55. package/templates/.opencode/agents/frontend-engineer.md +37 -0
  56. package/templates/.opencode/agents/handoff.md +21 -0
  57. package/templates/.opencode/agents/mobile-engineer.md +37 -0
  58. package/templates/.opencode/agents/planner.md +34 -0
  59. package/templates/.opencode/agents/product-manager.md +29 -0
  60. package/templates/.opencode/agents/qa-architect.md +27 -0
  61. package/templates/.opencode/agents/qa-runner.md +17 -0
  62. package/templates/.opencode/agents/security-engineer.md +37 -0
  63. package/templates/.opencode/agents/system-architect.md +37 -0
  64. package/templates/.opencode/agents/ui-designer.md +37 -0
  65. package/templates/.opencode/commands/board.md +15 -0
  66. package/templates/.opencode/commands/checkpoint.md +25 -0
  67. package/templates/.opencode/commands/feature.md +56 -0
  68. package/templates/.opencode/commands/finish.md +36 -0
  69. package/templates/.opencode/commands/next.md +49 -0
  70. package/templates/.opencode/commands/report.md +55 -0
  71. package/templates/.opencode/commands/resume.md +39 -0
  72. package/templates/.opencode/commands/switch-model.md +34 -0
  73. package/templates/.opencode/commands/tidy.md +49 -0
  74. package/templates/.opencode/plugins/backlog-notify.ts +57 -0
  75. package/templates/.opencode/plugins/backlog.ts +272 -0
  76. package/templates/.opencode/plugins/checkpoint.ts +160 -0
  77. package/templates/.opencode/plugins/context-guard.ts +1164 -0
  78. package/templates/.opencode/plugins/diff.ts +85 -0
  79. package/templates/.opencode/plugins/gates.ts +71 -0
  80. package/templates/.opencode/plugins/job-notify.ts +241 -0
  81. package/templates/.opencode/plugins/orient.ts +67 -0
  82. package/templates/.opencode/plugins/session.ts +89 -0
  83. package/templates/.opencode/plugins/wait.ts +101 -0
  84. package/templates/.opencode/plugins/where.ts +70 -0
  85. package/templates/.opencode/skills/bounded-explore/SKILL.md +38 -0
  86. package/templates/.opencode/skills/dev-loop/SKILL.md +87 -0
  87. package/templates/.vercelignore +16 -0
  88. package/templates/AGENTS.md +27 -0
  89. package/templates/BACKLOG.md +95 -0
  90. package/templates/docs/ci-cd-pipeline.md +81 -0
  91. package/templates/docs/gates.md +128 -0
  92. package/templates/docs/mcp-integrations.md +97 -0
  93. package/templates/docs/mobile-testing.md +555 -0
  94. package/templates/docs/nightly-testing.md +106 -0
  95. package/templates/docs/wsl-optimizations.md +290 -0
  96. package/templates/opencode.json +188 -0
  97. package/templates/scripts/agent-report.js +541 -0
  98. package/templates/scripts/agent-search.sh +117 -0
  99. package/templates/scripts/backlog.js +1864 -0
  100. package/templates/scripts/board-service.sh +207 -0
  101. package/templates/scripts/checkpoint.js +290 -0
  102. package/templates/scripts/finalize.js +277 -0
  103. package/templates/scripts/nightly.js +913 -0
  104. package/templates/scripts/orient.js +514 -0
  105. package/templates/scripts/qa/board-client.js +260 -0
  106. package/templates/scripts/qa/board-lib.js +96 -0
  107. package/templates/scripts/qa/board-sync.js +469 -0
  108. package/templates/scripts/qa/capacity-lib.js +916 -0
  109. package/templates/scripts/qa/check-backlog.js +427 -0
  110. package/templates/scripts/qa/check-capacity.js +85 -0
  111. package/templates/scripts/qa/check-ci-policy.js +164 -0
  112. package/templates/scripts/qa/check-concurrency.js +344 -0
  113. package/templates/scripts/qa/check-dispatch-config.js +296 -0
  114. package/templates/scripts/qa/check-docs.js +284 -0
  115. package/templates/scripts/qa/check-integrate.js +98 -0
  116. package/templates/scripts/qa/check-linger.js +160 -0
  117. package/templates/scripts/qa/check-prefix-stability.js +183 -0
  118. package/templates/scripts/qa/check-product.js +177 -0
  119. package/templates/scripts/qa/check-qa-plan.js +378 -0
  120. package/templates/scripts/qa/check-qa-scripts.js +85 -0
  121. package/templates/scripts/qa/check-quality.js +249 -0
  122. package/templates/scripts/qa/check-test-wiring.js +253 -0
  123. package/templates/scripts/qa/ci-triage.js +346 -0
  124. package/templates/scripts/qa/ci-usage-lib.js +185 -0
  125. package/templates/scripts/qa/ci-wait-lib.js +294 -0
  126. package/templates/scripts/qa/command-classifier.js +552 -0
  127. package/templates/scripts/qa/context-guard-core.js +1618 -0
  128. package/templates/scripts/qa/diff.js +174 -0
  129. package/templates/scripts/qa/feature-scaffold.js +224 -0
  130. package/templates/scripts/qa/fixtures/backlog.md +104 -0
  131. package/templates/scripts/qa/governance.js +174 -0
  132. package/templates/scripts/qa/hash-file.js +32 -0
  133. package/templates/scripts/qa/lease-lib.js +263 -0
  134. package/templates/scripts/qa/merge-backlog.js +324 -0
  135. package/templates/scripts/qa/mobile-e2e/analyze-timings.js +300 -0
  136. package/templates/scripts/qa/mobile-e2e/apk-cache.js +420 -0
  137. package/templates/scripts/qa/mobile-e2e/backend-build-cache.js +203 -0
  138. package/templates/scripts/qa/mobile-e2e/boot-emulator.sh +432 -0
  139. package/templates/scripts/qa/mobile-e2e/build-apk.sh +210 -0
  140. package/templates/scripts/qa/mobile-e2e/check-flows.js +453 -0
  141. package/templates/scripts/qa/mobile-e2e/config.yaml +18 -0
  142. package/templates/scripts/qa/mobile-e2e/device-down.sh +88 -0
  143. package/templates/scripts/qa/mobile-e2e/device-up.sh +258 -0
  144. package/templates/scripts/qa/mobile-e2e/ios-simulator-down.sh +72 -0
  145. package/templates/scripts/qa/mobile-e2e/ios-simulator-up.sh +153 -0
  146. package/templates/scripts/qa/mobile-e2e/job-events.js +181 -0
  147. package/templates/scripts/qa/mobile-e2e/prewarm.sh +56 -0
  148. package/templates/scripts/qa/mobile-e2e/run-detached.sh +222 -0
  149. package/templates/scripts/qa/mobile-e2e/run-maestro.js +1543 -0
  150. package/templates/scripts/qa/mobile-e2e/ui-dump.js +327 -0
  151. package/templates/scripts/qa/models.allowlist.txt +32 -0
  152. package/templates/scripts/qa/provider-stats.js +878 -0
  153. package/templates/scripts/qa/run-clean.js +83 -0
  154. package/templates/scripts/qa/run-gates.js +212 -0
  155. package/templates/scripts/qa/run-loop.js +220 -0
  156. package/templates/scripts/qa/session-recon.js +512 -0
  157. package/templates/scripts/qa/store-lib.js +324 -0
  158. package/templates/scripts/qa/tool-lib.js +134 -0
  159. package/templates/scripts/qa/where.js +214 -0
  160. package/templates/scripts/qa/wslconfig-merge.js +157 -0
  161. package/templates/scripts/serve.js +1328 -0
  162. package/templates/scripts/setup-nightly.sh +185 -0
  163. package/templates/scripts/setup-tmpfs.sh +374 -0
  164. package/templates/scripts/ship.js +586 -0
  165. package/templates/scripts/switch-reasoning-model.ps1 +101 -0
  166. package/templates/scripts/switch-reasoning-model.sh +104 -0
  167. package/templates/scripts/wait-for.js +342 -0
  168. package/templates/scripts/wsl-gpu.sh +180 -0
  169. package/templates/scripts/wsl-tune.sh +261 -0
@@ -0,0 +1,294 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ /*
4
+ * ci-wait-lib — bounded, blocking waits shared by `ship.js` (the CI watch on a
5
+ * landed SHA) and `scripts/wait-for.js` (the general "block, don't poll" waiter
6
+ * the agent uses instead of `sleep N; grep log`).
7
+ *
8
+ * Extracted from ship.js so the CI-watch implementation has ONE home: a
9
+ * behavior change (a new conclusion, a cwd-vanished guard, a gh-failure warn)
10
+ * lands once and is used by both the lander and the interactive waiter.
11
+ *
12
+ * Pure-ish and dependency-light: the only process spawns are `gh` (for the CI
13
+ * watch) and the caller's own readiness probes. Every function is bounded by a
14
+ * timeout and never throws into the caller.
15
+ */
16
+
17
+ const fs = require("fs");
18
+ const path = require("path");
19
+ const { spawnSync } = require("child_process");
20
+
21
+ /* The billing/infra-block signature, kept inline so this module stays
22
+ * dependency-light (its contract: the only imports are node builtins). A job
23
+ * that completed with ZERO steps and no runner_name never provisioned a runner:
24
+ * GitHub's answer when the account is out of Actions quota with no valid payment
25
+ * method. `ci-usage-lib.js` owns the full cost model; this is just the detection
26
+ * the CI waiter needs. */
27
+ function allJobsBlocked(jobs) {
28
+ if (!Array.isArray(jobs) || jobs.length === 0) return false;
29
+ return jobs.every((job) => {
30
+ if (!job) return false;
31
+ const steps = Array.isArray(job.steps) ? job.steps.length : 0;
32
+ const runner = job.runner_name == null ? "" : String(job.runner_name).trim();
33
+ return steps === 0 && runner === "";
34
+ });
35
+ }
36
+
37
+ /* The `gh` binary (overridable for tests). */
38
+ function ghBin() {
39
+ return process.env.HARNESS_SHIP_GH_BIN || "gh";
40
+ }
41
+
42
+ /* Synchronous sleep — a poll loop must not need async/await. `Atomics.wait` is
43
+ * a real blocking wait (setTimeout would not block the event loop). The test
44
+ * seam skips it so the watch tests run instantly. */
45
+ function sleepSync(ms) {
46
+ if (process.env.HARNESS_SHIP_CI_NO_SLEEP) return;
47
+ if (!(ms > 0)) return;
48
+ Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
49
+ }
50
+
51
+ function has(cmd) {
52
+ return spawnSync(cmd, ["--version"], { stdio: "ignore" }).status === 0;
53
+ }
54
+
55
+ /* Run a `gh` command and parse its JSON stdout. Returns `{ ok, data, error }`:
56
+ * `ok: false` on any failure (dead cwd, non-zero exit, no gh, malformed JSON)
57
+ * with `error` carrying the real reason — the caller decides whether that is
58
+ * fatal. Never prints, so poll loops stay quiet. The cwd is checked explicitly
59
+ * because a deleted working directory (a feature worktree pruned mid-watch)
60
+ * makes `spawnSync` fail with an opaque error and every poll silently return
61
+ * nothing — the F-252 phantom CI timeout. */
62
+ function ghJson(cwd, args) {
63
+ if (!fs.existsSync(cwd)) {
64
+ return { ok: false, data: null, error: `working directory ${cwd} no longer exists` };
65
+ }
66
+ const res = spawnSync(ghBin(), args, { cwd, encoding: "utf8" });
67
+ if (res.status !== 0) {
68
+ const lines = `${res.stderr || ""}\n${res.stdout || ""}`
69
+ .split(/\r?\n/)
70
+ .map((l) => l.trim())
71
+ .filter(Boolean);
72
+ return { ok: false, data: null, error: lines[lines.length - 1] || `gh exited ${res.status}` };
73
+ }
74
+ try {
75
+ return { ok: true, data: JSON.parse(String(res.stdout || "null")), error: null };
76
+ } catch {
77
+ return { ok: false, data: null, error: "gh returned malformed JSON" };
78
+ }
79
+ }
80
+
81
+ /* Consecutive `gh` failures tolerated before the watch says why it is stuck.
82
+ * `gh` can hiccup transiently, so a single failed poll is not news; a run of
83
+ * them means the watch is blind and the operator should know. */
84
+ const CI_GH_FAILURE_WARN = 4;
85
+
86
+ /* Wait for the CI workflow's run on `sha` to complete. Returns 0 when green
87
+ * (success/skipped/neutral), 1 otherwise (failed, timeout, or a watch that went
88
+ * blind — an unobserved gate is not a passed gate).
89
+ *
90
+ * Polls from `opts.cwd` (the MAIN worktree), not the feature checkout `root`:
91
+ * CI is a property of the landed SHA on the remote, so the feature worktree is
92
+ * not needed to observe it, and a concurrent `worktree-prune` removing that
93
+ * checkout mid-watch must not blind the poll (the F-252 race). A vanished cwd
94
+ * is reported immediately, never as a phantom timeout.
95
+ *
96
+ * `opts.onStatus(text)` (optional) receives each progress line instead of the
97
+ * default `process.stdout.write` spinner, so a non-ship caller (wait-for.js)
98
+ * can render its own. `opts.quiet` suppresses the default spinner. */
99
+ function waitCi(root, sha, opts) {
100
+ const name = opts.workflow;
101
+ const cwd = opts.cwd || root;
102
+ const say = (line, end = "\r") => {
103
+ if (opts.quiet) return;
104
+ if (typeof opts.onStatus === "function") opts.onStatus(line);
105
+ else process.stdout.write(`${line}${end}`);
106
+ };
107
+ if (!name) {
108
+ console.warn(
109
+ "ship: no CI workflow detected — landed, but cannot confirm CI. Add a `.github/workflows/ci.yml` (name: CI)."
110
+ );
111
+ return 0;
112
+ }
113
+ if (!has(ghBin())) {
114
+ console.error(
115
+ `ship: landed ${sha.slice(0, 7)}, but \`gh\` is unavailable — CI was NOT confirmed.\n` +
116
+ ` Confirm manually: gh run list --workflow "${name}" --commit ${sha}`
117
+ );
118
+ return 1;
119
+ }
120
+ const deadline = Date.now() + opts.timeoutMs;
121
+ let failures = 0;
122
+ let warned = false;
123
+ for (;;) {
124
+ const res = ghJson(cwd, [
125
+ "run",
126
+ "list",
127
+ "--workflow",
128
+ name,
129
+ "--commit",
130
+ sha,
131
+ "--limit",
132
+ "10",
133
+ "--json",
134
+ "databaseId,status,conclusion,url,headSha,name",
135
+ ]);
136
+ if (!res.ok) {
137
+ failures += 1;
138
+ if (!fs.existsSync(cwd)) {
139
+ console.error(
140
+ `ship: landed ${sha.slice(0, 7)}, but the CI watch lost its working directory:\n` +
141
+ ` ${res.error}\n` +
142
+ " The checkout was removed while CI was still being watched. Confirm CI from the main tree:\n" +
143
+ ` gh run list --workflow "${name}" --commit ${sha}`
144
+ );
145
+ return 1;
146
+ }
147
+ if (failures >= CI_GH_FAILURE_WARN && !warned) {
148
+ warned = true;
149
+ console.warn(
150
+ `ship: \`gh\` has failed ${failures} times while watching CI (${res.error}) — ` +
151
+ `still waiting until the ${Math.round(opts.timeoutMs / 60000)}m deadline.`
152
+ );
153
+ }
154
+ if (Date.now() >= deadline) {
155
+ console.error(
156
+ `ship: timed out after ${Math.round(opts.timeoutMs / 60000)}m waiting for ${name} on ${sha.slice(0, 7)}.\n` +
157
+ ` The change LANDED; CI is not confirmed. Last \`gh\` error: ${res.error}\n` +
158
+ " Check:\n" +
159
+ ` gh run list --workflow "${name}" --commit ${sha}`
160
+ );
161
+ return 1;
162
+ }
163
+ say(`[ci] waiting for ${name} on ${sha.slice(0, 7)}...`);
164
+ sleepSync(opts.pollMs);
165
+ continue;
166
+ }
167
+ failures = 0;
168
+ const runs = res.data;
169
+ const run = (runs || []).find((r) => !r.headSha || r.headSha === sha) || (runs || [])[0] || null;
170
+ if (run && run.status === "completed") {
171
+ if (["success", "skipped", "neutral"].includes(run.conclusion)) {
172
+ console.log(`[ci] ${name} green on ${sha.slice(0, 7)}${run.url ? " — " + run.url : ""}`);
173
+ return 0;
174
+ }
175
+ // A red run is not always a red TEST: a billing/infra block provisions no
176
+ // runner at all (steps: 0, runner_name empty, ~4-6s). Name that state
177
+ // explicitly instead of reporting "tests failed", and tell the operator
178
+ // what to fix — this is the 2026-10 nine-day silent outage.
179
+ if (run.databaseId) {
180
+ const jobsRes = ghJson(cwd, [
181
+ "api",
182
+ `/repos/{owner}/{repo}/actions/runs/${run.databaseId}/jobs`,
183
+ "--jq",
184
+ ".jobs",
185
+ ]);
186
+ const jobs = jobsRes.ok ? jobsRes.data : null;
187
+ if (allJobsBlocked(jobs)) {
188
+ console.error(
189
+ `ship: ${name} did NOT RUN on ${sha.slice(0, 7)} — GitHub Actions billing/infra block.\n` +
190
+ ` The job(s) provisioned no runner (0 steps, no runner_name), so this is NOT a test failure.\n` +
191
+ " Fix: add/repair the account payment method or raise the spending limit, then re-dispatch.\n" +
192
+ ` gh run view ${run.databaseId}\n` +
193
+ ` gh auth refresh -h github.com -s user # makes the billing state readable`
194
+ );
195
+ return 1;
196
+ }
197
+ }
198
+ console.error(
199
+ `ship: ${name} concluded "${run.conclusion}" on ${sha.slice(0, 7)}` +
200
+ (run.url ? " — " + run.url : "") +
201
+ (run.databaseId ? `\n Failing logs: gh run view ${run.databaseId} --log-failed` : "") +
202
+ "\n The change landed but CI is red — fix forward on a new branch.\n" +
203
+ " Emergency rollback: re-deploy the previous good SHA\n" +
204
+ " gh workflow run deploy-uat.yml --ref main -f ref=<previous-good-sha>"
205
+ );
206
+ return 1;
207
+ }
208
+ if (Date.now() >= deadline) {
209
+ console.error(
210
+ `ship: timed out after ${Math.round(opts.timeoutMs / 60000)}m waiting for ${name} on ${sha.slice(0, 7)}.\n` +
211
+ " The change LANDED; CI is not confirmed. Check:\n" +
212
+ ` gh run list --workflow "${name}" --commit ${sha}`
213
+ );
214
+ return 1;
215
+ }
216
+ say(`[ci] waiting for ${name} on ${sha.slice(0, 7)}...`);
217
+ sleepSync(opts.pollMs);
218
+ }
219
+ }
220
+
221
+ /* Read the `name:` of each workflow file under `.github/workflows`. Best-effort:
222
+ * a file without a `name:` is skipped. Shared so wait-for.js can resolve the CI
223
+ * workflow the same way ship does. */
224
+ function workflowNames(root) {
225
+ const dir = path.join(root, ".github", "workflows");
226
+ const names = [];
227
+ if (!fs.existsSync(dir)) return names;
228
+ for (const file of fs.readdirSync(dir)) {
229
+ if (!/\.ya?ml$/i.test(file)) continue;
230
+ try {
231
+ const src = fs.readFileSync(path.join(dir, file), "utf8");
232
+ const m = src.match(/^name:\s*(.+)$/m);
233
+ if (m) names.push(m[1].trim().replace(/^["']|["']$/g, ""));
234
+ } catch (_) {
235
+ /* unreadable: skip */
236
+ }
237
+ }
238
+ return names;
239
+ }
240
+
241
+ /* `shipCiWorkflow` from `.harness.json` when set, else the workflow named `CI`. */
242
+ function ciWorkflow(root) {
243
+ const config = (() => {
244
+ try {
245
+ return JSON.parse(fs.readFileSync(path.join(root, ".harness.json"), "utf8"));
246
+ } catch {
247
+ return null;
248
+ }
249
+ })();
250
+ if (config && config.shipCiWorkflow) return String(config.shipCiWorkflow);
251
+ return workflowNames(root).find((n) => /^ci$/i.test(n)) || null;
252
+ }
253
+
254
+ /* Resolve the CI wait timing (CLI flag > test-seam env > .harness.json >
255
+ * default) into { timeoutMs, pollMs }. */
256
+ function ciConfig(root, args) {
257
+ let config = {};
258
+ try {
259
+ config = JSON.parse(fs.readFileSync(path.join(root, ".harness.json"), "utf8")) || {};
260
+ } catch {
261
+ config = {};
262
+ }
263
+ const a = args || {};
264
+ const envTimeout = Number(process.env.HARNESS_SHIP_CI_TIMEOUT_MS);
265
+ const envPoll = Number(process.env.HARNESS_SHIP_CI_POLL_MS);
266
+ const timeoutMinutes =
267
+ a["ci-timeout"] !== undefined
268
+ ? Number(a["ci-timeout"])
269
+ : Number.isFinite(envTimeout) && envTimeout > 0
270
+ ? envTimeout / 60000
271
+ : Number(config.shipCiTimeoutMinutes) || 20;
272
+ const pollSeconds =
273
+ a["ci-poll"] !== undefined
274
+ ? Number(a["ci-poll"])
275
+ : Number.isFinite(envPoll) && envPoll > 0
276
+ ? envPoll / 1000
277
+ : Number(config.shipCiPollSeconds) || 15;
278
+ return {
279
+ timeoutMs: Math.max(1, Math.round(timeoutMinutes * 60 * 1000)),
280
+ pollMs: Math.max(1, Math.round(pollSeconds * 1000)),
281
+ };
282
+ }
283
+
284
+ module.exports = {
285
+ CI_GH_FAILURE_WARN,
286
+ ghBin,
287
+ sleepSync,
288
+ has,
289
+ ghJson,
290
+ waitCi,
291
+ workflowNames,
292
+ ciWorkflow,
293
+ ciConfig,
294
+ };