hopdeck 1.4.0 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Cambios
2
2
 
3
+ ## Sin publicar
4
+
5
+ ### Nuevo
6
+ - **La mascota de Hopdeck, un sapo naranja con auriculares.** Sale en la pantalla de inicio (el panel derecho cuando no hay ningún chat abierto), encima del texto y del mayor tamaño que quepa; si el terminal es pequeño o usas `NO_COLOR`, se queda el texto de siempre. También en la pantalla de carga y en el panel de tmux. Y con el comando `hopdeck mascot` (`--size small|normal|large`, `--plain` para dibujarla sin colores). Va dentro del programa, sin archivos de imagen ni Python; en el README hay una imagen (`docs/mascot.png`).
7
+
8
+ ## 1.4.1
9
+
10
+ ### Cambiado
11
+ - **Seleccionar texto del chat ya no lo copia solo.** Al soltar, la selección se queda marcada y se copia con `Ctrl+C` o con el clic derecho; `Esc` o un clic en otro sitio la quitan (`Esc` no llega a Claude mientras hay algo seleccionado, porque lo interrumpiría). Quien prefiera el comportamiento anterior puede poner `"copyOnSelect": true` en `~/.hopdeck.json`.
12
+
13
+ ### Arreglado
14
+ - **No se podía seleccionar más de lo que cabía en pantalla.** Al arrastrar contra el borde de arriba o de abajo del chat, este se desplaza solo (aunque el ratón se quede quieto) y la selección sigue. La selección ahora se ancla a las líneas del historial, no a las filas de la pantalla, así que también sigue en su sitio si usas la rueda mientras seleccionas.
15
+ - **El spinner de «trabajando» salía sin que Claude estuviera haciendo nada**, a veces en chats donde ni estabas. Hopdeck marcaba un chat como trabajando si escribía cualquier cosa en el último segundo, y eso también ocurre al mover o redimensionar los paneles (todos los chats se repintan), al cambiar de ventana o al actualizarse la barra de estado. Ahora solo cuenta como trabajando cuando la pantalla de Claude muestra «esc to interrupt», y el repintado justo después de redimensionar se ignora. Si una versión de Claude cambiara ese texto, `HOPDECK_BUSY=output` devuelve el criterio anterior.
16
+
3
17
  ## 1.4.0
4
18
 
5
19
  ### Nuevo
package/README.en.md CHANGED
@@ -5,6 +5,8 @@
5
5
  </picture>
6
6
  </p>
7
7
 
8
+ <p align="center"><img alt="The Hopdeck mascot: an orange toad with headphones" src="docs/mascot.png" width="130"></p>
9
+
8
10
  <p align="center"><b>Hop between your Claude Code projects and conversations without leaving the terminal.</b></p>
9
11
 
10
12
  [Español](README.md) · **English**
@@ -178,7 +180,7 @@ It refreshes itself every few seconds and never modifies the repository. It need
178
180
  ### Scroll and copy
179
181
 
180
182
  - **Scroll** the chat with the mouse wheel or `PgUp` / `PgDn`; `End` or typing returns you to the bottom.
181
- - **Copy:** drag with the mouse over the chat and the text goes to the clipboard. `F3` turns the mouse off if you prefer terminal selection (or use `Shift`+drag).
183
+ - **Select and copy:** drag with the mouse over the chat to mark text; it is not copied by itself. Copy it with `Ctrl+C` or right click, and clear the selection with `Esc` or by clicking elsewhere. If you drag to the top or bottom edge the chat scrolls on its own and the selection follows, so you can mark far more than fits on screen. For the old behaviour (copy on release) set `"copyOnSelect": true` in `~/.hopdeck.json`. `F3` turns the mouse off if you prefer terminal selection (or use `Shift`+drag).
182
184
 
183
185
  ### More
184
186
 
@@ -192,6 +194,7 @@ It refreshes itself every few seconds and never modifies the repository. It need
192
194
  | `hopdeck` | Opens Hopdeck |
193
195
  | `hopdeck shortcut on` / `hopdeck shortcut off` | Installs or removes the shortcut so that `claude` opens Hopdeck |
194
196
  | `hopdeck theme light` / `dark` / `auto` | Changes the color theme and remembers it (`hopdeck theme` shows the current one) |
197
+ | `hopdeck mascot` | Draws the mascot in the terminal (`--size small\|normal\|large`; `--plain` draws it without colors). It also shows on Hopdeck's start screen |
195
198
  | `hopdeck uninstall` | **Uninstalls Hopdeck completely**: the shortcut, your preferences and cache, and the program. Asks first (without a terminal, use `--yes`). Does not touch your Claude Code history |
196
199
  | `hopdeck doctor` | Checks your setup and tells you how to fix whatever is missing |
197
200
  | `hopdeck --list` | Lists the projects as plain text |
@@ -232,6 +235,7 @@ Keys in `~/.hopdeck.json` you can edit by hand:
232
235
  |---|---|---|
233
236
  | `notify` | Desktop notification when a chat finishes | `true` |
234
237
  | `mouse` | Mouse enabled (`F3` toggles) | `true` |
238
+ | `copyOnSelect` | Copy to the clipboard as soon as you release a chat selection | `false` |
235
239
  | `sidebar` | List width (`[` and `]` adjust it) | automatic |
236
240
  | `maxImages` | Max images per conversation in the gallery | `200` |
237
241
  | `previewMsgs` | Messages shown in the preview | `12` |
package/README.md CHANGED
@@ -5,6 +5,8 @@
5
5
  </picture>
6
6
  </p>
7
7
 
8
+ <p align="center"><img alt="La mascota de Hopdeck: un sapo naranja con auriculares" src="docs/mascot.png" width="130"></p>
9
+
8
10
  <p align="center"><b>Salta entre tus proyectos y conversaciones de Claude Code, sin salir de la terminal.</b></p>
9
11
 
10
12
  **Español** · [English](README.en.md)
@@ -178,7 +180,7 @@ Se refresca solo cada pocos segundos y no modifica nada en el repositorio. Neces
178
180
  ### Scroll y copiar
179
181
 
180
182
  - **Scroll** en el chat: rueda del ratón o `PgUp` / `PgDn`; `End` o escribir algo te devuelve al final.
