@tacuchi/updater 3.0.1 → 3.1.0

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 (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +67 -62
  3. package/dist/cli.js +1326 -1162
  4. package/package.json +11 -2
package/dist/cli.js CHANGED
@@ -1,11 +1,662 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ // src/cli.tsx
4
+ import { Writable } from "stream";
5
+
6
+ // src/lib/config.ts
7
+ import fs from "fs";
8
+ import path from "path";
9
+ import os from "os";
10
+ var DEFAULTS = {
11
+ enabledManagers: {},
12
+ verbosity: "info",
13
+ language: "es",
14
+ concurrency: 4,
15
+ timeoutsMs: {},
16
+ logTailBytes: 16384,
17
+ managers: {},
18
+ logRetentionRuns: 30,
19
+ selfCheck: true
20
+ };
21
+ var MIN_CONCURRENCY = 1;
22
+ var MAX_CONCURRENCY = 8;
23
+ function clampConcurrency(value) {
24
+ const n = typeof value === "number" && Number.isFinite(value) ? value : DEFAULTS.concurrency;
25
+ return Math.max(MIN_CONCURRENCY, Math.min(MAX_CONCURRENCY, Math.round(n)));
26
+ }
27
+ function normalizeConfig(parsed) {
28
+ return {
29
+ ...DEFAULTS,
30
+ ...parsed,
31
+ enabledManagers: { ...DEFAULTS.enabledManagers, ...parsed.enabledManagers },
32
+ timeoutsMs: { ...DEFAULTS.timeoutsMs, ...parsed.timeoutsMs },
33
+ managers: { ...DEFAULTS.managers, ...parsed.managers },
34
+ concurrency: clampConcurrency(parsed.concurrency),
35
+ logTailBytes: typeof parsed.logTailBytes === "number" && Number.isFinite(parsed.logTailBytes) && parsed.logTailBytes > 0 ? Math.max(1, Math.round(parsed.logTailBytes)) : DEFAULTS.logTailBytes,
36
+ logRetentionRuns: typeof parsed.logRetentionRuns === "number" && parsed.logRetentionRuns >= 1 ? Math.round(parsed.logRetentionRuns) : DEFAULTS.logRetentionRuns,
37
+ selfCheck: typeof parsed.selfCheck === "boolean" ? parsed.selfCheck : DEFAULTS.selfCheck
38
+ };
39
+ }
40
+ var APP = "tacuchi-updater";
41
+ function windowsPaths() {
42
+ const home = os.homedir();
43
+ const roaming = process.env["APPDATA"] || path.join(home, "AppData", "Roaming");
44
+ const local = process.env["LOCALAPPDATA"] || path.join(home, "AppData", "Local");
45
+ return { config: path.join(roaming, APP, "Config"), log: path.join(local, APP, "Log") };
46
+ }
47
+ function getConfigDir(platform = process.platform) {
48
+ const override = process.env["TACUCHI_UPDATER_CONFIG_DIR"];
49
+ if (override) return override;
50
+ if (platform === "win32") return windowsPaths().config;
51
+ return path.join(os.homedir(), ".tacuchi-updater");
52
+ }
53
+ function getLogDir(platform = process.platform) {
54
+ const override = process.env["TACUCHI_UPDATER_LOG_DIR"];
55
+ if (override) return override;
56
+ if (platform === "win32") return windowsPaths().log;
57
+ return path.join(getConfigDir(platform), "logs");
58
+ }
59
+ function getConfigPath() {
60
+ return path.join(getConfigDir(), "config.json");
61
+ }
62
+ function migrateLegacyConfig() {
63
+ if (process.platform !== "win32") return;
64
+ try {
65
+ const target = getConfigPath();
66
+ if (fs.existsSync(target)) return;
67
+ const legacy = path.join(os.homedir(), ".tacuchi-updater", "config.json");
68
+ if (!fs.existsSync(legacy)) return;
69
+ const dir = getConfigDir();
70
+ if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
71
+ fs.copyFileSync(legacy, target);
72
+ } catch {
73
+ }
74
+ }
75
+ function loadConfig() {
76
+ migrateLegacyConfig();
77
+ const configPath = getConfigPath();
78
+ try {
79
+ if (!fs.existsSync(configPath)) {
80
+ const defaults = { ...DEFAULTS };
81
+ try {
82
+ saveConfig(defaults);
83
+ } catch {
84
+ }
85
+ return defaults;
86
+ }
87
+ const raw = fs.readFileSync(configPath, "utf-8");
88
+ const parsed = JSON.parse(raw);
89
+ return normalizeConfig(parsed);
90
+ } catch {
91
+ return { ...DEFAULTS };
92
+ }
93
+ }
94
+ function saveConfig(config) {
95
+ const dir = getConfigDir();
96
+ if (!fs.existsSync(dir)) {
97
+ fs.mkdirSync(dir, { recursive: true });
98
+ }
99
+ const target = getConfigPath();
100
+ const tmp = target + ".tmp";
101
+ const data = JSON.stringify(config, null, 2);
102
+ try {
103
+ fs.writeFileSync(tmp, data, "utf-8");
104
+ fs.renameSync(tmp, target);
105
+ } catch (err) {
106
+ const code = err.code;
107
+ if (code === "EPERM" || code === "EBUSY" || code === "EEXIST") {
108
+ fs.writeFileSync(target, data, "utf-8");
109
+ try {
110
+ fs.unlinkSync(tmp);
111
+ } catch {
112
+ }
113
+ } else {
114
+ throw err;
115
+ }
116
+ }
117
+ }
118
+ function isManagerEnabled(config, managerId) {
119
+ if (Object.prototype.hasOwnProperty.call(config.enabledManagers, managerId)) {
120
+ return config.enabledManagers[managerId] ?? true;
121
+ }
122
+ return true;
123
+ }
124
+
125
+ // src/i18n/es.ts
126
+ var es = {
127
+ hints: {
128
+ ctrlC: "Ctrl+C cancelar",
129
+ confirmCancel: "S s\xED, cancelar",
130
+ continueRun: "N/Esc seguir",
131
+ quit: "Q salir",
132
+ retry: "R volver a buscar",
133
+ down: "Abajo/J bajar",
134
+ up: "Arriba/K subir",
135
+ mark: "Espacio marcar",
136
+ all: "A todos",
137
+ none: "N ninguno",
138
+ next: "Enter continuar",
139
+ settings: "S ajustes",
140
+ back: "Esc volver",
141
+ detail: "D detalle",
142
+ language: "L idioma",
143
+ elevate: "E abrir como administrador",
144
+ start: "Enter/Y actualizar",
145
+ cancel: "Esc cancelar"
146
+ },
147
+ cli: {
148
+ help: "@tacuchi/updater - Actualiza los gestores de paquetes\n\nUso: updater [opciones]\n\n-s, --sudo Permite gestores que requieren administrador\n-y, --yes, --all Actualiza todo sin teclado\n-h, --help Muestra esta ayuda\n-v, --version Muestra la versi\xF3n\n\nSin stdin TTY, la ejecuci\xF3n es autom\xE1tica.\n\xDAltima versi\xF3n: npx @tacuchi/updater@latest",
149
+ sudoPrompt: "Modo SUDO: ingresa tu contrase\xF1a para continuar...",
150
+ sudoFailure: "No se pudo autenticar sudo. Continuando sin permisos elevados.",
151
+ windowsAdmin: "En Windows --sudo no eleva. Abre la terminal como Administrador."
152
+ },
153
+ managers: {
154
+ brew: "Homebrew",
155
+ pip: "pip / Python",
156
+ npm: "Node NPM",
157
+ conda: "Conda",
158
+ gem: "RubyGems",
159
+ softwareupdate: "macOS Updates",
160
+ winget: "Winget",
161
+ apt: "APT / Debian",
162
+ dnf: "DNF / Fedora",
163
+ pacman: "Pacman / Arch",
164
+ flatpak: "Flatpak",
165
+ snap: "Snap",
166
+ flutter: "Flutter SDK",
167
+ angular: "Angular CLI",
168
+ cargo: "Cargo binarios",
169
+ "go-lang": "Go SDK",
170
+ composer: "Composer / PHP",
171
+ choco: "Chocolatey",
172
+ pnpm: "pnpm",
173
+ yarn: "Yarn",
174
+ bun: "Bun",
175
+ mise: "mise",
176
+ asdf: "asdf",
177
+ rustup: "Rust / rustup",
178
+ mas: "Mac App Store",
179
+ scoop: "Scoop",
180
+ pipx: "pipx"
181
+ },
182
+ banner: {
183
+ macos: "macOS",
184
+ linux: "Linux",
185
+ windows: "Windows",
186
+ searching: "buscando gestores",
187
+ managerOne: "gestor detectado",
188
+ managerMany: "gestores detectados"
189
+ },
190
+ flow: {
191
+ step: "Paso",
192
+ detecting: "Detectando gestores",
193
+ scanning: "Buscando actualizaciones",
194
+ select: "Seleccionar",
195
+ confirm: "Confirmar",
196
+ updating: "Actualizando",
197
+ summary: "Resumen",
198
+ detail: "Detalle por paquete",
199
+ settings: "Ajustes"
200
+ },
201
+ // Etiquetas de estado por-gestor (ManagerStatus)
202
+ status: {
203
+ cancelling: "CANCELANDO",
204
+ partial: "PARCIAL",
205
+ pending: "PENDIENTE",
206
+ scanning: "ESCANEANDO",
207
+ outdated: "DISPONIBLE",
208
+ uptodate: "AL D\xCDA",
209
+ queued: "EN COLA",
210
+ running: "ACTUALIZANDO",
211
+ done: "OK",
212
+ failed: "ERROR",
213
+ skipped: "MANUAL",
214
+ unknown: "INDETERMINADO"
215
+ },
216
+ // Cadenas de la interfaz del flujo
217
+ ui: {
218
+ rebootRequired: "necesario",
219
+ rebootInitiated: "iniciado",
220
+ rebootDeferred: "pospuesto",
221
+ of: "de",
222
+ upgradedOne: "actualizado",
223
+ failedOne: "fallido",
224
+ manualShort: "manual",
225
+ manualMany: "manuales",
226
+ cancelQuestion: "\xBFCancelar? Se detendr\xEDan:",
227
+ rebootPending: "Reinicio pendiente",
228
+ language: "Idioma",
229
+ on: "[s\xED]",
230
+ off: "[no]",
231
+ packageOne: "paquete",
232
+ packageMany: "paquetes",
233
+ adminManual: "requiere admin; manual",
234
+ sudoManual: "requiere --sudo; manual",
235
+ timeoutNote: "Un TIMEOUT suele pedir interacci\xF3n. Actual\xEDzalo a mano en una terminal.",
236
+ detectionFailed: "No se pudieron detectar los gestores de paquetes.",
237
+ chooseFirst: "Marca al menos un paquete para continuar.",
238
+ detecting: "Detectando gestores de paquetes...",
239
+ scanning: "Buscando actualizaciones...",
240
+ noUpdates: "Todo est\xE1 al d\xEDa. No hay actualizaciones.",
241
+ selectedOne: "marcado",
242
+ selected: "marcados",
243
+ willRun: "Se ejecutar\xE1:",
244
+ upgraded: "actualizados",
245
+ failed: "fallidos",
246
+ allDone: "COMPLETADO",
247
+ withErrors: "COMPLETADO CON ERRORES",
248
+ logAt: "Registro:",
249
+ manualNeeded: "Requiere ejecuci\xF3n manual:",
250
+ passwordNote: 'Si pide "Password:", escr\xEDbela y pulsa Enter.',
251
+ undetermined: "no se pudo determinar",
252
+ undeterminedShort: "sin determinar",
253
+ noChanges: "Ninguna corrida cambi\xF3 paquetes."
254
+ }
255
+ };
256
+
257
+ // src/i18n/en.ts
258
+ var en = {
259
+ hints: {
260
+ ctrlC: "Ctrl+C cancel",
261
+ confirmCancel: "Y yes, cancel",
262
+ continueRun: "N/Esc continue",
263
+ quit: "Q quit",
264
+ retry: "R scan again",
265
+ down: "Down/J move down",
266
+ up: "Up/K move up",
267
+ mark: "Space select",
268
+ all: "A all",
269
+ none: "N none",
270
+ next: "Enter continue",
271
+ settings: "S settings",
272
+ back: "Esc back",
273
+ detail: "D details",
274
+ language: "L language",
275
+ elevate: "E open as administrator",
276
+ start: "Enter/Y update",
277
+ cancel: "Esc cancel"
278
+ },
279
+ cli: {
280
+ help: "@tacuchi/updater - Updates package managers\n\nUsage: updater [options]\n\n-s, --sudo Allows managers requiring administrator access\n-y, --yes, --all Updates everything without keyboard input\n-h, --help Shows this help\n-v, --version Shows the version\n\nWithout stdin TTY, execution is automatic.\nLatest version: npx @tacuchi/updater@latest",
281
+ sudoPrompt: "SUDO mode: enter your password to continue...",
282
+ sudoFailure: "Could not authenticate sudo. Continuing without elevated permissions.",
283
+ windowsAdmin: "On Windows --sudo does not elevate. Open the terminal as Administrator."
284
+ },
285
+ managers: {
286
+ brew: "Homebrew",
287
+ pip: "pip / Python",
288
+ npm: "Node NPM",
289
+ conda: "Conda",
290
+ gem: "RubyGems",
291
+ softwareupdate: "macOS Updates",
292
+ winget: "Winget",
293
+ apt: "APT / Debian",
294
+ dnf: "DNF / Fedora",
295
+ pacman: "Pacman / Arch",
296
+ flatpak: "Flatpak",
297
+ snap: "Snap",
298
+ flutter: "Flutter SDK",
299
+ angular: "Angular CLI",
300
+ cargo: "Cargo binaries",
301
+ "go-lang": "Go SDK",
302
+ composer: "Composer / PHP",
303
+ choco: "Chocolatey",
304
+ pnpm: "pnpm",
305
+ yarn: "Yarn",
306
+ bun: "Bun",
307
+ mise: "mise",
308
+ asdf: "asdf",
309
+ rustup: "Rust / rustup",
310
+ mas: "Mac App Store",
311
+ scoop: "Scoop",
312
+ pipx: "pipx"
313
+ },
314
+ banner: {
315
+ macos: "macOS",
316
+ linux: "Linux",
317
+ windows: "Windows",
318
+ searching: "looking for managers",
319
+ managerOne: "manager detected",
320
+ managerMany: "managers detected"
321
+ },
322
+ flow: {
323
+ step: "Step",
324
+ detecting: "Detecting managers",
325
+ scanning: "Checking for updates",
326
+ select: "Select",
327
+ confirm: "Confirm",
328
+ updating: "Updating",
329
+ summary: "Summary",
330
+ detail: "Per-package detail",
331
+ settings: "Settings"
332
+ },
333
+ status: {
334
+ cancelling: "CANCELLING",
335
+ partial: "PARTIAL",
336
+ pending: "PENDING",
337
+ scanning: "SCANNING",
338
+ outdated: "AVAILABLE",
339
+ uptodate: "UP TO DATE",
340
+ queued: "QUEUED",
341
+ running: "UPDATING",
342
+ done: "OK",
343
+ failed: "ERROR",
344
+ skipped: "MANUAL",
345
+ unknown: "UNDETERMINED"
346
+ },
347
+ ui: {
348
+ rebootRequired: "required",
349
+ rebootInitiated: "initiated",
350
+ rebootDeferred: "deferred",
351
+ of: "of",
352
+ upgradedOne: "upgraded",
353
+ failedOne: "failed",
354
+ manualShort: "manual update",
355
+ manualMany: "manual updates",
356
+ cancelQuestion: "Cancel? These managers would stop:",
357
+ rebootPending: "Reboot pending",
358
+ language: "Language",
359
+ on: "[on]",
360
+ off: "[off]",
361
+ packageOne: "package",
362
+ packageMany: "packages",
363
+ adminManual: "requires admin; manual",
364
+ sudoManual: "requires --sudo; manual",
365
+ timeoutNote: "A TIMEOUT often needs interaction. Update it manually in a terminal.",
366
+ detectionFailed: "Could not detect package managers.",
367
+ chooseFirst: "Select at least one package to continue.",
368
+ detecting: "Detecting package managers...",
369
+ scanning: "Checking for updates...",
370
+ noUpdates: "Everything is up to date. No updates.",
371
+ selectedOne: "marked",
372
+ selected: "marked",
373
+ willRun: "Will run:",
374
+ upgraded: "upgraded",
375
+ failed: "failed",
376
+ allDone: "DONE",
377
+ withErrors: "DONE WITH ERRORS",
378
+ logAt: "Log:",
379
+ manualNeeded: "Manual command needed:",
380
+ passwordNote: 'If asked for "Password:", type it and press Enter.',
381
+ undetermined: "could not be determined",
382
+ undeterminedShort: "undetermined",
383
+ noChanges: "No run changed any package."
384
+ }
385
+ };
386
+
387
+ // src/i18n/index.ts
388
+ var currentLang = detectLanguage();
389
+ function detectLanguage() {
390
+ const lang = (process.env["LANG"] ?? process.env["LANGUAGE"] ?? "").toLowerCase();
391
+ if (lang.startsWith("en")) return "en";
392
+ return "es";
393
+ }
394
+ function setLanguage(lang) {
395
+ currentLang = lang;
396
+ }
397
+ function getLanguage() {
398
+ return currentLang;
399
+ }
400
+ var translations = { es, en };
401
+ function t(section, key) {
402
+ const dict = translations[currentLang] ?? es;
403
+ const sec = dict[section];
404
+ if (key === void 0) return sec;
405
+ return sec[key];
406
+ }
407
+ function managerName(id) {
408
+ const dict = translations[currentLang] ?? es;
409
+ const names = dict.managers;
410
+ return names[id] ?? id;
411
+ }
412
+
413
+ // src/theme.ts
414
+ var tokens = {
415
+ dark: { text: "#e6e6e2", muted: "#a3a39b", accent: "#bff278" },
416
+ light: { text: "#111111", muted: "#5c5c56", accent: "#bce489" },
417
+ logo: "#b6f23c",
418
+ error: "#ffb4ab",
419
+ warning: "#ffade0",
420
+ unknown: "#f0b429"
421
+ };
422
+ function themeFor(mode) {
423
+ const palette = tokens[mode];
424
+ return {
425
+ text: palette.text,
426
+ muted: palette.muted,
427
+ action: mode === "light" ? palette.text : palette.accent,
428
+ success: mode === "light" ? palette.text : palette.accent,
429
+ error: tokens.error,
430
+ warning: tokens.warning,
431
+ unknown: tokens.unknown,
432
+ accentFill: palette.accent,
433
+ logoFill: tokens.logo
434
+ };
435
+ }
436
+ var semantic = themeFor("dark");
437
+ var terminalTheme = "dark";
438
+ var colors = { outline: semantic.muted };
439
+ function setTerminalTheme(mode) {
440
+ terminalTheme = mode;
441
+ Object.assign(semantic, themeFor(mode));
442
+ colors.outline = semantic.muted;
443
+ }
444
+
445
+ // src/lib/brand-images.ts
446
+ var darkIsotype = "iVBORw0KGgoAAAANSUhEUgAAAXAAAAE4CAYAAABCEqg+AAAABmJLR0QA/wD/AP+gvaeTAAAOsElEQVR4nO3dT6il913H8c/vzJ8mtSk1Menck7kT22RAjXFh3dg/OlVBLIaCqOjCaEXanX9xKTWKuHAlCmIXRUEXWpBW1FIobaTFbrpoFylSWtNkpplkUgx1Es105p6fi4l1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bs04D8Acn2cifw1j7K8SZQEMCCE+klIel1J2SykP27Z9GD5edvN/AGTZ5V8riM4AAAAASUVORK5CYII=";
449
+
450
+ // src/lib/terminal-image.ts
451
+ var ESC = "\x1B";
452
+ var ST = `${ESC}\\`;
453
+ var KITTY_QUERY_ID = 31;
454
+ var KITTY_QUERY = `${ESC}_Gi=${KITTY_QUERY_ID},s=1,v=1,a=q,t=d,f=24;AAAA${ST}`;
455
+ var BANNER_MIN_COLUMNS = 60;
456
+ var BANNER_MIN_ROWS = 17 + 2;
457
+ var BANNER_EXTRA_ROWS = 2;
458
+ var CHUNK = 4096;
459
+ var PLACEHOLDER = "\u{10EEEE}";
460
+ var DIACRITICS = [773, 781, 782, 784, 786, 829, 830, 831].map((code) => String.fromCodePoint(code));
461
+ function answersImages(response) {
462
+ const answer = response.indexOf(`${ESC}_Gi=${KITTY_QUERY_ID};OK${ST}`);
463
+ const attributes = response.search(/\x1b\[[?\d;]*c/);
464
+ return answer !== -1 && attributes !== -1 && answer < attributes;
465
+ }
466
+ function pickPiece(theme, themeKnown) {
467
+ if (!themeKnown) return { name: "icono-terminal", png: icon, columns: 6, rows: 3 };
468
+ return theme === "light" ? { name: "isotipo-terminal-claro", png: lightIsotype, columns: 8, rows: 3 } : { name: "isotipo-terminal-oscuro", png: darkIsotype, columns: 8, rows: 3 };
469
+ }
470
+ function bannerBlocker({ env, stdoutTTY, ascii, columns, rows }) {
471
+ if (!stdoutTTY) return "not-tty";
472
+ if (env["NO_COLOR"] !== void 0) return "no-color";
473
+ if (ascii) return "ascii";
474
+ if (env["TMUX"] || env["STY"] || /^(?:screen|tmux)/.test(env["TERM"] ?? "")) return "multiplexer";
475
+ if (columns < BANNER_MIN_COLUMNS) return "narrow";
476
+ if (rows < BANNER_MIN_ROWS) return "short";
477
+ return null;
478
+ }
479
+ function pickImageId(random = Math.random) {
480
+ return 16 + Math.floor(random() * 240);
481
+ }
482
+ function transmitImage(id, piece) {
483
+ const chunks = [];
484
+ for (let start = 0; start < piece.png.length; start += CHUNK) chunks.push(piece.png.slice(start, start + CHUNK));
485
+ return chunks.map((chunk, index) => {
486
+ const more = index < chunks.length - 1 ? 1 : 0;
487
+ const keys = index === 0 ? `a=T,U=1,f=100,t=d,i=${id},c=${piece.columns},r=${piece.rows},C=1,q=2,m=${more}` : `m=${more}`;
488
+ return `${ESC}_G${keys};${chunk}${ST}`;
489
+ }).join("");
490
+ }
491
+ function deleteImage(id) {
492
+ return `${ESC}_Ga=d,d=I,i=${id},q=2${ST}`;
493
+ }
494
+ function placeholderRows(id, columns, rows) {
495
+ return Array.from({ length: rows }, (_, row) => `${ESC}[38;5;${id}m${Array.from({ length: columns }, (_2, column) => PLACEHOLDER + DIACRITICS[row] + DIACRITICS[column]).join("")}${ESC}[39m`);
496
+ }
497
+
498
+ // src/lib/terminal-theme.ts
499
+ var THEME_TIMEOUT_MS = 150;
500
+ function parseTerminalTheme(colorfgbg, response = "") {
501
+ const palette = colorfgbg?.split(";").at(-1);
502
+ if (palette !== void 0 && /^\d+$/.test(palette)) return [7, 10, 11, 14, 15].includes(Number(palette)) ? "light" : "dark";
503
+ const match = response.match(/\x1b\]11;rgb:([a-f\d]+)\/([a-f\d]+)\/([a-f\d]+)(?:\x07|\x1b\\)/i);
504
+ if (!match) return "dark";
505
+ const channels = match.slice(1).map((value) => {
506
+ const c = parseInt(value, 16) / (16 ** value.length - 1);
507
+ return c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
508
+ });
509
+ return channels[0] * 0.2126 + channels[1] * 0.7152 + channels[2] * 0.0722 > 0.5 ? "light" : "dark";
510
+ }
511
+ function themeReported(colorfgbg, response = "") {
512
+ const palette = colorfgbg?.split(";").at(-1);
513
+ if (palette !== void 0 && /^\d+$/.test(palette)) return true;
514
+ return /\x1b\]11;rgb:[a-f\d]+\/[a-f\d]+\/[a-f\d]+(?:\x07|\x1b\\)/i.test(response);
515
+ }
516
+ async function probeTerminal({ input = process.stdin, output = process.stdout, interactive, env = process.env, images = false }) {
517
+ const colorfgbg = env["COLORFGBG"];
518
+ if (!interactive || !input.isTTY || !output.isTTY || !input.setRawMode) return { theme: "dark", themeKnown: false, images: false };
519
+ if (colorfgbg && !images) return { theme: parseTerminalTheme(colorfgbg), themeKnown: themeReported(colorfgbg), images: false };
520
+ const wasRaw = input.isRaw === true;
521
+ const wasPaused = input.isPaused();
522
+ input.setRawMode(true);
523
+ let response = "";
524
+ try {
525
+ await new Promise((resolve) => {
526
+ const finish = () => {
527
+ clearTimeout(timer);
528
+ input.off("data", data);
529
+ resolve();
530
+ };
531
+ const data = (chunk) => {
532
+ response += chunk.toString();
533
+ if (/\x1b\[[?\d;]*c/.test(response)) finish();
534
+ };
535
+ const timer = setTimeout(finish, THEME_TIMEOUT_MS);
536
+ input.on("data", data);
537
+ output.write((colorfgbg ? "" : "\x1B]11;?\x07") + (images ? KITTY_QUERY : "") + "\x1B[c");
538
+ });
539
+ } finally {
540
+ input.setRawMode(wasRaw);
541
+ if (wasPaused) input.pause();
542
+ }
543
+ return {
544
+ theme: parseTerminalTheme(colorfgbg, response),
545
+ themeKnown: themeReported(colorfgbg, response),
546
+ images: images && answersImages(response)
547
+ };
548
+ }
549
+
550
+ // src/lib/glyphs.ts
551
+ function shouldUseAscii(env, platform) {
552
+ if (env["TACUCHI_ASCII"] === "1") return true;
553
+ if (env["TACUCHI_ASCII"] === "0") return false;
554
+ if (env["TERM"] === "dumb") return true;
555
+ if (platform === "win32" && !env["WT_SESSION"]) return true;
556
+ return false;
557
+ }
558
+ var UNICODE = {
559
+ separator: "\xB7",
560
+ logo: "\u2582",
561
+ partial: "!",
562
+ pending: "\xB7",
563
+ scanning: "\u25CC",
564
+ outdated: "\u203A",
565
+ uptodate: "\u2713",
566
+ running: "\u25B8",
567
+ done: "\u2713",
568
+ failed: "\u2717",
569
+ skipped: "\u2298",
570
+ unknown: "?",
571
+ cursor: "\u276F",
572
+ checkOn: "[\u2713]",
573
+ checkOff: "[ ]",
574
+ arrow: "\u2192",
575
+ scrollUp: "\u25B2",
576
+ scrollDown: "\u25BC",
577
+ stepOn: "\u2586",
578
+ stepOff: "\u2581",
579
+ info: "\u24D8",
580
+ ellipsis: "\u2026",
581
+ bullet: "\u25B8",
582
+ reboot: "\u27F3"
583
+ };
584
+ var ASCII_GLYPHS = {
585
+ separator: "|",
586
+ logo: "_",
587
+ partial: "!",
588
+ pending: ".",
589
+ scanning: "o",
590
+ outdated: ">",
591
+ uptodate: "+",
592
+ running: ">",
593
+ done: "+",
594
+ failed: "x",
595
+ skipped: "-",
596
+ unknown: "?",
597
+ cursor: ">",
598
+ checkOn: "[x]",
599
+ checkOff: "[ ]",
600
+ arrow: "->",
601
+ scrollUp: "^",
602
+ scrollDown: "v",
603
+ stepOn: "#",
604
+ stepOff: "_",
605
+ info: "i",
606
+ ellipsis: "...",
607
+ bullet: ">",
608
+ reboot: "*"
609
+ };
610
+ var ASCII = shouldUseAscii(process.env, process.platform);
611
+ var g = ASCII ? ASCII_GLYPHS : UNICODE;
612
+ var NO_ANIM = ASCII || !process.stdout.isTTY;
613
+ var SPINNER_UNICODE = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
614
+ var SPINNER_ASCII = ["|", "/", "-", "\\"];
615
+ var spinnerFrames = ASCII ? SPINNER_ASCII : SPINNER_UNICODE;
616
+
617
+ // src/lib/banner.ts
618
+ var image = null;
619
+ var retired = false;
620
+ var listeners = /* @__PURE__ */ new Set();
621
+ var emit = () => {
622
+ for (const listener of listeners) listener();
623
+ };
624
+ function configureBanner(next) {
625
+ image = next;
626
+ retired = false;
627
+ emit();
628
+ }
629
+ function retireBanner() {
630
+ if (!image || retired) return false;
631
+ retired = true;
632
+ emit();
633
+ return true;
634
+ }
635
+ function subscribeBanner(listener) {
636
+ listeners.add(listener);
637
+ return () => {
638
+ listeners.delete(listener);
639
+ };
640
+ }
641
+ function bannerSnapshot() {
642
+ return retired ? null : image;
643
+ }
644
+ function shownBanner(snapshot2 = bannerSnapshot(), stdout = process.stdout, env = process.env, ascii = ASCII) {
645
+ if (!snapshot2) return null;
646
+ const blocker = bannerBlocker({ env, stdoutTTY: true, ascii, columns: Math.min(stdout.columns ?? 100, 100), rows: stdout.rows ?? 24 });
647
+ return blocker ? null : snapshot2;
648
+ }
649
+ function headerExtraRows() {
650
+ return shownBanner() ? BANNER_EXTRA_ROWS : 0;
651
+ }
652
+
3
653
  // src/cli.tsx
4
654
  import { render } from "ink";
5
655
  import { execaSync } from "execa";
6
656
 
7
657
  // src/app.tsx
8
- import { Box as Box9, Text as Text10 } from "ink";
658
+ import { useEffect as useEffect5, useState as useState7 } from "react";
659
+ import { Box as Box9 } from "ink";
9
660
 
10
661
  // src/hooks/use-app-machine.tsx
11
662
  import { createContext, useContext, useReducer, useEffect, useRef, useState, useCallback } from "react";
@@ -62,7 +713,7 @@ function allOutdatedKeys(state) {
62
713
  function appReducer(state, action) {
63
714
  switch (action.type) {
64
715
  case "BOOT_DONE":
65
- return { ...state, phase: "detecting" };
716
+ return { ...state, phase: "detecting", error: void 0 };
66
717
  case "DETECT_DONE": {
67
718
  const managers = {};
68
719
  for (const info of action.managers) managers[info.id] = newEntry(info);
@@ -132,7 +783,7 @@ function appReducer(state, action) {
132
783
  ...state,
133
784
  phase: "updating",
134
785
  managers,
135
- run: { queue: action.queue, doneCount: 0, failedCount: 0, skippedCount: 0, unknownCount: 0 }
786
+ run: { startedAt: action.at, queue: action.queue, doneCount: 0, failedCount: 0, skippedCount: 0, unknownCount: 0 }
136
787
  };
137
788
  }
138
789
  case "MGR_QUEUED":
@@ -154,8 +805,8 @@ function appReducer(state, action) {
154
805
  }));
155
806
  case "MGR_DONE":
156
807
  return {
157
- ...patch(state, action.id, (e) => ({ ...e, status: "done", percent: 100, result: action.result })),
158
- run: { ...state.run, doneCount: state.run.doneCount + 1 }
808
+ ...patch(state, action.id, (e) => ({ ...e, status: action.result.failed > 0 ? "partial" : "done", percent: 100, result: action.result })),
809
+ run: { ...state.run, doneCount: state.run.doneCount + (action.result.failed > 0 ? 0 : 1), failedCount: state.run.failedCount + (action.result.failed > 0 ? 1 : 0) }
159
810
  };
160
811
  case "MGR_FAILED":
161
812
  return {
@@ -174,8 +825,10 @@ function appReducer(state, action) {
174
825
  ...patch(state, action.id, (e) => ({ ...e, status: "unknown", percent: 100, result: action.result })),
175
826
  run: { ...state.run, unknownCount: state.run.unknownCount + 1 }
176
827
  };
828
+ case "RUN_CANCEL":
829
+ return { ...state, managers: Object.fromEntries(Object.entries(state.managers).map(([id, entry]) => [id, entry.status === "running" ? { ...entry, status: "cancelling" } : entry])) };
177
830
  case "RUN_DONE":
178
- return { ...state, phase: "summary" };
831
+ return { ...state, phase: "summary", run: { ...state.run, finishedAt: action.at } };
179
832
  case "SET_LANGUAGE":
180
833
  return { ...state, config: { ...state.config, language: action.lang } };
181
834
  case "TOGGLE_ENABLED": {
@@ -289,8 +942,11 @@ function withSudo(cmd, args2, sudo) {
289
942
  return [cmd, args2];
290
943
  }
291
944
  function tail(s, bytes) {
292
- if (!s) return "";
293
- return s.length > bytes ? s.slice(-bytes) : s;
945
+ if (Buffer.byteLength(s, "utf8") <= bytes) return s;
946
+ const encoded = Buffer.from(s, "utf8");
947
+ let start = encoded.length - bytes;
948
+ while (start < encoded.length && (encoded[start] & 192) === 128) start += 1;
949
+ return encoded.subarray(start).toString("utf8");
294
950
  }
295
951
  function execaOptions(opts, all) {
296
952
  if (!Number.isFinite(opts.timeoutMs) || opts.timeoutMs < 0) {
@@ -334,7 +990,7 @@ async function* runStream(cmd, args2, opts, percentParser) {
334
990
  if (child.all) {
335
991
  const decoder = new StreamDecoder();
336
992
  let lineBuf = "";
337
- const emit = function* (raw) {
993
+ const emit2 = function* (raw) {
338
994
  const line = raw.replace(/\r$/, "");
339
995
  if (!line) return;
340
996
  const percent = percentParser?.(line);
@@ -350,11 +1006,11 @@ async function* runStream(cmd, args2, opts, percentParser) {
350
1006
  while ((nl = lineBuf.indexOf("\n")) >= 0) {
351
1007
  const raw = lineBuf.slice(0, nl);
352
1008
  lineBuf = lineBuf.slice(nl + 1);
353
- yield* emit(raw);
1009
+ yield* emit2(raw);
354
1010
  }
355
1011
  }
356
1012
  lineBuf += decoder.end();
357
- if (lineBuf) yield* emit(lineBuf);
1013
+ if (lineBuf) yield* emit2(lineBuf);
358
1014
  }
359
1015
  const result = await child;
360
1016
  return {
@@ -454,185 +1110,66 @@ function reconcile(requested, before, after, commands, successExitCodes) {
454
1110
  return {
455
1111
  name,
456
1112
  outcome: "unknown",
457
- fromVersion: b?.currentVersion,
458
- toVersion: b?.newVersion
459
- };
460
- }),
461
- commands
462
- };
463
- }
464
- const stillOutdated = new Set(after.stillOutdated.map((p) => p.name));
465
- const packages = targets.map((name) => {
466
- const b = beforeByName.get(name);
467
- if (stillOutdated.has(name)) {
468
- return {
469
- name,
470
- outcome: "failed",
471
- fromVersion: b?.currentVersion,
472
- toVersion: b?.newVersion,
473
- failureKind: cmdKind ?? "COMMAND_FAILED"
474
- };
475
- }
476
- return {
477
- name,
478
- outcome: "upgraded",
479
- fromVersion: b?.currentVersion,
480
- toVersion: b?.newVersion
481
- };
482
- });
483
- const upgraded = packages.filter((p) => p.outcome === "upgraded").length;
484
- const failed = packages.filter((p) => p.outcome === "failed").length;
485
- let status;
486
- let reason;
487
- if (targets.length === 0) {
488
- status = "noop";
489
- } else if (failed === 0) {
490
- status = "success";
491
- } else if (upgraded === 0) {
492
- status = "failed";
493
- reason = cmdKind ?? "UNKNOWN";
494
- } else {
495
- status = "partial";
496
- reason = "PARTIAL";
497
- }
498
- const errors = packages.filter((p) => p.outcome === "failed").map((p) => `${p.name}: no se pudo actualizar (${p.failureKind})`);
499
- return {
500
- success: status === "success" || status === "noop",
501
- upgraded,
502
- failed,
503
- errors,
504
- status,
505
- skipped: 0,
506
- reason,
507
- reboot: rebootFrom(commands),
508
- packages,
509
- commands
510
- };
511
- }
512
-
513
- // src/lib/logger.ts
514
- import fs3 from "fs";
515
- import path3 from "path";
516
-
517
- // src/lib/config.ts
518
- import fs from "fs";
519
- import path from "path";
520
- import os from "os";
521
- var DEFAULTS = {
522
- enabledManagers: {},
523
- verbosity: "info",
524
- language: "es",
525
- concurrency: 4,
526
- timeoutsMs: {},
527
- logTailBytes: 16384,
528
- managers: {},
529
- logRetentionRuns: 30,
530
- selfCheck: true
531
- };
532
- var MIN_CONCURRENCY = 1;
533
- var MAX_CONCURRENCY = 8;
534
- function clampConcurrency(value) {
535
- const n = typeof value === "number" && Number.isFinite(value) ? value : DEFAULTS.concurrency;
536
- return Math.max(MIN_CONCURRENCY, Math.min(MAX_CONCURRENCY, Math.round(n)));
537
- }
538
- function normalizeConfig(parsed) {
539
- return {
540
- ...DEFAULTS,
541
- ...parsed,
542
- enabledManagers: { ...DEFAULTS.enabledManagers, ...parsed.enabledManagers },
543
- timeoutsMs: { ...DEFAULTS.timeoutsMs, ...parsed.timeoutsMs },
544
- managers: { ...DEFAULTS.managers, ...parsed.managers },
545
- concurrency: clampConcurrency(parsed.concurrency),
546
- logTailBytes: typeof parsed.logTailBytes === "number" && parsed.logTailBytes > 0 ? Math.round(parsed.logTailBytes) : DEFAULTS.logTailBytes,
547
- logRetentionRuns: typeof parsed.logRetentionRuns === "number" && parsed.logRetentionRuns >= 1 ? Math.round(parsed.logRetentionRuns) : DEFAULTS.logRetentionRuns,
548
- selfCheck: typeof parsed.selfCheck === "boolean" ? parsed.selfCheck : DEFAULTS.selfCheck
549
- };
550
- }
551
- var APP = "tacuchi-updater";
552
- function windowsPaths() {
553
- const home = os.homedir();
554
- const roaming = process.env["APPDATA"] || path.join(home, "AppData", "Roaming");
555
- const local = process.env["LOCALAPPDATA"] || path.join(home, "AppData", "Local");
556
- return { config: path.join(roaming, APP, "Config"), log: path.join(local, APP, "Log") };
557
- }
558
- function getConfigDir(platform = process.platform) {
559
- const override = process.env["TACUCHI_UPDATER_CONFIG_DIR"];
560
- if (override) return override;
561
- if (platform === "win32") return windowsPaths().config;
562
- return path.join(os.homedir(), ".tacuchi-updater");
563
- }
564
- function getLogDir(platform = process.platform) {
565
- const override = process.env["TACUCHI_UPDATER_LOG_DIR"];
566
- if (override) return override;
567
- if (platform === "win32") return windowsPaths().log;
568
- return path.join(getConfigDir(platform), "logs");
569
- }
570
- function getConfigPath() {
571
- return path.join(getConfigDir(), "config.json");
572
- }
573
- function migrateLegacyConfig() {
574
- if (process.platform !== "win32") return;
575
- try {
576
- const target = getConfigPath();
577
- if (fs.existsSync(target)) return;
578
- const legacy = path.join(os.homedir(), ".tacuchi-updater", "config.json");
579
- if (!fs.existsSync(legacy)) return;
580
- const dir = getConfigDir();
581
- if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
582
- fs.copyFileSync(legacy, target);
583
- } catch {
584
- }
585
- }
586
- function loadConfig() {
587
- migrateLegacyConfig();
588
- const configPath = getConfigPath();
589
- try {
590
- if (!fs.existsSync(configPath)) {
591
- const defaults = { ...DEFAULTS };
592
- try {
593
- saveConfig(defaults);
594
- } catch {
595
- }
596
- return defaults;
597
- }
598
- const raw = fs.readFileSync(configPath, "utf-8");
599
- const parsed = JSON.parse(raw);
600
- return normalizeConfig(parsed);
601
- } catch {
602
- return { ...DEFAULTS };
603
- }
604
- }
605
- function saveConfig(config) {
606
- const dir = getConfigDir();
607
- if (!fs.existsSync(dir)) {
608
- fs.mkdirSync(dir, { recursive: true });
609
- }
610
- const target = getConfigPath();
611
- const tmp = target + ".tmp";
612
- const data = JSON.stringify(config, null, 2);
613
- try {
614
- fs.writeFileSync(tmp, data, "utf-8");
615
- fs.renameSync(tmp, target);
616
- } catch (err) {
617
- const code = err.code;
618
- if (code === "EPERM" || code === "EBUSY" || code === "EEXIST") {
619
- fs.writeFileSync(target, data, "utf-8");
620
- try {
621
- fs.unlinkSync(tmp);
622
- } catch {
623
- }
624
- } else {
625
- throw err;
626
- }
1113
+ fromVersion: b?.currentVersion,
1114
+ toVersion: b?.newVersion
1115
+ };
1116
+ }),
1117
+ commands
1118
+ };
627
1119
  }
628
- }
629
- function isManagerEnabled(config, managerId) {
630
- if (Object.prototype.hasOwnProperty.call(config.enabledManagers, managerId)) {
631
- return config.enabledManagers[managerId] ?? true;
1120
+ const stillOutdated = new Set(after.stillOutdated.map((p) => p.name));
1121
+ const packages = targets.map((name) => {
1122
+ const b = beforeByName.get(name);
1123
+ if (stillOutdated.has(name)) {
1124
+ return {
1125
+ name,
1126
+ outcome: "failed",
1127
+ fromVersion: b?.currentVersion,
1128
+ toVersion: b?.newVersion,
1129
+ failureKind: cmdKind ?? "COMMAND_FAILED"
1130
+ };
1131
+ }
1132
+ return {
1133
+ name,
1134
+ outcome: "upgraded",
1135
+ fromVersion: b?.currentVersion,
1136
+ toVersion: b?.newVersion
1137
+ };
1138
+ });
1139
+ const upgraded = packages.filter((p) => p.outcome === "upgraded").length;
1140
+ const failed = packages.filter((p) => p.outcome === "failed").length;
1141
+ let status;
1142
+ let reason;
1143
+ if (targets.length === 0) {
1144
+ status = "noop";
1145
+ } else if (failed === 0) {
1146
+ status = "success";
1147
+ } else if (upgraded === 0) {
1148
+ status = "failed";
1149
+ reason = cmdKind ?? "UNKNOWN";
1150
+ } else {
1151
+ status = "partial";
1152
+ reason = "PARTIAL";
632
1153
  }
633
- return true;
1154
+ const errors = packages.filter((p) => p.outcome === "failed").map((p) => `${p.name}: no se pudo actualizar (${p.failureKind})`);
1155
+ return {
1156
+ success: status === "success" || status === "noop",
1157
+ upgraded,
1158
+ failed,
1159
+ errors,
1160
+ status,
1161
+ skipped: 0,
1162
+ reason,
1163
+ reboot: rebootFrom(commands),
1164
+ packages,
1165
+ commands
1166
+ };
634
1167
  }
635
1168
 
1169
+ // src/lib/logger.ts
1170
+ import fs3 from "fs";
1171
+ import path3 from "path";
1172
+
636
1173
  // src/lib/log-retention.ts
637
1174
  import fs2 from "fs";
638
1175
  import path2 from "path";
@@ -930,7 +1467,8 @@ function fromDescriptor(d, cfg, deps = defaultDeps) {
930
1467
  platform: process.platform,
931
1468
  sudoMode: sudoMode2,
932
1469
  meta: {},
933
- signal
1470
+ signal,
1471
+ logTailBytes: cfg.logTailBytes
934
1472
  });
935
1473
  const upgradeTimeout = cfg.timeoutsMs[d.id] ?? d.defaultTimeoutMs ?? UPGRADE_TIMEOUT;
936
1474
  function sudoFor(spec, c) {
@@ -1054,12 +1592,19 @@ function fromDescriptor(d, cfg, deps = defaultDeps) {
1054
1592
  const pp = d.percentParser ? (line) => d.percentParser(line, c) : void 0;
1055
1593
  const runOne = async function* (spec) {
1056
1594
  yield { type: "log", message: `${spec.cmd} ${spec.args.join(" ")}` };
1057
- const rec = yield* deps.runStream(
1595
+ const stream = deps.runStream(
1058
1596
  spec.cmd,
1059
1597
  spec.args,
1060
- { timeoutMs: spec.timeout ?? upgradeTimeout, sudo: sudoFor(spec, c), signal: c.signal },
1598
+ { timeoutMs: spec.timeout ?? upgradeTimeout, sudo: sudoFor(spec, c), signal: c.signal, tailBytes: cfg.logTailBytes },
1061
1599
  pp
1062
1600
  );
1601
+ let item = await stream.next();
1602
+ while (!item.done) {
1603
+ const currentPackage = d.packageParser?.(item.value.message, c);
1604
+ yield currentPackage ? { ...item.value, type: "progress", package: currentPackage } : item.value;
1605
+ item = await stream.next();
1606
+ }
1607
+ const rec = item.value;
1063
1608
  commands.push(rec);
1064
1609
  logCommand(rec);
1065
1610
  };
@@ -1131,6 +1676,9 @@ function makeFractionParser(re) {
1131
1676
 
1132
1677
  // src/managers/descriptors/brew.ts
1133
1678
  var brewUpgradePercent = makeFractionParser(/Upgrading (\d+)\/(\d+)/);
1679
+ function parseBrewPackage(line) {
1680
+ return line.match(/^==> (?:Upgrading|Installing) ([a-zA-Z][\w@./+-]*)(?:\s|$)/)?.[1];
1681
+ }
1134
1682
  function parseBrewOutdated(stdout) {
1135
1683
  try {
1136
1684
  const data = JSON.parse(stdout);
@@ -1159,7 +1707,8 @@ var brew = {
1159
1707
  preUpgradeCmds: () => [{ cmd: "brew", args: ["update"] }],
1160
1708
  upgradeCmd: (pkgs) => ({ cmd: "brew", args: pkgs && pkgs.length ? ["upgrade", ...pkgs] : ["upgrade"] }),
1161
1709
  postUpgradeCmds: () => [{ cmd: "brew", args: ["cleanup"] }],
1162
- percentParser: (line) => brewUpgradePercent(line)
1710
+ percentParser: (line) => brewUpgradePercent(line),
1711
+ packageParser: parseBrewPackage
1163
1712
  };
1164
1713
 
1165
1714
  // src/lib/exec/capabilities.ts
@@ -1183,8 +1732,8 @@ async function pythonModuleCmd() {
1183
1732
  return once("pip:python", async () => {
1184
1733
  const candidates = process.platform === "win32" ? ["python", "py", "python3"] : ["python3", "python"];
1185
1734
  for (const c of candidates) {
1186
- const probe = await execCommand(c, ["-m", "pip", "--version"], 5e3);
1187
- if (probe.exitCode === 0) return c;
1735
+ const probe2 = await execCommand(c, ["-m", "pip", "--version"], 5e3);
1736
+ if (probe2.exitCode === 0) return c;
1188
1737
  }
1189
1738
  return null;
1190
1739
  });
@@ -1203,8 +1752,8 @@ function parsePipOutdated(stdout) {
1203
1752
  async function pep668Flags() {
1204
1753
  return once("pip:pep668", async () => {
1205
1754
  const { cmd, baseArgs } = await resolvedInvocation();
1206
- const probe = await execCommand(cmd, [...baseArgs, "install", "--user", "--dry-run", "pip"], 5e3);
1207
- const managed = (probe.stdout + probe.stderr).includes("externally-managed");
1755
+ const probe2 = await execCommand(cmd, [...baseArgs, "install", "--user", "--dry-run", "pip"], 5e3);
1756
+ const managed = (probe2.stdout + probe2.stderr).includes("externally-managed");
1208
1757
  return managed ? ["--break-system-packages"] : [];
1209
1758
  });
1210
1759
  }
@@ -1239,7 +1788,7 @@ var pip = {
1239
1788
  if (target.length) {
1240
1789
  const args2 = [...baseArgs, "install", "--user", "--upgrade", ...flags, ...target];
1241
1790
  yield { type: "log", message: `${cmd} ${args2.join(" ")}` };
1242
- const rec = yield* runStream(cmd, args2, { timeoutMs: 3e5, sudo: false, signal: ctx.signal });
1791
+ const rec = yield* runStream(cmd, args2, { timeoutMs: 3e5, sudo: false, signal: ctx.signal, tailBytes: ctx.logTailBytes });
1243
1792
  commands.push(rec);
1244
1793
  logCommand(rec);
1245
1794
  }
@@ -1379,7 +1928,7 @@ var gem = {
1379
1928
  if (target.length) {
1380
1929
  const args2 = updateArgs(target, useSudo);
1381
1930
  yield { type: "log", message: `${useSudo ? "sudo " : ""}gem ${args2.join(" ")}` };
1382
- const rec = yield* runStream("gem", args2, { timeoutMs: 3e5, sudo: useSudo, signal: ctx.signal });
1931
+ const rec = yield* runStream("gem", args2, { timeoutMs: 3e5, sudo: useSudo, signal: ctx.signal, tailBytes: ctx.logTailBytes });
1383
1932
  commands.push(rec);
1384
1933
  logCommand(rec);
1385
1934
  }
@@ -1480,7 +2029,7 @@ var winget = {
1480
2029
  const commands = [];
1481
2030
  const run = async function* (args2) {
1482
2031
  yield { type: "log", message: `winget ${args2.join(" ")}` };
1483
- const rec = yield* runStream("winget", args2, { timeoutMs: 6e5, sudo: false, signal: ctx.signal });
2032
+ const rec = yield* runStream("winget", args2, { timeoutMs: 6e5, sudo: false, signal: ctx.signal, tailBytes: ctx.logTailBytes });
1484
2033
  commands.push(rec);
1485
2034
  logCommand(rec);
1486
2035
  };
@@ -1726,7 +2275,7 @@ var flutter = {
1726
2275
  if (before.length) {
1727
2276
  const args2 = ["upgrade", "--force"];
1728
2277
  yield { type: "log", message: `flutter ${args2.join(" ")}` };
1729
- const rec = yield* runStream("flutter", args2, { timeoutMs: 6e5, sudo: false, signal: ctx.signal });
2278
+ const rec = yield* runStream("flutter", args2, { timeoutMs: 6e5, sudo: false, signal: ctx.signal, tailBytes: ctx.logTailBytes });
1730
2279
  commands.push(rec);
1731
2280
  logCommand(rec);
1732
2281
  }
@@ -1790,7 +2339,7 @@ var angular = {
1790
2339
  if (target.length) {
1791
2340
  const args2 = ["install", "-g", `${PACKAGE}@latest`];
1792
2341
  yield { type: "log", message: `npm ${args2.join(" ")}` };
1793
- const rec = yield* runStream("npm", args2, { timeoutMs: 3e5, sudo: false, signal: ctx.signal });
2342
+ const rec = yield* runStream("npm", args2, { timeoutMs: 3e5, sudo: false, signal: ctx.signal, tailBytes: ctx.logTailBytes });
1794
2343
  commands.push(rec);
1795
2344
  logCommand(rec);
1796
2345
  }
@@ -1919,7 +2468,7 @@ var goLang = {
1919
2468
  const commands = [];
1920
2469
  const args2 = ["upgrade", "go"];
1921
2470
  yield { type: "log", message: `brew ${args2.join(" ")}` };
1922
- const rec = yield* runStream("brew", args2, { timeoutMs: 3e5, sudo: false, signal: ctx.signal });
2471
+ const rec = yield* runStream("brew", args2, { timeoutMs: 3e5, sudo: false, signal: ctx.signal, tailBytes: ctx.logTailBytes });
1923
2472
  commands.push(rec);
1924
2473
  logCommand(rec);
1925
2474
  yield { type: "phase", phase: "verifying", message: "Verificando resultado..." };
@@ -2075,7 +2624,7 @@ var pnpm = {
2075
2624
  if (target.length) {
2076
2625
  const args2 = packages && packages.length ? ["update", "-g", ...packages] : ["update", "-g"];
2077
2626
  yield { type: "log", message: `pnpm ${args2.join(" ")}` };
2078
- const rec = yield* runStream("pnpm", args2, { timeoutMs: 3e5, sudo: false, signal: ctx.signal });
2627
+ const rec = yield* runStream("pnpm", args2, { timeoutMs: 3e5, sudo: false, signal: ctx.signal, tailBytes: ctx.logTailBytes });
2079
2628
  commands.push(rec);
2080
2629
  logCommand(rec);
2081
2630
  }
@@ -2178,7 +2727,7 @@ var yarn = {
2178
2727
  if (target.length) {
2179
2728
  const args2 = packages && packages.length ? ["global", "upgrade", ...packages] : ["global", "upgrade"];
2180
2729
  yield { type: "log", message: `yarn ${args2.join(" ")}` };
2181
- const rec = yield* runStream("yarn", args2, { timeoutMs: 3e5, sudo: false, signal: ctx.signal });
2730
+ const rec = yield* runStream("yarn", args2, { timeoutMs: 3e5, sudo: false, signal: ctx.signal, tailBytes: ctx.logTailBytes });
2182
2731
  commands.push(rec);
2183
2732
  logCommand(rec);
2184
2733
  }
@@ -2235,7 +2784,7 @@ var bun = {
2235
2784
  const commands = [];
2236
2785
  const args2 = packages && packages.length ? ["update", "-g", ...packages] : ["update", "-g"];
2237
2786
  yield { type: "log", message: `bun ${args2.join(" ")}` };
2238
- const rec = yield* runStream("bun", args2, { timeoutMs: 3e5, sudo: false, signal: ctx.signal });
2787
+ const rec = yield* runStream("bun", args2, { timeoutMs: 3e5, sudo: false, signal: ctx.signal, tailBytes: ctx.logTailBytes });
2239
2788
  commands.push(rec);
2240
2789
  logCommand(rec);
2241
2790
  yield { type: "phase", phase: "verifying", message: "Verificando resultado..." };
@@ -2271,8 +2820,8 @@ function parseMiseOutdated(stdout) {
2271
2820
  bodyStart = headerIdx + 1;
2272
2821
  }
2273
2822
  const norm = (v) => {
2274
- const t3 = v?.trim();
2275
- return t3 && t3 !== "-" ? t3 : "?";
2823
+ const t2 = v?.trim();
2824
+ return t2 && t2 !== "-" ? t2 : "?";
2276
2825
  };
2277
2826
  return lines.slice(bodyStart).map((line) => {
2278
2827
  const cols = line.trim().split(/\s+/);
@@ -2551,7 +3100,7 @@ var pipx = {
2551
3100
  if (before.length) {
2552
3101
  const args2 = ["upgrade-all"];
2553
3102
  yield { type: "log", message: `pipx ${args2.join(" ")}` };
2554
- const rec = yield* runStream("pipx", args2, { timeoutMs: 3e5, sudo: false, signal: ctx.signal });
3103
+ const rec = yield* runStream("pipx", args2, { timeoutMs: 3e5, sudo: false, signal: ctx.signal, tailBytes: ctx.logTailBytes });
2555
3104
  commands.push(rec);
2556
3105
  logCommand(rec);
2557
3106
  }
@@ -2671,472 +3220,23 @@ async function pool(items, limit, worker) {
2671
3220
  await worker(item);
2672
3221
  }
2673
3222
  };
2674
- const lanes = Math.max(1, Math.min(limit, items.length));
2675
- await Promise.all(Array.from({ length: lanes }, () => run()));
2676
- }
2677
- async function runEngine(tasks, opts) {
2678
- const results = new Array(tasks.length);
2679
- const indexed = tasks.map((task, index) => ({ task, index }));
2680
- const adminLane = indexed.filter((t3) => t3.task.manager.requiresAdmin);
2681
- const fastLane = indexed.filter((t3) => !t3.task.manager.requiresAdmin);
2682
- await Promise.all([
2683
- pool(fastLane, opts.concurrency, async ({ task, index }) => {
2684
- results[index] = await runTask(task, opts);
2685
- }),
2686
- pool(adminLane, 1, async ({ task, index }) => {
2687
- results[index] = await runTask(task, opts);
2688
- })
2689
- ]);
2690
- return results;
2691
- }
2692
-
2693
- // src/i18n/es.ts
2694
- var es = {
2695
- // Navegación
2696
- nav: {
2697
- title: "KINETIC_PKG_MGR",
2698
- dashboard: "PANEL",
2699
- packages: "PAQUETES",
2700
- registry: "REGISTRO",
2701
- settings: "AJUSTES",
2702
- version: "v1.0.0"
2703
- },
2704
- // Teclas de acción (barra inferior)
2705
- keys: {
2706
- quit: "[Q] SALIR",
2707
- help: "[?] AYUDA",
2708
- next: "[TAB] SIGUIENTE",
2709
- exec: "[ENTER] EJECUTAR",
2710
- back: "[ESC] VOLVER",
2711
- select: "[ESPACIO] SELECCIONAR",
2712
- update: "[U] ACTUALIZAR",
2713
- sync: "[S] SINCRONIZAR",
2714
- logView: "[F1] VER LOG"
2715
- },
2716
- // Panel principal (Dashboard)
2717
- dashboard: {
2718
- title: "PANEL_",
2719
- status: "ESTADO: ENTORNO ACTIVO",
2720
- totalUpdates: "TOTAL ACTUALIZACIONES",
2721
- systemLoad: "CARGA DEL SISTEMA",
2722
- systemInfo: "INFO_SISTEMA",
2723
- os: "SO",
2724
- kernel: "KERNEL",
2725
- uptime: "ACTIVO",
2726
- lastScan: "\xDALTIMO ESCANEO",
2727
- terminalLog: "TERMINAL_LOG",
2728
- noManagers: "No se detectaron gestores de paquetes",
2729
- scanning: "Escaneando...",
2730
- active: "ACTIVO",
2731
- degraded: "DEGRADADO",
2732
- available: "DISPONIBLE"
2733
- },
2734
- // Actualizaciones activas
2735
- activeUpdates: {
2736
- title: "ACTUALIZACIONES_ACTIVAS",
2737
- syncing: "\u25CF SINCRONIZANDO...",
2738
- stdout: "STDOUT \u2014 SESI\xD3N",
2739
- active: "ACTIVO",
2740
- success: "EXITOSO",
2741
- errors: "ERRORES",
2742
- pending: "[PENDIENTE]",
2743
- ok: "[OK]",
2744
- err: "[ERR]",
2745
- noActive: "No hay actualizaciones en curso",
2746
- goToPackages: "Ve a PAQUETES para iniciar una actualizaci\xF3n",
2747
- verifying: "VERIFICANDO_SUMA...",
2748
- retrying: "REINTENTANDO_EN_5S",
2749
- upgraded: "actualizado(s)",
2750
- failed: "fallido(s)",
2751
- noChanges: "Sin cambios",
2752
- allDone: "\u25CF COMPLETADO",
2753
- rescanHint: "Re-escanear actualizaciones disponibles"
2754
- },
2755
- // Sincronización de paquetes
2756
- packageSync: {
2757
- title: "SYNC_PAQUETES.",
2758
- diskUsage: "USO DE DISCO",
2759
- queueSize: "COLA",
2760
- pending: "OPERACIONES_PENDIENTES",
2761
- colSel: "SEL",
2762
- colManager: "GESTOR",
2763
- colPackage: "PAQUETE",
2764
- colVersion: "VERSION",
2765
- colNew: "NUEVA",
2766
- colSize: "TAMA\xD1O",
2767
- hint: "\u203A Presiona [ESPACIO] para seleccionar, [U] para Actualizar Seleccionados",
2768
- eligible: "paquetes elegibles para actualizar",
2769
- systemState: "ESTADO DEL SISTEMA",
2770
- noUpdates: "El sistema est\xE1 actualizado",
2771
- requiresAdmin: "REQUIERE ADMIN",
2772
- manualCmd: "Comando manual:"
2773
- },
2774
- // Ajustes
2775
- settings: {
2776
- title: "CONFIGURACI\xD3N_DEL_SISTEMA",
2777
- subtitle: "KINETIC::PKG::AJUSTES",
2778
- nav: {
2779
- general: "General",
2780
- sources: "Fuentes",
2781
- automation: "Automatizaci\xF3n",
2782
- networking: "Red",
2783
- advanced: "Avanzado"
2784
- },
2785
- activeManagers: "[01] GESTORES DE PAQUETES ACTIVOS",
2786
- automation: "[02] AUTOMATIZACI\xD3N Y LOGS",
2787
- autoScanInterval: "INTERVALO_AUTO_ESCANEO",
2788
- autoScanDesc: "Tiempo entre escaneos autom\xE1ticos.",
2789
- verbosity: "NIVEL_VERBOSIDAD",
2790
- verbosityDesc: "Controla la cantidad de datos guardados en logs.",
2791
- notifications: "NOTIFICACIONES",
2792
- desktopAlerts: "ALERTAS DE ESCRITORIO",
2793
- terminalBell: "CAMPANILLA",
2794
- telemetry: "TELEMETR\xCDA",
2795
- anonymousData: "DATOS AN\xD3NIMOS",
2796
- anonymousDesc: "Comparte datos de uso para mejorar la herramienta.",
2797
- language: "IDIOMA",
2798
- statusSynced: "Configuraci\xF3n sincronizada con archivo local.",
2799
- stable: "ESTABLE",
2800
- detected: "DETECTADO",
2801
- notFound: "NO ENCONTRADO",
2802
- on: "[ ON ]",
2803
- off: "[OFF]",
2804
- seconds: "SEGUNDOS"
2805
- },
2806
- // Estados comunes
2807
- states: {
2808
- loading: "Cargando...",
2809
- error: "Error",
2810
- success: "Exitoso",
2811
- warning: "Advertencia",
2812
- notFound: "No encontrado",
2813
- available: "Disponible",
2814
- unavailable: "No disponible",
2815
- requiresAdmin: "Requiere admin",
2816
- minutesAgo: "hace %d min",
2817
- justNow: "ahora mismo",
2818
- never: "nunca"
2819
- },
2820
- // Managers
2821
- managers: {
2822
- brew: "Homebrew",
2823
- pip: "pip / Python",
2824
- npm: "Node NPM",
2825
- conda: "Conda",
2826
- gem: "RubyGems",
2827
- softwareupdate: "macOS Updates",
2828
- winget: "Winget",
2829
- apt: "APT / Debian",
2830
- dnf: "DNF / Fedora",
2831
- pacman: "Pacman / Arch",
2832
- flatpak: "Flatpak",
2833
- snap: "Snap",
2834
- flutter: "Flutter SDK",
2835
- angular: "Angular CLI",
2836
- cargo: "Cargo binarios",
2837
- "go-lang": "Go SDK",
2838
- composer: "Composer / PHP",
2839
- choco: "Chocolatey",
2840
- pnpm: "pnpm",
2841
- yarn: "Yarn",
2842
- bun: "Bun",
2843
- mise: "mise",
2844
- asdf: "asdf",
2845
- rustup: "Rust / rustup",
2846
- mas: "Mac App Store",
2847
- scoop: "Scoop",
2848
- pipx: "pipx"
2849
- },
2850
- // Verbosidad
2851
- verbosity: {
2852
- silent: "SILENCIO",
2853
- info: "NORMAL",
2854
- debug: "DEBUG",
2855
- trace: "DETALLADO"
2856
- },
2857
- // Flujo lineal — etiquetas de fase/paso
2858
- flow: {
2859
- step: "Paso",
2860
- detecting: "Detectando gestores",
2861
- scanning: "Buscando actualizaciones",
2862
- select: "Seleccionar",
2863
- confirm: "Confirmar",
2864
- updating: "Actualizando",
2865
- summary: "Resumen",
2866
- detail: "Detalle por paquete",
2867
- settings: "Ajustes"
2868
- },
2869
- // Etiquetas de estado por-gestor (ManagerStatus)
2870
- status: {
2871
- pending: "PENDIENTE",
2872
- scanning: "ESCANEANDO",
2873
- outdated: "DISPONIBLE",
2874
- uptodate: "AL D\xCDA",
2875
- queued: "EN COLA",
2876
- running: "ACTUALIZANDO",
2877
- done: "OK",
2878
- failed: "ERROR",
2879
- skipped: "MANUAL",
2880
- unknown: "INDETERMINADO"
2881
- },
2882
- // Cadenas de la interfaz del flujo
2883
- ui: {
2884
- detecting: "Detectando gestores de paquetes...",
2885
- scanning: "Buscando actualizaciones...",
2886
- noUpdates: "Todo est\xE1 al d\xEDa. No hay actualizaciones.",
2887
- selected: "seleccionados",
2888
- willRun: "Se ejecutar\xE1:",
2889
- upgraded: "actualizados",
2890
- failed: "fallidos",
2891
- skipped: "omitidos (manual)",
2892
- allDone: "COMPLETADO",
2893
- withErrors: "COMPLETADO CON ERRORES",
2894
- logAt: "Registro completo en:",
2895
- manualNeeded: "Requiere ejecuci\xF3n manual:",
2896
- selectHint: "Espacio marcar \xB7 A todos \xB7 N ninguno \xB7 Enter continuar \xB7 S ajustes \xB7 Q salir",
2897
- confirmHint: "Enter actualizar \xB7 Esc volver \xB7 Q salir",
2898
- updatingHint: "Esc cancelar",
2899
- passwordNote: 'Si aparece "Password:" abajo, es un gestor (p.ej. un cask de brew): escr\xEDbela y Enter.',
2900
- summaryHint: "R re-escanear \xB7 Q salir",
2901
- elapsed: "transcurrido",
2902
- cancel: "Cancelando...",
2903
- undetermined: "no se pudo determinar",
2904
- undeterminedCount: "no se pudieron determinar",
2905
- undeterminedTotal: "indeterminados",
2906
- detailHint: "D detalle \xB7 R re-escanear \xB7 Q salir",
2907
- detailBack: "\u2191\u2193 recorrer \xB7 D volver al resumen \xB7 Q salir",
2908
- noChanges: "Ninguna corrida cambi\xF3 paquetes."
2909
- }
2910
- };
2911
-
2912
- // src/i18n/en.ts
2913
- var en = {
2914
- nav: {
2915
- title: "KINETIC_PKG_MGR",
2916
- dashboard: "DASHBOARD",
2917
- packages: "PACKAGES",
2918
- registry: "REGISTRY",
2919
- settings: "SETTINGS",
2920
- version: "v1.0.0"
2921
- },
2922
- keys: {
2923
- quit: "[Q] QUIT",
2924
- help: "[?] HELP",
2925
- next: "[TAB] NEXT",
2926
- exec: "[ENTER] EXEC",
2927
- back: "[ESC] BACK",
2928
- select: "[SPACE] SELECT",
2929
- update: "[U] UPDATE",
2930
- sync: "[S] SYNC",
2931
- logView: "[F1] LOG VIEW"
2932
- },
2933
- dashboard: {
2934
- title: "DASHBOARD_",
2935
- status: "STATUS: ACTIVE ENVIRONMENT",
2936
- totalUpdates: "TOTAL UPDATES",
2937
- systemLoad: "SYSTEM LOAD",
2938
- systemInfo: "SYSTEM_INFO",
2939
- os: "OS",
2940
- kernel: "KERNEL",
2941
- uptime: "UPTIME",
2942
- lastScan: "LAST SCAN",
2943
- terminalLog: "TERMINAL_LOG",
2944
- noManagers: "No package managers detected",
2945
- scanning: "Scanning...",
2946
- active: "ACTIVE",
2947
- degraded: "DEGRADED",
2948
- available: "AVAILABLE"
2949
- },
2950
- activeUpdates: {
2951
- title: "ACTIVE_UPDATES",
2952
- syncing: "\u25CF SYNCING_REPOS...",
2953
- stdout: "STDOUT \u2014 SESSION",
2954
- active: "ACTIVE",
2955
- success: "SUCCESS",
2956
- errors: "ERRORS",
2957
- pending: "[PENDING]",
2958
- ok: "[OK]",
2959
- err: "[ERR]",
2960
- noActive: "No active updates",
2961
- goToPackages: "Go to PACKAGES to start an update",
2962
- verifying: "VERIFYING_CHECKSUM...",
2963
- retrying: "RETRYING_IN_5S",
2964
- upgraded: "upgraded",
2965
- failed: "failed",
2966
- noChanges: "No changes",
2967
- allDone: "\u25CF COMPLETED",
2968
- rescanHint: "Re-scan for available updates"
2969
- },
2970
- packageSync: {
2971
- title: "PACKAGE_SYNC.",
2972
- diskUsage: "DISK USAGE",
2973
- queueSize: "QUEUE SIZE",
2974
- pending: "PENDING_OPERATIONS",
2975
- colSel: "SEL",
2976
- colManager: "MANAGER",
2977
- colPackage: "PACKAGE",
2978
- colVersion: "VERSION",
2979
- colNew: "NEW",
2980
- colSize: "SIZE",
2981
- hint: "\u203A Press [SPACE] to select, [U] to Update Selected",
2982
- eligible: "packages eligible for update",
2983
- systemState: "SYSTEM STATE",
2984
- noUpdates: "System is up to date",
2985
- requiresAdmin: "REQUIRES ADMIN",
2986
- manualCmd: "Manual command:"
2987
- },
2988
- settings: {
2989
- title: "SYSTEM_CONFIGURATION",
2990
- subtitle: "KINETIC::PKG::SETTINGS",
2991
- nav: {
2992
- general: "General",
2993
- sources: "Sources",
2994
- automation: "Automation",
2995
- networking: "Networking",
2996
- advanced: "Advanced"
2997
- },
2998
- activeManagers: "[01] ACTIVE PACKAGE MANAGERS",
2999
- automation: "[02] AUTOMATION & LOGGING",
3000
- autoScanInterval: "AUTO_SCAN_INTERVAL",
3001
- autoScanDesc: "Time between automatic global package scans.",
3002
- verbosity: "VERBOSITY_LEVEL",
3003
- verbosityDesc: "Controls the amount of data saved to logs.",
3004
- notifications: "NOTIFICATIONS",
3005
- desktopAlerts: "DESKTOP ALERTS",
3006
- terminalBell: "TERMINAL BELL",
3007
- telemetry: "TELEMETRY",
3008
- anonymousData: "ANONYMOUS DATA",
3009
- anonymousDesc: "Share usage data to improve kinetic tools.",
3010
- language: "LANGUAGE",
3011
- statusSynced: "Configuration is currently synced with local yaml file.",
3012
- stable: "STABLE",
3013
- detected: "DETECTED",
3014
- notFound: "NOT FOUND",
3015
- on: "[ ON ]",
3016
- off: "[OFF]",
3017
- seconds: "SECONDS"
3018
- },
3019
- states: {
3020
- loading: "Loading...",
3021
- error: "Error",
3022
- success: "Success",
3023
- warning: "Warning",
3024
- notFound: "Not found",
3025
- available: "Available",
3026
- unavailable: "Unavailable",
3027
- requiresAdmin: "Requires admin",
3028
- minutesAgo: "%d mins ago",
3029
- justNow: "just now",
3030
- never: "never"
3031
- },
3032
- managers: {
3033
- brew: "Homebrew",
3034
- pip: "pip / Python",
3035
- npm: "Node NPM",
3036
- conda: "Conda",
3037
- gem: "RubyGems",
3038
- softwareupdate: "macOS Updates",
3039
- winget: "Winget",
3040
- apt: "APT / Debian",
3041
- dnf: "DNF / Fedora",
3042
- pacman: "Pacman / Arch",
3043
- flatpak: "Flatpak",
3044
- snap: "Snap",
3045
- flutter: "Flutter SDK",
3046
- angular: "Angular CLI",
3047
- cargo: "Cargo binaries",
3048
- "go-lang": "Go SDK",
3049
- composer: "Composer / PHP",
3050
- choco: "Chocolatey",
3051
- pnpm: "pnpm",
3052
- yarn: "Yarn",
3053
- bun: "Bun",
3054
- mise: "mise",
3055
- asdf: "asdf",
3056
- rustup: "Rust / rustup",
3057
- mas: "Mac App Store",
3058
- scoop: "Scoop",
3059
- pipx: "pipx"
3060
- },
3061
- verbosity: {
3062
- silent: "SILENT",
3063
- info: "NORMAL",
3064
- debug: "DEBUG",
3065
- trace: "TRACE"
3066
- },
3067
- flow: {
3068
- step: "Step",
3069
- detecting: "Detecting managers",
3070
- scanning: "Checking for updates",
3071
- select: "Select",
3072
- confirm: "Confirm",
3073
- updating: "Updating",
3074
- summary: "Summary",
3075
- detail: "Per-package detail",
3076
- settings: "Settings"
3077
- },
3078
- status: {
3079
- pending: "PENDING",
3080
- scanning: "SCANNING",
3081
- outdated: "AVAILABLE",
3082
- uptodate: "UP TO DATE",
3083
- queued: "QUEUED",
3084
- running: "UPDATING",
3085
- done: "OK",
3086
- failed: "ERROR",
3087
- skipped: "MANUAL",
3088
- unknown: "UNDETERMINED"
3089
- },
3090
- ui: {
3091
- detecting: "Detecting package managers...",
3092
- scanning: "Checking for updates...",
3093
- noUpdates: "Everything is up to date. No updates.",
3094
- selected: "selected",
3095
- willRun: "Will run:",
3096
- upgraded: "upgraded",
3097
- failed: "failed",
3098
- skipped: "skipped (manual)",
3099
- allDone: "DONE",
3100
- withErrors: "DONE WITH ERRORS",
3101
- logAt: "Full log at:",
3102
- manualNeeded: "Manual command needed:",
3103
- selectHint: "Space toggle \xB7 A all \xB7 N none \xB7 Enter continue \xB7 S settings \xB7 Q quit",
3104
- confirmHint: "Enter update \xB7 Esc back \xB7 Q quit",
3105
- updatingHint: "Esc cancel",
3106
- passwordNote: 'If a "Password:" prompt appears below, it is a manager (e.g. a brew cask): type it and Enter.',
3107
- summaryHint: "R rescan \xB7 Q quit",
3108
- elapsed: "elapsed",
3109
- cancel: "Cancelling...",
3110
- undetermined: "could not be determined",
3111
- undeterminedCount: "could not be determined",
3112
- undeterminedTotal: "undetermined",
3113
- detailHint: "D detail \xB7 R rescan \xB7 Q quit",
3114
- detailBack: "\u2191\u2193 scroll \xB7 D back to summary \xB7 Q quit",
3115
- noChanges: "No run changed any package."
3116
- }
3117
- };
3118
-
3119
- // src/i18n/index.ts
3120
- var currentLang = detectLanguage();
3121
- function detectLanguage() {
3122
- const lang = (process.env["LANG"] ?? process.env["LANGUAGE"] ?? "").toLowerCase();
3123
- if (lang.startsWith("en")) return "en";
3124
- return "es";
3125
- }
3126
- function setLanguage(lang) {
3127
- currentLang = lang;
3128
- }
3129
- var translations = { es, en };
3130
- function t(section, key) {
3131
- const dict = translations[currentLang] ?? es;
3132
- const sec = dict[section];
3133
- if (key === void 0) return sec;
3134
- return sec[key];
3223
+ const lanes = Math.max(1, Math.min(limit, items.length));
3224
+ await Promise.all(Array.from({ length: lanes }, () => run()));
3135
3225
  }
3136
- function managerName(id) {
3137
- const dict = translations[currentLang] ?? es;
3138
- const names = dict.managers;
3139
- return names[id] ?? id;
3226
+ async function runEngine(tasks, opts) {
3227
+ const results = new Array(tasks.length);
3228
+ const indexed = tasks.map((task, index) => ({ task, index }));
3229
+ const adminLane = indexed.filter((t2) => t2.task.manager.requiresAdmin);
3230
+ const fastLane = indexed.filter((t2) => !t2.task.manager.requiresAdmin);
3231
+ await Promise.all([
3232
+ pool(fastLane, opts.concurrency, async ({ task, index }) => {
3233
+ results[index] = await runTask(task, opts);
3234
+ }),
3235
+ pool(adminLane, 1, async ({ task, index }) => {
3236
+ results[index] = await runTask(task, opts);
3237
+ })
3238
+ ]);
3239
+ return results;
3140
3240
  }
3141
3241
 
3142
3242
  // src/hooks/use-app-machine.tsx
@@ -3382,11 +3482,10 @@ function useMachine() {
3382
3482
  }
3383
3483
  function useAppMachine(sudoMode2, nonInteractive2 = false) {
3384
3484
  const configRef = useRef(loadConfig());
3385
- const [state, dispatch] = useReducer(
3386
- appReducer,
3387
- void 0,
3388
- () => initialState(configRef.current, sudoMode2)
3389
- );
3485
+ const [state, dispatch] = useReducer(appReducer, void 0, () => {
3486
+ setLanguage(configRef.current.language);
3487
+ return initialState(configRef.current, sudoMode2);
3488
+ });
3390
3489
  const detectedRef = useRef([]);
3391
3490
  const abortRef = useRef(null);
3392
3491
  const runLogRef = useRef(null);
@@ -3461,7 +3560,7 @@ function useAppMachine(sudoMode2, nonInteractive2 = false) {
3461
3560
  }
3462
3561
  const tasks = detectedRef.current.filter((dm) => packagesByManager.has(dm.manager.id)).map((dm) => ({ manager: dm.manager, op: "upgrade", packages: packagesByManager.get(dm.manager.id) }));
3463
3562
  if (tasks.length === 0) return;
3464
- const queue = tasks.map((t3) => t3.manager.id);
3563
+ const queue = tasks.map((t2) => t2.manager.id);
3465
3564
  logSelection({
3466
3565
  offered: state.order.reduce((n, id) => n + (state.managers[id]?.outdated.length ?? 0), 0),
3467
3566
  chosen: state.selection.size,
@@ -3471,7 +3570,7 @@ function useAppMachine(sudoMode2, nonInteractive2 = false) {
3471
3570
  chosen: packagesByManager.get(id)?.length ?? 0
3472
3571
  }))
3473
3572
  });
3474
- dispatch({ type: "RUN_START", queue });
3573
+ dispatch({ type: "RUN_START", queue, at: Date.now() });
3475
3574
  const ac = new AbortController();
3476
3575
  abortRef.current = ac;
3477
3576
  const logRef = getLogFilePath() ?? void 0;
@@ -3528,8 +3627,8 @@ function useAppMachine(sudoMode2, nonInteractive2 = false) {
3528
3627
  if (e.phase === "queued") {
3529
3628
  enqueue({ type: "MGR_QUEUED", id });
3530
3629
  } else if (e.phase === "upgrading") {
3531
- if (e.event?.percent !== void 0) {
3532
- enqueue({ type: "MGR_PROGRESS", id, percent: e.event.percent });
3630
+ if (e.event?.percent !== void 0 || e.event?.package !== void 0) {
3631
+ enqueue({ type: "MGR_PROGRESS", id, percent: e.event.percent, currentPackage: e.event.package });
3533
3632
  } else if (!e.event) {
3534
3633
  enqueue({ type: "MGR_RUNNING", id, at: Date.now() });
3535
3634
  }
@@ -3561,7 +3660,7 @@ function useAppMachine(sudoMode2, nonInteractive2 = false) {
3561
3660
  error(`El motor termin\xF3 con error: ${String(err)}`);
3562
3661
  }).finally(() => {
3563
3662
  flush();
3564
- dispatch({ type: "RUN_DONE" });
3663
+ dispatch({ type: "RUN_DONE", at: Date.now() });
3565
3664
  abortRef.current = null;
3566
3665
  if (ac.signal.aborted) settleRun("cancelada", "corrida abortada en vuelo");
3567
3666
  else if (engineError !== null) settleRun("fallida", `motor: ${String(engineError)}`);
@@ -3569,6 +3668,7 @@ function useAppMachine(sudoMode2, nonInteractive2 = false) {
3569
3668
  });
3570
3669
  }, [state.selection, sudoMode2]);
3571
3670
  const cancelRun = useCallback(() => {
3671
+ dispatch({ type: "RUN_CANCEL" });
3572
3672
  abortRef.current?.abort();
3573
3673
  }, []);
3574
3674
  const rescan = useCallback(() => {
@@ -3576,7 +3676,11 @@ function useAppMachine(sudoMode2, nonInteractive2 = false) {
3576
3676
  dispatch({ type: "RESCAN" });
3577
3677
  void boot();
3578
3678
  }, [boot]);
3579
- const { exit } = useApp();
3679
+ const { exit: inkExit } = useApp();
3680
+ const exit = useCallback(() => {
3681
+ if (retireBanner()) setImmediate(inkExit);
3682
+ else inkExit();
3683
+ }, [inkExit]);
3580
3684
  const exitedRef = useRef(false);
3581
3685
  const finishNonInteractive = useCallback(
3582
3686
  (code) => {
@@ -3586,14 +3690,18 @@ function useAppMachine(sudoMode2, nonInteractive2 = false) {
3586
3690
  settleRun("completa");
3587
3691
  exit();
3588
3692
  if (!process.env["VITEST"]) {
3589
- const t3 = setTimeout(() => process.exit(code), 100);
3590
- t3.unref?.();
3693
+ const t2 = setTimeout(() => process.exit(code), 100);
3694
+ t2.unref?.();
3591
3695
  }
3592
3696
  },
3593
3697
  [exit]
3594
3698
  );
3595
3699
  useEffect(() => {
3596
3700
  if (!nonInteractive2) return;
3701
+ if (state.error) {
3702
+ finishNonInteractive(1);
3703
+ return;
3704
+ }
3597
3705
  if (state.phase === "select") {
3598
3706
  const hasOutdated = state.order.some((id) => (state.managers[id]?.outdated.length ?? 0) > 0);
3599
3707
  if (!hasOutdated) finishNonInteractive(0);
@@ -3607,6 +3715,7 @@ function useAppMachine(sudoMode2, nonInteractive2 = false) {
3607
3715
  }, [
3608
3716
  nonInteractive2,
3609
3717
  state.phase,
3718
+ state.error,
3610
3719
  state.selection.size,
3611
3720
  state.run.failedCount,
3612
3721
  state.order,
@@ -3631,8 +3740,8 @@ function useAppMachine(sudoMode2, nonInteractive2 = false) {
3631
3740
  settleRun("cedida", "consola elevada");
3632
3741
  exit();
3633
3742
  if (!process.env["VITEST"]) {
3634
- const t3 = setTimeout(() => process.exit(0), 100);
3635
- t3.unref?.();
3743
+ const t2 = setTimeout(() => process.exit(0), 100);
3744
+ t2.unref?.();
3636
3745
  }
3637
3746
  }
3638
3747
  })();
@@ -3690,238 +3799,163 @@ function MachineProvider({ value, children }) {
3690
3799
  return /* @__PURE__ */ jsx(MachineContext.Provider, { value, children });
3691
3800
  }
3692
3801
 
3802
+ // src/screens/keys.tsx
3803
+ import { Text } from "ink";
3804
+
3693
3805
  // src/hooks/use-safe-input.ts
3694
3806
  import { useInput, useStdin } from "ink";
3807
+ import { useCallback as useCallback2, useLayoutEffect, useRef as useRef2 } from "react";
3695
3808
  function useSafeInput(handler, options) {
3809
+ const latestHandler = useRef2(handler);
3810
+ useLayoutEffect(() => {
3811
+ latestHandler.current = handler;
3812
+ }, [handler]);
3813
+ const stableHandler = useCallback2((input, key) => latestHandler.current(input, key), []);
3696
3814
  const { isRawModeSupported } = useStdin();
3697
3815
  const active = (options?.isActive ?? true) && isRawModeSupported === true;
3698
- useInput(handler, { ...options, isActive: active });
3816
+ useInput(stableHandler, { ...options, isActive: active });
3699
3817
  }
3700
3818
 
3701
- // src/screens/detect.tsx
3702
- import { Box as Box2, Text as Text3 } from "ink";
3703
-
3704
- // src/components/step-header.tsx
3705
- import { Box, Text } from "ink";
3706
-
3707
- // src/theme.ts
3708
- var colors = {
3709
- // Superficies (fondo)
3710
- surface: "#131313",
3711
- surfaceContainer: "#201f1f",
3712
- surfaceContainerLow: "#1c1b1b",
3713
- surfaceContainerHigh: "#2a2a2a",
3714
- surfaceContainerHighest: "#353534",
3715
- surfaceContainerLowest: "#0e0e0e",
3716
- // Primario (púrpura)
3717
- primary: "#c9bfff",
3718
- primaryContainer: "#6a49f8",
3719
- onPrimary: "#131313",
3720
- onPrimaryContainer: "#f0e9ff",
3721
- // Secundario (rosa)
3722
- secondary: "#ffade0",
3723
- secondaryContainer: "#7a3060",
3724
- onSecondary: "#131313",
3725
- onSecondaryContainer: "#ffd8ef",
3726
- // Terciario (verde - señal de éxito/activo)
3727
- tertiary: "#31e368",
3728
- tertiaryContainer: "#005229",
3729
- onTertiary: "#131313",
3730
- onTertiaryContainer: "#adffd0",
3731
- // Error
3732
- error: "#ffb4ab",
3733
- errorContainer: "#93000a",
3734
- onError: "#690005",
3735
- onErrorContainer: "#ffdad6",
3736
- // Texto
3737
- onSurface: "#e5e2e1",
3738
- onSurfaceVariant: "#a09d9c",
3739
- // Ámbar — reservado al estado «no se pudo determinar»
3740
- unknown: "#f0b429",
3741
- // Bordes
3742
- outlineVariant: "#484556",
3743
- outline: "#6f6d70"
3744
- };
3745
- var semantic = {
3746
- action: colors.primary,
3747
- // foco / acción primaria (púrpura)
3748
- success: colors.tertiary,
3749
- // verde
3750
- error: colors.error,
3751
- // rojo
3752
- warning: colors.secondary,
3753
- // rosa (admin / skipped / atención)
3754
- // Ámbar — «no se pudo determinar». NO puede reusar `muted`, que hoy significa
3755
- // «al día»: eso es exactamente confundir «no lo sé» con «está bien»
3756
- // (DES-001@r1). Se distingue a la vez del rosa de advertencia y del gris.
3757
- unknown: colors.unknown,
3758
- text: colors.onSurface,
3759
- muted: colors.onSurfaceVariant
3819
+ // src/screens/keys.tsx
3820
+ import { jsx as jsx2 } from "react/jsx-runtime";
3821
+ var bindings = {
3822
+ quit: ["q"],
3823
+ retry: ["r"],
3824
+ down: ["downArrow", "j"],
3825
+ up: ["upArrow", "k"],
3826
+ mark: [" "],
3827
+ all: ["a"],
3828
+ none: ["n"],
3829
+ next: ["return"],
3830
+ settings: ["s"],
3831
+ back: ["escape"],
3832
+ detail: ["d"],
3833
+ language: ["l"],
3834
+ elevate: ["e"],
3835
+ start: ["return", "y"],
3836
+ cancel: ["escape"],
3837
+ ctrlC: ["ctrl+c"],
3838
+ confirmCancel: ["s"],
3839
+ continueRun: ["n", "escape"]
3760
3840
  };
3761
-
3762
- // src/lib/glyphs.ts
3763
- function shouldUseAscii(env, platform) {
3764
- if (env["TACUCHI_ASCII"] === "1") return true;
3765
- if (env["TACUCHI_ASCII"] === "0") return false;
3766
- if (env["TERM"] === "dumb") return true;
3767
- if (platform === "win32" && !env["WT_SESSION"]) return true;
3768
- return false;
3841
+ function commandsFor(handlers2) {
3842
+ return Object.entries(handlers2).map(([action, run]) => ({ keys: action === "confirmCancel" && getLanguage() === "en" ? ["y"] : bindings[action], label: t("hints", action), run }));
3843
+ }
3844
+ function dispatchKey(commands, key) {
3845
+ commands.find((command) => command.keys.includes(key))?.run();
3846
+ }
3847
+ function hintLines(commands, width) {
3848
+ const lines = [];
3849
+ for (const command of commands) {
3850
+ const last = lines.at(-1);
3851
+ if (last && last.length + command.label.length + 3 <= width) lines[lines.length - 1] = `${last} ${g.separator} ${command.label}`;
3852
+ else lines.push(command.label);
3853
+ }
3854
+ return lines;
3855
+ }
3856
+ function useScreenKeys(handlers2) {
3857
+ const { quitApp } = useMachine();
3858
+ const commands = commandsFor({ ...handlers2, ctrlC: handlers2.ctrlC ?? quitApp });
3859
+ useSafeInput((input, key) => {
3860
+ const special = ["return", "escape", "downArrow", "upArrow"].find((name) => key[name]);
3861
+ if (key.ctrl) {
3862
+ if (input === "c") dispatchKey(commands, "ctrl+c");
3863
+ return;
3864
+ }
3865
+ if (key.meta && !key.escape) return;
3866
+ dispatchKey(commands, special ?? input.toLowerCase());
3867
+ });
3868
+ return commands;
3869
+ }
3870
+ function KeyHints({ commands }) {
3871
+ const width = Math.min(process.stdout.columns ?? 100, 100) - 4;
3872
+ return /* @__PURE__ */ jsx2(Text, { color: semantic.muted, children: hintLines(commands, width).join("\n") });
3769
3873
  }
3770
- var UNICODE = {
3771
- pending: "\xB7",
3772
- scanning: "\u25CC",
3773
- outdated: "\u203A",
3774
- uptodate: "\u2713",
3775
- running: "\u25B8",
3776
- done: "\u2713",
3777
- failed: "\u2717",
3778
- skipped: "\u2298",
3779
- unknown: "?",
3780
- cursor: "\u276F",
3781
- checkOn: "[\u2713]",
3782
- checkOff: "[ ]",
3783
- arrow: "\u2192",
3784
- scrollUp: "\u25B2",
3785
- scrollDown: "\u25BC",
3786
- stepOn: "\u2586",
3787
- stepOff: "\u2581",
3788
- info: "\u24D8",
3789
- ellipsis: "\u2026",
3790
- bullet: "\u25B8",
3791
- reboot: "\u27F3"
3792
- };
3793
- var ASCII_GLYPHS = {
3794
- pending: ".",
3795
- scanning: "o",
3796
- outdated: ">",
3797
- uptodate: "+",
3798
- running: ">",
3799
- done: "+",
3800
- failed: "x",
3801
- skipped: "-",
3802
- unknown: "?",
3803
- cursor: ">",
3804
- checkOn: "[x]",
3805
- checkOff: "[ ]",
3806
- arrow: "->",
3807
- scrollUp: "^",
3808
- scrollDown: "v",
3809
- stepOn: "#",
3810
- stepOff: "_",
3811
- info: "i",
3812
- ellipsis: "...",
3813
- bullet: ">",
3814
- reboot: "*"
3815
- };
3816
- var ASCII = shouldUseAscii(process.env, process.platform);
3817
- var g = ASCII ? ASCII_GLYPHS : UNICODE;
3818
- var NO_ANIM = ASCII || !process.stdout.isTTY;
3819
- var SPINNER_UNICODE = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
3820
- var SPINNER_ASCII = ["|", "/", "-", "\\"];
3821
- var spinnerFrames = ASCII ? SPINNER_ASCII : SPINNER_UNICODE;
3822
3874
 
3823
- // src/components/step-header.tsx
3824
- import { jsx as jsx2, jsxs } from "react/jsx-runtime";
3825
- var STEP = {
3826
- detecting: { n: 1, key: "detecting" },
3827
- scanning: { n: 1, key: "scanning" },
3828
- select: { n: 2, key: "select" },
3829
- confirm: { n: 3, key: "confirm" },
3830
- updating: { n: 4, key: "updating" }
3831
- };
3832
- function StepHeader({ phase }) {
3833
- if (phase === "summary") {
3834
- return /* @__PURE__ */ jsx2(Box, { marginBottom: 1, children: /* @__PURE__ */ jsxs(Text, { color: semantic.success, bold: true, children: [
3835
- g.stepOn,
3836
- " ",
3837
- t("flow", "summary")
3838
- ] }) });
3839
- }
3840
- if (phase === "detail") {
3841
- return /* @__PURE__ */ jsx2(Box, { marginBottom: 1, children: /* @__PURE__ */ jsxs(Text, { color: semantic.action, bold: true, children: [
3842
- g.stepOn,
3843
- " ",
3844
- t("flow", "detail")
3845
- ] }) });
3846
- }
3847
- if (phase === "settings") {
3848
- return /* @__PURE__ */ jsx2(Box, { marginBottom: 1, children: /* @__PURE__ */ jsxs(Text, { color: semantic.action, bold: true, children: [
3849
- g.stepOn,
3850
- " ",
3851
- t("flow", "settings")
3852
- ] }) });
3853
- }
3854
- const step = STEP[phase];
3855
- if (!step) return null;
3856
- return /* @__PURE__ */ jsxs(Box, { marginBottom: 1, children: [
3857
- [1, 2, 3, 4].map((i) => /* @__PURE__ */ jsxs(Text, { color: i === step.n ? semantic.action : semantic.muted, bold: i === step.n, children: [
3858
- i === step.n ? g.stepOn : g.stepOff,
3859
- " "
3860
- ] }, i)),
3861
- /* @__PURE__ */ jsxs(Text, { color: semantic.muted, children: [
3862
- " ",
3863
- t("flow", "step"),
3864
- " ",
3865
- step.n,
3866
- "/4 \xB7",
3867
- " "
3868
- ] }),
3869
- /* @__PURE__ */ jsx2(Text, { color: semantic.action, bold: true, children: t("flow", step.key) })
3870
- ] });
3875
+ // src/lib/display-path.ts
3876
+ import { homedir } from "os";
3877
+ function compactPath(path7, width) {
3878
+ const home = homedir();
3879
+ const display = path7 === home || path7.startsWith(home + "/") || path7.startsWith(home + "\\") ? "~" + path7.slice(home.length) : path7;
3880
+ if (display.length <= width) return display;
3881
+ const available = Math.max(0, width - g.ellipsis.length);
3882
+ const left = Math.ceil(available / 2);
3883
+ return display.slice(0, left) + g.ellipsis + display.slice(display.length - (available - left));
3871
3884
  }
3872
3885
 
3886
+ // src/screens/detect.tsx
3887
+ import { Box, Text as Text3 } from "ink";
3888
+
3873
3889
  // src/components/status-glyph.tsx
3874
3890
  import { useEffect as useEffect2, useState as useState2 } from "react";
3875
3891
  import { Text as Text2 } from "ink";
3876
3892
  import { jsx as jsx3 } from "react/jsx-runtime";
3877
- var SPECS = {
3878
- pending: { glyph: g.pending, color: semantic.muted },
3879
- scanning: { glyph: g.scanning, color: semantic.action },
3880
- outdated: { glyph: g.outdated, color: semantic.warning },
3881
- uptodate: { glyph: g.uptodate, color: semantic.muted },
3882
- queued: { glyph: g.pending, color: semantic.muted },
3883
- running: { glyph: g.running, color: semantic.action },
3884
- done: { glyph: g.done, color: semantic.success },
3885
- failed: { glyph: g.failed, color: semantic.error },
3886
- skipped: { glyph: g.skipped, color: semantic.warning },
3887
- // Amber and a one-cell `?`: it cannot reuse `muted`, which is the colour of
3888
- // "up to date" — the confusion this state exists to remove (DES-001@r1). The
3889
- // spec lands here with the domain state because this table is exhaustive over
3890
- // ManagerStatus, so the state cannot exist without it.
3891
- unknown: { glyph: g.unknown, color: semantic.unknown }
3892
- };
3893
+ function specs() {
3894
+ return {
3895
+ cancelling: { glyph: g.running, color: semantic.warning },
3896
+ partial: { glyph: g.partial, color: semantic.error },
3897
+ pending: { glyph: g.pending, color: semantic.muted },
3898
+ scanning: { glyph: g.scanning, color: semantic.action },
3899
+ outdated: { glyph: g.outdated, color: semantic.warning },
3900
+ uptodate: { glyph: g.uptodate, color: semantic.muted },
3901
+ queued: { glyph: g.pending, color: semantic.muted },
3902
+ running: { glyph: g.running, color: semantic.action },
3903
+ done: { glyph: g.done, color: semantic.success },
3904
+ failed: { glyph: g.failed, color: semantic.error },
3905
+ skipped: { glyph: g.skipped, color: semantic.warning },
3906
+ // Amber and a one-cell `?`: it cannot reuse `muted`, which is the colour of
3907
+ // "up to date" — the confusion this state exists to remove (DES-001@r1). The
3908
+ // spec lands here with the domain state because this table is exhaustive over
3909
+ // ManagerStatus, so the state cannot exist without it.
3910
+ unknown: { glyph: g.unknown, color: semantic.unknown }
3911
+ };
3912
+ }
3893
3913
  function statusColor(status) {
3894
- return SPECS[status].color;
3914
+ return specs()[status].color;
3895
3915
  }
3896
3916
  function StatusGlyph({ status }) {
3897
- const spec = SPECS[status];
3917
+ const spec = specs()[status];
3898
3918
  return /* @__PURE__ */ jsx3(Text2, { color: spec.color, children: spec.glyph });
3899
3919
  }
3900
3920
  function RunningGlyph() {
3901
3921
  const [i, setI] = useState2(0);
3902
3922
  useEffect2(() => {
3903
3923
  if (NO_ANIM) return;
3904
- const t3 = setInterval(() => setI((n) => (n + 1) % spinnerFrames.length), 90);
3905
- return () => clearInterval(t3);
3924
+ const t2 = setInterval(() => setI((n) => (n + 1) % spinnerFrames.length), 90);
3925
+ return () => clearInterval(t2);
3906
3926
  }, []);
3907
3927
  const frame = NO_ANIM ? g.running : spinnerFrames[i] ?? g.running;
3908
- return /* @__PURE__ */ jsx3(Text2, { color: SPECS.running.color, children: frame });
3928
+ return /* @__PURE__ */ jsx3(Text2, { color: specs().running.color, children: frame });
3909
3929
  }
3910
3930
 
3911
3931
  // src/screens/detect.tsx
3912
- import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
3932
+ import { jsx as jsx4, jsxs } from "react/jsx-runtime";
3913
3933
  function DetectScreen() {
3914
- const { state } = useMachine();
3934
+ const { state, rescan, quitApp } = useMachine();
3935
+ const commands = useScreenKeys({ ...state.error ? { retry: rescan } : {}, quit: quitApp });
3915
3936
  const scanning = state.phase === "scanning";
3916
3937
  const done = state.order.filter((id) => {
3917
3938
  const s = state.managers[id]?.status;
3918
3939
  return s === "outdated" || s === "uptodate" || s === "unknown";
3919
3940
  }).length;
3920
- return /* @__PURE__ */ jsxs2(Box2, { flexDirection: "column", children: [
3921
- /* @__PURE__ */ jsx4(StepHeader, { phase: state.phase }),
3922
- /* @__PURE__ */ jsxs2(Box2, { marginBottom: 1, children: [
3941
+ if (state.error) return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", children: [
3942
+ /* @__PURE__ */ jsxs(Text3, { color: semantic.error, children: [
3943
+ g.failed,
3944
+ " ",
3945
+ t("ui", "detectionFailed")
3946
+ ] }),
3947
+ /* @__PURE__ */ jsx4(Text3, { color: semantic.text, children: state.error }),
3948
+ /* @__PURE__ */ jsxs(Text3, { color: semantic.muted, children: [
3949
+ t("ui", "logAt"),
3950
+ " ",
3951
+ compactPath(getLogFilePath() ?? "", Math.min(process.stdout.columns ?? 100, 100) - 4 - t("ui", "logAt").length)
3952
+ ] }),
3953
+ /* @__PURE__ */ jsx4(KeyHints, { commands })
3954
+ ] });
3955
+ return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", children: [
3956
+ /* @__PURE__ */ jsxs(Box, { marginBottom: 1, children: [
3923
3957
  /* @__PURE__ */ jsx4(Text3, { color: semantic.text, children: scanning ? t("ui", "scanning") : t("ui", "detecting") }),
3924
- scanning && /* @__PURE__ */ jsxs2(Text3, { color: semantic.muted, children: [
3958
+ scanning && /* @__PURE__ */ jsxs(Text3, { color: semantic.muted, children: [
3925
3959
  " ",
3926
3960
  "(",
3927
3961
  done,
@@ -3933,28 +3967,53 @@ function DetectScreen() {
3933
3967
  scanning && state.order.map((id) => {
3934
3968
  const e = state.managers[id];
3935
3969
  if (!e) return null;
3936
- return /* @__PURE__ */ jsxs2(Box2, { children: [
3937
- /* @__PURE__ */ jsx4(Box2, { width: 2, children: /* @__PURE__ */ jsx4(StatusGlyph, { status: e.status }) }),
3938
- /* @__PURE__ */ jsx4(Box2, { width: 18, children: /* @__PURE__ */ jsx4(Text3, { color: e.status === "outdated" ? semantic.text : semantic.muted, children: managerName(id) }) }),
3939
- e.status === "outdated" ? /* @__PURE__ */ jsxs2(Text3, { color: semantic.warning, children: [
3970
+ return /* @__PURE__ */ jsxs(Box, { children: [
3971
+ /* @__PURE__ */ jsx4(Box, { width: 2, children: /* @__PURE__ */ jsx4(StatusGlyph, { status: e.status }) }),
3972
+ /* @__PURE__ */ jsx4(Box, { width: 18, children: /* @__PURE__ */ jsx4(Text3, { color: e.status === "outdated" ? semantic.text : semantic.muted, children: managerName(id) }) }),
3973
+ e.status === "outdated" ? /* @__PURE__ */ jsxs(Text3, { color: semantic.warning, children: [
3940
3974
  e.outdated.length,
3941
3975
  " ",
3942
3976
  g.outdated
3943
3977
  ] }) : e.status === "uptodate" ? /* @__PURE__ */ jsx4(Text3, { color: colors.outline, children: "-" }) : e.status === "unknown" ? /* @__PURE__ */ jsx4(Text3, { color: semantic.unknown, children: t("ui", "undetermined") }) : /* @__PURE__ */ jsx4(Text3, { color: semantic.muted, children: g.ellipsis })
3944
3978
  ] }, id);
3945
- })
3979
+ }),
3980
+ /* @__PURE__ */ jsx4(KeyHints, { commands })
3946
3981
  ] });
3947
3982
  }
3948
3983
 
3949
3984
  // src/screens/select.tsx
3950
3985
  import { useState as useState3 } from "react";
3951
- import { Box as Box3, Text as Text4 } from "ink";
3952
- import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
3986
+ import { Box as Box2, Text as Text4 } from "ink";
3987
+
3988
+ // src/lib/display-counts.ts
3989
+ var labels = {
3990
+ upgraded: ["upgradedOne", "upgraded"],
3991
+ failed: ["failedOne", "failed"],
3992
+ manual: ["manualShort", "manualMany"],
3993
+ unknown: ["undeterminedShort", "undeterminedShort"]
3994
+ };
3995
+ function countText(count, kind) {
3996
+ return `${count} ${t("ui", labels[kind][count === 1 ? 0 : 1])}`;
3997
+ }
3998
+ function selectionText(marked, total) {
3999
+ return `${marked} ${t("ui", "of")} ${total} ${t("ui", marked === 1 ? "selectedOne" : "selected")}`;
4000
+ }
4001
+ function summaryText(counts) {
4002
+ const parts = [countText(counts.upgraded, "upgraded")];
4003
+ if (counts.failed > 0) parts.push(countText(counts.failed, "failed"));
4004
+ if (counts.skipped > 0) parts.push(countText(counts.skipped, "manual"));
4005
+ if (counts.unknown > 0) parts.push(countText(counts.unknown, "unknown"));
4006
+ return parts.join(` ${g.separator} `);
4007
+ }
4008
+
4009
+ // src/screens/select.tsx
4010
+ import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
3953
4011
  function clip(s, n) {
3954
4012
  return s.length > n ? s.slice(0, Math.max(0, n - g.ellipsis.length)) + g.ellipsis : s;
3955
4013
  }
3956
4014
  function SelectScreen() {
3957
- const { state, toggleItem, selectAll, selectNone, goConfirm, openSettings } = useMachine();
4015
+ const { state, toggleItem, selectAll, selectNone, goConfirm, openSettings, rescan, quitApp } = useMachine();
4016
+ const [notice, setNotice] = useState3(false);
3958
4017
  const [cursor, setCursor] = useState3(0);
3959
4018
  const rows = [];
3960
4019
  for (const id of state.order) {
@@ -3963,71 +4022,61 @@ function SelectScreen() {
3963
4022
  }
3964
4023
  const clamped = Math.min(cursor, Math.max(0, rows.length - 1));
3965
4024
  const undetermined = state.order.filter((id) => state.managers[id]?.status === "unknown");
3966
- useSafeInput((input, key) => {
3967
- if (key.downArrow || input === "j") setCursor((c) => Math.min(rows.length - 1, c + 1));
3968
- else if (key.upArrow || input === "k") setCursor((c) => Math.max(0, c - 1));
3969
- else if (input === " ") {
3970
- const r = rows[clamped];
3971
- if (r) toggleItem(selectionKey(r.managerId, r.pkg.name));
3972
- } else if (input === "a" || input === "A") selectAll();
3973
- else if (input === "n" || input === "N") selectNone();
3974
- else if (key.return) goConfirm();
3975
- else if (input === "s" || input === "S") openSettings();
4025
+ const commands = useScreenKeys({
4026
+ ...rows.length > 0 ? {
4027
+ down: () => setCursor((c) => Math.min(rows.length - 1, c + 1)),
4028
+ up: () => setCursor((c) => Math.max(0, c - 1)),
4029
+ mark: () => {
4030
+ const row = rows[clamped];
4031
+ if (row) toggleItem(selectionKey(row.managerId, row.pkg.name));
4032
+ },
4033
+ all: selectAll,
4034
+ none: selectNone,
4035
+ next: () => {
4036
+ if (state.selection.size === 0) setNotice(true);
4037
+ else goConfirm();
4038
+ }
4039
+ } : { retry: rescan },
4040
+ settings: openSettings,
4041
+ quit: quitApp
3976
4042
  });
3977
4043
  if (rows.length === 0) {
3978
- return /* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", children: [
3979
- /* @__PURE__ */ jsx5(StepHeader, { phase: state.phase }),
3980
- /* @__PURE__ */ jsxs3(Text4, { color: semantic.success, children: [
3981
- "\u2713 ",
4044
+ return /* @__PURE__ */ jsxs2(Box2, { flexDirection: "column", children: [
4045
+ /* @__PURE__ */ jsxs2(Text4, { color: semantic.success, children: [
4046
+ g.done,
4047
+ " ",
3982
4048
  t("ui", "noUpdates")
3983
4049
  ] }),
3984
- undetermined.length > 0 && /* @__PURE__ */ jsxs3(Text4, { color: semantic.unknown, children: [
4050
+ undetermined.length > 0 && /* @__PURE__ */ jsxs2(Text4, { color: semantic.unknown, children: [
3985
4051
  g.unknown,
3986
4052
  " ",
3987
- undetermined.length,
3988
- " ",
3989
- t("ui", "undeterminedCount"),
4053
+ countText(undetermined.length, "unknown"),
3990
4054
  ":",
3991
4055
  " ",
3992
4056
  undetermined.map((id) => managerName(id)).join(", ")
3993
4057
  ] }),
3994
- /* @__PURE__ */ jsx5(Box3, { marginTop: 1, children: /* @__PURE__ */ jsxs3(Text4, { color: semantic.muted, children: [
3995
- "R ",
3996
- t("flow", "detecting"),
3997
- " \xB7 Q"
3998
- ] }) })
4058
+ /* @__PURE__ */ jsx5(Box2, { marginTop: 1, children: /* @__PURE__ */ jsx5(KeyHints, { commands }) })
3999
4059
  ] });
4000
4060
  }
4001
4061
  const width = Math.min((process.stdout.columns ?? 90) - 4, 92);
4002
- const view = Math.max(6, (process.stdout.rows ?? 24) - 11);
4062
+ const view = Math.max(6, (process.stdout.rows ?? 24) - 11 - headerExtraRows());
4003
4063
  let start = clamped - Math.floor(view / 2);
4004
4064
  start = Math.max(0, Math.min(start, Math.max(0, rows.length - view)));
4005
4065
  const end = Math.min(rows.length, start + view);
4006
4066
  const visible = rows.slice(start, end);
4007
4067
  let prevManager = "";
4008
- return /* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", children: [
4009
- /* @__PURE__ */ jsx5(StepHeader, { phase: state.phase }),
4010
- /* @__PURE__ */ jsxs3(Box3, { marginBottom: 1, children: [
4011
- /* @__PURE__ */ jsx5(Text4, { color: semantic.action, bold: true, children: state.selection.size }),
4012
- /* @__PURE__ */ jsxs3(Text4, { color: semantic.muted, children: [
4013
- " ",
4014
- "/ ",
4015
- rows.length,
4016
- " ",
4017
- t("ui", "selected")
4018
- ] })
4019
- ] }),
4020
- undetermined.length > 0 && /* @__PURE__ */ jsx5(Box3, { marginBottom: 1, children: /* @__PURE__ */ jsxs3(Text4, { color: semantic.unknown, children: [
4068
+ return /* @__PURE__ */ jsxs2(Box2, { flexDirection: "column", children: [
4069
+ notice && /* @__PURE__ */ jsx5(Text4, { color: semantic.warning, children: t("ui", "chooseFirst") }),
4070
+ /* @__PURE__ */ jsx5(Box2, { marginBottom: 1, children: /* @__PURE__ */ jsx5(Text4, { color: semantic.action, bold: true, children: selectionText(state.selection.size, rows.length) }) }),
4071
+ undetermined.length > 0 && /* @__PURE__ */ jsx5(Box2, { marginBottom: 1, children: /* @__PURE__ */ jsxs2(Text4, { color: semantic.unknown, children: [
4021
4072
  g.unknown,
4022
4073
  " ",
4023
- undetermined.length,
4024
- " ",
4025
- t("ui", "undeterminedCount"),
4074
+ countText(undetermined.length, "unknown"),
4026
4075
  ":",
4027
4076
  " ",
4028
4077
  undetermined.map((id) => managerName(id)).join(", ")
4029
4078
  ] }) }),
4030
- start > 0 && /* @__PURE__ */ jsxs3(Text4, { color: colors.outline, children: [
4079
+ start > 0 && /* @__PURE__ */ jsxs2(Text4, { color: colors.outline, children: [
4031
4080
  g.scrollUp,
4032
4081
  " ",
4033
4082
  start
@@ -4037,13 +4086,13 @@ function SelectScreen() {
4037
4086
  prevManager = r.managerId;
4038
4087
  const selected = state.selection.has(selectionKey(r.managerId, r.pkg.name));
4039
4088
  const isCursor = rows[clamped] === r;
4040
- return /* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", children: [
4089
+ return /* @__PURE__ */ jsxs2(Box2, { flexDirection: "column", children: [
4041
4090
  header && /* @__PURE__ */ jsx5(Text4, { color: semantic.muted, bold: true, children: header }),
4042
- /* @__PURE__ */ jsxs3(Box3, { children: [
4091
+ /* @__PURE__ */ jsxs2(Box2, { children: [
4043
4092
  /* @__PURE__ */ jsx5(Text4, { color: isCursor ? semantic.action : colors.outline, children: isCursor ? `${g.cursor} ` : " " }),
4044
4093
  /* @__PURE__ */ jsx5(Text4, { color: selected ? semantic.success : colors.outline, children: selected ? `${g.checkOn} ` : `${g.checkOff} ` }),
4045
- /* @__PURE__ */ jsx5(Box3, { width: 22, children: /* @__PURE__ */ jsx5(Text4, { color: semantic.text, bold: isCursor, children: clip(r.pkg.name, 21) }) }),
4046
- /* @__PURE__ */ jsxs3(Text4, { color: semantic.muted, wrap: "truncate-end", children: [
4094
+ /* @__PURE__ */ jsx5(Box2, { width: 22, children: /* @__PURE__ */ jsx5(Text4, { color: semantic.text, bold: isCursor, children: clip(r.pkg.name, 21) }) }),
4095
+ /* @__PURE__ */ jsxs2(Text4, { color: semantic.muted, wrap: "truncate-end", children: [
4047
4096
  clip(r.pkg.currentVersion, 14),
4048
4097
  " ",
4049
4098
  /* @__PURE__ */ jsx5(Text4, { color: semantic.action, children: g.arrow }),
@@ -4053,59 +4102,74 @@ function SelectScreen() {
4053
4102
  ] })
4054
4103
  ] }, `${r.managerId}:${r.pkg.name}`);
4055
4104
  }),
4056
- end < rows.length && /* @__PURE__ */ jsxs3(Text4, { color: colors.outline, children: [
4105
+ end < rows.length && /* @__PURE__ */ jsxs2(Text4, { color: colors.outline, children: [
4057
4106
  g.scrollDown,
4058
4107
  " ",
4059
4108
  rows.length - end
4060
4109
  ] }),
4061
- /* @__PURE__ */ jsx5(Box3, { marginTop: 1, children: /* @__PURE__ */ jsx5(Text4, { color: semantic.muted, children: clip(t("ui", "selectHint"), width) }) })
4110
+ /* @__PURE__ */ jsx5(Box2, { marginTop: 1, children: /* @__PURE__ */ jsx5(KeyHints, { commands }) })
4062
4111
  ] });
4063
4112
  }
4064
4113
 
4065
4114
  // src/screens/confirm.tsx
4066
- import { Box as Box4, Text as Text5 } from "ink";
4067
- import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
4115
+ import { Box as Box3, Text as Text5 } from "ink";
4116
+ import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
4068
4117
  function ConfirmScreen() {
4069
- const { state, startRun, goSelect, sudoMode: sudoMode2, relaunch } = useMachine();
4118
+ const { state, startRun, goSelect, sudoMode: sudoMode2, relaunch, quitApp } = useMachine();
4070
4119
  const byManager = /* @__PURE__ */ new Map();
4071
4120
  for (const key of state.selection) {
4072
4121
  const [id] = parseSelectionKey(key);
4073
4122
  byManager.set(id, (byManager.get(id) ?? 0) + 1);
4074
4123
  }
4075
4124
  const needsElevation = process.platform === "win32" && !sudoMode2 && [...byManager.keys()].some((id) => state.managers[id]?.requiresAdmin);
4076
- useSafeInput((input, key) => {
4077
- if ((input === "e" || input === "E") && needsElevation) relaunch();
4078
- else if (key.return || input === "y" || input === "Y") startRun();
4079
- else if (key.escape) goSelect();
4080
- });
4081
- return /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", children: [
4082
- /* @__PURE__ */ jsx6(StepHeader, { phase: state.phase }),
4083
- /* @__PURE__ */ jsx6(Text5, { color: semantic.text, children: t("ui", "willRun") }),
4084
- /* @__PURE__ */ jsx6(Box4, { flexDirection: "column", marginTop: 1, marginBottom: 1, children: [...byManager.entries()].map(([id, count]) => {
4085
- const m = state.managers[id];
4086
- const willSkip = m?.requiresAdmin && !sudoMode2;
4087
- return /* @__PURE__ */ jsxs4(Box4, { children: [
4088
- /* @__PURE__ */ jsxs4(Text5, { color: semantic.action, children: [
4125
+ const commands = useScreenKeys({ start: startRun, back: goSelect, ...needsElevation ? { elevate: relaunch } : {}, quit: quitApp });
4126
+ const active = [...byManager.entries()].filter(([id]) => !state.managers[id]?.requiresAdmin || sudoMode2);
4127
+ const skipped = [...byManager.entries()].filter(([id]) => state.managers[id]?.requiresAdmin && !sudoMode2);
4128
+ return /* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", children: [
4129
+ /* @__PURE__ */ jsxs3(Text5, { color: semantic.text, children: [
4130
+ t("ui", "willRun"),
4131
+ " ",
4132
+ active.reduce((sum, [, count]) => sum + count, 0),
4133
+ " ",
4134
+ t("ui", active.reduce((sum, [, count]) => sum + count, 0) === 1 ? "packageOne" : "packageMany")
4135
+ ] }),
4136
+ /* @__PURE__ */ jsx6(Box3, { flexDirection: "column", marginTop: 1, marginBottom: 1, children: active.map(([id, count]) => {
4137
+ return /* @__PURE__ */ jsxs3(Box3, { children: [
4138
+ /* @__PURE__ */ jsxs3(Text5, { color: semantic.action, children: [
4089
4139
  g.bullet,
4090
4140
  " "
4091
4141
  ] }),
4092
- /* @__PURE__ */ jsx6(Box4, { width: 20, children: /* @__PURE__ */ jsx6(Text5, { color: semantic.text, bold: true, children: managerName(id) }) }),
4093
- /* @__PURE__ */ jsxs4(Text5, { color: semantic.muted, children: [
4142
+ /* @__PURE__ */ jsx6(Box3, { width: 20, children: /* @__PURE__ */ jsx6(Text5, { color: semantic.text, bold: true, children: managerName(id) }) }),
4143
+ /* @__PURE__ */ jsxs3(Text5, { color: semantic.muted, children: [
4094
4144
  count,
4095
- " paquete(s)"
4096
- ] }),
4097
- willSkip && /* @__PURE__ */ jsx6(Text5, { color: semantic.warning, children: process.platform === "win32" ? " \xB7 requiere admin \u2192 manual" : " \xB7 requiere sudo \u2192 manual" })
4145
+ " ",
4146
+ t("ui", count === 1 ? "packageOne" : "packageMany")
4147
+ ] })
4098
4148
  ] }, id);
4099
4149
  }) }),
4100
- /* @__PURE__ */ jsx6(Text5, { color: semantic.muted, children: t("ui", "confirmHint") }),
4101
- needsElevation && /* @__PURE__ */ jsx6(Text5, { color: semantic.warning, children: "E \xB7 relanzar como Administrador (1 UAC) para los gestores que lo requieren" })
4150
+ skipped.length > 0 && /* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", marginBottom: 1, children: [
4151
+ /* @__PURE__ */ jsxs3(Text5, { color: semantic.warning, children: [
4152
+ t("ui", process.platform === "win32" ? "adminManual" : "sudoManual"),
4153
+ ":"
4154
+ ] }),
4155
+ skipped.map(([id, count]) => /* @__PURE__ */ jsxs3(Text5, { color: semantic.warning, children: [
4156
+ g.skipped,
4157
+ " ",
4158
+ managerName(id),
4159
+ " ",
4160
+ count,
4161
+ " ",
4162
+ t("ui", count === 1 ? "packageOne" : "packageMany")
4163
+ ] }, id))
4164
+ ] }),
4165
+ /* @__PURE__ */ jsx6(KeyHints, { commands })
4102
4166
  ] });
4103
4167
  }
4104
4168
 
4105
4169
  // src/screens/update.tsx
4106
4170
  import { useEffect as useEffect3, useState as useState4 } from "react";
4107
- import { Box as Box5, Text as Text6 } from "ink";
4108
- import { Fragment, jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
4171
+ import { Box as Box4, Text as Text6 } from "ink";
4172
+ import { Fragment, jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
4109
4173
  function clip2(s, n) {
4110
4174
  return s.length > n ? s.slice(0, Math.max(0, n - g.ellipsis.length)) + g.ellipsis : s;
4111
4175
  }
@@ -4132,62 +4196,89 @@ function Row({ e, width }) {
4132
4196
  else if (e.status === "skipped") detail = e.manualCommand ?? "manual";
4133
4197
  else if (e.status === "failed") detail = e.result?.failures[0]?.message ?? "";
4134
4198
  else if (e.status === "unknown") detail = e.result?.failures[0]?.message ?? t("ui", "undetermined");
4135
- return /* @__PURE__ */ jsxs5(Box5, { children: [
4136
- /* @__PURE__ */ jsx7(Box5, { width: 2, children: e.status === "running" ? /* @__PURE__ */ jsx7(RunningGlyph, {}) : /* @__PURE__ */ jsx7(StatusGlyph, { status: e.status }) }),
4137
- /* @__PURE__ */ jsx7(Box5, { width: 16, children: /* @__PURE__ */ jsx7(Text6, { color: semantic.text, bold: e.status === "running", children: clip2(managerName(e.id), 15) }) }),
4138
- /* @__PURE__ */ jsx7(Box5, { width: 13, children: /* @__PURE__ */ jsx7(Text6, { color: statusColor(e.status), children: t("status", e.status) }) }),
4139
- /* @__PURE__ */ jsx7(Text6, { color: semantic.muted, children: e.status === "running" ? e.percent > 0 ? `${e.percent}%` : e.startedAt !== void 0 && e.startedAt > 0 ? /* @__PURE__ */ jsx7(Elapsed, { startedAt: e.startedAt }) : "" : clip2(detail, Math.max(0, width - 33)) })
4199
+ return /* @__PURE__ */ jsxs4(Box4, { children: [
4200
+ /* @__PURE__ */ jsx7(Box4, { width: 2, children: e.status === "running" ? /* @__PURE__ */ jsx7(RunningGlyph, {}) : /* @__PURE__ */ jsx7(StatusGlyph, { status: e.status }) }),
4201
+ /* @__PURE__ */ jsx7(Box4, { width: 16, children: /* @__PURE__ */ jsx7(Text6, { color: semantic.text, bold: e.status === "running", children: clip2(managerName(e.id), 15) }) }),
4202
+ /* @__PURE__ */ jsx7(Box4, { width: 13, children: /* @__PURE__ */ jsx7(Text6, { color: statusColor(e.status), children: t("status", e.status) }) }),
4203
+ /* @__PURE__ */ jsx7(Text6, { color: semantic.muted, children: e.status === "running" ? e.percent > 0 ? `${e.percent}%` : e.startedAt !== void 0 && e.startedAt > 0 ? /* @__PURE__ */ jsx7(Elapsed, { startedAt: e.startedAt }) : "" : clip2(detail, Math.max(0, width - 33)) }),
4204
+ e.status === "running" && /* @__PURE__ */ jsxs4(Text6, { color: semantic.muted, children: [
4205
+ " ",
4206
+ e.percent > 0 && e.startedAt ? /* @__PURE__ */ jsx7(Elapsed, { startedAt: e.startedAt }) : "",
4207
+ " ",
4208
+ clip2(e.currentPackage ?? "", Math.max(0, width - 45))
4209
+ ] })
4140
4210
  ] });
4141
4211
  }
4142
4212
  function UpdateScreen() {
4143
- const { state, cancelRun } = useMachine();
4144
- useSafeInput((_input, key) => {
4145
- if (key.escape) cancelRun();
4146
- });
4213
+ const [now, setNow] = useState4(Date.now);
4214
+ useEffect3(() => {
4215
+ const timer = setInterval(() => setNow(Date.now()), 1e3);
4216
+ return () => clearInterval(timer);
4217
+ }, []);
4218
+ const { state, cancelRun, quitApp } = useMachine();
4219
+ const [asking, setAsking] = useState4(false);
4220
+ const commands = useScreenKeys(asking ? {
4221
+ confirmCancel: () => {
4222
+ setAsking(false);
4223
+ cancelRun();
4224
+ },
4225
+ continueRun: () => setAsking(false),
4226
+ ctrlC: quitApp
4227
+ } : { cancel: () => setAsking(true), quit: () => setAsking(true), ctrlC: quitApp });
4228
+ const activeNames = state.run.queue.filter((id) => ["running", "queued"].includes(state.managers[id]?.status ?? "")).map(managerName);
4147
4229
  const total = state.run.queue.length;
4230
+ const packagesDone = state.run.queue.reduce((sum, id) => {
4231
+ const result = state.managers[id]?.result;
4232
+ return sum + (result?.upgraded ?? 0) + (result?.failed ?? 0) + (result?.skipped ?? 0);
4233
+ }, 0);
4234
+ const canPrompt = state.run.queue.some((id) => {
4235
+ const entry = state.managers[id];
4236
+ if (entry?.requiresAdmin && !state.sudoMode) return false;
4237
+ return entry?.requiresAdmin || process.platform !== "win32" && ["brew", "gem", "pip", "pipx"].includes(id);
4238
+ });
4148
4239
  const finished = state.run.doneCount + state.run.failedCount + state.run.skippedCount + state.run.unknownCount;
4149
4240
  const width = Math.min((process.stdout.columns ?? 90) - 4, 92);
4150
- return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", children: [
4151
- /* @__PURE__ */ jsx7(StepHeader, { phase: state.phase }),
4152
- /* @__PURE__ */ jsxs5(Box5, { marginBottom: 1, children: [
4153
- /* @__PURE__ */ jsxs5(Text6, { color: semantic.text, bold: true, children: [
4154
- finished,
4155
- "/",
4156
- total,
4157
- " "
4158
- ] }),
4159
- /* @__PURE__ */ jsxs5(Text6, { color: semantic.success, children: [
4160
- g.done,
4161
- " ",
4162
- state.run.doneCount,
4163
- " "
4164
- ] }),
4165
- /* @__PURE__ */ jsxs5(Text6, { color: semantic.error, children: [
4166
- g.failed,
4167
- " ",
4168
- state.run.failedCount,
4169
- " "
4170
- ] }),
4171
- /* @__PURE__ */ jsxs5(Text6, { color: semantic.warning, children: [
4172
- g.skipped,
4173
- " ",
4174
- state.run.skippedCount
4175
- ] })
4176
- ] }),
4241
+ return /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", children: [
4242
+ /* @__PURE__ */ jsx7(Box4, { marginBottom: 1, children: /* @__PURE__ */ jsxs4(Text6, { color: semantic.text, children: [
4243
+ finished,
4244
+ "/",
4245
+ total,
4246
+ " ",
4247
+ g.separator,
4248
+ " ",
4249
+ packagesDone,
4250
+ " ",
4251
+ t("ui", "of"),
4252
+ " ",
4253
+ state.selection.size,
4254
+ " ",
4255
+ t("ui", state.selection.size === 1 ? "packageOne" : "packageMany"),
4256
+ " ",
4257
+ g.separator,
4258
+ " ",
4259
+ formatElapsed(now - (state.run.startedAt ?? now))
4260
+ ] }) }),
4177
4261
  state.run.queue.map((id) => {
4178
4262
  const e = state.managers[id];
4179
4263
  return e ? /* @__PURE__ */ jsx7(Row, { e, width }, id) : null;
4180
4264
  }),
4181
- /* @__PURE__ */ jsxs5(Box5, { marginTop: 1, flexDirection: "column", children: [
4182
- /* @__PURE__ */ jsx7(Text6, { color: semantic.muted, children: t("ui", "updatingHint") }),
4183
- /* @__PURE__ */ jsx7(Text6, { color: semantic.muted, children: t("ui", "passwordNote") })
4265
+ /* @__PURE__ */ jsxs4(Box4, { marginTop: 1, flexDirection: "column", children: [
4266
+ /* @__PURE__ */ jsxs4(Box4, { height: 3, flexDirection: "column", children: [
4267
+ asking && /* @__PURE__ */ jsx7(Box4, { height: 2, children: /* @__PURE__ */ jsxs4(Text6, { color: semantic.warning, wrap: "truncate-end", children: [
4268
+ t("ui", "cancelQuestion"),
4269
+ " ",
4270
+ activeNames.join(", ")
4271
+ ] }) }),
4272
+ /* @__PURE__ */ jsx7(KeyHints, { commands })
4273
+ ] }),
4274
+ canPrompt && /* @__PURE__ */ jsx7(Text6, { color: semantic.muted, children: t("ui", "passwordNote") })
4184
4275
  ] })
4185
4276
  ] });
4186
4277
  }
4187
4278
 
4188
4279
  // src/screens/summary.tsx
4189
- import { Box as Box6, Text as Text7 } from "ink";
4190
- import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
4280
+ import { Box as Box5, Text as Text7 } from "ink";
4281
+ import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
4191
4282
  function versionDelta(m) {
4192
4283
  const ups = (m.packages ?? []).filter((p) => p.outcome === "upgraded" && p.toVersion);
4193
4284
  if (ups.length === 0) return "";
@@ -4195,40 +4286,37 @@ function versionDelta(m) {
4195
4286
  const p = ups[0];
4196
4287
  return p.fromVersion ? `${p.name} ${p.fromVersion} ${g.arrow} ${p.toVersion}` : `${p.name} ${g.arrow} ${p.toVersion}`;
4197
4288
  }
4198
- return `${ups.length} ${t("ui", "upgraded")}`;
4289
+ return countText(ups.length, "upgraded");
4199
4290
  }
4200
4291
  function ManagerRow({ m }) {
4201
4292
  const dur = m.durationMs !== void 0 ? `${(m.durationMs / 1e3).toFixed(1)}s` : "";
4202
- return /* @__PURE__ */ jsxs6(Box6, { children: [
4203
- /* @__PURE__ */ jsx8(Box6, { width: 2, children: /* @__PURE__ */ jsx8(StatusGlyph, { status: m.status }) }),
4204
- /* @__PURE__ */ jsx8(Box6, { width: 14, children: /* @__PURE__ */ jsx8(Text7, { color: semantic.text, wrap: "truncate-end", children: managerName(m.id) }) }),
4205
- /* @__PURE__ */ jsxs6(Box6, { width: 9, children: [
4206
- m.upgraded > 0 ? /* @__PURE__ */ jsxs6(Text7, { color: semantic.success, children: [
4293
+ return /* @__PURE__ */ jsxs5(Box5, { children: [
4294
+ /* @__PURE__ */ jsx8(Box5, { width: 2, children: /* @__PURE__ */ jsx8(StatusGlyph, { status: m.status }) }),
4295
+ /* @__PURE__ */ jsx8(Box5, { width: 14, children: /* @__PURE__ */ jsx8(Text7, { color: semantic.text, wrap: "truncate-end", children: managerName(m.id) }) }),
4296
+ /* @__PURE__ */ jsxs5(Box5, { width: 9, children: [
4297
+ m.upgraded > 0 ? /* @__PURE__ */ jsxs5(Text7, { color: semantic.success, children: [
4207
4298
  g.done,
4208
4299
  " ",
4209
4300
  m.upgraded
4210
4301
  ] }) : null,
4211
- m.failed > 0 ? /* @__PURE__ */ jsxs6(Text7, { color: semantic.error, children: [
4302
+ m.failed > 0 ? /* @__PURE__ */ jsxs5(Text7, { color: semantic.error, children: [
4212
4303
  " ",
4213
4304
  g.failed,
4214
4305
  " ",
4215
4306
  m.failed
4216
4307
  ] }) : null
4217
4308
  ] }),
4218
- /* @__PURE__ */ jsx8(Box6, { flexGrow: 1, children: /* @__PURE__ */ jsx8(Text7, { color: semantic.muted, wrap: "truncate-end", children: versionDelta(m) }) }),
4219
- /* @__PURE__ */ jsx8(Box6, { width: 7, justifyContent: "flex-end", children: /* @__PURE__ */ jsx8(Text7, { color: semantic.muted, children: dur }) })
4309
+ /* @__PURE__ */ jsx8(Box5, { flexGrow: 1, children: /* @__PURE__ */ jsx8(Text7, { color: semantic.muted, wrap: "truncate-end", children: versionDelta(m) }) }),
4310
+ /* @__PURE__ */ jsx8(Box5, { width: 7, justifyContent: "flex-end", children: /* @__PURE__ */ jsx8(Text7, { color: semantic.muted, children: dur }) })
4220
4311
  ] });
4221
4312
  }
4222
4313
  function SummaryScreen() {
4223
- const { state, rescan, openDetail } = useMachine();
4224
- useSafeInput((input) => {
4225
- if (input === "r" || input === "R") rescan();
4226
- else if (input === "d" || input === "D") openDetail();
4227
- });
4314
+ const { state, rescan, openDetail, quitApp, selfUpdate } = useMachine();
4228
4315
  const summary = summarizeRun(state);
4229
- const { upgraded, failed, skipped, unknown } = summary;
4230
- const hasErrors = failed > 0;
4316
+ const { failed } = summary;
4317
+ const hasErrors = failed > 0 || state.run.failedCount > 0;
4231
4318
  const hasPackages = summary.managers.some((m) => (m.packages ?? []).length > 0);
4319
+ const commands = useScreenKeys({ ...hasPackages ? { detail: openDetail } : {}, retry: rescan, quit: quitApp });
4232
4320
  const failures = [];
4233
4321
  const manuals = [];
4234
4322
  const reboots = [];
@@ -4250,134 +4338,115 @@ function SummaryScreen() {
4250
4338
  if (r.reboot) reboots.push({ manager: id, state: r.reboot });
4251
4339
  }
4252
4340
  }
4253
- return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", children: [
4254
- /* @__PURE__ */ jsx8(StepHeader, { phase: state.phase }),
4255
- /* @__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")}` }) }),
4256
- undetermined.length > 0 && /* @__PURE__ */ jsx8(Box6, { flexDirection: "column", marginBottom: 1, children: /* @__PURE__ */ jsxs6(Text7, { color: semantic.unknown, children: [
4341
+ return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", children: [
4342
+ /* @__PURE__ */ jsx8(Box5, { 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")}` }) }),
4343
+ undetermined.length > 0 && /* @__PURE__ */ jsx8(Box5, { flexDirection: "column", marginBottom: 1, children: /* @__PURE__ */ jsxs5(Text7, { color: semantic.unknown, children: [
4257
4344
  g.unknown,
4258
4345
  " ",
4259
- undetermined.length,
4260
- " ",
4261
- t("ui", "undeterminedCount"),
4346
+ countText(undetermined.length, "unknown"),
4262
4347
  ":",
4263
4348
  " ",
4264
4349
  undetermined.map((id) => managerName(id)).join(", ")
4265
4350
  ] }) }),
4266
- manuals.length > 0 && /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", marginBottom: 1, children: [
4351
+ manuals.length > 0 && /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", marginBottom: 1, children: [
4267
4352
  /* @__PURE__ */ jsx8(Text7, { color: semantic.warning, children: t("ui", "manualNeeded") }),
4268
- manuals.map((m, i) => /* @__PURE__ */ jsxs6(Text7, { color: semantic.muted, children: [
4353
+ manuals.map((m, i) => /* @__PURE__ */ jsxs5(Text7, { color: semantic.muted, children: [
4269
4354
  " ",
4270
4355
  managerName(m.manager),
4271
4356
  ": ",
4272
4357
  /* @__PURE__ */ jsx8(Text7, { color: semantic.text, children: m.command })
4273
4358
  ] }, i))
4274
4359
  ] }),
4275
- /* @__PURE__ */ jsxs6(Box6, { marginBottom: 1, children: [
4276
- /* @__PURE__ */ jsxs6(Text7, { color: semantic.success, children: [
4277
- upgraded,
4278
- " ",
4279
- t("ui", "upgraded")
4280
- ] }),
4281
- /* @__PURE__ */ jsx8(Text7, { color: semantic.muted, children: " \xB7 " }),
4282
- /* @__PURE__ */ jsxs6(Text7, { color: hasErrors ? semantic.error : semantic.muted, children: [
4283
- failed,
4284
- " ",
4285
- t("ui", "failed")
4286
- ] }),
4287
- /* @__PURE__ */ jsx8(Text7, { color: semantic.muted, children: " \xB7 " }),
4288
- /* @__PURE__ */ jsxs6(Text7, { color: semantic.warning, children: [
4289
- skipped,
4290
- " ",
4291
- t("ui", "skipped")
4292
- ] }),
4293
- /* @__PURE__ */ jsx8(Text7, { color: semantic.muted, children: " \xB7 " }),
4294
- /* @__PURE__ */ jsxs6(Text7, { color: unknown > 0 ? semantic.unknown : semantic.muted, children: [
4295
- unknown,
4296
- " ",
4297
- t("ui", "undeterminedTotal")
4298
- ] })
4299
- ] }),
4300
- summary.managers.length > 0 && /* @__PURE__ */ jsx8(Box6, { flexDirection: "column", marginBottom: 1, children: summary.managers.map((m) => /* @__PURE__ */ jsx8(ManagerRow, { m }, m.id)) }),
4301
- failures.length > 0 && /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", marginBottom: 1, children: [
4302
- failures.slice(0, 8).map((f, i) => /* @__PURE__ */ jsxs6(Text7, { color: semantic.error, wrap: "truncate-end", children: [
4360
+ /* @__PURE__ */ jsx8(Box5, { marginBottom: 1, children: /* @__PURE__ */ jsx8(Text7, { color: semantic.text, children: summaryText(summary) }) }),
4361
+ summary.managers.length > 0 && /* @__PURE__ */ jsx8(Box5, { flexDirection: "column", marginBottom: 1, children: summary.managers.map((m) => /* @__PURE__ */ jsx8(ManagerRow, { m }, m.id)) }),
4362
+ failures.length > 0 && /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", marginBottom: 1, children: [
4363
+ failures.slice(0, 8).map((f, i) => /* @__PURE__ */ jsxs5(Text7, { color: semantic.error, wrap: "truncate-end", children: [
4303
4364
  g.failed,
4304
4365
  " ",
4305
4366
  managerName(f.manager),
4306
- f.package ? /* @__PURE__ */ jsxs6(Text7, { color: semantic.text, children: [
4367
+ f.package ? /* @__PURE__ */ jsxs5(Text7, { color: semantic.text, children: [
4307
4368
  " ",
4308
4369
  f.package
4309
4370
  ] }) : null,
4310
- f.kind ? /* @__PURE__ */ jsxs6(Text7, { color: semantic.muted, children: [
4311
- " \xB7 ",
4371
+ f.kind ? /* @__PURE__ */ jsxs5(Text7, { color: semantic.muted, children: [
4372
+ " ",
4373
+ g.separator,
4374
+ " ",
4312
4375
  f.kind
4313
4376
  ] }) : null
4314
4377
  ] }, i)),
4315
- failures.some((f) => f.kind === "TIMEOUT") && /* @__PURE__ */ jsxs6(Text7, { color: semantic.warning, children: [
4378
+ failures.some((f) => f.kind === "TIMEOUT") && /* @__PURE__ */ jsxs5(Text7, { color: semantic.warning, children: [
4316
4379
  g.info,
4317
- " Un TIMEOUT suele indicar un paquete que pide interacci\xF3n (ej. un cask que requiere cerrar la app o sudo). Actual\xEDzalo manualmente en una terminal."
4380
+ " ",
4381
+ t("ui", "timeoutNote")
4318
4382
  ] })
4319
4383
  ] }),
4320
- reboots.length > 0 && /* @__PURE__ */ jsx8(Box6, { marginBottom: 1, children: /* @__PURE__ */ jsxs6(Text7, { color: semantic.warning, children: [
4384
+ reboots.length > 0 && /* @__PURE__ */ jsx8(Box5, { marginBottom: 1, children: /* @__PURE__ */ jsxs5(Text7, { color: semantic.warning, children: [
4321
4385
  g.reboot,
4322
- " Reinicio pendiente: ",
4323
- reboots.map((r) => `${managerName(r.manager)} (${r.state})`).join(", ")
4386
+ " ",
4387
+ t("ui", "rebootPending"),
4388
+ ": ",
4389
+ reboots.map((r) => `${managerName(r.manager)} (${t("ui", r.state === "required" ? "rebootRequired" : r.state === "initiated" ? "rebootInitiated" : "rebootDeferred")})`).join(", ")
4324
4390
  ] }) }),
4325
- /* @__PURE__ */ jsxs6(Text7, { color: semantic.muted, children: [
4391
+ selfUpdate && /* @__PURE__ */ jsx8(Text7, { color: semantic.warning, children: selfUpdate.howTo }),
4392
+ /* @__PURE__ */ jsxs5(Text7, { color: semantic.muted, children: [
4326
4393
  t("ui", "logAt"),
4327
4394
  " ",
4328
- getLogFilePath() ?? "~/.tacuchi-updater/logs/"
4395
+ compactPath(getLogFilePath() ?? "~/.tacuchi-updater/logs/", Math.min(process.stdout.columns ?? 100, 100) - 4 - t("ui", "logAt").length)
4329
4396
  ] }),
4330
- /* @__PURE__ */ jsx8(Box6, { marginTop: 1, children: /* @__PURE__ */ jsx8(Text7, { color: semantic.muted, children: hasPackages ? t("ui", "detailHint") : t("ui", "summaryHint") }) })
4397
+ /* @__PURE__ */ jsx8(Box5, { marginTop: 1, children: /* @__PURE__ */ jsx8(KeyHints, { commands }) })
4331
4398
  ] });
4332
4399
  }
4333
4400
 
4334
4401
  // src/screens/settings-screen.tsx
4335
4402
  import { useState as useState5 } from "react";
4336
- import { Box as Box7, Text as Text8 } from "ink";
4337
- import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
4403
+ import { Box as Box6, Text as Text8 } from "ink";
4404
+ import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
4338
4405
  function SettingsScreen() {
4339
- const { state, toggleEnabled, setLang, closeSettings } = useMachine();
4406
+ const { state, toggleEnabled, setLang, closeSettings, quitApp } = useMachine();
4340
4407
  const ids = state.order;
4341
4408
  const [cursor, setCursor] = useState5(0);
4342
4409
  const clamped = Math.min(cursor, Math.max(0, ids.length - 1));
4343
- useSafeInput((input, key) => {
4344
- if (key.escape) closeSettings();
4345
- else if (key.downArrow || input === "j") setCursor((c) => Math.min(ids.length - 1, c + 1));
4346
- else if (key.upArrow || input === "k") setCursor((c) => Math.max(0, c - 1));
4347
- else if (input === " ") {
4410
+ const commands = useScreenKeys({
4411
+ back: closeSettings,
4412
+ down: () => setCursor((c) => Math.min(ids.length - 1, c + 1)),
4413
+ up: () => setCursor((c) => Math.max(0, c - 1)),
4414
+ mark: () => {
4348
4415
  const id = ids[clamped];
4349
4416
  if (id) toggleEnabled(id);
4350
- } else if (input === "l" || input === "L") {
4351
- setLang(state.config.language === "es" ? "en" : "es");
4352
- }
4417
+ },
4418
+ language: () => setLang(state.config.language === "es" ? "en" : "es"),
4419
+ quit: quitApp
4353
4420
  });
4354
- return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", children: [
4355
- /* @__PURE__ */ jsx9(StepHeader, { phase: "settings" }),
4356
- /* @__PURE__ */ jsxs7(Box7, { marginBottom: 1, children: [
4357
- /* @__PURE__ */ jsx9(Text8, { color: semantic.text, children: "Idioma / Language: " }),
4421
+ return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", children: [
4422
+ /* @__PURE__ */ jsxs6(Box6, { marginBottom: 1, children: [
4423
+ /* @__PURE__ */ jsxs6(Text8, { color: semantic.text, children: [
4424
+ t("ui", "language"),
4425
+ ": "
4426
+ ] }),
4358
4427
  /* @__PURE__ */ jsx9(Text8, { color: semantic.action, bold: true, children: state.config.language.toUpperCase() }),
4359
4428
  /* @__PURE__ */ jsx9(Text8, { color: semantic.muted, children: " (L)" })
4360
4429
  ] }),
4361
4430
  ids.map((id, i) => {
4362
4431
  const enabled = isManagerEnabled(state.config, id);
4363
4432
  const isCursor = i === clamped;
4364
- return /* @__PURE__ */ jsxs7(Box7, { children: [
4433
+ return /* @__PURE__ */ jsxs6(Box6, { children: [
4365
4434
  /* @__PURE__ */ jsx9(Text8, { color: isCursor ? semantic.action : colors.outline, children: isCursor ? `${g.cursor} ` : " " }),
4366
- /* @__PURE__ */ jsxs7(Text8, { color: enabled ? semantic.success : colors.outline, children: [
4367
- enabled ? "[on ]" : "[off]",
4435
+ /* @__PURE__ */ jsxs6(Text8, { color: enabled ? semantic.success : colors.outline, children: [
4436
+ t("ui", enabled ? "on" : "off"),
4368
4437
  " "
4369
4438
  ] }),
4370
4439
  /* @__PURE__ */ jsx9(Text8, { color: enabled ? semantic.text : semantic.muted, children: managerName(id) })
4371
4440
  ] }, id);
4372
4441
  }),
4373
- /* @__PURE__ */ jsx9(Box7, { marginTop: 1, children: /* @__PURE__ */ jsx9(Text8, { color: semantic.muted, children: "Espacio activar/desactivar \xB7 L idioma \xB7 Esc volver" }) })
4442
+ /* @__PURE__ */ jsx9(Box6, { marginTop: 1, children: /* @__PURE__ */ jsx9(KeyHints, { commands }) })
4374
4443
  ] });
4375
4444
  }
4376
4445
 
4377
4446
  // src/screens/detail.tsx
4378
4447
  import { useState as useState6 } from "react";
4379
- import { Box as Box8, Text as Text9 } from "ink";
4380
- import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
4448
+ import { Box as Box7, Text as Text9 } from "ink";
4449
+ import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
4381
4450
  function glyphStatus(outcome) {
4382
4451
  switch (outcome) {
4383
4452
  case "upgraded":
@@ -4399,7 +4468,7 @@ function delta(from, to) {
4399
4468
  return `${from} ${g.arrow} ${to}`;
4400
4469
  }
4401
4470
  function DetailScreen() {
4402
- const { state, closeDetail } = useMachine();
4471
+ const { state, closeDetail, quitApp } = useMachine();
4403
4472
  const [offset, setOffset] = useState6(0);
4404
4473
  const summary = summarizeRun(state);
4405
4474
  const rows = [];
@@ -4418,96 +4487,177 @@ function DetailScreen() {
4418
4487
  }
4419
4488
  }
4420
4489
  const width = Math.min((process.stdout.columns ?? 90) - 4, 92);
4421
- const view = Math.max(6, (process.stdout.rows ?? 24) - 11);
4490
+ const view = Math.max(6, (process.stdout.rows ?? 24) - 11 - headerExtraRows());
4422
4491
  const maxOffset = Math.max(0, rows.length - view);
4423
4492
  const start = Math.min(offset, maxOffset);
4424
4493
  const visible = rows.slice(start, start + view);
4425
4494
  const nameWidth = Math.max(12, Math.min(32, width - 26));
4426
- useSafeInput((input, key) => {
4427
- if (input === "d" || input === "D") closeDetail();
4428
- else if (key.downArrow || input === "j") setOffset((o) => Math.min(maxOffset, o + 1));
4429
- else if (key.upArrow || input === "k") setOffset((o) => Math.max(0, o - 1));
4495
+ const commands = useScreenKeys({
4496
+ detail: closeDetail,
4497
+ back: closeDetail,
4498
+ down: () => setOffset((o) => Math.min(maxOffset, o + 1)),
4499
+ up: () => setOffset((o) => Math.max(0, o - 1)),
4500
+ quit: quitApp
4430
4501
  });
4431
- return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", children: [
4432
- /* @__PURE__ */ jsx10(StepHeader, { phase: state.phase }),
4502
+ return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", children: [
4433
4503
  /* @__PURE__ */ jsx10(Text9, { color: colors.outline, children: start > 0 ? `${g.scrollUp} ${start}` : " " }),
4434
4504
  rows.length === 0 ? /* @__PURE__ */ jsx10(Text9, { color: semantic.muted, children: t("ui", "noChanges") }) : visible.map(
4435
- (r, i) => r.kind === "manager" ? /* @__PURE__ */ jsx10(Text9, { color: semantic.muted, bold: true, children: managerName(r.managerId) }, `m:${r.managerId}:${i}`) : /* @__PURE__ */ jsxs8(Box8, { children: [
4436
- /* @__PURE__ */ jsx10(Box8, { width: 2, children: /* @__PURE__ */ jsx10(StatusGlyph, { status: glyphStatus(r.outcome ?? "unchanged") }) }),
4437
- /* @__PURE__ */ jsx10(Box8, { width: nameWidth, children: /* @__PURE__ */ jsx10(Text9, { color: semantic.text, wrap: "truncate-end", children: r.name }) }),
4438
- /* @__PURE__ */ jsx10(Box8, { flexGrow: 1, justifyContent: "flex-end", children: /* @__PURE__ */ jsx10(Text9, { color: semantic.muted, wrap: "truncate-end", children: r.right }) })
4505
+ (r, i) => r.kind === "manager" ? /* @__PURE__ */ jsx10(Text9, { color: semantic.muted, bold: true, children: managerName(r.managerId) }, `m:${r.managerId}:${i}`) : /* @__PURE__ */ jsxs7(Box7, { children: [
4506
+ /* @__PURE__ */ jsx10(Box7, { width: 2, children: /* @__PURE__ */ jsx10(StatusGlyph, { status: glyphStatus(r.outcome ?? "unchanged") }) }),
4507
+ /* @__PURE__ */ jsx10(Box7, { width: nameWidth, children: /* @__PURE__ */ jsx10(Text9, { color: semantic.text, wrap: "truncate-end", children: r.name }) }),
4508
+ /* @__PURE__ */ jsx10(Box7, { flexGrow: 1, justifyContent: "flex-end", children: /* @__PURE__ */ jsx10(Text9, { color: semantic.muted, wrap: "truncate-end", children: r.right }) })
4439
4509
  ] }, `p:${r.managerId}:${r.name}:${i}`)
4440
4510
  ),
4441
4511
  /* @__PURE__ */ jsx10(Text9, { color: colors.outline, children: start + visible.length < rows.length ? `${g.scrollDown} ${rows.length - start - visible.length}` : " " }),
4442
- /* @__PURE__ */ jsx10(Box8, { marginTop: 1, children: /* @__PURE__ */ jsx10(Text9, { color: semantic.muted, children: t("ui", "detailBack") }) })
4512
+ /* @__PURE__ */ jsx10(Box7, { marginTop: 1, children: /* @__PURE__ */ jsx10(KeyHints, { commands }) })
4443
4513
  ] });
4444
4514
  }
4445
4515
 
4446
- // src/app.tsx
4447
- import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
4448
- function Header({ sudoMode: sudoMode2 }) {
4449
- const { selfUpdate } = useMachine();
4450
- return /* @__PURE__ */ jsxs9(Box9, { justifyContent: "space-between", marginBottom: 1, children: [
4451
- /* @__PURE__ */ jsxs9(Box9, { children: [
4452
- /* @__PURE__ */ jsx11(Text10, { color: semantic.action, bold: true, children: "@tacuchi/updater" }),
4453
- /* @__PURE__ */ jsxs9(Text10, { color: colors.outline, children: [
4454
- " v",
4455
- getVersion()
4516
+ // src/components/step-header.tsx
4517
+ import { useSyncExternalStore } from "react";
4518
+ import { Box as Box8, Text as Text10 } from "ink";
4519
+
4520
+ // src/lib/platform.ts
4521
+ function getPlatform() {
4522
+ switch (process.platform) {
4523
+ case "darwin":
4524
+ return "macos";
4525
+ case "win32":
4526
+ return "windows";
4527
+ default:
4528
+ return "linux";
4529
+ }
4530
+ }
4531
+
4532
+ // src/components/step-header.tsx
4533
+ import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
4534
+ var steps = { boot: 1, detecting: 1, scanning: 1, select: 2, confirm: 3, updating: 4 };
4535
+ function StepHeader() {
4536
+ const banner = shownBanner(useSyncExternalStore(subscribeBanner, bannerSnapshot));
4537
+ return banner ? /* @__PURE__ */ jsx11(BrandBanner, { image: banner }) : /* @__PURE__ */ jsx11(LineHeader, {});
4538
+ }
4539
+ var clip3 = (text, width) => text.length > width ? text.slice(0, Math.max(0, width - g.ellipsis.length)) + g.ellipsis : text;
4540
+ function BrandBanner({ image: image2 }) {
4541
+ const { state, selfUpdate } = useMachine();
4542
+ const textWidth = Math.min(process.stdout.columns ?? 100, 100) - 2 - 1 - image2.columns - 2;
4543
+ const step = steps[state.phase];
4544
+ const label = t("flow", state.phase === "boot" ? "detecting" : state.phase);
4545
+ const version = ` ${getVersion()}${selfUpdate ? ` ${g.arrow} ${selfUpdate.version}` : ""}`;
4546
+ const count = state.order.length;
4547
+ const detecting = count === 0 && (state.phase === "boot" || state.phase === "detecting");
4548
+ const managers = !detecting ? `${count} ${t("banner", count === 1 ? "managerOne" : "managerMany")}` : state.error ? "" : t("banner", "searching");
4549
+ const platform = t("banner", getPlatform()) + (managers ? ` ${g.separator} ${managers}` : "");
4550
+ const name = "tacuchi updater";
4551
+ return /* @__PURE__ */ jsxs8(Box8, { marginBottom: 1, children: [
4552
+ /* @__PURE__ */ jsx11(Box8, { flexDirection: "column", marginLeft: 1, width: image2.columns, flexShrink: 0, children: placeholderRows(image2.id, image2.columns, image2.rows).map((row, index) => /* @__PURE__ */ jsx11(Text10, { children: row }, index)) }),
4553
+ /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", marginLeft: 2, children: [
4554
+ /* @__PURE__ */ jsxs8(Text10, { children: [
4555
+ /* @__PURE__ */ jsx11(Text10, { bold: true, color: semantic.text, children: name }),
4556
+ /* @__PURE__ */ jsx11(Text10, { color: semantic.muted, children: clip3(version, Math.max(0, textWidth - name.length)) })
4456
4557
  ] }),
4457
- selfUpdate ? (
4458
- // `warning`, NOT `unknown`: el ámbar está reservado a «no se pudo
4459
- // determinar» (DES-001@r1) y reusarlo acá lo vuelve a significar dos cosas.
4460
- /* @__PURE__ */ jsxs9(Text10, { color: semantic.warning, children: [
4461
- " ",
4462
- "\u2192 v",
4463
- selfUpdate.version,
4464
- " \xB7 ",
4465
- selfUpdate.howTo
4466
- ] })
4467
- ) : null
4468
- ] }),
4469
- /* @__PURE__ */ jsx11(Text10, { color: sudoMode2 ? semantic.warning : colors.outline, children: sudoMode2 ? "SUDO" : `${process.platform}` })
4558
+ /* @__PURE__ */ jsx11(Text10, { color: semantic.muted, children: clip3(platform, textWidth) }),
4559
+ /* @__PURE__ */ jsx11(Text10, { color: semantic.muted, children: clip3(step ? `${t("flow", "step")} ${step}/4 ${g.separator} ${label}` : label, textWidth) })
4560
+ ] })
4561
+ ] });
4562
+ }
4563
+ function LineHeader() {
4564
+ const { state, selfUpdate } = useMachine();
4565
+ const width = Math.min(process.stdout.columns ?? 100, 100) - 2;
4566
+ const key = state.phase === "boot" ? "detecting" : state.phase;
4567
+ const label = t("flow", key);
4568
+ const step = steps[state.phase];
4569
+ let product = ` updater ${getVersion()}${selfUpdate ? ` ${g.arrow} ${selfUpdate.version}` : ""}`;
4570
+ let right = step ? `${t("flow", "step")} ${step}/4 ${g.separator} ${label}` : label;
4571
+ if (8 + product.length + right.length + 1 > width) product = product.replace(" updater", "");
4572
+ if (8 + product.length + right.length + 1 > width && step) right = `${step}/4 ${g.separator} ${label}`;
4573
+ const available = width - 8 - product.length - 1;
4574
+ if (right.length > available) right = right.slice(0, Math.max(0, available - g.ellipsis.length)) + g.ellipsis;
4575
+ const gap = " ".repeat(Math.max(1, width - 8 - product.length - right.length));
4576
+ const plainLogo = ASCII || process.env["NO_COLOR"] !== void 0;
4577
+ return /* @__PURE__ */ jsxs8(Box8, { marginBottom: 1, children: [
4578
+ /* @__PURE__ */ jsx11(Text10, { bold: true, color: semantic.text, children: "tacuchi" }),
4579
+ plainLogo ? /* @__PURE__ */ jsx11(Text10, { children: "_" }) : /* @__PURE__ */ jsx11(Text10, { color: terminalTheme === "light" ? semantic.text : semantic.logoFill, backgroundColor: terminalTheme === "light" ? semantic.logoFill : void 0, children: g.logo }),
4580
+ /* @__PURE__ */ jsxs8(Text10, { color: semantic.muted, children: [
4581
+ product,
4582
+ gap,
4583
+ right
4584
+ ] })
4470
4585
  ] });
4471
4586
  }
4587
+
4588
+ // src/components/line-output.tsx
4589
+ import { useEffect as useEffect4, useRef as useRef3 } from "react";
4590
+ function LineOutput({ write }) {
4591
+ const { state, selfUpdate } = useMachine();
4592
+ const emitted = useRef3(/* @__PURE__ */ new Set());
4593
+ useEffect4(() => {
4594
+ const once2 = (key, text) => {
4595
+ if (emitted.current.has(key)) return;
4596
+ emitted.current.add(key);
4597
+ write(text + "\n");
4598
+ };
4599
+ if (state.error) once2("error", `${t("ui", "detectionFailed")} ${state.error}`);
4600
+ for (const id of state.run.queue) {
4601
+ const entry = state.managers[id];
4602
+ if (!entry) continue;
4603
+ const result = entry.result;
4604
+ once2(`${id}:${entry.status}`, `${managerName(id)}: ${t("status", entry.status)}${result ? ` ${countText(result.upgraded, "upgraded")}, ${countText(result.failed, "failed")}` : ""}${entry.manualCommand ? ` ${entry.manualCommand}` : ""}`);
4605
+ }
4606
+ if (state.phase === "summary" || state.phase === "select" && state.order.every((id) => state.managers[id]?.outdated.length === 0)) {
4607
+ const result = summarizeRun(state);
4608
+ once2("summary", `${t("flow", "summary")}: ${summaryText(result)}`);
4609
+ if (selfUpdate) once2("self-update", selfUpdate.howTo);
4610
+ }
4611
+ }, [state, selfUpdate, write]);
4612
+ return null;
4613
+ }
4614
+
4615
+ // src/app.tsx
4616
+ import { jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
4472
4617
  function PhaseRouter() {
4473
4618
  const { state } = useMachine();
4474
4619
  switch (state.phase) {
4475
4620
  case "boot":
4476
4621
  case "detecting":
4477
4622
  case "scanning":
4478
- return /* @__PURE__ */ jsx11(DetectScreen, {});
4623
+ return /* @__PURE__ */ jsx12(DetectScreen, {});
4479
4624
  case "select":
4480
- return /* @__PURE__ */ jsx11(SelectScreen, {});
4625
+ return /* @__PURE__ */ jsx12(SelectScreen, {});
4481
4626
  case "confirm":
4482
- return /* @__PURE__ */ jsx11(ConfirmScreen, {});
4627
+ return /* @__PURE__ */ jsx12(ConfirmScreen, {});
4483
4628
  case "updating":
4484
- return /* @__PURE__ */ jsx11(UpdateScreen, {});
4629
+ return /* @__PURE__ */ jsx12(UpdateScreen, {});
4485
4630
  case "summary":
4486
- return /* @__PURE__ */ jsx11(SummaryScreen, {});
4631
+ return /* @__PURE__ */ jsx12(SummaryScreen, {});
4487
4632
  case "detail":
4488
- return /* @__PURE__ */ jsx11(DetailScreen, {});
4633
+ return /* @__PURE__ */ jsx12(DetailScreen, {});
4489
4634
  case "settings":
4490
- return /* @__PURE__ */ jsx11(SettingsScreen, {});
4635
+ return /* @__PURE__ */ jsx12(SettingsScreen, {});
4491
4636
  default:
4492
4637
  return null;
4493
4638
  }
4494
4639
  }
4495
- function Shell({ sudoMode: sudoMode2 }) {
4496
- const { quitApp } = useMachine();
4497
- useSafeInput((input) => {
4498
- if (input === "q" || input === "Q") quitApp();
4499
- });
4640
+ function Shell() {
4641
+ const [, setSize] = useState7(0);
4642
+ useEffect5(() => {
4643
+ const resized = () => setSize((size) => size + 1);
4644
+ process.stdout.on("resize", resized);
4645
+ return () => {
4646
+ process.stdout.off("resize", resized);
4647
+ };
4648
+ }, []);
4500
4649
  return /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", paddingX: 1, width: Math.min(process.stdout.columns ?? 100, 100), children: [
4501
- /* @__PURE__ */ jsx11(Header, { sudoMode: sudoMode2 }),
4502
- /* @__PURE__ */ jsx11(PhaseRouter, {})
4650
+ /* @__PURE__ */ jsx12(StepHeader, {}),
4651
+ /* @__PURE__ */ jsx12(PhaseRouter, {})
4503
4652
  ] });
4504
4653
  }
4505
4654
  function App({
4506
4655
  sudoMode: sudoMode2 = false,
4507
- nonInteractive: nonInteractive2 = false
4656
+ nonInteractive: nonInteractive2 = false,
4657
+ lineOutput: lineOutput2
4508
4658
  }) {
4509
4659
  const machine = useAppMachine(sudoMode2, nonInteractive2);
4510
- return /* @__PURE__ */ jsx11(MachineProvider, { value: machine, children: /* @__PURE__ */ jsx11(Shell, { sudoMode: sudoMode2 }) });
4660
+ return /* @__PURE__ */ jsx12(MachineProvider, { value: machine, children: lineOutput2 ? /* @__PURE__ */ jsx12(LineOutput, { write: lineOutput2 }) : /* @__PURE__ */ jsx12(Shell, {}) });
4511
4661
  }
4512
4662
 
4513
4663
  // src/lib/signals.ts
@@ -4537,29 +4687,13 @@ function answerSignal(route, effects) {
4537
4687
  }
4538
4688
 
4539
4689
  // src/cli.tsx
4540
- import { jsx as jsx12 } from "react/jsx-runtime";
4690
+ import { jsx as jsx13 } from "react/jsx-runtime";
4691
+ setLanguage(loadConfig().language);
4541
4692
  var args = process.argv.slice(2);
4542
4693
  var sudoRequested = args.includes("--sudo") || args.includes("-s");
4543
4694
  var isRoot = process.getuid?.() === 0;
4544
4695
  if (args.includes("--help") || args.includes("-h")) {
4545
- console.log(`
4546
- @tacuchi/updater \u2014 CLI para actualizar gestores de paquetes
4547
-
4548
- Uso:
4549
- updater Modo normal (sin permisos de admin)
4550
- updater --sudo Ejecutar con permisos de administrador
4551
- updater --help Mostrar esta ayuda
4552
-
4553
- Flags:
4554
- -s, --sudo Permite actualizar gestores que requieren admin
4555
- (softwareupdate, apt, dnf, pacman, snap)
4556
- -y, --yes, --all Modo no-interactivo: actualiza todo sin teclado
4557
- (autom\xE1tico cuando stdin no es un TTY / CI / pipe)
4558
- -h, --help Mostrar ayuda
4559
- -v, --version Mostrar versi\xF3n
4560
-
4561
- Tip: ejecuta siempre la \xFAltima versi\xF3n con npx @tacuchi/updater@latest
4562
- `);
4696
+ console.log(t("cli", "help"));
4563
4697
  process.exit(0);
4564
4698
  }
4565
4699
  if (args.includes("--version") || args.includes("-v")) {
@@ -4567,7 +4701,7 @@ if (args.includes("--version") || args.includes("-v")) {
4567
4701
  process.exit(0);
4568
4702
  }
4569
4703
  if (sudoRequested && !isRoot && process.platform !== "win32") {
4570
- console.log("\x1B[35m\xBB Modo SUDO: ingresa tu contrase\xF1a para continuar...\x1B[0m");
4704
+ console.log(t("cli", "sudoPrompt"));
4571
4705
  try {
4572
4706
  const scriptPath = process.argv[1] ?? "";
4573
4707
  const isDevMode = scriptPath.endsWith(".tsx") || scriptPath.endsWith(".ts");
@@ -4579,18 +4713,48 @@ if (sudoRequested && !isRoot && process.platform !== "win32") {
4579
4713
  });
4580
4714
  process.exit(result.exitCode ?? 0);
4581
4715
  } catch {
4582
- console.error("\x1B[31m\u2717 No se pudo autenticar sudo. Continuando sin permisos elevados.\x1B[0m");
4716
+ console.error(t("cli", "sudoFailure"));
4583
4717
  }
4584
4718
  }
4585
4719
  var elevated = await isElevated();
4586
4720
  if (process.platform === "win32" && sudoRequested && !elevated) {
4587
4721
  console.log(
4588
- "\x1B[33m\xBB En Windows --sudo no eleva. Abr\xED la terminal como Administrador (se detecta autom\xE1ticamente).\x1B[0m"
4722
+ t("cli", "windowsAdmin")
4589
4723
  );
4590
4724
  }
4591
4725
  var sudoMode = process.platform === "win32" ? elevated : isRoot || sudoRequested;
4592
4726
  var nonInteractive = !process.stdin.isTTY || args.includes("--yes") || args.includes("-y") || args.includes("--all");
4593
- var { unmount } = render(/* @__PURE__ */ jsx12(App, { sudoMode, nonInteractive }));
4727
+ var bannerWanted = !nonInteractive && bannerBlocker({
4728
+ env: process.env,
4729
+ stdoutTTY: process.stdout.isTTY === true,
4730
+ ascii: ASCII,
4731
+ columns: Math.min(process.stdout.columns ?? 0, 100),
4732
+ rows: process.stdout.rows ?? 0
4733
+ }) === null;
4734
+ var probe = await probeTerminal({ interactive: !nonInteractive, images: bannerWanted });
4735
+ setTerminalTheme(probe.theme);
4736
+ if (probe.images) {
4737
+ const piece = pickPiece(probe.theme, probe.themeKnown);
4738
+ const id = pickImageId();
4739
+ process.stdout.write(transmitImage(id, piece));
4740
+ configureBanner({ id, columns: piece.columns, rows: piece.rows });
4741
+ process.on("exit", () => {
4742
+ process.stdout.write(deleteImage(id));
4743
+ });
4744
+ }
4745
+ var redirected = !process.stdout.isTTY;
4746
+ var lineOutput = redirected ? (line) => {
4747
+ process.stdout.write(line);
4748
+ } : void 0;
4749
+ var sink = redirected ? new Writable({ write(_chunk, _encoding, done) {
4750
+ done();
4751
+ } }) : process.stdout;
4752
+ var app = /* @__PURE__ */ jsx13(App, { sudoMode, nonInteractive, lineOutput });
4753
+ var { unmount: inkUnmount, rerender } = render(app, { exitOnCtrlC: false, stdout: sink });
4754
+ var unmount = () => {
4755
+ if (retireBanner()) rerender(app);
4756
+ inkUnmount();
4757
+ };
4594
4758
  for (const route of signalRoutes(process.platform)) {
4595
4759
  process.on(
4596
4760
  route.signal,