@mutmutco/hub 4.5.168 → 4.5.170

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/index.cjs +53 -1
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -7381,6 +7381,7 @@ __export(index_exports, {
7381
7381
  enumerateSurfaces: () => enumerateSurfaces,
7382
7382
  failConsequence: () => failConsequence,
7383
7383
  fleetStamp: () => fleetStamp,
7384
+ handoffSchedule: () => handoffSchedule,
7384
7385
  hermesArm: () => hermesArm,
7385
7386
  hermesHome: () => hermesHome,
7386
7387
  hermesHomes: () => hermesHomes,
@@ -7414,6 +7415,7 @@ __export(index_exports, {
7414
7415
  reconcile: () => reconcile,
7415
7416
  reconcileCursorUserHooks: () => reconcileCursorUserHooks,
7416
7417
  releaseSharedDocLock: () => releaseSharedDocLock,
7418
+ removeLegacyTask: () => removeLegacyTask,
7417
7419
  renderNotice: () => renderNotice,
7418
7420
  renderReport: () => renderReport,
7419
7421
  reportCounts: () => reportCounts,
@@ -11538,6 +11540,50 @@ function uninstallTask(env = process.env) {
11538
11540
  if (process.platform === "linux") return uninstallSystemdTimer(env);
11539
11541
  return { ok: false, detail: "scheduler registration is available on Windows Task Scheduler, macOS launchd, and Linux systemd user timers only" };
11540
11542
  }
11543
+ function removeLegacyTask(env = process.env) {
11544
+ const removed = (what) => ({ ok: true, detail: `removed the legacy "${what}" \u2014 auto-update is owned by the launcher's task` });
11545
+ const noted = (what, reason) => ({ ok: true, detail: `could not remove the legacy "${what}": ${reason} \u2014 remove it with \`mmi-hub autoupdate off\`` });
11546
+ if (process.platform === "win32") {
11547
+ const del = schtasks(["/delete", "/tn", TASK_NAME, "/f"]);
11548
+ if (del.status !== 0) {
11549
+ if (schtasks(["/query", "/tn", TASK_NAME]).status === 0) {
11550
+ return noted(TASK_NAME, simpleLine(del.stderr || del.stdout) || "the task is still registered");
11551
+ }
11552
+ dropLauncher(env, LAUNCHER_FILE);
11553
+ return { ok: true, detail: `the legacy "${TASK_NAME}" is not registered \u2014 auto-update is owned by the launcher's task` };
11554
+ }
11555
+ dropLauncher(env, LAUNCHER_FILE);
11556
+ return removed(TASK_NAME);
11557
+ }
11558
+ if (process.platform === "darwin") {
11559
+ const what = LAUNCHD_LABEL;
11560
+ const plistPath = (0, import_node_path15.join)((0, import_node_os8.homedir)(), "Library", "LaunchAgents", LAUNCHD_PLIST_NAME);
11561
+ launchctl(["bootout", `gui/${uid()}/${LAUNCHD_LABEL}`]);
11562
+ try {
11563
+ (0, import_node_fs21.rmSync)(plistPath, { force: true });
11564
+ } catch {
11565
+ }
11566
+ dropLauncher(env, POSIX_LAUNCHER_FILE);
11567
+ return (0, import_node_fs21.existsSync)(plistPath) ? noted(what, "the agent plist is still on disk") : removed(what);
11568
+ }
11569
+ if (process.platform === "linux") {
11570
+ const what = SYSTEMD_TIMER_NAME;
11571
+ const unitDir = (0, import_node_path15.join)((0, import_node_os8.homedir)(), ".config", "systemd", "user");
11572
+ systemctlUser(["disable", "--now", SYSTEMD_TIMER_NAME]);
11573
+ try {
11574
+ (0, import_node_fs21.rmSync)((0, import_node_path15.join)(unitDir, SYSTEMD_TIMER_NAME), { force: true });
11575
+ (0, import_node_fs21.rmSync)((0, import_node_path15.join)(unitDir, SYSTEMD_SERVICE_NAME), { force: true });
11576
+ } catch {
11577
+ }
11578
+ systemctlUser(["daemon-reload"]);
11579
+ dropLauncher(env, POSIX_LAUNCHER_FILE);
11580
+ return (0, import_node_fs21.existsSync)((0, import_node_path15.join)(unitDir, SYSTEMD_TIMER_NAME)) ? noted(what, "the unit is still on disk") : removed(what);
11581
+ }
11582
+ return { ok: true, detail: "no legacy scheduler to remove on this platform \u2014 auto-update is owned by the launcher's task" };
11583
+ }
11584
+ function simpleLine(text) {
11585
+ return text.split(/\r?\n/).map((line) => line.trim()).filter(Boolean)[0] ?? "";
11586
+ }
11541
11587
  function dropLauncher(env, file) {
11542
11588
  try {
11543
11589
  (0, import_node_fs21.rmSync)((0, import_node_path15.join)(statePaths(env).root, file), { force: true });
@@ -11861,10 +11907,14 @@ function shippedTargetFrom(args) {
11861
11907
  const value = (args[index + 1] ?? "").trim();
11862
11908
  return value && !value.startsWith("--") ? value : void 0;
11863
11909
  }
11910
+ function handoffSchedule(env = process.env, remove = removeLegacyTask) {
11911
+ const launcherSchedule = env.MM_LAUNCHER_SCHEDULE?.trim();
11912
+ return launcherSchedule ? () => ({ ok: true, detail: remove().detail }) : null;
11913
+ }
11864
11914
  function runMaintenance2(args, dependencies = {}) {
11865
11915
  return runMaintenance(installer_product_default, args, {
11866
11916
  engine: dependencies.reconcile ?? reconcile,
11867
- schedule: dependencies.schedule ?? installTask,
11917
+ schedule: dependencies.schedule ?? handoffSchedule(process.env, dependencies.removeTask ?? removeLegacyTask) ?? installTask,
11868
11918
  handOff: dependencies.handOff ?? handOff,
11869
11919
  run: dependencies.run,
11870
11920
  shippedTarget: shippedTargetFrom(args),
@@ -11943,6 +11993,7 @@ if (typeof require !== "undefined" && require.main === module) {
11943
11993
  enumerateSurfaces,
11944
11994
  failConsequence,
11945
11995
  fleetStamp,
11996
+ handoffSchedule,
11946
11997
  hermesArm,
11947
11998
  hermesHome,
11948
11999
  hermesHomes,
@@ -11976,6 +12027,7 @@ if (typeof require !== "undefined" && require.main === module) {
11976
12027
  reconcile,
11977
12028
  reconcileCursorUserHooks,
11978
12029
  releaseSharedDocLock,
12030
+ removeLegacyTask,
11979
12031
  renderNotice,
11980
12032
  renderReport,
11981
12033
  reportCounts,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mutmutco/hub",
3
- "version": "4.5.168",
3
+ "version": "4.5.170",
4
4
  "description": "Install and maintain the MMI CLI and every present host surface from one release-gated Hub command.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",