@mutmutco/cli 4.1.6 → 4.1.7

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 +63 -33
  2. package/package.json +1 -1
package/dist/main.cjs CHANGED
@@ -13152,10 +13152,10 @@ var rollout_plan_default = {
13152
13152
  note: "The v4.0.0 stamp happens at cut time (D6e #4463); until then the candidate is the origin/development head artifacts (built cli/dist + npm pack), identity proven by dist content hash (D6a)."
13153
13153
  },
13154
13154
  baseline: {
13155
- version: "4.1.6",
13156
- tag: "v4.1.6",
13157
- commit: "45c61a1dd6f6",
13158
- npm: "@mutmutco/cli@4.1.6"
13155
+ version: "4.1.7",
13156
+ tag: "v4.1.7",
13157
+ commit: "3811b46c48ba",
13158
+ npm: "@mutmutco/cli@4.1.7"
13159
13159
  },
13160
13160
  exitCriterion: "fleet-n-of-n",
13161
13161
  hubOnlyShortcut: "forbidden",
@@ -13172,14 +13172,14 @@ var rollout_plan_default = {
13172
13172
  repo: "mutmutco/mmi-hub",
13173
13173
  role: "canary",
13174
13174
  schedule: "train",
13175
- v3Target: "v4.1.6"
13175
+ v3Target: "v4.1.7"
13176
13176
  }
13177
13177
  ],
13178
13178
  rollbackTrigger: "Any red inside the post-contract soak window: `devops train gate` FAIL attributable to the v4 doors, Hub endpoint health probe failure, a pre-v4 client admitted instead of receiving actionable HTTP 426, or npm consumer install/doctor failure on the v4-only dist.",
13179
13179
  rollback: {
13180
13180
  independent: true,
13181
- mechanism: "npm dist-tag latest -> 4.1.6 and redeploy the Hub Lambda from tag v4.1.6 (45c61a1dd6f6); installed clients repair via `mmi-cli doctor`. No other cohort is touched.",
13182
- v3Target: "v4.1.6 (@mutmutco/cli@4.1.6, tag commit 45c61a1dd6f6 \u2014 last known-good release carrying the repo-index v4-only contract)"
13181
+ mechanism: "npm dist-tag latest -> 4.1.7 and redeploy the Hub Lambda from tag v4.1.7 (3811b46c48ba); installed clients repair via `mmi-cli doctor`. No other cohort is touched.",
13182
+ v3Target: "v4.1.7 (@mutmutco/cli@4.1.7, tag commit 3811b46c48ba \u2014 last known-good release carrying the repo-index v4-only contract)"
13183
13183
  }
13184
13184
  },
