hopdeck 1.2.2 → 1.2.4

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,20 @@
1
1
  # Cambios
2
2
 
3
+ ## 1.2.4
4
+
5
+ ### Nuevo
6
+ - **Logotipo con el texto convertido a trazados** (Inter 800): se ve igual en cualquier equipo y en la página de npm, sin depender de la fuente instalada. Se añaden copias PNG en `docs/`.
7
+ - **Imagen real al pasar el cursor por `[Image #N]`** en terminales con Sixel (Windows Terminal 1.22 o posterior, iTerm2, WezTerm, foot, Konsole…). Hopdeck pregunta al terminal si lo admite y, si es así, dibuja la imagen con todos sus píxeles dentro del cuadro del hover; el texto del chat que queda debajo se repinta al apartar el cursor. Si no lo admite se mantiene la vista de bloques. `HOPDECK_SIXEL=1` lo fuerza y `HOPDECK_SIXEL=0` lo desactiva.
8
+ - **Clic en `[Image #N]` abre la imagen en grande** en el visor de imágenes del sistema, a su tamaño real. La vista rápida del terminal solo puede dibujar dos píxeles por carácter: una captura de pantalla de 1917 px de ancho quedaba en unos 50 y no se podía leer. Arrastrar para copiar texto y hacer clic en otro texto siguen igual. El cuadro del hover avisa («clic: abrir en grande») y es algo más grande.
9
+
10
+ ## 1.2.3
11
+
12
+ ### Cambiado
13
+ - **`hopdeck uninstall` desinstala de verdad.** Antes solo quitaba el atajo de `claude` y Hopdeck seguía instalado (`hopdeck --version` seguía funcionando). Ahora quita el atajo de tu perfil, borra tus preferencias y la caché y desinstala el programa (`npm uninstall -g hopdeck`). Pregunta antes; sin terminal exige `--yes`. No toca tu historial de Claude Code ni las copias de seguridad de tus perfiles.
14
+ - **El atajo de `claude` se gestiona con `hopdeck shortcut on` y `hopdeck shortcut off`** (antes `hopdeck install` y `hopdeck uninstall`).
15
+ - **Una sola forma para cada comando:** `hopdeck shortcut on|off`, `hopdeck uninstall`, `hopdeck doctor` y `hopdeck help`. Se retiran las variantes que la 1.2.2 aceptaba (`--install`, `--uninstall`, `--doctor` y los alias en español): ahora dan un error que sugiere el comando correcto, en lugar de ejecutarse.
16
+ - **Las erratas con guiones también avisan:** `hopdeck --unistall` abría Hopdeck en silencio y le pasaba esa opción a `claude`. Ahora una opción con guiones que se parece a un comando da el mismo error con sugerencia. Las opciones reales de `claude` (`--model`, `--resume`, `-p`…) se siguen pasando tal cual.
17
+
3
18
  ## 1.2.2
4
19
 
5
20
  ### Corregido
package/README.en.md CHANGED
@@ -53,9 +53,9 @@ Done. You can also try it without installing: `npx hopdeck`.
53
53
  - `claude` alone → opens Hopdeck.
54
54
  - `claude <any argument>` (`-p`, `--resume`, `--model`…) → works exactly as usual.
55
55
 
56
- You can say no and always use `hopdeck`. If you change your mind: `hopdeck install`.
56
+ You can say no and always use `hopdeck`. If you change your mind: `hopdeck shortcut on`.
57
57
 
58
- **Remove it:** `hopdeck uninstall`. To skip it once: `HOPDECK_SKIP=1 claude`.
58
+ **Remove only the shortcut:** `hopdeck shortcut off`. **Uninstall Hopdeck completely:** `hopdeck uninstall` (asks first; removes the shortcut, your preferences and cache, and the program). To skip the shortcut once: `HOPDECK_SKIP=1 claude`.
59
59
 
60
60
  **Something wrong?** Run `hopdeck doctor`: it checks your setup and tells you how to fix whatever is missing.
61
61
 
@@ -130,7 +130,7 @@ It always starts at `~`. Recently used folders appear on top (`↻ recent`).
130
130
 
