@tablation/crew 0.158.2 → 0.159.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.
- package/README.md +4 -1
- package/dist/cli.js +280 -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")) {
|
|
@@ -16801,6 +16898,15 @@ function versionRequest(argv2) {
|
|
|
16801
16898
|
function helpRequest(argv2) {
|
|
16802
16899
|
return argv2[0] === "--help" || argv2[0] === "-h" || argv2[0] === "help";
|
|
16803
16900
|
}
|
|
16901
|
+
function commandHelpRequest(argv2) {
|
|
16902
|
+
for (let i = 1; i < argv2.length; i++) {
|
|
16903
|
+
const a = argv2[i];
|
|
16904
|
+
if (a === "--") return false;
|
|
16905
|
+
if (a === "--help" || a === "-h") return true;
|
|
16906
|
+
if (a.startsWith("--") && !a.includes("=") && VALUE_FLAGS.has(a.slice(2))) i++;
|
|
16907
|
+
}
|
|
16908
|
+
return false;
|
|
16909
|
+
}
|
|
16804
16910
|
|
|
16805
16911
|
// src/roster.ts
|
|
16806
16912
|
function memberByIdentity(roster, identityId) {
|
|
@@ -21998,7 +22104,7 @@ function writeChangelog(o, version, entries) {
|
|
|
21998
22104
|
const existing = existsAt(path, existsSync42) ? readTextAt(path, (p) => readFileSync41(p, "utf8")) : "# Changelog\n";
|
|
21999
22105
|
writeTextAt(path, insertChangelogSection(existing, section), writeFileSync34);
|
|
22000
22106
|
}
|
|
22001
|
-
async function confirm(o, expected) {
|
|
22107
|
+
async function confirm(o, expected, ci) {
|
|
22002
22108
|
if (!o.repo.hooks.released) return void 0;
|
|
22003
22109
|
const { timeoutSeconds, intervalSeconds, match } = o.repo.release.verify;
|
|
22004
22110
|
if (o.dryRun) {
|
|
@@ -22010,10 +22116,15 @@ async function confirm(o, expected) {
|
|
|
22010
22116
|
const r = await hook(o, "released");
|
|
22011
22117
|
const live2 = r?.output.trim().split("\n").filter(Boolean).pop() ?? "";
|
|
22012
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);
|
|
22013
22120
|
if (live2 && hit) {
|
|
22014
22121
|
o.emit.emit(`confirmed live: ${live2.slice(0, 12)}`);
|
|
22015
22122
|
return true;
|
|
22016
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
|
+
}
|
|
22017
22128
|
if (Date.now() >= deadline) {
|
|
22018
22129
|
o.emit.warn(`not confirmed within ${timeoutSeconds}s \u2014 target reports ${live2 || "nothing"}`);
|
|
22019
22130
|
return false;
|
|
@@ -22021,6 +22132,58 @@ async function confirm(o, expected) {
|
|
|
22021
22132
|
await new Promise((r2) => setTimeout(r2, intervalSeconds * 1e3));
|
|
22022
22133
|
}
|
|
22023
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) {
|
|
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
|
+
await o.attention.raise({
|
|
22172
|
+
kind: "ci_run_failed",
|
|
22173
|
+
key: ciKey(o, w.version),
|
|
22174
|
+
message: `${o.scope ?? "release"}: CI failed for ${w.version} \u2014 ${w.failures.map(describeCiFailure).join("; ")}`,
|
|
22175
|
+
since: (/* @__PURE__ */ new Date()).toISOString()
|
|
22176
|
+
});
|
|
22177
|
+
}
|
|
22178
|
+
}
|
|
22179
|
+
function ciOutcome(o, w, confirmed) {
|
|
22180
|
+
if (!w) return {};
|
|
22181
|
+
if (w.failures.length) {
|
|
22182
|
+
return { ci: { failures: w.failures, blocking: confirmed !== true, sha: w.q.sha, ...w.q.tag ? { tag: w.q.tag } : {} } };
|
|
22183
|
+
}
|
|
22184
|
+
if (confirmed === true && w.green) o.attention?.clearKind?.("ci_run_failed", ciKeyPrefix(o));
|
|
22185
|
+
return w.green ? { ciGreen: true } : {};
|
|
22186
|
+
}
|
|
22024
22187
|
function refreshBase(o) {
|
|
22025
22188
|
const r = refreshBaseBranch(o.cwd, o.repo.branch.remote, o.repo.branch.base, o.dryRun);
|
|
22026
22189
|
switch (r.action) {
|
|
@@ -22070,9 +22233,10 @@ var canReconfirm = (o, decision) => !o.dryRun && (o.repo.release.mode === "ci_ma
|
|
|
22070
22233
|
async function confirmLastRelease(o, decision) {
|
|
22071
22234
|
const version = decision.lastTag.replace(/^v/, "");
|
|
22072
22235
|
const expected = o.repo.release.verify.match === "version" ? version : decision.lastReleased;
|
|
22073
|
-
const
|
|
22236
|
+
const watch2 = newCiWatch(o, decision.lastReleased, decision.lastTag, version);
|
|
22237
|
+
const confirmed = await confirm(o, expected, watch2) === true;
|
|
22074
22238
|
if (!confirmed) o.emit.warn(`${decision.lastTag} is still not confirmed live \u2014 tickets stay verified`);
|
|
22075
|
-
return { confirmed, version };
|
|
22239
|
+
return { confirmed, version, ...ciOutcome(o, watch2, confirmed) };
|
|
22076
22240
|
}
|
|
22077
22241
|
function closeReleaseCheckout(cwd, root, dir, branch, run4 = gitOk) {
|
|
22078
22242
|
try {
|
|
@@ -22520,7 +22684,9 @@ async function mergeAndReleaseBody(o, decision, fresh, releaseBranch, isolated =
|
|
|
22520
22684
|
confirmed: re.confirmed || void 0,
|
|
22521
22685
|
stampFrom: re.from,
|
|
22522
22686
|
stopped: "nothing to release",
|
|
22523
|
-
decision
|
|
22687
|
+
decision,
|
|
22688
|
+
...re.ci ? { ci: re.ci } : {},
|
|
22689
|
+
...re.ciGreen ? { ciGreen: true } : {}
|
|
22524
22690
|
};
|
|
22525
22691
|
}
|
|
22526
22692
|
o.emit.note("nothing to release");
|
|
@@ -22751,12 +22917,13 @@ async function mergeAndReleaseBody(o, decision, fresh, releaseBranch, isolated =
|
|
|
22751
22917
|
}
|
|
22752
22918
|
}
|
|
22753
22919
|
const expected = o.repo.release.verify.match === "version" && version ? version : o.dryRun ? head : headSha(o.cwd);
|
|
22754
|
-
const
|
|
22920
|
+
const watch2 = newCiWatch(o, o.dryRun ? head : headSha(o.cwd), tag, version ?? "");
|
|
22921
|
+
const confirmed = await confirm(o, expected, watch2);
|
|
22755
22922
|
o.emit.emit(
|
|
22756
22923
|
`release ${o.dryRun ? "plan complete" : "complete"}: ${merged.length} merged${version ? `, ${version}` : ""}${tag ? `, tagged ${tag}` : ""}`,
|
|
22757
22924
|
{ data: { merged: merged.length, version, tag, deployed, integrated, confirmed } }
|
|
22758
22925
|
);
|
|
22759
|
-
return { merged, conflicts, unbuildable, version, tag, deployed, integrated, confirmed, decision };
|
|
22926
|
+
return { merged, conflicts, unbuildable, version, tag, deployed, integrated, confirmed, decision, ...ciOutcome(o, watch2, confirmed) };
|
|
22760
22927
|
}
|
|
22761
22928
|
|
|
22762
22929
|
// src/failure-alert.ts
|
|
@@ -25420,7 +25587,7 @@ function defaultReadLog(path) {
|
|
|
25420
25587
|
return null;
|
|
25421
25588
|
}
|
|
25422
25589
|
}
|
|
25423
|
-
function
|
|
25590
|
+
function logTail2(text2, n = LOG_TAIL_LINES) {
|
|
25424
25591
|
if (text2 === null) return [];
|
|
25425
25592
|
return text2.split("\n").map((l) => l.trimEnd()).filter((l) => l.trim() !== "").slice(-n);
|
|
25426
25593
|
}
|
|
@@ -25468,7 +25635,7 @@ function startLaunchdDaemon(o) {
|
|
|
25468
25635
|
err3 += "crew daemon start: the daemon did not stay up.\n";
|
|
25469
25636
|
err3 += ` last exit status: ${after.lastExitCode ?? "none recorded"}
|
|
25470
25637
|
`;
|
|
25471
|
-
const tail3 =
|
|
25638
|
+
const tail3 = logTail2(readLog(o.schedulerLog));
|
|
25472
25639
|
if (tail3.length) {
|
|
25473
25640
|
err3 += ` last lines of ${o.schedulerLog}:
|
|
25474
25641
|
`;
|
|
@@ -26983,6 +27150,22 @@ async function projectCapabilities(o, projectId) {
|
|
|
26983
27150
|
return void 0;
|
|
26984
27151
|
}
|
|
26985
27152
|
}
|
|
27153
|
+
var LANE_ROLES = ROLE_NAMES.filter((r) => r !== "pair");
|
|
27154
|
+
async function memberPersonaItem(o, found) {
|
|
27155
|
+
const key = "sync-personas";
|
|
27156
|
+
const label = "sync personas and skills";
|
|
27157
|
+
try {
|
|
27158
|
+
const model = await get(o, `/data-models/agents?workspaceId=${found.workspaceId}`);
|
|
27159
|
+
const rows = await get(o, `/data-models/${model.id}/records?limit=200`);
|
|
27160
|
+
const absent = LANE_ROLES.filter((r) => !rows.some((row) => row.name === PERSONA_NAME[r]));
|
|
27161
|
+
if (absent.length > 0) {
|
|
27162
|
+
return { key, label, status: "missing", askFor: `one \`crew agents sync\` run (no Agents row for ${absent.map((r) => PERSONA_NAME[r]).join(", ")})` };
|
|
27163
|
+
}
|
|
27164
|
+
return { key, label, status: "info", note: "this ship uses the workspace's personas and skills as they are" };
|
|
27165
|
+
} catch {
|
|
27166
|
+
return { key, label, status: "skipped", note: "could not read the Agents table" };
|
|
27167
|
+
}
|
|
27168
|
+
}
|
|
26986
27169
|
async function checkCapabilities(o, found) {
|
|
26987
27170
|
const admin = isAdminRole(found.role);
|
|
26988
27171
|
const table2 = async (key, label, tableName2, modelId, askFor) => {
|
|
@@ -26998,7 +27181,7 @@ async function checkCapabilities(o, found) {
|
|
|
26998
27181
|
projectCapabilities(o, found.projectId)
|
|
26999
27182
|
]);
|
|
27000
27183
|
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" };
|
|
27001
|
-
const sync = admin ? { key: "sync-personas", label: "sync personas and skills", status: "ok" } :
|
|
27184
|
+
const sync = admin ? { key: "sync-personas", label: "sync personas and skills", status: "ok" } : await memberPersonaItem(o, found);
|
|
27002
27185
|
return [crew, ships, repos, mint, sync];
|
|
27003
27186
|
}
|
|
27004
27187
|
function missLine(i) {
|
|
@@ -27006,6 +27189,7 @@ function missLine(i) {
|
|
|
27006
27189
|
}
|
|
27007
27190
|
function describeCapability(i) {
|
|
27008
27191
|
if (i.status === "ok") return `ok ${i.label}`;
|
|
27192
|
+
if (i.status === "info") return `info ${i.label} (${i.note ?? ""})`;
|
|
27009
27193
|
if (i.status === "skipped") return `skipped ${i.label} (${i.note ?? "not checked"})`;
|
|
27010
27194
|
return `missing ${missLine(i)}`;
|
|
27011
27195
|
}
|
|
@@ -28540,7 +28724,7 @@ import { dirname as dirOf2, resolve as resolvePath } from "path";
|
|
|
28540
28724
|
import { existsSync as existsSync56, readdirSync as readdirSync18, statSync as statSync17 } from "fs";
|
|
28541
28725
|
import { join as join60 } from "path";
|
|
28542
28726
|
function builtVersion() {
|
|
28543
|
-
return true ? "0.
|
|
28727
|
+
return true ? "0.159.0" : null;
|
|
28544
28728
|
}
|
|
28545
28729
|
var REBUILD_HINT = "rebuild with npm run build";
|
|
28546
28730
|
function newestMtime(path) {
|
|
@@ -30907,6 +31091,7 @@ var KNOWN_COMMANDS = /* @__PURE__ */ new Set([
|
|
|
30907
31091
|
"worktree"
|
|
30908
31092
|
]);
|
|
30909
31093
|
if (!KNOWN_COMMANDS.has(command)) usage(`unknown command "${command}"`);
|
|
31094
|
+
if (commandHelpRequest(argv)) usage(void 0, true);
|
|
30910
31095
|
if (command === "shell-init") {
|
|
30911
31096
|
const asked = value("shell");
|
|
30912
31097
|
if (asked !== void 0 && !SHELLS.includes(asked)) {
|
|
@@ -32330,6 +32515,20 @@ ${changed2.map((c) => ` - ${c}
|
|
|
32330
32515
|
state: state.release(scope),
|
|
32331
32516
|
reviewColumns: repo.release.mode === "external" ? await tracker.reviewColumns() : void 0,
|
|
32332
32517
|
forge: { host: target.forgeHost, remote: target.remote },
|
|
32518
|
+
ci: (() => {
|
|
32519
|
+
if (!isQueryableCiProvider(repo.release.ci.provider) || repo.release.mode !== "ci_auto" && repo.release.mode !== "ci_manual") return void 0;
|
|
32520
|
+
const where = ciRemoteOf(gitOk(target.dir, ["remote", "get-url", repo.branch.remote]));
|
|
32521
|
+
const provider = ciProviderFor(repo.release.ci.provider, {
|
|
32522
|
+
token: (h) => {
|
|
32523
|
+
try {
|
|
32524
|
+
return readForgeToken(cfg.ship.forges, h, cfg.ship.stateDir);
|
|
32525
|
+
} catch {
|
|
32526
|
+
return null;
|
|
32527
|
+
}
|
|
32528
|
+
}
|
|
32529
|
+
});
|
|
32530
|
+
return where && provider ? { provider, ...where } : void 0;
|
|
32531
|
+
})(),
|
|
32333
32532
|
dryRun,
|
|
32334
32533
|
skipTests: flag("skip-tests"),
|
|
32335
32534
|
shell: cfg.ship.shell,
|
|
@@ -32354,7 +32553,8 @@ ${changed2.map((c) => ` - ${c}
|
|
|
32354
32553
|
isDeployCommand: opts.isDeployCommand,
|
|
32355
32554
|
attention: {
|
|
32356
32555
|
raise: (item) => raiseShipAttention({ state, emit: remit, route: c, ship: cfg.ship }, item),
|
|
32357
|
-
clear: (key) => clearShipAttention(state, key)
|
|
32556
|
+
clear: (key) => clearShipAttention(state, key),
|
|
32557
|
+
clearKind: (kind, keyPrefix) => clearShipAttentionKind(state, kind, keyPrefix)
|
|
32358
32558
|
}
|
|
32359
32559
|
});
|
|
32360
32560
|
const summary = summarizeOutcome(outcome, scope, !!repo.hooks.test && !flag("skip-tests"));
|
|
@@ -32508,6 +32708,51 @@ ${changed2.map((c) => ` - ${c}
|
|
|
32508
32708
|
});
|
|
32509
32709
|
}
|
|
32510
32710
|
}
|
|
32711
|
+
const ciHeadlines = (version) => ({
|
|
32712
|
+
blocking: `${scope}: CI failed for ${version} \u2014 the release did not ship`,
|
|
32713
|
+
live: `${scope}: a CI run failed for ${version} \u2014 the release is live`
|
|
32714
|
+
});
|
|
32715
|
+
if (outcome.ci && !dryRun) {
|
|
32716
|
+
const ci = outcome.ci;
|
|
32717
|
+
const version = outcome.version ?? ci.tag ?? ci.sha.slice(0, 8);
|
|
32718
|
+
const batch = [...outcome.merged.length ? outcome.merged.map((m) => displayKey(m.ticket)) : tickets.filter((t) => t.status === verifiedStatus).map((t) => displayKey(t))];
|
|
32719
|
+
const runs = ci.failures.map((f) => {
|
|
32720
|
+
const lines2 = [`- ${describeCiFailure(f)}`];
|
|
32721
|
+
if (f.logTail) lines2.push("", " ```", ...f.logTail.split("\n").map((l) => ` ${l}`), " ```");
|
|
32722
|
+
return lines2.join("\n");
|
|
32723
|
+
}).join("\n");
|
|
32724
|
+
const news2 = {
|
|
32725
|
+
level: ci.blocking ? "fail" : "warn",
|
|
32726
|
+
headline: ci.blocking ? ciHeadlines(version).blocking : ciHeadlines(version).live,
|
|
32727
|
+
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.`) + `
|
|
32728
|
+
|
|
32729
|
+
Failed run(s):
|
|
32730
|
+
${runs}
|
|
32731
|
+
|
|
32732
|
+
Tickets in the batch: ${batch.length ? batch.join(", ") : "none named"}.`,
|
|
32733
|
+
head: ci.sha
|
|
32734
|
+
};
|
|
32735
|
+
const notified = await notify(c, cfg.ship, news2, remit, dryRun);
|
|
32736
|
+
if (!notified) {
|
|
32737
|
+
await applyFailureAlert(tracker, news2, scope, all, releaseSeat(c), remit, dryRun, await alertPlacement()).catch((e) => {
|
|
32738
|
+
remit.warn(`could not file/update a CI failure ticket: ${e.message}`, { step: "release" });
|
|
32739
|
+
});
|
|
32740
|
+
}
|
|
32741
|
+
} else if (outcome.ciGreen && outcome.confirmed && outcome.version && !dryRun) {
|
|
32742
|
+
const h = ciHeadlines(outcome.version);
|
|
32743
|
+
await applyFailureRecovery(
|
|
32744
|
+
tracker,
|
|
32745
|
+
[h.blocking, h.live],
|
|
32746
|
+
all,
|
|
32747
|
+
tracker.contract,
|
|
32748
|
+
releaseSeat(c),
|
|
32749
|
+
`${scope} ${outcome.version} is live and its CI runs passed`,
|
|
32750
|
+
remit,
|
|
32751
|
+
dryRun
|
|
32752
|
+
).catch((e) => {
|
|
32753
|
+
remit.warn(`could not resolve CI failure tickets: ${e.message}`, { step: "release" });
|
|
32754
|
+
});
|
|
32755
|
+
}
|
|
32511
32756
|
const recovered = recoveredFailureHeadlines(outcome, scope);
|
|
32512
32757
|
if (recovered.length) {
|
|
32513
32758
|
const passed = outcome.version ? `${scope} released ${outcome.version}` : outcome.deployed || outcome.integrated ? `${scope} release passed` : `${scope} release got past this stage`;
|
|
@@ -36987,6 +37232,30 @@ routes: ${cfg.routes.map((c) => c.route).join(", ")}
|
|
|
36987
37232
|
if (warn) R.line(` WARNING ${warn}
|
|
36988
37233
|
`);
|
|
36989
37234
|
}
|
|
37235
|
+
if (isQueryableCiProvider(config.release.ci.provider) && (config.release.mode === "ci_auto" || config.release.mode === "ci_manual")) {
|
|
37236
|
+
const where = ciRemoteOf(gitOk(r.dir, ["remote", "get-url", config.branch.remote]));
|
|
37237
|
+
const provider = where && ciProviderFor(config.release.ci.provider, {
|
|
37238
|
+
token: (h) => {
|
|
37239
|
+
try {
|
|
37240
|
+
return readForgeToken(cfg.ship.forges, h, cfg.ship.stateDir);
|
|
37241
|
+
} catch {
|
|
37242
|
+
return null;
|
|
37243
|
+
}
|
|
37244
|
+
}
|
|
37245
|
+
});
|
|
37246
|
+
if (!where || !provider) {
|
|
37247
|
+
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
|
|
37248
|
+
`);
|
|
37249
|
+
} else if (flag("offline")) {
|
|
37250
|
+
R.line(` ci runs: ${provider.name}, not checked under --offline
|
|
37251
|
+
`);
|
|
37252
|
+
} else {
|
|
37253
|
+
const probe = await provider.runs({ host: where.host, remote: where.remote, sha: gitOk(r.dir, ["rev-parse", "HEAD"]) ?? "", base: config.branch.base });
|
|
37254
|
+
R.line(probe.ok ? ` ci runs: ${provider.name} \u2014 the crew can read ${where.remote}'s runs
|
|
37255
|
+
` : ` ci runs: WARN ${provider.name} \u2014 ${probe.why}; a failed release run will not be reported (the release waits on the released hook alone)
|
|
37256
|
+
`);
|
|
37257
|
+
}
|
|
37258
|
+
}
|
|
36990
37259
|
const scope = releaseLockScope(route2.route, r.name);
|
|
36991
37260
|
const lock2 = await tracker.lockState(scope).catch(() => void 0);
|
|
36992
37261
|
if (lock2?.holder && staleOwnLockClaim(lock2.holder, cfg.ship.name)) {
|
package/package.json
CHANGED