@mutmutco/cli 3.107.0 → 3.107.2

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 +74 -4
  2. package/package.json +1 -1
package/dist/main.cjs CHANGED
@@ -11982,6 +11982,7 @@ async function runPluginHeal(surface = detectSurface(process.env)) {
11982
11982
  }
11983
11983
 
11984
11984
  // src/train-apply.ts
11985
+ var TRAIN_BUMP_INTENTS = ["major", "minor", "patch"];
11985
11986
  function isCentralDispatchModel(model) {
11986
11987
  return model === "tenant-container" || model === "solo-container" || model === "static-cdn";
11987
11988
  }
@@ -12053,6 +12054,25 @@ async function alignExistingHotfixReleaseMarker(deps, version) {
12053
12054
  if (out === "stamped") return `jervaiseRelease hotfix marker stamped for ${version}`;
12054
12055
  return null;
12055
12056
  }
12057
+ async function clearStaleHotfixReleaseMarker(deps, version) {
12058
+ const script = [
12059
+ "const fs = require('fs');",
12060
+ "const p = 'package.json';",
12061
+ "if (!fs.existsSync(p)) { process.stdout.write('absent'); process.exit(0); }",
12062
+ "const j = JSON.parse(fs.readFileSync(p, 'utf8'));",
12063
+ "const marker = j.jervaiseRelease;",
12064
+ "if (!(marker && typeof marker === 'object' && marker.kind === 'hotfix')) {",
12065
+ " process.stdout.write('skip');",
12066
+ " process.exit(0);",
12067
+ "}",
12068
+ "delete j.jervaiseRelease;",
12069
+ "fs.writeFileSync(p, JSON.stringify(j, null, 2) + '\\n');",
12070
+ "process.stdout.write('cleared');"
12071
+ ].join("");
12072
+ const out = (await deps.run("node", ["-e", script])).trim();
12073
+ if (out === "cleared") return `stale jervaiseRelease hotfix marker cleared for train line ${version}`;
12074
+ return null;
12075
+ }
12056
12076
  async function installAppFoldDeps(deps) {
12057
12077
  const hasLock = await deps.run("git", ["cat-file", "-e", "HEAD:package-lock.json"]).then(() => true).catch(() => false);
12058
12078
  await deps.run("npm", hasLock ? ["ci"] : ["install"]);
@@ -12129,6 +12149,9 @@ async function foldReleaseVersion(deps, model, tag, foldPaths, sourceCommit = "H
12129
12149
  if (model === "registry-publish" && Number.isFinite(patch) && patch > 0) {
12130
12150
  await alignExistingHotfixReleaseMarker(deps, version);
12131
12151
  }
12152
+ if (model === "registry-publish" && Number.isFinite(patch) && patch === 0) {
12153
+ await clearStaleHotfixReleaseMarker(deps, version);
12154
+ }
12132
12155
  }
12133
12156
  for (const path2 of foldPaths) {
12134
12157
  await deps.run("git", ["add", "--", path2]).catch(() => void 0);
@@ -13959,15 +13982,62 @@ async function runTrainApplyPipeline(mode, input) {
13959
13982
  environments
13960
13983
  };
13961
13984
  }
13985
+ async function latestLocalReleaseTag(deps) {
13986
+ const tags = clean2(await deps.run("git", ["tag", "--list", "v*"])).split("\n");
13987
+ let latest = { major: 0, minor: 0, patch: 0 };
13988
+ for (const tag of tags) {
13989
+ const m = /^v(\d+)\.(\d+)\.(\d+)$/.exec(tag.trim());
13990
+ if (!m) continue;
13991
+ const v = { major: +m[1], minor: +m[2], patch: +m[3] };
13992
+ const delta = v.major - latest.major || v.minor - latest.minor || v.patch - latest.patch;
13993
+ if (delta > 0) latest = v;
13994
+ }
13995
+ return latest;
13996
+ }
13997
+ async function resolveTrainBumpIntent(deps, env = process.env) {
13998
+ const explicitIntent = (env.MMI_BUMP_INTENT ?? "").trim();
13999
+ if (explicitIntent) {
14000
+ if (!TRAIN_BUMP_INTENTS.includes(explicitIntent)) {
14001
+ throw new Error("MMI_BUMP_INTENT must be one of major|minor|patch");
14002
+ }
14003
+ return explicitIntent;
14004
+ }
14005
+ const explicitVersion = (env.MMI_RELEASE_VERSION ?? "").trim();
14006
+ if (explicitVersion) {
14007
+ const m = /^v?(\d+)\.(\d+)\.(\d+)$/.exec(explicitVersion);
14008
+ if (!m) throw new Error(`MMI_RELEASE_VERSION must be X.Y.Z (got ${explicitVersion})`);
14009
+ const explicit = { major: +m[1], minor: +m[2], patch: +m[3] };
14010
+ const latest = await latestLocalReleaseTag(deps);
14011
+ const delta = explicit.major - latest.major || explicit.minor - latest.minor || explicit.patch - latest.patch;
14012
+ if (delta <= 0) {
14013
+ throw new Error(
14014
+ `MMI_RELEASE_VERSION ${explicitVersion} must be ahead of the latest release v${latest.major}.${latest.minor}.${latest.patch}`
14015
+ );
14016
+ }
14017
+ return explicit.major > latest.major ? "major" : explicit.minor > latest.minor ? "minor" : "patch";
14018
+ }
14019
+ try {
14020
+ return requireValue(
14021
+ clean2(await deps.run("node", ["scripts/next-version.mjs", "intent"])),
14022
+ "release bump intent"
14023
+ );
14024
+ } catch (e) {
14025
+ const message = e instanceof Error ? e.message : String(e);
14026
+ const usage = /usage: next-version\.mjs <([^>]+)>/.exec(message);
14027
+ if (usage && !usage[1].split("|").includes("intent")) {
14028
+ throw new Error(
14029
+ `release bump intent: this repo's seeded scripts/next-version.mjs predates the \`intent\` verb (its usage lists <${usage[1]}>), so unset-intent derivation cannot run here. Declare the intent explicitly and rerun \u2014 MMI_BUMP_INTENT=major|minor|patch (or MMI_RELEASE_VERSION=X.Y.Z for an exact target); the train then resolves it in the CLI without shelling this script. The durable fix is refreshing the seeded script from the Hub via seed propagation.`
14030
+ );
14031
+ }
14032
+ throw e;
14033
+ }
14034
+ }
13962
14035
  async function runTrainApply(command, deps, options = {}) {
13963
14036
  const watch = options.watch ?? false;
13964
14037
  const ctx = await buildTrainApplyContext(deps);
13965
14038
  await requireCleanTree(deps);
13966
14039
  await runGitRemoteRead(deps, ["fetch", "origin"]);
13967
- const bumpIntent = requireValue(
13968
- clean2(await deps.run("node", ["scripts/next-version.mjs", "intent"])),
13969
- "release bump intent"
13970
- );
14040
+ const bumpIntent = await resolveTrainBumpIntent(deps);
13971
14041
  const meta = requireProjectMetaForTrain(await loadProjectMeta(deps, ctx), ctx.repo);
13972
14042
  const branchHints = await loadReleaseTrackBranchHints(deps);
13973
14043
  const directTrack = isHubControlRepo(ctx.repo) || resolveReleaseTrack(meta, branchHints) === "direct";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mutmutco/cli",
3
- "version": "3.107.0",
3
+ "version": "3.107.2",
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",