131
131
  ![Floating box with the image when hovering [Image #1]](docs/screenshots/04-hover-imagen.svg)
132
132
 
133
- - If a chat shows `[Image #3]` (an image you already sent), **hover it** and a box shows that image without covering the rest of the chat.
133
+ - If a chat shows `[Image #3]` (an image you already sent), **hover it** and a quick preview appears without covering the rest of the chat. A terminal can only draw a small version (two pixels per character), so a screenshot with text is not legible: **click the marker** and it opens full size, at its real resolution, in your system's image viewer.
134
134
  - `i` / `F7` opens a **gallery** with all the conversation's images (`← →` navigate, `o` opens it in the system viewer, `Esc` closes).
135
135
  - An image you just pasted and have not sent yet **cannot** be shown: it is not in the history yet.
136
136
 
@@ -155,13 +155,14 @@ It always starts at `~`. Recently used folders appear on top (`↻ recent`).
155
155
  | Command | What it does |
156
156
  |---|---|
157
157
  | `hopdeck` | Opens Hopdeck |
158
- | `hopdeck install` / `hopdeck uninstall` | Installs or removes the shortcut so that `claude` opens Hopdeck |
158
+ | `hopdeck shortcut on` / `hopdeck shortcut off` | Installs or removes the shortcut so that `claude` opens Hopdeck |
159
+ | `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 |
159
160
  | `hopdeck doctor` | Checks your setup and tells you how to fix whatever is missing |
160
161
  | `hopdeck --list` | Lists the projects as plain text |
161
162
  | `hopdeck --version` | Shows the version |
162
163
  | `hopdeck --model opus` | Anything starting with `-` is passed to `claude` when opening chats |
163
164
 
164
- A word that is not a command (for example `hopdeck unistall`) gives an error with a suggestion instead of opening Hopdeck.
165
+ Each command has **one single form**. Any other word, or a variant such as `install`, `--uninstall`, `desinstalar` or `unistall`, gives an error that suggests the right command and neither opens Hopdeck nor does anything.
165
166
 
166
167
  ## Compatibility
167
168
 
@@ -179,6 +180,7 @@ You almost never need to change anything. The most useful options:
179
180
  |---|---|
180
181
  | `HOPDECK_LANG` | `es` or `en` (default: system language) |
181
182
  | `HOPDECK_THEME` | `light` for light backgrounds |
183
+ | `HOPDECK_SIXEL` | `1` forces the real image when hovering `[Image #N]`, `0` always uses blocks (auto-detected by default) |
182
184
  | `NO_COLOR` | Disable colors |
183
185
  | `CLAUDE_CONFIG_DIR` | Claude Code folder, if it is not `~/.claude` |
184
186
  | `HOPDECK_SKIP=1` | Skip Hopdeck once: `HOPDECK_SKIP=1 claude` |
@@ -206,7 +208,7 @@ Other variables: `HOPDECK_EMBED=1` forces the built-in terminal, `HOPDECK_NOTMUX
206
208
 
207
209
  - **Nothing is sent to the internet.** No telemetry, no analytics, no network requests. Everything happens on your machine.
208
210
  - It reads your local Claude Code history and launches the `claude` you already have. It does not touch your session or your credentials.
209
- - It only writes its preferences and cache (in your home folder), the `hopdeck install` block in your shell profile and, if you rename a conversation, that conversation's title.
211
+ - It only writes its preferences and cache (in your home folder), the `hopdeck shortcut on` block in your shell profile and, if you rename a conversation, that conversation's title.
210
212
 
211
213
  More details, and how to report a security problem: [SECURITY.md](SECURITY.md).
212
214
 
@@ -226,7 +228,7 @@ Always start with `hopdeck doctor`.
226
228
 
227
229
  **I can't select text with the mouse.** Press `F3` to turn Hopdeck's mouse off, or hold `Shift` while dragging.
228
230
 
229
- **I want `claude` back to normal.** `hopdeck uninstall`, or `HOPDECK_SKIP=1 claude` to skip it once.
231
+ **I want `claude` back to normal.** `hopdeck shortcut off`, or `HOPDECK_SKIP=1 claude` to skip it once.
230
232
 
231
233
  **It looks wrong in my terminal.** Try `HOPDECK_THEME=light` (light background) or `NO_COLOR=1`.
232
234
 
package/README.md CHANGED
@@ -53,9 +53,9 @@ Listo. También puedes probarlo sin instalar: `npx hopdeck`.
53
53
  - `claude` solo → abre Hopdeck.
54
54
  - `claude <cualquier argumento>` (`-p`, `--resume`, `--model`…) → funciona exactamente igual que siempre.
55
55
 
56
- Puedes decir que no y usar siempre `hopdeck`. Si cambias de idea: `hopdeck install`.
56
+ Puedes decir que no y usar siempre `hopdeck`. Si cambias de idea: `hopdeck shortcut on`.
57
57
 
58
- **Quitarlo:** `hopdeck uninstall`. Para saltarlo una sola vez: `HOPDECK_SKIP=1 claude`.
58
+ **Quitar solo el atajo:** `hopdeck shortcut off`. **Desinstalar Hopdeck por completo:** `hopdeck uninstall` (pregunta antes; quita el atajo, tus preferencias y la caché, y el programa). Para saltar el atajo una sola vez: `HOPDECK_SKIP=1 claude`.
59
59
 
60
60
  **¿Algo no va bien?** Ejecuta `hopdeck doctor`: revisa tu instalación y dice cómo arreglar lo que falte.
61
61
 
@@ -130,7 +130,7 @@ Empieza siempre en `~`. Las carpetas que usaste hace poco aparecen arriba (`↻
130
130
 
131
131
  ![Cuadro flotante con la imagen al pasar el cursor por [Image #1]](docs/screenshots/04-hover-imagen.svg)
132
132
 
133
- - Si en un chat ves `[Image #3]` (una imagen que ya enviaste), **pasa el cursor por encima** y aparece un cuadro con esa imagen, sin tapar el resto del chat.
133
+ - Si en un chat ves `[Image #3]` (una imagen que ya enviaste), **pasa el cursor por encima** y aparece una vista rápida, sin tapar el resto del chat. En un terminal solo se puede dibujar una versión pequeña (dos píxeles por carácter), así que una captura con texto no se lee: **haz clic sobre la marca** y se abre en grande, a su tamaño real, en el visor de imágenes de tu sistema.
134
134
  - `i` / `F7` abre una **galería** con todas las imágenes de la conversación (`← →` navegan, `o` la abre en el visor del sistema, `Esc` cierra).
135
135
  - Una imagen recién pegada y aún sin enviar **no** se puede mostrar: todavía no está en el historial.
136
136
 
@@ -155,13 +155,14 @@ Empieza siempre en `~`. Las carpetas que usaste hace poco aparecen arriba (`↻
155
155
  | Comando | Qué hace |
156
156
  |---|---|
157
157
  | `hopdeck` | Abre Hopdeck |
158
- | `hopdeck install` / `hopdeck uninstall` | Instala o quita el atajo para que `claude` abra Hopdeck |
158
+ | `hopdeck shortcut on` / `hopdeck shortcut off` | Instala o quita el atajo para que `claude` abra Hopdeck |
159
+ | `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 |
159
160
  | `hopdeck doctor` | Revisa tu instalación y dice cómo arreglar lo que falte |
160
161
  | `hopdeck --list` | Lista los proyectos en texto plano |
161
162
  | `hopdeck --version` | Muestra la versión |
162
163
  | `hopdeck --model opus` | Lo que empiece por `-` se pasa a `claude` al abrir chats |
163
164
 
164
- Una palabra que no es un comando (por ejemplo `hopdeck unistall`) da un error con una sugerencia, en vez de abrir Hopdeck.
165
+ Cada comando tiene **una sola forma**. Cualquier otra palabra, o una variante como `install`, `--uninstall`, `desinstalar` o `unistall`, da un error que sugiere el comando correcto y no abre Hopdeck ni hace nada.
165
166
 
166
167
  ## Compatibilidad
167
168
 
@@ -179,6 +180,7 @@ Casi nunca hace falta tocar nada. Lo más útil:
179
180
  |---|---|
180
181
  | `HOPDECK_LANG` | `es` o `en` (por defecto, el idioma del sistema) |
181
182
  | `HOPDECK_THEME` | `light` para fondos claros |
183
+ | `HOPDECK_SIXEL` | `1` fuerza la imagen real al pasar el cursor por `[Image #N]`, `0` usa siempre bloques (por defecto se detecta) |
182
184
  | `NO_COLOR` | Quita los colores |
183
185
  | `CLAUDE_CONFIG_DIR` | Carpeta de Claude Code, si no es `~/.claude` |
184
186
  | `HOPDECK_SKIP=1` | Salta Hopdeck una vez: `HOPDECK_SKIP=1 claude` |
@@ -206,7 +208,7 @@ Otras variables: `HOPDECK_EMBED=1` fuerza el terminal integrado, `HOPDECK_NOTMUX
206
208
 
207
209
  - **No envía nada a internet.** Sin telemetría, sin analítica, sin peticiones de red. Todo ocurre en tu equipo.
208
210
  - Lee tu historial local de Claude Code y lanza el `claude` que ya tienes. No toca tu sesión ni tus credenciales.
209
- - Solo escribe sus preferencias y su caché (en tu carpeta de usuario), el bloque de `hopdeck install` en tu perfil de shell y, si renombras una conversación, el título de esa conversación.
211
+ - Solo escribe sus preferencias y su caché (en tu carpeta de usuario), el bloque de `hopdeck shortcut on` en tu perfil de shell y, si renombras una conversación, el título de esa conversación.
210
212
 
211
213
  Más detalles, y cómo avisar de un problema de seguridad: [SECURITY.md](SECURITY.md).
212
214
 
@@ -226,7 +228,7 @@ Empieza siempre por `hopdeck doctor`.
226
228
 
227
229
  **No puedo seleccionar texto con el ratón.** Pulsa `F3` para apagar el ratón de Hopdeck, o mantén `Shift` mientras arrastras.
228
230
 
229
- **Quiero que `claude` vuelva a ser el de siempre.** `hopdeck uninstall`, o `HOPDECK_SKIP=1 claude` para saltarlo una vez.
231
+ **Quiero que `claude` vuelva a ser el de siempre.** `hopdeck shortcut off`, o `HOPDECK_SKIP=1 claude` para saltarlo una vez.
230
232
 
231
233
  **Se ve mal en mi terminal.** Prueba `HOPDECK_THEME=light` (fondo claro) o `NO_COLOR=1`.
232
234
 
package/SECURITY.md CHANGED
@@ -6,7 +6,8 @@
6
6
  - Escribe solo en tu equipo:
7
7
  - `~/.hopdeck.json` (preferencias: proyectos fijados, ocultos, recientes…) y `~/.hopdeck-cache.json` (índice de títulos y primeros mensajes, con permisos solo para tu usuario).
8
8
  - Una carpeta temporal privada con las imágenes cuando abres la galería con `o` (se borra al salir).
9
- - Con `hopdeck install`, un bloque marcado en el perfil de tu shell (`~/.bashrc`, `~/.zshrc`, perfil de PowerShell…). Antes guarda una copia `<perfil>.hopdeck-backup` (la primera, sin sobrescribirla). `hopdeck uninstall` quita el bloque.
9
+ - Con `hopdeck shortcut on`, un bloque marcado en el perfil de tu shell (`~/.bashrc`, `~/.zshrc`, perfil de PowerShell…). Antes guarda una copia `<perfil>.hopdeck-backup` (la primera, sin sobrescribirla). `hopdeck shortcut off` quita el bloque.
10
+ - `hopdeck uninstall` (siempre con tu confirmación, o `--yes`) quita ese bloque, borra tus preferencias y la caché, y ejecuta `npm uninstall -g hopdeck`. No toca tu historial de Claude Code ni las copias de seguridad de los perfiles.
10
11
  - Al renombrar una conversación (`R`), añade una línea `custom-title` al final de su archivo `.jsonl`, igual que hace Claude Code.
11
12
  - Ejecuta el comando `claude` que encuentre en tu `PATH`. Si alguien puede cambiar tu `PATH`, puede cambiar qué se ejecuta (como con cualquier programa).
12
13
  - Lo que se muestra en pantalla procedente del historial (títulos, mensajes, rutas) se limpia de caracteres de control y secuencias de escape antes de dibujarse.
@@ -11,6 +11,10 @@ y cada una conserva su propia licencia.
11
11
 
12
12
  Ninguna dependencia ejecuta scripts de instalación (`npm audit`: 0 vulnerabilidades conocidas a la fecha de la versión 1.2.0).
13
13
 
14
+ ## Tipografía del logotipo
15
+
16
+ El texto de `docs/logo-*.svg` y `docs/logo-*.png` está convertido a trazados a partir de la fuente [Inter](https://rsms.me/inter/) (peso 800), con licencia SIL Open Font License 1.1, que permite este uso. No se distribuye la fuente.
17
+
14
18
  ## Marcas
15
19
 
16
20
  "Claude" y "Claude Code" son marcas de Anthropic, PBC. Este proyecto es independiente: **no está afiliado, respaldado ni patrocinado por Anthropic**.
package/bin/hopdeck.js CHANGED
@@ -17,6 +17,7 @@ const { baseName, tidy, home, shortPath, fuzzy, wrapText } = require('../lib/tex
17
17
  const hist = require('../lib/history');
18
18
  const { CONFIG_DIR, CACHE_FILE, textOf, isType, cacheLoad, cacheSave, readSession, decodeDir, projectDirs, buildProject, beginScan, endScan } = hist;
19
19
  const images = require('../lib/images');
20
+ const { encodeSixel } = require('../lib/sixel');
20
21
  const { collectImages, decodePNG, decodeImage, scaleBox, fitSize, halfBlocks } = images;
21
22
  const { parseKeys, KEYMAP, printable, editBuf, normalizeKeys } = require('../lib/keys');
22
23
  const { stripJsonc, wtCtrlV, wtSettingsFile } = require('../lib/windows-terminal');
@@ -126,7 +127,7 @@ function ago(ms) {
126
127
  const S = { qpos: 0, pc: 0, fb: null, confirmMk: null, confirmClose: null, more: new Set(), qs: null, promptKind: 'folder', renameTarget: null, deep: false, deepHits: null, showHidden: false, prompt: null, help: false, loading: false, projects: [], pi: 0, si: 0, focus: 0, query: '', searching: false, poff: 0, soff: 0, flash: '', c: 0, coff: 0, open: null, live: new Set(), liveKey: '' };
127
128
  const SIDEBAR = process.argv.includes('--sidebar');
128
129
  let EMBED = false; // vista dividida con terminal embebido (Windows / sin tmux)
129
- const E = { sessions: new Map(), shown: null, focus: 'left', pend: null, deps: null, mouse: CFG.mouse !== false, hideSide: false, note: null, sel: null, gallery: null, hover: null };
130
+ const E = { sessions: new Map(), shown: null, focus: 'left', pend: null, deps: null, mouse: CFG.mouse !== false, hideSide: false, note: null, sel: null, gallery: null, hover: null, sixelDetected: false, cell: { w: 10, h: 20 }, sixelKey: null, sixelAt: 0, sixelStale: false, sixelRetry: null };
130
131
  const SPIN = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
131
132
  let spinT = null, frameN = 0, reloading = false;
132
133
  const needsSpin = () => S.loading || (E.gallery && (E.gallery.loading || E.gallery.pending)) || (E.hover && E.hover.g.pending) || [...E.sessions.values()].some((x) => x.working || (!x.ready && x === E.sessions.get(E.shown)));
@@ -906,6 +907,7 @@ async function imagesOf(x) {
906
907
 
907
908
  /** Abre un archivo o carpeta con el programa por defecto del sistema. */
908
909
  function openExternal(target) {
910
+ if (process.env.HOPDECK_OPEN_LOG) { try { fs.appendFileSync(process.env.HOPDECK_OPEN_LOG, target + '\n'); } catch { /* */ } return; } // pruebas: no se abre ningún visor
909
911
  const quiet = (cmd, args) => { try { const c = cp.spawn(cmd, args, { stdio: 'ignore', detached: true, windowsHide: true }); c.on('error', () => {}); c.unref(); } catch { /* */ } };
910
912
  if (WIN) quiet('cmd', ['/c', 'start', '', target]);
911
913
  else if (process.platform === 'darwin') quiet('open', [target]);
@@ -960,6 +962,26 @@ async function shownSession(x) {
960
962
  return sess;
961
963
  }
962
964
 
965
+ // ── Imágenes reales (Sixel): se usan si el terminal las admite; si no, la vista rápida con medios bloques ──
966
+ /** HOPDECK_SIXEL=1 las fuerza, =0 las apaga; sin definir, se usan si el terminal dijo que las admite (consulta DA1 al arrancar). */
967
+ const sixelOn = () => process.env.HOPDECK_SIXEL === '1' || (process.env.HOPDECK_SIXEL !== '0' && E.sixelDetected);
968
+
969
+ /**
970
+ * Quita de la entrada las respuestas del terminal a nuestras consultas y las guarda en `st`:
971
+ * DA1 (ESC [ ? 61;4;… c): el atributo 4 significa que admite Sixel; y el tamaño en píxeles de una celda (ESC [ 6 ; alto ; ancho t).
972
+ */
973
+ function parseTermReplies(s, st) {
974
+ return s
975
+ .replace(/\x1b\[\?([0-9;]*)c/g, (m, attrs) => { st.sixelDetected = attrs.split(';').includes('4'); return ''; })
976
+ .replace(/\x1b\[6;(\d+);(\d+)t/g, (m, hh, ww) => { const h = +hh, w = +ww; if (h >= 4 && h <= 200 && w >= 2 && w <= 100) st.cell = { w, h }; return ''; });
977
+ }
978
+
979
+ /** Secuencia que coloca el cursor y dibuja la imagen. Con HOPDECK_SIXEL_LOG (pruebas) la ruta y los datos se anotan en un archivo y no se escribe nada. */
980
+ function emitSixel(row, col, data) {
981
+ if (process.env.HOPDECK_SIXEL_LOG) { try { fs.appendFileSync(process.env.HOPDECK_SIXEL_LOG, JSON.stringify({ row, col, data }) + '\n'); } catch { /* */ } return ''; }
982
+ return `\x1b[${row};${col}H` + data;
983
+ }
984
+
963
985
  /** Texto de una fila del terminal virtual y la columna de cada carácter (los de ancho 2 ocupan dos celdas). */
964
986
  function rowChars(term, y) {
965
987
  const b = term.buffer.active, line = b.getLine(b.viewportY + y), cols = []; let text = '';
@@ -1001,9 +1023,16 @@ function hoverPopup(hv, rw, th) {
1001
1023
  setImmediate(() => { let d = false; try { d = decodeImage(img) || false; } catch { d = false; } g.dec.set(0, d); g.pending = false; if (active) render(); });
1002
1024
  }
1003
1025
  const d = g.dec.get(0), lab = ` [Image #${hv.n}] `;
1004
- let rows, tw;
1005
- if (d && d.rgba) {
1006
- const sz = fitSize(d.w, d.h, Math.max(8, Math.min(rw - 4, 48)), Math.max(2, Math.min(th - 4, 16)) * 2), key = `${sz.tw}x${sz.th}`;
1026
+ let rows, tw, sx = null;
1027
+ if (d && d.rgba && sixelOn()) { // imagen real: se deja un hueco en blanco del tamaño de la imagen y se dibuja encima con Sixel
1028
+ const cw = E.cell.w, ch = E.cell.h, maxCols = Math.max(8, Math.min(rw - 6, 140)), maxRows = Math.max(2, th - 5);
1029
+ const k = Math.min((maxCols * cw) / d.w, (maxRows * ch) / d.h, 3);
1030
+ const iw = Math.max(1, Math.min(maxCols, Math.round((d.w * k) / cw))), ih = Math.max(1, Math.min(maxRows, Math.round((d.h * k) / ch))), key = `sx:${iw}x${ih}`;
1031
+ let data = g.cache.get(key);
1032
+ if (!data) { data = encodeSixel(scaleBox(d.rgba, d.w, d.h, iw * cw, ih * ch), iw * cw, ih * ch); g.cache.clear(); g.cache.set(key, data); }
1033
+ sx = { data, iw, ih, key }; tw = iw; rows = Array.from({ length: ih }, () => ' '.repeat(iw));
1034
+ } else if (d && d.rgba) {
1035
+ const sz = fitSize(d.w, d.h, Math.max(8, Math.min(rw - 6, 96)), Math.max(2, Math.min(th - 6, 18)) * 2), key = `${sz.tw}x${sz.th}`;
1007
1036
  let hb = g.cache.get(key);
1008
1037
  if (!hb) { hb = halfBlocks(scaleBox(d.rgba, d.w, d.h, sz.tw, sz.th), sz.tw, sz.th); g.cache.clear(); g.cache.set(key, hb); }
1009
1038
  rows = hb; tw = sz.tw;
@@ -1014,12 +1043,39 @@ function hoverPopup(hv, rw, th) {
1014
1043
  }
1015
1044
  const label = strW(lab) <= tw - 1 ? lab : '', b = C.accent;
1016
1045
  const box = [b + '╭─' + label + '─'.repeat(Math.max(0, tw - 1 - strW(label))) + '╮' + R,
1017
- ...rows.map((r) => b + '│' + R + r + b + '│' + R), b + '╰' + '─'.repeat(tw) + '╯' + R];
1046
+ ...rows.map((r) => b + '│' + R + r + b + '│' + R),
1047
+ (() => { const h = ` ${T.imgClickHint} `; return strW(h) <= tw - 1 ? b + '╰─' + C.dim + h + b + '─'.repeat(tw - 1 - strW(h)) + '╯' + R : b + '╰' + '─'.repeat(tw) + '╯' + R; })()];
1018
1048
  const bw = tw + 2, bh = box.length, left = clamp(hv.at.x, 0, Math.max(0, rw - bw));
1019
1049
  let top = hv.at.y + 1; // debajo de la marca; si no cabe, encima; si tampoco, pegado al borde
1020
1050
  if (top + bh > th) top = hv.at.y - bh;
1021
1051
  if (top < 0) top = Math.max(0, th - bh);
1022
- return { left, top, bw, rows: box };
1052
+ return { left, top, bw, rows: box, sixel: sx ? { ...sx, key: `${hv.k}|${sx.key}|${left},${top}` } : null };
1053
+ }
1054
+
1055
+ /** La imagen que corresponde a "[Image #n]" en la conversación de este chat, o null si aún no está en el historial. */
1056
+ async function imageForMarker(sh, n) {
1057
+ try {
1058
+ const sess = await shownSession(sh);
1059
+ if (!sess) return null;
1060
+ const imgs = await imagesOf(sess);
1061
+ let img = imgs.find((im) => im.n === n) || (imgs.some((im) => im.n) ? null : imgs[n - 1]) || null;
1062
+ if (!img && imgs.length >= maxImages()) img = await images.findImageByNumber(sess.file, n); // pasó el límite de la galería: se busca en todo el archivo
1063
+ return img;
1064
+ } catch { return null; }
1065
+ }
1066
+
1067
+ /**
1068
+ * Clic en un "[Image #N]": abre esa imagen en el visor del sistema, a su tamaño real. En el terminal solo se puede dibujar una
1069
+ * vista rápida (dos píxeles por carácter): una captura de pantalla con texto de 1917 px de ancho queda en unos 50 y no se lee.
1070
+ */
1071
+ async function openMarkerImage(sh, n) {
1072
+ const img = await imageForMarker(sh, n);
1073
+ const note = (t) => { E.note = { t, until: Date.now() + 2500 }; scheduleRender(); };
1074
+ if (!img) return note(T.hoverMiss(n));
1075
+ const { files } = exportImages([img]);
1076
+ if (!files[0]) return note(T.imgNoPrev); // no es una imagen reconocible: no se abre
1077
+ openExternal(files[0]);
1078
+ note(T.imgOpened(n));
1023
1079
  }
1024
1080
 
1025
1081
  function hoverChat(sh, x, y) {
@@ -1035,15 +1091,7 @@ function hoverChat(sh, x, y) {
1035
1091
  const hv = { n, k, at, g: { project: sh.project, title: sh.title, images: [], i: 0, loading: true, pending: false, dec: new Map(), cache: new Map() } };
1036
1092
  E.hover = hv; scheduleRender();
1037
1093
  (async () => {
1038
- let img = null;
1039
- try {
1040
- const sess = await shownSession(sh);
1041
- if (sess) {
1042
- const imgs = await imagesOf(sess);
1043
- img = imgs.find((im) => im.n === n) || (imgs.some((im) => im.n) ? null : imgs[n - 1]) || null;
1044
- if (!img && imgs.length >= maxImages()) img = await images.findImageByNumber(sess.file, n); // pasó el límite de la galería: se busca en todo el archivo
1045
- }
1046
- } catch { img = null; }
1094
+ const img = await imageForMarker(sh, n);
1047
1095
  if (E.hover !== hv) return; // el cursor ya se fue
1048
1096
  if (!img) { hv.g.loading = false; E.note = { t: T.hoverMiss(n), until: Date.now() + 2000 }; return scheduleRender(); }
1049
1097
  hv.g.images = [img]; hv.g.loading = false; scheduleRender();
@@ -1179,12 +1227,22 @@ function renderEmbed() {
1179
1227
  ...k('F1', T.bar1), ...k('F2', T.bar2), ...k('F3', E.mouse ? T.bar4 : T.bar5), ...k('F4', E.hideSide ? T.bar7 : T.bar6),
1180
1228
  [live ? '● ' + live : '', C.ok]], W));
1181
1229
  const changes = diffRows(rowsOut);
1230
+ // imagen real (Sixel) sobre el hueco del cuadro: se dibuja al aparecer y se repite si algo reescribe esas filas (con un mínimo de 150 ms entre dibujos)
1231
+ let sx = '';
1232
+ if (pop && pop.sixel) {
1233
+ const top = pop.top + 3, touched = lastChanged.some((y) => y >= top && y < top + pop.sixel.ih);
1234
+ if (E.sixelKey !== pop.sixel.key || touched || E.sixelStale) {
1235
+ const now = Date.now();
1236
+ if (E.sixelKey === pop.sixel.key && now - E.sixelAt < 150) { E.sixelStale = true; if (!E.sixelRetry) E.sixelRetry = setTimeout(() => { E.sixelRetry = null; scheduleRender(); }, 160); }
1237
+ else { sx = emitSixel(pop.top + 4, (SW ? SW + 2 : 1) + pop.left + 1, pop.sixel.data); E.sixelKey = pop.sixel.key; E.sixelAt = now; E.sixelStale = false; }
1238
+ }
1239
+ } else if (E.sixelKey) { E.sixelKey = null; E.sixelStale = false; } // al quitar el cuadro, las filas que cubría ya se reescriben solas con el texto del chat
1182
1240
  let cur = '';
1183
1241
  if (sh && sh.ready && E.focus === 'right' && !sh.cursorHidden && back === 0) {
1184
1242
  const b = sh.term.buffer.active;
1185
1243
  cur = `\x1b[${Math.min(th, b.cursorY + 1) + 2};${(SW ? SW + 1 : 0) + 1 + Math.min(rw - 1, b.cursorX)}H\x1b[?25h`;
1186
1244
  }
1187
- process.stdout.write((changes ? '\x1b[?2026h\x1b[?25l' + changes : '\x1b[?25l') + cur + (changes ? '\x1b[?2026l' : ''));
1245
+ process.stdout.write((changes || sx ? '\x1b[?2026h\x1b[?25l' + changes + sx : '\x1b[?25l') + cur + (changes || sx ? '\x1b[?2026l' : ''));
1188
1246
  }
1189
1247
 
1190
1248
  function scheduleRender() {
@@ -1340,6 +1398,10 @@ function onMouse(b, x, y, type) {
1340
1398
  if ((b & 32) && (b & 3) === 0) { if (E.sel && E.sel.down) { E.sel.b = cell(); render(); } return; } // arrastre
1341
1399
  if (type === 'm') { // soltar: copiar la selección
1342
1400
  const sl = E.sel; E.sel = null;
1401
+ 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
1402
+ const hit = imageMarkerAt(sh.term, sl.a.y, sl.a.x);
1403
+ if (hit) openMarkerImage(sh, hit.n);
1404
+ }
1343
1405
  if (sl && sl.down && (sl.a.x !== sl.b.x || sl.a.y !== sl.b.y) && sh) {
1344
1406
  const t = selText(sh, sl);
1345
1407
  if (t) { copyText(t); E.note = { t: T.copied(t.length), until: Date.now() + 3000 }; }
@@ -1457,10 +1519,11 @@ function embedKillAll() { for (const sess of E.sessions.values()) { try { sess.p
1457
1519
  // Redibujado diferencial: solo se reescriben las filas que cambiaron desde el último cuadro.
1458
1520
  let lastRows = [], forceFull = true;
1459
1521
  const invalidate = () => { forceFull = true; };
1522
+ let lastChanged = []; // índices de las filas que reescribió el último diffRows (si pisan una imagen Sixel hay que volver a dibujarla)
1460
1523
  function diffRows(rows) {
1461
- let out = '';
1524
+ let out = ''; lastChanged = [];
1462
1525
  for (let i = 0; i < rows.length; i++) {
1463
- if (forceFull || lastRows[i] !== rows[i]) out += `\x1b[${i + 1};1H` + rows[i];
1526
+ if (forceFull || lastRows[i] !== rows[i]) { out += `\x1b[${i + 1};1H` + rows[i]; lastChanged.push(i); }
1464
1527
  }
1465
1528
  lastRows = rows.slice(); forceFull = false;
1466
1529
  return out;
@@ -1480,7 +1543,7 @@ function render() {
1480
1543
  let active = false;
1481
1544
  function enter() {
1482
1545
  if (active) return; active = true; invalidate();
1483
- process.stdout.write('\x1b[?1049h\x1b[?25l\x1b[2J' + ((EMBED || SIDEBAR) && E.mouse ? mouseModes(true) : ''));
1546
+ process.stdout.write('\x1b[?1049h\x1b[?25l\x1b[2J' + ((EMBED || SIDEBAR) && E.mouse ? mouseModes(true) : '') + (EMBED && process.env.HOPDECK_SIXEL !== '0' ? '\x1b[c\x1b[16t' : '')); // consulta: ¿admite imágenes (Sixel)? ¿qué tamaño tiene una celda?
1484
1547
  process.stdin.setRawMode(true); process.stdin.resume();
1485
1548
  }
1486
1549
  function leave() {
@@ -1653,6 +1716,7 @@ async function run() {
1653
1716
  process.stdin.on('data', (buf) => {
1654
1717
  if (!active) return;
1655
1718
  let s = normalizeKeys(buf.toString('utf8'));
1719
+ if (EMBED) { s = parseTermReplies(s, E); if (!s) return; } // respuestas del terminal a las consultas del arranque
1656
1720
  if (EMBED) {
1657
1721
  s = s.replace(/\x1b\[<(\d+);(\d+);(\d+)([Mm])/g, (m, b, x, y, t) => { onMouse(+b, +x, +y, t); return ''; });
1658
1722
  if (!s) return;
@@ -1695,7 +1759,7 @@ function doctor() {
1695
1759
  else bad(T.dcNone, WIN ? T.dcNoneWin : T.dcNoneUnix);
1696
1760
  let wrapped = false;
1697
1761
  for (const t of targets()) { try { if (fs.readFileSync(t.file, 'utf8').includes(MARK_A)) wrapped = true; } catch { /* */ } }
1698
- wrapped ? ok(T.dcShort) : bad(T.dcNoShort, findClaude('hopdeck') ? T.dcNoShortHint : T.dcNoCmdHint); // sin el comando en el PATH, "hopdeck install" no existe todavía
1762
+ wrapped ? ok(T.dcShort) : bad(T.dcNoShort, findClaude('hopdeck') ? T.dcNoShortHint : T.dcNoCmdHint); // sin el comando en el PATH, "hopdeck shortcut on" no existe todavía
1699
1763
  ok(T.dcPrefs(shortPath(CFG_FILE), shortPath(CACHE_FILE)));
1700
1764
  if (process.env.WT_SESSION) { // dentro de Windows Terminal: Ctrl+V solo pega texto y no deja pegar imágenes
1701
1765
  const f = wtSettingsFile(); let st = null;
@@ -1817,6 +1881,34 @@ function install(remove, list = targets(), quiet = false) {
1817
1881
  return { done, baks };
1818
1882
  }
1819
1883
 
1884
+ /**
1885
+ * Desinstala Hopdeck por completo: quita el atajo del perfil, borra sus preferencias y su caché y ejecuta `npm uninstall -g hopdeck`.
1886
+ * Pregunta antes (sin terminal exige --yes). No toca el historial de Claude Code ni las copias de seguridad de tus perfiles.
1887
+ * HOPDECK_NO_NPM=1 no ejecuta npm (para las pruebas). Devuelve el código de salida.
1888
+ */
1889
+ async function uninstallAll({ yes = false, list = targets() } = {}) {
1890
+ const tty = process.stdin.isTTY && process.stdout.isTTY;
1891
+ if (!yes) {
1892
+ if (!tty) { console.error(`${C.warn}${T.unNeedYes}${R}`); return 2; }
1893
+ process.stdout.write(`\n ${C.text}${C.bold}${T.unQ}${R}\n ${C.dim}${T.unInfo}${R}\n\n ${C.accent}${T.unKeys}${R}\n`);
1894
+ const ans = await readKey((k) => (/^[sSyY]$/.test(k) ? 'yes' : /^[nN]$/.test(k) || k === '\r' || k === '\n' || k === '\x1b' ? 'no' : undefined));
1895
+ if (ans !== 'yes') { console.log(`\n ${C.dim}${T.unCancel}${R}`); return 0; }
1896
+ }
1897
+ const ok = (m) => console.log(` ${C.ok}✓${R} ${m}`), note = (m) => console.log(` ${C.dim}· ${m}${R}`);
1898
+ console.log('');
1899
+ const had = hasShortcut(list);
1900
+ const r = install(true, list, true);
1901
+ if (had && r.done.length) ok(T.unShortcutOff); else note(T.unNoShortcut);
1902
+ for (const f of [CFG_FILE, CACHE_FILE, CACHE_FILE + '.tmp']) { try { fs.rmSync(f, { force: true }); } catch { /* */ } }
1903
+ ok(T.unData);
1904
+ if (process.env.HOPDECK_NO_NPM) { note(T.unSkipNpm); console.log(`\n ${C.dim}${T.unDone}${R}`); return 0; }
1905
+ const res = cp.spawnSync('npm uninstall -g hopdeck', { shell: true, stdio: 'inherit' }); // comando fijo, sin datos de fuera
1906
+ if (res.status === 0 && !fs.existsSync(__filename)) ok(T.unProgram);
1907
+ else console.log(` ${C.warn}✗${R} ${T.unProgramFail(path.dirname(__dirname))}`);
1908
+ console.log(`\n ${C.dim}${T.unDone}${R}`);
1909
+ return 0;
1910
+ }
1911
+
1820
1912
  // ── Primer arranque: ofrecer que escribir `claude` abra Hopdeck ──
1821
1913
  const markAsked = () => { CFG.shortcutAsked = true; saveCfg(); };
1822
1914
  const hasShortcut = (list) => list.some((t) => { try { return fs.readFileSync(t.file, 'utf8').includes(MARK_A); } catch { return false; } });
@@ -1890,7 +1982,7 @@ function tutorial(afterInstall) {
1890
1982
  `${a}4${R} Al salir de Claude (${d}/exit${R}) vuelves aquí, sin abrir otra terminal`, '',
1891
1983
  `${d}/ buscar · r recargar · q salir${R}`,
1892
1984
  `${d}claude con argumentos (claude -p "...", claude --resume) funciona igual que siempre.${R}`,
1893
- `${d}Desinstalar: hopdeck uninstall${R}`,
1985
+ `${d}Quitar el atajo: hopdeck shortcut off · Desinstalar todo: hopdeck uninstall${R}`,
1894
1986
  ] : [
1895
1987
  `${C.brand}${b}» Hop${R}${C.text}${b}deck${R} ${d}v${VERSION}${R}`, '',
1896
1988
  afterInstall ? `${C.ok}Done.${R} Open a new terminal and type ${b}claude${R}.` : `Type ${b}hopdeck${R} (or just ${b}claude${R} if you installed the shortcut).`, '',
@@ -1900,43 +1992,51 @@ function tutorial(afterInstall) {
1900
1992
  `${a}4${R} When you exit Claude (${d}/exit${R}) you land back here — no new terminal needed`, '',
1901
1993
  `${d}/ search · r reload · q quit${R}`,
1902
1994
  `${d}claude with arguments (claude -p "...", claude --resume) works as usual.${R}`,
1903
- `${d}Uninstall: hopdeck uninstall${R}`,
1995
+ `${d}Remove the shortcut: hopdeck shortcut off · Uninstall everything: hopdeck uninstall${R}`,
1904
1996
  ];
1905
1997
  console.log('\n' + L.map((x) => ' ' + x).join('\n') + '\n');
1906
1998
  }
1907
1999
 
1908
2000
  // ───────────────────────── entrada ─────────────────────────
1909
- // ── Comandos: una errata no debe abrir Hopdeck (antes "hopdeck unistall" lo abría y le pasaba la palabra a claude como argumento) ──
1910
- const COMMANDS = ['install', 'uninstall', 'doctor', 'help'];
1911
- const COMMAND_ALIASES = { desinstalar: 'uninstall', remove: 'uninstall', instalar: 'install', ayuda: 'help', diagnostico: 'doctor', version: '--version', list: '--list' };
1912
- /** Nombre de comando (también como --uninstall o en español); null si no lo es. */
1913
- function commandName(arg) {
1914
- const w = String(arg || '').replace(/^-{1,2}/, '').toLowerCase();
1915
- return COMMANDS.includes(w) ? w : COMMAND_ALIASES[w] || null;
1916
- }
2001
+ // ── 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 ──
2002
+ const COMMANDS = ['shortcut', 'uninstall', 'doctor', 'help'];
2003
+ // Palabras que alguien escribiría para lo mismo: no son comandos y no se ejecutan, solo sirven para sugerir el correcto
2004
+ 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' };
2005
+ /** Nombre de comando si `arg` es exactamente uno (sin guiones ni variantes); null si no. */
2006
+ const commandName = (arg) => (COMMANDS.includes(String(arg || '').toLowerCase()) ? String(arg).toLowerCase() : null);
1917
2007
  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]; };
1918
- /** El comando que más se parece a una palabra mal escrita (hasta 2 letras de diferencia), o null. */
2008
+ /** El comando que se quiso escribir (por parecido, sin contar guiones, o por sinónimo), o null. */
1919
2009
  function suggestCommand(word) {
1920
- const w = String(word || '').toLowerCase(); let best = null, bd = 3;
1921
- for (const c of [...COMMANDS, ...Object.keys(COMMAND_ALIASES)]) { const d = editDistance(w, c); if (d < bd) { bd = d; best = COMMAND_ALIASES[c] || c; } }
2010
+ const w = String(word || '').replace(/^-+/, '').toLowerCase();
2011
+ if (SYNONYMS[w]) return SYNONYMS[w];
2012
+ let best = null, bd = 3;
2013
+ for (const c of COMMANDS) { const d = editDistance(w, c); if (d < bd) { bd = d; best = c; } }
1922
2014
  return best;
1923
2015
  }
2016
+ // Opciones que el propio programa entiende; el resto de lo que empiece por "-" se pasa a claude
2017
+ const OWN_FLAGS = ['--help', '-h', '--version', '-v', '--list', '--idle', '--frame', '--sidebar'];
1924
2018
 
1925
2019
  function main() {
1926
- let [cmd, ...rest] = process.argv.slice(2);
1927
- const named = commandName(cmd);
1928
- if (named) cmd = named; // --uninstall, desinstalar… valen como uninstall
1929
- else if (cmd && !cmd.startsWith('-')) { // una palabra suelta que no es comando: es una errata, no algo que pasar a claude
2020
+ const [cmd, ...rest] = process.argv.slice(2);
2021
+ // una palabra suelta, o una opción con guiones que se parece a un comando (--uninstall, --unistall…), es una errata: no se abre
2022
+ // Hopdeck ni se le pasa nada a claude
2023
+ if (cmd && !commandName(cmd) && !OWN_FLAGS.includes(cmd) && (!cmd.startsWith('-') || suggestCommand(cmd))) {
1930
2024
  const sug = suggestCommand(cmd);
1931
2025
  console.error(`${C.warn}${T.unknownCmd(cmd)}${R}${sug ? ' ' + T.didYouMean(sug) : ''}\n${C.dim}${T.cmdList}${R}`);
1932
2026
  process.exit(2);
1933
2027
  }
1934
- if (cmd === 'install') { install(false); markAsked(); }
1935
- else if (cmd === 'uninstall') { install(true); markAsked(); }
1936
- else if (cmd === 'help' || cmd === '--help' || cmd === '-h') tutorial(false);
2028
+ if (commandName(cmd) === 'shortcut') { // hopdeck shortcut on | off: solo el atajo de claude
2029
+ if (rest.length !== 1 || !['on', 'off'].includes(rest[0])) { console.error(`${C.warn}${T.shortcutUsage}${R}`); process.exit(2); }
2030
+ install(rest[0] === 'off'); markAsked();
2031
+ }
2032
+ else if (commandName(cmd) === 'uninstall') { // desinstalación completa: atajo, preferencias, caché y programa
2033
+ 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); }
2034
+ uninstallAll({ yes: rest.length > 0 }).then((code) => process.exit(code), (e) => { console.error(e); process.exit(1); });
2035
+ }
2036
+ else if (commandName(cmd) === 'help' || cmd === '--help' || cmd === '-h') tutorial(false);
1937
2037
  else if (cmd === '--version' || cmd === '-v') console.log(VERSION);
1938
2038
  else if (cmd === '--list') printList();
1939
- else if (cmd === 'doctor') doctor();
2039
+ else if (commandName(cmd) === 'doctor') doctor();
1940
2040
  else if (cmd === '--idle') idle();
1941
2041
  else if (cmd === '--frame') { // vista previa de un cuadro (pruebas)
1942
2042
  load();
@@ -1956,7 +2056,7 @@ else {
1956
2056
  module.exports = {
1957
2057
  cw, strW, fit, clean, imageExt, exportImages, safeId, findClaude, install, backupProfile, ago, tidy, fuzzy, wrapText, parseKeys, KEYMAP, isType, T, S, CFG, E,
1958
2058
  readSession, buildProject, scan, scanAsync, finishScan, sortProjects, projectDirs,
1959
- view, flatList, stripBlock, offerShortcut, commandName, suggestCommand, SNIP, MARK_A, MARK_B, toggleProject, cacheLoad, selNorm,
2059
+ view, flatList, stripBlock, offerShortcut, uninstallAll, commandName, suggestCommand, parseTermReplies, sixelOn, SNIP, MARK_A, MARK_B, toggleProject, cacheLoad, selNorm,
1960
2060
  decodePNG, decodeImage, scaleBox, fitSize, halfBlocks, collectImages, extractImages,
1961
2061
  editBuf, normalizeKeys, stripJsonc, wtCtrlV, fbNames, fbOpen, fbRows, sidebarMouse, gitBranch, imageMarkerAt, shownSession, linkChats, findImageByNumber: images.findImageByNumber,
1962
2062
  };
package/lib/i18n.js CHANGED
@@ -20,14 +20,18 @@ const T = {
20
20
  copied: (n) => `Copiado (${n} caracteres)`, archMsg: 'Archivada (H para verlas)', unarchMsg: 'Desarchivada', qsHint: 'saltar a cualquier conversación',
21
21
  prevHint: '⏎ reanudar esta conversación', 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
- unknownCmd: (c) => `Comando desconocido: "${c}"`, didYouMean: (s) => `¿Quisiste decir "${s}"?`, cmdList: 'Comandos: install, uninstall, doctor, help, --list, --version.\nLo que empiece por - se pasa a claude al abrir chats, por ejemplo: hopdeck --model opus',
24
- offerQ: '¿Quieres poder abrir Hopdeck escribiendo claude?', offerInfo: 'Se añade una función a tu perfil de shell, con copia de seguridad (para quitarla: hopdeck uninstall). Responder que no no cambia nada: Hopdeck se abre igualmente y puedes usarlo siempre con el comando hopdeck.', offerKeys: '[Enter] Sí, instalar el atajo [n] No, gracias [m] Más tarde', offerNo: 'Atajo no instalado. Si cambias de idea: hopdeck install', offerLater: 'Te lo volveré a preguntar la próxima vez.', offerDone: 'Hecho. Abre una terminal nueva para activarlo.', offerFail: 'No se pudo modificar tu perfil. Puedes intentarlo luego con: hopdeck install', offerCont: 'Pulsa una tecla para continuar…',
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 · uninstall · doctor · help (y --list, --version).\nLas opciones de claude (por ejemplo --model opus) se pasan tal cual: hopdeck --model opus',
25
+ shortcutUsage: 'Uso: hopdeck shortcut on (instalar el atajo de claude) · hopdeck shortcut off (quitarlo)',
26
+ unQ: '¿Desinstalar Hopdeck por completo?', unInfo: 'Se quitará el atajo de tu perfil de shell, tus preferencias y la caché de Hopdeck, y el programa (npm uninstall -g hopdeck). Tu historial de Claude Code no se toca.', unKeys: '[s] Sí, desinstalar [Enter] No', unCancel: 'Cancelado: no se ha quitado nada.', unNeedYes: 'Sin terminal no puedo preguntar. Para desinstalar sin preguntar: hopdeck uninstall --yes',
27
+ unShortcutOff: 'Atajo quitado de tu perfil de shell', unNoShortcut: 'No había atajo instalado', unData: 'Preferencias y caché borradas', unProgram: 'Programa desinstalado (npm uninstall -g hopdeck)', unProgramFail: (p) => `El programa sigue en ${p}. Si no lo instalaste con npm, quítalo con tu gestor (pnpm, yarn…); si es una copia de código fuente, borra esa carpeta. Con npm: npm uninstall -g hopdeck`, unDone: 'Hopdeck se ha desinstalado. Si también lo instalaste en otro sitio (por ejemplo en WSL y en Windows), repite allí: hopdeck uninstall', unSkipNpm: 'Sin ejecutar npm (HOPDECK_NO_NPM). El comando sería: npm uninstall -g hopdeck',
28
+ offerQ: '¿Quieres poder abrir Hopdeck escribiendo claude?', offerInfo: 'Se añade una función a tu perfil de shell, con copia de seguridad (para quitarlo: hopdeck shortcut off). Responder que no no cambia nada: Hopdeck se abre igualmente y puedes usarlo siempre con el comando hopdeck.', offerKeys: '[Enter] Sí, instalar el atajo [n] No, gracias [m] Más tarde', offerNo: 'Atajo no instalado. Si cambias de idea: hopdeck shortcut on', offerLater: 'Te lo volveré a preguntar la próxima vez.', offerDone: 'Hecho. Abre una terminal nueva para activarlo.', offerFail: 'No se pudo modificar tu perfil. Puedes intentarlo luego con: hopdeck shortcut on', offerCont: 'Pulsa una tecla para continuar…',
25
29
  dcNodeOld: (v) => `Node ${v}: se necesita Node 22 o superior`, dcNodeOldHint: 'Con versiones anteriores el ratón no funciona en Windows. Actualiza Node: https://nodejs.org',
26
30
  dcHist: (n, p) => `Historial de Claude: ${n} proyectos en ${p}`, dcNoHist: (p) => `No hay historial en ${p}`, dcNoHistHint: 'Usa Claude Code una vez, o define CLAUDE_CONFIG_DIR.',
27
31
  dcClaude: (p) => `claude encontrado: ${p}`, dcNoClaude: 'No se encuentra "claude" en el PATH', dcInstallWin: 'Instálalo: irm https://claude.ai/install.ps1 | iex', dcInstallUnix: 'Instálalo: curl -fsSL https://claude.ai/install.sh | bash',
28
32
  dcTmux: 'tmux disponible → vista dividida con tmux', dcEmbed: 'Terminal embebido disponible (node-pty + xterm) → vista dividida',
29
33
  dcNone: 'Sin tmux ni terminal embebido → vista a pantalla completa', dcNoneWin: 'Ejecuta npm install dentro de la carpeta del paquete.', dcNoneUnix: 'Instala tmux (brew install tmux / sudo apt install tmux).',
30
- dcShort: 'Atajo instalado: escribir "claude" abre Hopdeck', dcNoShort: 'Atajo no instalado', dcNoShortHint: 'Ejecuta: hopdeck install', dcNoCmdHint: 'Primero crea el comando (npm install -g hopdeck, o npm link si clonaste el repositorio) y luego ejecuta: hopdeck install', dcPrefs: (a, b) => `Preferencias: ${a} · caché: ${b}`, bakMsg: (f) => `Copia de seguridad de tu perfil: ${f}`,
34
+ dcShort: 'Atajo instalado: escribir "claude" abre Hopdeck', dcNoShort: 'Atajo no instalado', dcNoShortHint: 'Ejecuta: hopdeck shortcut on', dcNoCmdHint: 'Primero crea el comando (npm install -g hopdeck, o npm link si clonaste el repositorio) y luego ejecuta: hopdeck shortcut on', dcPrefs: (a, b) => `Preferencias: ${a} · caché: ${b}`, bakMsg: (f) => `Copia de seguridad de tu perfil: ${f}`,
31
35
  wtOk: 'Windows Terminal: Ctrl+V está reasignado (se pueden pegar imágenes)', wtBad: 'Windows Terminal: Ctrl+V solo pega texto, no imágenes', wtUnknown: 'Windows Terminal: no pude leer su settings.json para revisar Ctrl+V',
32
36
  wtHint: 'Para pegar imágenes con Ctrl+V añade en "actions" de settings.json:\n { "command": { "action": "sendInput", "input": "\\u001bv" }, "keys": "ctrl+v" }\n (el texto se sigue pegando con Ctrl+Shift+V). Alternativa sin tocar nada: Alt+V.',
33
37
  hiddenMsg: 'Proyecto oculto. Pulsa H para ver los ocultos.', pinMsg: 'Fijado arriba ★',
@@ -56,14 +60,18 @@ const T = {
56
60
  copied: (n) => `Copied (${n} chars)`, archMsg: 'Archived (H to show)', unarchMsg: 'Unarchived', qsHint: 'jump to any conversation',
57
61
  prevHint: '⏎ resume this conversation', noPrev: 'No messages to show',
58
62
  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',
59
- unknownCmd: (c) => `Unknown command: "${c}"`, didYouMean: (s) => `Did you mean "${s}"?`, cmdList: 'Commands: install, uninstall, doctor, help, --list, --version.\nAnything starting with - is passed to claude when opening chats, for example: hopdeck --model opus',
60
- offerQ: 'Do you want to open Hopdeck by typing claude?', offerInfo: 'A function is added to your shell profile, with a backup (to remove it: hopdeck uninstall). Answering no changes nothing: Hopdeck opens anyway and you can always use the hopdeck command.', offerKeys: '[Enter] Yes, install the shortcut [n] No, thanks [m] Later', offerNo: 'Shortcut not installed. If you change your mind: hopdeck install', offerLater: 'I will ask you again next time.', offerDone: 'Done. Open a new terminal to activate it.', offerFail: 'Could not modify your profile. You can try later with: hopdeck install', offerCont: 'Press any key to continue…',
63
+ imgClickHint: 'click: open full size', imgOpened: (n) => `[Image #${n}] opened in the image viewer`,
64
+ unknownCmd: (c) => `Unknown command: "${c}"`, didYouMean: (s) => `Did you mean "${s}"?`, cmdList: 'Commands: hopdeck shortcut on|off · uninstall · doctor · help (and --list, --version).\nclaude options (for example --model opus) are passed through as they are: hopdeck --model opus',
65
+ shortcutUsage: 'Usage: hopdeck shortcut on (install the claude shortcut) · hopdeck shortcut off (remove it)',
66
+ unQ: 'Uninstall Hopdeck completely?', unInfo: 'This removes the shortcut from your shell profile, Hopdeck\'s preferences and cache, and the program itself (npm uninstall -g hopdeck). Your Claude Code history is not touched.', unKeys: '[y] Yes, uninstall [Enter] No', unCancel: 'Cancelled: nothing was removed.', unNeedYes: 'Without a terminal I cannot ask. To uninstall without asking: hopdeck uninstall --yes',
67
+ unShortcutOff: 'Shortcut removed from your shell profile', unNoShortcut: 'There was no shortcut installed', unData: 'Preferences and cache deleted', unProgram: 'Program uninstalled (npm uninstall -g hopdeck)', unProgramFail: (p) => `The program is still at ${p}. If you did not install it with npm, remove it with your package manager (pnpm, yarn…); if it is a source copy, delete that folder. With npm: npm uninstall -g hopdeck`, unDone: 'Hopdeck has been uninstalled. If you also installed it elsewhere (for example in WSL and in Windows), repeat there: hopdeck uninstall', unSkipNpm: 'Not running npm (HOPDECK_NO_NPM). The command would be: npm uninstall -g hopdeck',
68
+ offerQ: 'Do you want to open Hopdeck by typing claude?', offerInfo: 'A function is added to your shell profile, with a backup (to remove it: hopdeck shortcut off). Answering no changes nothing: Hopdeck opens anyway and you can always use the hopdeck command.', offerKeys: '[Enter] Yes, install the shortcut [n] No, thanks [m] Later', offerNo: 'Shortcut not installed. If you change your mind: hopdeck shortcut on', offerLater: 'I will ask you again next time.', offerDone: 'Done. Open a new terminal to activate it.', offerFail: 'Could not modify your profile. You can try later with: hopdeck shortcut on', offerCont: 'Press any key to continue…',
61
69
  dcNodeOld: (v) => `Node ${v}: Node 22 or newer is required`, dcNodeOldHint: 'With older versions the mouse does not work on Windows. Update Node: https://nodejs.org',
62
70
  dcHist: (n, p) => `Claude history: ${n} projects in ${p}`, dcNoHist: (p) => `No history found in ${p}`, dcNoHistHint: 'Use Claude Code once, or set CLAUDE_CONFIG_DIR.',
63
71
  dcClaude: (p) => `claude found: ${p}`, dcNoClaude: '"claude" not found in PATH', dcInstallWin: 'Install it: irm https://claude.ai/install.ps1 | iex', dcInstallUnix: 'Install it: curl -fsSL https://claude.ai/install.sh | bash',
64
72
  dcTmux: 'tmux available → split view with tmux', dcEmbed: 'Embedded terminal available (node-pty + xterm) → split view',
65
73
  dcNone: 'No tmux or embedded terminal → full-screen view', dcNoneWin: 'Run npm install inside the package folder.', dcNoneUnix: 'Install tmux (brew install tmux / sudo apt install tmux).',
66
- dcShort: 'Shortcut installed: typing "claude" opens Hopdeck', dcNoShort: 'Shortcut not installed', dcNoShortHint: 'Run: hopdeck install', dcNoCmdHint: 'First create the command (npm install -g hopdeck, or npm link if you cloned the repo), then run: hopdeck install', dcPrefs: (a, b) => `Preferences: ${a} · cache: ${b}`, bakMsg: (f) => `Backup of your profile: ${f}`,
74
+ dcShort: 'Shortcut installed: typing "claude" opens Hopdeck', dcNoShort: 'Shortcut not installed', dcNoShortHint: 'Run: hopdeck shortcut on', dcNoCmdHint: 'First create the command (npm install -g hopdeck, or npm link if you cloned the repo), then run: hopdeck shortcut on', dcPrefs: (a, b) => `Preferences: ${a} · cache: ${b}`, bakMsg: (f) => `Backup of your profile: ${f}`,
67
75
  wtOk: 'Windows Terminal: Ctrl+V is remapped (images can be pasted)', wtBad: 'Windows Terminal: Ctrl+V only pastes text, not images', wtUnknown: 'Windows Terminal: could not read its settings.json to check Ctrl+V',
68
76
  wtHint: 'To paste images with Ctrl+V add to "actions" in settings.json:\n { "command": { "action": "sendInput", "input": "\\u001bv" }, "keys": "ctrl+v" }\n (text can still be pasted with Ctrl+Shift+V). No-config alternative: Alt+V.',
69
77
  hiddenMsg: 'Project hidden. Press H to show hidden ones.', pinMsg: 'Pinned on top ★',
package/lib/sixel.js ADDED
@@ -0,0 +1,90 @@
1
+ 'use strict';
2
+ // Codificador Sixel: convierte una imagen RGB en la secuencia que dibuja una imagen real (con todos sus píxeles) en terminales
3
+ // que la admiten (Windows Terminal 1.22+, iTerm2, WezTerm, foot, mlterm, Konsole…). Sin dependencias.
4
+ //
5
+ // Formato: DCS "P0;0;0q" + atributos del ráster ("1;1;ancho;alto) + paleta (#n;2;r;g;b, en 0-100) + datos por bandas de
6
+ // 6 píxeles de alto (un carácter por columna y color: 63 + máscara de bits), con "!n" para repeticiones, "$" para volver al
7
+ // principio de la banda, "-" para la banda siguiente, y ST (ESC \) para terminar.
8
+
9
+ /**
10
+ * Reduce la imagen a como mucho `maxColors` colores. Si ya tiene pocos colores (capturas de pantalla, interfaces) se conservan
11
+ * exactos; si no, se aplica "median cut" sobre un histograma de 5 bits por canal.
12
+ * Devuelve { palette: [[r,g,b]…], index: Uint8Array(w*h) }.
13
+ */
14
+ function quantize(rgb, w, h, maxColors = 256) {
15
+ const n = w * h, index = new Uint8Array(n);
16
+ // 1) ¿hay pocos colores distintos? entonces la paleta es exacta
17
+ const exact = new Map();
18
+ for (let i = 0; i < n && exact.size <= maxColors; i++) {
19
+ const k = (rgb[i * 3] << 16) | (rgb[i * 3 + 1] << 8) | rgb[i * 3 + 2];
20
+ if (!exact.has(k)) exact.set(k, exact.size);
21
+ }
22
+ if (exact.size <= maxColors) {
23
+ for (let i = 0; i < n; i++) index[i] = exact.get((rgb[i * 3] << 16) | (rgb[i * 3 + 1] << 8) | rgb[i * 3 + 2]);
24
+ const palette = []; for (const [k] of exact) palette.push([(k >> 16) & 255, (k >> 8) & 255, k & 255]);
25
+ return { palette, index };
26
+ }
27
+ // 2) histograma de 5 bits por canal + median cut
28
+ const hist = new Uint32Array(32768);
29
+ for (let i = 0; i < n; i++) hist[((rgb[i * 3] >> 3) << 10) | ((rgb[i * 3 + 1] >> 3) << 5) | (rgb[i * 3 + 2] >> 3)]++;
30
+ const bins = [];
31
+ for (let b = 0; b < 32768; b++) if (hist[b]) bins.push({ r: ((b >> 10) << 3) + 4, g: (((b >> 5) & 31) << 3) + 4, b: ((b & 31) << 3) + 4, c: hist[b], id: b });
32
+ let boxes = [bins];
33
+ while (boxes.length < maxColors) {
34
+ // se parte la caja con más rango (ponderado por su número de píxeles) por su canal más largo, en la mediana
35
+ let bi = -1, best = -1, bch = 'r';
36
+ boxes.forEach((bx, i) => {
37
+ if (bx.length < 2) return;
38
+ let lo = { r: 255, g: 255, b: 255 }, hi = { r: 0, g: 0, b: 0 }, cnt = 0;
39
+ for (const p of bx) { cnt += p.c; for (const ch of ['r', 'g', 'b']) { if (p[ch] < lo[ch]) lo[ch] = p[ch]; if (p[ch] > hi[ch]) hi[ch] = p[ch]; } }
40
+ for (const ch of ['r', 'g', 'b']) { const score = (hi[ch] - lo[ch]) * Math.sqrt(cnt); if (score > best) { best = score; bi = i; bch = ch; } }
41
+ });
42
+ if (bi < 0) break;
43
+ const bx = boxes[bi].slice().sort((p, q) => p[bch] - q[bch]);
44
+ const half = bx.reduce((s, p) => s + p.c, 0) / 2; let acc = 0, cut = 1;
45
+ for (let i = 0; i < bx.length - 1; i++) { acc += bx[i].c; cut = i + 1; if (acc >= half) break; }
46
+ boxes.splice(bi, 1, bx.slice(0, cut), bx.slice(cut));
47
+ }
48
+ const palette = boxes.map((bx) => { let r = 0, g = 0, b = 0, c = 0; for (const p of bx) { r += p.r * p.c; g += p.g * p.c; b += p.b * p.c; c += p.c; } return [Math.round(r / c), Math.round(g / c), Math.round(b / c)]; });
49
+ const map = new Int16Array(32768).fill(-1); // cada color de 5 bits → su caja
50
+ boxes.forEach((bx, i) => { for (const p of bx) map[p.id] = i; });
51
+ for (let i = 0; i < n; i++) index[i] = map[((rgb[i * 3] >> 3) << 10) | ((rgb[i * 3 + 1] >> 3) << 5) | (rgb[i * 3 + 2] >> 3)];
52
+ return { palette, index };
53
+ }
54
+
55
+ /** Una fila de máscaras de una banda como cadena sixel, con repeticiones "!n" y sin el relleno vacío del final. */
56
+ function rle(masks) {
57
+ let end = masks.length; while (end > 0 && masks[end - 1] === 0) end--; // los "?" finales no hacen falta
58
+ let out = '';
59
+ for (let x = 0; x < end;) {
60
+ let run = 1; while (x + run < end && masks[x + run] === masks[x]) run++;
61
+ const ch = String.fromCharCode(63 + masks[x]);
62
+ out += run > 3 ? `!${run}${ch}` : ch.repeat(run);
63
+ x += run;
64
+ }
65
+ return out;
66
+ }
67
+
68
+ /** Imagen RGB (3 bytes por píxel) → secuencia Sixel completa lista para escribir en el terminal. */
69
+ function encodeSixel(rgb, w, h, { maxColors = 256 } = {}) {
70
+ const { palette, index } = quantize(rgb, w, h, maxColors);
71
+ let out = `\x1bP0;0;0q"1;1;${w};${h}`;
72
+ palette.forEach(([r, g, b], i) => { out += `#${i};2;${Math.round((r * 100) / 255)};${Math.round((g * 100) / 255)};${Math.round((b * 100) / 255)}`; });
73
+ for (let y0 = 0; y0 < h; y0 += 6) {
74
+ const bandH = Math.min(6, h - y0), cols = new Map();
75
+ for (let dy = 0; dy < bandH; dy++) {
76
+ const row = (y0 + dy) * w;
77
+ for (let x = 0; x < w; x++) {
78
+ const c = index[row + x]; let a = cols.get(c);
79
+ if (!a) { a = new Uint8Array(w); cols.set(c, a); }
80
+ a[x] |= 1 << dy;
81
+ }
82
+ }
83
+ let first = true;
84
+ for (const [c, a] of cols) { out += (first ? '' : '$') + '#' + c + rle(a); first = false; }
85
+ if (y0 + 6 < h) out += '-';
86
+ }
87
+ return out + '\x1b\\';
88
+ }
89
+
90
+ module.exports = { encodeSixel, quantize };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hopdeck",
3
- "version": "1.2.2",
3
+ "version": "1.2.4",
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",