@mutmutco/cli 2.67.0 → 2.68.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/main.cjs +88 -7
  2. package/package.json +1 -1
package/dist/main.cjs CHANGED
@@ -5882,7 +5882,7 @@ async function waitForPrChecks(deps) {
5882
5882
  let lastDetail = "pending";
5883
5883
  while (now() < deadline) {
5884
5884
  const state = await deps.pollChecks();
5885
- if (state === "success") return { policy, status: "success", detail: lastDetail };
5885
+ if (state === "success") return { policy, status: "success", detail: "checks-success" };
5886
5886
  if (state === "failure") return { policy, status: "failure", detail: lastDetail };
5887
5887
  if (state === "no-checks-reported") {
5888
5888
  lastDetail = "no-checks-reported (waiting for workflow to queue)";
@@ -7696,8 +7696,8 @@ async function fastForwardCurrentBranch(git) {
7696
7696
  return { status: "failed", error: errorMessage(e) };
7697
7697
  }
7698
7698
  }
7699
- async function returnCheckoutToBase(git, base, mergedBranch, currentBranch) {
7700
- if (currentBranch === mergedBranch) {
7699
+ async function returnCheckoutToBase(git, base, mergedBranch, currentBranch2) {
7700
+ if (currentBranch2 === mergedBranch) {
7701
7701
  const dirty = (await git(["status", "--porcelain"]).catch(() => "dirty") || "").trim().length > 0;
7702
7702
  if (dirty) {
7703
7703
  return { report: { branch: base, switched: false, sync: "skipped", reason: "dirty-worktree" }, canDeleteBranch: false };
@@ -7713,7 +7713,7 @@ async function returnCheckoutToBase(git, base, mergedBranch, currentBranch) {
7713
7713
  const ff2 = await fastForwardCurrentBranch(git);
7714
7714
  return { report: { branch: base, switched: true, sync: ff2.status, ...ff2.error ? { error: ff2.error } : {} }, canDeleteBranch: true };
7715
7715
  }
7716
- if (currentBranch !== base) {
7716
+ if (currentBranch2 !== base) {
7717
7717
  return { report: { branch: base, switched: false, sync: "skipped", reason: "not-on-base" }, canDeleteBranch: true };
7718
7718
  }
7719
7719
  const ff = await fastForwardCurrentBranch(git);
@@ -9809,6 +9809,55 @@ async function requireBranch(deps, branch) {
9809
9809
  const current = clean(await deps.run("git", ["rev-parse", "--abbrev-ref", "HEAD"]));
9810
9810
  if (current !== branch) throw new Error(`must run from ${branch}, currently on ${current || "(unknown)"}`);
9811
9811
  }
9812
+ async function currentBranch(deps) {
9813
+ return clean(await deps.run("git", ["rev-parse", "--abbrev-ref", "HEAD"])) || "(unknown)";
9814
+ }
9815
+ async function restoreCheckoutAfterRelease(deps, startBranch) {
9816
+ const status = await deps.run("git", ["status", "--porcelain"]);
9817
+ if (porcelainHasBlockingChanges(status)) {
9818
+ return {
9819
+ startBranch,
9820
+ finalBranch: await currentBranch(deps),
9821
+ status: "skipped",
9822
+ reason: "dirty-worktree",
9823
+ note: `checkout restoration skipped: working tree changed after release; inspect it before leaving ${startBranch}`
9824
+ };
9825
+ }
9826
+ try {
9827
+ await deps.run("git", ["checkout", startBranch]);
9828
+ } catch (e) {
9829
+ return {
9830
+ startBranch,
9831
+ finalBranch: await currentBranch(deps),
9832
+ status: "skipped",
9833
+ reason: "checkout-failed",
9834
+ note: `checkout restoration failed while returning to ${startBranch}: ${e instanceof Error ? e.message : String(e)}`
9835
+ };
9836
+ }
9837
+ try {
9838
+ await ffOnlyPull(deps, startBranch);
9839
+ return {
9840
+ startBranch,
9841
+ finalBranch: startBranch,
9842
+ status: "returned",
9843
+ note: `checkout returned to ${startBranch} and fast-forwarded from origin/${startBranch}`
9844
+ };
9845
+ } catch (e) {
9846
+ return {
9847
+ startBranch,
9848
+ finalBranch: startBranch,
9849
+ status: "skipped",
9850
+ reason: "pull-failed",
9851
+ note: `checkout returned to ${startBranch}, but origin/${startBranch} fast-forward failed: ${e instanceof Error ? e.message : String(e)}`
9852
+ };
9853
+ }
9854
+ }
9855
+ async function withCheckoutRestoredAfterRelease(deps, result, startBranch) {
9856
+ return {
9857
+ ...result,
9858
+ checkout: await restoreCheckoutAfterRelease(deps, startBranch)
9859
+ };
9860
+ }
9812
9861
  function normGitPath(p) {
9813
9862
  return p.replace(/\\/g, "/").replace(/\/+$/, "").toLowerCase();
9814
9863
  }
@@ -10554,12 +10603,24 @@ async function runTrainApply(command, deps, options = {}) {
10554
10603
  return runTrainApplyPipeline("rcand", pipelineInput);
10555
10604
  }
10556
10605
  if (directTrack) {
10557
- return runTrainApplyPipeline("release-dev", { ...pipelineInput, directTrack: true });
10606
+ return withCheckoutRestoredAfterRelease(
10607
+ deps,
10608
+ await runTrainApplyPipeline("release-dev", { ...pipelineInput, directTrack: true }),
10609
+ "development"
10610
+ );
10558
10611
  }
10559
10612
  if (command === "release" && options.dev) {
10560
- return runTrainApplyPipeline("release-dev", pipelineInput);
10613
+ return withCheckoutRestoredAfterRelease(
10614
+ deps,
10615
+ await runTrainApplyPipeline("release-dev", pipelineInput),
10616
+ "development"
10617
+ );
10561
10618
  }
10562
- return runTrainApplyPipeline("release-full", pipelineInput);
10619
+ return withCheckoutRestoredAfterRelease(
10620
+ deps,
10621
+ await runTrainApplyPipeline("release-full", pipelineInput),
10622
+ "rc"
10623
+ );
10563
10624
  }
10564
10625
  async function buildEnvironments(deps, ctx, model, deployStatus, retirement) {
10565
10626
  if (model !== "tenant-container") return void 0;
@@ -15316,6 +15377,13 @@ function buildOpencodeVersionCheck(input) {
15316
15377
  }
15317
15378
  return { ...base, ok: false, installedVersion: input.installedVersion, releasedVersion: input.releasedVersion };
15318
15379
  }
15380
+ var OPENCODE_HOOK_ACTIVE_LABEL = "OpenCode MMI adapter hooks active (shell.env stamp)";
15381
+ function buildOpencodeHookActiveCheck(input) {
15382
+ const base = { ok: true, label: OPENCODE_HOOK_ACTIVE_LABEL, fix: OPENCODE_RECOVERY };
15383
+ if (!input.isOrgRepo || input.surface !== "opencode") return base;
15384
+ if (input.hookSurfaceStamp === "opencode") return { ...base, surfaceStamp: input.hookSurfaceStamp };
15385
+ return { ...base, ok: false, surfaceStamp: input.hookSurfaceStamp };
15386
+ }
15319
15387
  var OPENCODE_CONFIG_PLUGIN_LABEL = "OpenCode MMI adapter config wiring";
15320
15388
  var OPENCODE_SURFACE_ASSETS_LABEL = "OpenCode MMI commands and skills";
15321
15389
  function opencodePluginEntryMatches(entry) {
@@ -16852,6 +16920,16 @@ async function runDoctor(opts, io = consoleIo, readOrigin) {
16852
16920
  }
16853
16921
  }
16854
16922
  checks.push(opencodeVersionCheck);
16923
+ const hookSurfaceStamp = process.env.MMI_AGENT_SURFACE;
16924
+ const hookActiveCheck = buildOpencodeHookActiveCheck({
16925
+ isOrgRepo,
16926
+ surface,
16927
+ hookSurfaceStamp
16928
+ });
16929
+ if (!hookActiveCheck.ok && repairLocal) {
16930
+ io.err(` \u21BB MMI adapter config wired but hooks not active this session \u2014 ${reloadAction("opencode")} to load MMI plugin hooks`);
16931
+ }
16932
+ checks.push(hookActiveCheck);
16855
16933
  let surfaceAssetsCheck = buildOpencodeSurfaceAssetsCheck({
16856
16934
  isOrgRepo,
16857
16935
  configPath: openCodeConfigSnapshot.path,
@@ -19527,6 +19605,9 @@ function renderTrainApply(commandName, r) {
19527
19605
  const f = r.devRollForward;
19528
19606
  base = f.status === "pr-pending" ? `${base}; dev roll-forward: ALIGNMENT PR PENDING \u2014 land it with \`gh pr merge ${f.prNumber ?? "<number>"} --merge\`${f.prUrl ? ` (${f.prUrl})` : ""}` : `${base}; dev roll-forward: ${f.note}`;
19529
19607
  }
19608
+ if (r.checkout) {
19609
+ base = `${base}; checkout: ${r.checkout.note}`;
19610
+ }
19530
19611
  return r.announceNote ? `${base}; announce: ${r.announceNote}` : base;
19531
19612
  }
19532
19613
  function renderTenantRedeploy(r) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mutmutco/cli",
3
- "version": "2.67.0",
3
+ "version": "2.68.0",
4
4
  "description": "MMI Future CLI — delivers the org rules (whole-file), Jervaise-only continuity, and KB access. The cross-IDE engine the plugin's SessionStart hook drives.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",