13185
13185
  {
@@ -15941,6 +15941,40 @@ var HUB_REPO3 = "mutmutco/MMI-Hub";
15941
15941
  function isHubControlRepo(repo) {
15942
15942
  return repo.toLowerCase() === HUB_REPO3.toLowerCase();
15943
15943
  }
15944
+ function supportsReleaseAbort(repo, meta, branchHints) {
15945
+ if (isHubControlRepo(repo)) return true;
15946
+ if (meta.deployModel !== "registry-publish") return false;
15947
+ return resolveReleaseTrack(meta, branchHints, repo) === "direct";
15948
+ }
15949
+ function resolveReleaseAbortNpmPackage(meta, repo) {
15950
+ if (isHubControlRepo(repo)) return "@mutmutco/cli";
15951
+ const publishDir = typeof meta.publishDir === "string" && meta.publishDir.trim() ? meta.publishDir.trim() : ".";
15952
+ try {
15953
+ const pkg = JSON.parse((0, import_node_fs15.readFileSync)((0, import_node_path14.join)(publishDir, "package.json"), "utf8"));
15954
+ const name = pkg.name?.trim();
15955
+ if (!name) throw new Error("missing name field");
15956
+ return name;
15957
+ } catch (e) {
15958
+ throw new Error(
15959
+ `release --abort: cannot read npm publish name from ${publishDir}/package.json (${e instanceof Error ? e.message : String(e)}); nothing was written`
15960
+ );
15961
+ }
15962
+ }
15963
+ async function proveNpmVersionUnpublished(deps, packageName, version, tag) {
15964
+ try {
15965
+ const published = clean2(await deps.run("npm", ["view", `${packageName}@${version}`, "version", "--json"]));
15966
+ if (published) {
15967
+ throw new Error(`release --abort: ${packageName}@${version} is already published; ${tag} cannot be reused`);
15968
+ }
15969
+ throw new Error("npm registry returned an empty successful response");
15970
+ } catch (error) {
15971
+ const detail = `${error instanceof Error ? error.message : String(error)} ${String(error.stderr ?? "")}`;
15972
+ if (!/E404|not found|No match found/i.test(detail)) {
15973
+ if (/already published/.test(detail)) throw error;
15974
+ throw new Error(`release --abort: npm publish absence could not be proven (${detail.trim()}); nothing was written`);
15975
+ }
15976
+ }
15977
+ }
15944
15978
  function projectGetFailureText(e) {
15945
15979
  const err = e;
15946
15980
  return [err.message, err.stderr, err.stdout].filter(Boolean).join(" ");
@@ -16387,8 +16421,9 @@ function partialTrainRecoveryError(cause, input) {
16387
16421
  - origin/${branch}: NOT pushed
16388
16422
  - ${releaseState}
16389
16423
  ` + deployLine;
16390
- const failedHubMainGate = input.stage === "main" && input.repo.toLowerCase() === HUB_REPO3.toLowerCase() && /^required train check failed:/i.test(causeMessage);
16391
- if (failedHubMainGate) {
16424
+ const releaseAbortEligible = input.meta ? supportsReleaseAbort(input.repo, input.meta, input.branchHints) : isHubControlRepo(input.repo);
16425
+ const failedAbortEligibleMainGate = input.stage === "main" && releaseAbortEligible && /^required train check failed:/i.test(causeMessage);
16426
+ if (failedAbortEligibleMainGate) {
16392
16427
  return new Error(
16393
16428
  `${causeMessage}
16394
16429
 
@@ -17229,7 +17264,7 @@ async function gateTrueMergeCommit(deps, ctx, tag, releaseSha, requiredChecks) {
17229
17264
  }
17230
17265
  }
17231
17266
  }
17232
- async function completeMainRelease(deps, ctx, meta, deployModel, watch, options, tag, releaseSha, startBranch, preFold, tagProbe) {
17267
+ async function completeMainRelease(deps, ctx, meta, deployModel, watch, options, tag, releaseSha, startBranch, preFold, tagProbe, branchHints) {
17233
17268
  const resumeCommand = options.dev ? "mmi-cli devops release --dev --apply" : "mmi-cli devops release --apply";
17234
17269
  try {
17235
17270
  await verifyPublishDryRun(deps, ctx, meta, deployModel);
@@ -17265,16 +17300,17 @@ async function completeMainRelease(deps, ctx, meta, deployModel, watch, options,
17265
17300
  }
17266
17301
  const tagPushSince = (deps.now ?? Date.now)();
17267
17302
  let checks;
17303
+ const recoveryInput = { repo: ctx.repo, tag, stage: "main", deployModel, meta, branchHints };
17268
17304
  try {
17269
17305
  checks = await waitForRequiredTrainChecks(deps, ctx, releaseSha, requiredChecks, tagPush.pushed ? tagPushSince : void 0);
17270
17306
  } catch (e) {
17271
- throw partialTrainRecoveryError(e, { repo: ctx.repo, tag, stage: "main", deployModel });
17307
+ throw partialTrainRecoveryError(e, recoveryInput);
17272
17308
  }
17273
17309
  if (trueMergeGateNote) checks = `${trueMergeGateNote}; ${checks}`;
17274
17310
  try {
17275
17311
  await runGitPush(deps, ["push", "origin", "main"]);
17276
17312
  } catch (e) {
17277
- throw partialTrainRecoveryError(e, { repo: ctx.repo, tag, stage: "main", deployModel });
17313
+ throw partialTrainRecoveryError(e, recoveryInput);
17278
17314
  }
17279
17315
  const releaseUrl = clean2(await deps.run("gh", ["release", "create", tag, "--target", "main", "--generate-notes", "--latest", "--repo", ctx.repo])) || void 0;
17280
17316
  await verifyPublishedRelease(deps, ctx.repo, tag, "main", releaseSha);
@@ -17446,16 +17482,17 @@ async function runReleaseResume(deps, options = {}) {
17446
17482
  }
17447
17483
  const steps = [];
17448
17484
  let requiredChecks;
17485
+ const recoveryInput = { repo: ctx.repo, tag, stage: "main", deployModel, meta, branchHints };
17449
17486
  try {
17450
17487
  requiredChecks = await discoverRequiredCheckContexts(deps, ctx, "main");
17451
17488
  } catch (e) {
17452
- throw partialTrainRecoveryError(e, { repo: ctx.repo, tag, stage: "main", deployModel });
17489
+ throw partialTrainRecoveryError(e, recoveryInput);
17453
17490
  }
17454
17491
  assertTagAddressableRequiredContexts(deps, requiredChecks, ctx.repo);
17455
17492
  try {
17456
17493
  steps.push(await waitForRequiredTrainChecks(deps, ctx, tagSha, requiredChecks, void 0));
17457
17494
  } catch (e) {
17458
- throw partialTrainRecoveryError(e, { repo: ctx.repo, tag, stage: "main", deployModel });
17495
+ throw partialTrainRecoveryError(e, recoveryInput);
17459
17496
  }
17460
17497
  await runGitPush(deps, ["push", "origin", `${tagSha}:refs/heads/main`]);
17461
17498
  steps.push(`pushed ${tagSha.slice(0, 12)} to origin/main`);
@@ -17500,8 +17537,12 @@ async function runReleaseAbort(deps, options = {}) {
17500
17537
  throw new Error("release --abort requires --apply after explicit approval; nothing was written");
17501
17538
  }
17502
17539
  const ctx = await buildTrainApplyContext(deps);
17503
- if (!isHubControlRepo(ctx.repo)) {
17504
- throw new Error("release --abort is limited to mutmutco/MMI-Hub until other release tracks define equivalent publish-absence proof");
17540
+ const meta = requireProjectMetaForTrain(await loadProjectMeta(deps, ctx), ctx.repo);
17541
+ const branchHints = await loadReleaseTrackBranchHints(deps);
17542
+ if (!supportsReleaseAbort(ctx.repo, meta, branchHints)) {
17543
+ throw new Error(
17544
+ "release --abort is limited to mutmutco/MMI-Hub and eligible direct-track registry-publish repos until other release tracks define equivalent publish-absence proof"
17545
+ );
17505
17546
  }
17506
17547
  await requireCleanTree(deps);
17507
17548
  if (await currentBranch(deps) !== "main") {
@@ -17536,19 +17577,8 @@ async function runReleaseAbort(deps, options = {}) {
17536
17577
  throw new Error(`release --abort: ${tag} is released or its unpublished state could not be proven; nothing was written`);
17537
17578
  }
17538
17579
  const version = tag.slice(1);
17539
- try {
17540
- const published = clean2(await deps.run("npm", ["view", `@mutmutco/cli@${version}`, "version", "--json"]));
17541
- if (published) {
17542
- throw new Error(`release --abort: @mutmutco/cli@${version} is already published; ${tag} cannot be reused`);
17543
- }
17544
- throw new Error("npm registry returned an empty successful response");
17545
- } catch (error) {
17546
- const detail = `${error instanceof Error ? error.message : String(error)} ${String(error.stderr ?? "")}`;
17547
- if (!/E404|not found|No match found/i.test(detail)) {
17548
- if (/already published/.test(detail)) throw error;
17549
- throw new Error(`release --abort: npm publish absence could not be proven (${detail.trim()}); nothing was written`);
17550
- }
17551
- }
17580
+ const npmPackage = resolveReleaseAbortNpmPackage(meta, ctx.repo);
17581
+ await proveNpmVersionUnpublished(deps, npmPackage, version, tag);
17552
17582
  await runGitPush(deps, ["push", "origin", "--delete", tag]);
17553
17583
  if (await probeRemoteTag(deps, tag)) {
17554
17584
  throw new Error(`release --abort: origin still reports ${tag} after deletion; local state was preserved`);
@@ -17710,7 +17740,7 @@ async function runTrainApplyPipeline(mode, input) {
17710
17740
  const releaseSha3 = requireValue(clean2(await deps.run("git", ["rev-parse", "main"])), "release sha");
17711
17741
  return { versionFold: versionFold3, releaseSha: releaseSha3 };
17712
17742
  });
17713
- const { checks: checks2, releaseUrl: releaseUrl2, announceNote: announceNote2, dispatch: d2 } = await completeMainRelease(deps, ctx, meta, deployModel2, watch, options, tag2, releaseSha2, "development", preFold2, tagProbe2);
17743
+ const { checks: checks2, releaseUrl: releaseUrl2, announceNote: announceNote2, dispatch: d2 } = await completeMainRelease(deps, ctx, meta, deployModel2, watch, options, tag2, releaseSha2, "development", preFold2, tagProbe2, branchHints);
17714
17744
  const devRollForward2 = await rollDevelopmentForward(deps, ctx, tag2);
17715
17745
  if (directTrack) {
17716
17746
  return {
@@ -17797,7 +17827,7 @@ async function runTrainApplyPipeline(mode, input) {
17797
17827
  const releaseSha2 = requireValue(clean2(await deps.run("git", ["rev-parse", "main"])), "release sha");
17798
17828
  return { versionFold: versionFold2, releaseSha: releaseSha2 };
17799
17829
  });
17800
- const { checks, releaseUrl, announceNote, dispatch: d } = await completeMainRelease(deps, ctx, meta, deployModel, watch, options, tag, releaseSha, "rc", preFold, tagProbe);
17830
+ const { checks, releaseUrl, announceNote, dispatch: d } = await completeMainRelease(deps, ctx, meta, deployModel, watch, options, tag, releaseSha, "rc", preFold, tagProbe, branchHints);
17801
17831
  const retirement = await retireRcRuntime(deps, ctx, deployModel, d.deployStatus, releasedRcSha);
17802
17832
  const devRollForward = await rollDevelopmentForward(deps, ctx, tag);
17803
17833
  const rcAlignment = await alignRcForward(deps, ctx, tag);
@@ -42776,7 +42806,7 @@ for (const commandName of ["rcand", "release"]) {
42776
42806
  { flags: "--announce-summary-file <path>", description: "agent-curated 3-6 line Hub Slack summary; required for a new MMI-Hub --apply (#883/#3901)" },
42777
42807
  { flags: "--ack <shas>", description: "comma-separated dev shas a human verified are in the candidate, overriding the hotfix-coverage guard for a conflicted port whose -x trailer was lost (#958)" },
42778
42808
  { flags: "--dev", description: "full-track repos release development -> main directly, skipping rc (refuses if rc carries content not in development; no-op on direct-track repos) (#1062)" },
42779
- { flags: "--abort", description: "with --apply, delete only a proven unpublished failed Hub tag and restore local main for a clean recut (#3944)" },
42809
+ { flags: "--abort", description: "with --apply, delete only a proven unpublished failed release tag on MMI-Hub or an eligible direct-track registry-publish repo and restore local main for a clean recut (#3944/#5650)" },
42780
42810
  { flags: "--retry-publish <run-id>", description: "with --apply, retry failed jobs of one proven Hub publish release run (#3949)" }
42781
42811
  ];
42782
42812
  for (const f of RELEASE_ONLY_FLAGS) {
@@ -42802,7 +42832,7 @@ for (const commandName of ["rcand", "release"]) {
42802
42832
  return fail(`${commandName}: --announce-summary-file applies only to release \u2014 rcand posts no Hub Slack announcement. Run: mmi-cli devops release --announce-summary-file <path>`);
42803
42833
  }
42804
42834
  if (o.abort && commandName !== "release") {
42805
- return fail(`${commandName}: --abort applies only to release \u2014 it rolls back a proven unpublished Hub release tag. Run: mmi-cli devops release --abort --apply`);
42835
+ return fail(`${commandName}: --abort applies only to release \u2014 it rolls back a proven unpublished release tag. Run: mmi-cli devops release --abort --apply`);
42806
42836
  }
42807
42837
  if (o.retryPublish && commandName !== "release") {
42808
42838
  return fail(`${commandName}: --retry-publish applies only to release. Run: mmi-cli devops release --retry-publish <run-id> --apply --watch`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mutmutco/cli",
3
- "version": "4.1.6",
3
+ "version": "4.1.7",
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",