@mutmutco/hub 4.4.15 → 4.4.17
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/index.cjs +81 -47
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -84,7 +84,7 @@ __export(index_exports, {
|
|
|
84
84
|
writePending: () => writePending
|
|
85
85
|
});
|
|
86
86
|
module.exports = __toCommonJS(index_exports);
|
|
87
|
-
var
|
|
87
|
+
var import_node_child_process10 = require("node:child_process");
|
|
88
88
|
var import_node_fs22 = require("node:fs");
|
|
89
89
|
var import_node_path13 = require("node:path");
|
|
90
90
|
|
|
@@ -210,15 +210,24 @@ function createFace({ product, color = false, columns, env = process.env, operat
|
|
|
210
210
|
const record = { v: PROGRESS_PROTOCOL, step: stripColor(title), state: kind };
|
|
211
211
|
if (typeof measure === "number") record.ms = Math.max(0, Math.round(measure * 1e3));
|
|
212
212
|
if (kind === "running" && typeof measure === "string") record.measure = measure;
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
213
|
+
const line = `${JSON.stringify(record)}
|
|
214
|
+
`;
|
|
215
|
+
if (progressFd !== null) {
|
|
216
|
+
try {
|
|
217
|
+
(0, import_node_fs.writeSync)(progressFd, line);
|
|
218
|
+
return true;
|
|
219
|
+
} catch {
|
|
220
|
+
}
|
|
221
221
|
}
|
|
222
|
+
if (progressFile) {
|
|
223
|
+
try {
|
|
224
|
+
(0, import_node_fs.appendFileSync)(progressFile, line);
|
|
225
|
+
return true;
|
|
226
|
+
} catch {
|
|
227
|
+
return false;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
return false;
|
|
222
231
|
};
|
|
223
232
|
const welcome = () => continuesFace || nested ? [] : [
|
|
224
233
|
`${paint(identity.accent, GLYPH.diamond)} ${paint(identity.accent, identity.name)} \u2014 Mutatis Mutandis`,
|
|
@@ -232,7 +241,7 @@ function createFace({ product, color = false, columns, env = process.env, operat
|
|
|
232
241
|
};
|
|
233
242
|
const step = (title, measure = null, kind = "ok") => {
|
|
234
243
|
if (emitMilestone(title, measure, kind)) return "";
|
|
235
|
-
const glyph = title === "Armed hourly updates" && kind === "ok" ? GLYPH.clock : kind === "fail" ? paint(identity.accent, GLYPH.cross) : kind === "note" ? paint(PALETTE.muted, GLYPH.dot) : paint(
|
|
244
|
+
const glyph = title === "Armed hourly updates" && kind === "ok" ? GLYPH.clock : kind === "fail" ? paint(identity.accent, GLYPH.cross) : kind === "note" ? paint(PALETTE.muted, GLYPH.dot) : paint(identity.accent, GLYPH.check);
|
|
236
245
|
const measured = measure === null || measure === void 0 ? "" : paint(PALETTE.muted, typeof measure === "number" ? `${Math.max(0, Math.round(measure))}s` : String(measure).trim());
|
|
237
246
|
const time = measured;
|
|
238
247
|
const column = Math.min(44, Math.max(0, width - 8));
|
|
@@ -253,7 +262,7 @@ function createFace({ product, color = false, columns, env = process.env, operat
|
|
|
253
262
|
const content = Math.min(width - 6, Math.max(...body.map(visibleWidth)));
|
|
254
263
|
const rule = paint(identity.accent, GLYPH.rule.repeat(content + 4));
|
|
255
264
|
const frame = (left, right) => `${paint(identity.accent, left)}${rule}${paint(identity.accent, right)}`;
|
|
256
|
-
const bodyRow = (line) => line.startsWith(GLYPH.check) ? `${paint(
|
|
265
|
+
const bodyRow = (line) => line.startsWith(GLYPH.check) ? `${paint(identity.accent, GLYPH.check)}${line.slice(1)}` : line;
|
|
257
266
|
return [
|
|
258
267
|
frame(GLYPH.boxTop, GLYPH.boxTopEnd),
|
|
259
268
|
...body.map((line) => `${paint(identity.accent, GLYPH.bar)} ${bodyRow(line)}${" ".repeat(Math.max(0, content - visibleWidth(line)))} ${paint(identity.accent, GLYPH.bar)}`),
|
|
@@ -284,16 +293,31 @@ var import_node_fs2 = require("node:fs");
|
|
|
284
293
|
var import_node_worker_threads = require("node:worker_threads");
|
|
285
294
|
|
|
286
295
|
// ../installer/face/src/encoding.ts
|
|
296
|
+
var import_node_child_process = require("node:child_process");
|
|
287
297
|
var UNICODE_SPINNER_FRAMES = Object.freeze(["\u25D2", "\u25D0", "\u25D3", "\u25D1"]);
|
|
288
298
|
var ASCII_SPINNER_FRAMES = Object.freeze(["-", "\\", "|", "/"]);
|
|
289
|
-
|
|
299
|
+
var cachedCodePage;
|
|
300
|
+
function consoleOutputCodePage() {
|
|
301
|
+
if (cachedCodePage !== void 0) return cachedCodePage;
|
|
302
|
+
cachedCodePage = null;
|
|
303
|
+
try {
|
|
304
|
+
const out = (0, import_node_child_process.execFileSync)("chcp.com", { windowsHide: true, encoding: "utf8", timeout: 5e3 });
|
|
305
|
+
const pages = [...String(out).matchAll(/(\d{3,5})/gu)].map((m) => Number(m[1]));
|
|
306
|
+
cachedCodePage = pages.length ? pages[pages.length - 1] : null;
|
|
307
|
+
} catch {
|
|
308
|
+
cachedCodePage = null;
|
|
309
|
+
}
|
|
310
|
+
return cachedCodePage;
|
|
311
|
+
}
|
|
312
|
+
function consoleRendersUnicode(env = process.env, platform = process.platform, codePage = platform === "win32" ? consoleOutputCodePage() : null) {
|
|
290
313
|
if (env.MM_FACE_ASCII === "1" || env.NO_UNICODE === "1") return false;
|
|
291
314
|
const locale = env.LC_ALL || env.LC_CTYPE || env.LANG || "";
|
|
292
315
|
if (locale === "C" || locale === "POSIX" || /^C\./u.test(locale) || /^POSIX\./u.test(locale)) return false;
|
|
293
316
|
if (/cp437|ibm437|\b437\b/iu.test(locale)) return false;
|
|
294
317
|
if (/utf-?8/iu.test(locale)) return true;
|
|
295
318
|
if (platform === "win32") {
|
|
296
|
-
|
|
319
|
+
if (env.WT_SESSION || env.ConEmuANSI === "ON") return true;
|
|
320
|
+
return codePage === 65001;
|
|
297
321
|
}
|
|
298
322
|
return true;
|
|
299
323
|
}
|
|
@@ -710,6 +734,7 @@ function createInstallerRun(value, options = {}) {
|
|
|
710
734
|
let chunkColumn = 0;
|
|
711
735
|
const trailingCR = /* @__PURE__ */ new Set();
|
|
712
736
|
let deferredActivity;
|
|
737
|
+
const drawnPhaseCompletions = /* @__PURE__ */ new Set();
|
|
713
738
|
const closeChunk = () => {
|
|
714
739
|
if (chunkOpen) emit("\n", chunkChannel);
|
|
715
740
|
chunkOpen = false;
|
|
@@ -756,11 +781,15 @@ function createInstallerRun(value, options = {}) {
|
|
|
756
781
|
const fold = operation === "update" && UPDATE_CHECK_PHASES.has(id) && state !== "fail";
|
|
757
782
|
const title = PHASES[fold ? "check" : id][state === "ok" ? 1 : 0];
|
|
758
783
|
if (state === "running") {
|
|
759
|
-
if (
|
|
760
|
-
|
|
784
|
+
if (facts.runningTitle !== void 0 && (typeof facts.runningTitle !== "string" || !facts.runningTitle.trim() || /[\r\n\x00-\x1f]/u.test(facts.runningTitle))) {
|
|
785
|
+
throw new Error("installer run: invalid runningTitle");
|
|
786
|
+
}
|
|
787
|
+
const runningTitle = facts.runningTitle?.trim() ?? title;
|
|
788
|
+
if (face.progress(runningTitle, facts.measure ?? null)) return;
|
|
789
|
+
if (activeTitle === runningTitle) spinner.say(runningTitle, facts.measure ?? null);
|
|
761
790
|
else {
|
|
762
|
-
activeTitle =
|
|
763
|
-
spinner.start(
|
|
791
|
+
activeTitle = runningTitle;
|
|
792
|
+
spinner.start(runningTitle, facts.measure ?? null);
|
|
764
793
|
}
|
|
765
794
|
return;
|
|
766
795
|
}
|
|
@@ -768,7 +797,10 @@ function createInstallerRun(value, options = {}) {
|
|
|
768
797
|
if (facts.detail) run.relay(facts.detail);
|
|
769
798
|
return;
|
|
770
799
|
}
|
|
771
|
-
if (!face.continues(id, state))
|
|
800
|
+
if (!face.continues(id, state)) {
|
|
801
|
+
durable(title, facts.seconds ?? facts.measure ?? null, state);
|
|
802
|
+
if (state === "ok") drawnPhaseCompletions.add(title);
|
|
803
|
+
}
|
|
772
804
|
if (facts.detail) run.relay(facts.detail);
|
|
773
805
|
},
|
|
774
806
|
surface(facts) {
|
|
@@ -799,7 +831,9 @@ function createInstallerRun(value, options = {}) {
|
|
|
799
831
|
}
|
|
800
832
|
return;
|
|
801
833
|
}
|
|
834
|
+
if (state !== "fail" && drawnPhaseCompletions.has(step)) return;
|
|
802
835
|
durable(step, ms === void 0 ? null : ms / 1e3, state);
|
|
836
|
+
if (state === "ok") drawnPhaseCompletions.add(step);
|
|
803
837
|
},
|
|
804
838
|
signIn({ url, code }) {
|
|
805
839
|
start();
|
|
@@ -1260,7 +1294,7 @@ function fileExists(path) {
|
|
|
1260
1294
|
var import_node_perf_hooks2 = require("node:perf_hooks");
|
|
1261
1295
|
|
|
1262
1296
|
// src/npm.ts
|
|
1263
|
-
var
|
|
1297
|
+
var import_node_child_process2 = require("node:child_process");
|
|
1264
1298
|
var import_node_fs6 = require("node:fs");
|
|
1265
1299
|
var import_node_path2 = require("node:path");
|
|
1266
1300
|
var cachedNpm = null;
|
|
@@ -1268,7 +1302,7 @@ function resolveNpm(env = process.env) {
|
|
|
1268
1302
|
if (env.MMI_UPDATER_NPM) return { kind: "command", command: env.MMI_UPDATER_NPM };
|
|
1269
1303
|
if (cachedNpm) return cachedNpm;
|
|
1270
1304
|
if (process.platform === "win32") {
|
|
1271
|
-
const where = (0,
|
|
1305
|
+
const where = (0, import_node_child_process2.spawnSync)("where.exe", ["npm.cmd"], { encoding: "utf8", windowsHide: true });
|
|
1272
1306
|
const first = where.stdout.split("\n").map((l) => l.trim()).find(Boolean);
|
|
1273
1307
|
if (where.status === 0 && first) {
|
|
1274
1308
|
const script = (0, import_node_path2.join)((0, import_node_path2.dirname)(first), "node_modules", "npm", "bin", "npm-cli.js");
|
|
@@ -1285,7 +1319,7 @@ function resolveNpm(env = process.env) {
|
|
|
1285
1319
|
cachedNpm = { kind: "node-script", script: bundled };
|
|
1286
1320
|
return cachedNpm;
|
|
1287
1321
|
}
|
|
1288
|
-
const located = (0,
|
|
1322
|
+
const located = (0, import_node_child_process2.spawnSync)("/bin/sh", ["-lc", "command -v npm"], { encoding: "utf8", windowsHide: true });
|
|
1289
1323
|
const resolved = (located.stdout ?? "").trim().split("\n").map((line) => line.trim()).find(Boolean);
|
|
1290
1324
|
if (located.status === 0 && resolved && (0, import_node_fs6.existsSync)(resolved)) {
|
|
1291
1325
|
cachedNpm = { kind: "command", command: resolved };
|
|
@@ -1296,7 +1330,7 @@ function resolveNpm(env = process.env) {
|
|
|
1296
1330
|
}
|
|
1297
1331
|
function runNpm(args, env = process.env, options = {}) {
|
|
1298
1332
|
const npm = resolveNpm(env);
|
|
1299
|
-
const result = npm.kind === "node-script" ? (0,
|
|
1333
|
+
const result = npm.kind === "node-script" ? (0, import_node_child_process2.spawnSync)(process.execPath, [npm.script, ...args], { encoding: "utf8", env, cwd: options.cwd, windowsHide: true }) : (0, import_node_child_process2.spawnSync)(npm.command, args, { encoding: "utf8", env, cwd: options.cwd, shell: process.platform === "win32", windowsHide: true });
|
|
1300
1334
|
return { status: result.status, stdout: result.stdout ?? "", stderr: result.stderr ?? "" };
|
|
1301
1335
|
}
|
|
1302
1336
|
function runNpmAsync(args, env = process.env, options = {}) {
|
|
@@ -1307,7 +1341,7 @@ function runNpmAsync(args, env = process.env, options = {}) {
|
|
|
1307
1341
|
let stderr = "";
|
|
1308
1342
|
let child;
|
|
1309
1343
|
try {
|
|
1310
|
-
child = (0,
|
|
1344
|
+
child = (0, import_node_child_process2.spawn)(file, argv, { env, cwd: options.cwd, windowsHide: true, shell });
|
|
1311
1345
|
} catch (error) {
|
|
1312
1346
|
resolve({ status: null, stdout, stderr: String(error?.message ?? error) });
|
|
1313
1347
|
return;
|
|
@@ -1368,7 +1402,7 @@ function npmVersions(packageName, env = process.env) {
|
|
|
1368
1402
|
}
|
|
1369
1403
|
|
|
1370
1404
|
// src/gate.ts
|
|
1371
|
-
var
|
|
1405
|
+
var import_node_child_process3 = require("node:child_process");
|
|
1372
1406
|
var import_node_fs7 = require("node:fs");
|
|
1373
1407
|
function parseBom(text) {
|
|
1374
1408
|
const bom = JSON.parse(text);
|
|
@@ -1383,16 +1417,16 @@ function npmPackRows(bom) {
|
|
|
1383
1417
|
var GateEnvError = class extends Error {
|
|
1384
1418
|
};
|
|
1385
1419
|
function git(cachePath, args) {
|
|
1386
|
-
const result = (0,
|
|
1420
|
+
const result = (0, import_node_child_process3.spawnSync)("git", ["-C", cachePath, ...args], { encoding: "utf8", windowsHide: true });
|
|
1387
1421
|
return { status: result.status, stdout: (result.stdout ?? "").trim(), stderr: result.stderr ?? "" };
|
|
1388
1422
|
}
|
|
1389
1423
|
function ensureBareCache(cachePath, repoUrl) {
|
|
1390
|
-
const probe = (0,
|
|
1424
|
+
const probe = (0, import_node_child_process3.spawnSync)("git", ["--version"], { encoding: "utf8", windowsHide: true });
|
|
1391
1425
|
if (probe.status !== 0) {
|
|
1392
1426
|
throw new GateEnvError("git is not available \u2014 the release gate needs a git client");
|
|
1393
1427
|
}
|
|
1394
1428
|
if (!(0, import_node_fs7.existsSync)(cachePath)) {
|
|
1395
|
-
const init = (0,
|
|
1429
|
+
const init = (0, import_node_child_process3.spawnSync)("git", ["init", "--bare", cachePath], { encoding: "utf8", windowsHide: true });
|
|
1396
1430
|
if (init.status !== 0) throw new GateEnvError(`cannot create bare cache at ${cachePath}: ${init.stderr}`);
|
|
1397
1431
|
}
|
|
1398
1432
|
}
|
|
@@ -1503,18 +1537,18 @@ var import_node_os3 = require("node:os");
|
|
|
1503
1537
|
var import_node_path7 = require("node:path");
|
|
1504
1538
|
|
|
1505
1539
|
// src/arm-host-plugins.ts
|
|
1506
|
-
var
|
|
1540
|
+
var import_node_child_process6 = require("node:child_process");
|
|
1507
1541
|
var import_node_fs11 = require("node:fs");
|
|
1508
1542
|
var import_node_os2 = require("node:os");
|
|
1509
1543
|
var import_node_path6 = require("node:path");
|
|
1510
1544
|
|
|
1511
1545
|
// src/arm-npm-global.ts
|
|
1512
1546
|
var import_node_fs9 = require("node:fs");
|
|
1513
|
-
var
|
|
1547
|
+
var import_node_child_process5 = require("node:child_process");
|
|
1514
1548
|
var import_node_path4 = require("node:path");
|
|
1515
1549
|
|
|
1516
1550
|
// src/pending.ts
|
|
1517
|
-
var
|
|
1551
|
+
var import_node_child_process4 = require("node:child_process");
|
|
1518
1552
|
var import_node_fs8 = require("node:fs");
|
|
1519
1553
|
var import_node_path3 = require("node:path");
|
|
1520
1554
|
function hubDistPath(env) {
|
|
@@ -1595,7 +1629,7 @@ function buildWatcherCommand(opts) {
|
|
|
1595
1629
|
return { file: "sh", args: ["-c", `${testBusy}; ${wait}; ${lock}; ${run}`] };
|
|
1596
1630
|
}
|
|
1597
1631
|
function defaultDetachSpawn(file, args) {
|
|
1598
|
-
const child = (0,
|
|
1632
|
+
const child = (0, import_node_child_process4.spawn)(file, [...args], {
|
|
1599
1633
|
detached: process.platform !== "win32",
|
|
1600
1634
|
stdio: "ignore",
|
|
1601
1635
|
windowsHide: true,
|
|
@@ -1662,7 +1696,7 @@ function globalDist(env, packageName, distRel) {
|
|
|
1662
1696
|
}
|
|
1663
1697
|
function probeVersion(distPath) {
|
|
1664
1698
|
if (!fileExists(distPath)) return null;
|
|
1665
|
-
const probe = (0,
|
|
1699
|
+
const probe = (0, import_node_child_process5.spawnSync)(process.execPath, [distPath, "--version"], { encoding: "utf8", windowsHide: true });
|
|
1666
1700
|
const version = (probe.stdout || "").trim();
|
|
1667
1701
|
return probe.status === 0 && /^\d+\.\d+\.\d+/.test(version) ? version : null;
|
|
1668
1702
|
}
|
|
@@ -1808,13 +1842,13 @@ function cmdArg(value) {
|
|
|
1808
1842
|
return /^[A-Za-z0-9_@./:\\=+-]+$/.test(value) ? value : `"${value.replaceAll('"', '""')}"`;
|
|
1809
1843
|
}
|
|
1810
1844
|
var runHostCommand = (command, args, env) => {
|
|
1811
|
-
const result = process.platform === "win32" ? (0,
|
|
1845
|
+
const result = process.platform === "win32" ? (0, import_node_child_process6.spawnSync)("cmd.exe", ["/d", "/s", "/c", [command, ...args].map(cmdArg).join(" ")], {
|
|
1812
1846
|
encoding: "utf8",
|
|
1813
1847
|
env,
|
|
1814
1848
|
input: "",
|
|
1815
1849
|
timeout: 12e4,
|
|
1816
1850
|
windowsHide: true
|
|
1817
|
-
}) : (0,
|
|
1851
|
+
}) : (0, import_node_child_process6.spawnSync)(command, args, {
|
|
1818
1852
|
encoding: "utf8",
|
|
1819
1853
|
env,
|
|
1820
1854
|
input: "",
|
|
@@ -1900,7 +1934,7 @@ function claudeProcessToken(line) {
|
|
|
1900
1934
|
return null;
|
|
1901
1935
|
}
|
|
1902
1936
|
function realClaudeProcessListing() {
|
|
1903
|
-
const result = process.platform === "win32" ? (0,
|
|
1937
|
+
const result = process.platform === "win32" ? (0, import_node_child_process6.spawnSync)("powershell.exe", ["-NoProfile", "-Command", "Get-CimInstance Win32_Process | ForEach-Object { $_.Name + ' ' + $_.CommandLine }"], { encoding: "utf8", windowsHide: true, timeout: 15e3 }) : (0, import_node_child_process6.spawnSync)("ps", ["-eo", "args="], { encoding: "utf8", windowsHide: true, timeout: 15e3 });
|
|
1904
1938
|
return result.status === 0 ? result.stdout ?? "" : null;
|
|
1905
1939
|
}
|
|
1906
1940
|
function claudeHostEvidence(env, processListProvider) {
|
|
@@ -2165,7 +2199,7 @@ function enumerateSurfaces(env = process.env) {
|
|
|
2165
2199
|
|
|
2166
2200
|
// src/arm-cursor.ts
|
|
2167
2201
|
var import_node_fs15 = require("node:fs");
|
|
2168
|
-
var
|
|
2202
|
+
var import_node_child_process7 = require("node:child_process");
|
|
2169
2203
|
var import_node_os5 = require("node:os");
|
|
2170
2204
|
var import_node_path8 = require("node:path");
|
|
2171
2205
|
|
|
@@ -2348,7 +2382,7 @@ function cursorHostEvidence(env) {
|
|
|
2348
2382
|
if (env[marker]?.trim()) return `env marker ${marker}`;
|
|
2349
2383
|
}
|
|
2350
2384
|
if (env.CURSOR_AGENT === "1") return "env marker CURSOR_AGENT=1";
|
|
2351
|
-
const result = process.platform === "win32" ? (0,
|
|
2385
|
+
const result = process.platform === "win32" ? (0, import_node_child_process7.spawnSync)("powershell.exe", ["-NoProfile", "-Command", "Get-CimInstance Win32_Process | ForEach-Object { $_.CommandLine }"], { encoding: "utf8", windowsHide: true, timeout: 15e3 }) : (0, import_node_child_process7.spawnSync)("ps", ["-eo", "args="], { encoding: "utf8", windowsHide: true, timeout: 15e3 });
|
|
2352
2386
|
if (result.status !== 0 || !(result.stdout ?? "").trim()) return "the process table is unreadable (unsafe to write)";
|
|
2353
2387
|
for (const line of result.stdout.split(/\r?\n/)) {
|
|
2354
2388
|
const executable = cursorExecutable(line);
|
|
@@ -2745,7 +2779,7 @@ function jervcodeArm(options) {
|
|
|
2745
2779
|
|
|
2746
2780
|
// src/arm-hermes.ts
|
|
2747
2781
|
var import_node_fs17 = require("node:fs");
|
|
2748
|
-
var
|
|
2782
|
+
var import_node_child_process8 = require("node:child_process");
|
|
2749
2783
|
var import_node_path10 = require("node:path");
|
|
2750
2784
|
var PACKAGE2 = "@mutmutco/hermes-plugin";
|
|
2751
2785
|
var MANIFEST2 = "plugin.yaml";
|
|
@@ -2831,7 +2865,7 @@ function hermesProcessToken(line, home) {
|
|
|
2831
2865
|
return hermesToken(tokens) ?? (home && normalized.toLowerCase().includes(home.toLowerCase()) ? home : null);
|
|
2832
2866
|
}
|
|
2833
2867
|
function realProcessListing() {
|
|
2834
|
-
const result = process.platform === "win32" ? (0,
|
|
2868
|
+
const result = process.platform === "win32" ? (0, import_node_child_process8.spawnSync)("powershell.exe", ["-NoProfile", "-Command", "Get-CimInstance Win32_Process | ForEach-Object { $_.Name + ' ' + $_.CommandLine }"], { encoding: "utf8", windowsHide: true, timeout: 15e3 }) : (0, import_node_child_process8.spawnSync)("ps", ["-eo", "args="], { encoding: "utf8", windowsHide: true, timeout: 15e3 });
|
|
2835
2869
|
return result.status === 0 ? result.stdout ?? "" : null;
|
|
2836
2870
|
}
|
|
2837
2871
|
function hermesHostEvidence(env, home, processListProvider) {
|
|
@@ -3346,7 +3380,7 @@ async function reconcile(options) {
|
|
|
3346
3380
|
}
|
|
3347
3381
|
|
|
3348
3382
|
// src/scheduler.ts
|
|
3349
|
-
var
|
|
3383
|
+
var import_node_child_process9 = require("node:child_process");
|
|
3350
3384
|
var import_node_fs19 = require("node:fs");
|
|
3351
3385
|
var import_node_os6 = require("node:os");
|
|
3352
3386
|
var import_node_path12 = require("node:path");
|
|
@@ -3365,15 +3399,15 @@ var SYSTEMD_UNIT = "mmi-hub-updater";
|
|
|
3365
3399
|
var SYSTEMD_SERVICE_NAME = `${SYSTEMD_UNIT}.service`;
|
|
3366
3400
|
var SYSTEMD_TIMER_NAME = `${SYSTEMD_UNIT}.timer`;
|
|
3367
3401
|
function schtasks(args) {
|
|
3368
|
-
const result = (0,
|
|
3402
|
+
const result = (0, import_node_child_process9.spawnSync)("schtasks.exe", args, { encoding: "utf8", windowsHide: true });
|
|
3369
3403
|
return { status: result.status, stdout: result.stdout ?? "", stderr: result.stderr ?? "" };
|
|
3370
3404
|
}
|
|
3371
3405
|
function launchctl(args) {
|
|
3372
|
-
const result = (0,
|
|
3406
|
+
const result = (0, import_node_child_process9.spawnSync)("launchctl", args, { encoding: "utf8", windowsHide: true });
|
|
3373
3407
|
return { status: result.status, stdout: result.stdout ?? "", stderr: result.stderr ?? "" };
|
|
3374
3408
|
}
|
|
3375
3409
|
function systemctlUser(args) {
|
|
3376
|
-
const result = (0,
|
|
3410
|
+
const result = (0, import_node_child_process9.spawnSync)("systemctl", ["--user", ...args], { encoding: "utf8", windowsHide: true });
|
|
3377
3411
|
return { status: result.status, stdout: result.stdout ?? "", stderr: result.stderr ?? "" };
|
|
3378
3412
|
}
|
|
3379
3413
|
function uid() {
|
|
@@ -3398,7 +3432,7 @@ WScript.Quit code
|
|
|
3398
3432
|
`;
|
|
3399
3433
|
}
|
|
3400
3434
|
function loginPath(fallback = process.env.PATH ?? "") {
|
|
3401
|
-
const probe = (0,
|
|
3435
|
+
const probe = (0, import_node_child_process9.spawnSync)("/bin/sh", ["-lc", 'printf %s "$PATH"'], { encoding: "utf8", windowsHide: true, timeout: 1e4 });
|
|
3402
3436
|
const captured = (probe.status === 0 ? probe.stdout ?? "" : "").trim();
|
|
3403
3437
|
const source = captured || fallback;
|
|
3404
3438
|
const durable = source.split(":").filter((entry) => entry && !/^\/(?:private\/)?(?:tmp|var\/folders)\//.test(entry));
|
|
@@ -3519,7 +3553,7 @@ function elevatedRelaunch(mode, env) {
|
|
|
3519
3553
|
if (env.MMI_UPDATER_ELEVATED_RETRY === "1") return false;
|
|
3520
3554
|
const self = process.argv[1];
|
|
3521
3555
|
const command = self ? `"${process.execPath}" "${self}" autoupdate ${mode}` : `mmi-hub autoupdate ${mode}`;
|
|
3522
|
-
const relaunch = (0,
|
|
3556
|
+
const relaunch = (0, import_node_child_process9.spawnSync)(
|
|
3523
3557
|
"powershell.exe",
|
|
3524
3558
|
["-NoProfile", "-Command", `Start-Process -Verb RunAs -Wait -WindowStyle Hidden -FilePath 'cmd.exe' -ArgumentList '/c',${psQuote(`set MMI_UPDATER_ELEVATED_RETRY=1&& ${command}`)}`],
|
|
3525
3559
|
{ encoding: "utf8", windowsHide: true }
|
|
@@ -3530,7 +3564,7 @@ var NEVER_RUN_RESULT = 267011;
|
|
|
3530
3564
|
var NEVER_RUN_YEAR = 1999;
|
|
3531
3565
|
var EMPTY_RUN_INFO = { lastRunTime: null, lastTaskResult: null, nextRunTime: null };
|
|
3532
3566
|
function taskRunInfo() {
|
|
3533
|
-
const result = (0,
|
|
3567
|
+
const result = (0, import_node_child_process9.spawnSync)(
|
|
3534
3568
|
"powershell.exe",
|
|
3535
3569
|
["-NoProfile", "-Command", `$stamp = { param($t) if ($t) { $t.ToString('yyyy-MM-dd HH:mm:ss') } }; Get-ScheduledTaskInfo -TaskName '${TASK_NAME}' | Select-Object @{n='LastRunTime';e={& $stamp $_.LastRunTime}},LastTaskResult,@{n='NextRunTime';e={& $stamp $_.NextRunTime}} | ConvertTo-Json -Compress`],
|
|
3536
3570
|
{ encoding: "utf8", windowsHide: true, timeout: 3e4 }
|
|
@@ -4051,7 +4085,7 @@ State remains under $MMI_UPDATER_HOME (default ~/.mmi/updater), and the Windows
|
|
|
4051
4085
|
"MMI Fleet Updater", so existing installations continue in place.
|
|
4052
4086
|
Status performs no npm install, host repair, scheduler write, state mkdir, or repository cleanup.`;
|
|
4053
4087
|
function handOff(reexec, args, env) {
|
|
4054
|
-
const child = (0,
|
|
4088
|
+
const child = (0, import_node_child_process10.spawnSync)(process.execPath, [reexec.dist, ...args], {
|
|
4055
4089
|
stdio: "inherit",
|
|
4056
4090
|
windowsHide: true,
|
|
4057
4091
|
env: { ...env, MMI_UPDATER_REEXEC: "1" }
|
package/package.json
CHANGED