@mutmutco/cli 3.59.0 → 3.60.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 +35 -9
  2. package/package.json +1 -1
package/dist/main.cjs CHANGED
@@ -37,7 +37,8 @@ __export(index_exports, {
37
37
  gcPlan: () => gcPlan,
38
38
  isOrgRegisteredRepo: () => isOrgRegisteredRepo,
39
39
  registryClientDeps: () => registryClientDeps,
40
- repoSlug: () => repoSlug
40
+ repoSlug: () => repoSlug,
41
+ shouldMarkWorktreeActivity: () => shouldMarkWorktreeActivity
41
42
  });
42
43
  module.exports = __toCommonJS(index_exports);
43
44
 
@@ -14032,16 +14033,17 @@ async function rollDevelopmentForward(deps, ctx, tag) {
14032
14033
  }
14033
14034
  async function enqueueAlignmentAutoMerge(deps, ctx, prNumber, prUrl, openedNote) {
14034
14035
  const base = { status: "pr-pending", prNumber, prUrl };
14035
- const manual = `${openedNote} \u2014 land it with \`mmi-cli pr merge ${prNumber ?? "<number>"} --auto --merge\``;
14036
+ const retryCommand = `mmi-cli pr merge ${prNumber ?? "<number>"} --auto --merge`;
14037
+ const manual = `${openedNote} \u2014 land it with \`${retryCommand}\``;
14036
14038
  if (deps.mergeAuto && prNumber !== void 0) {
14037
14039
  try {
14038
14040
  const res = await deps.mergeAuto(String(prNumber), ctx.repo);
14039
14041
  if (res.mergeStatus !== "failed") {
14040
14042
  return { ...base, autoMergeEnqueued: true, note: `${openedNote} \u2014 auto-merge enqueued (merges when checks pass)` };
14041
14043
  }
14042
- deps.warn?.(`alignment PR #${prNumber} auto-merge enqueue failed (${res.error ?? "unknown error"}) \u2014 land it manually`);
14044
+ deps.warn?.(`alignment PR #${prNumber} auto-merge not armed (${res.error ?? "unknown error"}) \u2014 re-run: ${retryCommand}`);
14043
14045
  } catch (e) {
14044
- deps.warn?.(`alignment PR #${prNumber} auto-merge enqueue threw (${e instanceof Error ? e.message : String(e)}) \u2014 land it manually`);
14046
+ deps.warn?.(`alignment PR #${prNumber} auto-merge enqueue threw (${e instanceof Error ? e.message : String(e)}) \u2014 re-run: ${retryCommand}`);
14045
14047
  }
14046
14048
  }
14047
14049
  return { ...base, note: manual };
@@ -21792,11 +21794,17 @@ function lookupWorktreeOwner(primaryRoot, path2) {
21792
21794
  function recordWorktreeOwner(primaryRoot, entry) {
21793
21795
  writeOwners(primaryRoot, upsertWorktreeOwner(readOwners(primaryRoot), entry));
21794
21796
  }
21795
- function touchWorktreeOwner(primaryRoot, path2, at = /* @__PURE__ */ new Date()) {
21797
+ var WORKTREE_TOUCH_MIN_INTERVAL_MS = 5 * 6e4;
21798
+ function touchWorktreeOwner(primaryRoot, path2, at = /* @__PURE__ */ new Date(), minIntervalMs = 0) {
21796
21799
  const entries = readOwners(primaryRoot);
21797
21800
  const owner = findWorktreeOwner(entries, path2);
21798
- if (!owner) return;
21801
+ if (!owner) return false;
21802
+ if (minIntervalMs > 0) {
21803
+ const last = Date.parse(owner.lastSeenAt);
21804
+ if (Number.isFinite(last) && at.getTime() - last < minIntervalMs) return false;
21805
+ }
21799
21806
  writeOwners(primaryRoot, upsertWorktreeOwner(entries, { ...owner, lastSeenAt: at.toISOString() }));
21807
+ return true;
21800
21808
  }
21801
21809
  function dropWorktreeOwner(primaryRoot, path2) {
21802
21810
  const entries = readOwners(primaryRoot);
@@ -22161,7 +22169,10 @@ async function ghMergeAutoEnqueue(prNumber, repo, method, io = defaultGhMergeAut
22161
22169
  if (!basePolicyBlocksImmediateMerge(message)) {
22162
22170
  return { mergeStatus: "failed", error: ghFailureReason(e) };
22163
22171
  }
22164
- return { mergeStatus: "failed", error: `merge blocked: ${ghFailureReason(e)} \u2014 ensure checks are green` };
22172
+ return {
22173
+ mergeStatus: "failed",
22174
+ error: `${ghFailureReason(e)} \u2014 auto-merge could not be armed yet (the PR's required checks have not registered); re-run the same --auto merge once they appear`
22175
+ };
22165
22176
  }
22166
22177
  return confirmEnqueueOutcome();
22167
22178
  }
@@ -25630,9 +25641,23 @@ function appActorDeps() {
25630
25641
  fetch: (url, init) => fetch(url, init)
25631
25642
  };
25632
25643
  }
25644
+ function shouldMarkWorktreeActivity(commandPath3) {
25645
+ return commandPath3.split(" ")[0] !== "worktree";
25646
+ }
25647
+ async function markWorktreeActivity(commandPath3) {
25648
+ try {
25649
+ if (!shouldMarkWorktreeActivity(commandPath3)) return;
25650
+ if (!isLinkedWorktree(process.cwd())) return;
25651
+ const primaryRoot = await primaryCheckoutRoot(process.cwd());
25652
+ if (primaryRoot) touchWorktreeOwner(primaryRoot, process.cwd(), /* @__PURE__ */ new Date(), WORKTREE_TOUCH_MIN_INTERVAL_MS);
25653
+ } catch {
25654
+ }
25655
+ }
25633
25656
  program2.hook("preAction", async (_thisCommand, actionCommand) => {
25657
+ const commandPath3 = commandPathOf(actionCommand);
25658
+ await markWorktreeActivity(commandPath3);
25634
25659
  try {
25635
- await activateAppActor(commandPathOf(actionCommand), process.env, () => mintInstallationToken(appActorDeps()));
25660
+ await activateAppActor(commandPath3, process.env, () => mintInstallationToken(appActorDeps()));
25636
25661
  } catch (e) {
25637
25662
  if (e instanceof AppActorError) return fail(e.message);
25638
25663
  throw e;
@@ -27867,5 +27892,6 @@ program2.parseAsync(process.argv).then(() => finishCliRun()).catch((e) => failGr
27867
27892
  gcPlan,
27868
27893
  isOrgRegisteredRepo,
27869
27894
  registryClientDeps,
27870
- repoSlug
27895
+ repoSlug,
27896
+ shouldMarkWorktreeActivity
27871
27897
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mutmutco/cli",
3
- "version": "3.59.0",
3
+ "version": "3.60.0",
4
4
  "description": "MMI Future CLI — the org dev toolbox (board, registry, keyless secrets, release train, bootstrap, doctor) and the cross-IDE engine the plugin's session-start hook drives.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",