@mutmutco/cli 3.107.1 → 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.
- package/dist/main.cjs +52 -4
- 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
|
}
|
|
@@ -13981,15 +13982,62 @@ async function runTrainApplyPipeline(mode, input) {
|
|
|
13981
13982
|
environments
|
|
13982
13983
|
};
|
|
13983
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
|
+
}
|
|
13984
14035
|
async function runTrainApply(command, deps, options = {}) {
|
|
13985
14036
|
const watch = options.watch ?? false;
|
|
13986
14037
|
const ctx = await buildTrainApplyContext(deps);
|
|
13987
14038
|
await requireCleanTree(deps);
|
|
13988
14039
|
await runGitRemoteRead(deps, ["fetch", "origin"]);
|
|
13989
|
-
const bumpIntent =
|
|
13990
|
-
clean2(await deps.run("node", ["scripts/next-version.mjs", "intent"])),
|
|
13991
|
-
"release bump intent"
|
|
13992
|
-
);
|
|
14040
|
+
const bumpIntent = await resolveTrainBumpIntent(deps);
|
|
13993
14041
|
const meta = requireProjectMetaForTrain(await loadProjectMeta(deps, ctx), ctx.repo);
|
|
13994
14042
|
const branchHints = await loadReleaseTrackBranchHints(deps);
|
|
13995
14043
|
const directTrack = isHubControlRepo(ctx.repo) || resolveReleaseTrack(meta, branchHints) === "direct";
|
package/package.json
CHANGED