@plexus-ms/cli 0.116.0 → 0.118.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/dist/plx.js +181 -31
- package/package.json +2 -2
package/dist/plx.js
CHANGED
|
@@ -7969,12 +7969,13 @@ function compareTrains(a, b) {
|
|
|
7969
7969
|
|
|
7970
7970
|
// ../lib/dist/train.js
|
|
7971
7971
|
var PRIMITIVES = "primitives";
|
|
7972
|
+
var COMPENDIUM = "compendium";
|
|
7972
7973
|
var TRAIN_REPOS = [
|
|
7973
7974
|
PRIMITIVES,
|
|
7974
7975
|
"preset-repo-turbo",
|
|
7975
7976
|
"preset-app-nextjs",
|
|
7976
7977
|
"preset-repo-operations",
|
|
7977
|
-
|
|
7978
|
+
COMPENDIUM
|
|
7978
7979
|
];
|
|
7979
7980
|
var PHASES = [[PRIMITIVES], TRAIN_REPOS.filter((r) => r !== PRIMITIVES)];
|
|
7980
7981
|
var TRAIN_PACKAGES = [
|
|
@@ -8556,6 +8557,61 @@ async function resolveHealthUrl(remote, D, dc, ctx) {
|
|
|
8556
8557
|
return url;
|
|
8557
8558
|
}
|
|
8558
8559
|
|
|
8560
|
+
// ../lib/dist/manifest.js
|
|
8561
|
+
var MANIFEST_FILE = "train.json";
|
|
8562
|
+
var MANIFEST_SCHEMA = 1;
|
|
8563
|
+
function buildManifest(catalog, train, date) {
|
|
8564
|
+
const modules = [...catalog.values()].sort((a, b) => a.code.localeCompare(b.code));
|
|
8565
|
+
return { schema: MANIFEST_SCHEMA, train, date, modules };
|
|
8566
|
+
}
|
|
8567
|
+
var renderManifest = (manifest2) => `${JSON.stringify(manifest2, null, 2)}
|
|
8568
|
+
`;
|
|
8569
|
+
var catalogOf = (manifest2) => new Map(manifest2.modules.map((m) => [m.code, m]));
|
|
8570
|
+
var strings = (value) => Array.isArray(value) && value.every((v) => typeof v === "string");
|
|
8571
|
+
function parseManifest(text) {
|
|
8572
|
+
let data;
|
|
8573
|
+
try {
|
|
8574
|
+
data = JSON.parse(text);
|
|
8575
|
+
} catch {
|
|
8576
|
+
throw new Error("the train manifest is not JSON");
|
|
8577
|
+
}
|
|
8578
|
+
if (data === null || typeof data !== "object" || Array.isArray(data))
|
|
8579
|
+
throw new Error("the train manifest is not an object");
|
|
8580
|
+
const { schema, train, date, modules } = data;
|
|
8581
|
+
if (schema !== MANIFEST_SCHEMA)
|
|
8582
|
+
throw new Error(`the train manifest has schema ${JSON.stringify(schema)}; this plx reads ${MANIFEST_SCHEMA}`);
|
|
8583
|
+
if (typeof train !== "string" || !isTrainVersion(train))
|
|
8584
|
+
throw new Error(`the train manifest names '${String(train)}', not a train`);
|
|
8585
|
+
if (typeof date !== "string" || !/^\d{4}-\d{2}-\d{2}$/.test(date))
|
|
8586
|
+
throw new Error(`the train manifest is dated '${String(date)}', not YYYY-MM-DD`);
|
|
8587
|
+
if (!Array.isArray(modules))
|
|
8588
|
+
throw new Error("the train manifest lists no modules");
|
|
8589
|
+
return { schema: MANIFEST_SCHEMA, train, date, modules: modules.map(parseEntry) };
|
|
8590
|
+
}
|
|
8591
|
+
function parseEntry(entry) {
|
|
8592
|
+
const m = entry ?? {};
|
|
8593
|
+
const where = `the train manifest's module ${typeof m.code === "string" ? m.code : JSON.stringify(entry)}`;
|
|
8594
|
+
if (typeof m.code !== "string" || m.code === "")
|
|
8595
|
+
throw new Error(`${where} has no code`);
|
|
8596
|
+
if (m.kind !== "contract" && m.kind !== "approach")
|
|
8597
|
+
throw new Error(`${where} is neither contract nor approach`);
|
|
8598
|
+
if (typeof m.maturity !== "string" || typeof m.binds !== "string")
|
|
8599
|
+
throw new Error(`${where} lacks maturity or binds`);
|
|
8600
|
+
if (!strings(m.depends) || !strings(m.consumes))
|
|
8601
|
+
throw new Error(`${where} lacks depends or consumes`);
|
|
8602
|
+
if (m.changed !== void 0 && typeof m.changed !== "string")
|
|
8603
|
+
throw new Error(`${where} has a changed that is no train`);
|
|
8604
|
+
return {
|
|
8605
|
+
code: m.code,
|
|
8606
|
+
kind: m.kind,
|
|
8607
|
+
maturity: m.maturity,
|
|
8608
|
+
binds: m.binds,
|
|
8609
|
+
changed: m.changed,
|
|
8610
|
+
depends: m.depends,
|
|
8611
|
+
consumes: m.consumes
|
|
8612
|
+
};
|
|
8613
|
+
}
|
|
8614
|
+
|
|
8559
8615
|
// ../lib/dist/model.js
|
|
8560
8616
|
function kindOf(declaration) {
|
|
8561
8617
|
const has = (code) => declaration.modules.includes(code);
|
|
@@ -8581,9 +8637,16 @@ var DEFAULT_MAX_AGE = 30;
|
|
|
8581
8637
|
var MAX_AGE_ANSWER = "update_max_age";
|
|
8582
8638
|
var DAY = 24 * 60 * 60 * 1e3;
|
|
8583
8639
|
var days = (n) => `${n} day${n === 1 ? "" : "s"}`;
|
|
8584
|
-
function needOf({ recorded, releases, asked, maxAge, now }) {
|
|
8640
|
+
function needOf({ recorded, releases, asked, stale = [], maxAge, now }) {
|
|
8585
8641
|
if (asked)
|
|
8586
8642
|
return { take: true, trigger: "asked", why: `asked for (${asked})` };
|
|
8643
|
+
const [first, ...more] = stale;
|
|
8644
|
+
if (first)
|
|
8645
|
+
return {
|
|
8646
|
+
take: true,
|
|
8647
|
+
trigger: "module",
|
|
8648
|
+
why: `${first.code} changed in ${first.changed}, declared at ${first.declared} in ${first.where}${more.length > 0 ? `, and ${more.length} more` : ""}`
|
|
8649
|
+
};
|
|
8587
8650
|
const odd = recorded.findIndex((r) => !r || !isTrainVersion(r));
|
|
8588
8651
|
if (recorded.length === 0 || odd >= 0)
|
|
8589
8652
|
return {
|
|
@@ -8591,13 +8654,13 @@ function needOf({ recorded, releases, asked, maxAge, now }) {
|
|
|
8591
8654
|
trigger: "backstop",
|
|
8592
8655
|
why: `a site records ${recorded[odd] ? `'${recorded[odd]}'` : "no version"}, not a train`
|
|
8593
8656
|
};
|
|
8594
|
-
const
|
|
8595
|
-
const oldest =
|
|
8657
|
+
const trains2 = recorded;
|
|
8658
|
+
const oldest = trains2.reduce((a, b) => compareTrains(a, b) <= 0 ? a : b);
|
|
8596
8659
|
const untaken = releases.filter((r) => isTrainVersion(r.train) && compareTrains(r.train, oldest) > 0).sort((a, b) => Date.parse(a.published) - Date.parse(b.published));
|
|
8597
|
-
const
|
|
8598
|
-
if (!
|
|
8660
|
+
const oldestUntaken = untaken[0];
|
|
8661
|
+
if (!oldestUntaken)
|
|
8599
8662
|
return { take: false, why: `no train newer than ${oldest}` };
|
|
8600
|
-
const age = Math.max(0, Math.floor((now.getTime() - Date.parse(
|
|
8663
|
+
const age = Math.max(0, Math.floor((now.getTime() - Date.parse(oldestUntaken.published)) / DAY));
|
|
8601
8664
|
const count = `${untaken.length} newer train${untaken.length === 1 ? "" : "s"}`;
|
|
8602
8665
|
if (maxAge === 0)
|
|
8603
8666
|
return { take: true, trigger: "backstop", why: `a backstop age of zero takes every train (${count})` };
|
|
@@ -8605,13 +8668,26 @@ function needOf({ recorded, releases, asked, maxAge, now }) {
|
|
|
8605
8668
|
return {
|
|
8606
8669
|
take: true,
|
|
8607
8670
|
trigger: "backstop",
|
|
8608
|
-
why: `${
|
|
8671
|
+
why: `${oldestUntaken.train}, the oldest train not taken, was cut ${days(age)} ago (backstop: ${days(maxAge)}; ${count})`
|
|
8609
8672
|
};
|
|
8610
8673
|
return {
|
|
8611
8674
|
take: false,
|
|
8612
|
-
why: `${count}, the oldest (${
|
|
8675
|
+
why: `${count}, the oldest (${oldestUntaken.train}) cut ${days(age)} ago; the backstop is ${days(maxAge)}`
|
|
8613
8676
|
};
|
|
8614
8677
|
}
|
|
8678
|
+
function staleModules(markers, catalog) {
|
|
8679
|
+
const stale = [];
|
|
8680
|
+
for (const { where, plexus, modules } of markers) {
|
|
8681
|
+
if (!isTrainVersion(plexus))
|
|
8682
|
+
continue;
|
|
8683
|
+
for (const code of modules) {
|
|
8684
|
+
const changed = catalog.get(code)?.changed;
|
|
8685
|
+
if (changed && isTrainVersion(changed) && compareTrains(changed, plexus) > 0)
|
|
8686
|
+
stale.push({ code, changed, where, declared: plexus });
|
|
8687
|
+
}
|
|
8688
|
+
}
|
|
8689
|
+
return stale;
|
|
8690
|
+
}
|
|
8615
8691
|
function maxAgeOf(answers) {
|
|
8616
8692
|
const value = answers[MAX_AGE_ANSWER];
|
|
8617
8693
|
if (value === void 0 || value === null || value === "")
|
|
@@ -8765,6 +8841,7 @@ function mergeSummary(into, from) {
|
|
|
8765
8841
|
into.skipped.push(...from.skipped);
|
|
8766
8842
|
into.resting.push(...from.resting);
|
|
8767
8843
|
into.pulls.push(...from.pulls);
|
|
8844
|
+
into.mergeable.push(...from.mergeable);
|
|
8768
8845
|
}
|
|
8769
8846
|
var emptySummary = (train, preview) => ({
|
|
8770
8847
|
train,
|
|
@@ -8774,8 +8851,11 @@ var emptySummary = (train, preview) => ({
|
|
|
8774
8851
|
failed: [],
|
|
8775
8852
|
skipped: [],
|
|
8776
8853
|
resting: [],
|
|
8777
|
-
pulls: []
|
|
8854
|
+
pulls: [],
|
|
8855
|
+
mergeable: []
|
|
8778
8856
|
});
|
|
8857
|
+
var CLEAN_BODY = "Merged clean at every site.";
|
|
8858
|
+
var ofConsumer = (list2, consumer) => list2.filter((p) => p === consumer.rel || p.startsWith(`${consumer.rel}/`));
|
|
8779
8859
|
var trainBranch = (train) => `plexus/${train}`;
|
|
8780
8860
|
var copierIn = (dir, args) => [
|
|
8781
8861
|
"env",
|
|
@@ -8942,17 +9022,23 @@ async function openPull(ctx, consumer, dir, take, summary) {
|
|
|
8942
9022
|
summary.failed.push(consumer.rel);
|
|
8943
9023
|
return;
|
|
8944
9024
|
}
|
|
9025
|
+
const conflicted = ofConsumer(summary.conflicted, consumer);
|
|
9026
|
+
const failed = ofConsumer(summary.failed, consumer);
|
|
9027
|
+
const clean = conflicted.length === 0 && failed.length === 0;
|
|
8945
9028
|
const existing = await openPullUrl(ctx, consumer, dir, train);
|
|
8946
9029
|
if (existing) {
|
|
8947
9030
|
ctx.say(`\u2022 ${consumer.rel}: pull request updated: ${existing}`);
|
|
8948
9031
|
summary.pulls.push(existing);
|
|
9032
|
+
if (clean)
|
|
9033
|
+
summary.mergeable.push(existing);
|
|
8949
9034
|
return;
|
|
8950
9035
|
}
|
|
8951
9036
|
const sites = consumer.sites.map((s) => s.rel);
|
|
8952
|
-
const conflicted = sites.filter((s) => summary.conflicted.includes(s));
|
|
8953
9037
|
const body2 = [
|
|
8954
9038
|
`Train ${train} (\xA7 1.5 PLX): \`copier update\` at ${sites.join(", ")}, the marker, the lockfile where manifests moved, and the workflow refs.`,
|
|
8955
|
-
conflicted.length > 0 ? `Conflicts to resolve, committed with their markers: ${conflicted.join(", ")}.` :
|
|
9039
|
+
...conflicted.length > 0 ? [`Conflicts to resolve, committed with their markers: ${conflicted.join(", ")}.`] : [],
|
|
9040
|
+
...failed.length > 0 ? [`Failed, and left as it was: ${failed.join(", ")}.`] : [],
|
|
9041
|
+
...clean ? [CLEAN_BODY] : [],
|
|
8956
9042
|
`Opened by ${take.opener}${take.why ? `: ${take.why}` : ""}.`
|
|
8957
9043
|
].join("\n\n");
|
|
8958
9044
|
try {
|
|
@@ -8978,6 +9064,8 @@ async function openPull(ctx, consumer, dir, take, summary) {
|
|
|
8978
9064
|
const url = await openPullUrl(ctx, consumer, dir, train);
|
|
8979
9065
|
ctx.say(`\u2022 ${consumer.rel}: pull request opened${url ? `: ${url}` : ""}`);
|
|
8980
9066
|
summary.pulls.push(url || `${consumer.rel} ${branch}`);
|
|
9067
|
+
if (url && clean)
|
|
9068
|
+
summary.mergeable.push(url);
|
|
8981
9069
|
}
|
|
8982
9070
|
var detail = (error) => {
|
|
8983
9071
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -9046,8 +9134,8 @@ async function update(ctx, options) {
|
|
|
9046
9134
|
if (!root)
|
|
9047
9135
|
throw new Error(`${name}: its root is not a site of a repo preset`);
|
|
9048
9136
|
await preflightForge(ctx);
|
|
9049
|
-
const releases = options.train === void 0 ? await
|
|
9050
|
-
const train = options.train ?? newestOf(releases
|
|
9137
|
+
const releases = options.train === void 0 ? await trains(ctx) : [];
|
|
9138
|
+
const train = options.train ?? newestOf(releases);
|
|
9051
9139
|
const summary = emptySummary(train, ctx.dryRun);
|
|
9052
9140
|
await ctx.read("git", ["fetch", "--quiet", "origin", consumer.branch], { cwd: repo }).catch(() => "");
|
|
9053
9141
|
const answers = await Promise.all(consumer.sites.map(async (s) => {
|
|
@@ -9068,14 +9156,20 @@ async function update(ctx, options) {
|
|
|
9068
9156
|
if (onOrigin) {
|
|
9069
9157
|
const url = await openPullUrl(ctx, consumer, repo, train);
|
|
9070
9158
|
ctx.say(`\u2022 ${name}: ${branch} is already on origin${url ? ` (${url})` : ""} \u2014 nothing to do; delete the branch to pull the train again`);
|
|
9071
|
-
if (url)
|
|
9159
|
+
if (url) {
|
|
9072
9160
|
summary.pulls.push(url);
|
|
9161
|
+
const body2 = await ctx.read("gh", ["pr", "view", url, "--json", "body", "--jq", ".body"], { cwd: repo }).catch(() => "");
|
|
9162
|
+
if (body2.includes(CLEAN_BODY))
|
|
9163
|
+
summary.mergeable.push(url);
|
|
9164
|
+
}
|
|
9073
9165
|
return summary;
|
|
9074
9166
|
}
|
|
9167
|
+
const asked = options.train !== void 0 ? `--train ${train}` : options.now ? "--now" : void 0;
|
|
9075
9168
|
const need = needOf({
|
|
9076
9169
|
recorded,
|
|
9077
9170
|
releases,
|
|
9078
|
-
asked
|
|
9171
|
+
asked,
|
|
9172
|
+
stale: asked ? [] : await staleIn(ctx, consumer, repo, train),
|
|
9079
9173
|
maxAge: options.maxAge ?? maxAgeOf(answers[consumer.sites.indexOf(root)]?.answers ?? {}),
|
|
9080
9174
|
now: options.today === void 0 ? /* @__PURE__ */ new Date() : new Date(options.today)
|
|
9081
9175
|
});
|
|
@@ -9105,16 +9199,37 @@ async function update(ctx, options) {
|
|
|
9105
9199
|
}
|
|
9106
9200
|
return summary;
|
|
9107
9201
|
}
|
|
9108
|
-
async function
|
|
9109
|
-
const
|
|
9202
|
+
async function staleIn(ctx, consumer, repo, train) {
|
|
9203
|
+
const text = await ctx.read("gh", ["release", "download", train, "-R", TRAINS, "-p", MANIFEST_FILE, "-O", "-"]).catch(() => void 0);
|
|
9204
|
+
if (text === void 0) {
|
|
9205
|
+
ctx.say(` ${consumer.rel}: train ${train} carries no ${MANIFEST_FILE} that can be read; its modules are not checked`);
|
|
9206
|
+
return [];
|
|
9207
|
+
}
|
|
9208
|
+
const catalog = catalogOf(parseManifest(text));
|
|
9209
|
+
const markers = [];
|
|
9210
|
+
for (const site of consumer.sites) {
|
|
9211
|
+
const file = join9(relative4(consumer.path, site.path), MARKER_FILE);
|
|
9212
|
+
const marker = await ctx.read("git", ["show", `origin/${consumer.branch}:${file}`], { cwd: repo }).catch(() => void 0) ?? await ctx.readFile(join9(site.path, MARKER_FILE)).catch(() => void 0);
|
|
9213
|
+
if (marker === void 0)
|
|
9214
|
+
continue;
|
|
9215
|
+
try {
|
|
9216
|
+
const { plexus, modules } = parseMarker(marker);
|
|
9217
|
+
markers.push({ where: join9(site.rel, MARKER_FILE), plexus, modules });
|
|
9218
|
+
} catch {
|
|
9219
|
+
}
|
|
9220
|
+
}
|
|
9221
|
+
return staleModules(markers, catalog);
|
|
9222
|
+
}
|
|
9223
|
+
var TRAINS = `plexus-ms/${COMPENDIUM}`;
|
|
9224
|
+
async function trains(ctx) {
|
|
9110
9225
|
const jq = '.[] | select(.draft | not) | "\\(.tag_name) \\(.published_at)"';
|
|
9111
|
-
const lines = await ctx.read("gh", ["api", `repos/${
|
|
9226
|
+
const lines = await ctx.read("gh", ["api", `repos/${TRAINS}/releases`, "--paginate", "--jq", jq]).catch(() => "");
|
|
9112
9227
|
return lines.split("\n").map((l) => l.trim().split(/\s+/)).filter((p) => p.length === 2 && isTrainVersion(p[0] ?? "")).map(([train, published]) => ({ train, published }));
|
|
9113
9228
|
}
|
|
9114
|
-
function newestOf(releases
|
|
9229
|
+
function newestOf(releases) {
|
|
9115
9230
|
const newest = releases.map((r) => r.train).reduce((a, b) => a && compareTrains(a, b) >= 0 ? a : b, "");
|
|
9116
9231
|
if (!newest)
|
|
9117
|
-
throw new Error(`no release of ${
|
|
9232
|
+
throw new Error(`no release of ${TRAINS} found \u2014 pass the train explicitly (--train <version>)`);
|
|
9118
9233
|
return newest;
|
|
9119
9234
|
}
|
|
9120
9235
|
|
|
@@ -9366,23 +9481,27 @@ async function releasePhase(ctx, train, repos2, next, today2) {
|
|
|
9366
9481
|
ctx.say(`\u2192 phase: ${repos2.map((r) => r.name).join(", ")}`);
|
|
9367
9482
|
await ctx.apply(await planBookkeeping(ctx, train, repos2, next, today2));
|
|
9368
9483
|
for (const repo of repos2)
|
|
9369
|
-
await tagAndRelease(ctx, repo, next);
|
|
9484
|
+
await tagAndRelease(ctx, repo, next, today2);
|
|
9370
9485
|
}
|
|
9371
|
-
async function tagAndRelease(ctx, repo, next) {
|
|
9486
|
+
async function tagAndRelease(ctx, repo, next, today2) {
|
|
9372
9487
|
const tagged = await ctx.read("git", ["rev-parse", "-q", "--verify", `refs/tags/${next}`], { cwd: repo.path }).then(() => true).catch(() => false);
|
|
9373
9488
|
if (tagged)
|
|
9374
9489
|
ctx.say(`\u2022 ${repo.name}: already tagged ${next}`);
|
|
9375
9490
|
else
|
|
9376
9491
|
await ctx.apply([run("git", ["tag", "-a", next, "-m", `train ${next}`], { cwd: repo.path })]);
|
|
9377
9492
|
await ctx.apply([run("git", ["push", "origin", "main", next], { cwd: repo.path })]);
|
|
9378
|
-
const
|
|
9379
|
-
if (
|
|
9380
|
-
|
|
9381
|
-
|
|
9493
|
+
const create = ["release", "create", next, "--verify-tag", "--generate-notes", "--title", next];
|
|
9494
|
+
if (repo.name === COMPENDIUM) {
|
|
9495
|
+
if (!await releaseWithManifest(ctx, repo, next, today2, create))
|
|
9496
|
+
return;
|
|
9497
|
+
} else {
|
|
9498
|
+
const released = await ctx.read("gh", ["release", "view", next], { cwd: repo.path }).then(() => true).catch(() => false);
|
|
9499
|
+
if (released) {
|
|
9500
|
+
ctx.say(`\u2022 ${repo.name}: release ${next} exists`);
|
|
9501
|
+
return;
|
|
9502
|
+
}
|
|
9503
|
+
await ctx.apply([run("gh", create, { cwd: repo.path })]);
|
|
9382
9504
|
}
|
|
9383
|
-
await ctx.apply([
|
|
9384
|
-
run("gh", ["release", "create", next, "--verify-tag", "--generate-notes", "--title", next], { cwd: repo.path })
|
|
9385
|
-
]);
|
|
9386
9505
|
if (ctx.dryRun)
|
|
9387
9506
|
return;
|
|
9388
9507
|
const immutable = (await ctx.read("gh", ["api", `repos/{owner}/{repo}/releases/tags/${next}`, "--jq", ".immutable"], {
|
|
@@ -9391,6 +9510,32 @@ async function tagAndRelease(ctx, repo, next) {
|
|
|
9391
9510
|
if (immutable !== "true")
|
|
9392
9511
|
throw new Error(mutableRelease(`${repo.name}: release ${next} was created mutable, and its tag can still move`));
|
|
9393
9512
|
}
|
|
9513
|
+
async function releaseWithManifest(ctx, repo, next, today2, create) {
|
|
9514
|
+
const state = (await ctx.read("gh", ["release", "view", next, "--json", "isDraft", "--jq", ".isDraft"], { cwd: repo.path }).catch(() => "")).trim();
|
|
9515
|
+
if (state === "false") {
|
|
9516
|
+
ctx.say(`\u2022 ${repo.name}: release ${next} exists`);
|
|
9517
|
+
return false;
|
|
9518
|
+
}
|
|
9519
|
+
if (state === "true")
|
|
9520
|
+
ctx.say(`\u2022 ${repo.name}: release ${next} is still a draft \u2014 finishing it`);
|
|
9521
|
+
else
|
|
9522
|
+
await ctx.apply([run("gh", [...create, "--draft"], { cwd: repo.path })]);
|
|
9523
|
+
const scratch = (await ctx.stage(run("mktemp", ["-d"])))?.trim() ?? "";
|
|
9524
|
+
const file = join11(scratch, MANIFEST_FILE);
|
|
9525
|
+
try {
|
|
9526
|
+
const manifest2 = buildManifest(await readCatalog(ctx, repo.path), next, today2);
|
|
9527
|
+
ctx.say(` ${repo.name}: ${MANIFEST_FILE}: train ${next}, ${manifest2.modules.length} modules`);
|
|
9528
|
+
await ctx.stage(write(file, renderManifest(manifest2)));
|
|
9529
|
+
await ctx.apply([
|
|
9530
|
+
run("gh", ["release", "upload", next, file, "--clobber"], { cwd: repo.path }),
|
|
9531
|
+
run("gh", ["release", "edit", next, "--draft=false"], { cwd: repo.path })
|
|
9532
|
+
]);
|
|
9533
|
+
} finally {
|
|
9534
|
+
if (scratch)
|
|
9535
|
+
await ctx.stage(run("rm", ["-rf", scratch]));
|
|
9536
|
+
}
|
|
9537
|
+
return true;
|
|
9538
|
+
}
|
|
9394
9539
|
async function awaitPublished(ctx, next, wait) {
|
|
9395
9540
|
const names = TRAIN_PACKAGES.map((p) => p.name);
|
|
9396
9541
|
const list2 = names.map((n) => `${n}@${next}`).join(", ");
|
|
@@ -14530,6 +14675,9 @@ function register6(program2) {
|
|
|
14530
14675
|
if (!isClean(result)) process.exitCode = 1;
|
|
14531
14676
|
});
|
|
14532
14677
|
}
|
|
14678
|
+
function mergeLine(urls) {
|
|
14679
|
+
return urls.map((url) => /^https?:\/\/[^/]+\/([^/]+\/[^/]+)\/pull\/(\d+)$/.exec(url)).filter((m) => m !== null).map((m) => `gh pr merge -md -R ${m[1]} ${m[2]}`).join(" && ");
|
|
14680
|
+
}
|
|
14533
14681
|
function renderSummary(s, realCommand, verb = "propagate") {
|
|
14534
14682
|
const lines = ["\u2500\u2500 summary \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"];
|
|
14535
14683
|
for (const p of s.clean) lines.push(` \u2713 clean: ${p}`);
|
|
@@ -14538,8 +14686,10 @@ function renderSummary(s, realCommand, verb = "propagate") {
|
|
|
14538
14686
|
for (const { path: path3, reason } of s.skipped) lines.push(` \u26A0 skipped: ${path3} (${reason})`);
|
|
14539
14687
|
for (const { path: path3, reason } of s.resting) lines.push(` \u2022 resting: ${path3} (${reason})`);
|
|
14540
14688
|
for (const url of s.pulls) lines.push(` \u2192 pull: ${url}`);
|
|
14689
|
+
const merge = s.preview ? "" : mergeLine(s.mergeable);
|
|
14690
|
+
if (merge) lines.push(" the clean ones, to merge once their checks pass:", ` ${merge}`);
|
|
14541
14691
|
const clean = isClean(s);
|
|
14542
|
-
const idle = clean && s.clean.length === 0
|
|
14692
|
+
const idle = clean && s.clean.length === 0;
|
|
14543
14693
|
if (s.preview && !idle) {
|
|
14544
14694
|
lines.push(" (preview only \u2014 nothing was changed)");
|
|
14545
14695
|
if (clean) lines.push(`\u2713 dry run clean \u2014 run it for real: ${realCommand}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plexus-ms/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.118.0",
|
|
4
4
|
"description": "plx, the Plexus command-line tool: a single-script adapter over @plexus-ms/lib",
|
|
5
5
|
"license": "GPL-3.0-or-later",
|
|
6
6
|
"type": "module",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@inquirer/prompts": "^8.7.5",
|
|
27
|
-
"@plexus-ms/lib": "0.
|
|
27
|
+
"@plexus-ms/lib": "0.118.0",
|
|
28
28
|
"commander": "^15.0.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|