@mutmutco/cli 3.59.1 → 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 +27 -5
  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
 
@@ -21793,11 +21794,17 @@ function lookupWorktreeOwner(primaryRoot, path2) {
21793
21794
  function recordWorktreeOwner(primaryRoot, entry) {
21794
21795
  writeOwners(primaryRoot, upsertWorktreeOwner(readOwners(primaryRoot), entry));
21795
21796
  }
21796
- 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) {
21797
21799
  const entries = readOwners(primaryRoot);
21798
21800
  const owner = findWorktreeOwner(entries, path2);
21799
- 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
+ }
21800
21806
  writeOwners(primaryRoot, upsertWorktreeOwner(entries, { ...owner, lastSeenAt: at.toISOString() }));
21807
+ return true;
21801
21808
  }
21802
21809
  function dropWorktreeOwner(primaryRoot, path2) {
21803
21810
  const entries = readOwners(primaryRoot);
@@ -25634,9 +25641,23 @@ function appActorDeps() {
25634
25641
  fetch: (url, init) => fetch(url, init)
25635
25642
  };
25636
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
+ }
25637
25656
  program2.hook("preAction", async (_thisCommand, actionCommand) => {
25657
+ const commandPath3 = commandPathOf(actionCommand);
25658
+ await markWorktreeActivity(commandPath3);
25638
25659
  try {
25639
- await activateAppActor(commandPathOf(actionCommand), process.env, () => mintInstallationToken(appActorDeps()));
25660
+ await activateAppActor(commandPath3, process.env, () => mintInstallationToken(appActorDeps()));
25640
25661
  } catch (e) {
25641
25662
  if (e instanceof AppActorError) return fail(e.message);
25642
25663
  throw e;
@@ -27871,5 +27892,6 @@ program2.parseAsync(process.argv).then(() => finishCliRun()).catch((e) => failGr
27871
27892
  gcPlan,
27872
27893
  isOrgRegisteredRepo,
27873
27894
  registryClientDeps,
27874
- repoSlug
27895
+ repoSlug,
27896
+ shouldMarkWorktreeActivity
27875
27897
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mutmutco/cli",
3
- "version": "3.59.1",
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",