@tablation/crew 0.158.3 → 0.159.1
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/README.md +4 -1
- package/dist/cli.js +272 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -184,7 +184,10 @@ a route has `enabled: true`.
|
|
|
184
184
|
Right after the project resolves, `crew connect` prints a capability checklist
|
|
185
185
|
for the signed-in member (write the Crew and Ships tables, create Repos rows,
|
|
186
186
|
mint agent keys, sync personas and skills): `ok`, or `missing — ask a workspace
|
|
187
|
-
admin for <capability>`.
|
|
187
|
+
admin for <capability>`. A member key never syncs personas and skills, and does
|
|
188
|
+
not need to: when the workspace's Agents rows exist that line is `info` (the ship
|
|
189
|
+
uses them as they are), not a miss; only a lane role with no Agents row asks an
|
|
190
|
+
admin to run `crew agents sync` once. With `--json` it is one `capabilities` event on stdout.
|
|
188
191
|
Connect carries on for whatever is allowed; misses are stored in the route's
|
|
189
192
|
resolved state and `crew doctor` repeats them until a re-connect finds the grant
|
|
190
193
|
in place.
|
package/dist/cli.js
CHANGED
|
@@ -34,6 +34,97 @@ function doctorBaseReport(r, base, health) {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
// src/ci-provider.ts
|
|
38
|
+
function ciProviderFor(name, deps) {
|
|
39
|
+
return name === "github" ? githubProvider(deps) : null;
|
|
40
|
+
}
|
|
41
|
+
var isQueryableCiProvider = (name) => name === "github";
|
|
42
|
+
function logTail(log, n = 40) {
|
|
43
|
+
return log.split("\n").map((l) => l.replace(/^\d{4}-\d\d-\d\dT[\d:.]+Z /, "").replace(/\r$/, "")).filter((l) => l.trim()).slice(-n).join("\n");
|
|
44
|
+
}
|
|
45
|
+
var FAILED = /* @__PURE__ */ new Set(["failure", "timed_out", "startup_failure"]);
|
|
46
|
+
var PASSED = /* @__PURE__ */ new Set(["success", "skipped", "neutral"]);
|
|
47
|
+
function githubApiBase(host) {
|
|
48
|
+
return host === "github.com" ? "https://api.github.com" : `https://${host}/api/v3`;
|
|
49
|
+
}
|
|
50
|
+
function githubProvider(deps) {
|
|
51
|
+
const doFetch = deps.fetch ?? fetch;
|
|
52
|
+
const get2 = async (q2, path, accept = "application/vnd.github+json") => {
|
|
53
|
+
const token = deps.token(q2.host);
|
|
54
|
+
if (!token) throw new CiAccessError(`no readable forge credential for ${q2.host}`);
|
|
55
|
+
return doFetch(`${githubApiBase(q2.host)}/repos/${q2.remote}${path}`, {
|
|
56
|
+
headers: { authorization: `Bearer ${token}`, accept, "user-agent": "crew", "x-github-api-version": "2022-11-28" },
|
|
57
|
+
redirect: "follow"
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
return {
|
|
61
|
+
name: "github",
|
|
62
|
+
async runs(q2) {
|
|
63
|
+
let res;
|
|
64
|
+
try {
|
|
65
|
+
res = await get2(q2, `/actions/runs?head_sha=${encodeURIComponent(q2.sha)}&per_page=100`);
|
|
66
|
+
} catch (e) {
|
|
67
|
+
if (e instanceof CiAccessError) return { ok: false, why: e.message };
|
|
68
|
+
return { ok: false, why: `${q2.host} unreachable: ${e.message}` };
|
|
69
|
+
}
|
|
70
|
+
if (!res.ok) return { ok: false, why: describeHttp(res, q2) };
|
|
71
|
+
let body;
|
|
72
|
+
try {
|
|
73
|
+
body = await res.json();
|
|
74
|
+
} catch {
|
|
75
|
+
return { ok: false, why: `${q2.host} sent a reply that is not JSON` };
|
|
76
|
+
}
|
|
77
|
+
const runs = [];
|
|
78
|
+
for (const r of body.workflow_runs ?? []) {
|
|
79
|
+
if (r.event === "pull_request" || r.event === "pull_request_target") continue;
|
|
80
|
+
runs.push({
|
|
81
|
+
id: String(r.id),
|
|
82
|
+
name: r.name ?? `run ${r.id}`,
|
|
83
|
+
url: r.html_url ?? "",
|
|
84
|
+
state: r.status !== "completed" ? "pending" : FAILED.has(r.conclusion ?? "") ? "failed" : PASSED.has(r.conclusion ?? "") ? "passed" : "other",
|
|
85
|
+
ref: q2.tag && r.head_branch === q2.tag ? "tag" : r.head_branch === q2.base ? "base" : "other"
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
return { ok: true, runs };
|
|
89
|
+
},
|
|
90
|
+
async failure(q2, run4) {
|
|
91
|
+
const out = { run: run4 };
|
|
92
|
+
try {
|
|
93
|
+
const res = await get2(q2, `/actions/runs/${run4.id}/jobs?filter=latest&per_page=100`);
|
|
94
|
+
if (!res.ok) return out;
|
|
95
|
+
const jobs = (await res.json()).jobs ?? [];
|
|
96
|
+
const job = jobs.find((j) => FAILED.has(j.conclusion ?? ""));
|
|
97
|
+
if (!job) return out;
|
|
98
|
+
out.job = job.name;
|
|
99
|
+
out.step = job.steps?.find((s) => FAILED.has(s.conclusion ?? ""))?.name;
|
|
100
|
+
const log = await get2(q2, `/actions/jobs/${job.id}/logs`, "*/*");
|
|
101
|
+
if (log.ok) out.logTail = logTail(await log.text());
|
|
102
|
+
} catch {
|
|
103
|
+
}
|
|
104
|
+
return out;
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
var CiAccessError = class extends Error {
|
|
109
|
+
};
|
|
110
|
+
function describeHttp(res, q2) {
|
|
111
|
+
if (res.status === 429 || res.status === 403 && res.headers.get("x-ratelimit-remaining") === "0") {
|
|
112
|
+
return `${q2.host} is rate limiting this credential`;
|
|
113
|
+
}
|
|
114
|
+
if (res.status === 401 || res.status === 403) return `the forge credential cannot read ${q2.remote}'s runs (HTTP ${res.status})`;
|
|
115
|
+
if (res.status === 404) return `${q2.remote}'s runs are not visible to the forge credential (HTTP 404)`;
|
|
116
|
+
return `${q2.host} answered HTTP ${res.status}`;
|
|
117
|
+
}
|
|
118
|
+
function describeCiFailure(f) {
|
|
119
|
+
const where = f.job ? ` \u2014 job "${f.job}"${f.step ? `, step "${f.step}"` : ""}` : "";
|
|
120
|
+
return `${f.run.name}${where}${f.run.url ? ` (${f.run.url})` : ""}`;
|
|
121
|
+
}
|
|
122
|
+
function ciRemoteOf(url) {
|
|
123
|
+
if (!url) return null;
|
|
124
|
+
const m = /^[a-z+]+:\/\/(?:[^@/]*@)?([^/:]+)(?::\d+)?\/(.+?)(?:\.git)?\/?$/i.exec(url.trim()) ?? /^[\w.-]+@([\w.-]+):(.+?)(?:\.git)?\/?$/.exec(url.trim());
|
|
125
|
+
return m ? { host: m[1].toLowerCase(), remote: m[2] } : null;
|
|
126
|
+
}
|
|
127
|
+
|
|
37
128
|
// src/periscopes.ts
|
|
38
129
|
import { lookup } from "dns/promises";
|
|
39
130
|
function periscopeRoutes(cfg) {
|
|
@@ -6990,6 +7081,12 @@ function clearShipAttention(state, key) {
|
|
|
6990
7081
|
const next = clear(previous, key);
|
|
6991
7082
|
if (next.length !== previous.length) store.persist(next);
|
|
6992
7083
|
}
|
|
7084
|
+
function clearShipAttentionKind(state, kind, keyPrefix) {
|
|
7085
|
+
const store = state.shipAttention();
|
|
7086
|
+
const previous = store.previous();
|
|
7087
|
+
const next = previous.filter((i) => !(i.kind === kind && i.key.startsWith(keyPrefix)));
|
|
7088
|
+
if (next.length !== previous.length) store.persist(next);
|
|
7089
|
+
}
|
|
6993
7090
|
function hookCommand(script) {
|
|
6994
7091
|
if (mapFilePath(script)) return null;
|
|
6995
7092
|
for (const raw of script.split("\n")) {
|
|
@@ -22007,7 +22104,7 @@ function writeChangelog(o, version, entries) {
|
|
|
22007
22104
|
const existing = existsAt(path, existsSync42) ? readTextAt(path, (p) => readFileSync41(p, "utf8")) : "# Changelog\n";
|
|
22008
22105
|
writeTextAt(path, insertChangelogSection(existing, section), writeFileSync34);
|
|
22009
22106
|
}
|
|
22010
|
-
async function confirm(o, expected) {
|
|
22107
|
+
async function confirm(o, expected, ci) {
|
|
22011
22108
|
if (!o.repo.hooks.released) return void 0;
|
|
22012
22109
|
const { timeoutSeconds, intervalSeconds, match } = o.repo.release.verify;
|
|
22013
22110
|
if (o.dryRun) {
|
|
@@ -22019,10 +22116,15 @@ async function confirm(o, expected) {
|
|
|
22019
22116
|
const r = await hook(o, "released");
|
|
22020
22117
|
const live2 = r?.output.trim().split("\n").filter(Boolean).pop() ?? "";
|
|
22021
22118
|
const hit = match === "commit" ? live2.startsWith(expected.slice(0, 7)) || expected.startsWith(live2.slice(0, 7)) : live2 === expected;
|
|
22119
|
+
if (ci) await sweepCi(o, ci, Boolean(live2 && hit));
|
|
22022
22120
|
if (live2 && hit) {
|
|
22023
22121
|
o.emit.emit(`confirmed live: ${live2.slice(0, 12)}`);
|
|
22024
22122
|
return true;
|
|
22025
22123
|
}
|
|
22124
|
+
if (ci?.failures.some((f) => f.run.ref === "tag")) {
|
|
22125
|
+
o.emit.warn(`the CI run for ${ci.q.tag ?? "the release tag"} failed \u2014 not waiting out the remaining ${Math.max(0, Math.round((deadline - Date.now()) / 1e3))}s`);
|
|
22126
|
+
return false;
|
|
22127
|
+
}
|
|
22026
22128
|
if (Date.now() >= deadline) {
|
|
22027
22129
|
o.emit.warn(`not confirmed within ${timeoutSeconds}s \u2014 target reports ${live2 || "nothing"}`);
|
|
22028
22130
|
return false;
|
|
@@ -22030,6 +22132,60 @@ async function confirm(o, expected) {
|
|
|
22030
22132
|
await new Promise((r2) => setTimeout(r2, intervalSeconds * 1e3));
|
|
22031
22133
|
}
|
|
22032
22134
|
}
|
|
22135
|
+
function newCiWatch(o, sha, tag, version) {
|
|
22136
|
+
if (!o.ci || o.dryRun) return void 0;
|
|
22137
|
+
return {
|
|
22138
|
+
provider: o.ci.provider,
|
|
22139
|
+
version,
|
|
22140
|
+
failures: [],
|
|
22141
|
+
off: false,
|
|
22142
|
+
green: false,
|
|
22143
|
+
q: { host: o.ci.host, remote: o.ci.remote, sha, tag, base: o.repo.branch.base }
|
|
22144
|
+
};
|
|
22145
|
+
}
|
|
22146
|
+
var ciKeyPrefix = (o) => `ci_run_failed:${o.scope ?? "release"}/`;
|
|
22147
|
+
var ciKey = (o, version) => `${ciKeyPrefix(o)}${version}`;
|
|
22148
|
+
async function sweepCi(o, w, live2) {
|
|
22149
|
+
if (w.off) return;
|
|
22150
|
+
const got = await w.provider.runs(w.q);
|
|
22151
|
+
if (!got.ok) {
|
|
22152
|
+
w.off = true;
|
|
22153
|
+
o.emit.warn(`could not read the ${w.provider.name} CI runs for ${w.q.sha.slice(0, 8)} (${got.why}); waiting on the released hook alone`);
|
|
22154
|
+
return;
|
|
22155
|
+
}
|
|
22156
|
+
const failed = got.runs.filter((r) => r.state === "failed");
|
|
22157
|
+
w.green = got.runs.length > 0 && got.runs.every((r) => r.state === "passed" || r.state === "other");
|
|
22158
|
+
if (failed.length === 0) {
|
|
22159
|
+
w.failures = [];
|
|
22160
|
+
o.attention?.clear(ciKey(o, w.version));
|
|
22161
|
+
return;
|
|
22162
|
+
}
|
|
22163
|
+
for (const run4 of failed) {
|
|
22164
|
+
if (w.failures.some((f2) => f2.run.id === run4.id)) continue;
|
|
22165
|
+
const f = await w.provider.failure(w.q, run4);
|
|
22166
|
+
w.failures.push(f);
|
|
22167
|
+
o.emit.error(`CI run failed for ${w.version}: ${describeCiFailure(f)}`, { data: { run: run4.id, ref: run4.ref } });
|
|
22168
|
+
}
|
|
22169
|
+
w.failures = w.failures.filter((f) => failed.some((r) => r.id === f.run.id));
|
|
22170
|
+
if (o.attention) {
|
|
22171
|
+
const url = w.failures.find((f) => f.run.url)?.run.url;
|
|
22172
|
+
await o.attention.raise({
|
|
22173
|
+
kind: "ci_run_failed",
|
|
22174
|
+
key: ciKey(o, w.version),
|
|
22175
|
+
message: `${o.scope ?? "release"}: CI failed for ${w.version} \u2014 ${w.failures.map(describeCiFailure).join("; ")}`,
|
|
22176
|
+
since: (/* @__PURE__ */ new Date()).toISOString(),
|
|
22177
|
+
ci: { ...url ? { url } : {}, blocking: !live2, repo: o.scope ?? "release", version: w.version }
|
|
22178
|
+
});
|
|
22179
|
+
}
|
|
22180
|
+
}
|
|
22181
|
+
function ciOutcome(o, w, confirmed) {
|
|
22182
|
+
if (!w) return {};
|
|
22183
|
+
if (w.failures.length) {
|
|
22184
|
+
return { ci: { failures: w.failures, blocking: confirmed !== true, sha: w.q.sha, ...w.q.tag ? { tag: w.q.tag } : {} } };
|
|
22185
|
+
}
|
|
22186
|
+
if (confirmed === true && w.green) o.attention?.clearKind?.("ci_run_failed", ciKeyPrefix(o));
|
|
22187
|
+
return w.green ? { ciGreen: true } : {};
|
|
22188
|
+
}
|
|
22033
22189
|
function refreshBase(o) {
|
|
22034
22190
|
const r = refreshBaseBranch(o.cwd, o.repo.branch.remote, o.repo.branch.base, o.dryRun);
|
|
22035
22191
|
switch (r.action) {
|
|
@@ -22079,9 +22235,10 @@ var canReconfirm = (o, decision) => !o.dryRun && (o.repo.release.mode === "ci_ma
|
|
|
22079
22235
|
async function confirmLastRelease(o, decision) {
|
|
22080
22236
|
const version = decision.lastTag.replace(/^v/, "");
|
|
22081
22237
|
const expected = o.repo.release.verify.match === "version" ? version : decision.lastReleased;
|
|
22082
|
-
const
|
|
22238
|
+
const watch2 = newCiWatch(o, decision.lastReleased, decision.lastTag, version);
|
|
22239
|
+
const confirmed = await confirm(o, expected, watch2) === true;
|
|
22083
22240
|
if (!confirmed) o.emit.warn(`${decision.lastTag} is still not confirmed live \u2014 tickets stay verified`);
|
|
22084
|
-
return { confirmed, version };
|
|
22241
|
+
return { confirmed, version, ...ciOutcome(o, watch2, confirmed) };
|
|
22085
22242
|
}
|
|
22086
22243
|
function closeReleaseCheckout(cwd, root, dir, branch, run4 = gitOk) {
|
|
22087
22244
|
try {
|
|
@@ -22529,7 +22686,9 @@ async function mergeAndReleaseBody(o, decision, fresh, releaseBranch, isolated =
|
|
|
22529
22686
|
confirmed: re.confirmed || void 0,
|
|
22530
22687
|
stampFrom: re.from,
|
|
22531
22688
|
stopped: "nothing to release",
|
|
22532
|
-
decision
|
|
22689
|
+
decision,
|
|
22690
|
+
...re.ci ? { ci: re.ci } : {},
|
|
22691
|
+
...re.ciGreen ? { ciGreen: true } : {}
|
|
22533
22692
|
};
|
|
22534
22693
|
}
|
|
22535
22694
|
o.emit.note("nothing to release");
|
|
@@ -22760,12 +22919,13 @@ async function mergeAndReleaseBody(o, decision, fresh, releaseBranch, isolated =
|
|
|
22760
22919
|
}
|
|
22761
22920
|
}
|
|
22762
22921
|
const expected = o.repo.release.verify.match === "version" && version ? version : o.dryRun ? head : headSha(o.cwd);
|
|
22763
|
-
const
|
|
22922
|
+
const watch2 = newCiWatch(o, o.dryRun ? head : headSha(o.cwd), tag, version ?? "");
|
|
22923
|
+
const confirmed = await confirm(o, expected, watch2);
|
|
22764
22924
|
o.emit.emit(
|
|
22765
22925
|
`release ${o.dryRun ? "plan complete" : "complete"}: ${merged.length} merged${version ? `, ${version}` : ""}${tag ? `, tagged ${tag}` : ""}`,
|
|
22766
22926
|
{ data: { merged: merged.length, version, tag, deployed, integrated, confirmed } }
|
|
22767
22927
|
);
|
|
22768
|
-
return { merged, conflicts, unbuildable, version, tag, deployed, integrated, confirmed, decision };
|
|
22928
|
+
return { merged, conflicts, unbuildable, version, tag, deployed, integrated, confirmed, decision, ...ciOutcome(o, watch2, confirmed) };
|
|
22769
22929
|
}
|
|
22770
22930
|
|
|
22771
22931
|
// src/failure-alert.ts
|
|
@@ -25429,7 +25589,7 @@ function defaultReadLog(path) {
|
|
|
25429
25589
|
return null;
|
|
25430
25590
|
}
|
|
25431
25591
|
}
|
|
25432
|
-
function
|
|
25592
|
+
function logTail2(text2, n = LOG_TAIL_LINES) {
|
|
25433
25593
|
if (text2 === null) return [];
|
|
25434
25594
|
return text2.split("\n").map((l) => l.trimEnd()).filter((l) => l.trim() !== "").slice(-n);
|
|
25435
25595
|
}
|
|
@@ -25477,7 +25637,7 @@ function startLaunchdDaemon(o) {
|
|
|
25477
25637
|
err3 += "crew daemon start: the daemon did not stay up.\n";
|
|
25478
25638
|
err3 += ` last exit status: ${after.lastExitCode ?? "none recorded"}
|
|
25479
25639
|
`;
|
|
25480
|
-
const tail3 =
|
|
25640
|
+
const tail3 = logTail2(readLog(o.schedulerLog));
|
|
25481
25641
|
if (tail3.length) {
|
|
25482
25642
|
err3 += ` last lines of ${o.schedulerLog}:
|
|
25483
25643
|
`;
|
|
@@ -26992,6 +27152,22 @@ async function projectCapabilities(o, projectId) {
|
|
|
26992
27152
|
return void 0;
|
|
26993
27153
|
}
|
|
26994
27154
|
}
|
|
27155
|
+
var LANE_ROLES = ROLE_NAMES.filter((r) => r !== "pair");
|
|
27156
|
+
async function memberPersonaItem(o, found) {
|
|
27157
|
+
const key = "sync-personas";
|
|
27158
|
+
const label = "sync personas and skills";
|
|
27159
|
+
try {
|
|
27160
|
+
const model = await get(o, `/data-models/agents?workspaceId=${found.workspaceId}`);
|
|
27161
|
+
const rows = await get(o, `/data-models/${model.id}/records?limit=200`);
|
|
27162
|
+
const absent = LANE_ROLES.filter((r) => !rows.some((row) => row.name === PERSONA_NAME[r]));
|
|
27163
|
+
if (absent.length > 0) {
|
|
27164
|
+
return { key, label, status: "missing", askFor: `one \`crew agents sync\` run (no Agents row for ${absent.map((r) => PERSONA_NAME[r]).join(", ")})` };
|
|
27165
|
+
}
|
|
27166
|
+
return { key, label, status: "info", note: "this ship uses the workspace's personas and skills as they are" };
|
|
27167
|
+
} catch {
|
|
27168
|
+
return { key, label, status: "skipped", note: "could not read the Agents table" };
|
|
27169
|
+
}
|
|
27170
|
+
}
|
|
26995
27171
|
async function checkCapabilities(o, found) {
|
|
26996
27172
|
const admin = isAdminRole(found.role);
|
|
26997
27173
|
const table2 = async (key, label, tableName2, modelId, askFor) => {
|
|
@@ -27007,7 +27183,7 @@ async function checkCapabilities(o, found) {
|
|
|
27007
27183
|
projectCapabilities(o, found.projectId)
|
|
27008
27184
|
]);
|
|
27009
27185
|
const mint = admin || caps?.MINT_AGENT_KEYS ? { key: "mint-agent-keys", label: "mint agent keys", status: "ok" } : caps ? { key: "mint-agent-keys", label: "mint agent keys", status: "missing", askFor: 'the "Mint agent keys" capability' } : { key: "mint-agent-keys", label: "mint agent keys", status: "skipped", note: "could not read capabilities" };
|
|
27010
|
-
const sync = admin ? { key: "sync-personas", label: "sync personas and skills", status: "ok" } :
|
|
27186
|
+
const sync = admin ? { key: "sync-personas", label: "sync personas and skills", status: "ok" } : await memberPersonaItem(o, found);
|
|
27011
27187
|
return [crew, ships, repos, mint, sync];
|
|
27012
27188
|
}
|
|
27013
27189
|
function missLine(i) {
|
|
@@ -27015,6 +27191,7 @@ function missLine(i) {
|
|
|
27015
27191
|
}
|
|
27016
27192
|
function describeCapability(i) {
|
|
27017
27193
|
if (i.status === "ok") return `ok ${i.label}`;
|
|
27194
|
+
if (i.status === "info") return `info ${i.label} (${i.note ?? ""})`;
|
|
27018
27195
|
if (i.status === "skipped") return `skipped ${i.label} (${i.note ?? "not checked"})`;
|
|
27019
27196
|
return `missing ${missLine(i)}`;
|
|
27020
27197
|
}
|
|
@@ -28549,7 +28726,7 @@ import { dirname as dirOf2, resolve as resolvePath } from "path";
|
|
|
28549
28726
|
import { existsSync as existsSync56, readdirSync as readdirSync18, statSync as statSync17 } from "fs";
|
|
28550
28727
|
import { join as join60 } from "path";
|
|
28551
28728
|
function builtVersion() {
|
|
28552
|
-
return true ? "0.
|
|
28729
|
+
return true ? "0.159.1" : null;
|
|
28553
28730
|
}
|
|
28554
28731
|
var REBUILD_HINT = "rebuild with npm run build";
|
|
28555
28732
|
function newestMtime(path) {
|
|
@@ -32340,6 +32517,20 @@ ${changed2.map((c) => ` - ${c}
|
|
|
32340
32517
|
state: state.release(scope),
|
|
32341
32518
|
reviewColumns: repo.release.mode === "external" ? await tracker.reviewColumns() : void 0,
|
|
32342
32519
|
forge: { host: target.forgeHost, remote: target.remote },
|
|
32520
|
+
ci: (() => {
|
|
32521
|
+
if (!isQueryableCiProvider(repo.release.ci.provider) || repo.release.mode !== "ci_auto" && repo.release.mode !== "ci_manual") return void 0;
|
|
32522
|
+
const where = ciRemoteOf(gitOk(target.dir, ["remote", "get-url", repo.branch.remote]));
|
|
32523
|
+
const provider = ciProviderFor(repo.release.ci.provider, {
|
|
32524
|
+
token: (h) => {
|
|
32525
|
+
try {
|
|
32526
|
+
return readForgeToken(cfg.ship.forges, h, cfg.ship.stateDir);
|
|
32527
|
+
} catch {
|
|
32528
|
+
return null;
|
|
32529
|
+
}
|
|
32530
|
+
}
|
|
32531
|
+
});
|
|
32532
|
+
return where && provider ? { provider, ...where } : void 0;
|
|
32533
|
+
})(),
|
|
32343
32534
|
dryRun,
|
|
32344
32535
|
skipTests: flag("skip-tests"),
|
|
32345
32536
|
shell: cfg.ship.shell,
|
|
@@ -32364,7 +32555,8 @@ ${changed2.map((c) => ` - ${c}
|
|
|
32364
32555
|
isDeployCommand: opts.isDeployCommand,
|
|
32365
32556
|
attention: {
|
|
32366
32557
|
raise: (item) => raiseShipAttention({ state, emit: remit, route: c, ship: cfg.ship }, item),
|
|
32367
|
-
clear: (key) => clearShipAttention(state, key)
|
|
32558
|
+
clear: (key) => clearShipAttention(state, key),
|
|
32559
|
+
clearKind: (kind, keyPrefix) => clearShipAttentionKind(state, kind, keyPrefix)
|
|
32368
32560
|
}
|
|
32369
32561
|
});
|
|
32370
32562
|
const summary = summarizeOutcome(outcome, scope, !!repo.hooks.test && !flag("skip-tests"));
|
|
@@ -32518,6 +32710,51 @@ ${changed2.map((c) => ` - ${c}
|
|
|
32518
32710
|
});
|
|
32519
32711
|
}
|
|
32520
32712
|
}
|
|
32713
|
+
const ciHeadlines = (version) => ({
|
|
32714
|
+
blocking: `${scope}: CI failed for ${version} \u2014 the release did not ship`,
|
|
32715
|
+
live: `${scope}: a CI run failed for ${version} \u2014 the release is live`
|
|
32716
|
+
});
|
|
32717
|
+
if (outcome.ci && !dryRun) {
|
|
32718
|
+
const ci = outcome.ci;
|
|
32719
|
+
const version = outcome.version ?? ci.tag ?? ci.sha.slice(0, 8);
|
|
32720
|
+
const batch = [...outcome.merged.length ? outcome.merged.map((m) => displayKey(m.ticket)) : tickets.filter((t) => t.status === verifiedStatus).map((t) => displayKey(t))];
|
|
32721
|
+
const runs = ci.failures.map((f) => {
|
|
32722
|
+
const lines2 = [`- ${describeCiFailure(f)}`];
|
|
32723
|
+
if (f.logTail) lines2.push("", " ```", ...f.logTail.split("\n").map((l) => ` ${l}`), " ```");
|
|
32724
|
+
return lines2.join("\n");
|
|
32725
|
+
}).join("\n");
|
|
32726
|
+
const news2 = {
|
|
32727
|
+
level: ci.blocking ? "fail" : "warn",
|
|
32728
|
+
headline: ci.blocking ? ciHeadlines(version).blocking : ciHeadlines(version).live,
|
|
32729
|
+
detail: (ci.blocking ? `The release of ${version} did not ship: a CI run for ${ci.tag ?? ci.sha.slice(0, 8)} failed, and the released hook does not report it live. The tickets stay at verified.` : `${version} is live and its tickets are stamped, but a different CI run for the same commit failed, so something else is broken.`) + `
|
|
32730
|
+
|
|
32731
|
+
Failed run(s):
|
|
32732
|
+
${runs}
|
|
32733
|
+
|
|
32734
|
+
Tickets in the batch: ${batch.length ? batch.join(", ") : "none named"}.`,
|
|
32735
|
+
head: ci.sha
|
|
32736
|
+
};
|
|
32737
|
+
const notified = await notify(c, cfg.ship, news2, remit, dryRun);
|
|
32738
|
+
if (!notified) {
|
|
32739
|
+
await applyFailureAlert(tracker, news2, scope, all, releaseSeat(c), remit, dryRun, await alertPlacement()).catch((e) => {
|
|
32740
|
+
remit.warn(`could not file/update a CI failure ticket: ${e.message}`, { step: "release" });
|
|
32741
|
+
});
|
|
32742
|
+
}
|
|
32743
|
+
} else if (outcome.ciGreen && outcome.confirmed && outcome.version && !dryRun) {
|
|
32744
|
+
const h = ciHeadlines(outcome.version);
|
|
32745
|
+
await applyFailureRecovery(
|
|
32746
|
+
tracker,
|
|
32747
|
+
[h.blocking, h.live],
|
|
32748
|
+
all,
|
|
32749
|
+
tracker.contract,
|
|
32750
|
+
releaseSeat(c),
|
|
32751
|
+
`${scope} ${outcome.version} is live and its CI runs passed`,
|
|
32752
|
+
remit,
|
|
32753
|
+
dryRun
|
|
32754
|
+
).catch((e) => {
|
|
32755
|
+
remit.warn(`could not resolve CI failure tickets: ${e.message}`, { step: "release" });
|
|
32756
|
+
});
|
|
32757
|
+
}
|
|
32521
32758
|
const recovered = recoveredFailureHeadlines(outcome, scope);
|
|
32522
32759
|
if (recovered.length) {
|
|
32523
32760
|
const passed = outcome.version ? `${scope} released ${outcome.version}` : outcome.deployed || outcome.integrated ? `${scope} release passed` : `${scope} release got past this stage`;
|
|
@@ -36997,6 +37234,30 @@ routes: ${cfg.routes.map((c) => c.route).join(", ")}
|
|
|
36997
37234
|
if (warn) R.line(` WARNING ${warn}
|
|
36998
37235
|
`);
|
|
36999
37236
|
}
|
|
37237
|
+
if (isQueryableCiProvider(config.release.ci.provider) && (config.release.mode === "ci_auto" || config.release.mode === "ci_manual")) {
|
|
37238
|
+
const where = ciRemoteOf(gitOk(r.dir, ["remote", "get-url", config.branch.remote]));
|
|
37239
|
+
const provider = where && ciProviderFor(config.release.ci.provider, {
|
|
37240
|
+
token: (h) => {
|
|
37241
|
+
try {
|
|
37242
|
+
return readForgeToken(cfg.ship.forges, h, cfg.ship.stateDir);
|
|
37243
|
+
} catch {
|
|
37244
|
+
return null;
|
|
37245
|
+
}
|
|
37246
|
+
}
|
|
37247
|
+
});
|
|
37248
|
+
if (!where || !provider) {
|
|
37249
|
+
R.line(` ci runs: WARN remote "${config.branch.remote}" is not a ${config.release.ci.provider} repository the crew can name \u2014 failed runs will not be reported
|
|
37250
|
+
`);
|
|
37251
|
+
} else if (flag("offline")) {
|
|
37252
|
+
R.line(` ci runs: ${provider.name}, not checked under --offline
|
|
37253
|
+
`);
|
|
37254
|
+
} else {
|
|
37255
|
+
const probe = await provider.runs({ host: where.host, remote: where.remote, sha: gitOk(r.dir, ["rev-parse", "HEAD"]) ?? "", base: config.branch.base });
|
|
37256
|
+
R.line(probe.ok ? ` ci runs: ${provider.name} \u2014 the crew can read ${where.remote}'s runs
|
|
37257
|
+
` : ` ci runs: WARN ${provider.name} \u2014 ${probe.why}; a failed release run will not be reported (the release waits on the released hook alone)
|
|
37258
|
+
`);
|
|
37259
|
+
}
|
|
37260
|
+
}
|
|
37000
37261
|
const scope = releaseLockScope(route2.route, r.name);
|
|
37001
37262
|
const lock2 = await tracker.lockState(scope).catch(() => void 0);
|
|
37002
37263
|
if (lock2?.holder && staleOwnLockClaim(lock2.holder, cfg.ship.name)) {
|
package/package.json
CHANGED