hopdeck 1.2.6 → 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 +18 -0
- package/README.en.md +43 -7
- package/README.md +43 -7
- package/bin/hopdeck.js +149 -40
- package/lib/deepsearch.js +95 -0
- package/lib/git.js +94 -0
- package/lib/i18n.js +12 -6
- package/lib/keys.js +1 -1
- package/lib/sixel.js +14 -12
- package/lib/style.js +17 -5
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
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
|
+
|
|
9
|
+
## 1.3.0
|
|
10
|
+
|
|
11
|
+
### Nuevo
|
|
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.
|
|
13
|
+
|
|
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.
|
|
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).
|
|
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 `⌕`.
|
|
18
|
+
- **Resumen de chats abiertos en la cabecera de la lista:** `⠋` trabajando, `✔` terminados sin ver, `●` abiertos. La ayuda (`?`) explica los símbolos.
|
|
19
|
+
- **Capturas del README en claro y oscuro:** se muestra la que corresponde al tema de quien lee.
|
|
20
|
+
|
|
3
21
|
## 1.2.6
|
|
4
22
|
|
|
5
23
|
### Mejorado
|
package/README.en.md
CHANGED
|
@@ -17,7 +17,12 @@
|
|
|
17
17
|
Type `claude` in your terminal and **pick which project and conversation to continue**, without leaving and without `cd`.
|
|
18
18
|
The project list stays on the left and the conversation on the right.
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
<picture>
|
|
21
|
+
<source media="(prefers-color-scheme: light)" srcset="docs/screenshots/02-vista-dividida-light.svg">
|
|
22
|
+
<img alt="Split view: project list on the left, chat on the right" src="docs/screenshots/02-vista-dividida.svg">
|
|
23
|
+
</picture>
|
|
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>
|
|
21
26
|
|
|
22
27
|
> **Independent community project.** Not affiliated with, endorsed or sponsored by Anthropic.
|
|
23
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.
|
|
@@ -61,7 +66,10 @@ You can say no and always use `hopdeck`. If you change your mind: `hopdeck short
|
|
|
61
66
|
|
|
62
67
|
## Getting started
|
|
63
68
|
|
|
64
|
-
|
|
69
|
+
<picture>
|
|
70
|
+
<source media="(prefers-color-scheme: light)" srcset="docs/screenshots/01-lista-y-vista-previa-light.svg">
|
|
71
|
+
<img alt="Project list and preview of the selected conversation" src="docs/screenshots/01-lista-y-vista-previa.svg">
|
|
72
|
+
</picture>
|
|
65
73
|
|
|
66
74
|
1. Pick a project with `↑` `↓` or by hovering it with the mouse.
|
|
67
75
|
2. `→` or `⏎` expands its conversations. While you move, the right pane shows **a preview**.
|
|
@@ -90,6 +98,8 @@ You can say no and always use `hopdeck`. If you change your mind: `hopdeck short
|
|
|
90
98
|
| `[` `]` | Narrow / widen the list |
|
|
91
99
|
| `F3` | Turn the mouse off/on (to select text with the terminal) |
|
|
92
100
|
| `F4` | Hide/show the list to give the chat the full width |
|
|
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` |
|
|
93
103
|
| `r` · `?` · `q` | Reload · help · quit |
|
|
94
104
|
|
|
95
105
|
Every text box supports a cursor: `←` `→`, `Home`/`End`, `Delete`, and `Ctrl+U` to clear up to the start.
|
|
@@ -102,7 +112,10 @@ With no chat open, the right pane shows the last messages of the selected conver
|
|
|
102
112
|
|
|
103
113
|
### Pick a folder
|
|
104
114
|
|
|
105
|
-
|
|
115
|
+
<picture>
|
|
116
|
+
<source media="(prefers-color-scheme: light)" srcset="docs/screenshots/03-selector-de-carpetas-light.svg">
|
|
117
|
+
<img alt="Folder picker" src="docs/screenshots/03-selector-de-carpetas.svg">
|
|
118
|
+
</picture>
|
|
106
119
|
|
|
107
120
|
Press `o` to open a chat in **any folder**, with or without history, without typing paths:
|
|
108
121
|
|
|
@@ -122,18 +135,40 @@ It always starts at `~`. Recently used folders appear on top (`↻ recent`).
|
|
|
122
135
|
|
|
123
136
|
### Quick jump
|
|
124
137
|
|
|
125
|
-
|
|
138
|
+
<picture>
|
|
139
|
+
<source media="(prefers-color-scheme: light)" srcset="docs/screenshots/05-salto-rapido-light.svg">
|
|
140
|
+
<img alt="Quick jump with Ctrl+P" src="docs/screenshots/05-salto-rapido.svg">
|
|
141
|
+
</picture>
|
|
126
142
|
|
|
127
143
|
`Ctrl+P` searches **every** conversation of **every** project (title, project and first message). `⏎` opens it directly.
|
|
128
144
|
|
|
129
145
|
### Images in the chat
|
|
130
146
|
|
|
131
|
-
|
|
147
|
+
<picture>
|
|
148
|
+
<source media="(prefers-color-scheme: light)" srcset="docs/screenshots/04-hover-imagen-light.svg">
|
|
149
|
+
<img alt="Floating box with the image when hovering [Image #1]" src="docs/screenshots/04-hover-imagen.svg">
|
|
150
|
+
</picture>
|
|
132
151
|
|
|
133
152
|
- 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
153
|
- `i` / `F7` opens a **gallery** with all the conversation's images (`← →` navigate, `o` opens it in the system viewer, `Esc` closes).
|
|
135
154
|
- An image you just pasted and have not sent yet **cannot** be shown: it is not in the history yet.
|
|
136
155
|
|
|
156
|
+
### Git panel
|
|
157
|
+
|
|
158
|
+
`F8` (or `b` with the focus on the list) opens a read-only **third panel** to the right of the chat with the git state of the chat's folder (or the selected project):
|
|
159
|
+
|
|
160
|
+
- the **current branch**, with how far ahead or behind the remote it is;
|
|
161
|
+
- the **uncommitted changes** (modified, new or deleted files);
|
|
162
|
+
- the **recent branches**;
|
|
163
|
+
- the **branch activity**: branch switches, created branches and merges, taken from git's `reflog`. Anything from the last 10 minutes has an orange dot. It tells you when a branch was created or switched, whether by Claude or by anyone else (git does not record who did it).
|
|
164
|
+
|
|
165
|
+
<picture>
|
|
166
|
+
<source media="(prefers-color-scheme: light)" srcset="docs/screenshots/06-panel-git-light.svg">
|
|
167
|
+
<img alt="Git panel with the branch, the changes and the branch activity" src="docs/screenshots/06-panel-git.svg">
|
|
168
|
+
</picture>
|
|
169
|
+
|
|
170
|
+
It refreshes itself every few seconds and never modifies the repository. It needs `git` and a terminal of about 140 columns or more (if it does not fit, you get a notice). It is only in the built-in terminal, not in tmux mode.
|
|
171
|
+
|
|
137
172
|
### Chat status
|
|
138
173
|
|
|
139
174
|
- A new chat shows up in the list immediately (`● New conversation`), even if the folder has no history yet.
|
|
@@ -156,6 +191,7 @@ It always starts at `~`. Recently used folders appear on top (`↻ recent`).
|
|
|
156
191
|
|---|---|
|
|
157
192
|
| `hopdeck` | Opens Hopdeck |
|
|
158
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) |
|
|
159
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 |
|
|
160
196
|
| `hopdeck doctor` | Checks your setup and tells you how to fix whatever is missing |
|
|
161
197
|
| `hopdeck --list` | Lists the projects as plain text |
|
|
@@ -179,7 +215,7 @@ You almost never need to change anything. The most useful options:
|
|
|
179
215
|
| Environment variable | Effect |
|
|
180
216
|
|---|---|
|
|
181
217
|
| `HOPDECK_LANG` | `es` or `en` (default: system language) |
|
|
182
|
-
| `HOPDECK_THEME` | `light`
|
|
218
|
+
| `HOPDECK_THEME` | `light` or `dark`: takes priority over what `hopdeck theme` saved |
|
|
183
219
|
| `HOPDECK_SIXEL` | `1` forces the real image when hovering `[Image #N]`, `0` always uses blocks (auto-detected by default) |
|
|
184
220
|
| `NO_COLOR` | Disable colors |
|
|
185
221
|
| `CLAUDE_CONFIG_DIR` | Claude Code folder, if it is not `~/.claude` |
|
|
@@ -230,7 +266,7 @@ Always start with `hopdeck doctor`.
|
|
|
230
266
|
|
|
231
267
|
**I want `claude` back to normal.** `hopdeck shortcut off`, or `HOPDECK_SKIP=1 claude` to skip it once.
|
|
232
268
|
|
|
233
|
-
**It looks wrong in my terminal.** Try `
|
|
269
|
+
**It looks wrong in my terminal.** Try `hopdeck theme light` (light background) or `NO_COLOR=1`.
|
|
234
270
|
|
|
235
271
|
## Contributing and license
|
|
236
272
|
|
package/README.md
CHANGED
|
@@ -17,7 +17,12 @@
|
|
|
17
17
|
Escribe `claude` en tu terminal y **elige en qué proyecto y conversación seguir**, sin salir y sin hacer `cd`.
|
|
18
18
|
La lista de proyectos queda a la izquierda y la conversación a la derecha.
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
<picture>
|
|
21
|
+
<source media="(prefers-color-scheme: light)" srcset="docs/screenshots/02-vista-dividida-light.svg">
|
|
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
|
+
</picture>
|
|
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>
|
|
21
26
|
|
|
22
27
|
> **Proyecto independiente de la comunidad.** No está afiliado, respaldado ni patrocinado por Anthropic.
|
|
23
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.
|
|
@@ -61,7 +66,10 @@ Puedes decir que no y usar siempre `hopdeck`. Si cambias de idea: `hopdeck short
|
|
|
61
66
|
|
|
62
67
|
## Primeros pasos
|
|
63
68
|
|
|
64
|
-
|
|
69
|
+
<picture>
|
|
70
|
+
<source media="(prefers-color-scheme: light)" srcset="docs/screenshots/01-lista-y-vista-previa-light.svg">
|
|
71
|
+
<img alt="Lista de proyectos y vista previa de la conversación seleccionada" src="docs/screenshots/01-lista-y-vista-previa.svg">
|
|
72
|
+
</picture>
|
|
65
73
|
|
|
66
74
|
1. Elige un proyecto con `↑` `↓` o pasando el ratón por encima.
|
|
67
75
|
2. `→` o `⏎` despliega sus conversaciones. Mientras te mueves, el panel derecho muestra **una vista previa**.
|
|
@@ -90,6 +98,8 @@ Puedes decir que no y usar siempre `hopdeck`. Si cambias de idea: `hopdeck short
|
|
|
90
98
|
| `[` `]` | Estrechar / ensanchar la lista |
|
|
91
99
|
| `F3` | Apagar/encender el ratón (para seleccionar texto con el terminal) |
|
|
92
100
|
| `F4` | Ocultar/mostrar la lista para dar todo el ancho al chat |
|
|
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` |
|
|
93
103
|
| `r` · `?` · `q` | Recargar · ayuda · salir |
|
|
94
104
|
|
|
95
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`.
|
|
@@ -102,7 +112,10 @@ Sin ningún chat abierto, el panel derecho muestra los últimos mensajes de la c
|
|
|
102
112
|
|
|
103
113
|
### Elegir una carpeta
|
|
104
114
|
|
|
105
|
-
|
|
115
|
+
<picture>
|
|
116
|
+
<source media="(prefers-color-scheme: light)" srcset="docs/screenshots/03-selector-de-carpetas-light.svg">
|
|
117
|
+
<img alt="Selector de carpetas" src="docs/screenshots/03-selector-de-carpetas.svg">
|
|
118
|
+
</picture>
|
|
106
119
|
|
|
107
120
|
Pulsa `o` para abrir un chat en **cualquier carpeta**, tenga o no historial, sin escribir rutas:
|
|
108
121
|
|
|
@@ -122,18 +135,40 @@ Empieza siempre en `~`. Las carpetas que usaste hace poco aparecen arriba (`↻
|
|
|
122
135
|
|
|
123
136
|
### Salto rápido
|
|
124
137
|
|
|
125
|
-
|
|
138
|
+
<picture>
|
|
139
|
+
<source media="(prefers-color-scheme: light)" srcset="docs/screenshots/05-salto-rapido-light.svg">
|
|
140
|
+
<img alt="Salto rápido con Ctrl+P" src="docs/screenshots/05-salto-rapido.svg">
|
|
141
|
+
</picture>
|
|
126
142
|
|
|
127
143
|
`Ctrl+P` busca entre **todas** las conversaciones de **todos** los proyectos (título, proyecto y primer mensaje). `⏎` la abre directamente.
|
|
128
144
|
|
|
129
145
|
### Imágenes del chat
|
|
130
146
|
|
|
131
|
-
|
|
147
|
+
<picture>
|
|
148
|
+
<source media="(prefers-color-scheme: light)" srcset="docs/screenshots/04-hover-imagen-light.svg">
|
|
149
|
+
<img alt="Cuadro flotante con la imagen al pasar el cursor por [Image #1]" src="docs/screenshots/04-hover-imagen.svg">
|
|
150
|
+
</picture>
|
|
132
151
|
|
|
133
152
|
- 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
153
|
- `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
154
|
- Una imagen recién pegada y aún sin enviar **no** se puede mostrar: todavía no está en el historial.
|
|
136
155
|
|
|
156
|
+
### Panel de git
|
|
157
|
+
|
|
158
|
+
`F8` (o `b` con el foco en la lista) abre un **tercer panel** a la derecha del chat, de solo lectura, con el estado git de la carpeta del chat (o del proyecto seleccionado):
|
|
159
|
+
|
|
160
|
+
- la **rama actual**, con lo que lleva por delante o por detrás del remoto;
|
|
161
|
+
- los **cambios sin guardar** (archivos modificados, nuevos o borrados);
|
|
162
|
+
- las **ramas recientes**;
|
|
163
|
+
- la **actividad de ramas**: cambios de rama, ramas creadas y merges, tomados del registro (`reflog`) de git. Los de los últimos 10 minutos llevan un punto naranja. Sirve para enterarte de cuándo se creó o cambió de rama, desde Claude o desde donde sea (git no dice quién lo hizo).
|
|
164
|
+
|
|
165
|
+
<picture>
|
|
166
|
+
<source media="(prefers-color-scheme: light)" srcset="docs/screenshots/06-panel-git-light.svg">
|
|
167
|
+
<img alt="Panel de git con la rama, los cambios y la actividad de ramas" src="docs/screenshots/06-panel-git.svg">
|
|
168
|
+
</picture>
|
|
169
|
+
|
|
170
|
+
Se refresca solo cada pocos segundos y no modifica nada en el repositorio. Necesita `git` y una terminal de unas 140 columnas o más (si no cabe, te lo avisa). Solo está en el terminal integrado, no en el modo tmux.
|
|
171
|
+
|
|
137
172
|
### Estado de los chats
|
|
138
173
|
|
|
139
174
|
- Un chat nuevo aparece al instante en la lista (`● Nueva conversación`), aunque la carpeta aún no tenga historial.
|
|
@@ -156,6 +191,7 @@ Empieza siempre en `~`. Las carpetas que usaste hace poco aparecen arriba (`↻
|
|
|
156
191
|
|---|---|
|
|
157
192
|
| `hopdeck` | Abre Hopdeck |
|
|
158
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) |
|
|
159
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 |
|
|
160
196
|
| `hopdeck doctor` | Revisa tu instalación y dice cómo arreglar lo que falte |
|
|
161
197
|
| `hopdeck --list` | Lista los proyectos en texto plano |
|
|
@@ -179,7 +215,7 @@ Casi nunca hace falta tocar nada. Lo más útil:
|
|
|
179
215
|
| Variable de entorno | Efecto |
|
|
180
216
|
|---|---|
|
|
181
217
|
| `HOPDECK_LANG` | `es` o `en` (por defecto, el idioma del sistema) |
|
|
182
|
-
| `HOPDECK_THEME` | `light`
|
|
218
|
+
| `HOPDECK_THEME` | `light` o `dark`: manda sobre lo guardado con `hopdeck theme` |
|
|
183
219
|
| `HOPDECK_SIXEL` | `1` fuerza la imagen real al pasar el cursor por `[Image #N]`, `0` usa siempre bloques (por defecto se detecta) |
|
|
184
220
|
| `NO_COLOR` | Quita los colores |
|
|
185
221
|
| `CLAUDE_CONFIG_DIR` | Carpeta de Claude Code, si no es `~/.claude` |
|
|
@@ -230,7 +266,7 @@ Empieza siempre por `hopdeck doctor`.
|
|
|
230
266
|
|
|
231
267
|
**Quiero que `claude` vuelva a ser el de siempre.** `hopdeck shortcut off`, o `HOPDECK_SKIP=1 claude` para saltarlo una vez.
|
|
232
268
|
|
|
233
|
-
**Se ve mal en mi terminal.** Prueba `
|
|
269
|
+
**Se ve mal en mi terminal.** Prueba `hopdeck theme light` (fondo claro) o `NO_COLOR=1`.
|
|
234
270
|
|
|
235
271
|
## Colaborar y licencia
|
|
236
272
|
|
package/bin/hopdeck.js
CHANGED
|
@@ -12,12 +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
|
+
const gitlib = require('../lib/git');
|
|
22
|
+
const deepsearch = require('../lib/deepsearch');
|
|
21
23
|
const { collectImages, decodePNG, decodeImage, scaleBox, fitSize, halfBlocks } = images;
|
|
22
24
|
const { parseKeys, KEYMAP, printable, editBuf, normalizeKeys } = require('../lib/keys');
|
|
23
25
|
const { stripJsonc, wtCtrlV, wtSettingsFile } = require('../lib/windows-terminal');
|
|
@@ -127,7 +129,7 @@ function ago(ms) {
|
|
|
127
129
|
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: '' };
|
|
128
130
|
const SIDEBAR = process.argv.includes('--sidebar');
|
|
129
131
|
let EMBED = false; // vista dividida con terminal embebido (Windows / sin tmux)
|
|
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 };
|
|
132
|
+
const E = { sessions: new Map(), shown: null, focus: 'left', pend: null, deps: null, mouse: CFG.mouse !== false, hideSide: false, git: !!CFG.git, note: null, sel: null, gallery: null, hover: null, sixelDetected: false, cell: { w: 10, h: 20 }, sixelKey: null, sixelAt: 0, sixelStale: false, sixelRetry: null };
|
|
131
133
|
const SPIN = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
|
|
132
134
|
let spinT = null, frameN = 0, reloading = false;
|
|
133
135
|
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)));
|
|
@@ -167,40 +169,24 @@ function view() {
|
|
|
167
169
|
return out;
|
|
168
170
|
}
|
|
169
171
|
|
|
170
|
-
// búsqueda dentro del texto de las conversaciones (Tab en el modo búsqueda)
|
|
171
|
-
let deepT = null, deepTok = 0, deepPrev = null;
|
|
172
|
-
async function fileHas(file, q) {
|
|
173
|
-
let fh; try { fh = await fs.promises.open(file, 'r'); } catch { return false; }
|
|
174
|
-
try {
|
|
175
|
-
const st = await fh.stat(); if (st.size > 40 * 1024 * 1024) return false;
|
|
176
|
-
const buf = Buffer.alloc(256 * 1024); let pos = 0, carry = '';
|
|
177
|
-
while (pos < st.size) {
|
|
178
|
-
const { bytesRead } = await fh.read(buf, 0, buf.length, pos); if (!bytesRead) break;
|
|
179
|
-
const text = carry + buf.toString('utf8', 0, bytesRead).toLowerCase();
|
|
180
|
-
if (text.includes(q)) return true;
|
|
181
|
-
carry = text.slice(-q.length); pos += bytesRead;
|
|
182
|
-
}
|
|
183
|
-
return false;
|
|
184
|
-
} finally { await fh.close(); }
|
|
185
|
-
}
|
|
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;
|
|
186
174
|
function queryChanged() {
|
|
187
175
|
clearTimeout(deepT); deepTok++; S.deepHits = null;
|
|
176
|
+
if (deepJob) { deepJob.cancel(); deepJob = null; }
|
|
188
177
|
if (!S.deep || !S.query.trim()) deepPrev = null;
|
|
189
178
|
if (!S.deep || S.query.trim().length < 3) { if (!reloading) S.loading = false; return; }
|
|
190
179
|
const tok = deepTok; S.loading = true; ensureSpin();
|
|
191
|
-
deepT = setTimeout(
|
|
180
|
+
deepT = setTimeout(() => {
|
|
192
181
|
const q = S.query.trim().toLowerCase(), hits = new Set();
|
|
193
182
|
const all = S.projects.flatMap((p) => p.sessions);
|
|
194
183
|
// si la búsqueda anterior era un prefijo de esta, solo hay que mirar sus aciertos
|
|
195
|
-
const list = deepPrev && q.startsWith(deepPrev.q) ? all.filter((x) => deepPrev.hits.has(x.id)) : all;
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
}
|
|
202
|
-
}));
|
|
203
|
-
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(); } });
|
|
204
190
|
}, 250);
|
|
205
191
|
}
|
|
206
192
|
|
|
@@ -345,6 +331,34 @@ function chatMark(id) {
|
|
|
345
331
|
return ['● ', C.ok];
|
|
346
332
|
}
|
|
347
333
|
|
|
334
|
+
/** Trocea `text` en segmentos [[texto, estilo]] resaltando las coincidencias (sin distinguir mayúsculas) con la búsqueda `q` (en minúsculas). */
|
|
335
|
+
function hl(text, q, style) {
|
|
336
|
+
const t = String(text);
|
|
337
|
+
if (!q) return [[t, style]];
|
|
338
|
+
const low = t.toLowerCase();
|
|
339
|
+
if (low.length !== t.length) return [[t, style]]; // algunas letras cambian de largo al pasar a minúsculas: no se resalta
|
|
340
|
+
const out = []; let i = 0;
|
|
341
|
+
for (let at = low.indexOf(q); at >= 0; at = low.indexOf(q, i)) {
|
|
342
|
+
if (at > i) out.push([t.slice(i, at), style]);
|
|
343
|
+
out.push([t.slice(at, at + q.length), C.brand + C.bold]);
|
|
344
|
+
i = at + q.length;
|
|
345
|
+
}
|
|
346
|
+
if (i < t.length) out.push([t.slice(i), style]);
|
|
347
|
+
return out.length ? out : [[t, style]];
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
/** Resumen de los chats abiertos para la cabecera de la lista: trabajando ⠋, terminados sin ver ✔, abiertos ●. */
|
|
351
|
+
function liveSummary() {
|
|
352
|
+
if (!EMBED) return [];
|
|
353
|
+
let w = 0, u = 0, o = 0;
|
|
354
|
+
for (const x of E.sessions.values()) { if (x.working) w++; else if (x.unseen) u++; else o++; }
|
|
355
|
+
const segs = [];
|
|
356
|
+
if (w) segs.push([' ' + spin() + ' ' + w, C.accent]);
|
|
357
|
+
if (u) segs.push([' ✔ ' + u, C.warn]);
|
|
358
|
+
if (o) segs.push([' ● ' + o, C.ok]);
|
|
359
|
+
return segs;
|
|
360
|
+
}
|
|
361
|
+
|
|
348
362
|
const tailFit = (t, n) => (strW(t) > n && n > 3 ? '…' + t.slice(t.length - (n - 1)) : t);
|
|
349
363
|
|
|
350
364
|
function frameTree(W, H) {
|
|
@@ -354,8 +368,9 @@ function frameTree(W, H) {
|
|
|
354
368
|
const bodyH = H - 5;
|
|
355
369
|
S.coff = scroll(S.coff, S.c, bodyH);
|
|
356
370
|
const lines = [];
|
|
357
|
-
lines.push(fit([[' » ', C.brand], ['Hop', C.brand + C.bold], ['deck', C.text + C.bold], [' ' + S.projects.length, C.dim], [S.loading ? ' ' + spin() : '', C.accent]], W));
|
|
371
|
+
lines.push(fit([[' » ', C.brand], ['Hop', C.brand + C.bold], ['deck', C.text + C.bold], [' ' + S.projects.length, C.dim], [S.loading ? ' ' + spin() : '', C.accent], ...liveSummary()], W));
|
|
358
372
|
lines.push(C.faint + '─'.repeat(W) + R);
|
|
373
|
+
const sq0 = S.query.trim().toLowerCase(); // búsqueda activa: se resaltan las coincidencias
|
|
359
374
|
const qsList = S.qs ? qsItems() : null;
|
|
360
375
|
const fbList = S.fb && !S.qs ? fbRows() : null;
|
|
361
376
|
if (fbList) { S.fb.i = clamp(S.fb.i, 0, Math.max(0, fbList.length - 1)); S.fb.off = scroll(S.fb.off, S.fb.i, bodyH); lines[0] = fit([[' » ' + T.fbTitle, C.accent + C.bold]], W); }
|
|
@@ -399,7 +414,7 @@ function frameTree(W, H) {
|
|
|
399
414
|
// 4) los proyectos plegados se atenúan: el desplegado, el de esta carpeta y el seleccionado destacan
|
|
400
415
|
const nameC = sel ? C.text + C.bold : e.p.hidden ? C.dim : e.p.isCwd ? C.ok : e.open ? C.text : C.dim;
|
|
401
416
|
lines.push(fit([mark, [e.open ? ' ▾ ' : ' ▸ ', e.open ? C.accent : C.dim],
|
|
402
|
-
[(e.p.pinned ? '★ ' : '') + (e.p.isCwd ? '● ' : '')
|
|
417
|
+
[(e.p.pinned ? '★ ' : '') + (e.p.isCwd ? '● ' : ''), nameC], ...hl(e.p.name, sq0, nameC)], W - 13, base) +
|
|
403
418
|
fit(right, 13, base));
|
|
404
419
|
} else if (e.t === 'm') {
|
|
405
420
|
lines.push(fit([mark, [' ', ''], [T.more(e.n), sel ? C.text : C.dim]], W, base));
|
|
@@ -412,7 +427,8 @@ function frameTree(W, H) {
|
|
|
412
427
|
} else {
|
|
413
428
|
const [mk, mc] = chatMark(e.s.id);
|
|
414
429
|
const arch = CFG.archived.includes(e.s.id), tag = e.s.dup ? '#' + e.s.id.slice(0, 4) : '';
|
|
415
|
-
|
|
430
|
+
const ts = sel ? C.text + C.bold : arch ? C.dim : C.text, inTxt = sq0 && !e.s.title.toLowerCase().includes(sq0);
|
|
431
|
+
lines.push(fit([mark, [' ', ''], [mk, mc], ...hl(e.s.title, sq0, ts), ...(inTxt ? [[' ⌕', C.dim]] : [])], W - 13, base) +
|
|
416
432
|
fit([[tag.padEnd(6), C.accent], [ago(e.s.mtime).padStart(6), C.dim], [' ', '']], 13, base));
|
|
417
433
|
}
|
|
418
434
|
}
|
|
@@ -752,6 +768,8 @@ function onKeyTree(raw) {
|
|
|
752
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;
|
|
753
769
|
return key ? closeChat(key) : flash(T.notOpen);
|
|
754
770
|
}
|
|
771
|
+
case 't': case 'f9': return toggleTheme(); // tema claro/oscuro en caliente
|
|
772
|
+
case 'b': return toggleGit(); // panel de git (F8 en macOS pide Fn: por defecto son las teclas multimedia)
|
|
755
773
|
case 'i': case 'f7':
|
|
756
774
|
if (e && e.t === 's') {
|
|
757
775
|
if (EMBED) return openGallery(e.p.name, e.s);
|
|
@@ -837,7 +855,79 @@ function loadDeps() {
|
|
|
837
855
|
function embedLayout() {
|
|
838
856
|
const W = process.stdout.columns || 100, H = process.stdout.rows || 30;
|
|
839
857
|
const SW = E.hideSide ? 0 : CFG.sidebar ? clamp(CFG.sidebar, 24, 80) : clamp(Math.floor(W * 0.3), 36, 46);
|
|
840
|
-
|
|
858
|
+
const room = Math.max(10, W - SW - (SW ? 1 : 0));
|
|
859
|
+
const GW = E.git && room - GIT_W - 1 >= GIT_MIN_CHAT ? GIT_W : 0; // tercer panel (git): solo si el chat conserva un ancho cómodo
|
|
860
|
+
return { W, H, SW, GW, rw: GW ? room - GW - 1 : room, rh: Math.max(3, H - 1), th: Math.max(3, H - 3) };
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
// ───────────────────────── panel de git (tercer panel, F8) ─────────────────────────
|
|
864
|
+
const GIT_W = 38, GIT_MIN_CHAT = 60;
|
|
865
|
+
const GITC = new Map(); // carpeta → { t, loading, data }
|
|
866
|
+
/** Estado de git de la carpeta, de la caché; si tiene más de 4 s se vuelve a leer en segundo plano. */
|
|
867
|
+
function gitInfo(cwd) {
|
|
868
|
+
const hit = GITC.get(cwd), now = Date.now();
|
|
869
|
+
if (hit && (hit.loading || now - hit.t < 4000)) return hit.data;
|
|
870
|
+
GITC.set(cwd, { t: hit ? hit.t : 0, loading: true, data: hit ? hit.data : null });
|
|
871
|
+
gitlib.readGit(cwd).then((data) => { GITC.set(cwd, { t: Date.now(), loading: false, data }); if (active && E.git) scheduleRender(); });
|
|
872
|
+
return hit ? hit.data : null;
|
|
873
|
+
}
|
|
874
|
+
const gitCwd = () => {
|
|
875
|
+
const sh = E.sessions.get(E.shown);
|
|
876
|
+
if (sh && sh.cwd) return sh.cwd;
|
|
877
|
+
const e = !S.help && !S.qs ? flatList()[S.c] : null;
|
|
878
|
+
return e && e.p ? e.p.cwd : null;
|
|
879
|
+
};
|
|
880
|
+
function toggleGit() {
|
|
881
|
+
if (!EMBED) return flash(T.gitOnlyEmbed);
|
|
882
|
+
if (!E.git) {
|
|
883
|
+
const SW = E.hideSide ? 0 : CFG.sidebar ? clamp(CFG.sidebar, 24, 80) : clamp(Math.floor((process.stdout.columns || 100) * 0.3), 36, 46);
|
|
884
|
+
const need = SW + (SW ? 1 : 0) + GIT_MIN_CHAT + GIT_W + 1;
|
|
885
|
+
if ((process.stdout.columns || 100) < need) return flash(T.gitNarrow(need));
|
|
886
|
+
}
|
|
887
|
+
E.git = !E.git; CFG.git = E.git; saveCfg();
|
|
888
|
+
embedResize();
|
|
889
|
+
}
|
|
890
|
+
/** Las `rh` filas del panel de git: título, línea y contenido (rama, cambios, ramas recientes, actividad de ramas). */
|
|
891
|
+
function gitRows(GW, rh) {
|
|
892
|
+
const cwd = gitCwd(), d = cwd ? gitInfo(cwd) : null;
|
|
893
|
+
const out = [fit([[' ⎇ Git', C.accent + C.bold], [cwd ? ' ' + baseName(cwd) : '', C.dim]], GW), C.faint + '─'.repeat(GW) + R];
|
|
894
|
+
const body = [], line = (...segs) => body.push(segs);
|
|
895
|
+
const row = (left, right, rc) => body.push({ left, right, rc });
|
|
896
|
+
if (!cwd) line([' ' + T.gitNone, C.dim]);
|
|
897
|
+
else if (!d) line([' ' + spin() + ' …', C.accent]);
|
|
898
|
+
else if (!d.ok) { line([' ' + (d.missing ? T.gitMissing : d.repo ? T.gitErr : T.gitNoRepo), C.dim]); if (d.err && d.repo && !d.missing) line([' ' + d.err, C.faint]); }
|
|
899
|
+
else {
|
|
900
|
+
const s = d.status, n = s.files.length, now = Date.now();
|
|
901
|
+
line([' ', ''], [(s.detached ? '⌀ ' : '⎇ ') + s.branch, C.brand + C.bold], [s.ahead ? ' ↑' + s.ahead : '', C.ok], [s.behind ? ' ↓' + s.behind : '', C.warn]);
|
|
902
|
+
line(n ? [' ● ', C.warn] : [' ✔ ', C.ok], [n ? T.gitDirty(n) : T.gitClean, n ? C.warn : C.dim]);
|
|
903
|
+
const room = Math.max(0, Math.min(6, rh - 2 - 14));
|
|
904
|
+
for (const f of s.files.slice(0, room)) {
|
|
905
|
+
const code = f.x === '?' ? '?' : f.x !== ' ' ? f.x : f.y;
|
|
906
|
+
line([' ', ''], [code + ' ', code === 'D' ? C.brand : code === 'M' ? C.warn : C.ok], [f.path, C.text]);
|
|
907
|
+
}
|
|
908
|
+
if (n > room && room > 0) line([' ', ''], [T.gitMore(n - room), C.dim]);
|
|
909
|
+
body.push(null);
|
|
910
|
+
line([' ' + T.gitBranches, C.dim + C.bold]);
|
|
911
|
+
for (const b of d.branches.slice(0, 5)) row([[b.cur ? ' ● ' : ' ', b.cur ? C.ok : ''], [b.name, b.cur ? C.text + C.bold : C.text]], b.t ? ago(b.t * 1000) : '');
|
|
912
|
+
body.push(null);
|
|
913
|
+
line([' ' + T.gitActivity, C.dim + C.bold]);
|
|
914
|
+
if (!d.activity.length) line([' ' + T.gitNoActivity, C.dim]);
|
|
915
|
+
for (const a of d.activity) {
|
|
916
|
+
const fresh = now - a.t * 1000 < 10 * 60 * 1000, mark = [fresh ? ' ● ' : ' ', fresh ? C.brand : ''];
|
|
917
|
+
const txt = a.k === 'switch' ? [[a.from, C.dim], [' → ', C.accent], [a.to, C.text]]
|
|
918
|
+
: a.k === 'create' ? [['+ ', C.ok], [a.name, C.text], ...(a.from !== 'HEAD' && strW(a.name) + strW(a.from) + strW(T.gitFrom) + 19 <= GW ? [[' ' + T.gitFrom + ' ' + a.from, C.dim]] : [])]
|
|
919
|
+
: a.k === 'merge' ? [['⇄ merge ', C.accent], [a.what, C.text]] : [['↻ rebase', C.accent]];
|
|
920
|
+
row([mark, ...txt], ago(a.t * 1000));
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
for (const b of body) {
|
|
924
|
+
if (out.length >= rh) break;
|
|
925
|
+
if (b === null) out.push(' '.repeat(GW));
|
|
926
|
+
else if (Array.isArray(b)) out.push(fit(b, GW));
|
|
927
|
+
else { const rw = strW(b.right) + 1; out.push(fit(b.left, GW - rw) + fit([[b.right, b.rc || C.dim], [' ', '']], rw)); }
|
|
928
|
+
}
|
|
929
|
+
while (out.length < rh) out.push(' '.repeat(GW));
|
|
930
|
+
return out;
|
|
841
931
|
}
|
|
842
932
|
|
|
843
933
|
function sgr(c, fgMode) {
|
|
@@ -1206,7 +1296,7 @@ function headerRow(sh, width) {
|
|
|
1206
1296
|
}
|
|
1207
1297
|
|
|
1208
1298
|
function renderEmbed() {
|
|
1209
|
-
const { W, H, SW, rw, rh, th } = embedLayout();
|
|
1299
|
+
const { W, H, SW, GW, rw, rh, th } = embedLayout();
|
|
1210
1300
|
if (W < 70 || H < 12) { process.stdout.write('\x1b[2J\x1b[H' + T.small); invalidate(); return; }
|
|
1211
1301
|
const left = SW ? frameTree(SW, rh) : null;
|
|
1212
1302
|
const sh = E.sessions.get(E.shown);
|
|
@@ -1223,6 +1313,7 @@ function renderEmbed() {
|
|
|
1223
1313
|
? termRow(sh.term, ty, pop.left, selRange(ty, rw)) + pop.rows[ty - pop.top] + termRow(sh.term, ty, rw - pop.left - pop.bw, selRange(ty, rw), pop.left + pop.bw)
|
|
1224
1314
|
: null);
|
|
1225
1315
|
const div = (E.focus === 'right' ? C.accent : C.faint) + '│' + R;
|
|
1316
|
+
const gitR = GW ? gitRows(GW, rh) : null;
|
|
1226
1317
|
for (let y = 0; y < rh; y++) {
|
|
1227
1318
|
const ty = y - 2; // las 2 primeras filas del panel derecho son el título y su línea
|
|
1228
1319
|
const gd = E.gallery && E.gallery.dec.get(E.gallery.i);
|
|
@@ -1231,14 +1322,14 @@ function renderEmbed() {
|
|
|
1231
1322
|
: y === 1 ? C.faint + '─'.repeat(rw) + R : gRows[ty])
|
|
1232
1323
|
: y === 0 ? headerRow(hdr, rw) : y === 1 ? C.faint + '─'.repeat(rw) + R
|
|
1233
1324
|
: sh && sh.ready ? (popRow(ty) || termRow(sh.term, ty, rw, selRange(ty, rw))) : sh ? loaderRow(ty, rw, th, sh.title) : pvRows ? pvRows[ty] : idleRow(ty, rw, th);
|
|
1234
|
-
rowsOut.push((left ? (left[y] || ' '.repeat(SW)) + div : '') + right);
|
|
1325
|
+
rowsOut.push((left ? (left[y] || ' '.repeat(SW)) + div : '') + right + (gitR ? C.faint + '│' + R + gitR[y] : ''));
|
|
1235
1326
|
}
|
|
1236
1327
|
const live = E.sessions.size;
|
|
1237
1328
|
const k = (key, d) => [[key, C.accent], [' ' + d + ' ', C.dim]];
|
|
1238
1329
|
const sb = sh && sh.ready ? sh.term.buffer.active : null;
|
|
1239
1330
|
const back = sb ? sb.baseY - sb.viewportY : 0;
|
|
1240
1331
|
rowsOut.push(fit([[' ', ''], [E.note ? E.note.t + ' ' : '', C.ok], [back > 0 ? T.up(back, sb && sb.baseY ? Math.round((100 * sb.viewportY) / sb.baseY) : -1) + ' ' : '', C.warn],
|
|
1241
|
-
...k('F1', T.bar1), ...k('F2', T.bar2), ...k('F3', E.mouse ? T.bar4 : T.bar5), ...k('F4', E.hideSide ? T.bar7 : T.bar6),
|
|
1332
|
+
...k('F1', T.bar1), ...k('F2', T.bar2), ...k('F3', E.mouse ? T.bar4 : T.bar5), ...k('F4', E.hideSide ? T.bar7 : T.bar6), ...k('F8', T.bar8),
|
|
1242
1333
|
[live ? '● ' + live : '', C.ok]], W));
|
|
1243
1334
|
const changes = diffRows(rowsOut);
|
|
1244
1335
|
// 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)
|
|
@@ -1388,8 +1479,9 @@ function sidebarMouse(b, x, y, type, rows = process.stdout.rows || 30) {
|
|
|
1388
1479
|
|
|
1389
1480
|
function onMouse(b, x, y, type) {
|
|
1390
1481
|
if (E.gallery) return;
|
|
1391
|
-
const { SW, rh } = embedLayout();
|
|
1482
|
+
const { SW, GW, rw, rh } = embedLayout();
|
|
1392
1483
|
const sh = E.sessions.get(E.shown);
|
|
1484
|
+
if (GW && x > (SW ? SW + 1 : 0) + rw) { if (E.hover) { E.hover = null; scheduleRender(); } return; } // el panel de git es de solo lectura
|
|
1393
1485
|
if (b & 64) { // rueda
|
|
1394
1486
|
E.hover = null;
|
|
1395
1487
|
const up = (b & 1) === 0;
|
|
@@ -1635,6 +1727,13 @@ function back(key) {
|
|
|
1635
1727
|
}
|
|
1636
1728
|
|
|
1637
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
|
+
}
|
|
1638
1737
|
function flash(msg) { S.flash = msg; render(); clearTimeout(flashT); flashT = setTimeout(() => { S.flash = ''; render(); }, 2500); }
|
|
1639
1738
|
|
|
1640
1739
|
|
|
@@ -1725,6 +1824,7 @@ async function run() {
|
|
|
1725
1824
|
}
|
|
1726
1825
|
process.stdout.on('resize', EMBED ? embedResize : () => { invalidate(); render(); });
|
|
1727
1826
|
if (EMBED) setInterval(pollChats, 400);
|
|
1827
|
+
if (EMBED) setInterval(() => { if (active && E.git && embedLayout().GW) scheduleRender(); }, 4000); // el panel de git se refresca solo
|
|
1728
1828
|
setInterval(() => { // lista siempre al día
|
|
1729
1829
|
if (S.loading || reloading || S.searching || S.query || S.prompt !== null || S.help) return;
|
|
1730
1830
|
if (SIDEBAR || EMBED) { const e = flatList()[S.c]; reloadAsync(() => { if (!e) return; const i = flatList().findIndex((x) => x.t === e.t && x.p.key === e.p.key && (e.t !== 's' || x.s.id === e.s.id)); if (i >= 0) S.c = i; }, true); }
|
|
@@ -1741,6 +1841,8 @@ async function run() {
|
|
|
1741
1841
|
if (E.gallery) { for (const k of parseKeys(s)) galleryKey(k); return; }
|
|
1742
1842
|
if (s === '\x1b[17~' && E.focus === 'right') return closeChat(E.shown);
|
|
1743
1843
|
if (s === '\x1b[18~') return openGalleryShown();
|
|
1844
|
+
if (s === '\x1b[19~') return toggleGit();
|
|
1845
|
+
if (s === '\x1b[20~') return toggleTheme();
|
|
1744
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(); }
|
|
1745
1847
|
if (s === '\x1bOS' || s === '\x1b[14~') {
|
|
1746
1848
|
E.hideSide = !E.hideSide && E.sessions.has(E.shown);
|
|
@@ -2016,9 +2118,9 @@ function tutorial(afterInstall) {
|
|
|
2016
2118
|
|
|
2017
2119
|
// ───────────────────────── entrada ─────────────────────────
|
|
2018
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 ──
|
|
2019
|
-
const COMMANDS = ['shortcut', 'uninstall', 'doctor', 'help'];
|
|
2121
|
+
const COMMANDS = ['shortcut', 'theme', 'uninstall', 'doctor', 'help'];
|
|
2020
2122
|
// Palabras que alguien escribiría para lo mismo: no son comandos y no se ejecutan, solo sirven para sugerir el correcto
|
|
2021
|
-
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' };
|
|
2022
2124
|
/** Nombre de comando si `arg` es exactamente uno (sin guiones ni variantes); null si no. */
|
|
2023
2125
|
const commandName = (arg) => (COMMANDS.includes(String(arg || '').toLowerCase()) ? String(arg).toLowerCase() : null);
|
|
2024
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]; };
|
|
@@ -2046,6 +2148,13 @@ function main() {
|
|
|
2046
2148
|
if (rest.length !== 1 || !['on', 'off'].includes(rest[0])) { console.error(`${C.warn}${T.shortcutUsage}${R}`); process.exit(2); }
|
|
2047
2149
|
install(rest[0] === 'off'); markAsked();
|
|
2048
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
|
+
}
|
|
2049
2158
|
else if (commandName(cmd) === 'uninstall') { // desinstalación completa: atajo, preferencias, caché y programa
|
|
2050
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); }
|
|
2051
2160
|
uninstallAll({ yes: rest.length > 0 }).then((code) => process.exit(code), (e) => { console.error(e); process.exit(1); });
|
|
@@ -2071,10 +2180,10 @@ if (require.main === module) main();
|
|
|
2071
2180
|
else {
|
|
2072
2181
|
// al hacer require() (pruebas automáticas) no se ejecuta nada: solo se exponen las piezas puras
|
|
2073
2182
|
module.exports = {
|
|
2074
|
-
cw, strW, fit, clean, imageExt, exportImages, safeId, findClaude, install, backupProfile, ago, tidy, fuzzy, wrapText, parseKeys, KEYMAP, isType, T, S, CFG, E,
|
|
2183
|
+
cw, strW, fit, clean, hl, gitRows, gitInfo, toggleGit, imageExt, exportImages, safeId, findClaude, install, backupProfile, ago, tidy, fuzzy, wrapText, parseKeys, KEYMAP, isType, T, S, CFG, E,
|
|
2075
2184
|
readSession, buildProject, scan, scanAsync, finishScan, sortProjects, projectDirs,
|
|
2076
2185
|
view, flatList, stripBlock, offerShortcut, uninstallAll, commandName, suggestCommand, parseTermReplies, sixelOn, SNIP, MARK_A, MARK_B, toggleProject, cacheLoad, selNorm,
|
|
2077
2186
|
decodePNG, decodeImage, scaleBox, fitSize, halfBlocks, collectImages, extractImages,
|
|
2078
|
-
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,
|
|
2079
2188
|
};
|
|
2080
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/git.js
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
// Lectura de solo lectura del estado de git de una carpeta, para el panel de git: rama actual, cambios sin guardar,
|
|
3
|
+
// ramas recientes y la actividad de ramas (cambios de rama, ramas creadas, merges) que git guarda en su reflog.
|
|
4
|
+
// Nunca modifica el repositorio. Solo se ejecutan comandos fijos (`status`, `reflog show`, `for-each-ref`) sin shell.
|
|
5
|
+
const cp = require('child_process');
|
|
6
|
+
|
|
7
|
+
// GIT_OPTIONAL_LOCKS=0: `status` no escribe en .git. core.fsmonitor=false: un repositorio ajeno no puede lanzar un programa
|
|
8
|
+
// propio a través de su configuración mientras lo miramos. LC_ALL=C: salida estable, sin traducir.
|
|
9
|
+
const ENV = { ...process.env, GIT_OPTIONAL_LOCKS: '0', GIT_TERMINAL_PROMPT: '0', GIT_PAGER: 'cat', LC_ALL: 'C' };
|
|
10
|
+
const BASE = ['-c', 'core.fsmonitor=false', '--no-pager'];
|
|
11
|
+
|
|
12
|
+
function run(cwd, args) {
|
|
13
|
+
return new Promise((resolve) => {
|
|
14
|
+
try {
|
|
15
|
+
cp.execFile('git', [...BASE, ...args], { cwd, env: ENV, timeout: 6000, maxBuffer: 2 * 1024 * 1024, windowsHide: true },
|
|
16
|
+
(err, out, errOut) => resolve({ ok: !err, out: String(out || ''), err: String(errOut || ''), missing: !!(err && err.code === 'ENOENT') }));
|
|
17
|
+
} catch (e) { resolve({ ok: false, out: '', err: String(e.message || e), missing: false }); }
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** `git status --porcelain=v1 -b` → { branch, upstream, ahead, behind, detached, files: [{ x, y, path }] } */
|
|
22
|
+
function parseStatus(out) {
|
|
23
|
+
const res = { branch: '', upstream: '', ahead: 0, behind: 0, detached: false, files: [] };
|
|
24
|
+
for (const line of String(out).split('\n')) {
|
|
25
|
+
if (!line) continue;
|
|
26
|
+
if (line.startsWith('## ')) {
|
|
27
|
+
const h = line.slice(3);
|
|
28
|
+
let m;
|
|
29
|
+
if ((m = h.match(/^No commits yet on (.+)$/))) { res.branch = m[1]; continue; }
|
|
30
|
+
if (/^HEAD \(no branch\)/.test(h)) { res.detached = true; res.branch = 'HEAD'; continue; }
|
|
31
|
+
m = h.match(/^(.+?)(?:\.\.\.(\S+))?(?: \[(.+)\])?$/);
|
|
32
|
+
if (m) {
|
|
33
|
+
res.branch = m[1]; res.upstream = m[2] || '';
|
|
34
|
+
const a = (m[3] || '').match(/ahead (\d+)/), b = (m[3] || '').match(/behind (\d+)/);
|
|
35
|
+
res.ahead = a ? +a[1] : 0; res.behind = b ? +b[1] : 0;
|
|
36
|
+
}
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
if (line.length < 4) continue;
|
|
40
|
+
res.files.push({ x: line[0], y: line[1], path: line.slice(3).replace(/^"(.*)"$/, '$1') });
|
|
41
|
+
}
|
|
42
|
+
return res;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* `git reflog show --all --date=unix --format=%gd%x09%gs` → actividad de ramas, la más reciente primero:
|
|
47
|
+
* { k: 'switch', from, to, t } · { k: 'create', name, from, t } · { k: 'merge', what, t } · { k: 'rebase', t } (t en segundos)
|
|
48
|
+
*/
|
|
49
|
+
function parseActivity(out, limit = 20) {
|
|
50
|
+
const list = [];
|
|
51
|
+
String(out).split('\n').forEach((line, idx) => {
|
|
52
|
+
const m = line.match(/^(.+)@\{(\d+)\}\t(.*)$/);
|
|
53
|
+
if (!m) return;
|
|
54
|
+
const [, ref, ts, subj] = m, t = +ts;
|
|
55
|
+
let e = null, s;
|
|
56
|
+
if (ref === 'HEAD' && (s = subj.match(/^checkout: moving from (.+) to (.+)$/))) e = { k: 'switch', from: s[1], to: s[2], t };
|
|
57
|
+
else if (ref !== 'HEAD' && (s = subj.match(/^branch: Created from (.+)$/))) e = { k: 'create', name: ref, from: s[1], t };
|
|
58
|
+
else if (ref === 'HEAD' && (s = subj.match(/^merge (.+?)(?:: .*)?$/))) e = { k: 'merge', what: s[1], t };
|
|
59
|
+
else if (ref === 'HEAD' && /^rebase.*\(finish\)/.test(subj)) e = { k: 'rebase', t };
|
|
60
|
+
if (e) list.push({ ...e, idx });
|
|
61
|
+
});
|
|
62
|
+
return list.sort((a, b) => b.t - a.t || a.idx - b.idx).slice(0, limit).map(({ idx, ...e }) => e);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** `git for-each-ref …` con %(HEAD)\t%(refname:short)\t%(committerdate:unix) → [{ cur, name, t }] */
|
|
66
|
+
function parseBranches(out) {
|
|
67
|
+
return String(out).split('\n').map((l) => l.split('\t')).filter((p) => p.length >= 3 && p[1])
|
|
68
|
+
.map(([h, name, t]) => ({ cur: h.trim() === '*', name, t: +t || 0 }));
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// En macOS, sin las Command Line Tools /usr/bin/git es un atajo que abre el instalador de Apple: no se llama a git si es lo único que hay.
|
|
72
|
+
let macGit = null;
|
|
73
|
+
async function gitUsableOnMac() {
|
|
74
|
+
if (process.platform !== 'darwin') return true;
|
|
75
|
+
if (macGit !== null) return macGit;
|
|
76
|
+
const run1 = (cmd, args) => new Promise((res) => { try { cp.execFile(cmd, args, { timeout: 3000 }, (err, out) => res({ ok: !err, out: String(out || '').trim() })); } catch { res({ ok: false, out: '' }); } });
|
|
77
|
+
macGit = (await run1('/usr/bin/xcode-select', ['-p'])).ok || (await run1('/usr/bin/which', ['git'])).out.replace(/\/+$/, '') !== '/usr/bin/git';
|
|
78
|
+
return macGit;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** Estado completo de una carpeta: { ok, repo, missing, status, activity, branches } (nunca lanza). */
|
|
82
|
+
async function readGit(cwd) {
|
|
83
|
+
if (!(await gitUsableOnMac())) return { ok: false, repo: true, missing: true };
|
|
84
|
+
const st = await run(cwd, ['status', '--porcelain=v1', '-b']);
|
|
85
|
+
if (st.missing) return { ok: false, repo: true, missing: true };
|
|
86
|
+
if (!st.ok) return { ok: false, repo: !/not a git repository/i.test(st.err), err: st.err.trim().split('\n')[0] || '' };
|
|
87
|
+
const [rl, br] = await Promise.all([
|
|
88
|
+
run(cwd, ['reflog', 'show', '--all', '--date=unix', '--format=%gd%x09%gs']),
|
|
89
|
+
run(cwd, ['for-each-ref', '--sort=-committerdate', '--count=8', '--format=%(HEAD)%09%(refname:short)%09%(committerdate:unix)', 'refs/heads']),
|
|
90
|
+
]);
|
|
91
|
+
return { ok: true, repo: true, status: parseStatus(st.out), activity: rl.ok ? parseActivity(rl.out) : [], branches: br.ok ? parseBranches(br.out) : [] };
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
module.exports = { readGit, parseStatus, parseActivity, parseBranches };
|
package/lib/i18n.js
CHANGED
|
@@ -18,10 +18,13 @@ const T = {
|
|
|
18
18
|
imgNoPrev: 'No se puede previsualizar este formato', imgHint: '← → navegar o abrir en el visor esc cerrar', imgFolder: 'Imágenes abiertas en el visor',
|
|
19
19
|
more: (n) => `mostrar ${n} más…`, busyRename: 'Cierra la conversación antes de renombrarla', renameLbl: 'nombre',
|
|
20
20
|
copied: (n) => `Copiado (${n} caracteres)`, archMsg: 'Archivada (H para verlas)', unarchMsg: 'Desarchivada', qsHint: 'saltar a cualquier conversación',
|
|
21
|
-
prevHint: '⏎ reanudar esta conversación', 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',
|
|
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', '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).',
|
|
@@ -58,10 +61,13 @@ const T = {
|
|
|
58
61
|
imgNoPrev: 'This format cannot be previewed', imgHint: '← → browse o open in viewer esc close', imgFolder: 'Images opened in the viewer',
|
|
59
62
|
more: (n) => `show ${n} more…`, busyRename: 'Close the conversation before renaming it', renameLbl: 'name',
|
|
60
63
|
copied: (n) => `Copied (${n} chars)`, archMsg: 'Archived (H to show)', unarchMsg: 'Unarchived', qsHint: 'jump to any conversation',
|
|
61
|
-
prevHint: '⏎ resume this conversation', 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',
|
|
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', '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/sixel.js
CHANGED
|
@@ -29,22 +29,24 @@ function quantize(rgb, w, h, maxColors = 256) {
|
|
|
29
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
30
|
const bins = [];
|
|
31
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
|
-
|
|
32
|
+
// cada caja guarda su mejor corte (canal y puntuación) calculado una sola vez al crearla: así cada paso solo recalcula las dos cajas nuevas
|
|
33
|
+
const mk = (items) => {
|
|
34
|
+
let cnt = 0; const lo = [255, 255, 255], hi = [0, 0, 0];
|
|
35
|
+
for (const p of items) { cnt += p.c; if (p.r < lo[0]) lo[0] = p.r; if (p.r > hi[0]) hi[0] = p.r; if (p.g < lo[1]) lo[1] = p.g; if (p.g > hi[1]) hi[1] = p.g; if (p.b < lo[2]) lo[2] = p.b; if (p.b > hi[2]) hi[2] = p.b; }
|
|
36
|
+
let ch = 0, rng = hi[0] - lo[0]; if (hi[1] - lo[1] > rng) { ch = 1; rng = hi[1] - lo[1]; } if (hi[2] - lo[2] > rng) { ch = 2; rng = hi[2] - lo[2]; }
|
|
37
|
+
return { items, ch: 'rgb'[ch], score: items.length < 2 ? -1 : rng * Math.sqrt(cnt) };
|
|
38
|
+
};
|
|
39
|
+
let boxes = [mk(bins)];
|
|
33
40
|
while (boxes.length < maxColors) {
|
|
34
|
-
|
|
35
|
-
let
|
|
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
|
-
});
|
|
41
|
+
let bi = -1, best = -1;
|
|
42
|
+
for (let i = 0; i < boxes.length; i++) if (boxes[i].score > best) { best = boxes[i].score; bi = i; }
|
|
42
43
|
if (bi < 0) break;
|
|
43
|
-
const
|
|
44
|
-
const half = bx.reduce((
|
|
44
|
+
const { items, ch } = boxes[bi], bx = items.slice().sort((p, q) => p[ch] - q[ch]);
|
|
45
|
+
const half = bx.reduce((s2, p) => s2 + p.c, 0) / 2; let acc = 0, cut = 1;
|
|
45
46
|
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
|
+
boxes.splice(bi, 1, mk(bx.slice(0, cut)), mk(bx.slice(cut)));
|
|
47
48
|
}
|
|
49
|
+
boxes = boxes.map((bx) => bx.items);
|
|
48
50
|
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
51
|
const map = new Int16Array(32768).fill(-1); // cada color de 5 bits → su caja
|
|
50
52
|
boxes.forEach((bx, i) => { for (const p of bx) map[p.id] = i; });
|
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
|
+
"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",
|