@theholocron/cli 5.0.0-alpha.581 → 5.0.0-alpha.583
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 +23 -0
- package/dist/cli.mjs +730 -75
- package/dist/cli.mjs.map +1 -1
- package/dist/{index-C1jTRYcM.d.mts → index-B5wGOshm.d.mts} +53 -2
- package/dist/index.d.mts +2 -2
- package/dist/plugin/capabilities.d.mts +2 -2
- package/dist/presets.d.mts +1 -1
- package/package.json +7 -7
package/dist/cli.mjs
CHANGED
|
@@ -144,6 +144,7 @@ const COMMAND_CONTEXTS = {
|
|
|
144
144
|
"sync github": "workspace",
|
|
145
145
|
"sync issues": "workspace",
|
|
146
146
|
"sync incidents": "workspace",
|
|
147
|
+
"sync releases": "workspace",
|
|
147
148
|
"sync ideas": "workspace",
|
|
148
149
|
"sync tooling": "workspace",
|
|
149
150
|
"sync requests": "workspace",
|
|
@@ -2202,6 +2203,30 @@ const syncReadmeEntry = {
|
|
|
2202
2203
|
skipOptions: ["dry-run"],
|
|
2203
2204
|
supportsDryRun: true
|
|
2204
2205
|
};
|
|
2206
|
+
// src/commands/sync-releases/sync-releases.entry.ts
|
|
2207
|
+
const syncReleasesEntry = {
|
|
2208
|
+
name: "sync releases",
|
|
2209
|
+
description: "Announce a release in the releases channel, with a thread listing each package",
|
|
2210
|
+
positionals: [],
|
|
2211
|
+
options: [{
|
|
2212
|
+
key: "from",
|
|
2213
|
+
flag: "--from",
|
|
2214
|
+
type: "input",
|
|
2215
|
+
message: "The commit the release started from:"
|
|
2216
|
+
}, {
|
|
2217
|
+
key: "tag",
|
|
2218
|
+
flag: "--tag",
|
|
2219
|
+
type: "input",
|
|
2220
|
+
message: "The release's tag (v5.0.0-alpha.1):"
|
|
2221
|
+
}],
|
|
2222
|
+
skipOptions: [
|
|
2223
|
+
"to",
|
|
2224
|
+
"channel",
|
|
2225
|
+
"provider",
|
|
2226
|
+
"yes"
|
|
2227
|
+
],
|
|
2228
|
+
supportsDryRun: true
|
|
2229
|
+
};
|
|
2205
2230
|
// src/commands/sync-requests/sync-requests.entry.ts
|
|
2206
2231
|
const syncRequestsEntry = {
|
|
2207
2232
|
name: "sync requests",
|
|
@@ -2433,6 +2458,7 @@ const registry = createCommandRegistry([
|
|
|
2433
2458
|
syncGithubEntry,
|
|
2434
2459
|
syncIssuesEntry,
|
|
2435
2460
|
syncIncidentsEntry,
|
|
2461
|
+
syncReleasesEntry,
|
|
2436
2462
|
ideasSyncEntry,
|
|
2437
2463
|
syncToolingEntry,
|
|
2438
2464
|
syncRequestsEntry,
|
|
@@ -13361,7 +13387,7 @@ async function readShadowSamples(source, limit = 40) {
|
|
|
13361
13387
|
}
|
|
13362
13388
|
// src/commands/doctor-ci/shadow-row.ts
|
|
13363
13389
|
const ID$7 = "shadow";
|
|
13364
|
-
const TITLE$
|
|
13390
|
+
const TITLE$8 = "Sentinel's ci shadow agrees with the Actions aggregate";
|
|
13365
13391
|
/**
|
|
13366
13392
|
* The `shadow` row (SPEC-0099, phase 4): do `ci / Required checks (sentinel)` and `ci / Required checks` say the same on
|
|
13367
13393
|
* the same commit? `samples` are the newest pull requests first. A pull request is **decided** when both posted and
|
|
@@ -13376,7 +13402,7 @@ function shadowRow$1(samples, target = 20) {
|
|
|
13376
13402
|
const decided = samples.filter((sample) => sample.actions !== void 0 && sample.sentinel !== void 0 && sample.actions !== "pending" && sample.sentinel !== "pending");
|
|
13377
13403
|
if (decided.length === 0) return {
|
|
13378
13404
|
id: ID$7,
|
|
13379
|
-
title: TITLE$
|
|
13405
|
+
title: TITLE$8,
|
|
13380
13406
|
status: "skip",
|
|
13381
13407
|
detail: "no pull request has a finished verdict from both the Actions aggregate and the shadow yet",
|
|
13382
13408
|
problems: []
|
|
@@ -13384,7 +13410,7 @@ function shadowRow$1(samples, target = 20) {
|
|
|
13384
13410
|
const disagreements = decided.filter((sample) => sample.actions !== sample.sentinel);
|
|
13385
13411
|
if (disagreements.length > 0) return {
|
|
13386
13412
|
id: ID$7,
|
|
13387
|
-
title: TITLE$
|
|
13413
|
+
title: TITLE$8,
|
|
13388
13414
|
status: "fail",
|
|
13389
13415
|
detail: `${disagreements.length} of ${decided.length} decided pull requests disagree`,
|
|
13390
13416
|
problems: disagreements.map((s) => `#${s.number}: Actions said ${s.actions}, the shadow said ${s.sentinel}`)
|
|
@@ -13392,13 +13418,13 @@ function shadowRow$1(samples, target = 20) {
|
|
|
13392
13418
|
const consecutive = decided.length;
|
|
13393
13419
|
return consecutive >= target ? {
|
|
13394
13420
|
id: ID$7,
|
|
13395
|
-
title: TITLE$
|
|
13421
|
+
title: TITLE$8,
|
|
13396
13422
|
status: "ok",
|
|
13397
13423
|
detail: `${consecutive} consecutive pull requests agree (target ${target})`,
|
|
13398
13424
|
problems: []
|
|
13399
13425
|
} : {
|
|
13400
13426
|
id: ID$7,
|
|
13401
|
-
title: TITLE$
|
|
13427
|
+
title: TITLE$8,
|
|
13402
13428
|
status: "skip",
|
|
13403
13429
|
detail: `${consecutive} of ${target} consecutive pull requests agree so far`,
|
|
13404
13430
|
problems: []
|
|
@@ -13826,13 +13852,40 @@ function expectedDnsRecords(config, sources) {
|
|
|
13826
13852
|
});
|
|
13827
13853
|
return expected;
|
|
13828
13854
|
}
|
|
13855
|
+
// src/commands/doctor-dns/undeclared-dns-row.ts
|
|
13856
|
+
/** A record's name without its case or final dot. */
|
|
13857
|
+
const bare$1 = (name) => name.toLowerCase().replace(/\.$/, "");
|
|
13858
|
+
/**
|
|
13859
|
+
* The information row for the records a zone holds that nothing declares: not a record the config makes `setup`
|
|
13860
|
+
* write, one `.holocron/dns-records.json` lists, a deployment domain's, or one `doctor.manualDnsRecords` names
|
|
13861
|
+
* (`"<TYPE> <name>"` for one type, a bare name for every record of that name). It is a skip, so it never fails
|
|
13862
|
+
* the run, and there is no row when nothing is left over.
|
|
13863
|
+
*
|
|
13864
|
+
* @param zone - The zone the records were read from.
|
|
13865
|
+
* @param have - Every record the provider lists for the zone.
|
|
13866
|
+
* @param declared - Whether a record is one the config accounts for.
|
|
13867
|
+
* @param manual - `doctor.manualDnsRecords`.
|
|
13868
|
+
*/
|
|
13869
|
+
function undeclaredDnsRow(zone, have, declared, manual) {
|
|
13870
|
+
const allowed = new Set(manual.map((entry) => entry.trim().toLowerCase().replace(/\.$/, "")));
|
|
13871
|
+
const left = have.filter((r) => !declared(r) && !allowed.has(bare$1(r.name)) && !allowed.has(`${r.type.toLowerCase()} ${bare$1(r.name)}`));
|
|
13872
|
+
if (left.length === 0) return [];
|
|
13873
|
+
return [{
|
|
13874
|
+
id: `dns-undeclared-${zone}`,
|
|
13875
|
+
title: `${zone} records nothing declares`,
|
|
13876
|
+
status: "skip",
|
|
13877
|
+
detail: `${left.length} not declared: ${left.map((r) => `${r.type} ${r.name}`).join(", ")}`,
|
|
13878
|
+
problems: []
|
|
13879
|
+
}];
|
|
13880
|
+
}
|
|
13829
13881
|
// src/commands/doctor-dns/doctor-dns.ts
|
|
13830
13882
|
/**
|
|
13831
13883
|
* `holocron doctor dns` — do the DNS records the config makes setup write exist, pointing where they should?
|
|
13832
13884
|
*
|
|
13833
13885
|
* Read-only. One row per zone, each record looked up by type and name (case-insensitively) in what the `dns`
|
|
13834
13886
|
* provider lists for the zone. A record that is missing, points elsewhere, or is not proxied where it must be is a
|
|
13835
|
-
* problem; a record in the zone that is not expected never is
|
|
13887
|
+
* problem; a record in the zone that is not expected never is, and is listed in an information row
|
|
13888
|
+
* (`dns-undeclared-<zone>`, a skip) unless `doctor.manualDnsRecords` names it. With no `dns` provider and records expected, the
|
|
13836
13889
|
* rows are skips with the reason; a provider with no token for the read skips its zone.
|
|
13837
13890
|
*
|
|
13838
13891
|
* A custom domain on the `deployment` provider (Sentinel's `sentinel.theholocron.dev` on Vercel) gets a row of its
|
|
@@ -13915,8 +13968,25 @@ async function runDoctorDns(input) {
|
|
|
13915
13968
|
for (const { hostname } of domains) rows.push(domainRow(hostname, "skip", why));
|
|
13916
13969
|
} else {
|
|
13917
13970
|
const dns = loader.get("dns");
|
|
13918
|
-
|
|
13919
|
-
|
|
13971
|
+
const manual = input.loaded.resolved.doctor?.manualDnsRecords ?? [];
|
|
13972
|
+
const domainChecks = [];
|
|
13973
|
+
for (const { project, hostname } of domains) domainChecks.push(await checkDomain(dns, deploy, project, hostname));
|
|
13974
|
+
const declared = /* @__PURE__ */ new Set([...expected.map((e) => keyOf(e.record)), ...domainChecks.flatMap((c) => c.wanted ? [keyOf(c.wanted)] : [])]);
|
|
13975
|
+
const listedLeftovers = /* @__PURE__ */ new Set();
|
|
13976
|
+
for (const zone of zones) {
|
|
13977
|
+
const wanted = expected.filter((e) => e.zone === zone).map((e) => e.record);
|
|
13978
|
+
for (const r of await checkZone(dns, zone, wanted, {
|
|
13979
|
+
declared,
|
|
13980
|
+
manual
|
|
13981
|
+
})) {
|
|
13982
|
+
if (r.id.startsWith("dns-undeclared-")) {
|
|
13983
|
+
if (listedLeftovers.has(r.detail)) continue;
|
|
13984
|
+
listedLeftovers.add(r.detail);
|
|
13985
|
+
}
|
|
13986
|
+
rows.push(r);
|
|
13987
|
+
}
|
|
13988
|
+
}
|
|
13989
|
+
rows.push(...domainChecks.map((c) => c.row));
|
|
13920
13990
|
}
|
|
13921
13991
|
printCheckRows(rows, print);
|
|
13922
13992
|
const summary = summariseChecks(rows);
|
|
@@ -13955,14 +14025,18 @@ function domainRow(hostname, status, detail, problems = []) {
|
|
|
13955
14025
|
async function checkDomain(dns, deploy, project, hostname) {
|
|
13956
14026
|
try {
|
|
13957
14027
|
const request = await deploy.expectedDomainRecord(project, hostname);
|
|
13958
|
-
if (!request) return domainRow(hostname, "skip", `${deploy.providerName} recommends no record for it`);
|
|
13959
|
-
|
|
14028
|
+
if (!request) return { row: domainRow(hostname, "skip", `${deploy.providerName} recommends no record for it`) };
|
|
14029
|
+
const [row] = await checkZone(dns, request.zone, [request.record], void 0, domainRow.bind(void 0, hostname));
|
|
14030
|
+
return {
|
|
14031
|
+
row,
|
|
14032
|
+
wanted: request.record
|
|
14033
|
+
};
|
|
13960
14034
|
} catch (err) {
|
|
13961
14035
|
const noToken = missingTokenReason(err);
|
|
13962
|
-
return noToken !== void 0 ? domainRow(hostname, "skip", noToken) : domainRow(hostname, "fail", errorMessage(err));
|
|
14036
|
+
return { row: noToken !== void 0 ? domainRow(hostname, "skip", noToken) : domainRow(hostname, "fail", errorMessage(err)) };
|
|
13963
14037
|
}
|
|
13964
14038
|
}
|
|
13965
|
-
async function checkZone(dns, zone, wanted, rowOf = (...args) => row$29(zone, ...args)) {
|
|
14039
|
+
async function checkZone(dns, zone, wanted, undeclared, rowOf = (...args) => row$29(zone, ...args)) {
|
|
13966
14040
|
try {
|
|
13967
14041
|
const have = await dns.listRecords(zone);
|
|
13968
14042
|
const problems = declaredVsActual(new Map(wanted.map((w) => [keyOf(w), w])), new Map(have.map((h) => [keyOf(h), h])), {
|
|
@@ -13971,10 +14045,10 @@ async function checkZone(dns, zone, wanted, rowOf = (...args) => row$29(zone, ..
|
|
|
13971
14045
|
equal: (want, found) => sameContent(want.content, found.content) && (want.proxied === void 0 || found.proxied === true === want.proxied),
|
|
13972
14046
|
show: (r) => `${r.content}${r.proxied ? " (proxied)" : ""}`
|
|
13973
14047
|
});
|
|
13974
|
-
return problems.length > 0 ? rowOf("fail", `${problems.length} problem(s)`, problems) : rowOf("ok", `${wanted.length} of ${wanted.length} exist`);
|
|
14048
|
+
return [problems.length > 0 ? rowOf("fail", `${problems.length} problem(s)`, problems) : rowOf("ok", `${wanted.length} of ${wanted.length} exist`), ...undeclared ? undeclaredDnsRow(zone, have, (r) => undeclared.declared.has(keyOf(r)), undeclared.manual) : []];
|
|
13975
14049
|
} catch (err) {
|
|
13976
14050
|
const noToken = missingTokenReason(err);
|
|
13977
|
-
return noToken !== void 0 ? rowOf("skip", noToken) : rowOf("fail", errorMessage(err));
|
|
14051
|
+
return [noToken !== void 0 ? rowOf("skip", noToken) : rowOf("fail", errorMessage(err))];
|
|
13978
14052
|
}
|
|
13979
14053
|
}
|
|
13980
14054
|
// src/commands/doctor-dns/doctor-dns.command.ts
|
|
@@ -14057,7 +14131,7 @@ function environmentProblems(declared, have) {
|
|
|
14057
14131
|
* nothing named, nothing is declared; with no provider but some named, the row is a skip with the reason.
|
|
14058
14132
|
*/
|
|
14059
14133
|
const ID$6 = "environments";
|
|
14060
|
-
const TITLE$
|
|
14134
|
+
const TITLE$7 = "environments exist";
|
|
14061
14135
|
const UNDECLARED_ID = "environments-undeclared";
|
|
14062
14136
|
const UNDECLARED_TITLE = "environments nothing declares";
|
|
14063
14137
|
async function runDoctorEnvironments(input) {
|
|
@@ -14085,7 +14159,7 @@ async function runDoctorEnvironments(input) {
|
|
|
14085
14159
|
async function checkEnvironments(loader, named, declared, manual) {
|
|
14086
14160
|
const make = (status, detail, problems = []) => ({
|
|
14087
14161
|
id: ID$6,
|
|
14088
|
-
title: TITLE$
|
|
14162
|
+
title: TITLE$7,
|
|
14089
14163
|
status,
|
|
14090
14164
|
detail,
|
|
14091
14165
|
problems
|
|
@@ -14462,7 +14536,7 @@ async function readWorkspaceMonitoring(context) {
|
|
|
14462
14536
|
}
|
|
14463
14537
|
// src/commands/doctor-monitoring/dashboard-rows/dashboard-rows.ts
|
|
14464
14538
|
const ID$5 = "monitoring-dashboards";
|
|
14465
|
-
const TITLE$
|
|
14539
|
+
const TITLE$6 = "monitoring dashboards match";
|
|
14466
14540
|
/** The tags as comparable text: sorted and de-duplicated. */
|
|
14467
14541
|
const tagsText = (tags) => [...new Set(tags)].sort().join(", ") || "none";
|
|
14468
14542
|
/** What differs between a declared dashboard and the one the account holds. Privacy is always compared (default private). */
|
|
@@ -14494,7 +14568,7 @@ async function dashboardRows(monitoring) {
|
|
|
14494
14568
|
detail,
|
|
14495
14569
|
problems: []
|
|
14496
14570
|
});
|
|
14497
|
-
if (!monitoring.inspectDashboard) return [skip(ID$5, TITLE$
|
|
14571
|
+
if (!monitoring.inspectDashboard) return [skip(ID$5, TITLE$6, "provider does not implement inspectDashboard")];
|
|
14498
14572
|
try {
|
|
14499
14573
|
const names = new Set(declared.map((d) => d.name));
|
|
14500
14574
|
const problems = [];
|
|
@@ -14506,13 +14580,13 @@ async function dashboardRows(monitoring) {
|
|
|
14506
14580
|
}
|
|
14507
14581
|
const rows = [problems.length > 0 ? {
|
|
14508
14582
|
id: ID$5,
|
|
14509
|
-
title: TITLE$
|
|
14583
|
+
title: TITLE$6,
|
|
14510
14584
|
status: "fail",
|
|
14511
14585
|
detail: `${problems.length} problem(s)`,
|
|
14512
14586
|
problems
|
|
14513
14587
|
} : {
|
|
14514
14588
|
id: ID$5,
|
|
14515
|
-
title: TITLE$
|
|
14589
|
+
title: TITLE$6,
|
|
14516
14590
|
status: "ok",
|
|
14517
14591
|
detail: `${declared.length} of ${declared.length} match`,
|
|
14518
14592
|
problems: []
|
|
@@ -14521,10 +14595,10 @@ async function dashboardRows(monitoring) {
|
|
|
14521
14595
|
return rows;
|
|
14522
14596
|
} catch (err) {
|
|
14523
14597
|
const noToken = missingTokenReason(err);
|
|
14524
|
-
if (noToken !== void 0) return [skip(ID$5, TITLE$
|
|
14598
|
+
if (noToken !== void 0) return [skip(ID$5, TITLE$6, noToken)];
|
|
14525
14599
|
return [{
|
|
14526
14600
|
id: ID$5,
|
|
14527
|
-
title: TITLE$
|
|
14601
|
+
title: TITLE$6,
|
|
14528
14602
|
status: "fail",
|
|
14529
14603
|
detail: errorMessage(err),
|
|
14530
14604
|
problems: []
|
|
@@ -14538,7 +14612,7 @@ async function dashboardRows(monitoring) {
|
|
|
14538
14612
|
* config is an `info` row (shown as skipped). Names only: the ping URL is never read here.
|
|
14539
14613
|
*/
|
|
14540
14614
|
const ID$4 = "monitoring-heartbeats";
|
|
14541
|
-
const TITLE$
|
|
14615
|
+
const TITLE$5 = "monitoring heartbeats match";
|
|
14542
14616
|
const show = (b) => new Map([
|
|
14543
14617
|
["period", `${b.period} ${b.periodUnit}`],
|
|
14544
14618
|
["grace", `${b.grace} ${b.graceUnit}`],
|
|
@@ -14550,7 +14624,7 @@ async function heartbeatRows(monitoring) {
|
|
|
14550
14624
|
if (declared.length === 0) return [];
|
|
14551
14625
|
const skip = (detail) => ({
|
|
14552
14626
|
id: ID$4,
|
|
14553
|
-
title: TITLE$
|
|
14627
|
+
title: TITLE$5,
|
|
14554
14628
|
status: "skip",
|
|
14555
14629
|
detail,
|
|
14556
14630
|
problems: []
|
|
@@ -14575,13 +14649,13 @@ async function heartbeatRows(monitoring) {
|
|
|
14575
14649
|
}
|
|
14576
14650
|
const rows = [problems.length > 0 ? {
|
|
14577
14651
|
id: ID$4,
|
|
14578
|
-
title: TITLE$
|
|
14652
|
+
title: TITLE$5,
|
|
14579
14653
|
status: "fail",
|
|
14580
14654
|
detail: `${problems.length} problem(s)`,
|
|
14581
14655
|
problems
|
|
14582
14656
|
} : {
|
|
14583
14657
|
id: ID$4,
|
|
14584
|
-
title: TITLE$
|
|
14658
|
+
title: TITLE$5,
|
|
14585
14659
|
status: "ok",
|
|
14586
14660
|
detail: `${declared.length} of ${declared.length} match`,
|
|
14587
14661
|
problems: []
|
|
@@ -14601,7 +14675,7 @@ async function heartbeatRows(monitoring) {
|
|
|
14601
14675
|
if (noToken !== void 0) return [skip(noToken)];
|
|
14602
14676
|
return [{
|
|
14603
14677
|
id: ID$4,
|
|
14604
|
-
title: TITLE$
|
|
14678
|
+
title: TITLE$5,
|
|
14605
14679
|
status: "fail",
|
|
14606
14680
|
detail: errorMessage(err),
|
|
14607
14681
|
problems: []
|
|
@@ -14706,7 +14780,7 @@ async function statusPageRows(monitoring) {
|
|
|
14706
14780
|
}
|
|
14707
14781
|
// src/commands/doctor-monitoring/undeclared-check-rows/undeclared-check-rows.ts
|
|
14708
14782
|
const ID$3 = "monitoring-undeclared";
|
|
14709
|
-
const TITLE$
|
|
14783
|
+
const TITLE$4 = "checks no config declares";
|
|
14710
14784
|
function undeclaredCheckRows({ monitoring, workspace, have }) {
|
|
14711
14785
|
if (have === void 0) return [];
|
|
14712
14786
|
const tags = new Set([
|
|
@@ -14717,7 +14791,7 @@ function undeclaredCheckRows({ monitoring, workspace, have }) {
|
|
|
14717
14791
|
if (tags.size === 0) return [];
|
|
14718
14792
|
const row = (status, detail) => [{
|
|
14719
14793
|
id: ID$3,
|
|
14720
|
-
title: TITLE$
|
|
14794
|
+
title: TITLE$4,
|
|
14721
14795
|
status,
|
|
14722
14796
|
detail,
|
|
14723
14797
|
problems: []
|
|
@@ -14755,7 +14829,7 @@ function undeclaredCheckRows({ monitoring, workspace, have }) {
|
|
|
14755
14829
|
* `doctor notifications`) and any check that a message really arrives.
|
|
14756
14830
|
*/
|
|
14757
14831
|
const ID$2 = "monitoring-checks";
|
|
14758
|
-
const TITLE$
|
|
14832
|
+
const TITLE$3 = "monitoring checks match";
|
|
14759
14833
|
async function runDoctorMonitoring(input) {
|
|
14760
14834
|
const print = input.print ?? ((line) => console.log(line));
|
|
14761
14835
|
const logger = input.logger ?? getLogger();
|
|
@@ -14795,14 +14869,14 @@ async function runDoctorMonitoring(input) {
|
|
|
14795
14869
|
async function checkRow(loader) {
|
|
14796
14870
|
const skip = (detail) => ({ row: {
|
|
14797
14871
|
id: ID$2,
|
|
14798
|
-
title: TITLE$
|
|
14872
|
+
title: TITLE$3,
|
|
14799
14873
|
status: "skip",
|
|
14800
14874
|
detail,
|
|
14801
14875
|
problems: []
|
|
14802
14876
|
} });
|
|
14803
14877
|
const none = () => ({ row: {
|
|
14804
14878
|
id: ID$2,
|
|
14805
|
-
title: TITLE$
|
|
14879
|
+
title: TITLE$3,
|
|
14806
14880
|
status: "ok",
|
|
14807
14881
|
detail: "none declared",
|
|
14808
14882
|
problems: []
|
|
@@ -14820,7 +14894,7 @@ async function checkRow(loader) {
|
|
|
14820
14894
|
if (problems.length > 0) return {
|
|
14821
14895
|
row: {
|
|
14822
14896
|
id: ID$2,
|
|
14823
|
-
title: TITLE$
|
|
14897
|
+
title: TITLE$3,
|
|
14824
14898
|
status: "fail",
|
|
14825
14899
|
detail: `${problems.length} problem(s)`,
|
|
14826
14900
|
problems
|
|
@@ -14831,7 +14905,7 @@ async function checkRow(loader) {
|
|
|
14831
14905
|
return {
|
|
14832
14906
|
row: {
|
|
14833
14907
|
id: ID$2,
|
|
14834
|
-
title: TITLE$
|
|
14908
|
+
title: TITLE$3,
|
|
14835
14909
|
status: "ok",
|
|
14836
14910
|
detail: `${n} of ${n} match`,
|
|
14837
14911
|
problems: []
|
|
@@ -14843,7 +14917,7 @@ async function checkRow(loader) {
|
|
|
14843
14917
|
if (noToken !== void 0) return skip(noToken);
|
|
14844
14918
|
return { row: {
|
|
14845
14919
|
id: ID$2,
|
|
14846
|
-
title: TITLE$
|
|
14920
|
+
title: TITLE$3,
|
|
14847
14921
|
status: "fail",
|
|
14848
14922
|
detail: errorMessage(err),
|
|
14849
14923
|
problems: []
|
|
@@ -14978,7 +15052,7 @@ function resultRow(id, title, problems, ok) {
|
|
|
14978
15052
|
};
|
|
14979
15053
|
}
|
|
14980
15054
|
// src/commands/bot-permission-checks/bot-permission-checks.ts
|
|
14981
|
-
const TITLE$
|
|
15055
|
+
const TITLE$2 = "bot holds the server-wide permissions it needs";
|
|
14982
15056
|
/**
|
|
14983
15057
|
* The step of `doctor notifications` for the bot's own role: the permissions the provider says it needs (read from
|
|
14984
15058
|
* `inspect`, server-wide, before any channel overwrite) are all held. A failure names the missing ones and carries the
|
|
@@ -14987,13 +15061,13 @@ const TITLE$1 = "bot holds the server-wide permissions it needs";
|
|
|
14987
15061
|
*/
|
|
14988
15062
|
function botPermissionChecks(input) {
|
|
14989
15063
|
const { found } = input;
|
|
14990
|
-
if (!found) return [skipRow$1("bot-permissions", TITLE$
|
|
14991
|
-
if (found.botPermissionsError) return [skipRow$1("bot-permissions", TITLE$
|
|
15064
|
+
if (!found) return [skipRow$1("bot-permissions", TITLE$2, "not checked: could not read the server")];
|
|
15065
|
+
if (found.botPermissionsError) return [skipRow$1("bot-permissions", TITLE$2, `not checked: could not read the bot's roles (${sanitizeDetail(found.botPermissionsError)})`)];
|
|
14992
15066
|
const { botPermissions } = found;
|
|
14993
15067
|
if (!botPermissions) return [];
|
|
14994
15068
|
const { missing, inviteUrl } = botPermissions;
|
|
14995
15069
|
const problems = missing.length === 0 ? [] : [`missing: ${missing.map((m) => sanitizeDetail(m)).join(", ")}`, ...inviteUrl ? [`invite the bot again with them (updates its role in place): ${inviteUrl}`] : []];
|
|
14996
|
-
return [resultRow("bot-permissions", TITLE$
|
|
15070
|
+
return [resultRow("bot-permissions", TITLE$2, problems, "every permission it needs")];
|
|
14997
15071
|
}
|
|
14998
15072
|
// src/commands/notifications-reaction/layout-reactions/layout-reactions.ts
|
|
14999
15073
|
/**
|
|
@@ -15148,7 +15222,7 @@ function tagEmojiProblem(tagName, emoji, pictured) {
|
|
|
15148
15222
|
return `${noun} \`${emoji}\` has no picture: give the emoji an \`image\` in \`emojis\` or a reaction so \`setup\` can make it`;
|
|
15149
15223
|
}
|
|
15150
15224
|
// src/commands/emoji-checks/emoji-checks.ts
|
|
15151
|
-
const TITLE = "server emoji the forums' reactions and tags name exist";
|
|
15225
|
+
const TITLE$1 = "server emoji the forums' reactions and tags name exist";
|
|
15152
15226
|
/**
|
|
15153
15227
|
* The step of `doctor notifications` for server emoji: each one a forum's `defaultReaction`, `starterReactions` or tag `emoji` names
|
|
15154
15228
|
* (`:git_merge:`) is on the server. A missing one fails by name, and says how to get it: `setup` makes it when the layout
|
|
@@ -15160,17 +15234,17 @@ function emojiChecks(input) {
|
|
|
15160
15234
|
const wanted = layoutEmojis(input.layout);
|
|
15161
15235
|
if (wanted.length === 0) return [];
|
|
15162
15236
|
const { found } = input;
|
|
15163
|
-
if (!found) return [skipRow$1("emoji", TITLE, "not checked: could not read the server")];
|
|
15164
|
-
if (found.emojisError) return [skipRow$1("emoji", TITLE, `not checked: could not read the server's emoji (${sanitizeDetail(found.emojisError)})`)];
|
|
15237
|
+
if (!found) return [skipRow$1("emoji", TITLE$1, "not checked: could not read the server")];
|
|
15238
|
+
if (found.emojisError) return [skipRow$1("emoji", TITLE$1, `not checked: could not read the server's emoji (${sanitizeDetail(found.emojisError)})`)];
|
|
15165
15239
|
const have = new Set(found.emojis ?? []);
|
|
15166
15240
|
const problems = wanted.filter((emoji) => !have.has(emoji.name)).map((emoji) => {
|
|
15167
15241
|
const name = sanitizeDetail(emoji.name);
|
|
15168
15242
|
return emoji.image ? `:${name}: is not on the server; \`setup notifications\` makes it from ${sanitizeDetail(emoji.image)}` : `:${name}: is not on the server; add it in the server's settings, or give the reaction an \`image\` for \`setup notifications\` to make it from`;
|
|
15169
15243
|
});
|
|
15170
|
-
return [resultRow("emoji", TITLE, problems, `${wanted.length} of ${wanted.length} on the server`)];
|
|
15244
|
+
return [resultRow("emoji", TITLE$1, problems, `${wanted.length} of ${wanted.length} on the server`)];
|
|
15171
15245
|
}
|
|
15172
15246
|
// src/commands/forum-feed-checks/forum-feed-checks.ts
|
|
15173
|
-
const same$
|
|
15247
|
+
const same$6 = (a, b) => a.toLowerCase() === b.toLowerCase();
|
|
15174
15248
|
const shown$6 = (s) => sanitizeDetail(s);
|
|
15175
15249
|
/**
|
|
15176
15250
|
* The steps of `doctor notifications` for a forum feed (`feeds.prs`, `feeds.incidents`): the forum is there (in its
|
|
@@ -15201,7 +15275,7 @@ function forumFeedChecks(input, spec) {
|
|
|
15201
15275
|
const botProblems = [];
|
|
15202
15276
|
for (const { cat, channel } of fed) {
|
|
15203
15277
|
const name = shown$6(channel.name);
|
|
15204
|
-
const have = found.channels.find((c) => same$
|
|
15278
|
+
const have = found.channels.find((c) => same$6(c.name, channel.name) && c.category !== void 0 && same$6(c.category, cat));
|
|
15205
15279
|
if (!have) {
|
|
15206
15280
|
forumProblems.push(`#${name}: missing from ${shown$6(cat)}`);
|
|
15207
15281
|
continue;
|
|
@@ -15210,7 +15284,7 @@ function forumFeedChecks(input, spec) {
|
|
|
15210
15284
|
forumProblems.push(`#${name}: is a text channel, not a forum; delete it so \`setup\` can make it again`);
|
|
15211
15285
|
continue;
|
|
15212
15286
|
}
|
|
15213
|
-
for (const tag of spec.tags) if (!have.tags?.some((t) => same$
|
|
15287
|
+
for (const tag of spec.tags) if (!have.tags?.some((t) => same$6(t.name, tag))) tagProblems.push(`#${name}: tag "${tag}" is missing`);
|
|
15214
15288
|
if (have.botThreadsError) botProblems.push(`#${name}: could not read the bot's permissions (${shown$6(have.botThreadsError)})`);
|
|
15215
15289
|
else if (have.botThreads) {
|
|
15216
15290
|
if (!have.botThreads.post) botProblems.push(`#${name}: the bot cannot start posts or reply in it`);
|
|
@@ -16440,7 +16514,7 @@ const CHANNEL_ID = "monitoring-alert-channel";
|
|
|
16440
16514
|
const CHANNEL_TITLE = "monitoring alert channel posts through the feed webhook";
|
|
16441
16515
|
const SUBSCRIPTIONS_ID = "monitoring-subscriptions";
|
|
16442
16516
|
const SUBSCRIPTIONS_TITLE = "monitoring alert channel is subscribed to the checks routed to it";
|
|
16443
|
-
const same$
|
|
16517
|
+
const same$5 = (a, b) => a.toLowerCase() === b.toLowerCase();
|
|
16444
16518
|
const shown$4 = (s) => sanitizeDetail(s);
|
|
16445
16519
|
const skipAll = (reason) => [
|
|
16446
16520
|
skipRow$1(WEBHOOK_ID$1, WEBHOOK_TITLE$1, reason),
|
|
@@ -16468,14 +16542,14 @@ async function monitoringFeedChecks(input) {
|
|
|
16468
16542
|
let channelSkip;
|
|
16469
16543
|
for (const { channel, feed } of fed) {
|
|
16470
16544
|
const names = monitoringFeed(channel.name, feed, monitoring);
|
|
16471
|
-
const where = found.channels.find((c) => same$
|
|
16545
|
+
const where = found.channels.find((c) => same$5(c.name, channel.name));
|
|
16472
16546
|
const hookId = where?.webhookIds?.[names.webhook.toLowerCase()];
|
|
16473
|
-
const named = where?.webhooks.some((w) => same$
|
|
16547
|
+
const named = where?.webhooks.some((w) => same$5(w, names.webhook)) ?? false;
|
|
16474
16548
|
const label = `#${shown$4(channel.name)}`;
|
|
16475
16549
|
if (!where) webhookProblems.push(`${label}: no channel to hold the feed webhook`);
|
|
16476
16550
|
else if (where.webhooksError) webhookProblems.push(`${label}: could not list its webhooks (${shown$4(where.webhooksError)})`);
|
|
16477
16551
|
else if (!named) webhookProblems.push(`${label}: no webhook named ${shown$4(names.webhook)}`);
|
|
16478
|
-
else if (feedAvatarOf(layout, feed, monitoring).length > 0 && !where.webhookAvatars?.some((w) => same$
|
|
16552
|
+
else if (feedAvatarOf(layout, feed, monitoring).length > 0 && !where.webhookAvatars?.some((w) => same$5(w, names.webhook))) webhookProblems.push(`${label}: webhook ${shown$4(names.webhook)} has no picture`);
|
|
16479
16553
|
if (channelSkip !== void 0) continue;
|
|
16480
16554
|
if (!monitoring.inspectAlertChannel) {
|
|
16481
16555
|
channelSkip = `the \`${monitoring.providerName}\` provider cannot read its alert channels`;
|
|
@@ -17205,7 +17279,7 @@ const BINDINGS_ID = "relay-bindings";
|
|
|
17205
17279
|
const BINDINGS_TITLE = "relay Worker has its webhook and signing secret bound";
|
|
17206
17280
|
const WEBHOOK_ID = "relay-feed-webhook";
|
|
17207
17281
|
const WEBHOOK_TITLE = "error feed webhook exists and has a picture";
|
|
17208
|
-
const same$
|
|
17282
|
+
const same$4 = (a, b) => a.toLowerCase() === b.toLowerCase();
|
|
17209
17283
|
const shown$2 = (s) => sanitizeDetail(s);
|
|
17210
17284
|
/** One unsigned `POST` to the Worker, and what the answer says about it. Reads nothing from the response. */
|
|
17211
17285
|
async function answers(url, doFetch) {
|
|
@@ -17256,7 +17330,7 @@ async function relayChecks(input) {
|
|
|
17256
17330
|
else {
|
|
17257
17331
|
const bound = new Set(state.bindingNames.map((n) => n.toUpperCase()));
|
|
17258
17332
|
const wanted = ids.flatMap((id) => [relayWebhookBinding(id), relaySecretBinding(id)]);
|
|
17259
|
-
rows.push(resultRow(WORKER_ID, WORKER_TITLE, state.routes.some((r) => same$
|
|
17333
|
+
rows.push(resultRow(WORKER_ID, WORKER_TITLE, state.routes.some((r) => same$4(r, route)) ? [] : [`${shown$2(script)} has no route ${shown$2(route)}`], `${shown$2(script)} serves ${shown$2(route)}`), resultRow(BINDINGS_ID, BINDINGS_TITLE, wanted.filter((n) => !bound.has(n)).map((n) => `${n}: not bound`), `${wanted.length} of ${wanted.length} bound`));
|
|
17260
17334
|
}
|
|
17261
17335
|
} catch (err) {
|
|
17262
17336
|
const reason = missingTokenReason(err);
|
|
@@ -17283,15 +17357,38 @@ function webhookRow$1(input, source) {
|
|
|
17283
17357
|
}
|
|
17284
17358
|
/** The one rule both feeds follow: the channel exists, lists the webhook and, when a picture is wanted, the picture is on it. */
|
|
17285
17359
|
function webhookProblems(input, id, title, channelName, name, avatar) {
|
|
17286
|
-
const where = input.found.channels.find((c) => same$
|
|
17360
|
+
const where = input.found.channels.find((c) => same$4(c.name, channelName));
|
|
17287
17361
|
const label = `#${shown$2(channelName)}`;
|
|
17288
17362
|
const problems = [];
|
|
17289
17363
|
if (!where) problems.push(`${label}: no channel to hold the feed webhook`);
|
|
17290
17364
|
else if (where.webhooksError) problems.push(`${label}: could not list its webhooks (${shown$2(where.webhooksError)})`);
|
|
17291
|
-
else if (!where.webhooks.some((w) => same$
|
|
17292
|
-
else if (avatar.length > 0 && !where.webhookAvatars?.some((w) => same$
|
|
17365
|
+
else if (!where.webhooks.some((w) => same$4(w, name))) problems.push(`${label}: no webhook named ${shown$2(name)}`);
|
|
17366
|
+
else if (avatar.length > 0 && !where.webhookAvatars?.some((w) => same$4(w, name))) problems.push(`${label}: webhook ${shown$2(name)} has no picture`);
|
|
17293
17367
|
return resultRow(id, title, problems, `${label}: ${shown$2(name)}`);
|
|
17294
17368
|
}
|
|
17369
|
+
// src/commands/release-thread-checks/release-thread-checks.ts
|
|
17370
|
+
const same$3 = (a, b) => a.toLowerCase() === b.toLowerCase();
|
|
17371
|
+
const TITLE = "bot can create release threads in #releases";
|
|
17372
|
+
/**
|
|
17373
|
+
* The step of `doctor notifications` for release announcements (`sync releases`, SPEC-0119): when the layout has a
|
|
17374
|
+
* `releases` channel, the bot can create public threads there and send in them, read from `inspect` after the
|
|
17375
|
+
* channel's own overwrites (`botThreads.post`). Read-only. No row when the layout has no `releases` channel.
|
|
17376
|
+
*/
|
|
17377
|
+
function releaseThreadChecks(input) {
|
|
17378
|
+
const { layout, found } = input;
|
|
17379
|
+
if (!(layout.categories ?? []).flatMap((cat) => (cat.channels ?? []).map((channel) => ({
|
|
17380
|
+
cat: cat.name,
|
|
17381
|
+
channel
|
|
17382
|
+
}))).find(({ channel }) => same$3(channel.name, "releases"))) return [];
|
|
17383
|
+
if (!found) return [skipRow$1("release-threads", TITLE, "not checked: could not read the server")];
|
|
17384
|
+
const have = found.channels.find((c) => same$3(c.name, "releases"));
|
|
17385
|
+
const problems = [];
|
|
17386
|
+
if (!have) problems.push("#releases: missing from the server");
|
|
17387
|
+
else if (have.botThreadsError) problems.push(`#releases: could not read the bot's permissions (${sanitizeDetail(have.botThreadsError)})`);
|
|
17388
|
+
else if (!have.botThreads) problems.push("#releases: the provider did not report the bot's permissions");
|
|
17389
|
+
else if (!have.botThreads.post) problems.push("#releases: the bot cannot create public threads there (needs Create Public Threads and Send Messages in Threads)");
|
|
17390
|
+
return [resultRow("release-threads", TITLE, problems, "the bot can create threads in #releases")];
|
|
17391
|
+
}
|
|
17295
17392
|
// src/commands/sentry-relay-checks/sentry-relay-checks.ts
|
|
17296
17393
|
const INTEGRATION_ID = "relay-integration";
|
|
17297
17394
|
const INTEGRATION_TITLE = "error tracker integration posts to the relay";
|
|
@@ -17862,6 +17959,10 @@ async function runDoctorNotifications(input) {
|
|
|
17862
17959
|
layout,
|
|
17863
17960
|
found
|
|
17864
17961
|
}));
|
|
17962
|
+
checks.push(...releaseThreadChecks({
|
|
17963
|
+
layout,
|
|
17964
|
+
found
|
|
17965
|
+
}));
|
|
17865
17966
|
checks.push(...await notificationsWorkflowChecks({
|
|
17866
17967
|
layout,
|
|
17867
17968
|
source: loader.has("source") ? loader.get("source") : void 0,
|
|
@@ -19056,19 +19157,25 @@ function repoChecks(config, repoRoot, statusContexts) {
|
|
|
19056
19157
|
checks.push(...viewChecks(repo?.views));
|
|
19057
19158
|
if (repo?.teams && repo.teams.length > 0) {
|
|
19058
19159
|
const teams = repo.teams;
|
|
19160
|
+
const manualTeams = config.doctor?.manualTeams ?? [];
|
|
19059
19161
|
checks.push({
|
|
19060
19162
|
id: "repo-teams",
|
|
19061
19163
|
title: "team access matches",
|
|
19062
19164
|
needs: "listTeamAccess",
|
|
19063
19165
|
async run(source) {
|
|
19064
19166
|
const found = await source.listTeamAccess();
|
|
19167
|
+
const problems = declaredVsActual(new Map(teams.map(teamPermission)), new Map(found.map((t) => [t.slug, t.permission])), {
|
|
19168
|
+
noun: "team",
|
|
19169
|
+
flagExtra: false,
|
|
19170
|
+
show: quote
|
|
19171
|
+
});
|
|
19172
|
+
const known = new Set([...teams.map((t) => teamPermission(t)[0]), ...manualTeams].map((s) => s.toLowerCase()));
|
|
19173
|
+
const undeclared = found.map((t) => t.slug).filter((slug) => !known.has(slug.toLowerCase()));
|
|
19174
|
+
const info = undeclared.length > 0 ? [`${undeclared.length} team(s) with access not in \`repo.teams\`: ${undeclared.join(", ")}`] : [];
|
|
19065
19175
|
return {
|
|
19066
|
-
problems
|
|
19067
|
-
|
|
19068
|
-
|
|
19069
|
-
show: quote
|
|
19070
|
-
}),
|
|
19071
|
-
checked: teams.length
|
|
19176
|
+
problems,
|
|
19177
|
+
checked: teams.length,
|
|
19178
|
+
info
|
|
19072
19179
|
};
|
|
19073
19180
|
}
|
|
19074
19181
|
});
|
|
@@ -36438,7 +36545,7 @@ function resolveOtp(argvOtp, env) {
|
|
|
36438
36545
|
}
|
|
36439
36546
|
// src/commands/publish/default-exec.ts
|
|
36440
36547
|
const defaultExec = async (cmd, args, opts) => {
|
|
36441
|
-
const { HOLOCRON_OTP: _omittedOtp, ...
|
|
36548
|
+
const { HOLOCRON_OTP: _omittedOtp, ...inherited } = process.env;
|
|
36442
36549
|
const result = spawnSync(cmd, args, {
|
|
36443
36550
|
cwd: opts.cwd,
|
|
36444
36551
|
encoding: "utf8",
|
|
@@ -36447,7 +36554,10 @@ const defaultExec = async (cmd, args, opts) => {
|
|
|
36447
36554
|
"pipe",
|
|
36448
36555
|
"pipe"
|
|
36449
36556
|
],
|
|
36450
|
-
env
|
|
36557
|
+
env: {
|
|
36558
|
+
...inherited,
|
|
36559
|
+
...opts.env
|
|
36560
|
+
}
|
|
36451
36561
|
});
|
|
36452
36562
|
return {
|
|
36453
36563
|
exitCode: result.status ?? -1,
|
|
@@ -36483,6 +36593,8 @@ function discoverPublicPackageEntries(cwd, scope = {}) {
|
|
|
36483
36593
|
}] : []);
|
|
36484
36594
|
}
|
|
36485
36595
|
// src/commands/publish/filter-new-packages.ts
|
|
36596
|
+
/** The version npm gives a staged new package's public placeholder until the stage is approved. */
|
|
36597
|
+
const STAGE_PLACEHOLDER_VERSION = "0.0.0-stage";
|
|
36486
36598
|
/**
|
|
36487
36599
|
* Keeps only the entries that don't exist on npm yet — the actual
|
|
36488
36600
|
* chicken-and-egg case `--initial` exists for (ADR: npm requires a package
|
|
@@ -36516,7 +36628,7 @@ async function filterNewPackages(entries, cwd, exec, print, nameWidth, dirWidth)
|
|
|
36516
36628
|
"version"
|
|
36517
36629
|
], { cwd });
|
|
36518
36630
|
const publishedVersion = view.exitCode === 0 ? view.stdout.trim() : "";
|
|
36519
|
-
if (publishedVersion) {
|
|
36631
|
+
if (publishedVersion && publishedVersion !== STAGE_PLACEHOLDER_VERSION) {
|
|
36520
36632
|
print(statusRow$1("skip", [
|
|
36521
36633
|
pad$1(entry.name, nameWidth),
|
|
36522
36634
|
pad$1(entry.dir, dirWidth),
|
|
@@ -36528,8 +36640,35 @@ async function filterNewPackages(entries, cwd, exec, print, nameWidth, dirWidth)
|
|
|
36528
36640
|
}
|
|
36529
36641
|
return results;
|
|
36530
36642
|
}
|
|
36643
|
+
// src/commands/publish/node-version-supports-stage.ts
|
|
36644
|
+
/** The first Node that npm's `npm stage` supports. */
|
|
36645
|
+
const MIN_STAGE_NODE_VERSION = "22.14.0";
|
|
36646
|
+
/** True when the `node --version` output (`v22.14.0`) names 22.14.0 or later. */
|
|
36647
|
+
function nodeVersionSupportsStage(output) {
|
|
36648
|
+
const match = /^v?(\d+)\.(\d+)\.(\d+)/.exec(output.trim());
|
|
36649
|
+
if (!match) return false;
|
|
36650
|
+
const [major, minor] = [Number(match[1]), Number(match[2])];
|
|
36651
|
+
return major > 22 || major === 22 && minor >= 14;
|
|
36652
|
+
}
|
|
36653
|
+
// src/commands/publish/npm-version-supports-stage.ts
|
|
36654
|
+
/** The first npm CLI that has `npm stage publish`. */
|
|
36655
|
+
const MIN_STAGE_NPM_VERSION = "11.15.0";
|
|
36656
|
+
/** True when the `npm --version` output names a release of 11.15.0 or later (a prerelease suffix is ignored). */
|
|
36657
|
+
function npmVersionSupportsStage(output) {
|
|
36658
|
+
const match = /^(\d+)\.(\d+)\.(\d+)/.exec(output.trim());
|
|
36659
|
+
if (!match) return false;
|
|
36660
|
+
const [major, minor] = [Number(match[1]), Number(match[2])];
|
|
36661
|
+
return major > 11 || major === 11 && minor >= 15;
|
|
36662
|
+
}
|
|
36663
|
+
// src/commands/publish/print-approve-lines.ts
|
|
36664
|
+
/** One `npm stage approve <id>` line per staged package, and where to find the same stages on npmjs.com. */
|
|
36665
|
+
function printApproveLines(print, staged) {
|
|
36666
|
+
for (const s of staged) print(` npm stage approve ${s.id}`);
|
|
36667
|
+
print(" or on npmjs.com, the Staged Packages tab of each package (under its settings):");
|
|
36668
|
+
for (const s of staged) print(` https://www.npmjs.com/package/${s.name}/access`);
|
|
36669
|
+
}
|
|
36531
36670
|
// src/commands/publish/print-next-steps.ts
|
|
36532
|
-
function printNextSteps(print, env, packageNames, identity, workflowFile) {
|
|
36671
|
+
function printNextSteps(print, env, packageNames, identity, workflowFile, npmTokenUsed = false) {
|
|
36533
36672
|
print("");
|
|
36534
36673
|
print("→ next: configure Trusted Publisher for each package on npm:");
|
|
36535
36674
|
print(" Publisher: GitHub Actions");
|
|
@@ -36542,9 +36681,10 @@ function printNextSteps(print, env, packageNames, identity, workflowFile) {
|
|
|
36542
36681
|
print("");
|
|
36543
36682
|
print("→ packages to be published:");
|
|
36544
36683
|
for (const name of packageNames) print(` https://www.npmjs.com/package/${name}/access`);
|
|
36545
|
-
if (env.get("NPM_TOKEN")) {
|
|
36684
|
+
if (npmTokenUsed || env.get("NPM_TOKEN") || env.get("HOLOCRON_NPM_TOKEN")) {
|
|
36546
36685
|
print("");
|
|
36547
|
-
print("→ cleanup:
|
|
36686
|
+
print("→ cleanup: the npm token was used. It is short-lived (a short expiry); revoke it now if it has not run out");
|
|
36687
|
+
print(" (no API for self-revoke; UI-only):");
|
|
36548
36688
|
print(" https://www.npmjs.com/settings/~/tokens");
|
|
36549
36689
|
}
|
|
36550
36690
|
}
|
|
@@ -36560,6 +36700,11 @@ function redactOtp(args, otp) {
|
|
|
36560
36700
|
if (!otp) return [...args];
|
|
36561
36701
|
return args.map((arg) => arg === otp ? "***" : arg);
|
|
36562
36702
|
}
|
|
36703
|
+
// src/commands/publish/redact-token.ts
|
|
36704
|
+
/** Replaces every occurrence of `token` in `text` with `***`, so an npm error never echoes the credential. */
|
|
36705
|
+
function redactToken(text, token) {
|
|
36706
|
+
return token ? text.split(token).join("***") : text;
|
|
36707
|
+
}
|
|
36563
36708
|
// src/commands/publish/release-workflow-file.ts
|
|
36564
36709
|
/** The release caller's filename: the current name first, then the one a repo still on the older callers has. */
|
|
36565
36710
|
const CANDIDATES = ["ci.release.yml", "delivery.publish.yml"];
|
|
@@ -36598,6 +36743,134 @@ function scopeOf({ group, excludeGroups, onlyPackages }) {
|
|
|
36598
36743
|
...onlyPackages === void 0 ? {} : { onlyPackages }
|
|
36599
36744
|
};
|
|
36600
36745
|
}
|
|
36746
|
+
// src/commands/publish/parse-stage-id.ts
|
|
36747
|
+
/**
|
|
36748
|
+
* The stage id `npm stage publish` prints, as in `+ @scope/name@0.0.1 (staged with id <uuid>)`.
|
|
36749
|
+
* `undefined` when the output carries none.
|
|
36750
|
+
*/
|
|
36751
|
+
function parseStageId(output) {
|
|
36752
|
+
return /staged with id ([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/i.exec(output)?.[1];
|
|
36753
|
+
}
|
|
36754
|
+
// src/commands/publish/parse-stage-list.ts
|
|
36755
|
+
/**
|
|
36756
|
+
* The stages `npm stage list` prints, one block of `key: value` lines each (`id`, `package name`, `version`, `status`,
|
|
36757
|
+
* ...). A block with no id, name or version is dropped, so unfamiliar output reads as no pending stages.
|
|
36758
|
+
*/
|
|
36759
|
+
function parseStageList(output) {
|
|
36760
|
+
const stages = [];
|
|
36761
|
+
let current;
|
|
36762
|
+
const flush = () => {
|
|
36763
|
+
if (current?.id && current.name && current.version) stages.push({
|
|
36764
|
+
id: current.id,
|
|
36765
|
+
name: current.name,
|
|
36766
|
+
version: current.version,
|
|
36767
|
+
status: current.status ?? ""
|
|
36768
|
+
});
|
|
36769
|
+
};
|
|
36770
|
+
for (const raw of output.split("\n")) {
|
|
36771
|
+
const line = raw.trim();
|
|
36772
|
+
const colon = line.indexOf(":");
|
|
36773
|
+
if (colon < 0) continue;
|
|
36774
|
+
const key = line.slice(0, colon).trim().toLowerCase();
|
|
36775
|
+
const value = line.slice(colon + 1).trim();
|
|
36776
|
+
if (key === "id") {
|
|
36777
|
+
flush();
|
|
36778
|
+
current = { id: value };
|
|
36779
|
+
} else if (current && key === "package name") current.name = value;
|
|
36780
|
+
else if (current && key === "version") current.version = value;
|
|
36781
|
+
else if (current && key === "status") current.status = value;
|
|
36782
|
+
}
|
|
36783
|
+
flush();
|
|
36784
|
+
return stages;
|
|
36785
|
+
}
|
|
36786
|
+
// src/commands/publish/stage-packages/stage-packages.ts
|
|
36787
|
+
/** The registry auth key npm reads from the environment, so the token never touches an `.npmrc`. */
|
|
36788
|
+
const NPM_AUTH_ENV_KEY = "npm_config_//registry.npmjs.org/:_authToken";
|
|
36789
|
+
/**
|
|
36790
|
+
* Stages each package with `npm stage publish`: nothing becomes public until a maintainer approves it with 2FA. The
|
|
36791
|
+
* package is packed with `pnpm pack` first (npm would not rewrite `workspace:` ranges), and the tarball is staged. The
|
|
36792
|
+
* token is in the child environment for the stage calls only, and every message is redacted of it.
|
|
36793
|
+
*/
|
|
36794
|
+
async function stagePackages(input) {
|
|
36795
|
+
const { exec, cwd, token } = input;
|
|
36796
|
+
const env = { [NPM_AUTH_ENV_KEY]: token };
|
|
36797
|
+
const staged = [];
|
|
36798
|
+
const listed = await exec("npm", ["stage", "list"], {
|
|
36799
|
+
cwd,
|
|
36800
|
+
env
|
|
36801
|
+
});
|
|
36802
|
+
const pending = listed.exitCode === 0 ? parseStageList(listed.stdout) : [];
|
|
36803
|
+
const scratch = mkdtempSync(join(tmpdir(), "holocron-stage-"));
|
|
36804
|
+
try {
|
|
36805
|
+
for (const entry of input.entries) {
|
|
36806
|
+
const dir = resolve(cwd, entry.dir);
|
|
36807
|
+
const label = `${entry.name}@${entry.version}`;
|
|
36808
|
+
const already = pending.find((p) => p.name === entry.name && p.version === entry.version);
|
|
36809
|
+
if (already) {
|
|
36810
|
+
input.print(` · ${label} is already staged (${already.id}); not uploading it again`);
|
|
36811
|
+
staged.push({
|
|
36812
|
+
name: entry.name,
|
|
36813
|
+
version: entry.version,
|
|
36814
|
+
id: already.id,
|
|
36815
|
+
resumed: true
|
|
36816
|
+
});
|
|
36817
|
+
continue;
|
|
36818
|
+
}
|
|
36819
|
+
const pack = await exec("pnpm", [
|
|
36820
|
+
"pack",
|
|
36821
|
+
"--pack-destination",
|
|
36822
|
+
scratch
|
|
36823
|
+
], { cwd: dir });
|
|
36824
|
+
const tarball = pack.stdout.split("\n").map((l) => l.trim()).filter((l) => l.endsWith(".tgz")).pop();
|
|
36825
|
+
if (pack.exitCode !== 0 || !tarball) {
|
|
36826
|
+
const message = `pack failed for ${label}: ${redactToken(pack.stderr.trim() || pack.stdout.trim() || "no output", token)}`;
|
|
36827
|
+
input.print(` ✗ ${message}`);
|
|
36828
|
+
return {
|
|
36829
|
+
ok: false,
|
|
36830
|
+
staged,
|
|
36831
|
+
message
|
|
36832
|
+
};
|
|
36833
|
+
}
|
|
36834
|
+
const result = await exec("npm", [
|
|
36835
|
+
"stage",
|
|
36836
|
+
"publish",
|
|
36837
|
+
resolve(dir, tarball),
|
|
36838
|
+
"--access",
|
|
36839
|
+
"public",
|
|
36840
|
+
"--tag",
|
|
36841
|
+
input.tag
|
|
36842
|
+
], {
|
|
36843
|
+
cwd: dir,
|
|
36844
|
+
env
|
|
36845
|
+
});
|
|
36846
|
+
const id = parseStageId(`${result.stdout}\n${result.stderr}`);
|
|
36847
|
+
if (result.exitCode !== 0 || !id) {
|
|
36848
|
+
const detail = redactToken(result.stderr.trim() || result.stdout.trim() || "no output", token);
|
|
36849
|
+
const message = result.exitCode === 0 ? `stage did not report an id for ${label}: ${detail}` : `stage failed for ${label} (exit ${result.exitCode}): ${detail}`;
|
|
36850
|
+
input.print(` ✗ ${message}`);
|
|
36851
|
+
return {
|
|
36852
|
+
ok: false,
|
|
36853
|
+
staged,
|
|
36854
|
+
message
|
|
36855
|
+
};
|
|
36856
|
+
}
|
|
36857
|
+
staged.push({
|
|
36858
|
+
name: entry.name,
|
|
36859
|
+
version: entry.version,
|
|
36860
|
+
id
|
|
36861
|
+
});
|
|
36862
|
+
}
|
|
36863
|
+
return {
|
|
36864
|
+
ok: true,
|
|
36865
|
+
staged
|
|
36866
|
+
};
|
|
36867
|
+
} finally {
|
|
36868
|
+
rmSync(scratch, {
|
|
36869
|
+
recursive: true,
|
|
36870
|
+
force: true
|
|
36871
|
+
});
|
|
36872
|
+
}
|
|
36873
|
+
}
|
|
36601
36874
|
// src/commands/publish/workspace-filter-args.ts
|
|
36602
36875
|
/**
|
|
36603
36876
|
* `-r --filter=./clients/* --filter=./observability` -- one filter per
|
|
@@ -36673,20 +36946,62 @@ async function runPublish(input = {}) {
|
|
|
36673
36946
|
const env = createEnvLookup(input.env);
|
|
36674
36947
|
const exec = input.exec ?? defaultExec;
|
|
36675
36948
|
const login = input.login ?? defaultLogin;
|
|
36949
|
+
const npmToken = resolveValue$2(["NPM_TOKEN"], input.env, { prefix: PREFIX$1 });
|
|
36950
|
+
const tokenEnv = npmToken ? { [NPM_AUTH_ENV_KEY]: npmToken } : void 0;
|
|
36676
36951
|
logger.info({
|
|
36677
36952
|
tag,
|
|
36678
|
-
dryRun: dryRun || void 0
|
|
36953
|
+
dryRun: dryRun || void 0,
|
|
36954
|
+
staged: npmToken ? true : void 0
|
|
36679
36955
|
}, "publish --initial: start");
|
|
36956
|
+
const names = () => (input.packages ?? discoverPublicPackageEntries(cwd, scopeOf(input))).map((e) => e.name);
|
|
36680
36957
|
print("");
|
|
36681
36958
|
print(style.dim(" → verifying npm auth (`npm whoami`)…"));
|
|
36682
|
-
|
|
36959
|
+
if (npmToken) {
|
|
36960
|
+
const version = await exec("npm", ["--version"], { cwd });
|
|
36961
|
+
if (version.exitCode !== 0 || !npmVersionSupportsStage(version.stdout)) {
|
|
36962
|
+
const message = `staging needs npm ${MIN_STAGE_NPM_VERSION} or later (found ${version.stdout.trim() || "none"}). Update npm, then re-run.`;
|
|
36963
|
+
print(` ✗ ${message}`);
|
|
36964
|
+
logger.warn({ reason: "npm too old for stage" }, "publish --initial: done");
|
|
36965
|
+
return {
|
|
36966
|
+
status: "fail",
|
|
36967
|
+
message,
|
|
36968
|
+
packageNames: names()
|
|
36969
|
+
};
|
|
36970
|
+
}
|
|
36971
|
+
const node = await exec("node", ["--version"], { cwd });
|
|
36972
|
+
if (node.exitCode !== 0 || !nodeVersionSupportsStage(node.stdout)) {
|
|
36973
|
+
const message = `staging needs Node ${MIN_STAGE_NODE_VERSION} or later (found ${node.stdout.trim() || "none"}). Switch Node, then re-run.`;
|
|
36974
|
+
print(` ✗ ${message}`);
|
|
36975
|
+
logger.warn({ reason: "node too old for stage" }, "publish --initial: done");
|
|
36976
|
+
return {
|
|
36977
|
+
status: "fail",
|
|
36978
|
+
message,
|
|
36979
|
+
packageNames: names()
|
|
36980
|
+
};
|
|
36981
|
+
}
|
|
36982
|
+
}
|
|
36983
|
+
let whoami = await exec("npm", ["whoami"], {
|
|
36984
|
+
cwd,
|
|
36985
|
+
...tokenEnv ? { env: tokenEnv } : {}
|
|
36986
|
+
});
|
|
36987
|
+
if (npmToken && whoami.exitCode !== 0) {
|
|
36988
|
+
const detail = redactToken(`${whoami.stderr} ${whoami.stdout}`, npmToken);
|
|
36989
|
+
const message = /E401/.test(detail) ? "npm rejected HOLOCRON_NPM_TOKEN (E401): it is expired or revoked. Make a new stage-only token at https://www.npmjs.com/settings/~/tokens." : `npm whoami failed with HOLOCRON_NPM_TOKEN: ${detail.trim() || "no output"}`;
|
|
36990
|
+
print(` ✗ ${message}`);
|
|
36991
|
+
logger.warn({ reason: "npm whoami failed with token" }, "publish --initial: done");
|
|
36992
|
+
return {
|
|
36993
|
+
status: "fail",
|
|
36994
|
+
message,
|
|
36995
|
+
packageNames: names()
|
|
36996
|
+
};
|
|
36997
|
+
}
|
|
36683
36998
|
if (whoami.exitCode !== 0) {
|
|
36684
36999
|
print(" not authenticated — running `npm login --auth-type=web`…");
|
|
36685
37000
|
logger.info({}, "publish --initial: npm login");
|
|
36686
37001
|
if ((await login(cwd)).exitCode !== 0) {
|
|
36687
37002
|
const message = "npm login failed. Run `npm login --auth-type=web` (or `npm login`) manually, then re-run.";
|
|
36688
37003
|
print(` ✗ ${message}`);
|
|
36689
|
-
const packageNames = (
|
|
37004
|
+
const packageNames = names();
|
|
36690
37005
|
logger.warn({ reason: "npm login failed" }, "publish --initial: done");
|
|
36691
37006
|
return {
|
|
36692
37007
|
status: "fail",
|
|
@@ -36698,7 +37013,7 @@ async function runPublish(input = {}) {
|
|
|
36698
37013
|
if (whoami.exitCode !== 0) {
|
|
36699
37014
|
const message = "npm login completed but `npm whoami` still fails — check your npm account.";
|
|
36700
37015
|
print(` ✗ ${message}`);
|
|
36701
|
-
const packageNames = (
|
|
37016
|
+
const packageNames = names();
|
|
36702
37017
|
logger.warn({ reason: "npm whoami still fails after login" }, "publish --initial: done");
|
|
36703
37018
|
return {
|
|
36704
37019
|
status: "fail",
|
|
@@ -36757,10 +37072,10 @@ async function runPublish(input = {}) {
|
|
|
36757
37072
|
];
|
|
36758
37073
|
if (dryRun) {
|
|
36759
37074
|
print("");
|
|
36760
|
-
for (const entry of newEntries) print(style.dim(` ${pad$1(entry.name, nameWidth)} ${pad$1(entry.dir, dirWidth)} would publish (v${entry.version})`));
|
|
36761
|
-
print(style.dim(` would run: pnpm ${redactOtp(publishArgs, otp).join(" ")}`));
|
|
37075
|
+
for (const entry of newEntries) print(style.dim(` ${pad$1(entry.name, nameWidth)} ${pad$1(entry.dir, dirWidth)} would ${npmToken ? "stage" : "publish"} (v${entry.version})`));
|
|
37076
|
+
print(style.dim(npmToken ? ` would run, per package: pnpm pack, then npm stage publish <tarball> --access public --tag ${tag} (token from the environment, not shown)` : ` would run: pnpm ${redactOtp(publishArgs, otp).join(" ")}`));
|
|
36762
37077
|
printSummary(print, dryRun, packageNames.length, 0, skippedCount);
|
|
36763
|
-
printNextSteps(print, env, packageNames, identity, releaseWorkflowFile(cwd));
|
|
37078
|
+
printNextSteps(print, env, packageNames, identity, releaseWorkflowFile(cwd), Boolean(npmToken));
|
|
36764
37079
|
logger.info({
|
|
36765
37080
|
tag,
|
|
36766
37081
|
status: "dry-run",
|
|
@@ -36772,6 +37087,53 @@ async function runPublish(input = {}) {
|
|
|
36772
37087
|
packageNames
|
|
36773
37088
|
};
|
|
36774
37089
|
}
|
|
37090
|
+
if (npmToken) {
|
|
37091
|
+
print("");
|
|
37092
|
+
print(` → staging ${packageNames.length} new package${packageNames.length === 1 ? "" : "s"} (nothing is published)…`);
|
|
37093
|
+
const result = await stagePackages({
|
|
37094
|
+
entries: newEntries,
|
|
37095
|
+
cwd,
|
|
37096
|
+
tag,
|
|
37097
|
+
token: npmToken,
|
|
37098
|
+
exec,
|
|
37099
|
+
print
|
|
37100
|
+
});
|
|
37101
|
+
if (!result.ok) {
|
|
37102
|
+
if (result.staged.length > 0) {
|
|
37103
|
+
print("");
|
|
37104
|
+
print("→ these were staged before the failure and are still pending (a rerun reports them, it does not stage them twice):");
|
|
37105
|
+
printApproveLines(print, result.staged);
|
|
37106
|
+
}
|
|
37107
|
+
printSummary(print, dryRun, 0, packageNames.length - result.staged.length, skippedCount);
|
|
37108
|
+
logger.warn({
|
|
37109
|
+
tag,
|
|
37110
|
+
reason: "stage failed"
|
|
37111
|
+
}, "publish --initial: done");
|
|
37112
|
+
return {
|
|
37113
|
+
status: "fail",
|
|
37114
|
+
message: result.message,
|
|
37115
|
+
packageNames,
|
|
37116
|
+
staged: result.staged
|
|
37117
|
+
};
|
|
37118
|
+
}
|
|
37119
|
+
for (const s of result.staged) print(statusRow$1("ok", [pad$1(s.name, nameWidth), `staged (v${s.version})`]));
|
|
37120
|
+
print("");
|
|
37121
|
+
print(style.dim(` ${result.staged.length} staged, 0 failed, ${skippedCount} skipped (nothing is public yet)`));
|
|
37122
|
+
print("");
|
|
37123
|
+
print("→ approve each staged package (asks for 2FA; add `--otp <code>` to give the code on the command line):");
|
|
37124
|
+
printApproveLines(print, result.staged);
|
|
37125
|
+
printNextSteps(print, env, packageNames, identity, releaseWorkflowFile(cwd), true);
|
|
37126
|
+
logger.info({
|
|
37127
|
+
tag,
|
|
37128
|
+
status: "ok",
|
|
37129
|
+
staged: result.staged.length
|
|
37130
|
+
}, "publish --initial: done");
|
|
37131
|
+
return {
|
|
37132
|
+
status: "ok",
|
|
37133
|
+
packageNames,
|
|
37134
|
+
staged: result.staged
|
|
37135
|
+
};
|
|
37136
|
+
}
|
|
36775
37137
|
print("");
|
|
36776
37138
|
print(` → publishing ${packageNames.length} new package${packageNames.length === 1 ? "" : "s"}…`);
|
|
36777
37139
|
const publish = await exec("pnpm", publishArgs, { cwd });
|
|
@@ -40916,6 +41278,299 @@ const syncReadmeCommand = {
|
|
|
40916
41278
|
}
|
|
40917
41279
|
}
|
|
40918
41280
|
};
|
|
41281
|
+
// src/commands/sync-releases/release-marker/release-marker.ts
|
|
41282
|
+
/**
|
|
41283
|
+
* The marker that ends a release's message: Discord's small-text line, so it is quiet to read, carrying the release id
|
|
41284
|
+
* between brackets. The closing bracket matters: a marker looked for as text must not match the next release's id
|
|
41285
|
+
* (`v5.0.0-alpha.1` is a prefix of `v5.0.0-alpha.10`).
|
|
41286
|
+
*
|
|
41287
|
+
* @param id - The release's id: its tag, or the two commits.
|
|
41288
|
+
*/
|
|
41289
|
+
function releaseMarker(id) {
|
|
41290
|
+
return `-# release [${id}]`;
|
|
41291
|
+
}
|
|
41292
|
+
// src/commands/sync-releases/released-packages/released-packages.ts
|
|
41293
|
+
/** The file at `rev`, or `undefined` when the commit has no such file. */
|
|
41294
|
+
function showAt(cwd, rev, path) {
|
|
41295
|
+
try {
|
|
41296
|
+
return execFileSync("git", ["show", `${rev}:${path}`], {
|
|
41297
|
+
cwd,
|
|
41298
|
+
encoding: "utf8",
|
|
41299
|
+
stdio: [
|
|
41300
|
+
"ignore",
|
|
41301
|
+
"pipe",
|
|
41302
|
+
"ignore"
|
|
41303
|
+
]
|
|
41304
|
+
});
|
|
41305
|
+
} catch {
|
|
41306
|
+
return;
|
|
41307
|
+
}
|
|
41308
|
+
}
|
|
41309
|
+
function versionAt(cwd, rev, dir) {
|
|
41310
|
+
const text = showAt(cwd, rev, dir === "." ? "package.json" : `${dir.replace(/^\.\//, "")}/package.json`);
|
|
41311
|
+
if (text === void 0) return {};
|
|
41312
|
+
try {
|
|
41313
|
+
const manifest = JSON.parse(text);
|
|
41314
|
+
return {
|
|
41315
|
+
version: manifest.version,
|
|
41316
|
+
private: manifest.private
|
|
41317
|
+
};
|
|
41318
|
+
} catch {
|
|
41319
|
+
return {};
|
|
41320
|
+
}
|
|
41321
|
+
}
|
|
41322
|
+
/** The dist-tag a version publishes under: its prerelease identifier (`5.0.0-alpha.3` is `alpha`), else `latest`. */
|
|
41323
|
+
function distTagOf(version) {
|
|
41324
|
+
const pre = version.split("-").slice(1).join("-");
|
|
41325
|
+
return pre ? pre.split(".")[0] : "latest";
|
|
41326
|
+
}
|
|
41327
|
+
/**
|
|
41328
|
+
* The public packages a release published: those whose `version` differs between `from` and `to`. Private packages
|
|
41329
|
+
* and apps (deployed, not versioned) are left out. The packages and their folders are the working tree's, read the
|
|
41330
|
+
* way `publish package` reads them, and each manifest is read from the two commits with git, so the working tree
|
|
41331
|
+
* needs no particular checkout. With no `from` (a first release) every public package counts.
|
|
41332
|
+
*
|
|
41333
|
+
* @param cwd - The repository root.
|
|
41334
|
+
* @param from - The commit the release started from; empty for none.
|
|
41335
|
+
* @param to - The release commit.
|
|
41336
|
+
* @throws When `to` (or a non-empty `from`) is not a commit of the repository.
|
|
41337
|
+
*/
|
|
41338
|
+
function releasedPackages(cwd, from, to) {
|
|
41339
|
+
for (const rev of [from, to]) {
|
|
41340
|
+
if (!rev) continue;
|
|
41341
|
+
try {
|
|
41342
|
+
execFileSync("git", [
|
|
41343
|
+
"rev-parse",
|
|
41344
|
+
"--verify",
|
|
41345
|
+
"--quiet",
|
|
41346
|
+
`${rev}^{commit}`
|
|
41347
|
+
], {
|
|
41348
|
+
cwd,
|
|
41349
|
+
stdio: [
|
|
41350
|
+
"ignore",
|
|
41351
|
+
"pipe",
|
|
41352
|
+
"ignore"
|
|
41353
|
+
]
|
|
41354
|
+
});
|
|
41355
|
+
} catch {
|
|
41356
|
+
throw new Error(`\`${rev}\` is not a commit of this repository`);
|
|
41357
|
+
}
|
|
41358
|
+
}
|
|
41359
|
+
const released = [];
|
|
41360
|
+
for (const entry of discoverPublicPackageEntries(cwd)) {
|
|
41361
|
+
if (entry.dir.replace(/^\.\//, "").startsWith("apps/")) continue;
|
|
41362
|
+
const after = versionAt(cwd, to, entry.dir);
|
|
41363
|
+
if (!after.version || after.private) continue;
|
|
41364
|
+
if ((from ? versionAt(cwd, from, entry.dir).version : void 0) === after.version) continue;
|
|
41365
|
+
released.push({
|
|
41366
|
+
name: entry.name,
|
|
41367
|
+
version: after.version,
|
|
41368
|
+
distTag: distTagOf(after.version)
|
|
41369
|
+
});
|
|
41370
|
+
}
|
|
41371
|
+
return released.sort((a, b) => a.name.localeCompare(b.name));
|
|
41372
|
+
}
|
|
41373
|
+
// src/commands/sync-releases/render-release/render-release.ts
|
|
41374
|
+
/** Discord's limit on a thread's name. */
|
|
41375
|
+
const THREAD_NAME_LIMIT = 100;
|
|
41376
|
+
/**
|
|
41377
|
+
* The text of a release's announcement: a message with the headline, the link to the GitHub release (when a tag and
|
|
41378
|
+
* the repository are known) and the marker last, a thread name, and one line per package. Chunking the lines to the
|
|
41379
|
+
* provider's limit is the provider's job.
|
|
41380
|
+
*/
|
|
41381
|
+
function renderRelease(input) {
|
|
41382
|
+
const { id, tag, repo, packages } = input;
|
|
41383
|
+
const count = packages.length;
|
|
41384
|
+
const tags = [...new Set(packages.map((p) => p.distTag))].join(", ");
|
|
41385
|
+
return {
|
|
41386
|
+
message: [
|
|
41387
|
+
`**${tag ?? id}** released: ${count} package${count === 1 ? "" : "s"} on ${tags}`,
|
|
41388
|
+
...tag && repo ? [`https://github.com/${repo}/releases/tag/${tag}`] : [],
|
|
41389
|
+
releaseMarker(id)
|
|
41390
|
+
].join("\n"),
|
|
41391
|
+
threadName: (tag ?? id).slice(0, THREAD_NAME_LIMIT),
|
|
41392
|
+
lines: packages.map((p) => `${p.name} ${p.version}`)
|
|
41393
|
+
};
|
|
41394
|
+
}
|
|
41395
|
+
// src/commands/sync-releases/run-sync-releases/run-sync-releases.ts
|
|
41396
|
+
/**
|
|
41397
|
+
* `holocron sync releases` -- announce a release in the `releases` channel (SPEC-0119 part 2, #2777).
|
|
41398
|
+
*
|
|
41399
|
+
* The public packages whose version differs between `--from` and `--to` are posted as one message, with a thread on it
|
|
41400
|
+
* holding one line per package. The message ends with a marker carrying the release id, so a rerun finds it, starts a
|
|
41401
|
+
* thread only when it has none, and posts only the lines the thread lacks: it never posts a second message. Nothing
|
|
41402
|
+
* published is a success that posts nothing. It writes, so it asks first; `--yes` skips the question and, without a
|
|
41403
|
+
* terminal, a run with neither `--yes` nor `--dry-run` refuses.
|
|
41404
|
+
*/
|
|
41405
|
+
const DEFAULT_CHANNEL = "releases";
|
|
41406
|
+
const canThread = (p) => typeof p.sendWithId === "function" && typeof p.findMessage === "function" && typeof p.startThread === "function" && typeof p.postToThread === "function" && typeof p.readThread === "function";
|
|
41407
|
+
async function runSyncReleases(input) {
|
|
41408
|
+
const print = input.print ?? ((line) => console.log(line));
|
|
41409
|
+
const row = (status, ...parts) => print(statusRow$1(status, ["sync releases", ...parts]));
|
|
41410
|
+
const stop = (status, reason) => {
|
|
41411
|
+
row(status, reason);
|
|
41412
|
+
return {
|
|
41413
|
+
status,
|
|
41414
|
+
reason
|
|
41415
|
+
};
|
|
41416
|
+
};
|
|
41417
|
+
const channel = input.channel ?? DEFAULT_CHANNEL;
|
|
41418
|
+
const dryRun = Boolean(input.context.dryRun);
|
|
41419
|
+
let packages;
|
|
41420
|
+
try {
|
|
41421
|
+
packages = releasedPackages(input.context.repoRoot, input.from || void 0, input.to);
|
|
41422
|
+
} catch (err) {
|
|
41423
|
+
return stop("fail", errorMessage(err));
|
|
41424
|
+
}
|
|
41425
|
+
if (packages.length === 0) {
|
|
41426
|
+
row("ok", "no public package changed version, nothing to announce");
|
|
41427
|
+
return {
|
|
41428
|
+
status: "ok",
|
|
41429
|
+
packages
|
|
41430
|
+
};
|
|
41431
|
+
}
|
|
41432
|
+
const repo = input.context.repo ?? (input.context.org && input.loaded.resolved.name ? `${input.context.org}/${input.loaded.resolved.name}` : void 0);
|
|
41433
|
+
const id = input.tag || `${(input.from || "start").slice(0, 7)}..${input.to.slice(0, 7)}`;
|
|
41434
|
+
const rendered = renderRelease({
|
|
41435
|
+
id,
|
|
41436
|
+
...input.tag ? { tag: input.tag } : {},
|
|
41437
|
+
...repo ? { repo } : {},
|
|
41438
|
+
packages
|
|
41439
|
+
});
|
|
41440
|
+
const marker = releaseMarker(id);
|
|
41441
|
+
if (dryRun) {
|
|
41442
|
+
print(`Would post to #${channel}:`);
|
|
41443
|
+
for (const line of rendered.message.split("\n")) print(` ${line}`);
|
|
41444
|
+
print(`Would start the thread "${rendered.threadName}" with:`);
|
|
41445
|
+
for (const line of rendered.lines) print(` ${line}`);
|
|
41446
|
+
row("skip", `dry run, nothing posted; ${packages.length} package(s)`);
|
|
41447
|
+
return {
|
|
41448
|
+
status: "ok",
|
|
41449
|
+
packages
|
|
41450
|
+
};
|
|
41451
|
+
}
|
|
41452
|
+
/* v8 ignore next -- the real loader is only built outside tests, which always inject one */
|
|
41453
|
+
const loader = input.loader ?? new PluginLoader(input.loaded.resolved, input.context);
|
|
41454
|
+
await loader.load();
|
|
41455
|
+
assertPluginsResolvable(loader, "sync releases");
|
|
41456
|
+
let notifications;
|
|
41457
|
+
try {
|
|
41458
|
+
notifications = pickProvider(notificationProviders(loader), input.provider, canThread, {
|
|
41459
|
+
infinitive: "start a thread on a message",
|
|
41460
|
+
gerund: "threading"
|
|
41461
|
+
});
|
|
41462
|
+
} catch (err) {
|
|
41463
|
+
return stop("fail", `the notifications provider cannot start a thread: ${errorMessage(err)}`);
|
|
41464
|
+
}
|
|
41465
|
+
const posted = {
|
|
41466
|
+
message: false,
|
|
41467
|
+
thread: false,
|
|
41468
|
+
lines: 0
|
|
41469
|
+
};
|
|
41470
|
+
try {
|
|
41471
|
+
let message = await notifications.findMessage(channel, marker);
|
|
41472
|
+
const existing = message?.threadId ? await notifications.readThread(message.threadId) : [];
|
|
41473
|
+
const have = new Set(existing.flatMap((text) => text.split("\n").map((l) => l.trim())));
|
|
41474
|
+
const missing = rendered.lines.filter((l) => !have.has(l));
|
|
41475
|
+
if (message?.threadId && missing.length === 0) {
|
|
41476
|
+
row("ok", id, "already announced, in step");
|
|
41477
|
+
return {
|
|
41478
|
+
status: "ok",
|
|
41479
|
+
packages,
|
|
41480
|
+
posted
|
|
41481
|
+
};
|
|
41482
|
+
}
|
|
41483
|
+
if (!input.yes) {
|
|
41484
|
+
if (!(input.interactive ?? Boolean(process.stdin.isTTY))) throw new NonInteractiveError(`\`sync releases\` posts to #${channel}; pass --yes to run it without asking, or --dry-run to look`);
|
|
41485
|
+
if (!await (input.confirm ?? ((q) => confirm({
|
|
41486
|
+
message: q,
|
|
41487
|
+
default: false
|
|
41488
|
+
})))(`Announce ${id} (${packages.length} package(s)) in #${channel}?`)) {
|
|
41489
|
+
row("skip", "cancelled; nothing was changed");
|
|
41490
|
+
return {
|
|
41491
|
+
status: "cancelled",
|
|
41492
|
+
packages,
|
|
41493
|
+
posted
|
|
41494
|
+
};
|
|
41495
|
+
}
|
|
41496
|
+
}
|
|
41497
|
+
if (!message) {
|
|
41498
|
+
message = await notifications.sendWithId(channel, rendered.message);
|
|
41499
|
+
posted.message = true;
|
|
41500
|
+
row("ok", id, `posted to #${channel}`);
|
|
41501
|
+
}
|
|
41502
|
+
let threadId = message.threadId;
|
|
41503
|
+
if (!threadId) {
|
|
41504
|
+
threadId = (await notifications.startThread(message, rendered.threadName)).id;
|
|
41505
|
+
posted.thread = true;
|
|
41506
|
+
row("ok", id, `started the thread "${rendered.threadName}"`);
|
|
41507
|
+
}
|
|
41508
|
+
await notifications.postToThread(threadId, missing);
|
|
41509
|
+
posted.lines = missing.length;
|
|
41510
|
+
row("ok", id, `${missing.length} package line(s) posted`);
|
|
41511
|
+
return {
|
|
41512
|
+
status: "ok",
|
|
41513
|
+
packages,
|
|
41514
|
+
posted
|
|
41515
|
+
};
|
|
41516
|
+
} catch (err) {
|
|
41517
|
+
if (err instanceof NonInteractiveError) throw err;
|
|
41518
|
+
row("fail", id, describeError(err));
|
|
41519
|
+
return {
|
|
41520
|
+
status: "fail",
|
|
41521
|
+
packages,
|
|
41522
|
+
posted,
|
|
41523
|
+
reason: errorMessage(err)
|
|
41524
|
+
};
|
|
41525
|
+
}
|
|
41526
|
+
}
|
|
41527
|
+
// src/commands/sync-releases/sync-releases.command.ts
|
|
41528
|
+
const syncReleasesCommand = {
|
|
41529
|
+
command: "releases",
|
|
41530
|
+
describe: "Announce a release in the `releases` channel: one message, and a thread with a line per package that changed version",
|
|
41531
|
+
builder: (y) => y.option("from", {
|
|
41532
|
+
type: "string",
|
|
41533
|
+
describe: "The commit the release started from (the release job's `previous`); empty counts every package"
|
|
41534
|
+
}).option("to", {
|
|
41535
|
+
type: "string",
|
|
41536
|
+
default: "HEAD",
|
|
41537
|
+
describe: "The release commit"
|
|
41538
|
+
}).option("tag", {
|
|
41539
|
+
type: "string",
|
|
41540
|
+
describe: "The release's tag; names it and links its GitHub release"
|
|
41541
|
+
}).option("channel", {
|
|
41542
|
+
type: "string",
|
|
41543
|
+
default: "releases",
|
|
41544
|
+
describe: "The channel to post in"
|
|
41545
|
+
}).option("provider", {
|
|
41546
|
+
type: "string",
|
|
41547
|
+
describe: "The `notifications` provider to post through, when several are configured"
|
|
41548
|
+
}).option("yes", {
|
|
41549
|
+
type: "boolean",
|
|
41550
|
+
describe: "Post without asking (a workflow needs it)"
|
|
41551
|
+
}),
|
|
41552
|
+
handler: async (argv) => {
|
|
41553
|
+
const tokens = tokenContext(argv.token);
|
|
41554
|
+
if (!tokens) return;
|
|
41555
|
+
const loaded = await loadConfig(argv.cwd);
|
|
41556
|
+
applyResolvedConfig(argv, loaded.resolved);
|
|
41557
|
+
if ((await runSyncReleases({
|
|
41558
|
+
loaded,
|
|
41559
|
+
context: {
|
|
41560
|
+
repoRoot: argv.cwd,
|
|
41561
|
+
dryRun: argv.dryRun,
|
|
41562
|
+
...tokens,
|
|
41563
|
+
org: resolveOrg(argv, loaded.resolved)
|
|
41564
|
+
},
|
|
41565
|
+
to: argv.to || "HEAD",
|
|
41566
|
+
...argv.from ? { from: argv.from } : {},
|
|
41567
|
+
...argv.tag ? { tag: argv.tag } : {},
|
|
41568
|
+
...argv.channel ? { channel: argv.channel } : {},
|
|
41569
|
+
...argv.provider ? { provider: argv.provider } : {},
|
|
41570
|
+
...argv.yes ? { yes: true } : {}
|
|
41571
|
+
})).status === "fail") process.exitCode = 1;
|
|
41572
|
+
}
|
|
41573
|
+
};
|
|
40919
41574
|
// src/commands/sync-requests/run-sync-requests/run-sync-requests.ts
|
|
40920
41575
|
/**
|
|
40921
41576
|
* `holocron sync requests` — keeps each `tooling` provider's own workspace and the repo's request files in step, both ways.
|
|
@@ -42185,7 +42840,7 @@ async function syncApp(argv) {
|
|
|
42185
42840
|
const syncCommand = {
|
|
42186
42841
|
command: "sync [steps..]",
|
|
42187
42842
|
describe: "Sync state from config to the provider and local files (labels, properties, teams, topics, keywords, description, homepage, readme, workflows, scripts, wiki)",
|
|
42188
|
-
builder: (y) => syncArgs(y).command(syncGithubCommand).command(syncIssuesCommand).command(syncIncidentsCommand).command(syncReadmeCommand).command(ideasSyncCommand).command(syncToolingCommand).command(syncRequestsCommand).command(specsSyncCommand).command(secretsSyncCommand).command(notificationsSyncRolesCommand),
|
|
42843
|
+
builder: (y) => syncArgs(y).command(syncGithubCommand).command(syncIssuesCommand).command(syncIncidentsCommand).command(syncReleasesCommand).command(syncReadmeCommand).command(ideasSyncCommand).command(syncToolingCommand).command(syncRequestsCommand).command(specsSyncCommand).command(secretsSyncCommand).command(notificationsSyncRolesCommand),
|
|
42189
42844
|
handler: async (argv) => {
|
|
42190
42845
|
if (argv.env !== void 0 || argv.steps?.[0] !== void 0) {
|
|
42191
42846
|
if (await syncApp(argv)) return;
|