181
- - **Copiar:** arrastra con el ratón sobre el chat y el texto queda en el portapapeles. `F3` apaga el ratón si prefieres seleccionar con el terminal (o usa `Shift`+arrastrar).
183
+ - **Seleccionar y copiar:** arrastra con el ratón sobre el chat para marcar texto; no se copia solo. Cópialo con `Ctrl+C` o con el clic derecho, y quita la selección con `Esc` o haciendo clic en otro sitio. Si arrastras hasta el borde de arriba o de abajo, el chat se desplaza solo y la selección sigue, así que puedes marcar mucho más de lo que cabe en pantalla. Si prefieres el comportamiento anterior (copiar al soltar), pon `"copyOnSelect": true` en `~/.hopdeck.json`. `F3` apaga el ratón si prefieres seleccionar con el terminal (o usa `Shift`+arrastrar).
182
184
 
183
185
  ### Otros detalles
184
186
 
@@ -192,6 +194,7 @@ Se refresca solo cada pocos segundos y no modifica nada en el repositorio. Neces
192
194
  | `hopdeck` | Abre Hopdeck |
193
195
  | `hopdeck shortcut on` / `hopdeck shortcut off` | Instala o quita el atajo para que `claude` abra Hopdeck |
194
196
  | `hopdeck theme light` / `dark` / `auto` | Cambia el tema de colores y lo guarda (`hopdeck theme` muestra el actual) |
197
+ | `hopdeck mascot` | Dibuja la mascota en el terminal (`--size small\|normal\|large`; `--plain` la dibuja sin colores). También sale en la pantalla de inicio de Hopdeck |
195
198
  | `hopdeck uninstall` | **Desinstala Hopdeck por completo**: el atajo, tus preferencias y la caché, y el programa. Pregunta antes (sin terminal, usa `--yes`). No toca tu historial de Claude Code |
196
199
  | `hopdeck doctor` | Revisa tu instalación y dice cómo arreglar lo que falte |
197
200
  | `hopdeck --list` | Lista los proyectos en texto plano |
@@ -217,6 +220,7 @@ Casi nunca hace falta tocar nada. Lo más útil:
217
220
  | `HOPDECK_LANG` | `es` o `en` (por defecto, el idioma del sistema) |
218
221
  | `HOPDECK_THEME` | `light` o `dark`: manda sobre lo guardado con `hopdeck theme` |
219
222
  | `HOPDECK_SIXEL` | `1` fuerza la imagen real al pasar el cursor por `[Image #N]`, `0` usa siempre bloques (por defecto se detecta) |
223
+ | `HOPDECK_BUSY` | `output` marca un chat como «trabajando» con cualquier salida reciente. Por defecto solo cuando Claude muestra «esc to interrupt» |
220
224
  | `NO_COLOR` | Quita los colores |
221
225
  | `CLAUDE_CONFIG_DIR` | Carpeta de Claude Code, si no es `~/.claude` |
222
226
  | `HOPDECK_SKIP=1` | Salta Hopdeck una vez: `HOPDECK_SKIP=1 claude` |
@@ -232,6 +236,7 @@ Claves de `~/.hopdeck.json` que puedes editar a mano:
232
236
  |---|---|---|
233
237
  | `notify` | Aviso de escritorio al terminar un chat | `true` |
234
238
  | `mouse` | Ratón activado (`F3` lo alterna) | `true` |
239
+ | `copyOnSelect` | Copiar al portapapeles en cuanto sueltas la selección del chat | `false` |
235
240
  | `sidebar` | Ancho de la lista (`[` y `]` lo ajustan) | automático |
236
241
  | `maxImages` | Imágenes máximas por conversación en la galería | `200` |
237
242
  | `previewMsgs` | Mensajes mostrados en la vista previa | `12` |
package/bin/hopdeck.js CHANGED
@@ -13,6 +13,7 @@ const readline = require('readline');
13
13
 
14
14
  const { LANG, T } = require('../lib/i18n');
15
15
  const { TRUE, NOCOL, LIGHT, setTheme, isLight, fg, bg, R, C, cw, strW, fit, clean } = require('../lib/style');
16
+ const mascot = require('../lib/mascot');
16
17
  const { baseName, tidy, home, shortPath, fold, queryWords, matchWords, fuzzy, wrapText } = require('../lib/text');
17
18
  const hist = require('../lib/history');
18
19
  const { CONFIG_DIR, CACHE_FILE, textOf, isType, cacheLoad, cacheSave, readSession, decodeDir, projectDirs, buildProject, beginScan, endScan } = hist;
@@ -842,7 +843,10 @@ function idle() {
842
843
  const c = process.stdout.columns || 80, r = process.stdout.rows || 24;
843
844
  const rows = [[C.brand + C.bold, '» Hop\u0001deck'], [C.text, T.idle1], [C.dim, T.idle2], ['', ''], [C.dim, T.idle3]];
844
845
  let out = '\x1b[2J\x1b[?25l';
845
- rows.forEach(([st, t], i) => { out += `\x1b[${Math.max(1, Math.floor(r / 2) - 2 + i)};${Math.max(1, Math.floor((c - strW(t.replace('\u0001', ''))) / 2) + 1)}H${st}${paintMark(t)}${R}`; });
846
+ const art = mascotArt(c, r - rows.length - 2), gap = art.length ? 1 : 0; // el panel de tmux también lleva la mascota, si cabe
847
+ const top = art.length ? Math.max(1, Math.floor((r - art.length - gap - rows.length) / 2) + 1) : Math.max(1, Math.floor(r / 2) - 2);
848
+ art.forEach((_, j) => { out += `\x1b[${top + j};1H${mascotRow(art, j, c)}`; });
849
+ rows.forEach(([st, t], i) => { out += `\x1b[${top + art.length + gap + i};${Math.max(1, Math.floor((c - strW(t.replace('\u0001', ''))) / 2) + 1)}H${st}${paintMark(t)}${R}`; });
846
850
  process.stdout.write(out);
847
851
  };
848
852
  draw(); process.stdout.on('resize', draw);
