@plexus-ms/cli 0.117.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.
Files changed (2) hide show
  1. package/dist/plx.js +26 -5
  2. package/package.json +2 -2
package/dist/plx.js CHANGED
@@ -8841,6 +8841,7 @@ function mergeSummary(into, from) {
8841
8841
  into.skipped.push(...from.skipped);
8842
8842
  into.resting.push(...from.resting);
8843
8843
  into.pulls.push(...from.pulls);
8844
+ into.mergeable.push(...from.mergeable);
8844
8845
  }
8845
8846
  var emptySummary = (train, preview) => ({
8846
8847
  train,
@@ -8850,8 +8851,11 @@ var emptySummary = (train, preview) => ({
8850
8851
  failed: [],
8851
8852
  skipped: [],
8852
8853
  resting: [],
8853
- pulls: []
8854
+ pulls: [],
8855
+ mergeable: []
8854
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}/`));
8855
8859
  var trainBranch = (train) => `plexus/${train}`;
8856
8860
  var copierIn = (dir, args) => [
8857
8861
  "env",
@@ -9018,17 +9022,23 @@ async function openPull(ctx, consumer, dir, take, summary) {
9018
9022
  summary.failed.push(consumer.rel);
9019
9023
  return;
9020
9024
  }
9025
+ const conflicted = ofConsumer(summary.conflicted, consumer);
9026
+ const failed = ofConsumer(summary.failed, consumer);
9027
+ const clean = conflicted.length === 0 && failed.length === 0;
9021
9028
  const existing = await openPullUrl(ctx, consumer, dir, train);
9022
9029
  if (existing) {
9023
9030
  ctx.say(`\u2022 ${consumer.rel}: pull request updated: ${existing}`);
9024
9031
  summary.pulls.push(existing);
9032
+ if (clean)
9033
+ summary.mergeable.push(existing);
9025
9034
  return;
9026
9035
  }
9027
9036
  const sites = consumer.sites.map((s) => s.rel);
9028
- const conflicted = sites.filter((s) => summary.conflicted.includes(s));
9029
9037
  const body2 = [
9030
9038
  `Train ${train} (\xA7 1.5 PLX): \`copier update\` at ${sites.join(", ")}, the marker, the lockfile where manifests moved, and the workflow refs.`,
9031
- conflicted.length > 0 ? `Conflicts to resolve, committed with their markers: ${conflicted.join(", ")}.` : "Merged clean at every site.",
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] : [],
9032
9042
  `Opened by ${take.opener}${take.why ? `: ${take.why}` : ""}.`
9033
9043
  ].join("\n\n");
9034
9044
  try {
@@ -9054,6 +9064,8 @@ async function openPull(ctx, consumer, dir, take, summary) {
9054
9064
  const url = await openPullUrl(ctx, consumer, dir, train);
9055
9065
  ctx.say(`\u2022 ${consumer.rel}: pull request opened${url ? `: ${url}` : ""}`);
9056
9066
  summary.pulls.push(url || `${consumer.rel} ${branch}`);
9067
+ if (url && clean)
9068
+ summary.mergeable.push(url);
9057
9069
  }
9058
9070
  var detail = (error) => {
9059
9071
  const message = error instanceof Error ? error.message : String(error);
@@ -9144,8 +9156,12 @@ async function update(ctx, options) {
9144
9156
  if (onOrigin) {
9145
9157
  const url = await openPullUrl(ctx, consumer, repo, train);
9146
9158
  ctx.say(`\u2022 ${name}: ${branch} is already on origin${url ? ` (${url})` : ""} \u2014 nothing to do; delete the branch to pull the train again`);
9147
- if (url)
9159
+ if (url) {
9148
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
+ }
9149
9165
  return summary;
9150
9166
  }
9151
9167
  const asked = options.train !== void 0 ? `--train ${train}` : options.now ? "--now" : void 0;
@@ -14659,6 +14675,9 @@ function register6(program2) {
14659
14675
  if (!isClean(result)) process.exitCode = 1;
14660
14676
  });
14661
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
+ }
14662
14681
  function renderSummary(s, realCommand, verb = "propagate") {
14663
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"];
14664
14683
  for (const p of s.clean) lines.push(` \u2713 clean: ${p}`);
@@ -14667,8 +14686,10 @@ function renderSummary(s, realCommand, verb = "propagate") {
14667
14686
  for (const { path: path3, reason } of s.skipped) lines.push(` \u26A0 skipped: ${path3} (${reason})`);
14668
14687
  for (const { path: path3, reason } of s.resting) lines.push(` \u2022 resting: ${path3} (${reason})`);
14669
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}`);
14670
14691
  const clean = isClean(s);
14671
- const idle = clean && s.clean.length === 0 && s.pulls.length === 0;
14692
+ const idle = clean && s.clean.length === 0;
14672
14693
  if (s.preview && !idle) {
14673
14694
  lines.push(" (preview only \u2014 nothing was changed)");
14674
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.117.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.117.0",
27
+ "@plexus-ms/lib": "0.118.0",
28
28
  "commander": "^15.0.0"
29
29
  },
30
30
  "devDependencies": {