@mutmutco/cli 3.105.3 → 3.105.4

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/main.cjs +23 -2
  2. package/package.json +1 -1
package/dist/main.cjs CHANGED
@@ -20425,6 +20425,14 @@ async function hotfixBaseTagForRelease(deps, tag) {
20425
20425
  const current = normalizeHotfixVersion(tag).tag;
20426
20426
  return tags.find((t) => compareHotfixVersions(t, current) < 0) ?? tags.find((t) => t !== current) ?? "origin/main^";
20427
20427
  }
20428
+ async function hotfixReleaseExists(deps, ctx, tag) {
20429
+ try {
20430
+ await deps.run("gh", ["release", "view", tag, "--repo", ctx.repo, "--json", "tagName"]);
20431
+ return true;
20432
+ } catch {
20433
+ return false;
20434
+ }
20435
+ }
20428
20436
  async function runHotfixStart(deps, options) {
20429
20437
  const ctx = await buildTrainApplyContext(deps);
20430
20438
  const deployModel = await resolveHotfixDeployModel(deps, ctx);
@@ -20437,7 +20445,11 @@ async function runHotfixStart(deps, options) {
20437
20445
  const branch = hotfixBranch(tag);
20438
20446
  const notes = [];
20439
20447
  const existingPr = await findHotfixPr(deps, ctx, tag);
20440
- if (existingPr) {
20448
+ const existingState = (existingPr?.state ?? "").toUpperCase();
20449
+ const releaseExists = existingState === "MERGED" ? await hotfixReleaseExists(deps, ctx, tag) : false;
20450
+ const reusable = existingState === "OPEN" || existingState === "MERGED" && releaseExists;
20451
+ if (existingPr && reusable) {
20452
+ const next = existingState === "MERGED" ? `next: mmi-cli hotfix release ${tag}` : `next: merge it, then mmi-cli hotfix release ${tag}`;
20441
20453
  return {
20442
20454
  ...ctx,
20443
20455
  command: "hotfix-start",
@@ -20447,9 +20459,18 @@ async function runHotfixStart(deps, options) {
20447
20459
  source: options.from,
20448
20460
  prUrl: existingPr.url,
20449
20461
  reused: true,
20450
- notes: [`hotfix PR for ${tag} already exists (#${existingPr.number}, ${existingPr.state}) \u2014 reused; next: merge it, then mmi-cli hotfix release ${tag}`]
20462
+ notes: [`hotfix PR for ${tag} already exists (#${existingPr.number}, ${existingPr.state}) \u2014 reused; ${next}`]
20451
20463
  };
20452
20464
  }
20465
+ if (existingPr) {
20466
+ const reason = existingState === "MERGED" && !releaseExists ? `MERGED with no GitHub Release for ${tag} \u2014 recreating ${branch} from origin/main (#4381/#4383)` : `${existingPr.state} \u2014 recreating ${branch} from origin/main (#4369)`;
20467
+ notes.push(`prior hotfix PR #${existingPr.number} is ${reason}`);
20468
+ const staleRemote = clean3(await deps.run("git", ["ls-remote", "origin", `refs/heads/${branch}`]));
20469
+ if (staleRemote) {
20470
+ await deps.run("git", ["push", "origin", "--delete", branch]);
20471
+ notes.push(`deleted stale origin/${branch} left by the incomplete train`);
20472
+ }
20473
+ }
20453
20474
  const { sha, label } = await resolveHotfixSource(deps, ctx, options.from);
20454
20475
  if (deployModel === "hub-serverless") {
20455
20476
  await deps.run("node", ["scripts/release-distribution.mjs", "verify-deps"]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mutmutco/cli",
3
- "version": "3.105.3",
3
+ "version": "3.105.4",
4
4
  "description": "MMI Future CLI — the org dev toolbox and shared cross-IDE engine for every registry-declared MMI coding surface.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",