@@ -1035,10 +1039,28 @@ function termRow(term, y, width, sel, from = 0) {
1035
1039
  /** Texto con la marca en dos colores: \u0001 separa "Hop" (color de marca) de "deck" (color del texto). */
1036
1040
  const paintMark = (t) => t.replace('\u0001', R + C.text + C.bold);
1037
1041
 
1042
+ /** La mascota, del mayor tamaño que quepa (en `width` columnas y `rows` filas); nada si no cabe ni la más pequeña o si no hay colores. */
1043
+ function mascotArt(width, rows) {
1044
+ if (NOCOL) return [];
1045
+ const n = mascot.sizeFor(width - 2, rows);
1046
+ return n ? mascot.render(n) : [];
1047
+ }
1048
+
1049
+ /** Una fila de la mascota centrada en `width` columnas. */
1050
+ function mascotRow(art, j, width) {
1051
+ const n = art.length * 2, pad = Math.max(0, Math.floor((width - n) / 2));
1052
+ return ' '.repeat(pad) + art[j] + ' '.repeat(Math.max(0, width - pad - n));
1053
+ }
1054
+
1038
1055
  function idleRow(y, width, height) {
1039
1056
  const k = T.k;
1040
1057
  const rows = [[C.brand + C.bold, '» Hop\u0001deck'], [C.text, T.idle1], [C.dim, T.idle2], ['', ''], [C.accent, `⏎ ${k.resume} n ${k.neu} / ${k.find} ? ${T.kHelp}`], [C.dim, T.idle3]];
1041
- const i = y - (Math.floor(height / 2) - 2);
1058
+ const art = mascotArt(width, height - rows.length - 2); // la mascota va encima del texto, si cabe
1059
+ const gap = art.length ? 1 : 0;
1060
+ const start = art.length ? Math.floor((height - art.length - gap - rows.length) / 2) : Math.floor(height / 2) - 2;
1061
+ const j = y - start;
1062
+ if (j >= 0 && j < art.length) return mascotRow(art, j, width);
1063
+ const i = j - art.length - gap;
1042
1064
  if (i < 0 || i >= rows.length) return ' '.repeat(width);
1043
1065
  const [st, t] = rows[i];
1044
1066
  const vis = t.replace('\u0001', ''), pad = Math.max(0, Math.floor((width - strW(vis)) / 2));
@@ -1443,13 +1465,13 @@ function embedLaunch(project, session) {
1443
1465
  { name: 'xterm-256color', cols: rw, rows: th, cwd: project.cwd, env });
1444
1466
  } catch (e) { flash(String(e.message).split('\n')[0]); return; }
1445
1467
  const term = new Terminal({ cols: rw, rows: th, allowProposedApi: true, scrollback: 2000 });
1446
- const sess = { p, term, cursorHidden: false, ready: false, lastData: Date.now(), working: false, busy: false, unseen: false, title: session ? session.title : T.newChat, t0: Date.now(), project: project.name, cwd: project.cwd, sid: session ? session.id : null, closing: false, branch: gitBranch(project.cwd) };
1468
+ const sess = { p, term, cursorHidden: false, ready: false, lastData: Date.now(), quietUntil: 0, working: false, busy: false, unseen: false, title: session ? session.title : T.newChat, t0: Date.now(), project: project.name, cwd: project.cwd, sid: session ? session.id : null, closing: false, branch: gitBranch(project.cwd) };
1447
1469
  const vis = (hidden) => (params) => { if (params.some((x) => x === 25 || (Array.isArray(x) && x.includes(25)))) sess.cursorHidden = hidden; return false; };
1448
1470
  term.parser.registerCsiHandler({ prefix: '?', final: 'h' }, vis(false));
1449
1471
  term.parser.registerCsiHandler({ prefix: '?', final: 'l' }, vis(true));
1450
1472
  term.onData((d) => { try { p.write(d); } catch { /* cerrado */ } }); // respuestas a consultas del terminal
1451
1473
  p.onData((d) => {
1452
- sess.lastData = Date.now();
1474
+ if (Date.now() >= sess.quietUntil) sess.lastData = Date.now(); // lo que Claude repinta justo tras redimensionar no es trabajo
1453
1475
  // "listo" = ya hay texto visible. En Windows ConPTY manda secuencias de control al arrancar, antes de que Claude dibuje nada.
1454
1476
  term.write(d, () => { if (!sess.ready && hasContent(term)) sess.ready = true; if (E.shown === key) scheduleRender(); });
1455
1477
  });
@@ -1474,22 +1496,51 @@ function selNorm(sl) {
1474
1496
  if (b.y < a.y || (b.y === a.y && b.x < a.x)) [a, b] = [b, a];
1475
1497
  return [a, b];
1476
1498
  }
1499
+ // La selección del chat guarda en `y` la línea del historial del terminal (absoluta), no la fila de la pantalla: así sigue sobre
1500
+ // el mismo texto aunque el chat se desplace mientras se arrastra, y puede abarcar más de lo que cabe en pantalla.
1477
1501
  function selRange(ty, rw) {
1478
- if (!E.sel || !E.sel.down) return null;
1479
- const [a, b] = selNorm(E.sel);
1480
- if (ty < a.y || ty > b.y) return null;
1481
- return [ty === a.y ? a.x : 0, ty === b.y ? b.x : rw - 1];
1502
+ if (!E.sel) return null;
1503
+ const sh = E.sessions.get(E.shown); if (!sh) return null;
1504
+ const y = sh.term.buffer.active.viewportY + ty, [a, b] = selNorm(E.sel);
1505
+ if (y < a.y || y > b.y) return null;
1506
+ return [y === a.y ? a.x : 0, y === b.y ? b.x : rw - 1];
1482
1507
  }
1483
1508
  function selText(sh, sl) {
1484
1509
  const [a, b] = selNorm(sl); const buf = sh.term.buffer.active; const out = [];
1485
1510
  for (let y = a.y; y <= b.y; y++) {
1486
- const l = buf.getLine(buf.viewportY + y);
1511
+ const l = buf.getLine(y);
1487
1512
  out.push(l ? l.translateToString(true, y === a.y ? a.x : 0, y === b.y ? b.x + 1 : sh.term.cols) : '');
1488
1513
  }
1489
1514
  return out.join('\n').replace(/\s+$/, '');
1490
1515
  }
1516
+ /** Copia la selección marcada y la quita. Solo se llama cuando el usuario lo pide (Ctrl+C, clic derecho), o con "copyOnSelect". */
1517
+ function copySelection(sh) {
1518
+ const sl = E.sel; E.sel = null; stopSelScroll();
1519
+ const t = sl && sh ? selText(sh, sl) : '';
1520
+ if (t) { copyText(t); E.note = { t: T.copied(t.length), until: Date.now() + 3000 }; }
1521
+ }
1522
+
1523
+ // Al arrastrar contra el borde de arriba o de abajo, el chat se desplaza solo (aunque el ratón se quede quieto) y la selección sigue.
1524
+ let selTimer = null;
1525
+ function stopSelScroll() { if (selTimer) { clearInterval(selTimer); selTimer = null; } if (E.sel) E.sel.dir = 0; }
1526
+ function selScrollTick() {
1527
+ const sel = E.sel, sh = E.sessions.get(E.shown);
1528
+ if (!sel || !sel.down || !sel.dir || !sh || sh.term.buffer.active.type === 'alternate') return stopSelScroll();
1529
+ sh.term.scrollLines(-sel.dir * 2); // dir > 0: hacia arriba
1530
+ const row = sel.dir > 0 ? 0 : embedLayout().th - 1;
1531
+ sel.b = { x: sel.b.x, y: sh.term.buffer.active.viewportY + row };
1532
+ render();
1533
+ }
1534
+ /** `row`: fila del ratón respecto a la zona del chat (negativa = encima, ≥ th = debajo). Pone en marcha o para el desplazamiento. */
1535
+ function selEdge(sh, row) {
1536
+ const th = embedLayout().th, dir = row < 0 ? 1 : row >= th ? -1 : 0;
1537
+ E.sel.dir = dir;
1538
+ if (dir && sh.term.buffer.active.type !== 'alternate') { if (!selTimer) { selTimer = setInterval(selScrollTick, 60); selScrollTick(); } }
1539
+ else if (selTimer) { clearInterval(selTimer); selTimer = null; }
1540
+ }
1491
1541
  /** Copia al portapapeles: OSC 52 (la mayoría de terminales) + comando del sistema como respaldo. */
1492
1542
  function copyText(t) {
1543
+ if (process.env.HOPDECK_COPY_LOG) { try { fs.appendFileSync(process.env.HOPDECK_COPY_LOG, JSON.stringify(t) + '\n'); } catch { /* */ } return; } // pruebas: se anota en un archivo y no se toca el portapapeles
1493
1544
  try { process.stdout.write(`\x1b]52;c;${Buffer.from(t).toString('base64')}\x07`); } catch { /* */ }
1494
1545
  const run = (cmd, args) => { try { const c = cp.spawn(cmd, args, { stdio: ['pipe', 'ignore', 'ignore'] }); c.on('error', () => {}); c.stdin.on('error', () => {}); c.stdin.end(t); } catch { /* */ } };
1495
1546
  if (process.platform === 'darwin') run('pbcopy', []);
@@ -1570,7 +1621,7 @@ function onMouse(b, x, y, type) {
1570
1621
  return render();
1571
1622
  }
1572
1623
  if ((b & 32) && (b & 3) === 3) { // movimiento sin botón (hover): previsualiza la conversación bajo el cursor
1573
- if (S.help || S.qs || E.sel) return;
1624
+ if (S.help || S.qs || (E.sel && E.sel.down)) return;
1574
1625
  if (S.fb) { const i = S.fb.off + (y - 3); if (x <= SW && y >= 3 && y <= rh - 2 && fbRows()[i] && i !== S.fb.i) { S.fb.i = i; scheduleRender(); } return; }
1575
1626
  if (sh) { if (x > SW) hoverChat(sh, x, y); else if (E.hover) { E.hover = null; scheduleRender(); } return; }
1576
1627
  if (x > SW || y < 3 || y > rh - 2) return;
@@ -1579,24 +1630,30 @@ function onMouse(b, x, y, type) {
1579
1630
  return;
1580
1631
  }
1581
1632
  const x0 = SW ? SW + 2 : 1, inPane = (SW ? x > SW + 1 : true) && y >= 3 && sh && sh.ready;
1582
- const cell = () => ({ x: clamp(x - x0, 0, embedLayout().rw - 1), y: clamp(y - 3, 0, embedLayout().th - 1) });
1583
- if ((b & 32) && (b & 3) === 0) { if (E.sel && E.sel.down) { E.sel.b = cell(); render(); } return; } // arrastre
1584
- if (type === 'm') { // soltar: copiar la selección
1585
- const sl = E.sel; E.sel = null;
1586
- if (sl && sl.down && sl.a.x === sl.b.x && sl.a.y === sl.b.y && sh && sh.ready) { // un clic sin arrastrar: si es sobre un [Image #N], se abre la imagen
1587
- const hit = imageMarkerAt(sh.term, sl.a.y, sl.a.x);
1588
- if (hit) openMarkerImage(sh, hit.n);
1589
- }
1590
- if (sl && sl.down && (sl.a.x !== sl.b.x || sl.a.y !== sl.b.y) && sh) {
1591
- const t = selText(sh, sl);
1592
- if (t) { copyText(t); E.note = { t: T.copied(t.length), until: Date.now() + 3000 }; }
1633
+ // celda del chat bajo el ratón; `y` es la línea del historial (ver selRange), así que sirve aunque el chat esté desplazado
1634
+ const cell = () => { const L = embedLayout(); return { x: clamp(x - x0, 0, L.rw - 1), y: sh.term.buffer.active.viewportY + clamp(y - 3, 0, L.th - 1) }; };
1635
+ if ((b & 32) && (b & 3) === 0) { // arrastre
1636
+ if (E.sel && E.sel.down && sh) { E.sel.b = cell(); selEdge(sh, y - 3); render(); }
1637
+ return;
1638
+ }
1639
+ if (type === 'm') { // soltar
1640
+ stopSelScroll();
1641
+ const sl = E.sel;
1642
+ if (!sl || !sl.down) return render();
1643
+ if (sl.a.x === sl.b.x && sl.a.y === sl.b.y) { // un clic sin arrastrar: si es sobre un [Image #N], se abre la imagen
1644
+ E.sel = null;
1645
+ if (sh && sh.ready) { const hit = imageMarkerAt(sh.term, sl.a.y - sh.term.buffer.active.viewportY, sl.a.x); if (hit) openMarkerImage(sh, hit.n); }
1646
+ return render();
1593
1647
  }
1648
+ sl.down = false; // la selección se queda marcada: no se copia sola (se copia con Ctrl+C o clic derecho), salvo con "copyOnSelect": true
1649
+ if (CFG.copyOnSelect) copySelection(sh); else E.note = { t: T.selHint, until: Date.now() + 8000 };
1594
1650
  return render();
1595
1651
  }
1652
+ if (type === 'M' && (b & 3) === 2 && E.sel && !E.sel.down && sh) { copySelection(sh); return render(); } // clic derecho: copiar lo marcado
1596
1653
  if (type !== 'M' || (b & 3) !== 0) return; // solo clic izquierdo
1597
1654
  if (x <= SW && y === 1 && !S.fb && !S.qs && S.prompt === null && !S.help) { E.focus = 'left'; E.sel = null; S.searching = true; S.qpos = [...S.query].length; return render(); } // clic en la fila de arriba de la lista: buscar
1598
- if (inPane) { E.focus = 'right'; const c = cell(); E.sel = { a: c, b: c, down: true }; return render(); }
1599
- E.sel = null;
1655
+ if (inPane) { E.focus = 'right'; const c = cell(); stopSelScroll(); E.sel = { a: c, b: c, down: true, dir: 0 }; return render(); }
1656
+ stopSelScroll(); E.sel = null;
1600
1657
  if (S.fb && x <= SW) {
1601
1658
  E.focus = 'left'; const i = S.fb.off + (y - 3);
1602
1659
  if (S.prompt === null && y >= 3 && y <= rh - 2 && fbRows()[i]) { S.fb.i = i; return fbActivate(); }
@@ -1620,7 +1677,11 @@ function hasContent(term) {
1620
1677
  }
1621
1678
 
1622
1679
  function embedInput(s) {
1623
- E.sel = null; E.hover = null;
1680
+ if (E.sel && !E.sel.down) { // hay texto seleccionado: Ctrl+C lo copia y Esc lo quita, sin llegar a Claude (Esc le interrumpiría)
1681
+ if (s === '\x03') { copySelection(E.sessions.get(E.shown)); return render(); }
1682
+ if (s === '\x1b') { E.sel = null; E.note = null; return render(); }
1683
+ }
1684
+ stopSelScroll(); E.sel = null; E.hover = null;
1624
1685
  if (s === '\x1bOP' || s === '\x1b[11~' || s === '\x1b[1;1P') { E.focus = 'left'; if (E.hideSide) { E.hideSide = false; embedResize(); } else render(); return; }
1625
1686
  const sh = E.sessions.get(E.shown);
1626
1687
  const b = sh.term.buffer.active, scrolled = b.baseY > b.viewportY;
@@ -1677,10 +1738,26 @@ function closeChat(key) {
1677
1738
  flash(T.closed(x.title));
1678
1739
  }
1679
1740
 
1741
+ /**
1742
+ * ¿Claude Code está trabajando de verdad? Mientras genera, su pantalla muestra «esc to interrupt» (o «ctrl+c to interrupt»).
1743
+ * Antes bastaba con que el chat escribiera algo en el último segundo, y eso también pasa sin trabajo: al redimensionar los
1744
+ * paneles, al cambiar de ventana, o al actualizar su barra de estado. Se mira solo la pantalla viva (no lo que se ve al subir).
1745
+ */
1746
+ const BUSY_HINT = /(esc|ctrl\+c) to interrupt/i;
1747
+ function showsBusy(term) {
1748
+ const b = term.buffer.active;
1749
+ for (let y = Math.max(0, term.rows - 14); y < term.rows; y++) {
1750
+ const l = b.getLine(b.baseY + y);
1751
+ if (l && BUSY_HINT.test(l.translateToString(true))) return true;
1752
+ }
1753
+ return false;
1754
+ }
1755
+
1680
1756
  function pollChats() {
1681
1757
  const now = Date.now(); let changed = false;
1682
1758
  for (const [key, x] of E.sessions) {
1683
- const working = x.ready && now - x.lastData < 1200;
1759
+ // HOPDECK_BUSY=output devuelve el criterio antiguo (cualquier salida reciente) por si una versión de Claude cambia ese texto
1760
+ const working = x.ready && now - x.lastData < 1200 && (process.env.HOPDECK_BUSY === 'output' || showsBusy(x.term));
1684
1761
  if (x.working && !working && x.busy) {
1685
1762
  x.busy = false;
1686
1763
  if (E.shown !== key || E.focus !== 'right') { x.unseen = true; E.note = { t: '✔ ' + x.project + ' › ' + x.title, until: now + 6000 }; process.stdout.write('\x07'); notifyDesktop(x.project + ' › ' + x.title); }
@@ -1694,9 +1771,9 @@ function pollChats() {
1694
1771
  const x_any = (e) => [...e.sessions.values()].some((x) => x.working);
1695
1772
 
1696
1773
  function embedResize() {
1697
- invalidate(); E.sel = null;
1774
+ invalidate(); stopSelScroll(); E.sel = null; // al cambiar el ancho las líneas se reajustan: la selección ya no marcaría lo mismo
1698
1775
  const { rw, th } = embedLayout();
1699
- for (const sess of E.sessions.values()) { try { sess.p.resize(rw, th); sess.term.resize(rw, th); } catch { /* */ } }
1776
+ for (const sess of E.sessions.values()) { sess.quietUntil = Date.now() + 1500; try { sess.p.resize(rw, th); sess.term.resize(rw, th); } catch { /* */ } } // todos los chats se repintan al cambiar el tamaño
1700
1777
  render();
1701
1778
  }
1702
1779
 
@@ -1873,7 +1950,10 @@ function splash(done, total) {
1873
1950
  const lines = [[C.brand + C.bold, '» Hopdeck'], ['', ''],
1874
1951
  [C.dim, `${spin()} ${T.loading}${total ? ` ${done}/${total}` : '…'}`]];
1875
1952
  let out = '\x1b[2J';
1876
- lines.forEach(([st, t], i) => { out += `\x1b[${Math.max(1, Math.floor(r / 2) - 1 + i)};${Math.max(1, Math.floor((c - strW(t)) / 2) + 1)}H${st}${t}${R}`; });
1953
+ const art = mascotArt(c, r - lines.length - 2), gap = art.length ? 1 : 0; // la mascota va encima, si cabe
1954
+ const top = art.length ? Math.max(1, Math.floor((r - art.length - gap - lines.length) / 2) + 1) : Math.max(1, Math.floor(r / 2) - 1);
1955
+ art.forEach((_, j) => { out += `\x1b[${top + j};1H${mascotRow(art, j, c)}`; });
1956
+ lines.forEach(([st, t], i) => { out += `\x1b[${top + art.length + gap + i};${Math.max(1, Math.floor((c - strW(t)) / 2) + 1)}H${st}${t}${R}`; });
1877
1957
  process.stdout.write(out);
1878
1958
  }
1879
1959
 
@@ -2198,9 +2278,9 @@ function tutorial(afterInstall) {
2198
2278
 
2199
2279
  // ───────────────────────── entrada ─────────────────────────
2200
2280
  // ── Comandos: UNA sola forma para cada uno (shortcut on|off, uninstall, doctor, help). Lo demás no hace nada: da un error con una sugerencia ──
2201
- const COMMANDS = ['shortcut', 'theme', 'uninstall', 'doctor', 'help'];
2281
+ const COMMANDS = ['shortcut', 'theme', 'mascot', 'uninstall', 'doctor', 'help'];
2202
2282
  // Palabras que alguien escribiría para lo mismo: no son comandos y no se ejecutan, solo sirven para sugerir el correcto
2203
- const SYNONYMS = { install: 'shortcut on', instalar: 'shortcut on', atajo: 'shortcut on', desinstalar: 'uninstall', remove: 'uninstall', delete: 'uninstall', ayuda: 'help', diagnostico: 'doctor', version: '--version', list: '--list', tema: 'theme', modo: 'theme', mode: 'theme', dark: 'theme dark', light: 'theme light', oscuro: 'theme dark', claro: 'theme light' };
2283
+ const SYNONYMS = { install: 'shortcut on', instalar: 'shortcut on', atajo: 'shortcut on', desinstalar: 'uninstall', remove: 'uninstall', delete: 'uninstall', ayuda: 'help', diagnostico: 'doctor', version: '--version', list: '--list', tema: 'theme', mascota: 'mascot', sapo: 'mascot', frog: 'mascot', modo: 'theme', mode: 'theme', dark: 'theme dark', light: 'theme light', oscuro: 'theme dark', claro: 'theme light' };
2204
2284
  /** Nombre de comando si `arg` es exactamente uno (sin guiones ni variantes); null si no. */
2205
2285
  const commandName = (arg) => (COMMANDS.includes(String(arg || '').toLowerCase()) ? String(arg).toLowerCase() : null);
2206
2286
  const editDistance = (a, b) => { const d = Array.from({ length: a.length + 1 }, (_, i) => [i, ...Array(b.length).fill(0)]); for (let j = 1; j <= b.length; j++) d[0][j] = j; for (let i = 1; i <= a.length; i++) for (let j = 1; j <= b.length; j++) d[i][j] = Math.min(d[i - 1][j] + 1, d[i][j - 1] + 1, d[i - 1][j - 1] + (a[i - 1] === b[j - 1] ? 0 : 1)); return d[a.length][b.length]; };
@@ -2235,6 +2315,17 @@ function main() {
2235
2315
  const eff = env ? (LIGHT ? 'light' : 'dark') : CFG.theme || (/;(7|15)$/.test(process.env.COLORFGBG || '') ? 'light' : 'dark');
2236
2316
  console.log(T.themeShow(CFG.theme || 'auto', eff, CFG.theme ? 'config' : 'auto', env));
2237
2317
  }
2318
+ else if (commandName(cmd) === 'mascot') { // hopdeck mascot [--size small|normal|large] [--plain]: dibuja la mascota (sin colores con --plain o NO_COLOR)
2319
+ const sizes = { small: 32, normal: 48, large: 64 }; let size = 'normal', plain = false, bad = false;
2320
+ for (let i = 0; i < rest.length; i++) {
2321
+ if (rest[i] === '--plain') plain = true;
2322
+ else if (rest[i] === '--size' && sizes[rest[i + 1]]) size = rest[++i];
2323
+ else bad = true;
2324
+ }
2325
+ if (bad) { console.error(`${C.warn}${T.mascotUsage}${R}`); process.exit(2); }
2326
+ if (plain || NOCOL) console.log(mascot.ASCII);
2327
+ else { const cols = process.stdout.isTTY ? process.stdout.columns || 80 : 999; console.log(mascot.render(Math.max(16, Math.min(sizes[size], cols))).join('\n')); }
2328
+ }
2238
2329
  else if (commandName(cmd) === 'uninstall') { // desinstalación completa: atajo, preferencias, caché y programa
2239
2330
  if (rest.some((a) => a !== '--yes' && a !== '-y')) { console.error(`${C.warn}${T.unknownCmd(rest.find((a) => a !== '--yes' && a !== '-y'))}${R}\n${C.dim}${T.cmdList}${R}`); process.exit(2); }
2240
2331
  uninstallAll({ yes: rest.length > 0 }).then((code) => process.exit(code), (e) => { console.error(e); process.exit(1); });
package/lib/i18n.js CHANGED
@@ -21,8 +21,9 @@ const T = {
21
21
  prevHint: '⏎ reanudar esta conversación', bar8: 'git', gitNone: 'Elige un proyecto', gitNoRepo: 'Esta carpeta no es un repositorio git', gitMissing: 'git no está instalado', gitErr: 'No se pudo leer el repositorio', gitClean: 'sin cambios', gitDirty: (n) => (n === 1 ? '1 cambio sin guardar' : `${n} cambios sin guardar`), gitMore: (n) => `… y ${n} más`, gitBranches: 'Ramas recientes', gitActivity: 'Actividad de ramas', gitNoActivity: 'Sin cambios de rama', gitFrom: 'desde', gitNarrow: (n) => `Terminal estrecha: el panel de git necesita ${n} columnas`, gitOnlyEmbed: 'El panel de git solo está en el terminal integrado', prevInfo: (a, n) => `${a === 'ahora' ? 'ahora mismo' : 'hace ' + a} · últimos ${n} mensajes`, kUnfold: 'desplegar', kRename: 'renombrar', kPin: 'fijar', kHelp: 'ayuda', noPrev: 'Sin mensajes para mostrar',
22
22
  bar6: 'ocultar lista', bar7: 'mostrar lista', deep: 'contenido', pathPrompt: 'nombre de la nueva carpeta', mkIn: 'se crea en', fbTitle: 'Elegir carpeta', fbHere: 'Abrir chat aquí', fbNew: 'Nueva carpeta aquí…', fbUp: 'Subir un nivel', fbProj: 'proyecto', fbHint: '⏎ entrar · ␣ abrir · / buscar · . ocultas', fbDrives: 'Este equipo', fbRecent: 'reciente', hoverMiss: (n) => `[Image #${n}]: aún no está en el historial`, fbEmpty: 'Sin subcarpetas', badId: 'Identificador de sesión no válido',
23
23
  imgClickHint: 'clic: abrir en grande', imgOpened: (n) => `[Image #${n}] abierta en el visor de imágenes`,
24
- unknownCmd: (c) => `Comando desconocido: "${c}"`, didYouMean: (s) => `¿Quisiste decir "${s}"?`, cmdList: 'Comandos: hopdeck shortcut on|off · theme light|dark|auto · uninstall · doctor · help (y --list, --version).\nLas opciones de claude (por ejemplo --model opus) se pasan tal cual: hopdeck --model opus',
24
+ unknownCmd: (c) => `Comando desconocido: "${c}"`, didYouMean: (s) => `¿Quisiste decir "${s}"?`, cmdList: 'Comandos: hopdeck shortcut on|off · theme light|dark|auto · mascot · uninstall · doctor · help (y --list, --version).\nLas opciones de claude (por ejemplo --model opus) se pasan tal cual: hopdeck --model opus',
25
25
  themeNow: (n) => `Tema ${n === 'light' ? 'claro' : 'oscuro'} (guardado)`,
26
+ mascotUsage: 'Uso: hopdeck mascot · hopdeck mascot --size small|normal|large · hopdeck mascot --plain (sin colores)',
26
27
  themeUsage: 'Uso: hopdeck theme light (claro) · hopdeck theme dark (oscuro) · hopdeck theme auto (según el terminal) · hopdeck theme (ver el actual)',
27
28
  themeShow: (saved, eff, from, env) => `Tema guardado: ${saved === 'auto' ? 'automático' : saved === 'light' ? 'claro' : 'oscuro'}.\nSe está usando: ${eff === 'light' ? 'claro' : 'oscuro'}` + (env ? ' (la variable HOPDECK_THEME tiene prioridad sobre lo guardado).' : from === 'auto' ? ' (automático: oscuro salvo que el terminal diga que tiene fondo claro).' : '.'),
28
29
  shortcutUsage: 'Uso: hopdeck shortcut on (instalar el atajo de claude) · hopdeck shortcut off (quitarlo)',
@@ -44,6 +45,7 @@ const T = {
44
45
  'F1 F2 foco lista / chat', 'F3 copiar texto (ratón)', 'F4 ocultar la lista', 'b F8 panel de git', 't F9 tema claro / oscuro', '⠋ ✔ ● trabajando · terminó · abierta', 'q salir'],
45
46
  bar4: 'copiar texto', bar5: 'ratón', up: (n, pct) => `↑ ${n} líneas${pct >= 0 ? ` (${pct}%)` : ''} · PgDn/End`, loading: 'Cargando proyectos', opening: 'Abriendo conversación', close: 'cerrar', idle1: 'Elige una conversación', idle2: 'Usa ↑↓ y ⏎ en el panel izquierdo',
46
47
  idle3: 'F1 proyectos · F2 chat', bar1: 'proyectos', bar2: 'chat', bar3: 'minimizar',
48
+ selHint: 'Ctrl+C o clic derecho: copiar · Esc: quitar la selección',
47
49
  searchPh: 'buscar conversación o proyecto…', found: (n) => `${n} ${n === 1 ? 'resultado' : 'resultados'}`, noRes: (q) => `Sin resultados para «${q}»`,
48
50
  searchingContent: 'Buscando dentro de las conversaciones…', tryContent: 'Pulsa Tab para buscar también dentro del contenido', inContent: 'en el contenido', kClear: 'limpiar', kEdit: 'editar', kEsc: 'salir',
49
51
  inside: 'Ya estás dentro de Hopdeck (F1 para ir a la lista de proyectos).',
@@ -66,8 +68,9 @@ const T = {
66
68
  prevHint: '⏎ resume this conversation', bar8: 'git', gitNone: 'Pick a project', gitNoRepo: 'This folder is not a git repository', gitMissing: 'git is not installed', gitErr: 'Could not read the repository', gitClean: 'clean', gitDirty: (n) => (n === 1 ? '1 uncommitted change' : `${n} uncommitted changes`), gitMore: (n) => `… and ${n} more`, gitBranches: 'Recent branches', gitActivity: 'Branch activity', gitNoActivity: 'No branch changes', gitFrom: 'from', gitNarrow: (n) => `Terminal too narrow: the git panel needs ${n} columns`, gitOnlyEmbed: 'The git panel is only in the built-in terminal', prevInfo: (a, n) => `${a === 'now' ? 'just now' : a + ' ago'} · last ${n} messages`, kUnfold: 'unfold', kRename: 'rename', kPin: 'pin', kHelp: 'help', noPrev: 'No messages to show',
67
69
  bar6: 'hide list', bar7: 'show list', deep: 'content', pathPrompt: 'new folder name', mkIn: 'created in', fbTitle: 'Pick a folder', fbHere: 'Open chat here', fbNew: 'New folder here…', fbUp: 'Go up', fbProj: 'project', fbHint: '⏎ enter · ␣ open · / find · . hidden', fbDrives: 'This PC', fbRecent: 'recent', hoverMiss: (n) => `[Image #${n}]: not in the history yet`, fbEmpty: 'No subfolders', badId: 'Invalid session id',
68
70
  imgClickHint: 'click: open full size', imgOpened: (n) => `[Image #${n}] opened in the image viewer`,
69
- unknownCmd: (c) => `Unknown command: "${c}"`, didYouMean: (s) => `Did you mean "${s}"?`, cmdList: 'Commands: hopdeck shortcut on|off · theme light|dark|auto · uninstall · doctor · help (and --list, --version).\nclaude options (for example --model opus) are passed through as they are: hopdeck --model opus',
71
+ unknownCmd: (c) => `Unknown command: "${c}"`, didYouMean: (s) => `Did you mean "${s}"?`, cmdList: 'Commands: hopdeck shortcut on|off · theme light|dark|auto · mascot · uninstall · doctor · help (and --list, --version).\nclaude options (for example --model opus) are passed through as they are: hopdeck --model opus',
70
72
  themeNow: (n) => `${n === 'light' ? 'Light' : 'Dark'} theme (saved)`,
73
+ mascotUsage: 'Usage: hopdeck mascot · hopdeck mascot --size small|normal|large · hopdeck mascot --plain (no colors)',
71
74
  themeUsage: 'Usage: hopdeck theme light · hopdeck theme dark · hopdeck theme auto (follow the terminal) · hopdeck theme (show the current one)',
72
75
  themeShow: (saved, eff, from, env) => `Saved theme: ${saved}.\nIn use: ${eff}` + (env ? ' (the HOPDECK_THEME variable takes priority over the saved one).' : from === 'auto' ? ' (auto: dark unless the terminal says it has a light background).' : '.'),
73
76
  shortcutUsage: 'Usage: hopdeck shortcut on (install the claude shortcut) · hopdeck shortcut off (remove it)',
@@ -89,6 +92,7 @@ const T = {
89
92
  'F1 F2 focus list / chat', 'F3 copy text (mouse)', 'F4 hide the list', 'b F8 git panel', 't F9 light / dark theme', '⠋ ✔ ● working · done · open', 'q quit'],
90
93
  bar4: 'copy text', bar5: 'mouse', up: (n, pct) => `↑ ${n} lines${pct >= 0 ? ` (${pct}%)` : ''} · PgDn/End`, loading: 'Loading projects', opening: 'Opening conversation', close: 'close', idle1: 'Pick a conversation', idle2: 'Use ↑↓ and ⏎ in the left pane',
91
94
  idle3: 'F1 projects · F2 chat', bar1: 'projects', bar2: 'chat', bar3: 'minimize',
95
+ selHint: 'Ctrl+C or right click: copy · Esc: clear the selection',
92
96
  searchPh: 'search conversation or project…', found: (n) => `${n} ${n === 1 ? 'result' : 'results'}`, noRes: (q) => `No results for “${q}”`,
93
97
  searchingContent: 'Searching inside the conversations…', tryContent: 'Press Tab to also search inside the content', inContent: 'in content', kClear: 'clear', kEdit: 'edit', kEsc: 'exit',
94
98
  inside: 'You are already inside Hopdeck (F1 jumps to the project list).',
package/lib/mascot.js ADDED
@@ -0,0 +1,149 @@
1
+ 'use strict';
2
+ // La mascota de Hopdeck: un sapo naranja con auriculares. Son 64×64 píxeles con transparencia que se dibujan con medios bloques
3
+ // (▀ ▄) al tamaño que quepa. Los píxeles van comprimidos (zlib + base64) para no depender de ningún archivo de imagen.
4
+ const zlib = require('zlib');
5
+ const { TRUE, R } = require('./style');
6
+
7
+ const SIZE = 64;
8
+ const PIXELS = zlib.inflateSync(Buffer.from(
9
+ 'eNrtewd8VNW2N+WWh42SOpmZc2ZOL3OmlxSSANI7QighCT10AtJ7syCKFEFEAQXlXgXUawMUBNQrCOpFrCBypVdBIQnJlP/Z3++c' +
10
+ 'gPJ83vt9n4r63nP/fiszk7P32uu/9tprr732PrVq/V5+L7+XX7nUvo7+p+Osm5+f/weDatWqVeeH6xTUvfq87v8QndS5iucHC8dx' +
11
+ 'f7bZbPUKavD+QCmoW+tfPvtt475ebgOnwithWZRHyYK8WuClHRwvf8Ry4hGGk45xnHxQ4OVdEi89LYvyVJ6XmzMMU/97/Or894Be' +
12
+ '8C1ukRE1SZDmC4JykGZlksEoJJ1RzU+KlYmTkwjDyaTmmUzSnAqxMIr5m+flkyIvrWRZMfuHeP9G57g5Rg6HKEq8tJbh5KjFqRAr' +
13
+ 'LZCwqiT6NnZH57XzRv/a3RfbWhKI7+4fiL8zI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 /** La misma mascota sin colores, para NO_COLOR o --plain. */
104
+ const ASCII = " .-============-.\n .-' _ _ '-.\n / (o) (o) \\\\\n .---|---. .. .---|---.\n | >_ | \\____/ | |\n '---|---' '---|---'\n \\ .------. /\n '._ \\____/ _.-'\n '----------'\n /_||_\\\\";
105
+
106
+ /** Color del píxel (r, g, b) de la celda (x, y) de una versión de n×n: promedio de los píxeles que cubre, o null si es transparente. */
107
+ function sample(x, y, n) {
108
+ const x0 = Math.floor((x * SIZE) / n), x1 = Math.max(x0 + 1, Math.floor(((x + 1) * SIZE) / n));
109
+ const y0 = Math.floor((y * SIZE) / n), y1 = Math.max(y0 + 1, Math.floor(((y + 1) * SIZE) / n));
110
+ let a = 0, r = 0, g = 0, b = 0, cnt = 0;
111
+ for (let yy = y0; yy < y1 && yy < SIZE; yy++) {
112
+ for (let xx = x0; xx < x1 && xx < SIZE; xx++) {
113
+ const i = (yy * SIZE + xx) * 4, al = PIXELS[i + 3];
114
+ cnt++; a += al; r += PIXELS[i] * al; g += PIXELS[i + 1] * al; b += PIXELS[i + 2] * al;
115
+ }
116
+ }
117
+ if (!cnt || !a || a / cnt < 100) return null; // casi transparente
118
+ return [Math.round(r / a), Math.round(g / a), Math.round(b / a)];
119
+ }
120
+
121
+ const c256 = ([r, g, b]) => { const q = (v) => Math.round((v / 255) * 5); return 16 + 36 * q(r) + 6 * q(g) + q(b); };
122
+ const col = (c, bg) => (TRUE ? `\x1b[${bg ? 48 : 38};2;${c[0]};${c[1]};${c[2]}m` : `\x1b[${bg ? 48 : 38};5;${c256(c)}m`);
123
+ /** Cada celda son dos píxeles: ▀ con el de arriba de color de letra y el de abajo de fondo. Lo transparente deja ver el fondo del terminal. */
124
+ function cell(top, bottom) {
125
+ if (!top && !bottom) return ' ';
126
+ if (top && !bottom) return col(top) + '▀' + R;
127
+ if (!top && bottom) return col(bottom) + '▄' + R;
128
+ return col(top) + col(bottom, true) + '▀' + R;
129
+ }
130
+
131
+ const CACHE = new Map();
132
+ /** Filas de texto (n celdas de ancho, n/2 de alto) con la mascota a n×n píxeles. */
133
+ function render(n) {
134
+ n = Math.max(2, Math.min(SIZE, n & ~1));
135
+ if (CACHE.has(n)) return CACHE.get(n);
136
+ const rows = [];
137
+ for (let y = 0; y < n; y += 2) {
138
+ let line = '';
139
+ for (let x = 0; x < n; x++) line += cell(sample(x, y, n), sample(x, y + 1, n));
140
+ rows.push(line);
141
+ }
142
+ CACHE.set(n, rows);
143
+ return rows;
144
+ }
145
+
146
+ /** El mayor tamaño que cabe en `maxCols` columnas y `maxRows` filas, o 0 si ni el más pequeño. */
147
+ const sizeFor = (maxCols, maxRows) => [48, 40, 32, 24, 16].find((n) => n <= maxCols && n / 2 <= maxRows) || 0;
148
+
149
+ module.exports = { SIZE, ASCII, render, sizeFor };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hopdeck",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "Selector visual de proyectos y conversaciones para Claude Code, en la terminal: salta entre proyectos sin hacer cd.",
5
5
  "author": "fabriciodev26",
6
6
  "license": "MIT",