hopdeck 1.2.0 → 1.2.2
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 +16 -0
- package/README.en.md +15 -1
- package/README.md +15 -1
- package/bin/hopdeck.js +71 -11
- package/lib/history.js +47 -25
- package/lib/i18n.js +6 -4
- package/lib/images.js +2 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Cambios
|
|
2
2
|
|
|
3
|
+
## 1.2.2
|
|
4
|
+
|
|
5
|
+
### Corregido
|
|
6
|
+
- **Una errata en un comando ya no abre Hopdeck:** `hopdeck unistall` abría la interfaz y le pasaba la palabra a `claude` como argumento, que se aplicaba a los chats que abrieras. Ahora una palabra que no es un comando da un error con una sugerencia («¿Quisiste decir "uninstall"?»). También se aceptan `--uninstall`, `--install`, `--doctor` y los alias `desinstalar`, `instalar`, `ayuda`, `version` y `list`. Lo que empieza por `-` sigue pasando a `claude`.
|
|
7
|
+
|
|
8
|
+
## 1.2.1
|
|
9
|
+
|
|
10
|
+
### Corregido
|
|
11
|
+
- **Conversaciones que no aparecían en la lista** (y por tanto tampoco mostraban sus imágenes al pasar el cursor): Hopdeck solo leía los primeros 64 KB de cada archivo para sacar el título. Si el primer mensaje llevaba una imagen (cientos de KB) y Claude aún no había guardado un título, la conversación se descartaba. Ahora lee el principio del archivo por bloques, hasta 4 MB, hasta encontrar el primer mensaje.
|
|
12
|
+
- **Las cachés guardadas con la versión anterior se reconstruyen**, para que ese arreglo llegue también a quien ya tenía la lista cacheada.
|
|
13
|
+
- **Imágenes duplicadas en la galería:** Claude Code guarda cada imagen otra vez en una línea interna (`api-request-blob`). Ya no se cuentan dos veces.
|
|
14
|
+
- **Hover de imagen en un chat nuevo:** si todavía no se había enlazado con su conversación, podía mostrar la imagen de otra conversación del mismo proyecto cuando coincidía el número. Ahora solo toma una conversación creada después de abrir el chat.
|
|
15
|
+
- **Detección de `[Image #N]`:** calcula bien la columna con caracteres anchos delante (emoji, CJK) y acepta espacios no separables.
|
|
16
|
+
- **Pregunta del primer arranque:** al responder, la pregunta se borra de la pantalla y deja una línea de resumen (antes se quedaba escrita como si siguiera pendiente), y el texto aclara que responder que no no impide abrir Hopdeck: el atajo solo afecta a lo que ocurre al escribir `claude`.
|
|
17
|
+
- **Aviso de tamaño mínimo:** decía 60×12 y el programa exige 70×12.
|
|
18
|
+
|
|
3
19
|
## 1.2.0 · primera versión pública
|
|
4
20
|
|
|
5
21
|
### Nuevo
|
package/README.en.md
CHANGED
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
|
|
10
10
|
[Español](README.md) · **English**
|
|
11
11
|
|
|
12
|
+
[](https://www.npmjs.com/package/hopdeck)
|
|
13
|
+
[](https://github.com/fabriciodev26/hopdeck/actions/workflows/ci.yml)
|
|
12
14
|
[](LICENSE)
|
|
13
15
|
[](package.json)
|
|
14
16
|
|
|
@@ -146,9 +148,21 @@ It always starts at `~`. Recently used folders appear on top (`↻ recent`).
|
|
|
146
148
|
### More
|
|
147
149
|
|
|
148
150
|
- The project's **git branch** is shown and the list refreshes itself.
|
|
149
|
-
- `hopdeck --list` prints the projects as plain text. `hopdeck <arguments>` passes them to `claude` when opening chats (for example `hopdeck --model opus`).
|
|
150
151
|
- Available in **Spanish and English** (follows the system language).
|
|
151
152
|
|
|
153
|
+
## Commands
|
|
154
|
+
|
|
155
|
+
| Command | What it does |
|
|
156
|
+
|---|---|
|
|
157
|
+
| `hopdeck` | Opens Hopdeck |
|
|
158
|
+
| `hopdeck install` / `hopdeck uninstall` | Installs or removes the shortcut so that `claude` opens Hopdeck |
|
|
159
|
+
| `hopdeck doctor` | Checks your setup and tells you how to fix whatever is missing |
|
|
160
|
+
| `hopdeck --list` | Lists the projects as plain text |
|
|
161
|
+
| `hopdeck --version` | Shows the version |
|
|
162
|
+
| `hopdeck --model opus` | Anything starting with `-` is passed to `claude` when opening chats |
|
|
163
|
+
|
|
164
|
+
A word that is not a command (for example `hopdeck unistall`) gives an error with a suggestion instead of opening Hopdeck.
|
|
165
|
+
|
|
152
166
|
## Compatibility
|
|
153
167
|
|
|
154
168
|
| System | Works with | Notes |
|
package/README.md
CHANGED
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
|
|
10
10
|
**Español** · [English](README.en.md)
|
|
11
11
|
|
|
12
|
+
[](https://www.npmjs.com/package/hopdeck)
|
|
13
|
+
[](https://github.com/fabriciodev26/hopdeck/actions/workflows/ci.yml)
|
|
12
14
|
[](LICENSE)
|
|
13
15
|
[](package.json)
|
|
14
16
|
|
|
@@ -146,9 +148,21 @@ Empieza siempre en `~`. Las carpetas que usaste hace poco aparecen arriba (`↻
|
|
|
146
148
|
### Otros detalles
|
|
147
149
|
|
|
148
150
|
- Se muestra la **rama de git** del proyecto y la lista se refresca sola.
|
|
149
|
-
- `hopdeck --list` imprime los proyectos en texto plano. `hopdeck <argumentos>` pasa esos argumentos a `claude` al abrir chats (por ejemplo `hopdeck --model opus`).
|
|
150
151
|
- Disponible en **español e inglés** (sigue el idioma del sistema).
|
|
151
152
|
|
|
153
|
+
## Comandos
|
|
154
|
+
|
|
155
|
+
| Comando | Qué hace |
|
|
156
|
+
|---|---|
|
|
157
|
+
| `hopdeck` | Abre Hopdeck |
|
|
158
|
+
| `hopdeck install` / `hopdeck uninstall` | Instala o quita el atajo para que `claude` abra Hopdeck |
|
|
159
|
+
| `hopdeck doctor` | Revisa tu instalación y dice cómo arreglar lo que falte |
|
|
160
|
+
| `hopdeck --list` | Lista los proyectos en texto plano |
|
|
161
|
+
| `hopdeck --version` | Muestra la versión |
|
|
162
|
+
| `hopdeck --model opus` | Lo que empiece por `-` se pasa a `claude` al abrir chats |
|
|
163
|
+
|
|
164
|
+
Una palabra que no es un comando (por ejemplo `hopdeck unistall`) da un error con una sugerencia, en vez de abrir Hopdeck.
|
|
165
|
+
|
|
152
166
|
## Compatibilidad
|
|
153
167
|
|
|
154
168
|
| Sistema | Funciona con | Notas |
|
package/bin/hopdeck.js
CHANGED
|
@@ -953,11 +953,38 @@ async function shownSession(x) {
|
|
|
953
953
|
if (!sess) {
|
|
954
954
|
await reloadAsync(null, true);
|
|
955
955
|
const p = S.projects.find((q) => q.cwd === x.cwd);
|
|
956
|
-
|
|
956
|
+
// un chat nuevo aún sin enlazar: solo vale una conversación creada después de abrirlo. Usar "la más reciente del proyecto"
|
|
957
|
+
// podía mostrar la imagen de OTRA conversación cuando coincidía el número
|
|
958
|
+
sess = p && p.sessions.find((q) => q.mtime >= (x.t0 || 0) - 2000);
|
|
957
959
|
}
|
|
958
960
|
return sess;
|
|
959
961
|
}
|
|
960
962
|
|
|
963
|
+
/** Texto de una fila del terminal virtual y la columna de cada carácter (los de ancho 2 ocupan dos celdas). */
|
|
964
|
+
function rowChars(term, y) {
|
|
965
|
+
const b = term.buffer.active, line = b.getLine(b.viewportY + y), cols = []; let text = '';
|
|
966
|
+
if (!line) return { text, cols };
|
|
967
|
+
const cell = b.getNullCell();
|
|
968
|
+
for (let x = 0; x < term.cols; x++) {
|
|
969
|
+
const c = line.getCell(x, cell); if (!c) break;
|
|
970
|
+
if (c.getWidth() === 0) continue;
|
|
971
|
+
const ch = c.getChars() || ' ';
|
|
972
|
+
for (let i = 0; i < ch.length; i++) cols.push(x);
|
|
973
|
+
text += ch;
|
|
974
|
+
}
|
|
975
|
+
return { text, cols };
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
/** ¿Hay un "[Image #N]" bajo la columna `col` de la fila `y`? Devuelve { n, x } o null. Tolera espacios no separables y caracteres anchos antes de la marca. */
|
|
979
|
+
function imageMarkerAt(term, y, col) {
|
|
980
|
+
const { text, cols } = rowChars(term, y);
|
|
981
|
+
for (const m of text.matchAll(/\[Image\s*#(\d+)\]/g)) {
|
|
982
|
+
const x0 = cols[m.index], x1 = cols[m.index + m[0].length - 1];
|
|
983
|
+
if (col >= x0 && col <= x1) return { n: +m[1], x: x0 };
|
|
984
|
+
}
|
|
985
|
+
return null;
|
|
986
|
+
}
|
|
987
|
+
|
|
961
988
|
async function openGalleryShown() {
|
|
962
989
|
const x = E.sessions.get(E.shown); if (!x) return flash(T.notOpen);
|
|
963
990
|
const sess = await shownSession(x);
|
|
@@ -999,9 +1026,8 @@ function hoverChat(sh, x, y) {
|
|
|
999
1026
|
const { SW, rw } = embedLayout(), x0 = SW ? SW + 2 : 1;
|
|
1000
1027
|
let n = 0, at = null;
|
|
1001
1028
|
if (sh.ready && x >= x0 && y >= 3) {
|
|
1002
|
-
const
|
|
1003
|
-
|
|
1004
|
-
for (const m of txt.matchAll(/\[Image #(\d+)\]/g)) if (col >= m.index && col < m.index + m[0].length) { n = +m[1]; at = { x: m.index, y: y - 3 }; break; }
|
|
1029
|
+
const hit = imageMarkerAt(sh.term, y - 3, x - x0);
|
|
1030
|
+
if (hit) { n = hit.n; at = { x: hit.x, y: y - 3 }; }
|
|
1005
1031
|
}
|
|
1006
1032
|
if (!n) { if (E.hover) { E.hover = null; scheduleRender(); } return; }
|
|
1007
1033
|
const k = `${n}:${at.x}:${at.y}`;
|
|
@@ -1814,9 +1840,20 @@ function readKey(accept) {
|
|
|
1814
1840
|
});
|
|
1815
1841
|
}
|
|
1816
1842
|
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1843
|
+
/**
|
|
1844
|
+
* Pinta la pregunta, espera la respuesta y la BORRA de la pantalla (si no, se quedaba escrita como si siguiera pendiente).
|
|
1845
|
+
* Cada línea se ajusta al ancho del terminal para saber exactamente cuántas ocupa y poder subir el cursor hasta el principio.
|
|
1846
|
+
*/
|
|
1847
|
+
async function askShortcut() {
|
|
1848
|
+
const width = Math.max(30, (process.stdout.columns || 80) - 4);
|
|
1849
|
+
const block = ['', ` ${C.brand}${C.bold}» Hop${R}${C.text}${C.bold}deck${R}`, '', ` ${C.text}${C.bold}${T.offerQ}${R}`,
|
|
1850
|
+
...wrapText(T.offerInfo, width).map((l) => ` ${C.dim}${l}${R}`), '', ` ${C.accent}${T.offerKeys}${R}`];
|
|
1851
|
+
process.stdout.write(block.join('\n') + '\n');
|
|
1852
|
+
const ans = await readKey((k) => (k === '\r' || k === '\n' || /^[sSyY]$/.test(k) ? 'yes' : /^[nN]$/.test(k) ? 'no' : k === '\x1b' || /^[mM]$/.test(k) ? 'later' : undefined));
|
|
1853
|
+
process.stdout.write(`\x1b[${block.length}A\x1b[J`); // sube hasta el principio de la pregunta y la borra
|
|
1854
|
+
if (ans === 'no') process.stdout.write(` ${C.dim}${T.offerNo}${R}\n`);
|
|
1855
|
+
else if (ans === 'later') process.stdout.write(` ${C.dim}${T.offerLater}${R}\n`);
|
|
1856
|
+
return ans;
|
|
1820
1857
|
}
|
|
1821
1858
|
|
|
1822
1859
|
/**
|
|
@@ -1837,7 +1874,7 @@ async function offerShortcut(opts = {}) {
|
|
|
1837
1874
|
r.baks.forEach((b) => process.stdout.write(` ${C.dim}${T.bakMsg(shortPath(b))}${R}\n`));
|
|
1838
1875
|
process.stdout.write(`\n ${C.dim}${T.offerCont}${R}`);
|
|
1839
1876
|
await readKey(() => true);
|
|
1840
|
-
process.stdout.write('\
|
|
1877
|
+
process.stdout.write('\r\x1b[2K'); // borra la línea «Pulsa una tecla…» y deja solo el resultado
|
|
1841
1878
|
}
|
|
1842
1879
|
return r.done.length ? 'yes' : 'failed';
|
|
1843
1880
|
}
|
|
@@ -1869,8 +1906,31 @@ function tutorial(afterInstall) {
|
|
|
1869
1906
|
}
|
|
1870
1907
|
|
|
1871
1908
|
// ───────────────────────── 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
|
+
}
|
|
1917
|
+
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. */
|
|
1919
|
+
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; } }
|
|
1922
|
+
return best;
|
|
1923
|
+
}
|
|
1924
|
+
|
|
1872
1925
|
function main() {
|
|
1873
|
-
|
|
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
|
|
1930
|
+
const sug = suggestCommand(cmd);
|
|
1931
|
+
console.error(`${C.warn}${T.unknownCmd(cmd)}${R}${sug ? ' ' + T.didYouMean(sug) : ''}\n${C.dim}${T.cmdList}${R}`);
|
|
1932
|
+
process.exit(2);
|
|
1933
|
+
}
|
|
1874
1934
|
if (cmd === 'install') { install(false); markAsked(); }
|
|
1875
1935
|
else if (cmd === 'uninstall') { install(true); markAsked(); }
|
|
1876
1936
|
else if (cmd === 'help' || cmd === '--help' || cmd === '-h') tutorial(false);
|
|
@@ -1896,8 +1956,8 @@ else {
|
|
|
1896
1956
|
module.exports = {
|
|
1897
1957
|
cw, strW, fit, clean, imageExt, exportImages, safeId, findClaude, install, backupProfile, ago, tidy, fuzzy, wrapText, parseKeys, KEYMAP, isType, T, S, CFG, E,
|
|
1898
1958
|
readSession, buildProject, scan, scanAsync, finishScan, sortProjects, projectDirs,
|
|
1899
|
-
view, flatList, stripBlock, offerShortcut, SNIP, MARK_A, MARK_B, toggleProject, cacheLoad, selNorm,
|
|
1959
|
+
view, flatList, stripBlock, offerShortcut, commandName, suggestCommand, SNIP, MARK_A, MARK_B, toggleProject, cacheLoad, selNorm,
|
|
1900
1960
|
decodePNG, decodeImage, scaleBox, fitSize, halfBlocks, collectImages, extractImages,
|
|
1901
|
-
editBuf, normalizeKeys, stripJsonc, wtCtrlV, fbNames, fbOpen, fbRows, sidebarMouse, gitBranch, linkChats, findImageByNumber: images.findImageByNumber,
|
|
1961
|
+
editBuf, normalizeKeys, stripJsonc, wtCtrlV, fbNames, fbOpen, fbRows, sidebarMouse, gitBranch, imageMarkerAt, shownSession, linkChats, findImageByNumber: images.findImageByNumber,
|
|
1902
1962
|
};
|
|
1903
1963
|
}
|
package/lib/history.js
CHANGED
|
@@ -18,13 +18,15 @@ function textOf(content) {
|
|
|
18
18
|
|
|
19
19
|
// Caché del índice: solo se vuelven a leer las sesiones cuya fecha/tamaño cambió.
|
|
20
20
|
const CACHE_FILE = process.env.HOPDECK_CACHE || path.join(os.homedir(), '.hopdeck-cache.json');
|
|
21
|
+
// Sube la versión cuando cambie cómo se lee una sesión: así las cachés ya guardadas se reconstruyen en vez de repetir resultados antiguos.
|
|
22
|
+
const CACHE_VERSION = 2;
|
|
21
23
|
let CACHE = null, cacheDirty = false, cacheSeen = null;
|
|
22
24
|
/** Empieza un escaneo: las entradas de la caché que no se vean se descartan al terminar. */
|
|
23
25
|
const beginScan = () => { cacheSeen = new Set(); };
|
|
24
26
|
const endScan = () => { cacheSave(); cacheSeen = null; };
|
|
25
27
|
function cacheLoad() {
|
|
26
28
|
if (CACHE) return CACHE;
|
|
27
|
-
try { const j = JSON.parse(fs.readFileSync(CACHE_FILE, 'utf8')); CACHE = j && j.v ===
|
|
29
|
+
try { const j = JSON.parse(fs.readFileSync(CACHE_FILE, 'utf8')); CACHE = j && j.v === CACHE_VERSION && j.files ? j : { v: CACHE_VERSION, files: {} }; } catch { CACHE = { v: CACHE_VERSION, files: {} }; }
|
|
28
30
|
return CACHE;
|
|
29
31
|
}
|
|
30
32
|
function cacheSave() {
|
|
@@ -51,40 +53,60 @@ function readSession(file) {
|
|
|
51
53
|
return d;
|
|
52
54
|
}
|
|
53
55
|
|
|
56
|
+
/**
|
|
57
|
+
* Recorre el principio del archivo por bloques, línea a línea, hasta que `onLine` devuelva true (ya tiene lo que busca)
|
|
58
|
+
* o se llegue a HEAD_MAX bytes. Antes solo se leían los primeros 64 KB: si el primer mensaje llevaba una imagen
|
|
59
|
+
* (una línea de cientos de KB) caía fuera y la conversación se descartaba por no tener título.
|
|
60
|
+
*/
|
|
61
|
+
function scanHead(fd, size, onLine) {
|
|
62
|
+
const CHUNK = 128 * 1024, HEAD_MAX = 4 * 1024 * 1024;
|
|
63
|
+
let pos = 0, carry = Buffer.alloc(0);
|
|
64
|
+
while (pos < size && pos < HEAD_MAX) {
|
|
65
|
+
const buf = Buffer.alloc(Math.min(CHUNK, size - pos));
|
|
66
|
+
const n = fs.readSync(fd, buf, 0, buf.length, pos);
|
|
67
|
+
if (!n) break;
|
|
68
|
+
pos += n;
|
|
69
|
+
const data = carry.length ? Buffer.concat([carry, buf.subarray(0, n)]) : buf.subarray(0, n);
|
|
70
|
+
let start = 0, nl;
|
|
71
|
+
while ((nl = data.indexOf(10, start)) >= 0) { // se parte por bytes y se decodifica la línea completa: un carácter de varios bytes nunca queda cortado
|
|
72
|
+
if (onLine(data.toString('utf8', start, nl)) === true) return;
|
|
73
|
+
start = nl + 1;
|
|
74
|
+
}
|
|
75
|
+
carry = data.subarray(start);
|
|
76
|
+
}
|
|
77
|
+
if (pos >= size && carry.length) onLine(carry.toString('utf8')); // última línea sin salto final
|
|
78
|
+
}
|
|
79
|
+
|
|
54
80
|
function parseSession(file, st) {
|
|
55
81
|
let fd;
|
|
56
82
|
try { fd = fs.openSync(file, 'r'); } catch { return null; }
|
|
57
83
|
try {
|
|
58
|
-
const
|
|
59
|
-
const hb = Buffer.alloc(Math.min(st.size, HEAD));
|
|
60
|
-
fs.readSync(fd, hb, 0, hb.length, 0);
|
|
61
|
-
const head = hb.toString('utf8').split('\n');
|
|
62
|
-
if (st.size > HEAD) head.pop(); // última línea cortada
|
|
63
|
-
let tail = [];
|
|
64
|
-
if (st.size > HEAD) {
|
|
65
|
-
const len = Math.min(st.size, TAIL);
|
|
66
|
-
const tb = Buffer.alloc(len);
|
|
67
|
-
fs.readSync(fd, tb, 0, len, st.size - len);
|
|
68
|
-
tail = tb.toString('utf8').split('\n');
|
|
69
|
-
tail.shift();
|
|
70
|
-
}
|
|
84
|
+
const TAIL = 160 * 1024;
|
|
71
85
|
let cwd = '', first = '', custom = '', ai = '';
|
|
72
|
-
|
|
73
|
-
if (!line)
|
|
86
|
+
scanHead(fd, st.size, (line) => {
|
|
87
|
+
if (!line) return false;
|
|
74
88
|
const wantCwd = !cwd && line.includes('"cwd"');
|
|
75
89
|
const wantUser = !first && isType(line, 'user');
|
|
76
90
|
const wantTitle = line.includes('-title"');
|
|
77
|
-
if (
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
91
|
+
if (wantCwd || wantUser || wantTitle) {
|
|
92
|
+
let j; try { j = JSON.parse(line); } catch { j = null; }
|
|
93
|
+
if (j) {
|
|
94
|
+
if (wantCwd && j.cwd) cwd = j.cwd;
|
|
95
|
+
if (j.type === 'custom-title' && j.customTitle) custom = j.customTitle;
|
|
96
|
+
if (j.type === 'ai-title' && j.aiTitle) ai = j.aiTitle;
|
|
97
|
+
if (wantUser && j.type === 'user' && !j.isMeta && !j.isSidechain) {
|
|
98
|
+
const t = tidy(textOf(j.message && j.message.content));
|
|
99
|
+
if (t && !t.startsWith('<') && !t.startsWith('[Request interrupted')) first = t.slice(0, 300);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
85
102
|
}
|
|
86
|
-
|
|
103
|
+
return !!(cwd && first); // con la carpeta y el primer mensaje ya no hace falta leer más del principio
|
|
104
|
+
});
|
|
87
105
|
// los títulos más recientes están al final del archivo
|
|
106
|
+
const len = Math.min(st.size, TAIL), tb = Buffer.alloc(len);
|
|
107
|
+
fs.readSync(fd, tb, 0, len, st.size - len);
|
|
108
|
+
const tail = tb.toString('utf8').split('\n');
|
|
109
|
+
if (st.size > len) tail.shift(); // primera línea cortada
|
|
88
110
|
let tCustom = '', tAi = '';
|
|
89
111
|
for (let i = tail.length - 1; i >= 0; i--) {
|
|
90
112
|
const line = tail[i];
|
package/lib/i18n.js
CHANGED
|
@@ -9,7 +9,7 @@ const T = {
|
|
|
9
9
|
sess: (n) => `${n} ${n === 1 ? 'sesión' : 'sesiones'}`,
|
|
10
10
|
k: { move: 'mover', open: 'abrir', resume: 'reanudar', back: 'volver', neu: 'nueva', find: 'buscar', quit: 'salir' },
|
|
11
11
|
searchHint: 'enter aceptar · esc limpiar',
|
|
12
|
-
noMatch: 'Sin resultados', small: 'Agranda la terminal (mín.
|
|
12
|
+
noMatch: 'Sin resultados', small: 'Agranda la terminal (mín. 70×12)',
|
|
13
13
|
missing: 'La carpeta ya no existe', mkAsk: '⏎ otra vez para crear', mkFail: 'No se pudo crear', current: 'carpeta actual',
|
|
14
14
|
noClaude: 'No se encontró el comando "claude". ¿Está instalado y en el PATH?',
|
|
15
15
|
pressKey: 'Pulsa una tecla para volver…',
|
|
@@ -20,7 +20,8 @@ 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
|
-
|
|
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…',
|
|
24
25
|
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',
|
|
25
26
|
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.',
|
|
26
27
|
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',
|
|
@@ -44,7 +45,7 @@ const T = {
|
|
|
44
45
|
sess: (n) => `${n} ${n === 1 ? 'session' : 'sessions'}`,
|
|
45
46
|
k: { move: 'move', open: 'open', resume: 'resume', back: 'back', neu: 'new', find: 'search', quit: 'quit' },
|
|
46
47
|
searchHint: 'enter accept · esc clear',
|
|
47
|
-
noMatch: 'No results', small: 'Make the terminal bigger (min
|
|
48
|
+
noMatch: 'No results', small: 'Make the terminal bigger (min 70×12)',
|
|
48
49
|
missing: 'That folder no longer exists', mkAsk: '⏎ again to create', mkFail: 'Could not create', current: 'current folder',
|
|
49
50
|
noClaude: 'Could not find the "claude" command. Is it installed and on PATH?',
|
|
50
51
|
pressKey: 'Press any key to go back…',
|
|
@@ -55,7 +56,8 @@ const T = {
|
|
|
55
56
|
copied: (n) => `Copied (${n} chars)`, archMsg: 'Archived (H to show)', unarchMsg: 'Unarchived', qsHint: 'jump to any conversation',
|
|
56
57
|
prevHint: '⏎ resume this conversation', noPrev: 'No messages to show',
|
|
57
58
|
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',
|
|
58
|
-
|
|
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…',
|
|
59
61
|
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',
|
|
60
62
|
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.',
|
|
61
63
|
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',
|
package/lib/images.js
CHANGED
|
@@ -22,6 +22,7 @@ async function extractImages(file, max = 200) {
|
|
|
22
22
|
for await (const line of rl) {
|
|
23
23
|
if (!/"type"\s*:\s*"image"/.test(line)) continue;
|
|
24
24
|
let j; try { j = JSON.parse(line); } catch { continue; }
|
|
25
|
+
if (j.type !== 'user' && j.type !== 'assistant') continue; // Claude Code guarda cada imagen otra vez en líneas internas (api-request-blob): se ignoran
|
|
25
26
|
const c = j.message && j.message.content, local = [];
|
|
26
27
|
collectImages(c, local);
|
|
27
28
|
// "[Image #N]" del texto del mensaje ↔ imágenes del mismo mensaje (en orden)
|
|
@@ -47,6 +48,7 @@ async function findImageByNumber(file, n) {
|
|
|
47
48
|
for await (const line of rl) {
|
|
48
49
|
if (!/"type"\s*:\s*"image"/.test(line)) continue;
|
|
49
50
|
let j; try { j = JSON.parse(line); } catch { continue; }
|
|
51
|
+
if (j.type !== 'user' && j.type !== 'assistant') continue; // Claude Code guarda cada imagen otra vez en líneas internas (api-request-blob): se ignoran
|
|
50
52
|
const c = j.message && j.message.content, local = [];
|
|
51
53
|
collectImages(c, local);
|
|
52
54
|
const nums = [];
|
package/package.json
CHANGED