@mutmutco/cli 3.59.1 → 3.61.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 +34 -6
  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
 
@@ -21684,7 +21685,13 @@ var import_node_path25 = require("node:path");
21684
21685
  var OWNERS_FILE = "worktree-owners.json";
21685
21686
  var EVENTS_FILE = "worktree-events.jsonl";
21686
21687
  var WORKTREE_ACTIVITY_WINDOW_MS = 30 * 6e4;
21687
- var SESSION_ID_ENV_VARS = ["MMI_SESSION_ID", "CLAUDE_SESSION_ID", "CODEX_SESSION_ID", "CURSOR_SESSION_ID"];
21688
+ var SESSION_ID_ENV_VARS = [
21689
+ "MMI_SESSION_ID",
21690
+ "CLAUDE_SESSION_ID",
21691
+ "CLAUDE_CODE_SESSION_ID",
21692
+ "CODEX_SESSION_ID",
21693
+ "CURSOR_SESSION_ID"
21694
+ ];
21688
21695
  function readSessionId(env) {
21689
21696
  for (const key of SESSION_ID_ENV_VARS) {
21690
21697
  const value = env[key]?.trim();
@@ -21793,11 +21800,17 @@ function lookupWorktreeOwner(primaryRoot, path2) {
21793
21800
  function recordWorktreeOwner(primaryRoot, entry) {
21794
21801
  writeOwners(primaryRoot, upsertWorktreeOwner(readOwners(primaryRoot), entry));
21795
21802
  }
21796
- function touchWorktreeOwner(primaryRoot, path2, at = /* @__PURE__ */ new Date()) {
21803
+ var WORKTREE_TOUCH_MIN_INTERVAL_MS = 5 * 6e4;
21804
+ function touchWorktreeOwner(primaryRoot, path2, at = /* @__PURE__ */ new Date(), minIntervalMs = 0) {
21797
21805
  const entries = readOwners(primaryRoot);
21798
21806
  const owner = findWorktreeOwner(entries, path2);
21799
- if (!owner) return;
21807
+ if (!owner) return false;
21808
+ if (minIntervalMs > 0) {
21809
+ const last = Date.parse(owner.lastSeenAt);
21810
+ if (Number.isFinite(last) && at.getTime() - last < minIntervalMs) return false;
21811
+ }
21800
21812
  writeOwners(primaryRoot, upsertWorktreeOwner(entries, { ...owner, lastSeenAt: at.toISOString() }));
21813
+ return true;
21801
21814
  }
21802
21815
  function dropWorktreeOwner(primaryRoot, path2) {
21803
21816
  const entries = readOwners(primaryRoot);
@@ -25634,9 +25647,23 @@ function appActorDeps() {
25634
25647
  fetch: (url, init) => fetch(url, init)
25635
25648
  };
25636
25649
  }
25650
+ function shouldMarkWorktreeActivity(commandPath3) {
25651
+ return commandPath3.split(" ")[0] !== "worktree";
25652
+ }
25653
+ async function markWorktreeActivity(commandPath3) {
25654
+ try {
25655
+ if (!shouldMarkWorktreeActivity(commandPath3)) return;
25656
+ if (!isLinkedWorktree(process.cwd())) return;
25657
+ const primaryRoot = await primaryCheckoutRoot(process.cwd());
25658
+ if (primaryRoot) touchWorktreeOwner(primaryRoot, process.cwd(), /* @__PURE__ */ new Date(), WORKTREE_TOUCH_MIN_INTERVAL_MS);
25659
+ } catch {
25660
+ }
25661
+ }
25637
25662
  program2.hook("preAction", async (_thisCommand, actionCommand) => {
25663
+ const commandPath3 = commandPathOf(actionCommand);
25664
+ await markWorktreeActivity(commandPath3);
25638
25665
  try {
25639
- await activateAppActor(commandPathOf(actionCommand), process.env, () => mintInstallationToken(appActorDeps()));
25666
+ await activateAppActor(commandPath3, process.env, () => mintInstallationToken(appActorDeps()));
25640
25667
  } catch (e) {
25641
25668
  if (e instanceof AppActorError) return fail(e.message);
25642
25669
  throw e;
@@ -27871,5 +27898,6 @@ program2.parseAsync(process.argv).then(() => finishCliRun()).catch((e) => failGr
27871
27898
  gcPlan,
27872
27899
  isOrgRegisteredRepo,
27873
27900
  registryClientDeps,
27874
- repoSlug
27901
+ repoSlug,
27902
+ shouldMarkWorktreeActivity
27875
27903
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mutmutco/cli",
3
- "version": "3.59.1",
3
+ "version": "3.61.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",