hopdeck 1.3.0 → 1.3.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 +7 -0
- package/README.en.md +6 -2
- package/README.md +6 -2
- package/bin/hopdeck.js +31 -30
- package/lib/deepsearch.js +95 -0
- package/lib/i18n.js +10 -4
- package/lib/keys.js +1 -1
- package/lib/style.js +17 -5
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
# Cambios
|
|
2
2
|
|
|
3
|
+
## 1.3.1
|
|
4
|
+
|
|
5
|
+
### Nuevo
|
|
6
|
+
- **Cambiar de tema en caliente: `t` o `F9`.** Alterna entre el tema claro y el oscuro sin reiniciar: se repinta todo al instante (lista, chat, panel de git, cuadros) y se recuerda para la próxima vez. Cambia los colores de Hopdeck, no el fondo de tu terminal: úsalo cuando cambies el tema de tu terminal.
|
|
7
|
+
- **`hopdeck theme light|dark|auto`:** lo mismo desde la línea de comandos (`hopdeck theme` solo muestra el actual). La variable `HOPDECK_THEME` sigue mandando sobre lo guardado.
|
|
8
|
+
|
|
3
9
|
## 1.3.0
|
|
4
10
|
|
|
5
11
|
### Nuevo
|
|
6
12
|
- **Panel de git (F8 o `b`):** un tercer panel de solo lectura a la derecha del chat con la rama actual (y lo que lleva por delante o por detrás del remoto), los cambios sin guardar, las ramas recientes y la **actividad de ramas** (cambios de rama, ramas creadas y merges, desde el reflog de git; los de los últimos 10 minutos se destacan). Se refresca solo, no modifica el repositorio y solo aparece si caben unas 140 columnas. Solo en el terminal integrado. En macOS no se llama a `git` si solo existe el atajo que abre el instalador de Apple.
|
|
7
13
|
|
|
8
14
|
### Mejorado
|
|
15
|
+
- **La búsqueda dentro del contenido (`/` y Tab) es unas 10 veces más rápida:** con 2,2 GB de historial pasó de unos 35 s a unos 3,5 s en el peor caso. Se hace en hilos de trabajo en paralelo, sin decodificar el texto, y las conversaciones aparecen en la lista según se encuentran. Además ya no se saltan los archivos de más de 40 MB (ahora el límite es 256 MB), que suelen ser las conversaciones más largas.
|
|
9
16
|
- **La codificación de imágenes Sixel es unas 10 veces más rápida** (el recorte de colores recalculaba todas las cajas en cada paso).
|
|
10
17
|
- **La búsqueda resalta las coincidencias** en los nombres de proyecto y en los títulos; si una conversación aparece porque la coincidencia está dentro de su texto, lleva un `⌕`.
|
|
11
18
|
- **Resumen de chats abiertos en la cabecera de la lista:** `⠋` trabajando, `✔` terminados sin ver, `●` abiertos. La ayuda (`?`) explica los símbolos.
|
package/README.en.md
CHANGED
|
@@ -22,6 +22,8 @@ The project list stays on the left and the conversation on the right.
|
|
|
22
22
|
<img alt="Split view: project list on the left, chat on the right" src="docs/screenshots/02-vista-dividida.svg">
|
|
23
23
|
</picture>
|
|
24
24
|
|
|
25
|
+
<p align="center"><img alt="Hopdeck in action: preview, chat, image on hover and git panel" src="docs/demo.gif" width="900"></p>
|
|
26
|
+
|
|
25
27
|
> **Independent community project.** Not affiliated with, endorsed or sponsored by Anthropic.
|
|
26
28
|
> "Claude" and "Claude Code" are trademarks of Anthropic, PBC. Hopdeck only reads the local history that Claude Code already keeps on your machine and launches the `claude` command you have installed.
|
|
27
29
|
|
|
@@ -97,6 +99,7 @@ You can say no and always use `hopdeck`. If you change your mind: `hopdeck short
|
|
|
97
99
|
| `F3` | Turn the mouse off/on (to select text with the terminal) |
|
|
98
100
|
| `F4` | Hide/show the list to give the chat the full width |
|
|
99
101
|
| `F8` · `b` | Show/hide the git panel (third panel). `b` works with the focus on the list; on macOS `F8` usually needs `Fn` |
|
|
102
|
+
| `t` · `F9` | Switch between light and dark theme instantly (remembered). Also: `hopdeck theme light\|dark\|auto` |
|
|
100
103
|
| `r` · `?` · `q` | Reload · help · quit |
|
|
101
104
|
|
|
102
105
|
Every text box supports a cursor: `←` `→`, `Home`/`End`, `Delete`, and `Ctrl+U` to clear up to the start.
|
|
@@ -188,6 +191,7 @@ It refreshes itself every few seconds and never modifies the repository. It need
|
|
|
188
191
|
|---|---|
|
|
189
192
|
| `hopdeck` | Opens Hopdeck |
|
|
190
193
|
| `hopdeck shortcut on` / `hopdeck shortcut off` | Installs or removes the shortcut so that `claude` opens Hopdeck |
|
|
194
|
+
| `hopdeck theme light` / `dark` / `auto` | Changes the color theme and remembers it (`hopdeck theme` shows the current one) |
|
|
191
195
|
| `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 |
|
|
192
196
|
| `hopdeck doctor` | Checks your setup and tells you how to fix whatever is missing |
|
|
193
197
|
| `hopdeck --list` | Lists the projects as plain text |
|
|
@@ -211,7 +215,7 @@ You almost never need to change anything. The most useful options:
|
|
|
211
215
|
| Environment variable | Effect |
|
|
212
216
|
|---|---|
|
|
213
217
|
| `HOPDECK_LANG` | `es` or `en` (default: system language) |
|
|
214
|
-
| `HOPDECK_THEME` | `light`
|
|
218
|
+
| `HOPDECK_THEME` | `light` or `dark`: takes priority over what `hopdeck theme` saved |
|
|
215
219
|
| `HOPDECK_SIXEL` | `1` forces the real image when hovering `[Image #N]`, `0` always uses blocks (auto-detected by default) |
|
|
216
220
|
| `NO_COLOR` | Disable colors |
|
|
217
221
|
| `CLAUDE_CONFIG_DIR` | Claude Code folder, if it is not `~/.claude` |
|
|
@@ -262,7 +266,7 @@ Always start with `hopdeck doctor`.
|
|
|
262
266
|
|
|
263
267
|
**I want `claude` back to normal.** `hopdeck shortcut off`, or `HOPDECK_SKIP=1 claude` to skip it once.
|
|
264
268
|
|
|
265
|
-
**It looks wrong in my terminal.** Try `
|
|
269
|
+
**It looks wrong in my terminal.** Try `hopdeck theme light` (light background) or `NO_COLOR=1`.
|
|
266
270
|
|
|
267
271
|
## Contributing and license
|
|
268
272
|
|
package/README.md
CHANGED
|
@@ -22,6 +22,8 @@ La lista de proyectos queda a la izquierda y la conversación a la derecha.
|
|
|
22
22
|
<img alt="Vista dividida: lista de proyectos a la izquierda y el chat a la derecha" src="docs/screenshots/02-vista-dividida.svg">
|
|
23
23
|
</picture>
|
|
24
24
|
|
|
25
|
+
<p align="center"><img alt="Hopdeck en acción: vista previa, chat, imagen al pasar el cursor y panel de git" src="docs/demo.gif" width="900"></p>
|
|
26
|
+
|
|
25
27
|
> **Proyecto independiente de la comunidad.** No está afiliado, respaldado ni patrocinado por Anthropic.
|
|
26
28
|
> "Claude" y "Claude Code" son marcas de Anthropic, PBC. Hopdeck solo lee el historial local que Claude Code ya guarda en tu equipo y lanza el comando `claude` que tú tengas instalado.
|
|
27
29
|
|
|
@@ -97,6 +99,7 @@ Puedes decir que no y usar siempre `hopdeck`. Si cambias de idea: `hopdeck short
|
|
|
97
99
|
| `F3` | Apagar/encender el ratón (para seleccionar texto con el terminal) |
|
|
98
100
|
| `F4` | Ocultar/mostrar la lista para dar todo el ancho al chat |
|
|
99
101
|
| `F8` · `b` | Mostrar/ocultar el panel de git (tercer panel). `b` funciona con el foco en la lista; en macOS `F8` suele necesitar `Fn` |
|
|
102
|
+
| `t` · `F9` | Cambiar entre tema claro y oscuro al instante (se recuerda). También: `hopdeck theme light\|dark\|auto` |
|
|
100
103
|
| `r` · `?` · `q` | Recargar · ayuda · salir |
|
|
101
104
|
|
|
102
105
|
En todas las cajas de texto puedes mover el cursor con `←` `→`, ir al principio/final con `Inicio`/`Fin`, borrar con `Supr` y vaciar hasta el inicio con `Ctrl+U`.
|
|
@@ -188,6 +191,7 @@ Se refresca solo cada pocos segundos y no modifica nada en el repositorio. Neces
|
|
|
188
191
|
|---|---|
|
|
189
192
|
| `hopdeck` | Abre Hopdeck |
|
|
190
193
|
| `hopdeck shortcut on` / `hopdeck shortcut off` | Instala o quita el atajo para que `claude` abra Hopdeck |
|
|
194
|
+
| `hopdeck theme light` / `dark` / `auto` | Cambia el tema de colores y lo guarda (`hopdeck theme` muestra el actual) |
|
|
191
195
|
| `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 |
|
|
192
196
|
| `hopdeck doctor` | Revisa tu instalación y dice cómo arreglar lo que falte |
|
|
193
197
|
| `hopdeck --list` | Lista los proyectos en texto plano |
|
|
@@ -211,7 +215,7 @@ Casi nunca hace falta tocar nada. Lo más útil:
|
|
|
211
215
|
| Variable de entorno | Efecto |
|
|
212
216
|
|---|---|
|
|
213
217
|
| `HOPDECK_LANG` | `es` o `en` (por defecto, el idioma del sistema) |
|
|
214
|
-
| `HOPDECK_THEME` | `light`
|
|
218
|
+
| `HOPDECK_THEME` | `light` o `dark`: manda sobre lo guardado con `hopdeck theme` |
|
|
215
219
|
| `HOPDECK_SIXEL` | `1` fuerza la imagen real al pasar el cursor por `[Image #N]`, `0` usa siempre bloques (por defecto se detecta) |
|
|
216
220
|
| `NO_COLOR` | Quita los colores |
|
|
217
221
|
| `CLAUDE_CONFIG_DIR` | Carpeta de Claude Code, si no es `~/.claude` |
|
|
@@ -262,7 +266,7 @@ Empieza siempre por `hopdeck doctor`.
|
|
|
262
266
|
|
|
263
267
|
**Quiero que `claude` vuelva a ser el de siempre.** `hopdeck shortcut off`, o `HOPDECK_SKIP=1 claude` para saltarlo una vez.
|
|
264
268
|
|
|
265
|
-
**Se ve mal en mi terminal.** Prueba `
|
|
269
|
+
**Se ve mal en mi terminal.** Prueba `hopdeck theme light` (fondo claro) o `NO_COLOR=1`.
|
|
266
270
|
|
|
267
271
|
## Colaborar y licencia
|
|
268
272
|
|
package/bin/hopdeck.js
CHANGED
|
@@ -12,13 +12,14 @@ const cp = require('child_process');
|
|
|
12
12
|
const readline = require('readline');
|
|
13
13
|
|
|
14
14
|
const { LANG, T } = require('../lib/i18n');
|
|
15
|
-
const { TRUE, NOCOL, LIGHT, fg, bg, R, C, cw, strW, fit, clean } = require('../lib/style');
|
|
15
|
+
const { TRUE, NOCOL, LIGHT, setTheme, isLight, fg, bg, R, C, cw, strW, fit, clean } = require('../lib/style');
|
|
16
16
|
const { baseName, tidy, home, shortPath, fuzzy, wrapText } = require('../lib/text');
|
|
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
20
|
const { encodeSixel } = require('../lib/sixel');
|
|
21
21
|
const gitlib = require('../lib/git');
|
|
22
|
+
const deepsearch = require('../lib/deepsearch');
|
|
22
23
|
const { collectImages, decodePNG, decodeImage, scaleBox, fitSize, halfBlocks } = images;
|
|
23
24
|
const { parseKeys, KEYMAP, printable, editBuf, normalizeKeys } = require('../lib/keys');
|
|
24
25
|
const { stripJsonc, wtCtrlV, wtSettingsFile } = require('../lib/windows-terminal');
|
|
@@ -168,40 +169,24 @@ function view() {
|
|
|
168
169
|
return out;
|
|
169
170
|
}
|
|
170
171
|
|
|
171
|
-
// búsqueda dentro del texto de las conversaciones (Tab en el modo búsqueda)
|
|
172
|
-
let deepT = null, deepTok = 0, deepPrev = null;
|
|
173
|
-
async function fileHas(file, q) {
|
|
174
|
-
let fh; try { fh = await fs.promises.open(file, 'r'); } catch { return false; }
|
|
175
|
-
try {
|
|
176
|
-
const st = await fh.stat(); if (st.size > 40 * 1024 * 1024) return false;
|
|
177
|
-
const buf = Buffer.alloc(256 * 1024); let pos = 0, carry = '';
|
|
178
|
-
while (pos < st.size) {
|
|
179
|
-
const { bytesRead } = await fh.read(buf, 0, buf.length, pos); if (!bytesRead) break;
|
|
180
|
-
const text = carry + buf.toString('utf8', 0, bytesRead).toLowerCase();
|
|
181
|
-
if (text.includes(q)) return true;
|
|
182
|
-
carry = text.slice(-q.length); pos += bytesRead;
|
|
183
|
-
}
|
|
184
|
-
return false;
|
|
185
|
-
} finally { await fh.close(); }
|
|
186
|
-
}
|
|
172
|
+
// búsqueda dentro del texto de las conversaciones (Tab en el modo búsqueda): en hilos de trabajo y con los aciertos en directo
|
|
173
|
+
let deepT = null, deepTok = 0, deepPrev = null, deepJob = null;
|
|
187
174
|
function queryChanged() {
|
|
188
175
|
clearTimeout(deepT); deepTok++; S.deepHits = null;
|
|
176
|
+
if (deepJob) { deepJob.cancel(); deepJob = null; }
|
|
189
177
|
if (!S.deep || !S.query.trim()) deepPrev = null;
|
|
190
178
|
if (!S.deep || S.query.trim().length < 3) { if (!reloading) S.loading = false; return; }
|
|
191
179
|
const tok = deepTok; S.loading = true; ensureSpin();
|
|
192
|
-
deepT = setTimeout(
|
|
180
|
+
deepT = setTimeout(() => {
|
|
193
181
|
const q = S.query.trim().toLowerCase(), hits = new Set();
|
|
194
182
|
const all = S.projects.flatMap((p) => p.sessions);
|
|
195
183
|
// si la búsqueda anterior era un prefijo de esta, solo hay que mirar sus aciertos
|
|
196
|
-
const list = deepPrev && q.startsWith(deepPrev.q) ? all.filter((x) => deepPrev.hits.has(x.id)) : all;
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
}
|
|
203
|
-
}));
|
|
204
|
-
if (tok === deepTok) { S.deepHits = hits; deepPrev = { q, hits }; S.loading = false; if (active) render(); }
|
|
184
|
+
const list = (deepPrev && q.startsWith(deepPrev.q) ? all.filter((x) => deepPrev.hits.has(x.id)) : all).filter((x) => x.file);
|
|
185
|
+
const idOf = new Map(list.map((x) => [x.file, x.id]));
|
|
186
|
+
S.deepHits = hits; // se va llenando: los aciertos aparecen en la lista según se encuentran
|
|
187
|
+
const job = deepsearch.deepSearch(list.map((x) => x.file), q, (file) => { if (tok !== deepTok) return; hits.add(idOf.get(file)); if (active) scheduleRender(); });
|
|
188
|
+
deepJob = job;
|
|
189
|
+
job.done.then(() => { if (tok === deepTok) { deepPrev = { q, hits }; S.loading = false; deepJob = null; if (active) render(); } });
|
|
205
190
|
}, 250);
|
|
206
191
|
}
|
|
207
192
|
|
|
@@ -783,6 +768,7 @@ function onKeyTree(raw) {
|
|
|
783
768
|
const key = e && e.t === 's' && S.live.has(e.s.id) ? (chatKeyOf(e.s.id) || e.s.id) : e && e.t === 'l' ? e.key : EMBED ? E.shown : null;
|
|
784
769
|
return key ? closeChat(key) : flash(T.notOpen);
|
|
785
770
|
}
|
|
771
|
+
case 't': case 'f9': return toggleTheme(); // tema claro/oscuro en caliente
|
|
786
772
|
case 'b': return toggleGit(); // panel de git (F8 en macOS pide Fn: por defecto son las teclas multimedia)
|
|
787
773
|
case 'i': case 'f7':
|
|
788
774
|
if (e && e.t === 's') {
|
|
@@ -1741,6 +1727,13 @@ function back(key) {
|
|
|
1741
1727
|
}
|
|
1742
1728
|
|
|
1743
1729
|
let flashT;
|
|
1730
|
+
/** Cambia entre el tema claro y el oscuro sin reiniciar, y lo recuerda para la próxima vez. */
|
|
1731
|
+
function toggleTheme() {
|
|
1732
|
+
const next = isLight() ? 'dark' : 'light';
|
|
1733
|
+
setTheme(next); CFG.theme = next; saveCfg();
|
|
1734
|
+
invalidate(); // todas las filas se repintan con los colores nuevos
|
|
1735
|
+
flash(T.themeNow(next));
|
|
1736
|
+
}
|
|
1744
1737
|
function flash(msg) { S.flash = msg; render(); clearTimeout(flashT); flashT = setTimeout(() => { S.flash = ''; render(); }, 2500); }
|
|
1745
1738
|
|
|
1746
1739
|
|
|
@@ -1849,6 +1842,7 @@ async function run() {
|
|
|
1849
1842
|
if (s === '\x1b[17~' && E.focus === 'right') return closeChat(E.shown);
|
|
1850
1843
|
if (s === '\x1b[18~') return openGalleryShown();
|
|
1851
1844
|
if (s === '\x1b[19~') return toggleGit();
|
|
1845
|
+
if (s === '\x1b[20~') return toggleTheme();
|
|
1852
1846
|
if (s === '\x1b[15~') { E.focus = 'left'; if (E.hideSide) E.hideSide = false; S.qs = { q: '', pc: 0, i: 0, off: 0 }; return embedResize(); }
|
|
1853
1847
|
if (s === '\x1bOS' || s === '\x1b[14~') {
|
|
1854
1848
|
E.hideSide = !E.hideSide && E.sessions.has(E.shown);
|
|
@@ -2124,9 +2118,9 @@ function tutorial(afterInstall) {
|
|
|
2124
2118
|
|
|
2125
2119
|
// ───────────────────────── entrada ─────────────────────────
|
|
2126
2120
|
// ── 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 ──
|
|
2127
|
-
const COMMANDS = ['shortcut', 'uninstall', 'doctor', 'help'];
|
|
2121
|
+
const COMMANDS = ['shortcut', 'theme', 'uninstall', 'doctor', 'help'];
|
|
2128
2122
|
// Palabras que alguien escribiría para lo mismo: no son comandos y no se ejecutan, solo sirven para sugerir el correcto
|
|
2129
|
-
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' };
|
|
2123
|
+
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' };
|
|
2130
2124
|
/** Nombre de comando si `arg` es exactamente uno (sin guiones ni variantes); null si no. */
|
|
2131
2125
|
const commandName = (arg) => (COMMANDS.includes(String(arg || '').toLowerCase()) ? String(arg).toLowerCase() : null);
|
|
2132
2126
|
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]; };
|
|
@@ -2154,6 +2148,13 @@ function main() {
|
|
|
2154
2148
|
if (rest.length !== 1 || !['on', 'off'].includes(rest[0])) { console.error(`${C.warn}${T.shortcutUsage}${R}`); process.exit(2); }
|
|
2155
2149
|
install(rest[0] === 'off'); markAsked();
|
|
2156
2150
|
}
|
|
2151
|
+
else if (commandName(cmd) === 'theme') { // hopdeck theme [light|dark|auto]: guarda el tema (la variable HOPDECK_THEME manda sobre esto)
|
|
2152
|
+
if (rest.length > 1 || (rest[0] && !['light', 'dark', 'auto'].includes(rest[0]))) { console.error(`${C.warn}${T.themeUsage}${R}`); process.exit(2); }
|
|
2153
|
+
if (rest[0]) { if (rest[0] === 'auto') delete CFG.theme; else CFG.theme = rest[0]; saveCfg(); }
|
|
2154
|
+
const env = !!process.env.HOPDECK_THEME; // lo que se usará la próxima vez que abras Hopdeck
|
|
2155
|
+
const eff = env ? (LIGHT ? 'light' : 'dark') : CFG.theme || (/;(7|15)$/.test(process.env.COLORFGBG || '') ? 'light' : 'dark');
|
|
2156
|
+
console.log(T.themeShow(CFG.theme || 'auto', eff, CFG.theme ? 'config' : 'auto', env));
|
|
2157
|
+
}
|
|
2157
2158
|
else if (commandName(cmd) === 'uninstall') { // desinstalación completa: atajo, preferencias, caché y programa
|
|
2158
2159
|
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); }
|
|
2159
2160
|
uninstallAll({ yes: rest.length > 0 }).then((code) => process.exit(code), (e) => { console.error(e); process.exit(1); });
|
|
@@ -2183,6 +2184,6 @@ else {
|
|
|
2183
2184
|
readSession, buildProject, scan, scanAsync, finishScan, sortProjects, projectDirs,
|
|
2184
2185
|
view, flatList, stripBlock, offerShortcut, uninstallAll, commandName, suggestCommand, parseTermReplies, sixelOn, SNIP, MARK_A, MARK_B, toggleProject, cacheLoad, selNorm,
|
|
2185
2186
|
decodePNG, decodeImage, scaleBox, fitSize, halfBlocks, collectImages, extractImages,
|
|
2186
|
-
editBuf, normalizeKeys, stripJsonc, wtCtrlV, fbNames, fbOpen, fbRows, sidebarMouse, gitBranch, imageMarkerAt, shownSession, linkChats, findImageByNumber: images.findImageByNumber,
|
|
2187
|
+
editBuf, normalizeKeys, stripJsonc, wtCtrlV, fbNames, fbOpen, fbRows, sidebarMouse, toggleTheme, gitBranch, imageMarkerAt, shownSession, linkChats, findImageByNumber: images.findImageByNumber,
|
|
2187
2188
|
};
|
|
2188
2189
|
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
// Búsqueda dentro del contenido de las conversaciones (Tab en el modo búsqueda). Los archivos de historial pueden sumar
|
|
3
|
+
// gigas (imágenes en base64, resultados de herramientas), así que la búsqueda se hace en hilos de trabajo, en paralelo,
|
|
4
|
+
// y cada acierto se avisa en cuanto se encuentra. Sin dependencias.
|
|
5
|
+
//
|
|
6
|
+
// No se decodifica el texto: se busca con una expresión regular sobre los bytes del archivo (leídos como latin1).
|
|
7
|
+
const fs = require('fs');
|
|
8
|
+
const os = require('os');
|
|
9
|
+
const { Worker, isMainThread, parentPort, workerData } = require('worker_threads');
|
|
10
|
+
|
|
11
|
+
const CHUNK = 1024 * 1024;
|
|
12
|
+
const MAX_SIZE = 256 * 1024 * 1024; // más grande que esto no se busca (antes 40 MB: se perdían las conversaciones más largas)
|
|
13
|
+
const escapeRe = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
14
|
+
// eslint-disable-next-line no-control-regex
|
|
15
|
+
const isAscii = (s) => /^[\u0000-\u007f]*$/.test(s);
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Expresión que busca `q` sin distinguir mayúsculas directamente sobre los bytes del archivo (leídos como latin1):
|
|
19
|
+
* cada letra se sustituye por las variantes (minúscula/mayúscula) codificadas en UTF-8. Así tampoco hace falta decodificar
|
|
20
|
+
* el texto cuando la búsqueda lleva acentos o eñes. `keep` = bytes que hay que arrastrar entre bloques de lectura.
|
|
21
|
+
*/
|
|
22
|
+
function buildMatcher(q) {
|
|
23
|
+
if (isAscii(q)) return { re: new RegExp(escapeRe(q), 'i'), keep: Math.max(0, q.length - 1) };
|
|
24
|
+
const parts = []; let bytes = 0;
|
|
25
|
+
for (const ch of q) {
|
|
26
|
+
const vs = [...new Set([ch, ch.toLowerCase(), ch.toUpperCase()])].filter((v) => [...v].length === 1).map((v) => Buffer.from(v, 'utf8').toString('latin1'));
|
|
27
|
+
bytes += Math.max(...vs.map((v) => v.length));
|
|
28
|
+
parts.push(vs.length > 1 ? '(?:' + vs.map(escapeRe).join('|') + ')' : escapeRe(vs[0]));
|
|
29
|
+
}
|
|
30
|
+
return { re: new RegExp(parts.join('')), keep: Math.max(0, bytes - 1) };
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** ¿El archivo contiene `q` (sin distinguir mayúsculas)? Síncrono: pensado para correr en un hilo de trabajo. */
|
|
34
|
+
function fileHasSync(file, q) {
|
|
35
|
+
let fd;
|
|
36
|
+
try { fd = fs.openSync(file, 'r'); } catch { return false; }
|
|
37
|
+
try {
|
|
38
|
+
const size = fs.fstatSync(fd).size;
|
|
39
|
+
if (size > MAX_SIZE || !q) return false;
|
|
40
|
+
const { re, keep } = buildMatcher(q);
|
|
41
|
+
const buf = Buffer.alloc(CHUNK);
|
|
42
|
+
let pos = 0, carry = '';
|
|
43
|
+
while (pos < size) {
|
|
44
|
+
const n = fs.readSync(fd, buf, 0, CHUNK, pos);
|
|
45
|
+
if (!n) break;
|
|
46
|
+
pos += n;
|
|
47
|
+
const text = carry + buf.latin1Slice(0, n);
|
|
48
|
+
if (re.test(text)) return true;
|
|
49
|
+
carry = keep > 0 ? text.slice(-keep) : '';
|
|
50
|
+
}
|
|
51
|
+
return false;
|
|
52
|
+
} catch { return false; } finally { try { fs.closeSync(fd); } catch { /* */ } }
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (!isMainThread && workerData && workerData.deepSearch) {
|
|
56
|
+
// hilo de trabajo: recorre su parte de los archivos y avisa de cada acierto
|
|
57
|
+
const { files, q } = workerData;
|
|
58
|
+
for (const f of files) if (fileHasSync(f, q)) parentPort.postMessage({ hit: f });
|
|
59
|
+
parentPort.postMessage({ done: true });
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Busca `q` en `files`. `onHit(file)` se llama en cuanto se encuentra un acierto. Devuelve { done: Promise, cancel() }.
|
|
64
|
+
* Reparte los archivos (los grandes primero) entre varios hilos; si no se pueden crear hilos, busca en el hilo principal por tandas.
|
|
65
|
+
*/
|
|
66
|
+
function deepSearch(files, q, onHit, { threads } = {}) {
|
|
67
|
+
let cancelled = false; const workers = [];
|
|
68
|
+
const cancel = () => { cancelled = true; for (const w of workers) { try { w.terminate(); } catch { /* */ } } };
|
|
69
|
+
const sized = files.map((f) => { let s = 0; try { s = fs.statSync(f).size; } catch { /* */ } return [f, s]; }).filter(([, s]) => s <= MAX_SIZE).sort((a, b) => b[1] - a[1]);
|
|
70
|
+
const n = Math.max(1, Math.min(threads || 4, os.cpus().length - 1 || 1, sized.length));
|
|
71
|
+
const parts = Array.from({ length: n }, () => []);
|
|
72
|
+
sized.forEach(([f], i) => parts[i % n].push(f));
|
|
73
|
+
const done = new Promise((resolve) => {
|
|
74
|
+
if (!sized.length) return resolve();
|
|
75
|
+
let left = parts.filter((p) => p.length).length;
|
|
76
|
+
const finish = () => { if (--left <= 0) resolve(); };
|
|
77
|
+
const fallback = (list) => { // sin hilos: en el hilo principal, cediendo el control entre archivos
|
|
78
|
+
let i = 0;
|
|
79
|
+
const step = () => { if (cancelled) return finish(); const t = Date.now(); while (i < list.length && Date.now() - t < 20) { const f = list[i++]; if (fileHasSync(f, q)) onHit(f); } if (i < list.length) setImmediate(step); else finish(); };
|
|
80
|
+
step();
|
|
81
|
+
};
|
|
82
|
+
for (const part of parts) {
|
|
83
|
+
if (!part.length) continue;
|
|
84
|
+
let w;
|
|
85
|
+
try { w = new Worker(__filename, { workerData: { deepSearch: true, files: part, q } }); } catch { fallback(part); continue; }
|
|
86
|
+
workers.push(w);
|
|
87
|
+
let ended = false; const end = () => { if (!ended) { ended = true; finish(); } };
|
|
88
|
+
w.on('message', (m) => { if (cancelled) return; if (m.hit) onHit(m.hit); else if (m.done) end(); });
|
|
89
|
+
w.on('error', end); w.on('exit', end);
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
return { done, cancel };
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
module.exports = { deepSearch, fileHasSync, MAX_SIZE };
|
package/lib/i18n.js
CHANGED
|
@@ -21,7 +21,10 @@ 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 · 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 · uninstall · doctor · help (y --list, --version).\nLas opciones de claude (por ejemplo --model opus) se pasan tal cual: hopdeck --model opus',
|
|
25
|
+
themeNow: (n) => `Tema ${n === 'light' ? 'claro' : 'oscuro'} (guardado)`,
|
|
26
|
+
themeUsage: 'Uso: hopdeck theme light (claro) · hopdeck theme dark (oscuro) · hopdeck theme auto (según el terminal) · hopdeck theme (ver el actual)',
|
|
27
|
+
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).' : '.'),
|
|
25
28
|
shortcutUsage: 'Uso: hopdeck shortcut on (instalar el atajo de claude) · hopdeck shortcut off (quitarlo)',
|
|
26
29
|
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
30
|
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',
|
|
@@ -38,7 +41,7 @@ const T = {
|
|
|
38
41
|
help: ['Teclas', '↑↓ j k mover', '⏎ → l abrir / desplegar', '← h volver / plegar', 'n nueva conversación',
|
|
39
42
|
'/ buscar (Tab: contenido)', 'p fijar proyecto ★', 'x H ocultar / ver ocultos', 'o abrir una carpeta',
|
|
40
43
|
'c F6 cerrar el chat abierto', 'i F7 ver imágenes del chat', 'R a renombrar / archivar', 'Ctrl+P F5 saltar a cualquier chat', '[ ] ancho de la lista', 'r recargar',
|
|
41
|
-
'F1 F2 foco lista / chat', 'F3 copiar texto (ratón)', 'F4 ocultar la lista', 'b F8 panel de git', '⠋ ✔ ● trabajando · terminó · abierta', 'q salir'],
|
|
44
|
+
'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'],
|
|
42
45
|
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',
|
|
43
46
|
idle3: 'F1 proyectos · F2 chat', bar1: 'proyectos', bar2: 'chat', bar3: 'minimizar',
|
|
44
47
|
inside: 'Ya estás dentro de Hopdeck (F1 para ir a la lista de proyectos).',
|
|
@@ -61,7 +64,10 @@ const T = {
|
|
|
61
64
|
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',
|
|
62
65
|
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',
|
|
63
66
|
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',
|
|
67
|
+
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',
|
|
68
|
+
themeNow: (n) => `${n === 'light' ? 'Light' : 'Dark'} theme (saved)`,
|
|
69
|
+
themeUsage: 'Usage: hopdeck theme light · hopdeck theme dark · hopdeck theme auto (follow the terminal) · hopdeck theme (show the current one)',
|
|
70
|
+
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).' : '.'),
|
|
65
71
|
shortcutUsage: 'Usage: hopdeck shortcut on (install the claude shortcut) · hopdeck shortcut off (remove it)',
|
|
66
72
|
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
73
|
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',
|
|
@@ -78,7 +84,7 @@ const T = {
|
|
|
78
84
|
help: ['Keys', '↑↓ j k move', '⏎ → l open / expand', '← h back / collapse', 'n new conversation',
|
|
79
85
|
'/ search (Tab: content)', 'p pin project ★', 'x H hide / show hidden', 'o open a folder',
|
|
80
86
|
'c F6 close the open chat', 'i F7 view the chat images', 'R a rename / archive', 'Ctrl+P F5 jump to any chat', '[ ] list width', 'r reload',
|
|
81
|
-
'F1 F2 focus list / chat', 'F3 copy text (mouse)', 'F4 hide the list', 'b F8 git panel', '⠋ ✔ ● working · done · open', 'q quit'],
|
|
87
|
+
'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'],
|
|
82
88
|
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',
|
|
83
89
|
idle3: 'F1 projects · F2 chat', bar1: 'projects', bar2: 'chat', bar3: 'minimize',
|
|
84
90
|
inside: 'You are already inside Hopdeck (F1 jumps to the project list).',
|
package/lib/keys.js
CHANGED
|
@@ -18,7 +18,7 @@ function parseKeys(s) {
|
|
|
18
18
|
const KEYMAP = {
|
|
19
19
|
'\x1b[A': 'up', '\x1bOA': 'up', '\x1b[B': 'down', '\x1bOB': 'down', '\x1b[C': 'right', '\x1bOC': 'right',
|
|
20
20
|
'\x1b[D': 'left', '\x1bOD': 'left', '\x1b[5~': 'pgup', '\x1b[6~': 'pgdn', '\x1b[H': 'home', '\x1b[1~': 'home',
|
|
21
|
-
'\x1b[17~': 'f6', '\x1b[18~': 'f7', '\x10': 'ctrlp', '\x1b[15~': 'f5', '\x1b[I': 'focus', '\x1bOP': 'f1', '\x1b[11~': 'f1', '\x1bOQ': 'f2', '\x1b[12~': 'f2', '\x1b[F': 'end', '\x1b[4~': 'end', '\r': 'enter', '\n': 'enter', '\x1b': 'esc', '\x7f': 'bs', '\b': 'bs', '\x03': 'ctrlc',
|
|
21
|
+
'\x1b[17~': 'f6', '\x1b[18~': 'f7', '\x1b[20~': 'f9', '\x10': 'ctrlp', '\x1b[15~': 'f5', '\x1b[I': 'focus', '\x1bOP': 'f1', '\x1b[11~': 'f1', '\x1bOQ': 'f2', '\x1b[12~': 'f2', '\x1b[F': 'end', '\x1b[4~': 'end', '\r': 'enter', '\n': 'enter', '\x1b': 'esc', '\x7f': 'bs', '\b': 'bs', '\x03': 'ctrlc',
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
|
package/lib/style.js
CHANGED
|
@@ -2,20 +2,32 @@
|
|
|
2
2
|
// Colores ANSI, tema claro/oscuro y utilidades de ancho visual (emoji / CJK = 2 columnas).
|
|
3
3
|
const TRUE = /truecolor|24bit/i.test(process.env.COLORTERM || '') || !!process.env.WT_SESSION;
|
|
4
4
|
const NOCOL = !!process.env.NO_COLOR; // https://no-color.org
|
|
5
|
-
// tema: HOPDECK_THEME=light|dark
|
|
6
|
-
|
|
5
|
+
// tema, por orden de prioridad: HOPDECK_THEME=light|dark → la elección guardada con "hopdeck theme" → COLORFGBG (fondo claro
|
|
6
|
+
// termina en ;7 o ;15) → oscuro
|
|
7
|
+
const savedTheme = () => { try { const t = JSON.parse(require('fs').readFileSync(process.env.HOPDECK_CONFIG || require('path').join(require('os').homedir(), '.hopdeck.json'), 'utf8')).theme; return t === 'light' || t === 'dark' ? t : ''; } catch { return ''; } };
|
|
8
|
+
const THEME_FROM = process.env.HOPDECK_THEME ? 'env' : savedTheme() ? 'config' : 'auto';
|
|
9
|
+
const LIGHT = THEME_FROM === 'env' ? process.env.HOPDECK_THEME === 'light' : THEME_FROM === 'config' ? savedTheme() === 'light' : /;(7|15)$/.test(process.env.COLORFGBG || '');
|
|
7
10
|
const fg = (r, g, b, n) => (NOCOL ? '' : TRUE ? `\x1b[38;2;${r};${g};${b}m` : `\x1b[38;5;${n}m`);
|
|
8
11
|
const bg = (r, g, b, n) => (NOCOL ? '' : TRUE ? `\x1b[48;2;${r};${g};${b}m` : `\x1b[48;5;${n}m`);
|
|
9
12
|
const R = '\x1b[0m';
|
|
10
|
-
const
|
|
13
|
+
const PALETTES = {
|
|
14
|
+
light: {
|
|
11
15
|
brand: fg(190, 85, 50, 166), accent: fg(79, 70, 229, 62), text: fg(38, 38, 44, 235), dim: fg(105, 105, 114, 242),
|
|
12
16
|
faint: fg(190, 190, 196, 250), ok: fg(28, 128, 68, 29), warn: fg(168, 104, 16, 130),
|
|
13
17
|
selOn: bg(232, 234, 252, 189), selOff: bg(234, 234, 238, 255), bold: NOCOL ? '' : '\x1b[1m', ital: NOCOL ? '' : '\x1b[3m',
|
|
14
|
-
}
|
|
18
|
+
},
|
|
19
|
+
dark: {
|
|
15
20
|
brand: fg(217, 119, 87, 173), accent: fg(129, 140, 248, 105), text: fg(232, 230, 227, 253), dim: fg(128, 128, 134, 244),
|
|
16
21
|
faint: fg(78, 78, 84, 239), ok: fg(126, 196, 143, 114), warn: fg(224, 175, 104, 179),
|
|
17
22
|
selOn: bg(38, 40, 64, 236), selOff: bg(34, 34, 36, 235), bold: NOCOL ? '' : '\x1b[1m', ital: NOCOL ? '' : '\x1b[3m',
|
|
23
|
+
},
|
|
18
24
|
};
|
|
25
|
+
// La paleta se puede cambiar en caliente (tecla t / F9): `C` es un solo objeto que se actualiza en su sitio, y todo el programa lo lee
|
|
26
|
+
// al pintar, nunca lo copia.
|
|
27
|
+
let light = LIGHT;
|
|
28
|
+
const C = { ...PALETTES[light ? 'light' : 'dark'] };
|
|
29
|
+
const setTheme = (name) => { light = name === 'light'; Object.assign(C, PALETTES[light ? 'light' : 'dark']); };
|
|
30
|
+
const isLight = () => light;
|
|
19
31
|
|
|
20
32
|
// ancho visual (emoji / CJK = 2 columnas)
|
|
21
33
|
function cw(c) {
|
|
@@ -59,4 +71,4 @@ function fit(segs, width, base = '') {
|
|
|
59
71
|
return out;
|
|
60
72
|
}
|
|
61
73
|
|
|
62
|
-
module.exports = { TRUE, NOCOL, LIGHT, fg, bg, R, C, cw, strW, fit, clean };
|
|
74
|
+
module.exports = { TRUE, NOCOL, LIGHT, THEME_FROM, setTheme, isLight, fg, bg, R, C, cw, strW, fit, clean };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hopdeck",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.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",
|
|
@@ -44,7 +44,8 @@
|
|
|
44
44
|
"scripts": {
|
|
45
45
|
"test": "node --test test/unit.test.js test/e2e.test.js test/ui.test.js",
|
|
46
46
|
"doctor": "node bin/hopdeck.js doctor",
|
|
47
|
-
"screenshots": "node scripts/screenshots.js"
|
|
47
|
+
"screenshots": "node scripts/screenshots.js",
|
|
48
|
+
"demo": "node scripts/demo.js"
|
|
48
49
|
},
|
|
49
50
|
"dependencies": {
|
|
50
51
|
"@lydell/node-pty": "1.2.0-beta.18",
|