@mutmutco/installer-launcher 1.4.1 → 1.4.3

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.
package/dist/launcher.js CHANGED
@@ -2265,7 +2265,7 @@ async function refreshLauncher(target, options = {}) {
2265
2265
  }
2266
2266
 
2267
2267
  // src/index.ts
2268
- var LAUNCHER_VERSION = true ? "1.4.1" : readVersionFromPackage();
2268
+ var LAUNCHER_VERSION = true ? "1.4.3" : readVersionFromPackage();
2269
2269
  function defaultPrint(message) {
2270
2270
  process.stdout.write(`${message}
2271
2271
  `);
@@ -3070,6 +3070,22 @@ function within(fetchImpl, ms) {
3070
3070
  return ((input, init) => fetchImpl(input, { ...init, signal: AbortSignal.timeout(ms) }));
3071
3071
  }
3072
3072
  var STATUS_PROBE_MS = 3e3;
3073
+ function readBudget(cwd, env) {
3074
+ const command2 = process.platform === "win32" ? "mmi-cli.cmd" : "mmi-cli";
3075
+ const result = spawnSync4(command2, ["devops", "github", "budget", "--json"], {
3076
+ cwd,
3077
+ env,
3078
+ shell: needsShell(command2),
3079
+ encoding: "utf8",
3080
+ stdio: "pipe",
3081
+ timeout: 1e4,
3082
+ killSignal: "SIGKILL",
3083
+ windowsHide: true,
3084
+ maxBuffer: 64 * 1024
3085
+ });
3086
+ if (result.error || result.status !== 0) throw new Error("Budget unavailable");
3087
+ return result.stdout;
3088
+ }
3073
3089
  async function doStatus(config, dir, options, ui, print, json) {
3074
3090
  const fetchImpl = within(options.fetchImpl ?? fetch, STATUS_PROBE_MS);
3075
3091
  const local = localFacts(config, dir, options);
@@ -3077,12 +3093,22 @@ async function doStatus(config, dir, options, ui, print, json) {
3077
3093
  fetchReleaseVersion(config, fetchImpl),
3078
3094
  readLauncherRecord(launcherTarget(config), { fetch: fetchImpl, timeoutMs: STATUS_PROBE_MS })
3079
3095
  ]);
3096
+ let budget = null;
3097
+ const hub = config.product === "mmi" || config.product === "mmi-hub";
3098
+ if (hub && local.installed) {
3099
+ try {
3100
+ const parsed = JSON.parse((options.readBudget ?? readBudget)(payloadDir(dir), payloadEnv(dir) ?? process.env));
3101
+ if (typeof parsed?.line === "string" && parsed.line.startsWith("GitHub budget \xB7 ")) budget = parsed;
3102
+ } catch {
3103
+ }
3104
+ }
3080
3105
  const launcherNewer = record !== null && compareVersions(record.version, LAUNCHER_VERSION) > 0;
3081
3106
  const releaseOrder = local.installed && release ? compareVersions(release, local.installed) : null;
3082
3107
  const verdict = verdictFor(ui, local, launcherNewer || (releaseOrder ?? 0) > 0, `${ui.bin} doctor`);
3083
3108
  if (json) {
3084
3109
  print(JSON.stringify({
3085
3110
  product: config.product,
3111
+ ...hub ? { budget: budget ?? "unknown" } : {},
3086
3112
  launcher: { version: LAUNCHER_VERSION, available: launcherNewer ? record.version : null },
3087
3113
  installed: local.installed,
3088
3114
  release,
@@ -3096,7 +3122,13 @@ async function doStatus(config, dir, options, ui, print, json) {
3096
3122
  const launcherRow = record === null ? { surface: "launcher", state: `${LAUNCHER_VERSION} \xB7 ${SURFACE_WORDS.unknown}`, mark: "note" } : launcherNewer ? { surface: "launcher", state: `${LAUNCHER_VERSION} \u2192 ${record.version} \xB7 ${SURFACE_WORDS.behind}`, mark: "note" } : { surface: "launcher", state: `${LAUNCHER_VERSION} \xB7 ${SURFACE_WORDS.current}`, mark: "ok" };
3097
3123
  const productRow = !local.installed ? { surface: config.product, state: SURFACE_WORDS.missing, mark: "fail" } : releaseOrder === null ? { surface: config.product, state: `${local.installed} \xB7 ${SURFACE_WORDS.unknown}`, mark: "note" } : releaseOrder > 0 ? { surface: config.product, state: `${local.installed} \u2192 ${release} \xB7 ${SURFACE_WORDS.behind}`, mark: "note" } : releaseOrder < 0 ? { surface: config.product, state: `${local.installed} \xB7 ${SURFACE_WORDS.ahead}`, mark: "note" } : { surface: config.product, state: `${local.installed} \xB7 ${SURFACE_WORDS.current}`, mark: "ok" };
3098
3124
  ui.show(renderReport(ui.product, {
3099
- rows: [launcherRow, productRow, signInRow(local), autoUpdateRow(local.schedule)],
3125
+ rows: [
3126
+ launcherRow,
3127
+ productRow,
3128
+ signInRow(local),
3129
+ autoUpdateRow(local.schedule),
3130
+ ...hub ? (budget?.line ?? "unknown").split("\n").map((state) => ({ surface: "github", state, mark: state.includes("unknown") ? "note" : "ok" })) : []
3131
+ ],
3100
3132
  verdict: { ...verdict, facts: [release ? `The release is ${release}.` : "The release version could not be read."] }
3101
3133
  }, ui.render));
3102
3134
  return verdict.state === "fail" ? 1 : 0;
@@ -2298,7 +2298,7 @@ async function refreshLauncher(target, options = {}) {
2298
2298
  }
2299
2299
 
2300
2300
  // src/index.ts
2301
- var LAUNCHER_VERSION = true ? "1.4.1" : readVersionFromPackage();
2301
+ var LAUNCHER_VERSION = true ? "1.4.3" : readVersionFromPackage();
2302
2302
  function defaultPrint(message) {
2303
2303
  process.stdout.write(`${message}
2304
2304
  `);
@@ -3103,6 +3103,22 @@ function within(fetchImpl, ms) {
3103
3103
  return ((input, init) => fetchImpl(input, { ...init, signal: AbortSignal.timeout(ms) }));
3104
3104
  }
3105
3105
  var STATUS_PROBE_MS = 3e3;
3106
+ function readBudget(cwd, env) {
3107
+ const command2 = process.platform === "win32" ? "mmi-cli.cmd" : "mmi-cli";
3108
+ const result = (0, import_node_child_process5.spawnSync)(command2, ["devops", "github", "budget", "--json"], {
3109
+ cwd,
3110
+ env,
3111
+ shell: needsShell(command2),
3112
+ encoding: "utf8",
3113
+ stdio: "pipe",
3114
+ timeout: 1e4,
3115
+ killSignal: "SIGKILL",
3116
+ windowsHide: true,
3117
+ maxBuffer: 64 * 1024
3118
+ });
3119
+ if (result.error || result.status !== 0) throw new Error("Budget unavailable");
3120
+ return result.stdout;
3121
+ }
3106
3122
  async function doStatus(config, dir, options, ui, print, json) {
3107
3123
  const fetchImpl = within(options.fetchImpl ?? fetch, STATUS_PROBE_MS);
3108
3124
  const local = localFacts(config, dir, options);
@@ -3110,12 +3126,22 @@ async function doStatus(config, dir, options, ui, print, json) {
3110
3126
  fetchReleaseVersion(config, fetchImpl),
3111
3127
  readLauncherRecord(launcherTarget(config), { fetch: fetchImpl, timeoutMs: STATUS_PROBE_MS })
3112
3128
  ]);
3129
+ let budget = null;
3130
+ const hub = config.product === "mmi" || config.product === "mmi-hub";
3131
+ if (hub && local.installed) {
3132
+ try {
3133
+ const parsed = JSON.parse((options.readBudget ?? readBudget)(payloadDir(dir), payloadEnv(dir) ?? process.env));
3134
+ if (typeof parsed?.line === "string" && parsed.line.startsWith("GitHub budget \xB7 ")) budget = parsed;
3135
+ } catch {
3136
+ }
3137
+ }
3113
3138
  const launcherNewer = record !== null && compareVersions(record.version, LAUNCHER_VERSION) > 0;
3114
3139
  const releaseOrder = local.installed && release ? compareVersions(release, local.installed) : null;
3115
3140
  const verdict = verdictFor(ui, local, launcherNewer || (releaseOrder ?? 0) > 0, `${ui.bin} doctor`);
3116
3141
  if (json) {
3117
3142
  print(JSON.stringify({
3118
3143
  product: config.product,
3144
+ ...hub ? { budget: budget ?? "unknown" } : {},
3119
3145
  launcher: { version: LAUNCHER_VERSION, available: launcherNewer ? record.version : null },
3120
3146
  installed: local.installed,
3121
3147
  release,
@@ -3129,7 +3155,13 @@ async function doStatus(config, dir, options, ui, print, json) {
3129
3155
  const launcherRow = record === null ? { surface: "launcher", state: `${LAUNCHER_VERSION} \xB7 ${SURFACE_WORDS.unknown}`, mark: "note" } : launcherNewer ? { surface: "launcher", state: `${LAUNCHER_VERSION} \u2192 ${record.version} \xB7 ${SURFACE_WORDS.behind}`, mark: "note" } : { surface: "launcher", state: `${LAUNCHER_VERSION} \xB7 ${SURFACE_WORDS.current}`, mark: "ok" };
3130
3156
  const productRow = !local.installed ? { surface: config.product, state: SURFACE_WORDS.missing, mark: "fail" } : releaseOrder === null ? { surface: config.product, state: `${local.installed} \xB7 ${SURFACE_WORDS.unknown}`, mark: "note" } : releaseOrder > 0 ? { surface: config.product, state: `${local.installed} \u2192 ${release} \xB7 ${SURFACE_WORDS.behind}`, mark: "note" } : releaseOrder < 0 ? { surface: config.product, state: `${local.installed} \xB7 ${SURFACE_WORDS.ahead}`, mark: "note" } : { surface: config.product, state: `${local.installed} \xB7 ${SURFACE_WORDS.current}`, mark: "ok" };
3131
3157
  ui.show(renderReport(ui.product, {
3132
- rows: [launcherRow, productRow, signInRow(local), autoUpdateRow(local.schedule)],
3158
+ rows: [
3159
+ launcherRow,
3160
+ productRow,
3161
+ signInRow(local),
3162
+ autoUpdateRow(local.schedule),
3163
+ ...hub ? (budget?.line ?? "unknown").split("\n").map((state) => ({ surface: "github", state, mark: state.includes("unknown") ? "note" : "ok" })) : []
3164
+ ],
3133
3165
  verdict: { ...verdict, facts: [release ? `The release is ${release}.` : "The release version could not be read."] }
3134
3166
  }, ui.render));
3135
3167
  return verdict.state === "fail" ? 1 : 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mutmutco/installer-launcher",
3
- "version": "1.4.1",
3
+ "version": "1.4.3",
4
4
  "description": "Single-executable (SEA) launcher: sign-in, gated payload fetch, self-update. One copy ships per product.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",