@tacuchi/updater 2.1.1 → 2.2.1
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/cli.js +146 -33
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -576,6 +576,10 @@ function addToMemory(level, message) {
|
|
|
576
576
|
inMemoryLog.push({ id, timestamp, level, message });
|
|
577
577
|
if (inMemoryLog.length > 200) inMemoryLog.shift();
|
|
578
578
|
}
|
|
579
|
+
function warn(message) {
|
|
580
|
+
writeRaw("WARN", message);
|
|
581
|
+
addToMemory("warn", message);
|
|
582
|
+
}
|
|
579
583
|
function error(message) {
|
|
580
584
|
writeRaw("ERROR", message);
|
|
581
585
|
addToMemory("error", message);
|
|
@@ -589,17 +593,42 @@ function logCommand(rec) {
|
|
|
589
593
|
}
|
|
590
594
|
addToMemory("debug", `$ ${rec.cmd} (${status})`);
|
|
591
595
|
}
|
|
596
|
+
function formatResultLines(r) {
|
|
597
|
+
const id = r.managerId ?? "?";
|
|
598
|
+
const reason = r.reason ? ` reason=${r.reason}` : "";
|
|
599
|
+
const reboot = r.reboot ? ` reboot=${r.reboot}` : "";
|
|
600
|
+
const lines = [`${id}: status=${r.status} upgraded=${r.upgraded} failed=${r.failed}${reason}${reboot}`];
|
|
601
|
+
if (r.startedAt !== void 0 && r.finishedAt !== void 0) {
|
|
602
|
+
lines.push(` ${id}: duration=${r.finishedAt - r.startedAt}ms`);
|
|
603
|
+
}
|
|
604
|
+
for (const p of r.packages ?? []) {
|
|
605
|
+
const ver = p.fromVersion || p.toVersion ? ` ${p.fromVersion ?? "?"}->${p.toVersion ?? "?"}` : "";
|
|
606
|
+
lines.push(` ${id}: ${p.name}${ver} [${p.outcome}]`);
|
|
607
|
+
}
|
|
608
|
+
return lines;
|
|
609
|
+
}
|
|
592
610
|
function logResult(r) {
|
|
593
611
|
const id = r.managerId ?? "?";
|
|
594
612
|
const ok = r.status === "success" || r.status === "noop";
|
|
595
613
|
const level = ok ? "INFO" : r.status === "partial" ? "WARN" : "ERROR";
|
|
596
|
-
const
|
|
597
|
-
const reboot = r.reboot ? ` reboot=${r.reboot}` : "";
|
|
598
|
-
writeRaw(level, `${id}: status=${r.status} upgraded=${r.upgraded} failed=${r.failed}${reason}${reboot}`);
|
|
614
|
+
for (const line of formatResultLines(r)) writeRaw(level, line);
|
|
599
615
|
for (const e of r.errors) writeRaw(level, ` ${id}: ${e}`);
|
|
600
616
|
const memLevel = ok ? "info" : r.status === "partial" ? "warn" : "error";
|
|
601
617
|
addToMemory(memLevel, `${id}: ${r.status} (${r.upgraded} ok, ${r.failed} fail)`);
|
|
602
618
|
}
|
|
619
|
+
function formatRunSummary(s) {
|
|
620
|
+
const lines = ["\u2500\u2500\u2500\u2500 Resumen del run \u2500\u2500\u2500\u2500"];
|
|
621
|
+
for (const m of s.managers) {
|
|
622
|
+
const dur = m.durationMs !== void 0 ? ` ${m.durationMs}ms` : "";
|
|
623
|
+
lines.push(` ${m.id}: ${m.status} (${m.upgraded} ok, ${m.failed} fail)${dur}`);
|
|
624
|
+
}
|
|
625
|
+
lines.push(`Total: ${s.upgraded} upgraded \xB7 ${s.failed} failed \xB7 ${s.skipped} skipped`);
|
|
626
|
+
return lines;
|
|
627
|
+
}
|
|
628
|
+
function logRunSummary(s) {
|
|
629
|
+
for (const line of formatRunSummary(s)) writeRaw("INFO", line);
|
|
630
|
+
addToMemory("info", `Resumen: ${s.upgraded} ok \xB7 ${s.failed} fail \xB7 ${s.skipped} skip`);
|
|
631
|
+
}
|
|
603
632
|
function getLogFilePath() {
|
|
604
633
|
return logFilePath;
|
|
605
634
|
}
|
|
@@ -736,7 +765,23 @@ async function verifySnapshot(d, c, deps, manager, _requested) {
|
|
|
736
765
|
return { stillOutdated: still.map((p) => ({ name: p.name, currentVersion: p.currentVersion, newVersion: p.newVersion })) };
|
|
737
766
|
}
|
|
738
767
|
|
|
768
|
+
// src/lib/exec/percent.ts
|
|
769
|
+
function clamp(n) {
|
|
770
|
+
return Math.max(0, Math.min(100, n));
|
|
771
|
+
}
|
|
772
|
+
function makeFractionParser(re) {
|
|
773
|
+
return (line) => {
|
|
774
|
+
const m = line.match(re);
|
|
775
|
+
if (!m) return void 0;
|
|
776
|
+
const num = Number(m[1]);
|
|
777
|
+
const den = Number(m[2]);
|
|
778
|
+
if (!den || Number.isNaN(num) || Number.isNaN(den)) return void 0;
|
|
779
|
+
return clamp(Math.round(num / den * 100));
|
|
780
|
+
};
|
|
781
|
+
}
|
|
782
|
+
|
|
739
783
|
// src/managers/descriptors/brew.ts
|
|
784
|
+
var brewUpgradePercent = makeFractionParser(/Upgrading (\d+)\/(\d+)/);
|
|
740
785
|
function parseBrewOutdated(stdout) {
|
|
741
786
|
try {
|
|
742
787
|
const data = JSON.parse(stdout);
|
|
@@ -764,7 +809,8 @@ var brew = {
|
|
|
764
809
|
parseOutdated: (stdout) => parseBrewOutdated(stdout),
|
|
765
810
|
preUpgradeCmds: () => [{ cmd: "brew", args: ["update"] }],
|
|
766
811
|
upgradeCmd: (pkgs) => ({ cmd: "brew", args: pkgs && pkgs.length ? ["upgrade", ...pkgs] : ["upgrade"] }),
|
|
767
|
-
postUpgradeCmds: () => [{ cmd: "brew", args: ["cleanup"] }]
|
|
812
|
+
postUpgradeCmds: () => [{ cmd: "brew", args: ["cleanup"] }],
|
|
813
|
+
percentParser: (line) => brewUpgradePercent(line)
|
|
768
814
|
};
|
|
769
815
|
|
|
770
816
|
// src/lib/exec/capabilities.ts
|
|
@@ -794,6 +840,9 @@ async function pythonModuleCmd() {
|
|
|
794
840
|
return null;
|
|
795
841
|
});
|
|
796
842
|
}
|
|
843
|
+
async function resolvedInvocation() {
|
|
844
|
+
return once("pip:invocation", async () => pipInvocation(await pythonModuleCmd()));
|
|
845
|
+
}
|
|
797
846
|
function parsePipOutdated(stdout) {
|
|
798
847
|
try {
|
|
799
848
|
const data = JSON.parse(stdout);
|
|
@@ -804,14 +853,15 @@ function parsePipOutdated(stdout) {
|
|
|
804
853
|
}
|
|
805
854
|
async function pep668Flags() {
|
|
806
855
|
return once("pip:pep668", async () => {
|
|
807
|
-
const cmd =
|
|
808
|
-
const probe = await execCommand(cmd, ["install", "--user", "--dry-run", "pip"], 5e3);
|
|
856
|
+
const { cmd, baseArgs } = await resolvedInvocation();
|
|
857
|
+
const probe = await execCommand(cmd, [...baseArgs, "install", "--user", "--dry-run", "pip"], 5e3);
|
|
809
858
|
const managed = (probe.stdout + probe.stderr).includes("externally-managed");
|
|
810
859
|
return managed ? ["--break-system-packages"] : [];
|
|
811
860
|
});
|
|
812
861
|
}
|
|
813
862
|
async function listOutdated() {
|
|
814
|
-
const
|
|
863
|
+
const { cmd, baseArgs } = await resolvedInvocation();
|
|
864
|
+
const res = await execCommand(cmd, [...baseArgs, "list", "--outdated", "--format=json"], 3e4);
|
|
815
865
|
if (res.exitCode !== 0) return [];
|
|
816
866
|
return parsePipOutdated(res.stdout);
|
|
817
867
|
}
|
|
@@ -823,17 +873,17 @@ var pip = {
|
|
|
823
873
|
kind: "direct",
|
|
824
874
|
detectCmd: { cmd: pipCmd(), args: ["--version"], timeout: 3e3 },
|
|
825
875
|
parseVersion: (stdout) => stdout.match(/pip (\S+)/)?.[1],
|
|
826
|
-
listOutdatedCmd: () => ({ cmd: pipCmd(), args: ["list", "--outdated", "--format=json"] }),
|
|
827
|
-
parseOutdated: (stdout) => parsePipOutdated(stdout),
|
|
828
876
|
// Escape hatch: pip needs a cached PEP 668 probe and a single bulk install
|
|
829
877
|
// (the old code looped one `pip install` per package — the main slowness).
|
|
878
|
+
// No declarative listOutdatedCmd: the engine prefers escapeHatch.listOutdated,
|
|
879
|
+
// and listing MUST share the upgrade's interpreter (resolvedInvocation).
|
|
830
880
|
escapeHatch: {
|
|
831
881
|
listOutdated,
|
|
832
882
|
async *upgrade(packages, ctx) {
|
|
833
883
|
yield { type: "phase", phase: "upgrading", message: "Actualizando pip..." };
|
|
834
884
|
const flags = await pep668Flags();
|
|
835
885
|
if (flags.length) yield { type: "log", message: "Entorno PEP 668: usando --break-system-packages" };
|
|
836
|
-
const { cmd, baseArgs } =
|
|
886
|
+
const { cmd, baseArgs } = await resolvedInvocation();
|
|
837
887
|
const before = await listOutdated();
|
|
838
888
|
const target = packages && packages.length ? packages : before.map((p) => p.name);
|
|
839
889
|
const commands = [];
|
|
@@ -1087,7 +1137,12 @@ var winget = {
|
|
|
1087
1137
|
if (!targets.length) {
|
|
1088
1138
|
yield* run(["upgrade", "--all", "--include-unknown", "--include-pinned", ...UPGRADE_FLAGS]);
|
|
1089
1139
|
} else {
|
|
1090
|
-
|
|
1140
|
+
const n = targets.length;
|
|
1141
|
+
for (let i = 0; i < n; i++) {
|
|
1142
|
+
const id = targets[i];
|
|
1143
|
+
yield* run(["upgrade", "--exact", "--id", id, "--include-unknown", ...UPGRADE_FLAGS]);
|
|
1144
|
+
yield { type: "progress", message: `(${i + 1}/${n}) ${id}`, percent: Math.round((i + 1) / n * 100) };
|
|
1145
|
+
}
|
|
1091
1146
|
}
|
|
1092
1147
|
yield { type: "phase", phase: "verifying", message: "Verificando resultado..." };
|
|
1093
1148
|
const after = await listWinget();
|
|
@@ -1124,6 +1179,7 @@ var apt = {
|
|
|
1124
1179
|
};
|
|
1125
1180
|
|
|
1126
1181
|
// src/managers/descriptors/dnf.ts
|
|
1182
|
+
var dnfVerifyPercent = makeFractionParser(/Verifying\s*:\s*(\d+)\/(\d+)/);
|
|
1127
1183
|
function parseDnfOutdated(stdout) {
|
|
1128
1184
|
return stdout.split("\n").filter((l) => l.trim() && !l.startsWith("Last") && !l.startsWith("Obsoleting")).map((line) => {
|
|
1129
1185
|
const cols = line.trim().split(/\s+/);
|
|
@@ -1150,7 +1206,8 @@ var dnf = {
|
|
|
1150
1206
|
// Single bulk upgrade; the engine runs it under sudo when sudoMode is on and
|
|
1151
1207
|
// shows manualCommand otherwise.
|
|
1152
1208
|
upgradeCmd: () => ({ cmd: "dnf", args: ["upgrade", "-y"] }),
|
|
1153
|
-
manualCommand: () => "sudo dnf upgrade"
|
|
1209
|
+
manualCommand: () => "sudo dnf upgrade",
|
|
1210
|
+
percentParser: (line) => dnfVerifyPercent(line)
|
|
1154
1211
|
};
|
|
1155
1212
|
|
|
1156
1213
|
// src/managers/descriptors/pacman.ts
|
|
@@ -2785,7 +2842,16 @@ function toManagerResult(r, logRef) {
|
|
|
2785
2842
|
skipped: r.skipped ?? 0,
|
|
2786
2843
|
failures,
|
|
2787
2844
|
manualCommand: r.manualCommand,
|
|
2788
|
-
reboot: r.reboot
|
|
2845
|
+
reboot: r.reboot,
|
|
2846
|
+
// Keep the per-package detail + engine timings the Summary needs (previously discarded).
|
|
2847
|
+
packages: r.packages?.map((p) => ({
|
|
2848
|
+
name: p.name,
|
|
2849
|
+
outcome: p.outcome,
|
|
2850
|
+
fromVersion: p.fromVersion,
|
|
2851
|
+
toVersion: p.toVersion
|
|
2852
|
+
})),
|
|
2853
|
+
startedAt: r.startedAt,
|
|
2854
|
+
finishedAt: r.finishedAt
|
|
2789
2855
|
};
|
|
2790
2856
|
}
|
|
2791
2857
|
function summarizeRun(state) {
|
|
@@ -2801,11 +2867,13 @@ function summarizeRun(state) {
|
|
|
2801
2867
|
managers.push({ id, status: "skipped", upgraded: 0, failed: 0 });
|
|
2802
2868
|
continue;
|
|
2803
2869
|
}
|
|
2804
|
-
const
|
|
2805
|
-
const
|
|
2870
|
+
const r = e.result;
|
|
2871
|
+
const u = r?.upgraded ?? 0;
|
|
2872
|
+
const f = r?.failed ?? 0;
|
|
2806
2873
|
upgraded += u;
|
|
2807
2874
|
failed += f;
|
|
2808
|
-
|
|
2875
|
+
const durationMs = r?.startedAt !== void 0 && r?.finishedAt !== void 0 ? r.finishedAt - r.startedAt : void 0;
|
|
2876
|
+
managers.push({ id, status: e.status, upgraded: u, failed: f, durationMs, packages: r?.packages });
|
|
2809
2877
|
}
|
|
2810
2878
|
return { upgraded, failed, skipped, managers };
|
|
2811
2879
|
}
|
|
@@ -2984,6 +3052,10 @@ function useAppMachine(sudoMode2, nonInteractive2 = false) {
|
|
|
2984
3052
|
} catch {
|
|
2985
3053
|
}
|
|
2986
3054
|
}, [state.phase]);
|
|
3055
|
+
useEffect(() => {
|
|
3056
|
+
if (state.phase !== "summary") return;
|
|
3057
|
+
logRunSummary(summarizeRun(state));
|
|
3058
|
+
}, [state.phase]);
|
|
2987
3059
|
const relaunch = useCallback(() => {
|
|
2988
3060
|
void (async () => {
|
|
2989
3061
|
const ok = await relaunchElevated();
|
|
@@ -3152,6 +3224,10 @@ var ASCII_GLYPHS = {
|
|
|
3152
3224
|
};
|
|
3153
3225
|
var ASCII = shouldUseAscii(process.env, process.platform);
|
|
3154
3226
|
var g = ASCII ? ASCII_GLYPHS : UNICODE;
|
|
3227
|
+
var NO_ANIM = ASCII || !process.stdout.isTTY;
|
|
3228
|
+
var SPINNER_UNICODE = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
3229
|
+
var SPINNER_ASCII = ["|", "/", "-", "\\"];
|
|
3230
|
+
var spinnerFrames = ASCII ? SPINNER_ASCII : SPINNER_UNICODE;
|
|
3155
3231
|
|
|
3156
3232
|
// src/components/step-header.tsx
|
|
3157
3233
|
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
@@ -3197,6 +3273,7 @@ function StepHeader({ phase }) {
|
|
|
3197
3273
|
}
|
|
3198
3274
|
|
|
3199
3275
|
// src/components/status-glyph.tsx
|
|
3276
|
+
import { useEffect as useEffect2, useState } from "react";
|
|
3200
3277
|
import { Text as Text2 } from "ink";
|
|
3201
3278
|
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
3202
3279
|
var SPECS = {
|
|
@@ -3217,6 +3294,16 @@ function StatusGlyph({ status }) {
|
|
|
3217
3294
|
const spec = SPECS[status];
|
|
3218
3295
|
return /* @__PURE__ */ jsx3(Text2, { color: spec.color, children: spec.glyph });
|
|
3219
3296
|
}
|
|
3297
|
+
function RunningGlyph() {
|
|
3298
|
+
const [i, setI] = useState(0);
|
|
3299
|
+
useEffect2(() => {
|
|
3300
|
+
if (NO_ANIM) return;
|
|
3301
|
+
const t3 = setInterval(() => setI((n) => (n + 1) % spinnerFrames.length), 90);
|
|
3302
|
+
return () => clearInterval(t3);
|
|
3303
|
+
}, []);
|
|
3304
|
+
const frame = NO_ANIM ? g.running : spinnerFrames[i] ?? g.running;
|
|
3305
|
+
return /* @__PURE__ */ jsx3(Text2, { color: SPECS.running.color, children: frame });
|
|
3306
|
+
}
|
|
3220
3307
|
|
|
3221
3308
|
// src/screens/detect.tsx
|
|
3222
3309
|
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
@@ -3257,7 +3344,7 @@ function DetectScreen() {
|
|
|
3257
3344
|
}
|
|
3258
3345
|
|
|
3259
3346
|
// src/screens/select.tsx
|
|
3260
|
-
import { useState } from "react";
|
|
3347
|
+
import { useState as useState2 } from "react";
|
|
3261
3348
|
import { Box as Box3, Text as Text4 } from "ink";
|
|
3262
3349
|
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
3263
3350
|
function clip(s, n) {
|
|
@@ -3265,7 +3352,7 @@ function clip(s, n) {
|
|
|
3265
3352
|
}
|
|
3266
3353
|
function SelectScreen() {
|
|
3267
3354
|
const { state, toggleItem, selectAll, selectNone, goConfirm, openSettings } = useMachine();
|
|
3268
|
-
const [cursor, setCursor] =
|
|
3355
|
+
const [cursor, setCursor] = useState2(0);
|
|
3269
3356
|
const rows = [];
|
|
3270
3357
|
for (const id of state.order) {
|
|
3271
3358
|
const m = state.managers[id];
|
|
@@ -3403,7 +3490,7 @@ function Row({ e, width }) {
|
|
|
3403
3490
|
else if (e.status === "skipped") detail = e.manualCommand ?? "manual";
|
|
3404
3491
|
else if (e.status === "failed") detail = e.result?.failures[0]?.message ?? "";
|
|
3405
3492
|
return /* @__PURE__ */ jsxs5(Box5, { children: [
|
|
3406
|
-
/* @__PURE__ */ jsx7(Box5, { width: 2, children: /* @__PURE__ */ jsx7(StatusGlyph, { status: e.status }) }),
|
|
3493
|
+
/* @__PURE__ */ jsx7(Box5, { width: 2, children: e.status === "running" ? /* @__PURE__ */ jsx7(RunningGlyph, {}) : /* @__PURE__ */ jsx7(StatusGlyph, { status: e.status }) }),
|
|
3407
3494
|
/* @__PURE__ */ jsx7(Box5, { width: 16, children: /* @__PURE__ */ jsx7(Text6, { color: semantic.text, bold: e.status === "running", children: clip2(managerName(e.id), 15) }) }),
|
|
3408
3495
|
/* @__PURE__ */ jsx7(Box5, { width: 13, children: /* @__PURE__ */ jsx7(Text6, { color: statusColor(e.status), children: t("status", e.status) }) }),
|
|
3409
3496
|
/* @__PURE__ */ jsx7(Text6, { color: semantic.muted, children: clip2(detail, Math.max(0, width - 33)) })
|
|
@@ -3458,14 +3545,42 @@ function UpdateScreen() {
|
|
|
3458
3545
|
// src/screens/summary.tsx
|
|
3459
3546
|
import { Box as Box6, Text as Text7 } from "ink";
|
|
3460
3547
|
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
3548
|
+
function versionDelta(m) {
|
|
3549
|
+
const ups = (m.packages ?? []).filter((p2) => p2.outcome === "upgraded" && p2.toVersion);
|
|
3550
|
+
if (ups.length !== 1) return "";
|
|
3551
|
+
const p = ups[0];
|
|
3552
|
+
return p.fromVersion ? `${p.name} ${p.fromVersion} ${g.arrow} ${p.toVersion}` : `${p.name} ${g.arrow} ${p.toVersion}`;
|
|
3553
|
+
}
|
|
3554
|
+
function ManagerRow({ m }) {
|
|
3555
|
+
const dur = m.durationMs !== void 0 ? `${(m.durationMs / 1e3).toFixed(1)}s` : "";
|
|
3556
|
+
return /* @__PURE__ */ jsxs6(Box6, { children: [
|
|
3557
|
+
/* @__PURE__ */ jsx8(Box6, { width: 2, children: /* @__PURE__ */ jsx8(StatusGlyph, { status: m.status }) }),
|
|
3558
|
+
/* @__PURE__ */ jsx8(Box6, { width: 14, children: /* @__PURE__ */ jsx8(Text7, { color: semantic.text, wrap: "truncate-end", children: managerName(m.id) }) }),
|
|
3559
|
+
/* @__PURE__ */ jsxs6(Box6, { width: 9, children: [
|
|
3560
|
+
m.upgraded > 0 ? /* @__PURE__ */ jsxs6(Text7, { color: semantic.success, children: [
|
|
3561
|
+
g.done,
|
|
3562
|
+
" ",
|
|
3563
|
+
m.upgraded
|
|
3564
|
+
] }) : null,
|
|
3565
|
+
m.failed > 0 ? /* @__PURE__ */ jsxs6(Text7, { color: semantic.error, children: [
|
|
3566
|
+
" ",
|
|
3567
|
+
g.failed,
|
|
3568
|
+
" ",
|
|
3569
|
+
m.failed
|
|
3570
|
+
] }) : null
|
|
3571
|
+
] }),
|
|
3572
|
+
/* @__PURE__ */ jsx8(Box6, { flexGrow: 1, children: /* @__PURE__ */ jsx8(Text7, { color: semantic.muted, wrap: "truncate-end", children: versionDelta(m) }) }),
|
|
3573
|
+
/* @__PURE__ */ jsx8(Box6, { width: 7, justifyContent: "flex-end", children: /* @__PURE__ */ jsx8(Text7, { color: semantic.muted, children: dur }) })
|
|
3574
|
+
] });
|
|
3575
|
+
}
|
|
3461
3576
|
function SummaryScreen() {
|
|
3462
3577
|
const { state, rescan } = useMachine();
|
|
3463
3578
|
useSafeInput((input) => {
|
|
3464
3579
|
if (input === "r" || input === "R") rescan();
|
|
3465
3580
|
});
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3581
|
+
const summary = summarizeRun(state);
|
|
3582
|
+
const { upgraded, failed, skipped } = summary;
|
|
3583
|
+
const hasErrors = failed > 0;
|
|
3469
3584
|
const failures = [];
|
|
3470
3585
|
const manuals = [];
|
|
3471
3586
|
const reboots = [];
|
|
@@ -3473,19 +3588,15 @@ function SummaryScreen() {
|
|
|
3473
3588
|
const e = state.managers[id];
|
|
3474
3589
|
if (!e) continue;
|
|
3475
3590
|
if (e.status === "skipped") {
|
|
3476
|
-
skipped++;
|
|
3477
3591
|
if (e.manualCommand) manuals.push({ manager: id, command: e.manualCommand });
|
|
3478
3592
|
continue;
|
|
3479
3593
|
}
|
|
3480
3594
|
const r = e.result;
|
|
3481
3595
|
if (r) {
|
|
3482
|
-
upgraded += r.upgraded;
|
|
3483
|
-
failed += r.failed;
|
|
3484
3596
|
for (const f of r.failures) failures.push({ manager: id, package: f.package, message: f.message, kind: f.kind });
|
|
3485
3597
|
if (r.reboot) reboots.push({ manager: id, state: r.reboot });
|
|
3486
3598
|
}
|
|
3487
3599
|
}
|
|
3488
|
-
const hasErrors = failed > 0;
|
|
3489
3600
|
return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", children: [
|
|
3490
3601
|
/* @__PURE__ */ jsx8(StepHeader, { phase: state.phase }),
|
|
3491
3602
|
/* @__PURE__ */ jsx8(Box6, { marginBottom: 1, children: /* @__PURE__ */ jsx8(Text7, { color: hasErrors ? semantic.error : semantic.success, bold: true, children: hasErrors ? `${g.failed} ${t("ui", "withErrors")}` : `${g.done} ${t("ui", "allDone")}` }) }),
|
|
@@ -3508,6 +3619,7 @@ function SummaryScreen() {
|
|
|
3508
3619
|
t("ui", "skipped")
|
|
3509
3620
|
] })
|
|
3510
3621
|
] }),
|
|
3622
|
+
summary.managers.length > 0 && /* @__PURE__ */ jsx8(Box6, { flexDirection: "column", marginBottom: 1, children: summary.managers.map((m) => /* @__PURE__ */ jsx8(ManagerRow, { m }, m.id)) }),
|
|
3511
3623
|
failures.length > 0 && /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", marginBottom: 1, children: [
|
|
3512
3624
|
failures.slice(0, 8).map((f, i) => /* @__PURE__ */ jsxs6(Text7, { color: semantic.error, wrap: "truncate-end", children: [
|
|
3513
3625
|
g.failed,
|
|
@@ -3541,7 +3653,7 @@ function SummaryScreen() {
|
|
|
3541
3653
|
" Reinicio pendiente: ",
|
|
3542
3654
|
reboots.map((r) => `${managerName(r.manager)} (${r.state})`).join(", ")
|
|
3543
3655
|
] }) }),
|
|
3544
|
-
|
|
3656
|
+
/* @__PURE__ */ jsxs6(Text7, { color: semantic.muted, children: [
|
|
3545
3657
|
t("ui", "logAt"),
|
|
3546
3658
|
" ",
|
|
3547
3659
|
getLogFilePath() ?? "~/.tacuchi-updater/logs/"
|
|
@@ -3551,13 +3663,13 @@ function SummaryScreen() {
|
|
|
3551
3663
|
}
|
|
3552
3664
|
|
|
3553
3665
|
// src/screens/settings-screen.tsx
|
|
3554
|
-
import { useState as
|
|
3666
|
+
import { useState as useState3 } from "react";
|
|
3555
3667
|
import { Box as Box7, Text as Text8 } from "ink";
|
|
3556
3668
|
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
3557
3669
|
function SettingsScreen() {
|
|
3558
3670
|
const { state, toggleEnabled, setLang, closeSettings } = useMachine();
|
|
3559
3671
|
const ids = state.order;
|
|
3560
|
-
const [cursor, setCursor] =
|
|
3672
|
+
const [cursor, setCursor] = useState3(0);
|
|
3561
3673
|
const clamped = Math.min(cursor, Math.max(0, ids.length - 1));
|
|
3562
3674
|
useSafeInput((input, key) => {
|
|
3563
3675
|
if (key.escape) closeSettings();
|
|
@@ -3726,13 +3838,14 @@ if (process.platform === "win32" && sudoRequested && !elevated) {
|
|
|
3726
3838
|
var sudoMode = process.platform === "win32" ? elevated : isRoot || sudoRequested;
|
|
3727
3839
|
var nonInteractive = !process.stdin.isTTY || args.includes("--yes") || args.includes("-y") || args.includes("--all");
|
|
3728
3840
|
var { unmount } = render(/* @__PURE__ */ jsx11(App, { sudoMode, nonInteractive }));
|
|
3729
|
-
var onSignal = (code) => () => {
|
|
3841
|
+
var onSignal = (code, name) => () => {
|
|
3842
|
+
warn(`Interrumpido por se\xF1al (${name}) \u2014 run incompleto, sin resumen`);
|
|
3730
3843
|
fireProcessCancel();
|
|
3731
3844
|
setTimeout(() => {
|
|
3732
3845
|
unmount();
|
|
3733
3846
|
process.exit(code);
|
|
3734
3847
|
}, 200);
|
|
3735
3848
|
};
|
|
3736
|
-
process.on("SIGINT", onSignal(130));
|
|
3737
|
-
process.on("SIGTERM", onSignal(143));
|
|
3738
|
-
process.on("SIGBREAK", onSignal(130));
|
|
3849
|
+
process.on("SIGINT", onSignal(130, "SIGINT"));
|
|
3850
|
+
process.on("SIGTERM", onSignal(143, "SIGTERM"));
|
|
3851
|
+
process.on("SIGBREAK", onSignal(130, "SIGBREAK"));
|