@mutmutco/hub 4.3.10 → 4.3.11

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 +31 -11
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -31,6 +31,7 @@ __export(index_exports, {
31
31
  failConsequence: () => failConsequence,
32
32
  fleetStamp: () => fleetStamp,
33
33
  formatReconcileReport: () => formatReconcileReport,
34
+ heldOutput: () => heldOutput,
34
35
  hermesArm: () => hermesArm,
35
36
  hermesHome: () => hermesHome,
36
37
  hermesHostCommand: () => hermesHostCommand,
@@ -3109,12 +3110,7 @@ function printReconcile(summary, json, dryRun = false) {
3109
3110
  journalPath: statePaths(process.env).journalPath
3110
3111
  }));
3111
3112
  }
3112
- function handOff(reexec, args, json) {
3113
- if (!json) {
3114
- process.stdout.write(` updater ${reexec.from ?? "absent"} \u2192 ${reexec.target} updated \u2014 rerunning under ${reexec.target}
3115
-
3116
- `);
3117
- }
3113
+ function handOff(reexec, args) {
3118
3114
  const child = (0, import_node_child_process9.spawnSync)(process.execPath, [reexec.dist, ...args], {
3119
3115
  stdio: "inherit",
3120
3116
  windowsHide: true,
@@ -3127,6 +3123,22 @@ function handOff(reexec, args, json) {
3127
3123
  }
3128
3124
  return child.status;
3129
3125
  }
3126
+ function heldOutput(write) {
3127
+ const held = [];
3128
+ let streaming = false;
3129
+ return {
3130
+ emit: (line) => {
3131
+ if (streaming) write(line);
3132
+ else held.push(line);
3133
+ },
3134
+ stream: () => {
3135
+ if (streaming) return;
3136
+ streaming = true;
3137
+ for (const line of held) write(line);
3138
+ held.length = 0;
3139
+ }
3140
+ };
3141
+ }
3130
3142
  function runUpdate(args, json) {
3131
3143
  const dryRun = args.includes("--dry-run");
3132
3144
  const verbose = args.includes("--verbose");
@@ -3148,20 +3160,27 @@ function runUpdate(args, json) {
3148
3160
  const spinner = startSpinner(true);
3149
3161
  let headerEmitted = false;
3150
3162
  let summary;
3163
+ const { emit, stream } = heldOutput((line) => spinner.persist(line));
3164
+ let arms = 0;
3151
3165
  try {
3152
3166
  summary = reconcile({
3153
3167
  dryRun,
3154
3168
  onPhase: (line) => spinner.label(line),
3155
3169
  onTargetResolved: (target) => {
3156
- spinner.persist(updateHeader(target, dryRun));
3157
- spinner.persist("");
3170
+ emit(updateHeader(target, dryRun));
3171
+ emit("");
3158
3172
  headerEmitted = true;
3159
3173
  },
3160
- onArm: (arm) => spinner.persist(progressiveRow(arm, reportOptions))
3174
+ onArm: (arm) => {
3175
+ if (arms++) stream();
3176
+ emit(progressiveRow(arm, reportOptions));
3177
+ }
3161
3178
  });
3162
3179
  } finally {
3163
3180
  spinner.stop();
3164
3181
  }
3182
+ if (summary.reexec) return { summary, rendered: true };
3183
+ stream();
3165
3184
  if (headerEmitted) process.stdout.write(reportFooterLines(summary, reportOptions).join("\n") + "\n");
3166
3185
  else process.stdout.write(formatReconcileReport(summary, reportOptions));
3167
3186
  return { summary, rendered: true };
@@ -3184,14 +3203,14 @@ function main(args = process.argv.slice(2)) {
3184
3203
  }
3185
3204
  if (command === "update") {
3186
3205
  const { summary, rendered } = runUpdate(args, json);
3187
- if (summary.reexec) return handOff(summary.reexec, args, json);
3206
+ if (summary.reexec) return handOff(summary.reexec, args);
3188
3207
  if (!rendered) printReconcile(summary, json, args.includes("--dry-run"));
3189
3208
  return summary.exit;
3190
3209
  }
3191
3210
  if (command === "install") {
3192
3211
  const { summary, rendered } = runUpdate(args, json);
3193
3212
  if (summary.reexec) {
3194
- const handedOff = handOff(summary.reexec, ["update", ...args.filter((arg) => arg !== "install")], json);
3213
+ const handedOff = handOff(summary.reexec, ["update", ...args.filter((arg) => arg !== "install")]);
3195
3214
  const scheduled = installTask();
3196
3215
  if (!json) {
3197
3216
  process.stdout.write(scheduled.ok ? ` Auto-update on \u2014 hourly task "MMI Fleet Updater".
@@ -3243,6 +3262,7 @@ if (typeof require !== "undefined" && require.main === module) {
3243
3262
  failConsequence,
3244
3263
  fleetStamp,
3245
3264
  formatReconcileReport,
3265
+ heldOutput,
3246
3266
  hermesArm,
3247
3267
  hermesHome,
3248
3268
  hermesHostCommand,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mutmutco/hub",
3
- "version": "4.3.10",
3
+ "version": "4.3.11",
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",