@tacuchi/updater 3.0.1 → 3.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +67 -62
  3. package/dist/cli.js +1529 -1165
  4. package/package.json +11 -2
package/dist/cli.js CHANGED
@@ -1,11 +1,862 @@
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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1Her3td3YsBhlNR3syHUd2LAYXTUd6tB1HdiwGF01HezodR3YsBhVNR3q8HUd2LAYVTUd7Mh1XdiwGE01HerQdV3YsBhNNR3s6HVd2LAYRTUd6vB1XdiwGEU1HezIdZ3YsBh46nvVoOs78SAw8ZT382GWt+JAYeNpr5bDba+EwMOG019NxtyfQMAAAAAAAAAAAAAMDz/C9fVY89rPsc2AAAAAElFTkSuQmCC";
449
+ var lightIsotypeBitmap = { width: 368, height: 312, palette: ["111111", "b6f23c"], runs: "Pz8/Pz8/Pz8/Pz8/Pz8/Pz8/Pz8/Pz8/Pz8/Pz8/Pz8/Pz8/Pz8/Pz8/Pz8/Py9/f39/Xz8Of39/f18/D39/f39fPw5/f39/Xz8Pf39/f18/Dn9/f39fPw9/f39/Xz8Of39/f18/D39/f39fPw5/f39/Xz8Pf39/f18/Dn9/f39fPw9/f39/Xz8Of39/f18/D39/f39fPw5/f39/Xz8Pf39/f18/Dn9/f39fPw9/f39/Xz8Of39/f18/D39/f39fPw5/f39/Xz8Pf39/f18/Dn9/f39fPw9/f39/Xz8Of39/f18/D39/f39fPw5/f39/Xz8Pf39/f18/Dn9/f39fPw9/f39/Xz8Of39/f18/D39/f39fPw5/f39/Xz8Pf39/f18/Dn9/f39fPw9/f39/Xz8Of39/f18/D39/f39fPw5/f39/Xz8Pf39/f18/Dn9/f39fPw9/f39/Xz8Of39/f18/D39/f39fPw5/f39/Xz8Pf39/f18/Dn9/f39fPw9/f39/Xz8Of39/f18/D39/f39fPw5/f39/Xz8Pf39/f18/Dn9/f39fPw9/f39/Xz8Of39/f18/D39/f39fPw5/f39/Xz8Pf39/f18/Dn9/f39fPw9/f39/Xz8Of39/f18/D39/f39fPw5/f39/Xz8Pf39/f18/Dn9/f39fPw9/f39/Xz8Of39/f18/D39/f39fPw5/f39/Xz8Pf39/f18/Dn9/f39fPw9/f39/Xz8Of39/f18/D39/f39fPw5/f39/Xz8Pf39/f18/Dn9/f39fPw9/f39/Xz8Of39/f18/In9/fD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39/f39/f39/f39/f39/f39/f39/f39/f2kAf399AX9/fQF/f30Bf399An9/ewN/f3sDf397BH9/eQV/f3kGf393B39/dwh/f3UJf391Cn9/cwt/f3MMf39xDn9/bxB/f20Sf39rFH9/aRZ/f2cYf39lGn9/Yxx/f2Eff39dI39/WSd/f1Yqf39RMH9/Szd/f0Md" };
452
+
453
+ // src/lib/terminal-image.ts
454
+ var ESC = "\x1B";
455
+ var ST = `${ESC}\\`;
456
+ var KITTY_QUERY_ID = 31;
457
+ var KITTY_QUERY = `${ESC}_Gi=${KITTY_QUERY_ID},s=1,v=1,a=q,t=d,f=24;AAAA${ST}`;
458
+ var BANNER_MIN_COLUMNS = 60;
459
+ var BANNER_MIN_ROWS = 17 + 2;
460
+ var BANNER_EXTRA_ROWS = 2;
461
+ var CHUNK = 4096;
462
+ var PLACEHOLDER = "\u{10EEEE}";
463
+ var DIACRITICS = [773, 781, 782, 784, 786, 829, 830, 831].map((code) => String.fromCodePoint(code));
464
+ var CELL_SIZE_QUERY = `${ESC}[16t`;
465
+ var CURSOR_IMAGE_ID = 31313;
466
+ var CURSOR_PLACEMENT_ID = 1;
467
+ var IMAGE_COLUMN = 2;
468
+ var SIXEL_BY_DEFAULT = false;
469
+ function answersImages(response) {
470
+ const answer = response.indexOf(`${ESC}_Gi=${KITTY_QUERY_ID};OK${ST}`);
471
+ const attributes = response.search(/\x1b\[[?\d;]*c/);
472
+ return answer !== -1 && attributes !== -1 && answer < attributes;
473
+ }
474
+ function listsSixel(response) {
475
+ const match = response.match(/\x1b\[\?([\d;]*)c/);
476
+ return match !== null && match[1].split(";").includes("4");
477
+ }
478
+ function cellSize(response) {
479
+ const match = response.match(/\x1b\[6;(\d+);(\d+)t/);
480
+ const attributes = response.search(/\x1b\[[?\d;]*c/);
481
+ if (!match || attributes === -1 || match.index > attributes) return null;
482
+ const [height, width] = [Number(match[1]), Number(match[2])];
483
+ return height > 0 && width > 0 ? { width, height } : null;
484
+ }
485
+ function drawsPlaceholders(env) {
486
+ return env["TERM_PROGRAM"] === "ghostty" || env["TERM"] === "xterm-ghostty" || env["TERM"] === "xterm-kitty" || env["KITTY_WINDOW_ID"] !== void 0;
487
+ }
488
+ function forcedTier(env) {
489
+ const value = env["TACUCHI_BANNER"]?.trim().toLowerCase();
490
+ if (value === "off") return "none";
491
+ return value === "placeholders" || value === "cursor" || value === "sixel" ? value : null;
492
+ }
493
+ function pickTier({ env, images, sixel }) {
494
+ const forced = forcedTier(env);
495
+ if (forced) return forced;
496
+ if (images) return drawsPlaceholders(env) ? "placeholders" : "cursor";
497
+ if (SIXEL_BY_DEFAULT && sixel) return "sixel";
498
+ return "none";
499
+ }
500
+ function pickPiece(theme, themeKnown) {
501
+ if (!themeKnown) return { name: "icono-terminal", png: icon, bitmap: iconBitmap, columns: 6, rows: 3 };
502
+ return theme === "light" ? { name: "isotipo-terminal-claro", png: lightIsotype, bitmap: lightIsotypeBitmap, columns: 8, rows: 3 } : { name: "isotipo-terminal-oscuro", png: darkIsotype, bitmap: darkIsotypeBitmap, columns: 8, rows: 3 };
503
+ }
504
+ function bannerBlocker({ env, stdoutTTY, ascii, columns, rows }) {
505
+ if (!stdoutTTY) return "not-tty";
506
+ if (env["NO_COLOR"] !== void 0) return "no-color";
507
+ if (ascii) return "ascii";
508
+ if (env["TMUX"] || env["STY"] || /^(?:screen|tmux)/.test(env["TERM"] ?? "")) return "multiplexer";
509
+ if (columns < BANNER_MIN_COLUMNS) return "narrow";
510
+ if (rows < BANNER_MIN_ROWS) return "short";
511
+ return null;
512
+ }
513
+ function bannerWanted({ env, interactive, stdoutTTY, ascii, columns, rows }) {
514
+ return interactive && forcedTier(env) !== "none" && bannerBlocker({ env, stdoutTTY, ascii, columns, rows }) === null;
515
+ }
516
+ function sixelPossible(env) {
517
+ return SIXEL_BY_DEFAULT || forcedTier(env) === "sixel";
518
+ }
519
+ function pickImageId(random = Math.random) {
520
+ return 16 + Math.floor(random() * 240);
521
+ }
522
+ function chunked(png, firstKeys) {
523
+ const chunks = [];
524
+ for (let start = 0; start < png.length; start += CHUNK) chunks.push(png.slice(start, start + CHUNK));
525
+ return chunks.map((chunk, index) => {
526
+ const more = index < chunks.length - 1 ? 1 : 0;
527
+ return `${ESC}_G${index === 0 ? `${firstKeys},m=${more}` : `m=${more}`};${chunk}${ST}`;
528
+ }).join("");
529
+ }
530
+ function transmitImage(id, piece) {
531
+ return chunked(piece.png, `a=T,U=1,f=100,t=d,i=${id},c=${piece.columns},r=${piece.rows},C=1,q=2`);
532
+ }
533
+ function transmitData(id, png) {
534
+ return chunked(png, `a=t,f=100,t=d,i=${id},q=2`);
535
+ }
536
+ function placeImage({ id, placement, columns, rows, up }) {
537
+ return `${ESC}7${up > 0 ? `${ESC}[${up}A` : ""}${ESC}[${IMAGE_COLUMN + 1}G${ESC}_Ga=p,i=${id},p=${placement},c=${columns},r=${rows},C=1,q=2${ST}${ESC}8`;
538
+ }
539
+ function deletePlacement(id, placement) {
540
+ return `${ESC}_Ga=d,d=i,i=${id},p=${placement},q=2${ST}`;
541
+ }
542
+ function drawSixel(sixel, up) {
543
+ return `${ESC}7${up > 0 ? `${ESC}[${up}A` : ""}${ESC}[${IMAGE_COLUMN + 1}G${sixel}${ESC}8`;
544
+ }
545
+ function deleteImage(id) {
546
+ return `${ESC}_Ga=d,d=I,i=${id},q=2${ST}`;
547
+ }
548
+ function placeholderRows(id, columns, rows) {
549
+ 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`);
550
+ }
551
+
552
+ // src/lib/terminal-theme.ts
553
+ var THEME_TIMEOUT_MS = 150;
554
+ function parseTerminalTheme(colorfgbg, response = "") {
555
+ const palette = colorfgbg?.split(";").at(-1);
556
+ if (palette !== void 0 && /^\d+$/.test(palette)) return [7, 10, 11, 14, 15].includes(Number(palette)) ? "light" : "dark";
557
+ const match = response.match(/\x1b\]11;rgb:([a-f\d]+)\/([a-f\d]+)\/([a-f\d]+)(?:\x07|\x1b\\)/i);
558
+ if (!match) return "dark";
559
+ const channels = match.slice(1).map((value) => {
560
+ const c = parseInt(value, 16) / (16 ** value.length - 1);
561
+ return c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
562
+ });
563
+ return channels[0] * 0.2126 + channels[1] * 0.7152 + channels[2] * 0.0722 > 0.5 ? "light" : "dark";
564
+ }
565
+ function themeReported(colorfgbg, response = "") {
566
+ const palette = colorfgbg?.split(";").at(-1);
567
+ if (palette !== void 0 && /^\d+$/.test(palette)) return true;
568
+ return /\x1b\]11;rgb:[a-f\d]+\/[a-f\d]+\/[a-f\d]+(?:\x07|\x1b\\)/i.test(response);
569
+ }
570
+ async function probeTerminal({ input = process.stdin, output = process.stdout, interactive, env = process.env, images = false, cell = false }) {
571
+ const colorfgbg = env["COLORFGBG"];
572
+ if (!interactive || !input.isTTY || !output.isTTY || !input.setRawMode) return { theme: "dark", themeKnown: false, images: false, sixel: false, cell: null };
573
+ if (colorfgbg && !images) return { theme: parseTerminalTheme(colorfgbg), themeKnown: themeReported(colorfgbg), images: false, sixel: false, cell: null };
574
+ const wasRaw = input.isRaw === true;
575
+ const wasPaused = input.isPaused();
576
+ input.setRawMode(true);
577
+ let response = "";
578
+ try {
579
+ await new Promise((resolve) => {
580
+ const finish = () => {
581
+ clearTimeout(timer);
582
+ input.off("data", data);
583
+ resolve();
584
+ };
585
+ const data = (chunk) => {
586
+ response += chunk.toString();
587
+ if (/\x1b\[[?\d;]*c/.test(response)) finish();
588
+ };
589
+ const timer = setTimeout(finish, THEME_TIMEOUT_MS);
590
+ input.on("data", data);
591
+ output.write((colorfgbg ? "" : "\x1B]11;?\x07") + (images ? KITTY_QUERY : "") + (images && cell ? CELL_SIZE_QUERY : "") + "\x1B[c");
592
+ });
593
+ } finally {
594
+ input.setRawMode(wasRaw);
595
+ if (wasPaused) input.pause();
596
+ }
597
+ return {
598
+ theme: parseTerminalTheme(colorfgbg, response),
599
+ themeKnown: themeReported(colorfgbg, response),
600
+ images: images && answersImages(response),
601
+ sixel: images && listsSixel(response),
602
+ cell: images && cell ? cellSize(response) : null
603
+ };
604
+ }
605
+
606
+ // src/lib/glyphs.ts
607
+ function shouldUseAscii(env, platform) {
608
+ if (env["TACUCHI_ASCII"] === "1") return true;
609
+ if (env["TACUCHI_ASCII"] === "0") return false;
610
+ if (env["TERM"] === "dumb") return true;
611
+ if (platform === "win32" && !env["WT_SESSION"]) return true;
612
+ return false;
613
+ }
614
+ var UNICODE = {
615
+ separator: "\xB7",
616
+ logo: "\u2582",
617
+ partial: "!",
618
+ pending: "\xB7",
619
+ scanning: "\u25CC",
620
+ outdated: "\u203A",
621
+ uptodate: "\u2713",
622
+ running: "\u25B8",
623
+ done: "\u2713",
624
+ failed: "\u2717",
625
+ skipped: "\u2298",
626
+ unknown: "?",
627
+ cursor: "\u276F",
628
+ checkOn: "[\u2713]",
629
+ checkOff: "[ ]",
630
+ arrow: "\u2192",
631
+ scrollUp: "\u25B2",
632
+ scrollDown: "\u25BC",
633
+ stepOn: "\u2586",
634
+ stepOff: "\u2581",
635
+ info: "\u24D8",
636
+ ellipsis: "\u2026",
637
+ bullet: "\u25B8",
638
+ reboot: "\u27F3"
639
+ };
640
+ var ASCII_GLYPHS = {
641
+ separator: "|",
642
+ logo: "_",
643
+ partial: "!",
644
+ pending: ".",
645
+ scanning: "o",
646
+ outdated: ">",
647
+ uptodate: "+",
648
+ running: ">",
649
+ done: "+",
650
+ failed: "x",
651
+ skipped: "-",
652
+ unknown: "?",
653
+ cursor: ">",
654
+ checkOn: "[x]",
655
+ checkOff: "[ ]",
656
+ arrow: "->",
657
+ scrollUp: "^",
658
+ scrollDown: "v",
659
+ stepOn: "#",
660
+ stepOff: "_",
661
+ info: "i",
662
+ ellipsis: "...",
663
+ bullet: ">",
664
+ reboot: "*"
665
+ };
666
+ var ASCII = shouldUseAscii(process.env, process.platform);
667
+ var g = ASCII ? ASCII_GLYPHS : UNICODE;
668
+ var NO_ANIM = ASCII || !process.stdout.isTTY;
669
+ var SPINNER_UNICODE = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
670
+ var SPINNER_ASCII = ["|", "/", "-", "\\"];
671
+ var spinnerFrames = ASCII ? SPINNER_ASCII : SPINNER_UNICODE;
672
+
673
+ // src/lib/banner.ts
674
+ var image = null;
675
+ var retired = false;
676
+ var listeners = /* @__PURE__ */ new Set();
677
+ var emit = () => {
678
+ for (const listener of listeners) listener();
679
+ };
680
+ function configureBanner(next) {
681
+ image = next;
682
+ retired = false;
683
+ emit();
684
+ }
685
+ function retireBanner() {
686
+ if (!image || retired) return false;
687
+ retired = true;
688
+ emit();
689
+ return true;
690
+ }
691
+ function subscribeBanner(listener) {
692
+ listeners.add(listener);
693
+ return () => {
694
+ listeners.delete(listener);
695
+ };
696
+ }
697
+ function bannerSnapshot() {
698
+ return retired ? null : image;
699
+ }
700
+ function shownBanner(snapshot2 = bannerSnapshot(), stdout = process.stdout, env = process.env, ascii = ASCII) {
701
+ if (!snapshot2) return null;
702
+ const blocker = bannerBlocker({ env, stdoutTTY: true, ascii, columns: Math.min(stdout.columns ?? 100, 100), rows: stdout.rows ?? 24 });
703
+ return blocker ? null : snapshot2;
704
+ }
705
+ function headerExtraRows() {
706
+ return shownBanner() ? BANNER_EXTRA_ROWS : 0;
707
+ }
708
+
709
+ // src/lib/sixel.ts
710
+ var ESC2 = "\x1B";
711
+ var DEFAULT_CELL = { width: 10, height: 20 };
712
+ function decodeRuns(bitmap) {
713
+ const pixels = new Uint8Array(bitmap.width * bitmap.height);
714
+ let at = 0;
715
+ for (const byte of Buffer.from(bitmap.runs, "base64")) {
716
+ const end = Math.min(pixels.length, at + (byte & 63) + 1);
717
+ pixels.fill(byte >> 6, at, end);
718
+ at = end;
719
+ }
720
+ if (at !== pixels.length) throw new Error(`bitmap runs cover ${at} pixels, expected ${pixels.length}`);
721
+ return pixels;
722
+ }
723
+ function scaleIndexed(source, width, height, targetWidth, targetHeight) {
724
+ const target = new Uint8Array(targetWidth * targetHeight);
725
+ const counts = [0, 0, 0, 0];
726
+ for (let ty = 0; ty < targetHeight; ty++) {
727
+ const y0 = Math.floor(ty * height / targetHeight);
728
+ const y1 = Math.max(y0 + 1, Math.floor((ty + 1) * height / targetHeight));
729
+ for (let tx = 0; tx < targetWidth; tx++) {
730
+ const x0 = Math.floor(tx * width / targetWidth);
731
+ const x1 = Math.max(x0 + 1, Math.floor((tx + 1) * width / targetWidth));
732
+ counts.fill(0);
733
+ for (let y = y0; y < y1; y++) for (let x = x0; x < x1; x++) counts[source[y * width + x]]++;
734
+ let best = 0;
735
+ if (counts[0] * 2 <= (y1 - y0) * (x1 - x0)) {
736
+ for (let index = 1; index < 4; index++) if (best === 0 || counts[index] > counts[best]) best = index;
737
+ }
738
+ target[ty * targetWidth + tx] = best;
739
+ }
740
+ }
741
+ return target;
742
+ }
743
+ var percent = (channel) => Math.round(channel * 100 / 255);
744
+ var repeat = (char, count) => count >= 4 ? `!${count}${char}` : char.repeat(count);
745
+ function encodeSixel(pixels, width, height, palette) {
746
+ let out = `${ESC2}P0;1;0q"1;1;${width};${height}`;
747
+ palette.forEach((hex, slot) => {
748
+ const value = parseInt(hex, 16);
749
+ out += `#${slot + 1};2;${percent(value >> 16)};${percent(value >> 8 & 255)};${percent(value & 255)}`;
750
+ });
751
+ for (let band = 0; band < height; band += 6) {
752
+ const layers = [];
753
+ for (let index = 1; index <= palette.length; index++) {
754
+ const runs = [];
755
+ for (let x = 0; x < width; x++) {
756
+ let bits = 0;
757
+ for (let row = 0; row < 6 && band + row < height; row++) if (pixels[(band + row) * width + x] === index) bits |= 1 << row;
758
+ const char = String.fromCharCode(63 + bits);
759
+ const last = runs.at(-1);
760
+ if (last && last[0] === char) last[1]++;
761
+ else runs.push([char, 1]);
762
+ }
763
+ if (runs.at(-1)?.[0] === "?") runs.pop();
764
+ if (runs.length > 0) layers.push(`#${index}${runs.map(([char, count]) => repeat(char, count)).join("")}`);
765
+ }
766
+ out += layers.join("$") + (band + 6 < height ? "-" : "");
767
+ }
768
+ return `${out}${ESC2}\\`;
769
+ }
770
+ function sixelImage(bitmap, columns, rows, cell = DEFAULT_CELL) {
771
+ const width = columns * cell.width;
772
+ const height = rows * cell.height;
773
+ return encodeSixel(scaleIndexed(decodeRuns(bitmap), bitmap.width, bitmap.height, width, height), width, height, bitmap.palette);
774
+ }
775
+
776
+ // src/lib/banner-output.ts
777
+ var CLEAR = /\x1b\[[23]J/g;
778
+ function frameRows(chunk) {
779
+ let start = 0;
780
+ for (const match of chunk.matchAll(CLEAR)) start = match.index + match[0].length;
781
+ const cleared = start > 0;
782
+ const rows = chunk.slice(start).split("\n").length - 1;
783
+ return rows > 0 || cleared ? rows : null;
784
+ }
785
+ function clearsScreen(chunk) {
786
+ return /\x1b\[[23]J/.test(chunk);
787
+ }
788
+ function bannerPainter({ tier: tier2, id, columns, rows, retransmit, sixel = "", shown, terminalRows }) {
789
+ let placed = false;
790
+ return (chunk) => {
791
+ const cleared = clearsScreen(chunk);
792
+ let extra = "";
793
+ if (cleared && tier2 !== "sixel") {
794
+ extra += retransmit;
795
+ placed = false;
796
+ }
797
+ if (tier2 === "placeholders") return extra;
798
+ const up = frameRows(chunk);
799
+ if (up === null) return extra;
800
+ const visible = shown() && up <= terminalRows() - 1;
801
+ if (tier2 === "sixel") return visible ? extra + drawSixel(sixel, up) : extra;
802
+ if (visible) {
803
+ placed = true;
804
+ return extra + placeImage({ id, placement: CURSOR_PLACEMENT_ID, columns, rows, up });
805
+ }
806
+ if (placed) {
807
+ placed = false;
808
+ return extra + deletePlacement(id, CURSOR_PLACEMENT_ID);
809
+ }
810
+ return extra;
811
+ };
812
+ }
813
+ function startBanner({ tier: tier2, piece, cell, shown, terminalRows, random }) {
814
+ const { columns, rows } = piece;
815
+ if (tier2 === "sixel") {
816
+ const sixel = sixelImage(piece.bitmap, columns, rows, cell ?? void 0);
817
+ return { image: { id: 0, columns, rows, tier: tier2 }, start: "", exit: "", after: bannerPainter({ tier: tier2, id: 0, columns, rows, retransmit: "", sixel, shown, terminalRows }) };
818
+ }
819
+ const id = tier2 === "cursor" ? CURSOR_IMAGE_ID : pickImageId(random);
820
+ const transmit = tier2 === "cursor" ? transmitData(id, piece.png) : transmitImage(id, piece);
821
+ return {
822
+ image: { id, columns, rows, tier: tier2 },
823
+ start: transmit,
824
+ exit: deleteImage(id),
825
+ after: bannerPainter({ tier: tier2, id, columns, rows, retransmit: transmit, shown, terminalRows })
826
+ };
827
+ }
828
+ function wrapStdout(stdout, after) {
829
+ const write = (chunk, ...rest) => {
830
+ const result = stdout.write(chunk, ...rest);
831
+ const extra = after(typeof chunk === "string" ? chunk : Buffer.from(chunk).toString());
832
+ if (extra) stdout.write(extra);
833
+ return result;
834
+ };
835
+ return new Proxy(stdout, {
836
+ get(target, property) {
837
+ if (property === "write") return write;
838
+ const value = Reflect.get(target, property, target);
839
+ return typeof value === "function" ? value.bind(target) : value;
840
+ }
841
+ });
842
+ }
843
+ function mountBanner({ tier: tier2, piece, cell, stdout, exitEvents, random }) {
844
+ const banner = startBanner({ tier: tier2, piece, cell, random, shown: () => shownBanner() !== null, terminalRows: () => stdout.rows ?? 24 });
845
+ if (banner.start) stdout.write(banner.start);
846
+ configureBanner(banner.image);
847
+ if (exitEvents && banner.exit) exitEvents.on("exit", () => {
848
+ stdout.write(banner.exit);
849
+ });
850
+ return { stdout: wrapStdout(stdout, banner.after), banner };
851
+ }
852
+
3
853
  // src/cli.tsx
4
854
  import { render } from "ink";
5
855
  import { execaSync } from "execa";
6
856
 
7
857
  // src/app.tsx
8
- import { Box as Box9, Text as Text10 } from "ink";
858
+ import { useEffect as useEffect5, useState as useState7 } from "react";
859
+ import { Box as Box9 } from "ink";
9
860
 
10
861
  // src/hooks/use-app-machine.tsx
11
862
  import { createContext, useContext, useReducer, useEffect, useRef, useState, useCallback } from "react";
@@ -62,7 +913,7 @@ function allOutdatedKeys(state) {
62
913
  function appReducer(state, action) {
63
914
  switch (action.type) {
64
915
  case "BOOT_DONE":
65
- return { ...state, phase: "detecting" };
916
+ return { ...state, phase: "detecting", error: void 0 };
66
917
  case "DETECT_DONE": {
67
918
  const managers = {};
68
919
  for (const info of action.managers) managers[info.id] = newEntry(info);
@@ -132,7 +983,7 @@ function appReducer(state, action) {
132
983
  ...state,
133
984
  phase: "updating",
134
985
  managers,
135
- run: { queue: action.queue, doneCount: 0, failedCount: 0, skippedCount: 0, unknownCount: 0 }
986
+ run: { startedAt: action.at, queue: action.queue, doneCount: 0, failedCount: 0, skippedCount: 0, unknownCount: 0 }
136
987
  };
137
988
  }
138
989
  case "MGR_QUEUED":
@@ -154,8 +1005,8 @@ function appReducer(state, action) {
154
1005
  }));
155
1006
  case "MGR_DONE":
156
1007
  return {
157
- ...patch(state, action.id, (e) => ({ ...e, status: "done", percent: 100, result: action.result })),
158
- run: { ...state.run, doneCount: state.run.doneCount + 1 }
1008
+ ...patch(state, action.id, (e) => ({ ...e, status: action.result.failed > 0 ? "partial" : "done", percent: 100, result: action.result })),
1009
+ run: { ...state.run, doneCount: state.run.doneCount + (action.result.failed > 0 ? 0 : 1), failedCount: state.run.failedCount + (action.result.failed > 0 ? 1 : 0) }
159
1010
  };
160
1011
  case "MGR_FAILED":
161
1012
  return {
@@ -174,8 +1025,10 @@ function appReducer(state, action) {
174
1025
  ...patch(state, action.id, (e) => ({ ...e, status: "unknown", percent: 100, result: action.result })),
175
1026
  run: { ...state.run, unknownCount: state.run.unknownCount + 1 }
176
1027
  };
1028
+ case "RUN_CANCEL":
1029
+ return { ...state, managers: Object.fromEntries(Object.entries(state.managers).map(([id, entry]) => [id, entry.status === "running" ? { ...entry, status: "cancelling" } : entry])) };
177
1030
  case "RUN_DONE":
178
- return { ...state, phase: "summary" };
1031
+ return { ...state, phase: "summary", run: { ...state.run, finishedAt: action.at } };
179
1032
  case "SET_LANGUAGE":
180
1033
  return { ...state, config: { ...state.config, language: action.lang } };
181
1034
  case "TOGGLE_ENABLED": {
@@ -289,8 +1142,11 @@ function withSudo(cmd, args2, sudo) {
289
1142
  return [cmd, args2];
290
1143
  }
291
1144
  function tail(s, bytes) {
292
- if (!s) return "";
293
- return s.length > bytes ? s.slice(-bytes) : s;
1145
+ if (Buffer.byteLength(s, "utf8") <= bytes) return s;
1146
+ const encoded = Buffer.from(s, "utf8");
1147
+ let start = encoded.length - bytes;
1148
+ while (start < encoded.length && (encoded[start] & 192) === 128) start += 1;
1149
+ return encoded.subarray(start).toString("utf8");
294
1150
  }
295
1151
  function execaOptions(opts, all) {
296
1152
  if (!Number.isFinite(opts.timeoutMs) || opts.timeoutMs < 0) {
@@ -334,12 +1190,12 @@ async function* runStream(cmd, args2, opts, percentParser) {
334
1190
  if (child.all) {
335
1191
  const decoder = new StreamDecoder();
336
1192
  let lineBuf = "";
337
- const emit = function* (raw) {
1193
+ const emit2 = function* (raw) {
338
1194
  const line = raw.replace(/\r$/, "");
339
1195
  if (!line) return;
340
- const percent = percentParser?.(line);
341
- if (percent !== void 0) {
342
- yield { type: "progress", message: line, percent };
1196
+ const percent2 = percentParser?.(line);
1197
+ if (percent2 !== void 0) {
1198
+ yield { type: "progress", message: line, percent: percent2 };
343
1199
  } else {
344
1200
  yield { type: "log", message: line, severity: WARN_RE.test(line) ? "warn" : "info" };
345
1201
  }
@@ -350,11 +1206,11 @@ async function* runStream(cmd, args2, opts, percentParser) {
350
1206
  while ((nl = lineBuf.indexOf("\n")) >= 0) {
351
1207
  const raw = lineBuf.slice(0, nl);
352
1208
  lineBuf = lineBuf.slice(nl + 1);
353
- yield* emit(raw);
1209
+ yield* emit2(raw);
354
1210
  }
355
1211
  }
356
1212
  lineBuf += decoder.end();
357
- if (lineBuf) yield* emit(lineBuf);
1213
+ if (lineBuf) yield* emit2(lineBuf);
358
1214
  }
359
1215
  const result = await child;
360
1216
  return {
@@ -456,183 +1312,64 @@ function reconcile(requested, before, after, commands, successExitCodes) {
456
1312
  outcome: "unknown",
457
1313
  fromVersion: b?.currentVersion,
458
1314
  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
- }
1315
+ };
1316
+ }),
1317
+ commands
1318
+ };
627
1319
  }
628
- }
629
- function isManagerEnabled(config, managerId) {
630
- if (Object.prototype.hasOwnProperty.call(config.enabledManagers, managerId)) {
631
- return config.enabledManagers[managerId] ?? true;
1320
+ const stillOutdated = new Set(after.stillOutdated.map((p) => p.name));
1321
+ const packages = targets.map((name) => {
1322
+ const b = beforeByName.get(name);
1323
+ if (stillOutdated.has(name)) {
1324
+ return {
1325
+ name,
1326
+ outcome: "failed",
1327
+ fromVersion: b?.currentVersion,
1328
+ toVersion: b?.newVersion,
1329
+ failureKind: cmdKind ?? "COMMAND_FAILED"
1330
+ };
1331
+ }
1332
+ return {
1333
+ name,
1334
+ outcome: "upgraded",
1335
+ fromVersion: b?.currentVersion,
1336
+ toVersion: b?.newVersion
1337
+ };
1338
+ });
1339
+ const upgraded = packages.filter((p) => p.outcome === "upgraded").length;
1340
+ const failed = packages.filter((p) => p.outcome === "failed").length;
1341
+ let status;
1342
+ let reason;
1343
+ if (targets.length === 0) {
1344
+ status = "noop";
1345
+ } else if (failed === 0) {
1346
+ status = "success";
1347
+ } else if (upgraded === 0) {
1348
+ status = "failed";
1349
+ reason = cmdKind ?? "UNKNOWN";
1350
+ } else {
1351
+ status = "partial";
1352
+ reason = "PARTIAL";
632
1353
  }
633
- return true;
1354
+ const errors = packages.filter((p) => p.outcome === "failed").map((p) => `${p.name}: no se pudo actualizar (${p.failureKind})`);
1355
+ return {
1356
+ success: status === "success" || status === "noop",
1357
+ upgraded,
1358
+ failed,
1359
+ errors,
1360
+ status,
1361
+ skipped: 0,
1362
+ reason,
1363
+ reboot: rebootFrom(commands),
1364
+ packages,
1365
+ commands
1366
+ };
634
1367
  }
635
1368
 
1369
+ // src/lib/logger.ts
1370
+ import fs3 from "fs";
1371
+ import path3 from "path";
1372
+
636
1373
  // src/lib/log-retention.ts
637
1374
  import fs2 from "fs";
638
1375
  import path2 from "path";
@@ -930,7 +1667,8 @@ function fromDescriptor(d, cfg, deps = defaultDeps) {
930
1667
  platform: process.platform,
931
1668
  sudoMode: sudoMode2,
932
1669
  meta: {},
933
- signal
1670
+ signal,
1671
+ logTailBytes: cfg.logTailBytes
934
1672
  });
935
1673
  const upgradeTimeout = cfg.timeoutsMs[d.id] ?? d.defaultTimeoutMs ?? UPGRADE_TIMEOUT;
936
1674
  function sudoFor(spec, c) {
@@ -1054,12 +1792,19 @@ function fromDescriptor(d, cfg, deps = defaultDeps) {
1054
1792
  const pp = d.percentParser ? (line) => d.percentParser(line, c) : void 0;
1055
1793
  const runOne = async function* (spec) {
1056
1794
  yield { type: "log", message: `${spec.cmd} ${spec.args.join(" ")}` };
1057
- const rec = yield* deps.runStream(
1795
+ const stream = deps.runStream(
1058
1796
  spec.cmd,
1059
1797
  spec.args,
1060
- { timeoutMs: spec.timeout ?? upgradeTimeout, sudo: sudoFor(spec, c), signal: c.signal },
1798
+ { timeoutMs: spec.timeout ?? upgradeTimeout, sudo: sudoFor(spec, c), signal: c.signal, tailBytes: cfg.logTailBytes },
1061
1799
  pp
1062
1800
  );
1801
+ let item = await stream.next();
1802
+ while (!item.done) {
1803
+ const currentPackage = d.packageParser?.(item.value.message, c);
1804
+ yield currentPackage ? { ...item.value, type: "progress", package: currentPackage } : item.value;
1805
+ item = await stream.next();
1806
+ }
1807
+ const rec = item.value;
1063
1808
  commands.push(rec);
1064
1809
  logCommand(rec);
1065
1810
  };
@@ -1131,6 +1876,9 @@ function makeFractionParser(re) {
1131
1876
 
1132
1877
  // src/managers/descriptors/brew.ts
1133
1878
  var brewUpgradePercent = makeFractionParser(/Upgrading (\d+)\/(\d+)/);
1879
+ function parseBrewPackage(line) {
1880
+ return line.match(/^==> (?:Upgrading|Installing) ([a-zA-Z][\w@./+-]*)(?:\s|$)/)?.[1];
1881
+ }
1134
1882
  function parseBrewOutdated(stdout) {
1135
1883
  try {
1136
1884
  const data = JSON.parse(stdout);
@@ -1159,7 +1907,8 @@ var brew = {
1159
1907
  preUpgradeCmds: () => [{ cmd: "brew", args: ["update"] }],
1160
1908
  upgradeCmd: (pkgs) => ({ cmd: "brew", args: pkgs && pkgs.length ? ["upgrade", ...pkgs] : ["upgrade"] }),
1161
1909
  postUpgradeCmds: () => [{ cmd: "brew", args: ["cleanup"] }],
1162
- percentParser: (line) => brewUpgradePercent(line)
1910
+ percentParser: (line) => brewUpgradePercent(line),
1911
+ packageParser: parseBrewPackage
1163
1912
  };
1164
1913
 
1165
1914
  // src/lib/exec/capabilities.ts
@@ -1183,8 +1932,8 @@ async function pythonModuleCmd() {
1183
1932
  return once("pip:python", async () => {
1184
1933
  const candidates = process.platform === "win32" ? ["python", "py", "python3"] : ["python3", "python"];
1185
1934
  for (const c of candidates) {
1186
- const probe = await execCommand(c, ["-m", "pip", "--version"], 5e3);
1187
- if (probe.exitCode === 0) return c;
1935
+ const probe2 = await execCommand(c, ["-m", "pip", "--version"], 5e3);
1936
+ if (probe2.exitCode === 0) return c;
1188
1937
  }
1189
1938
  return null;
1190
1939
  });
@@ -1203,8 +1952,8 @@ function parsePipOutdated(stdout) {
1203
1952
  async function pep668Flags() {
1204
1953
  return once("pip:pep668", async () => {
1205
1954
  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");
1955
+ const probe2 = await execCommand(cmd, [...baseArgs, "install", "--user", "--dry-run", "pip"], 5e3);
1956
+ const managed = (probe2.stdout + probe2.stderr).includes("externally-managed");
1208
1957
  return managed ? ["--break-system-packages"] : [];
1209
1958
  });
1210
1959
  }
@@ -1239,7 +1988,7 @@ var pip = {
1239
1988
  if (target.length) {
1240
1989
  const args2 = [...baseArgs, "install", "--user", "--upgrade", ...flags, ...target];
1241
1990
  yield { type: "log", message: `${cmd} ${args2.join(" ")}` };
1242
- const rec = yield* runStream(cmd, args2, { timeoutMs: 3e5, sudo: false, signal: ctx.signal });
1991
+ const rec = yield* runStream(cmd, args2, { timeoutMs: 3e5, sudo: false, signal: ctx.signal, tailBytes: ctx.logTailBytes });
1243
1992
  commands.push(rec);
1244
1993
  logCommand(rec);
1245
1994
  }
@@ -1379,7 +2128,7 @@ var gem = {
1379
2128
  if (target.length) {
1380
2129
  const args2 = updateArgs(target, useSudo);
1381
2130
  yield { type: "log", message: `${useSudo ? "sudo " : ""}gem ${args2.join(" ")}` };
1382
- const rec = yield* runStream("gem", args2, { timeoutMs: 3e5, sudo: useSudo, signal: ctx.signal });
2131
+ const rec = yield* runStream("gem", args2, { timeoutMs: 3e5, sudo: useSudo, signal: ctx.signal, tailBytes: ctx.logTailBytes });
1383
2132
  commands.push(rec);
1384
2133
  logCommand(rec);
1385
2134
  }
@@ -1480,7 +2229,7 @@ var winget = {
1480
2229
  const commands = [];
1481
2230
  const run = async function* (args2) {
1482
2231
  yield { type: "log", message: `winget ${args2.join(" ")}` };
1483
- const rec = yield* runStream("winget", args2, { timeoutMs: 6e5, sudo: false, signal: ctx.signal });
2232
+ const rec = yield* runStream("winget", args2, { timeoutMs: 6e5, sudo: false, signal: ctx.signal, tailBytes: ctx.logTailBytes });
1484
2233
  commands.push(rec);
1485
2234
  logCommand(rec);
1486
2235
  };
@@ -1726,7 +2475,7 @@ var flutter = {
1726
2475
  if (before.length) {
1727
2476
  const args2 = ["upgrade", "--force"];
1728
2477
  yield { type: "log", message: `flutter ${args2.join(" ")}` };
1729
- const rec = yield* runStream("flutter", args2, { timeoutMs: 6e5, sudo: false, signal: ctx.signal });
2478
+ const rec = yield* runStream("flutter", args2, { timeoutMs: 6e5, sudo: false, signal: ctx.signal, tailBytes: ctx.logTailBytes });
1730
2479
  commands.push(rec);
1731
2480
  logCommand(rec);
1732
2481
  }
@@ -1790,7 +2539,7 @@ var angular = {
1790
2539
  if (target.length) {
1791
2540
  const args2 = ["install", "-g", `${PACKAGE}@latest`];
1792
2541
  yield { type: "log", message: `npm ${args2.join(" ")}` };
1793
- const rec = yield* runStream("npm", args2, { timeoutMs: 3e5, sudo: false, signal: ctx.signal });
2542
+ const rec = yield* runStream("npm", args2, { timeoutMs: 3e5, sudo: false, signal: ctx.signal, tailBytes: ctx.logTailBytes });
1794
2543
  commands.push(rec);
1795
2544
  logCommand(rec);
1796
2545
  }
@@ -1919,7 +2668,7 @@ var goLang = {
1919
2668
  const commands = [];
1920
2669
  const args2 = ["upgrade", "go"];
1921
2670
  yield { type: "log", message: `brew ${args2.join(" ")}` };
1922
- const rec = yield* runStream("brew", args2, { timeoutMs: 3e5, sudo: false, signal: ctx.signal });
2671
+ const rec = yield* runStream("brew", args2, { timeoutMs: 3e5, sudo: false, signal: ctx.signal, tailBytes: ctx.logTailBytes });
1923
2672
  commands.push(rec);
1924
2673
  logCommand(rec);
1925
2674
  yield { type: "phase", phase: "verifying", message: "Verificando resultado..." };
@@ -2075,7 +2824,7 @@ var pnpm = {
2075
2824
  if (target.length) {
2076
2825
  const args2 = packages && packages.length ? ["update", "-g", ...packages] : ["update", "-g"];
2077
2826
  yield { type: "log", message: `pnpm ${args2.join(" ")}` };
2078
- const rec = yield* runStream("pnpm", args2, { timeoutMs: 3e5, sudo: false, signal: ctx.signal });
2827
+ const rec = yield* runStream("pnpm", args2, { timeoutMs: 3e5, sudo: false, signal: ctx.signal, tailBytes: ctx.logTailBytes });
2079
2828
  commands.push(rec);
2080
2829
  logCommand(rec);
2081
2830
  }
@@ -2178,7 +2927,7 @@ var yarn = {
2178
2927
  if (target.length) {
2179
2928
  const args2 = packages && packages.length ? ["global", "upgrade", ...packages] : ["global", "upgrade"];
2180
2929
  yield { type: "log", message: `yarn ${args2.join(" ")}` };
2181
- const rec = yield* runStream("yarn", args2, { timeoutMs: 3e5, sudo: false, signal: ctx.signal });
2930
+ const rec = yield* runStream("yarn", args2, { timeoutMs: 3e5, sudo: false, signal: ctx.signal, tailBytes: ctx.logTailBytes });
2182
2931
  commands.push(rec);
2183
2932
  logCommand(rec);
2184
2933
  }
@@ -2235,7 +2984,7 @@ var bun = {
2235
2984
  const commands = [];
2236
2985
  const args2 = packages && packages.length ? ["update", "-g", ...packages] : ["update", "-g"];
2237
2986
  yield { type: "log", message: `bun ${args2.join(" ")}` };
2238
- const rec = yield* runStream("bun", args2, { timeoutMs: 3e5, sudo: false, signal: ctx.signal });
2987
+ const rec = yield* runStream("bun", args2, { timeoutMs: 3e5, sudo: false, signal: ctx.signal, tailBytes: ctx.logTailBytes });
2239
2988
  commands.push(rec);
2240
2989
  logCommand(rec);
2241
2990
  yield { type: "phase", phase: "verifying", message: "Verificando resultado..." };
@@ -2271,8 +3020,8 @@ function parseMiseOutdated(stdout) {
2271
3020
  bodyStart = headerIdx + 1;
2272
3021
  }
2273
3022
  const norm = (v) => {
2274
- const t3 = v?.trim();
2275
- return t3 && t3 !== "-" ? t3 : "?";
3023
+ const t2 = v?.trim();
3024
+ return t2 && t2 !== "-" ? t2 : "?";
2276
3025
  };
2277
3026
  return lines.slice(bodyStart).map((line) => {
2278
3027
  const cols = line.trim().split(/\s+/);
@@ -2551,7 +3300,7 @@ var pipx = {
2551
3300
  if (before.length) {
2552
3301
  const args2 = ["upgrade-all"];
2553
3302
  yield { type: "log", message: `pipx ${args2.join(" ")}` };
2554
- const rec = yield* runStream("pipx", args2, { timeoutMs: 3e5, sudo: false, signal: ctx.signal });
3303
+ const rec = yield* runStream("pipx", args2, { timeoutMs: 3e5, sudo: false, signal: ctx.signal, tailBytes: ctx.logTailBytes });
2555
3304
  commands.push(rec);
2556
3305
  logCommand(rec);
2557
3306
  }
@@ -2669,474 +3418,25 @@ async function pool(items, limit, worker) {
2669
3418
  while (cursor < items.length) {
2670
3419
  const item = items[cursor++];
2671
3420
  await worker(item);
2672
- }
2673
- };
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];
3421
+ }
3422
+ };
3423
+ const lanes = Math.max(1, Math.min(limit, items.length));
3424
+ await Promise.all(Array.from({ length: lanes }, () => run()));
3135
3425
  }
3136
- function managerName(id) {
3137
- const dict = translations[currentLang] ?? es;
3138
- const names = dict.managers;
3139
- return names[id] ?? id;
3426
+ async function runEngine(tasks, opts) {
3427
+ const results = new Array(tasks.length);
3428
+ const indexed = tasks.map((task, index) => ({ task, index }));
3429
+ const adminLane = indexed.filter((t2) => t2.task.manager.requiresAdmin);
3430
+ const fastLane = indexed.filter((t2) => !t2.task.manager.requiresAdmin);
3431
+ await Promise.all([
3432
+ pool(fastLane, opts.concurrency, async ({ task, index }) => {
3433
+ results[index] = await runTask(task, opts);
3434
+ }),
3435
+ pool(adminLane, 1, async ({ task, index }) => {
3436
+ results[index] = await runTask(task, opts);
3437
+ })
3438
+ ]);
3439
+ return results;
3140
3440
  }
3141
3441
 
3142
3442
  // src/hooks/use-app-machine.tsx
@@ -3382,11 +3682,10 @@ function useMachine() {
3382
3682
  }
3383
3683
  function useAppMachine(sudoMode2, nonInteractive2 = false) {
3384
3684
  const configRef = useRef(loadConfig());
3385
- const [state, dispatch] = useReducer(
3386
- appReducer,
3387
- void 0,
3388
- () => initialState(configRef.current, sudoMode2)
3389
- );
3685
+ const [state, dispatch] = useReducer(appReducer, void 0, () => {
3686
+ setLanguage(configRef.current.language);
3687
+ return initialState(configRef.current, sudoMode2);
3688
+ });
3390
3689
  const detectedRef = useRef([]);
3391
3690
  const abortRef = useRef(null);
3392
3691
  const runLogRef = useRef(null);
@@ -3461,7 +3760,7 @@ function useAppMachine(sudoMode2, nonInteractive2 = false) {
3461
3760
  }
3462
3761
  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
3762
  if (tasks.length === 0) return;
3464
- const queue = tasks.map((t3) => t3.manager.id);
3763
+ const queue = tasks.map((t2) => t2.manager.id);
3465
3764
  logSelection({
3466
3765
  offered: state.order.reduce((n, id) => n + (state.managers[id]?.outdated.length ?? 0), 0),
3467
3766
  chosen: state.selection.size,
@@ -3471,7 +3770,7 @@ function useAppMachine(sudoMode2, nonInteractive2 = false) {
3471
3770
  chosen: packagesByManager.get(id)?.length ?? 0
3472
3771
  }))
3473
3772
  });
3474
- dispatch({ type: "RUN_START", queue });
3773
+ dispatch({ type: "RUN_START", queue, at: Date.now() });
3475
3774
  const ac = new AbortController();
3476
3775
  abortRef.current = ac;
3477
3776
  const logRef = getLogFilePath() ?? void 0;
@@ -3528,8 +3827,8 @@ function useAppMachine(sudoMode2, nonInteractive2 = false) {
3528
3827
  if (e.phase === "queued") {
3529
3828
  enqueue({ type: "MGR_QUEUED", id });
3530
3829
  } else if (e.phase === "upgrading") {
3531
- if (e.event?.percent !== void 0) {
3532
- enqueue({ type: "MGR_PROGRESS", id, percent: e.event.percent });
3830
+ if (e.event?.percent !== void 0 || e.event?.package !== void 0) {
3831
+ enqueue({ type: "MGR_PROGRESS", id, percent: e.event.percent, currentPackage: e.event.package });
3533
3832
  } else if (!e.event) {
3534
3833
  enqueue({ type: "MGR_RUNNING", id, at: Date.now() });
3535
3834
  }
@@ -3561,7 +3860,7 @@ function useAppMachine(sudoMode2, nonInteractive2 = false) {
3561
3860
  error(`El motor termin\xF3 con error: ${String(err)}`);
3562
3861
  }).finally(() => {
3563
3862
  flush();
3564
- dispatch({ type: "RUN_DONE" });
3863
+ dispatch({ type: "RUN_DONE", at: Date.now() });
3565
3864
  abortRef.current = null;
3566
3865
  if (ac.signal.aborted) settleRun("cancelada", "corrida abortada en vuelo");
3567
3866
  else if (engineError !== null) settleRun("fallida", `motor: ${String(engineError)}`);
@@ -3569,6 +3868,7 @@ function useAppMachine(sudoMode2, nonInteractive2 = false) {
3569
3868
  });
3570
3869
  }, [state.selection, sudoMode2]);
3571
3870
  const cancelRun = useCallback(() => {
3871
+ dispatch({ type: "RUN_CANCEL" });
3572
3872
  abortRef.current?.abort();
3573
3873
  }, []);
3574
3874
  const rescan = useCallback(() => {
@@ -3576,7 +3876,11 @@ function useAppMachine(sudoMode2, nonInteractive2 = false) {
3576
3876
  dispatch({ type: "RESCAN" });
3577
3877
  void boot();
3578
3878
  }, [boot]);
3579
- const { exit } = useApp();
3879
+ const { exit: inkExit } = useApp();
3880
+ const exit = useCallback(() => {
3881
+ if (retireBanner()) setImmediate(inkExit);
3882
+ else inkExit();
3883
+ }, [inkExit]);
3580
3884
  const exitedRef = useRef(false);
3581
3885
  const finishNonInteractive = useCallback(
3582
3886
  (code) => {
@@ -3586,14 +3890,18 @@ function useAppMachine(sudoMode2, nonInteractive2 = false) {
3586
3890
  settleRun("completa");
3587
3891
  exit();
3588
3892
  if (!process.env["VITEST"]) {
3589
- const t3 = setTimeout(() => process.exit(code), 100);
3590
- t3.unref?.();
3893
+ const t2 = setTimeout(() => process.exit(code), 100);
3894
+ t2.unref?.();
3591
3895
  }
3592
3896
  },
3593
3897
  [exit]
3594
3898
  );
3595
3899
  useEffect(() => {
3596
3900
  if (!nonInteractive2) return;
3901
+ if (state.error) {
3902
+ finishNonInteractive(1);
3903
+ return;
3904
+ }
3597
3905
  if (state.phase === "select") {
3598
3906
  const hasOutdated = state.order.some((id) => (state.managers[id]?.outdated.length ?? 0) > 0);
3599
3907
  if (!hasOutdated) finishNonInteractive(0);
@@ -3607,6 +3915,7 @@ function useAppMachine(sudoMode2, nonInteractive2 = false) {
3607
3915
  }, [
3608
3916
  nonInteractive2,
3609
3917
  state.phase,
3918
+ state.error,
3610
3919
  state.selection.size,
3611
3920
  state.run.failedCount,
3612
3921
  state.order,
@@ -3631,8 +3940,8 @@ function useAppMachine(sudoMode2, nonInteractive2 = false) {
3631
3940
  settleRun("cedida", "consola elevada");
3632
3941
  exit();
3633
3942
  if (!process.env["VITEST"]) {
3634
- const t3 = setTimeout(() => process.exit(0), 100);
3635
- t3.unref?.();
3943
+ const t2 = setTimeout(() => process.exit(0), 100);
3944
+ t2.unref?.();
3636
3945
  }
3637
3946
  }
3638
3947
  })();
@@ -3690,238 +3999,163 @@ function MachineProvider({ value, children }) {
3690
3999
  return /* @__PURE__ */ jsx(MachineContext.Provider, { value, children });
3691
4000
  }
3692
4001
 
4002
+ // src/screens/keys.tsx
4003
+ import { Text } from "ink";
4004
+
3693
4005
  // src/hooks/use-safe-input.ts
3694
4006
  import { useInput, useStdin } from "ink";
4007
+ import { useCallback as useCallback2, useLayoutEffect, useRef as useRef2 } from "react";
3695
4008
  function useSafeInput(handler, options) {
4009
+ const latestHandler = useRef2(handler);
4010
+ useLayoutEffect(() => {
4011
+ latestHandler.current = handler;
4012
+ }, [handler]);
4013
+ const stableHandler = useCallback2((input, key) => latestHandler.current(input, key), []);
3696
4014
  const { isRawModeSupported } = useStdin();
3697
4015
  const active = (options?.isActive ?? true) && isRawModeSupported === true;
3698
- useInput(handler, { ...options, isActive: active });
4016
+ useInput(stableHandler, { ...options, isActive: active });
3699
4017
  }
3700
4018
 
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
4019
+ // src/screens/keys.tsx
4020
+ import { jsx as jsx2 } from "react/jsx-runtime";
4021
+ var bindings = {
4022
+ quit: ["q"],
4023
+ retry: ["r"],
4024
+ down: ["downArrow", "j"],
4025
+ up: ["upArrow", "k"],
4026
+ mark: [" "],
4027
+ all: ["a"],
4028
+ none: ["n"],
4029
+ next: ["return"],
4030
+ settings: ["s"],
4031
+ back: ["escape"],
4032
+ detail: ["d"],
4033
+ language: ["l"],
4034
+ elevate: ["e"],
4035
+ start: ["return", "y"],
4036
+ cancel: ["escape"],
4037
+ ctrlC: ["ctrl+c"],
4038
+ confirmCancel: ["s"],
4039
+ continueRun: ["n", "escape"]
3760
4040
  };
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;
4041
+ function commandsFor(handlers2) {
4042
+ return Object.entries(handlers2).map(([action, run]) => ({ keys: action === "confirmCancel" && getLanguage() === "en" ? ["y"] : bindings[action], label: t("hints", action), run }));
4043
+ }
4044
+ function dispatchKey(commands, key) {
4045
+ commands.find((command) => command.keys.includes(key))?.run();
4046
+ }
4047
+ function hintLines(commands, width) {
4048
+ const lines = [];
4049
+ for (const command of commands) {
4050
+ const last = lines.at(-1);
4051
+ if (last && last.length + command.label.length + 3 <= width) lines[lines.length - 1] = `${last} ${g.separator} ${command.label}`;
4052
+ else lines.push(command.label);
4053
+ }
4054
+ return lines;
4055
+ }
4056
+ function useScreenKeys(handlers2) {
4057
+ const { quitApp } = useMachine();
4058
+ const commands = commandsFor({ ...handlers2, ctrlC: handlers2.ctrlC ?? quitApp });
4059
+ useSafeInput((input, key) => {
4060
+ const special = ["return", "escape", "downArrow", "upArrow"].find((name) => key[name]);
4061
+ if (key.ctrl) {
4062
+ if (input === "c") dispatchKey(commands, "ctrl+c");
4063
+ return;
4064
+ }
4065
+ if (key.meta && !key.escape) return;
4066
+ dispatchKey(commands, special ?? input.toLowerCase());
4067
+ });
4068
+ return commands;
4069
+ }
4070
+ function KeyHints({ commands }) {
4071
+ const width = Math.min(process.stdout.columns ?? 100, 100) - 4;
4072
+ return /* @__PURE__ */ jsx2(Text, { color: semantic.muted, children: hintLines(commands, width).join("\n") });
3769
4073
  }
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
4074
 
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
- ] });
4075
+ // src/lib/display-path.ts
4076
+ import { homedir } from "os";
4077
+ function compactPath(path7, width) {
4078
+ const home = homedir();
4079
+ const display = path7 === home || path7.startsWith(home + "/") || path7.startsWith(home + "\\") ? "~" + path7.slice(home.length) : path7;
4080
+ if (display.length <= width) return display;
4081
+ const available = Math.max(0, width - g.ellipsis.length);
4082
+ const left = Math.ceil(available / 2);
4083
+ return display.slice(0, left) + g.ellipsis + display.slice(display.length - (available - left));
3871
4084
  }
3872
4085
 
4086
+ // src/screens/detect.tsx
4087
+ import { Box, Text as Text3 } from "ink";
4088
+
3873
4089
  // src/components/status-glyph.tsx
3874
4090
  import { useEffect as useEffect2, useState as useState2 } from "react";
3875
4091
  import { Text as Text2 } from "ink";
3876
4092
  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
- };
4093
+ function specs() {
4094
+ return {
4095
+ cancelling: { glyph: g.running, color: semantic.warning },
4096
+ partial: { glyph: g.partial, color: semantic.error },
4097
+ pending: { glyph: g.pending, color: semantic.muted },
4098
+ scanning: { glyph: g.scanning, color: semantic.action },
4099
+ outdated: { glyph: g.outdated, color: semantic.warning },
4100
+ uptodate: { glyph: g.uptodate, color: semantic.muted },
4101
+ queued: { glyph: g.pending, color: semantic.muted },
4102
+ running: { glyph: g.running, color: semantic.action },
4103
+ done: { glyph: g.done, color: semantic.success },
4104
+ failed: { glyph: g.failed, color: semantic.error },
4105
+ skipped: { glyph: g.skipped, color: semantic.warning },
4106
+ // Amber and a one-cell `?`: it cannot reuse `muted`, which is the colour of
4107
+ // "up to date" — the confusion this state exists to remove (DES-001@r1). The
4108
+ // spec lands here with the domain state because this table is exhaustive over
4109
+ // ManagerStatus, so the state cannot exist without it.
4110
+ unknown: { glyph: g.unknown, color: semantic.unknown }
4111
+ };
4112
+ }
3893
4113
  function statusColor(status) {
3894
- return SPECS[status].color;
4114
+ return specs()[status].color;
3895
4115
  }
3896
4116
  function StatusGlyph({ status }) {
3897
- const spec = SPECS[status];
4117
+ const spec = specs()[status];
3898
4118
  return /* @__PURE__ */ jsx3(Text2, { color: spec.color, children: spec.glyph });
3899
4119
  }
3900
4120
  function RunningGlyph() {
3901
4121
  const [i, setI] = useState2(0);
3902
4122
  useEffect2(() => {
3903
4123
  if (NO_ANIM) return;
3904
- const t3 = setInterval(() => setI((n) => (n + 1) % spinnerFrames.length), 90);
3905
- return () => clearInterval(t3);
4124
+ const t2 = setInterval(() => setI((n) => (n + 1) % spinnerFrames.length), 90);
4125
+ return () => clearInterval(t2);
3906
4126
  }, []);
3907
4127
  const frame = NO_ANIM ? g.running : spinnerFrames[i] ?? g.running;
3908
- return /* @__PURE__ */ jsx3(Text2, { color: SPECS.running.color, children: frame });
4128
+ return /* @__PURE__ */ jsx3(Text2, { color: specs().running.color, children: frame });
3909
4129
  }
3910
4130
 
3911
4131
  // src/screens/detect.tsx
3912
- import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
4132
+ import { jsx as jsx4, jsxs } from "react/jsx-runtime";
3913
4133
  function DetectScreen() {
3914
- const { state } = useMachine();
4134
+ const { state, rescan, quitApp } = useMachine();
4135
+ const commands = useScreenKeys({ ...state.error ? { retry: rescan } : {}, quit: quitApp });
3915
4136
  const scanning = state.phase === "scanning";
3916
4137
  const done = state.order.filter((id) => {
3917
4138
  const s = state.managers[id]?.status;
3918
4139
  return s === "outdated" || s === "uptodate" || s === "unknown";
3919
4140
  }).length;
3920
- return /* @__PURE__ */ jsxs2(Box2, { flexDirection: "column", children: [
3921
- /* @__PURE__ */ jsx4(StepHeader, { phase: state.phase }),
3922
- /* @__PURE__ */ jsxs2(Box2, { marginBottom: 1, children: [
4141
+ if (state.error) return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", children: [
4142
+ /* @__PURE__ */ jsxs(Text3, { color: semantic.error, children: [
4143
+ g.failed,
4144
+ " ",
4145
+ t("ui", "detectionFailed")
4146
+ ] }),
4147
+ /* @__PURE__ */ jsx4(Text3, { color: semantic.text, children: state.error }),
4148
+ /* @__PURE__ */ jsxs(Text3, { color: semantic.muted, children: [
4149
+ t("ui", "logAt"),
4150
+ " ",
4151
+ compactPath(getLogFilePath() ?? "", Math.min(process.stdout.columns ?? 100, 100) - 4 - t("ui", "logAt").length)
4152
+ ] }),
4153
+ /* @__PURE__ */ jsx4(KeyHints, { commands })
4154
+ ] });
4155
+ return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", children: [
4156
+ /* @__PURE__ */ jsxs(Box, { marginBottom: 1, children: [
3923
4157
  /* @__PURE__ */ jsx4(Text3, { color: semantic.text, children: scanning ? t("ui", "scanning") : t("ui", "detecting") }),
3924
- scanning && /* @__PURE__ */ jsxs2(Text3, { color: semantic.muted, children: [
4158
+ scanning && /* @__PURE__ */ jsxs(Text3, { color: semantic.muted, children: [
3925
4159
  " ",
3926
4160
  "(",
3927
4161
  done,
@@ -3933,28 +4167,53 @@ function DetectScreen() {
3933
4167
  scanning && state.order.map((id) => {
3934
4168
  const e = state.managers[id];
3935
4169
  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: [
4170
+ return /* @__PURE__ */ jsxs(Box, { children: [
4171
+ /* @__PURE__ */ jsx4(Box, { width: 2, children: /* @__PURE__ */ jsx4(StatusGlyph, { status: e.status }) }),
4172
+ /* @__PURE__ */ jsx4(Box, { width: 18, children: /* @__PURE__ */ jsx4(Text3, { color: e.status === "outdated" ? semantic.text : semantic.muted, children: managerName(id) }) }),
4173
+ e.status === "outdated" ? /* @__PURE__ */ jsxs(Text3, { color: semantic.warning, children: [
3940
4174
  e.outdated.length,
3941
4175
  " ",
3942
4176
  g.outdated
3943
4177
  ] }) : 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
4178
  ] }, id);
3945
- })
4179
+ }),
4180
+ /* @__PURE__ */ jsx4(KeyHints, { commands })
3946
4181
  ] });
3947
4182
  }
3948
4183
 
3949
4184
  // src/screens/select.tsx
3950
4185
  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";
4186
+ import { Box as Box2, Text as Text4 } from "ink";
4187
+
4188
+ // src/lib/display-counts.ts
4189
+ var labels = {
4190
+ upgraded: ["upgradedOne", "upgraded"],
4191
+ failed: ["failedOne", "failed"],
4192
+ manual: ["manualShort", "manualMany"],
4193
+ unknown: ["undeterminedShort", "undeterminedShort"]
4194
+ };
4195
+ function countText(count, kind) {
4196
+ return `${count} ${t("ui", labels[kind][count === 1 ? 0 : 1])}`;
4197
+ }
4198
+ function selectionText(marked, total) {
4199
+ return `${marked} ${t("ui", "of")} ${total} ${t("ui", marked === 1 ? "selectedOne" : "selected")}`;
4200
+ }
4201
+ function summaryText(counts) {
4202
+ const parts = [countText(counts.upgraded, "upgraded")];
4203
+ if (counts.failed > 0) parts.push(countText(counts.failed, "failed"));
4204
+ if (counts.skipped > 0) parts.push(countText(counts.skipped, "manual"));
4205
+ if (counts.unknown > 0) parts.push(countText(counts.unknown, "unknown"));
4206
+ return parts.join(` ${g.separator} `);
4207
+ }
4208
+
4209
+ // src/screens/select.tsx
4210
+ import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
3953
4211
  function clip(s, n) {
3954
4212
  return s.length > n ? s.slice(0, Math.max(0, n - g.ellipsis.length)) + g.ellipsis : s;
3955
4213
  }
3956
4214
  function SelectScreen() {
3957
- const { state, toggleItem, selectAll, selectNone, goConfirm, openSettings } = useMachine();
4215
+ const { state, toggleItem, selectAll, selectNone, goConfirm, openSettings, rescan, quitApp } = useMachine();
4216
+ const [notice, setNotice] = useState3(false);
3958
4217
  const [cursor, setCursor] = useState3(0);
3959
4218
  const rows = [];
3960
4219
  for (const id of state.order) {
@@ -3963,71 +4222,61 @@ function SelectScreen() {
3963
4222
  }
3964
4223
  const clamped = Math.min(cursor, Math.max(0, rows.length - 1));
3965
4224
  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();
4225
+ const commands = useScreenKeys({
4226
+ ...rows.length > 0 ? {
4227
+ down: () => setCursor((c) => Math.min(rows.length - 1, c + 1)),
4228
+ up: () => setCursor((c) => Math.max(0, c - 1)),
4229
+ mark: () => {
4230
+ const row = rows[clamped];
4231
+ if (row) toggleItem(selectionKey(row.managerId, row.pkg.name));
4232
+ },
4233
+ all: selectAll,
4234
+ none: selectNone,
4235
+ next: () => {
4236
+ if (state.selection.size === 0) setNotice(true);
4237
+ else goConfirm();
4238
+ }
4239
+ } : { retry: rescan },
4240
+ settings: openSettings,
4241
+ quit: quitApp
3976
4242
  });
3977
4243
  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 ",
4244
+ return /* @__PURE__ */ jsxs2(Box2, { flexDirection: "column", children: [
4245
+ /* @__PURE__ */ jsxs2(Text4, { color: semantic.success, children: [
4246
+ g.done,
4247
+ " ",
3982
4248
  t("ui", "noUpdates")
3983
4249
  ] }),
3984
- undetermined.length > 0 && /* @__PURE__ */ jsxs3(Text4, { color: semantic.unknown, children: [
4250
+ undetermined.length > 0 && /* @__PURE__ */ jsxs2(Text4, { color: semantic.unknown, children: [
3985
4251
  g.unknown,
3986
4252
  " ",
3987
- undetermined.length,
3988
- " ",
3989
- t("ui", "undeterminedCount"),
4253
+ countText(undetermined.length, "unknown"),
3990
4254
  ":",
3991
4255
  " ",
3992
4256
  undetermined.map((id) => managerName(id)).join(", ")
3993
4257
  ] }),
3994
- /* @__PURE__ */ jsx5(Box3, { marginTop: 1, children: /* @__PURE__ */ jsxs3(Text4, { color: semantic.muted, children: [
3995
- "R ",
3996
- t("flow", "detecting"),
3997
- " \xB7 Q"
3998
- ] }) })
4258
+ /* @__PURE__ */ jsx5(Box2, { marginTop: 1, children: /* @__PURE__ */ jsx5(KeyHints, { commands }) })
3999
4259
  ] });
4000
4260
  }
4001
4261
  const width = Math.min((process.stdout.columns ?? 90) - 4, 92);
4002
- const view = Math.max(6, (process.stdout.rows ?? 24) - 11);
4262
+ const view = Math.max(6, (process.stdout.rows ?? 24) - 11 - headerExtraRows());
4003
4263
  let start = clamped - Math.floor(view / 2);
4004
4264
  start = Math.max(0, Math.min(start, Math.max(0, rows.length - view)));
4005
4265
  const end = Math.min(rows.length, start + view);
4006
4266
  const visible = rows.slice(start, end);
4007
4267
  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: [
4268
+ return /* @__PURE__ */ jsxs2(Box2, { flexDirection: "column", children: [
4269
+ notice && /* @__PURE__ */ jsx5(Text4, { color: semantic.warning, children: t("ui", "chooseFirst") }),
4270
+ /* @__PURE__ */ jsx5(Box2, { marginBottom: 1, children: /* @__PURE__ */ jsx5(Text4, { color: semantic.action, bold: true, children: selectionText(state.selection.size, rows.length) }) }),
4271
+ undetermined.length > 0 && /* @__PURE__ */ jsx5(Box2, { marginBottom: 1, children: /* @__PURE__ */ jsxs2(Text4, { color: semantic.unknown, children: [
4021
4272
  g.unknown,
4022
4273
  " ",
4023
- undetermined.length,
4024
- " ",
4025
- t("ui", "undeterminedCount"),
4274
+ countText(undetermined.length, "unknown"),
4026
4275
  ":",
4027
4276
  " ",
4028
4277
  undetermined.map((id) => managerName(id)).join(", ")
4029
4278
  ] }) }),
4030
- start > 0 && /* @__PURE__ */ jsxs3(Text4, { color: colors.outline, children: [
4279
+ start > 0 && /* @__PURE__ */ jsxs2(Text4, { color: colors.outline, children: [
4031
4280
  g.scrollUp,
4032
4281
  " ",
4033
4282
  start
@@ -4037,13 +4286,13 @@ function SelectScreen() {
4037
4286
  prevManager = r.managerId;
4038
4287
  const selected = state.selection.has(selectionKey(r.managerId, r.pkg.name));
4039
4288
  const isCursor = rows[clamped] === r;
4040
- return /* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", children: [
4289
+ return /* @__PURE__ */ jsxs2(Box2, { flexDirection: "column", children: [
4041
4290
  header && /* @__PURE__ */ jsx5(Text4, { color: semantic.muted, bold: true, children: header }),
4042
- /* @__PURE__ */ jsxs3(Box3, { children: [
4291
+ /* @__PURE__ */ jsxs2(Box2, { children: [
4043
4292
  /* @__PURE__ */ jsx5(Text4, { color: isCursor ? semantic.action : colors.outline, children: isCursor ? `${g.cursor} ` : " " }),
4044
4293
  /* @__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: [
4294
+ /* @__PURE__ */ jsx5(Box2, { width: 22, children: /* @__PURE__ */ jsx5(Text4, { color: semantic.text, bold: isCursor, children: clip(r.pkg.name, 21) }) }),
4295
+ /* @__PURE__ */ jsxs2(Text4, { color: semantic.muted, wrap: "truncate-end", children: [
4047
4296
  clip(r.pkg.currentVersion, 14),
4048
4297
  " ",
4049
4298
  /* @__PURE__ */ jsx5(Text4, { color: semantic.action, children: g.arrow }),
@@ -4053,59 +4302,74 @@ function SelectScreen() {
4053
4302
  ] })
4054
4303
  ] }, `${r.managerId}:${r.pkg.name}`);
4055
4304
  }),
4056
- end < rows.length && /* @__PURE__ */ jsxs3(Text4, { color: colors.outline, children: [
4305
+ end < rows.length && /* @__PURE__ */ jsxs2(Text4, { color: colors.outline, children: [
4057
4306
  g.scrollDown,
4058
4307
  " ",
4059
4308
  rows.length - end
4060
4309
  ] }),
4061
- /* @__PURE__ */ jsx5(Box3, { marginTop: 1, children: /* @__PURE__ */ jsx5(Text4, { color: semantic.muted, children: clip(t("ui", "selectHint"), width) }) })
4310
+ /* @__PURE__ */ jsx5(Box2, { marginTop: 1, children: /* @__PURE__ */ jsx5(KeyHints, { commands }) })
4062
4311
  ] });
4063
4312
  }
4064
4313
 
4065
4314
  // 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";
4315
+ import { Box as Box3, Text as Text5 } from "ink";
4316
+ import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
4068
4317
  function ConfirmScreen() {
4069
- const { state, startRun, goSelect, sudoMode: sudoMode2, relaunch } = useMachine();
4318
+ const { state, startRun, goSelect, sudoMode: sudoMode2, relaunch, quitApp } = useMachine();
4070
4319
  const byManager = /* @__PURE__ */ new Map();
4071
4320
  for (const key of state.selection) {
4072
4321
  const [id] = parseSelectionKey(key);
4073
4322
  byManager.set(id, (byManager.get(id) ?? 0) + 1);
4074
4323
  }
4075
4324
  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: [
4325
+ const commands = useScreenKeys({ start: startRun, back: goSelect, ...needsElevation ? { elevate: relaunch } : {}, quit: quitApp });
4326
+ const active = [...byManager.entries()].filter(([id]) => !state.managers[id]?.requiresAdmin || sudoMode2);
4327
+ const skipped = [...byManager.entries()].filter(([id]) => state.managers[id]?.requiresAdmin && !sudoMode2);
4328
+ return /* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", children: [
4329
+ /* @__PURE__ */ jsxs3(Text5, { color: semantic.text, children: [
4330
+ t("ui", "willRun"),
4331
+ " ",
4332
+ active.reduce((sum, [, count]) => sum + count, 0),
4333
+ " ",
4334
+ t("ui", active.reduce((sum, [, count]) => sum + count, 0) === 1 ? "packageOne" : "packageMany")
4335
+ ] }),
4336
+ /* @__PURE__ */ jsx6(Box3, { flexDirection: "column", marginTop: 1, marginBottom: 1, children: active.map(([id, count]) => {
4337
+ return /* @__PURE__ */ jsxs3(Box3, { children: [
4338
+ /* @__PURE__ */ jsxs3(Text5, { color: semantic.action, children: [
4089
4339
  g.bullet,
4090
4340
  " "
4091
4341
  ] }),
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: [
4342
+ /* @__PURE__ */ jsx6(Box3, { width: 20, children: /* @__PURE__ */ jsx6(Text5, { color: semantic.text, bold: true, children: managerName(id) }) }),
4343
+ /* @__PURE__ */ jsxs3(Text5, { color: semantic.muted, children: [
4094
4344
  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" })
4345
+ " ",
4346
+ t("ui", count === 1 ? "packageOne" : "packageMany")
4347
+ ] })
4098
4348
  ] }, id);
4099
4349
  }) }),
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" })
4350
+ skipped.length > 0 && /* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", marginBottom: 1, children: [
4351
+ /* @__PURE__ */ jsxs3(Text5, { color: semantic.warning, children: [
4352
+ t("ui", process.platform === "win32" ? "adminManual" : "sudoManual"),
4353
+ ":"
4354
+ ] }),
4355
+ skipped.map(([id, count]) => /* @__PURE__ */ jsxs3(Text5, { color: semantic.warning, children: [
4356
+ g.skipped,
4357
+ " ",
4358
+ managerName(id),
4359
+ " ",
4360
+ count,
4361
+ " ",
4362
+ t("ui", count === 1 ? "packageOne" : "packageMany")
4363
+ ] }, id))
4364
+ ] }),
4365
+ /* @__PURE__ */ jsx6(KeyHints, { commands })
4102
4366
  ] });
4103
4367
  }
4104
4368
 
4105
4369
  // src/screens/update.tsx
4106
4370
  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";
4371
+ import { Box as Box4, Text as Text6 } from "ink";
4372
+ import { Fragment, jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
4109
4373
  function clip2(s, n) {
4110
4374
  return s.length > n ? s.slice(0, Math.max(0, n - g.ellipsis.length)) + g.ellipsis : s;
4111
4375
  }
@@ -4132,62 +4396,89 @@ function Row({ e, width }) {
4132
4396
  else if (e.status === "skipped") detail = e.manualCommand ?? "manual";
4133
4397
  else if (e.status === "failed") detail = e.result?.failures[0]?.message ?? "";
4134
4398
  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)) })
4399
+ return /* @__PURE__ */ jsxs4(Box4, { children: [
4400
+ /* @__PURE__ */ jsx7(Box4, { width: 2, children: e.status === "running" ? /* @__PURE__ */ jsx7(RunningGlyph, {}) : /* @__PURE__ */ jsx7(StatusGlyph, { status: e.status }) }),
4401
+ /* @__PURE__ */ jsx7(Box4, { width: 16, children: /* @__PURE__ */ jsx7(Text6, { color: semantic.text, bold: e.status === "running", children: clip2(managerName(e.id), 15) }) }),
4402
+ /* @__PURE__ */ jsx7(Box4, { width: 13, children: /* @__PURE__ */ jsx7(Text6, { color: statusColor(e.status), children: t("status", e.status) }) }),
4403
+ /* @__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)) }),
4404
+ e.status === "running" && /* @__PURE__ */ jsxs4(Text6, { color: semantic.muted, children: [
4405
+ " ",
4406
+ e.percent > 0 && e.startedAt ? /* @__PURE__ */ jsx7(Elapsed, { startedAt: e.startedAt }) : "",
4407
+ " ",
4408
+ clip2(e.currentPackage ?? "", Math.max(0, width - 45))
4409
+ ] })
4140
4410
  ] });
4141
4411
  }
4142
4412
  function UpdateScreen() {
4143
- const { state, cancelRun } = useMachine();
4144
- useSafeInput((_input, key) => {
4145
- if (key.escape) cancelRun();
4146
- });
4413
+ const [now, setNow] = useState4(Date.now);
4414
+ useEffect3(() => {
4415
+ const timer = setInterval(() => setNow(Date.now()), 1e3);
4416
+ return () => clearInterval(timer);
4417
+ }, []);
4418
+ const { state, cancelRun, quitApp } = useMachine();
4419
+ const [asking, setAsking] = useState4(false);
4420
+ const commands = useScreenKeys(asking ? {
4421
+ confirmCancel: () => {
4422
+ setAsking(false);
4423
+ cancelRun();
4424
+ },
4425
+ continueRun: () => setAsking(false),
4426
+ ctrlC: quitApp
4427
+ } : { cancel: () => setAsking(true), quit: () => setAsking(true), ctrlC: quitApp });
4428
+ const activeNames = state.run.queue.filter((id) => ["running", "queued"].includes(state.managers[id]?.status ?? "")).map(managerName);
4147
4429
  const total = state.run.queue.length;
4430
+ const packagesDone = state.run.queue.reduce((sum, id) => {
4431
+ const result = state.managers[id]?.result;
4432
+ return sum + (result?.upgraded ?? 0) + (result?.failed ?? 0) + (result?.skipped ?? 0);
4433
+ }, 0);
4434
+ const canPrompt = state.run.queue.some((id) => {
4435
+ const entry = state.managers[id];
4436
+ if (entry?.requiresAdmin && !state.sudoMode) return false;
4437
+ return entry?.requiresAdmin || process.platform !== "win32" && ["brew", "gem", "pip", "pipx"].includes(id);
4438
+ });
4148
4439
  const finished = state.run.doneCount + state.run.failedCount + state.run.skippedCount + state.run.unknownCount;
4149
4440
  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
- ] }),
4441
+ return /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", children: [
4442
+ /* @__PURE__ */ jsx7(Box4, { marginBottom: 1, children: /* @__PURE__ */ jsxs4(Text6, { color: semantic.text, children: [
4443
+ finished,
4444
+ "/",
4445
+ total,
4446
+ " ",
4447
+ g.separator,
4448
+ " ",
4449
+ packagesDone,
4450
+ " ",
4451
+ t("ui", "of"),
4452
+ " ",
4453
+ state.selection.size,
4454
+ " ",
4455
+ t("ui", state.selection.size === 1 ? "packageOne" : "packageMany"),
4456
+ " ",
4457
+ g.separator,
4458
+ " ",
4459
+ formatElapsed(now - (state.run.startedAt ?? now))
4460
+ ] }) }),
4177
4461
  state.run.queue.map((id) => {
4178
4462
  const e = state.managers[id];
4179
4463
  return e ? /* @__PURE__ */ jsx7(Row, { e, width }, id) : null;
4180
4464
  }),
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") })
4465
+ /* @__PURE__ */ jsxs4(Box4, { marginTop: 1, flexDirection: "column", children: [
4466
+ /* @__PURE__ */ jsxs4(Box4, { height: 3, flexDirection: "column", children: [
4467
+ asking && /* @__PURE__ */ jsx7(Box4, { height: 2, children: /* @__PURE__ */ jsxs4(Text6, { color: semantic.warning, wrap: "truncate-end", children: [
4468
+ t("ui", "cancelQuestion"),
4469
+ " ",
4470
+ activeNames.join(", ")
4471
+ ] }) }),
4472
+ /* @__PURE__ */ jsx7(KeyHints, { commands })
4473
+ ] }),
4474
+ canPrompt && /* @__PURE__ */ jsx7(Text6, { color: semantic.muted, children: t("ui", "passwordNote") })
4184
4475
  ] })
4185
4476
  ] });
4186
4477
  }
4187
4478
 
4188
4479
  // 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";
4480
+ import { Box as Box5, Text as Text7 } from "ink";
4481
+ import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
4191
4482
  function versionDelta(m) {
4192
4483
  const ups = (m.packages ?? []).filter((p) => p.outcome === "upgraded" && p.toVersion);
4193
4484
  if (ups.length === 0) return "";
@@ -4195,40 +4486,37 @@ function versionDelta(m) {
4195
4486
  const p = ups[0];
4196
4487
  return p.fromVersion ? `${p.name} ${p.fromVersion} ${g.arrow} ${p.toVersion}` : `${p.name} ${g.arrow} ${p.toVersion}`;
4197
4488
  }
4198
- return `${ups.length} ${t("ui", "upgraded")}`;
4489
+ return countText(ups.length, "upgraded");
4199
4490
  }
4200
4491
  function ManagerRow({ m }) {
4201
4492
  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: [
4493
+ return /* @__PURE__ */ jsxs5(Box5, { children: [
4494
+ /* @__PURE__ */ jsx8(Box5, { width: 2, children: /* @__PURE__ */ jsx8(StatusGlyph, { status: m.status }) }),
4495
+ /* @__PURE__ */ jsx8(Box5, { width: 14, children: /* @__PURE__ */ jsx8(Text7, { color: semantic.text, wrap: "truncate-end", children: managerName(m.id) }) }),
4496
+ /* @__PURE__ */ jsxs5(Box5, { width: 9, children: [
4497
+ m.upgraded > 0 ? /* @__PURE__ */ jsxs5(Text7, { color: semantic.success, children: [
4207
4498
  g.done,
4208
4499
  " ",
4209
4500
  m.upgraded
4210
4501
  ] }) : null,
4211
- m.failed > 0 ? /* @__PURE__ */ jsxs6(Text7, { color: semantic.error, children: [
4502
+ m.failed > 0 ? /* @__PURE__ */ jsxs5(Text7, { color: semantic.error, children: [
4212
4503
  " ",
4213
4504
  g.failed,
4214
4505
  " ",
4215
4506
  m.failed
4216
4507
  ] }) : null
4217
4508
  ] }),
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 }) })
4509
+ /* @__PURE__ */ jsx8(Box5, { flexGrow: 1, children: /* @__PURE__ */ jsx8(Text7, { color: semantic.muted, wrap: "truncate-end", children: versionDelta(m) }) }),
4510
+ /* @__PURE__ */ jsx8(Box5, { width: 7, justifyContent: "flex-end", children: /* @__PURE__ */ jsx8(Text7, { color: semantic.muted, children: dur }) })
4220
4511
  ] });
4221
4512
  }
4222
4513
  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
- });
4514
+ const { state, rescan, openDetail, quitApp, selfUpdate } = useMachine();
4228
4515
  const summary = summarizeRun(state);
4229
- const { upgraded, failed, skipped, unknown } = summary;
4230
- const hasErrors = failed > 0;
4516
+ const { failed } = summary;
4517
+ const hasErrors = failed > 0 || state.run.failedCount > 0;
4231
4518
  const hasPackages = summary.managers.some((m) => (m.packages ?? []).length > 0);
4519
+ const commands = useScreenKeys({ ...hasPackages ? { detail: openDetail } : {}, retry: rescan, quit: quitApp });
4232
4520
  const failures = [];
4233
4521
  const manuals = [];
4234
4522
  const reboots = [];
@@ -4250,134 +4538,115 @@ function SummaryScreen() {
4250
4538
  if (r.reboot) reboots.push({ manager: id, state: r.reboot });
4251
4539
  }
4252
4540
  }
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: [
4541
+ return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", children: [
4542
+ /* @__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")}` }) }),
4543
+ undetermined.length > 0 && /* @__PURE__ */ jsx8(Box5, { flexDirection: "column", marginBottom: 1, children: /* @__PURE__ */ jsxs5(Text7, { color: semantic.unknown, children: [
4257
4544
  g.unknown,
4258
4545
  " ",
4259
- undetermined.length,
4260
- " ",
4261
- t("ui", "undeterminedCount"),
4546
+ countText(undetermined.length, "unknown"),
4262
4547
  ":",
4263
4548
  " ",
4264
4549
  undetermined.map((id) => managerName(id)).join(", ")
4265
4550
  ] }) }),
4266
- manuals.length > 0 && /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", marginBottom: 1, children: [
4551
+ manuals.length > 0 && /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", marginBottom: 1, children: [
4267
4552
  /* @__PURE__ */ jsx8(Text7, { color: semantic.warning, children: t("ui", "manualNeeded") }),
4268
- manuals.map((m, i) => /* @__PURE__ */ jsxs6(Text7, { color: semantic.muted, children: [
4553
+ manuals.map((m, i) => /* @__PURE__ */ jsxs5(Text7, { color: semantic.muted, children: [
4269
4554
  " ",
4270
4555
  managerName(m.manager),
4271
4556
  ": ",
4272
4557
  /* @__PURE__ */ jsx8(Text7, { color: semantic.text, children: m.command })
4273
4558
  ] }, i))
4274
4559
  ] }),
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: [
4560
+ /* @__PURE__ */ jsx8(Box5, { marginBottom: 1, children: /* @__PURE__ */ jsx8(Text7, { color: semantic.text, children: summaryText(summary) }) }),
4561
+ summary.managers.length > 0 && /* @__PURE__ */ jsx8(Box5, { flexDirection: "column", marginBottom: 1, children: summary.managers.map((m) => /* @__PURE__ */ jsx8(ManagerRow, { m }, m.id)) }),
4562
+ failures.length > 0 && /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", marginBottom: 1, children: [
4563
+ failures.slice(0, 8).map((f, i) => /* @__PURE__ */ jsxs5(Text7, { color: semantic.error, wrap: "truncate-end", children: [
4303
4564
  g.failed,
4304
4565
  " ",
4305
4566
  managerName(f.manager),
4306
- f.package ? /* @__PURE__ */ jsxs6(Text7, { color: semantic.text, children: [
4567
+ f.package ? /* @__PURE__ */ jsxs5(Text7, { color: semantic.text, children: [
4307
4568
  " ",
4308
4569
  f.package
4309
4570
  ] }) : null,
4310
- f.kind ? /* @__PURE__ */ jsxs6(Text7, { color: semantic.muted, children: [
4311
- " \xB7 ",
4571
+ f.kind ? /* @__PURE__ */ jsxs5(Text7, { color: semantic.muted, children: [
4572
+ " ",
4573
+ g.separator,
4574
+ " ",
4312
4575
  f.kind
4313
4576
  ] }) : null
4314
4577
  ] }, i)),
4315
- failures.some((f) => f.kind === "TIMEOUT") && /* @__PURE__ */ jsxs6(Text7, { color: semantic.warning, children: [
4578
+ failures.some((f) => f.kind === "TIMEOUT") && /* @__PURE__ */ jsxs5(Text7, { color: semantic.warning, children: [
4316
4579
  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."
4580
+ " ",
4581
+ t("ui", "timeoutNote")
4318
4582
  ] })
4319
4583
  ] }),
4320
- reboots.length > 0 && /* @__PURE__ */ jsx8(Box6, { marginBottom: 1, children: /* @__PURE__ */ jsxs6(Text7, { color: semantic.warning, children: [
4584
+ reboots.length > 0 && /* @__PURE__ */ jsx8(Box5, { marginBottom: 1, children: /* @__PURE__ */ jsxs5(Text7, { color: semantic.warning, children: [
4321
4585
  g.reboot,
4322
- " Reinicio pendiente: ",
4323
- reboots.map((r) => `${managerName(r.manager)} (${r.state})`).join(", ")
4586
+ " ",
4587
+ t("ui", "rebootPending"),
4588
+ ": ",
4589
+ reboots.map((r) => `${managerName(r.manager)} (${t("ui", r.state === "required" ? "rebootRequired" : r.state === "initiated" ? "rebootInitiated" : "rebootDeferred")})`).join(", ")
4324
4590
  ] }) }),
4325
- /* @__PURE__ */ jsxs6(Text7, { color: semantic.muted, children: [
4591
+ selfUpdate && /* @__PURE__ */ jsx8(Text7, { color: semantic.warning, children: selfUpdate.howTo }),
4592
+ /* @__PURE__ */ jsxs5(Text7, { color: semantic.muted, children: [
4326
4593
  t("ui", "logAt"),
4327
4594
  " ",
4328
- getLogFilePath() ?? "~/.tacuchi-updater/logs/"
4595
+ compactPath(getLogFilePath() ?? "~/.tacuchi-updater/logs/", Math.min(process.stdout.columns ?? 100, 100) - 4 - t("ui", "logAt").length)
4329
4596
  ] }),
4330
- /* @__PURE__ */ jsx8(Box6, { marginTop: 1, children: /* @__PURE__ */ jsx8(Text7, { color: semantic.muted, children: hasPackages ? t("ui", "detailHint") : t("ui", "summaryHint") }) })
4597
+ /* @__PURE__ */ jsx8(Box5, { marginTop: 1, children: /* @__PURE__ */ jsx8(KeyHints, { commands }) })
4331
4598
  ] });
4332
4599
  }
4333
4600
 
4334
4601
  // src/screens/settings-screen.tsx
4335
4602
  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";
4603
+ import { Box as Box6, Text as Text8 } from "ink";
4604
+ import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
4338
4605
  function SettingsScreen() {
4339
- const { state, toggleEnabled, setLang, closeSettings } = useMachine();
4606
+ const { state, toggleEnabled, setLang, closeSettings, quitApp } = useMachine();
4340
4607
  const ids = state.order;
4341
4608
  const [cursor, setCursor] = useState5(0);
4342
4609
  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 === " ") {
4610
+ const commands = useScreenKeys({
4611
+ back: closeSettings,
4612
+ down: () => setCursor((c) => Math.min(ids.length - 1, c + 1)),
4613
+ up: () => setCursor((c) => Math.max(0, c - 1)),
4614
+ mark: () => {
4348
4615
  const id = ids[clamped];
4349
4616
  if (id) toggleEnabled(id);
4350
- } else if (input === "l" || input === "L") {
4351
- setLang(state.config.language === "es" ? "en" : "es");
4352
- }
4617
+ },
4618
+ language: () => setLang(state.config.language === "es" ? "en" : "es"),
4619
+ quit: quitApp
4353
4620
  });
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: " }),
4621
+ return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", children: [
4622
+ /* @__PURE__ */ jsxs6(Box6, { marginBottom: 1, children: [
4623
+ /* @__PURE__ */ jsxs6(Text8, { color: semantic.text, children: [
4624
+ t("ui", "language"),
4625
+ ": "
4626
+ ] }),
4358
4627
  /* @__PURE__ */ jsx9(Text8, { color: semantic.action, bold: true, children: state.config.language.toUpperCase() }),
4359
4628
  /* @__PURE__ */ jsx9(Text8, { color: semantic.muted, children: " (L)" })
4360
4629
  ] }),
4361
4630
  ids.map((id, i) => {
4362
4631
  const enabled = isManagerEnabled(state.config, id);
4363
4632
  const isCursor = i === clamped;
4364
- return /* @__PURE__ */ jsxs7(Box7, { children: [
4633
+ return /* @__PURE__ */ jsxs6(Box6, { children: [
4365
4634
  /* @__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]",
4635
+ /* @__PURE__ */ jsxs6(Text8, { color: enabled ? semantic.success : colors.outline, children: [
4636
+ t("ui", enabled ? "on" : "off"),
4368
4637
  " "
4369
4638
  ] }),
4370
4639
  /* @__PURE__ */ jsx9(Text8, { color: enabled ? semantic.text : semantic.muted, children: managerName(id) })
4371
4640
  ] }, id);
4372
4641
  }),
4373
- /* @__PURE__ */ jsx9(Box7, { marginTop: 1, children: /* @__PURE__ */ jsx9(Text8, { color: semantic.muted, children: "Espacio activar/desactivar \xB7 L idioma \xB7 Esc volver" }) })
4642
+ /* @__PURE__ */ jsx9(Box6, { marginTop: 1, children: /* @__PURE__ */ jsx9(KeyHints, { commands }) })
4374
4643
  ] });
4375
4644
  }
4376
4645
 
4377
4646
  // src/screens/detail.tsx
4378
4647
  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";
4648
+ import { Box as Box7, Text as Text9 } from "ink";
4649
+ import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
4381
4650
  function glyphStatus(outcome) {
4382
4651
  switch (outcome) {
4383
4652
  case "upgraded":
@@ -4399,7 +4668,7 @@ function delta(from, to) {
4399
4668
  return `${from} ${g.arrow} ${to}`;
4400
4669
  }
4401
4670
  function DetailScreen() {
4402
- const { state, closeDetail } = useMachine();
4671
+ const { state, closeDetail, quitApp } = useMachine();
4403
4672
  const [offset, setOffset] = useState6(0);
4404
4673
  const summary = summarizeRun(state);
4405
4674
  const rows = [];
@@ -4418,96 +4687,177 @@ function DetailScreen() {
4418
4687
  }
4419
4688
  }
4420
4689
  const width = Math.min((process.stdout.columns ?? 90) - 4, 92);
4421
- const view = Math.max(6, (process.stdout.rows ?? 24) - 11);
4690
+ const view = Math.max(6, (process.stdout.rows ?? 24) - 11 - headerExtraRows());
4422
4691
  const maxOffset = Math.max(0, rows.length - view);
4423
4692
  const start = Math.min(offset, maxOffset);
4424
4693
  const visible = rows.slice(start, start + view);
4425
4694
  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));
4695
+ const commands = useScreenKeys({
4696
+ detail: closeDetail,
4697
+ back: closeDetail,
4698
+ down: () => setOffset((o) => Math.min(maxOffset, o + 1)),
4699
+ up: () => setOffset((o) => Math.max(0, o - 1)),
4700
+ quit: quitApp
4430
4701
  });
4431
- return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", children: [
4432
- /* @__PURE__ */ jsx10(StepHeader, { phase: state.phase }),
4702
+ return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", children: [
4433
4703
  /* @__PURE__ */ jsx10(Text9, { color: colors.outline, children: start > 0 ? `${g.scrollUp} ${start}` : " " }),
4434
4704
  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 }) })
4705
+ (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: [
4706
+ /* @__PURE__ */ jsx10(Box7, { width: 2, children: /* @__PURE__ */ jsx10(StatusGlyph, { status: glyphStatus(r.outcome ?? "unchanged") }) }),
4707
+ /* @__PURE__ */ jsx10(Box7, { width: nameWidth, children: /* @__PURE__ */ jsx10(Text9, { color: semantic.text, wrap: "truncate-end", children: r.name }) }),
4708
+ /* @__PURE__ */ jsx10(Box7, { flexGrow: 1, justifyContent: "flex-end", children: /* @__PURE__ */ jsx10(Text9, { color: semantic.muted, wrap: "truncate-end", children: r.right }) })
4439
4709
  ] }, `p:${r.managerId}:${r.name}:${i}`)
4440
4710
  ),
4441
4711
  /* @__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") }) })
4712
+ /* @__PURE__ */ jsx10(Box7, { marginTop: 1, children: /* @__PURE__ */ jsx10(KeyHints, { commands }) })
4443
4713
  ] });
4444
4714
  }
4445
4715
 
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()
4716
+ // src/components/step-header.tsx
4717
+ import { useSyncExternalStore } from "react";
4718
+ import { Box as Box8, Text as Text10 } from "ink";
4719
+
4720
+ // src/lib/platform.ts
4721
+ function getPlatform() {
4722
+ switch (process.platform) {
4723
+ case "darwin":
4724
+ return "macos";
4725
+ case "win32":
4726
+ return "windows";
4727
+ default:
4728
+ return "linux";
4729
+ }
4730
+ }
4731
+
4732
+ // src/components/step-header.tsx
4733
+ import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
4734
+ var steps = { boot: 1, detecting: 1, scanning: 1, select: 2, confirm: 3, updating: 4 };
4735
+ function StepHeader() {
4736
+ const banner = shownBanner(useSyncExternalStore(subscribeBanner, bannerSnapshot));
4737
+ return banner ? /* @__PURE__ */ jsx11(BrandBanner, { image: banner }) : /* @__PURE__ */ jsx11(LineHeader, {});
4738
+ }
4739
+ var clip3 = (text, width) => text.length > width ? text.slice(0, Math.max(0, width - g.ellipsis.length)) + g.ellipsis : text;
4740
+ function BrandBanner({ image: image2 }) {
4741
+ const { state, selfUpdate } = useMachine();
4742
+ const textWidth = Math.min(process.stdout.columns ?? 100, 100) - 2 - 1 - image2.columns - 2;
4743
+ const step = steps[state.phase];
4744
+ const label = t("flow", state.phase === "boot" ? "detecting" : state.phase);
4745
+ const version = ` ${getVersion()}${selfUpdate ? ` ${g.arrow} ${selfUpdate.version}` : ""}`;
4746
+ const count = state.order.length;
4747
+ const detecting = count === 0 && (state.phase === "boot" || state.phase === "detecting");
4748
+ const managers = !detecting ? `${count} ${t("banner", count === 1 ? "managerOne" : "managerMany")}` : state.error ? "" : t("banner", "searching");
4749
+ const platform = t("banner", getPlatform()) + (managers ? ` ${g.separator} ${managers}` : "");
4750
+ const name = "tacuchi updater";
4751
+ return /* @__PURE__ */ jsxs8(Box8, { marginBottom: 1, children: [
4752
+ /* @__PURE__ */ jsx11(Box8, { flexDirection: "column", marginLeft: IMAGE_COLUMN - 1, width: image2.columns, flexShrink: 0, children: (image2.tier === "placeholders" ? placeholderRows(image2.id, image2.columns, image2.rows) : Array.from({ length: image2.rows }, () => " ".repeat(image2.columns))).map((row, index) => /* @__PURE__ */ jsx11(Text10, { children: row }, index)) }),
4753
+ /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", marginLeft: 2, children: [
4754
+ /* @__PURE__ */ jsxs8(Text10, { children: [
4755
+ /* @__PURE__ */ jsx11(Text10, { bold: true, color: semantic.text, children: name }),
4756
+ /* @__PURE__ */ jsx11(Text10, { color: semantic.muted, children: clip3(version, Math.max(0, textWidth - name.length)) })
4456
4757
  ] }),
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}` })
4758
+ /* @__PURE__ */ jsx11(Text10, { color: semantic.muted, children: clip3(platform, textWidth) }),
4759
+ /* @__PURE__ */ jsx11(Text10, { color: semantic.muted, children: clip3(step ? `${t("flow", "step")} ${step}/4 ${g.separator} ${label}` : label, textWidth) })
4760
+ ] })
4761
+ ] });
4762
+ }
4763
+ function LineHeader() {
4764
+ const { state, selfUpdate } = useMachine();
4765
+ const width = Math.min(process.stdout.columns ?? 100, 100) - 2;
4766
+ const key = state.phase === "boot" ? "detecting" : state.phase;
4767
+ const label = t("flow", key);
4768
+ const step = steps[state.phase];
4769
+ let product = ` updater ${getVersion()}${selfUpdate ? ` ${g.arrow} ${selfUpdate.version}` : ""}`;
4770
+ let right = step ? `${t("flow", "step")} ${step}/4 ${g.separator} ${label}` : label;
4771
+ if (8 + product.length + right.length + 1 > width) product = product.replace(" updater", "");
4772
+ if (8 + product.length + right.length + 1 > width && step) right = `${step}/4 ${g.separator} ${label}`;
4773
+ const available = width - 8 - product.length - 1;
4774
+ if (right.length > available) right = right.slice(0, Math.max(0, available - g.ellipsis.length)) + g.ellipsis;
4775
+ const gap = " ".repeat(Math.max(1, width - 8 - product.length - right.length));
4776
+ const plainLogo = ASCII || process.env["NO_COLOR"] !== void 0;
4777
+ return /* @__PURE__ */ jsxs8(Box8, { marginBottom: 1, children: [
4778
+ /* @__PURE__ */ jsx11(Text10, { bold: true, color: semantic.text, children: "tacuchi" }),
4779
+ 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 }),
4780
+ /* @__PURE__ */ jsxs8(Text10, { color: semantic.muted, children: [
4781
+ product,
4782
+ gap,
4783
+ right
4784
+ ] })
4470
4785
  ] });
4471
4786
  }
4787
+
4788
+ // src/components/line-output.tsx
4789
+ import { useEffect as useEffect4, useRef as useRef3 } from "react";
4790
+ function LineOutput({ write }) {
4791
+ const { state, selfUpdate } = useMachine();
4792
+ const emitted = useRef3(/* @__PURE__ */ new Set());
4793
+ useEffect4(() => {
4794
+ const once2 = (key, text) => {
4795
+ if (emitted.current.has(key)) return;
4796
+ emitted.current.add(key);
4797
+ write(text + "\n");
4798
+ };
4799
+ if (state.error) once2("error", `${t("ui", "detectionFailed")} ${state.error}`);
4800
+ for (const id of state.run.queue) {
4801
+ const entry = state.managers[id];
4802
+ if (!entry) continue;
4803
+ const result = entry.result;
4804
+ once2(`${id}:${entry.status}`, `${managerName(id)}: ${t("status", entry.status)}${result ? ` ${countText(result.upgraded, "upgraded")}, ${countText(result.failed, "failed")}` : ""}${entry.manualCommand ? ` ${entry.manualCommand}` : ""}`);
4805
+ }
4806
+ if (state.phase === "summary" || state.phase === "select" && state.order.every((id) => state.managers[id]?.outdated.length === 0)) {
4807
+ const result = summarizeRun(state);
4808
+ once2("summary", `${t("flow", "summary")}: ${summaryText(result)}`);
4809
+ if (selfUpdate) once2("self-update", selfUpdate.howTo);
4810
+ }
4811
+ }, [state, selfUpdate, write]);
4812
+ return null;
4813
+ }
4814
+
4815
+ // src/app.tsx
4816
+ import { jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
4472
4817
  function PhaseRouter() {
4473
4818
  const { state } = useMachine();
4474
4819
  switch (state.phase) {
4475
4820
  case "boot":
4476
4821
  case "detecting":
4477
4822
  case "scanning":
4478
- return /* @__PURE__ */ jsx11(DetectScreen, {});
4823
+ return /* @__PURE__ */ jsx12(DetectScreen, {});
4479
4824
  case "select":
4480
- return /* @__PURE__ */ jsx11(SelectScreen, {});
4825
+ return /* @__PURE__ */ jsx12(SelectScreen, {});
4481
4826
  case "confirm":
4482
- return /* @__PURE__ */ jsx11(ConfirmScreen, {});
4827
+ return /* @__PURE__ */ jsx12(ConfirmScreen, {});
4483
4828
  case "updating":
4484
- return /* @__PURE__ */ jsx11(UpdateScreen, {});
4829
+ return /* @__PURE__ */ jsx12(UpdateScreen, {});
4485
4830
  case "summary":
4486
- return /* @__PURE__ */ jsx11(SummaryScreen, {});
4831
+ return /* @__PURE__ */ jsx12(SummaryScreen, {});
4487
4832
  case "detail":
4488
- return /* @__PURE__ */ jsx11(DetailScreen, {});
4833
+ return /* @__PURE__ */ jsx12(DetailScreen, {});
4489
4834
  case "settings":
4490
- return /* @__PURE__ */ jsx11(SettingsScreen, {});
4835
+ return /* @__PURE__ */ jsx12(SettingsScreen, {});
4491
4836
  default:
4492
4837
  return null;
4493
4838
  }
4494
4839
  }
4495
- function Shell({ sudoMode: sudoMode2 }) {
4496
- const { quitApp } = useMachine();
4497
- useSafeInput((input) => {
4498
- if (input === "q" || input === "Q") quitApp();
4499
- });
4840
+ function Shell() {
4841
+ const [, setSize] = useState7(0);
4842
+ useEffect5(() => {
4843
+ const resized = () => setSize((size) => size + 1);
4844
+ process.stdout.on("resize", resized);
4845
+ return () => {
4846
+ process.stdout.off("resize", resized);
4847
+ };
4848
+ }, []);
4500
4849
  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, {})
4850
+ /* @__PURE__ */ jsx12(StepHeader, {}),
4851
+ /* @__PURE__ */ jsx12(PhaseRouter, {})
4503
4852
  ] });
4504
4853
  }
4505
4854
  function App({
4506
4855
  sudoMode: sudoMode2 = false,
4507
- nonInteractive: nonInteractive2 = false
4856
+ nonInteractive: nonInteractive2 = false,
4857
+ lineOutput: lineOutput2
4508
4858
  }) {
4509
4859
  const machine = useAppMachine(sudoMode2, nonInteractive2);
4510
- return /* @__PURE__ */ jsx11(MachineProvider, { value: machine, children: /* @__PURE__ */ jsx11(Shell, { sudoMode: sudoMode2 }) });
4860
+ return /* @__PURE__ */ jsx12(MachineProvider, { value: machine, children: lineOutput2 ? /* @__PURE__ */ jsx12(LineOutput, { write: lineOutput2 }) : /* @__PURE__ */ jsx12(Shell, {}) });
4511
4861
  }
4512
4862
 
4513
4863
  // src/lib/signals.ts
@@ -4537,29 +4887,13 @@ function answerSignal(route, effects) {
4537
4887
  }
4538
4888
 
4539
4889
  // src/cli.tsx
4540
- import { jsx as jsx12 } from "react/jsx-runtime";
4890
+ import { jsx as jsx13 } from "react/jsx-runtime";
4891
+ setLanguage(loadConfig().language);
4541
4892
  var args = process.argv.slice(2);
4542
4893
  var sudoRequested = args.includes("--sudo") || args.includes("-s");
4543
4894
  var isRoot = process.getuid?.() === 0;
4544
4895
  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
- `);
4896
+ console.log(t("cli", "help"));
4563
4897
  process.exit(0);
4564
4898
  }
4565
4899
  if (args.includes("--version") || args.includes("-v")) {
@@ -4567,7 +4901,7 @@ if (args.includes("--version") || args.includes("-v")) {
4567
4901
  process.exit(0);
4568
4902
  }
4569
4903
  if (sudoRequested && !isRoot && process.platform !== "win32") {
4570
- console.log("\x1B[35m\xBB Modo SUDO: ingresa tu contrase\xF1a para continuar...\x1B[0m");
4904
+ console.log(t("cli", "sudoPrompt"));
4571
4905
  try {
4572
4906
  const scriptPath = process.argv[1] ?? "";
4573
4907
  const isDevMode = scriptPath.endsWith(".tsx") || scriptPath.endsWith(".ts");
@@ -4579,18 +4913,48 @@ if (sudoRequested && !isRoot && process.platform !== "win32") {
4579
4913
  });
4580
4914
  process.exit(result.exitCode ?? 0);
4581
4915
  } catch {
4582
- console.error("\x1B[31m\u2717 No se pudo autenticar sudo. Continuando sin permisos elevados.\x1B[0m");
4916
+ console.error(t("cli", "sudoFailure"));
4583
4917
  }
4584
4918
  }
4585
4919
  var elevated = await isElevated();
4586
4920
  if (process.platform === "win32" && sudoRequested && !elevated) {
4587
4921
  console.log(
4588
- "\x1B[33m\xBB En Windows --sudo no eleva. Abr\xED la terminal como Administrador (se detecta autom\xE1ticamente).\x1B[0m"
4922
+ t("cli", "windowsAdmin")
4589
4923
  );
4590
4924
  }
4591
4925
  var sudoMode = process.platform === "win32" ? elevated : isRoot || sudoRequested;
4592
4926
  var nonInteractive = !process.stdin.isTTY || args.includes("--yes") || args.includes("-y") || args.includes("--all");
4593
- var { unmount } = render(/* @__PURE__ */ jsx12(App, { sudoMode, nonInteractive }));
4927
+ var wanted = bannerWanted({
4928
+ env: process.env,
4929
+ interactive: !nonInteractive,
4930
+ stdoutTTY: process.stdout.isTTY === true,
4931
+ ascii: ASCII,
4932
+ columns: Math.min(process.stdout.columns ?? 0, 100),
4933
+ rows: process.stdout.rows ?? 0
4934
+ });
4935
+ var probe = await probeTerminal({ interactive: !nonInteractive, images: wanted, cell: sixelPossible(process.env) });
4936
+ setTerminalTheme(probe.theme);
4937
+ var tier = wanted ? pickTier({ env: process.env, images: probe.images, sixel: probe.sixel }) : "none";
4938
+ var inkStdout = tier === "none" ? process.stdout : mountBanner({
4939
+ tier,
4940
+ piece: pickPiece(probe.theme, probe.themeKnown),
4941
+ cell: probe.cell,
4942
+ stdout: process.stdout,
4943
+ exitEvents: process
4944
+ }).stdout;
4945
+ var redirected = !process.stdout.isTTY;
4946
+ var lineOutput = redirected ? (line) => {
4947
+ process.stdout.write(line);
4948
+ } : void 0;
4949
+ var sink = redirected ? new Writable({ write(_chunk, _encoding, done) {
4950
+ done();
4951
+ } }) : inkStdout;
4952
+ var app = /* @__PURE__ */ jsx13(App, { sudoMode, nonInteractive, lineOutput });
4953
+ var { unmount: inkUnmount, rerender } = render(app, { exitOnCtrlC: false, stdout: sink });
4954
+ var unmount = () => {
4955
+ if (retireBanner()) rerender(app);
4956
+ inkUnmount();
4957
+ };
4594
4958
  for (const route of signalRoutes(process.platform)) {
4595
4959
  process.on(
4596
4960
  route.signal,