cdd-cli 3.1.3 → 3.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
6
6
 
7
+ ## [3.1.4] - 2025-10-17
8
+
9
+ ### Changed
10
+
11
+ - Documentation cleanup: translate `FIXES_APPLIED.md` to English, remove Spanish duplicate and references to internal audit doc.
12
+ - No functional code changes.
13
+
7
14
  ## [3.1.3] - 2025-10-17
8
15
 
9
16
  ### Fixed
package/FIXES_APPLIED.md CHANGED
@@ -1,127 +1,127 @@
1
- # Correcciones Aplicadas - CDD CLI
1
+ # Applied Fixes - CDD CLI
2
2
 
3
- **Fecha:** 2025-10-17
4
- **Proyecto:** CDD-CLI (CLI Docker Dashboard)
3
+ **Date:** 2025-10-17
4
+ **Project:** CDD-CLI (CLI Docker Dashboard)
5
5
 
6
6
  ---
7
7
 
8
- ## Resumen de Correcciones
8
+ ## Fixes Summary
9
9
 
10
- Se han aplicado **11 correcciones críticas** que resuelven problemas de seguridad, estabilidad y portabilidad identificados en la auditoría de código.
10
+ A total of 11 critical fixes were applied to address security, stability, and portability issues identified during the code audit.
11
11
 
12
12
  ---
13
13
 
14
- ## 1. CORRECCIONES CRÍTICAS APLICADAS
14
+ ## 1. APPLIED CRITICAL FIXES
15
15
 
16
- ### ✅ 1.1. Corrección del Orden de Imports
16
+ ### ✅ 1.1. Import Order Fix
17
17
 
18
- **Archivo:** `src/helpers/dockerService/serviceComponents/containerActions.js`
18
+ **File:** `src/helpers/dockerService/serviceComponents/containerActions.js`
19
19
 
20
- **Problema:** Las importaciones estaban después de las exportaciones.
20
+ **Issue:** Imports were declared after exports.
21
21
 
22
- **Solución aplicada:**
22
+ **Applied fix:**
23
23
  ```javascript
24
- // ANTES (incorrecto):
24
+ // BEFORE (incorrect):
25
25
  export async function removeContainer(containerId) { ... }
26
26
  import { docker } from "../dockerService";
27
27
 
28
- // DESPUÉS (correcto):
28
+ // AFTER (correct):
29
29
  import { docker } from "../dockerService";
30
30
  import { imageExists, pullImage } from "./imageUtils.js";
31
31
  export async function removeContainer(containerId) { ... }
32
32
  ```
33
33
 
34
- **Impacto:** Elimina posibles errores de referencia y cumple con el estándar ES6.
34
+ **Impact:** Removes potential reference errors and follows ES6 standards.
35
35
 
36
36
  ---
37
37
 
38
- ### ✅ 1.2. Puertos Opcionales en Creación de Contenedores
38
+ ### ✅ 1.2. Optional Ports in Container Creation
39
39
 
40
- **Archivo:** `src/hooks/creation/useContainerCreation.js`
40
+ **File:** `src/hooks/creation/useContainerCreation.js`
41
41
 
42
- **Problema:** Se obligaba al usuario a especificar puertos, pero muchos contenedores no los necesitan.
42
+ **Issue:** Users were forced to specify ports, but many containers don’t need them.
43
43
 
44
- **Solución aplicada:**
44
+ **Applied fix:**
45
45
  ```javascript
46
- // ANTES:
46
+ // BEFORE:
47
47
  if (!portInput.trim()) {
48
48
  setMessage("You must specify at least one port to expose");
49
49
  return;
50
50
  }
51
51
 
52
- // DESPUÉS:
53
- // Puertos son opcionales - solo valida si se proporcionan
52
+ // AFTER:
53
+ // Ports are optional only validate if provided
54
54
  if (portInput.trim() && !validatePorts(portInput)) {
55
55
  setMessage("Port format must be host:container...");
56
56
  return;
57
57
  }
58
58
  ```
59
59
 
60
- **Impacto:** Permite crear contenedores sin puertos expuestos (workers, servicios internos, etc.)
60
+ **Impact:** Allows creating containers without exposed ports (workers, internal services, etc.).
61
61
 
62
62
  ---
63
63
 
64
- ### ✅ 1.3. Manejo de Errores en getLogsStream
64
+ ### ✅ 1.3. Error Handling in getLogsStream
65
65
 
66
- **Archivo:** `src/helpers/dockerService/serviceComponents/containerLogs.js`
66
+ **File:** `src/helpers/dockerService/serviceComponents/containerLogs.js`
67
67
 
68
- **Problema:** No había try-catch para manejar excepciones síncronas.
68
+ **Issue:** No try-catch to handle synchronous exceptions.
69
69
 
70
- **Solución aplicada:**
70
+ **Applied fix:**
71
71
  ```javascript
72
72
  export function getLogsStream(containerId, onData, onEnd, onError) {
73
73
  try {
74
74
  const container = docker.getContainer(containerId);
75
- // ... resto del código
75
+ // ... rest of the code
76
76
  } catch (err) {
77
77
  onError?.(err);
78
78
  }
79
79
  }
80
80
  ```
81
81
 
82
- **Impacto:** Previene crashes cuando el contenedor no existe o hay errores de conexión.
82
+ **Impact:** Prevents crashes when the container doesn’t exist or connection errors occur.
83
83
 
84
84
  ---
85
85
 
86
- ### ✅ 1.4. Configuración Cross-Platform de Docker Socket
86
+ ### ✅ 1.4. Cross-Platform Docker Socket Configuration
87
87
 
88
- **Archivo:** `src/helpers/dockerService/dockerService.js`
88
+ **File:** `src/helpers/dockerService/dockerService.js`
89
89
 
90
- **Problema:** Path hardcodeado `/var/run/docker.sock` solo funciona en Linux/Mac.
90
+ **Issue:** Hardcoded path `/var/run/docker.sock` only works on Linux/macOS.
91
91
 
92
- **Solución aplicada:**
92
+ **Applied fix:**
93
93
  ```javascript
94
- // ANTES:
94
+ // BEFORE:
95
95
  const docker = new Docker({ socketPath: "/var/run/docker.sock" });
96
96
 
97
- // DESPUÉS:
98
- // Usa configuración por defecto que maneja automáticamente:
99
- // - /var/run/docker.sock en Linux/Mac
100
- // - //./pipe/docker_engine en Windows
97
+ // AFTER:
98
+ // Use default configuration that automatically handles:
99
+ // - /var/run/docker.sock on Linux/macOS
100
+ // - //./pipe/docker_engine on Windows
101
101
  const docker = new Docker();
102
102
  ```
103
103
 
104
- **Impacto:** La aplicación ahora funciona en Windows, Linux y macOS sin modificaciones.
104
+ **Impact:** Works on Windows, Linux, and macOS without manual changes.
105
105
 
106
106
  ---
107
107
 
108
- ### ✅ 1.5. Prevención de Race Conditions en Stats
108
+ ### ✅ 1.5. Race Condition Prevention in Stats
109
109
 
110
- **Archivo:** `src/components/ContainerRow.jsx`
110
+ **File:** `src/components/ContainerRow.jsx`
111
111
 
112
- **Problema:** Actualizaciones de estado en componentes desmontados causaban memory leaks.
112
+ **Issue:** State updates on unmounted components caused memory leaks.
113
113
 
114
- **Solución aplicada:**
114
+ **Applied fix:**
115
115
  ```javascript
116
116
  useEffect(() => {
117
117
  if (state !== "running") return;
118
118
 
119
- let isMounted = true; // ← Bandera de montaje
119
+ let isMounted = true; // ← Mount flag
120
120
 
121
121
  const fetchStats = async () => {
122
122
  try {
123
123
  const s = await getStats(id);
124
- if (isMounted) { // ← Solo actualiza si está montado
124
+ if (isMounted) { // ← Only update if mounted
125
125
  setStats(s);
126
126
  }
127
127
  } catch (err) {
@@ -135,23 +135,23 @@ useEffect(() => {
135
135
  const timer = setInterval(fetchStats, 1500);
136
136
 
137
137
  return () => {
138
- isMounted = false; // ← Limpieza
138
+ isMounted = false; // ← Cleanup
139
139
  clearInterval(timer);
140
140
  };
141
141
  }, [id, state]);
142
142
  ```
143
143
 
144
- **Impacto:** Elimina warnings de React y previene memory leaks.
144
+ **Impact:** Eliminates React warnings and prevents memory leaks.
145
145
 
146
146
  ---
147
147
 
148
- ### ✅ 1.6. Validación de Variables de Entorno
148
+ ### ✅ 1.6. Environment Variables Validation
149
149
 
150
- **Archivo:** `src/helpers/validationHelpers.js`
150
+ **File:** `src/helpers/validationHelpers.js`
151
151
 
152
- **Problema:** La función `validateEnvVars` siempre retornaba `true`.
152
+ **Issue:** `validateEnvVars` always returned `true`.
153
153
 
154
- **Solución aplicada:**
154
+ **Applied fix:**
155
155
  ```javascript
156
156
  export function validateEnvVars(envInput) {
157
157
  if (!envInput || !envInput.trim()) return true; // Empty is valid
@@ -159,9 +159,9 @@ export function validateEnvVars(envInput) {
159
159
  const vars = envInput.split(",").map(v => v.trim()).filter(Boolean);
160
160
  const invalid = vars.find(v => {
161
161
  const parts = v.split("=");
162
- if (parts.length < 2) return true; // Debe tener VAR=value
162
+ if (parts.length < 2) return true; // Must be VAR=value
163
163
  const varName = parts[0].trim();
164
- // Nombres deben ser alfanuméricos con underscores
164
+ // Names must be alphanumeric with underscores
165
165
  if (!/^[A-Z_][A-Z0-9_]*$/i.test(varName)) return true;
166
166
  return false;
167
167
  });
@@ -170,39 +170,39 @@ export function validateEnvVars(envInput) {
170
170
  }
171
171
  ```
172
172
 
173
- **Impacto:** Detecta variables malformadas antes de enviarlas a Docker.
173
+ **Impact:** Detects malformed variables before sending them to Docker.
174
174
 
175
175
  ---
176
176
 
177
- ### ✅ 1.7. Corrección de Cálculo de CPU Stats
177
+ ### ✅ 1.7. CPU Stats Calculation Fix
178
178
 
179
- **Archivo:** `src/helpers/dockerService/serviceComponents/containerStats.js`
179
+ **File:** `src/helpers/dockerService/serviceComponents/containerStats.js`
180
180
 
181
- **Problema:** No se normalizaba por número de CPUs, dando valores incorrectos en multi-core.
181
+ **Issue:** Not normalized by number of CPUs, producing wrong values on multi-core hosts.
182
182
 
183
- **Solución aplicada:**
183
+ **Applied fix:**
184
184
  ```javascript
185
- // Obtener número de CPUs
185
+ // Determine number of CPUs
186
186
  const numCpus = stream.cpu_stats.online_cpus ||
187
187
  stream.cpu_stats.cpu_usage.percpu_usage?.length || 1;
188
188
 
189
- // Calcular porcentaje normalizado
189
+ // Compute normalized percentage
190
190
  const cpuPercent = systemDelta > 0
191
191
  ? ((cpuDelta / systemDelta) * numCpus * 100)
192
192
  : 0;
193
193
  ```
194
194
 
195
- **Impacto:** Estadísticas de CPU correctas en sistemas multi-core.
195
+ **Impact:** Correct CPU stats on multi-core systems.
196
196
 
197
197
  ---
198
198
 
199
- ### ✅ 1.8. Timeouts en Operaciones Docker
199
+ ### ✅ 1.8. Timeouts in Docker Operations
200
200
 
201
- **Archivo:** `src/helpers/dockerService/serviceComponents/containerActions.js`
201
+ **File:** `src/helpers/dockerService/serviceComponents/containerActions.js`
202
202
 
203
- **Problema:** Operaciones sin timeout podían colgar la UI indefinidamente.
203
+ **Issue:** Operations without timeouts could freeze the UI indefinitely.
204
204
 
205
- **Solución aplicada:**
205
+ **Applied fix:**
206
206
  ```javascript
207
207
  function withTimeout(promise, ms = 30000) {
208
208
  return Promise.race([
@@ -219,82 +219,82 @@ export async function startContainer(containerId) {
219
219
  }
220
220
  ```
221
221
 
222
- **Impacto:** Previene UI congelada en operaciones largas o que fallan.
222
+ **Impact:** Prevents frozen UI during long or failing operations.
223
223
 
224
224
  ---
225
225
 
226
- ### ✅ 1.9. Límite de Logs en Memoria
226
+ ### ✅ 1.9. In-Memory Log Limit
227
227
 
228
- **Archivo:** `src/hooks/useControls.js`
228
+ **File:** `src/hooks/useControls.js`
229
229
 
230
- **Problema:** Los logs se acumulaban indefinidamente causando memory leak.
230
+ **Issue:** Logs accumulated indefinitely causing a memory leak.
231
231
 
232
- **Solución aplicada:**
232
+ **Applied fix:**
233
233
  ```javascript
234
234
  getLogsStream(
235
235
  containers[selected].id,
236
236
  (data) => logsViewer.setLogs((prev) => {
237
237
  const newLogs = [...prev, ...data.split("\n").filter(Boolean)];
238
- // Limitar a últimas 1000 líneas
238
+ // Limit to last 1000 lines
239
239
  return newLogs.slice(-1000);
240
240
  }),
241
241
  // ...
242
242
  );
243
243
  ```
244
244
 
245
- **Impacto:** Previene memory leaks en streams de logs largos.
245
+ **Impact:** Prevents memory leaks on long-running log streams.
246
246
 
247
247
  ---
248
248
 
249
- ### ✅ 1.10. Corrección de Mensaje Duplicado
249
+ ### ✅ 1.10. Duplicate Message Fix
250
250
 
251
- **Archivo:** `src/helpers/actionHelpers.js`
251
+ **File:** `src/helpers/actionHelpers.js`
252
252
 
253
- **Problema:** El mensaje de éxito era idéntico al de inicio.
253
+ **Issue:** Success message was identical to the start message.
254
254
 
255
- **Solución aplicada:**
255
+ **Applied fix:**
256
256
  ```javascript
257
- // ANTES:
258
- setMessage(`${actionLabel} container...`); // inicio
257
+ // BEFORE:
258
+ setMessage(`${actionLabel} container...`); // start
259
259
  await actionFn(c.id);
260
- setMessage(`${actionLabel} container...`); // éxito (duplicado)
260
+ setMessage(`${actionLabel} container...`); // success (duplicate)
261
261
 
262
- // DESPUÉS:
263
- setMessage(`${actionLabel} container...`); // inicio
262
+ // AFTER:
263
+ setMessage(`${actionLabel} container...`); // start
264
264
  await actionFn(c.id);
265
- setMessage(`${actionLabel} container completed successfully`); // éxito
265
+ setMessage(`${actionLabel} container completed successfully`); // success
266
266
  ```
267
267
 
268
- **Impacto:** Feedback claro de que la operación se completó.
268
+ **Impact:** Clear feedback that the operation completed.
269
269
 
270
270
  ---
271
271
 
272
- ### ✅ 1.11. Validación de Container Names
272
+ ### ✅ 1.11. Container Names Validation
273
273
 
274
- **Archivo:** `src/helpers/dockerService/serviceComponents/containerList.js`
274
+ **File:** `src/helpers/dockerService/serviceComponents/containerList.js`
275
275
 
276
- **Problema:** No se validaba si `Names` estaba vacío.
276
+ **Issue:** Didn’t validate when `Names` was empty.
277
277
 
278
- **Solución aplicada:**
278
+ **Applied fix:**
279
279
  ```javascript
280
- // ANTES:
280
+ // BEFORE:
281
281
  name: container.Names[0].replace("/", ""),
282
282
 
283
- // DESPUÉS:
283
+ // AFTER:
284
284
  name: (container.Names && container.Names[0] || 'Unknown').replace("/", ""),
285
285
  ```
286
286
 
287
- **Impacto:** Previene crashes si Docker devuelve datos inesperados.
287
+ **Impact:** Prevents crashes when Docker returns unexpected data.
288
288
 
289
289
  ---
290
290
 
291
- ## 2. MEJORAS EN TESTS
291
+ ## 2. TEST IMPROVEMENTS
292
292
 
293
- ### ✅ Tests para validateEnvVars
293
+ ### ✅ Tests for validateEnvVars
294
294
 
295
- **Archivo:** `test/validationHelpers.test.js`
295
+ **File:** `test/validationHelpers.test.js`
296
296
 
297
- **Nuevos tests agregados:**
297
+ **New tests added:**
298
298
  - Empty input is valid
299
299
  - Valid single env var
300
300
  - Valid multiple env vars
@@ -303,19 +303,19 @@ name: (container.Names && container.Names[0] || 'Unknown').replace("/", ""),
303
303
  - Invalid env var with invalid name
304
304
  - Invalid env var with special characters in name
305
305
 
306
- **Resultado:**
306
+ **Result:**
307
307
  ```
308
308
  Test Suites: 1 passed, 1 total
309
- Tests: 12 passed, 12 total (antes: 5)
309
+ Tests: 12 passed, 12 total (previously: 5)
310
310
  ```
311
311
 
312
312
  ---
313
313
 
314
- ## 3. ANÁLISIS DE SEGURIDAD
314
+ ## 3. SECURITY ANALYSIS
315
315
 
316
316
  ### ✅ CodeQL Security Scan
317
317
 
318
- **Resultado:** ✅ **0 vulnerabilidades encontradas**
318
+ **Result:** ✅ 0 vulnerabilities found
319
319
 
320
320
  ```
321
321
  Analysis Result for 'javascript'. Found 0 alert(s):
@@ -324,9 +324,9 @@ Analysis Result for 'javascript'. Found 0 alert(s):
324
324
 
325
325
  ---
326
326
 
327
- ## 4. VERIFICACIÓN DE BUILD
327
+ ## 4. BUILD VERIFICATION
328
328
 
329
- ### ✅ Build Exitoso
329
+ ### ✅ Successful Build
330
330
 
331
331
  ```bash
332
332
  $ npm run build
@@ -335,38 +335,38 @@ Successfully compiled 28 files with Babel (815ms).
335
335
 
336
336
  ---
337
337
 
338
- ## 5. IMPACTO GENERAL DE LAS CORRECCIONES
338
+ ## 5. OVERALL IMPACT OF FIXES
339
339
 
340
- ### Seguridad
341
- - ✅ Sin vulnerabilidades de seguridad detectadas
342
- - ✅ Validación de inputs mejorada
343
- - ✅ Manejo de errores robusto
340
+ ### Security
341
+ - ✅ No security vulnerabilities detected
342
+ - ✅ Improved input validation
343
+ - ✅ Robust error handling
344
344
 
345
- ### Estabilidad
346
- - ✅ Prevención de memory leaks
347
- - ✅ Prevención de race conditions
348
- - ✅ Prevención de crashes por errores no manejados
349
- - ✅ Timeouts en operaciones potencialmente largas
345
+ ### Stability
346
+ - ✅ Memory leak prevention
347
+ - ✅ Race condition prevention
348
+ - ✅ Crash prevention due to unhandled errors
349
+ - ✅ Timeouts for potentially long operations
350
350
 
351
- ### Portabilidad
352
- - ✅ Compatibilidad con Windows
353
- - ✅ Compatibilidad con Linux
354
- - ✅ Compatibilidad con macOS
351
+ ### Portability
352
+ - ✅ Windows compatibility
353
+ - ✅ Linux compatibility
354
+ - ✅ macOS compatibility
355
355
 
356
- ### Experiencia de Usuario
357
- - ✅ Puertos opcionales en creación de contenedores
358
- - ✅ Mensajes de feedback más claros
359
- - ✅ Estadísticas de CPU correctas
360
- - ✅ Mejor manejo de errores con mensajes informativos
356
+ ### User Experience
357
+ - ✅ Optional ports in container creation
358
+ - ✅ Clearer feedback messages
359
+ - ✅ Correct CPU statistics
360
+ - ✅ Better error handling with informative messages
361
361
 
362
- ### Calidad de Código
363
- - ✅ Cumple estándar ES6
364
- - ✅ Mejor cobertura de tests (5 → 12 tests)
365
- - ✅ Código más mantenible
362
+ ### Code Quality
363
+ - ✅ ES6 compliant
364
+ - ✅ Better test coverage (5 → 12 tests)
365
+ - ✅ More maintainable code
366
366
 
367
367
  ---
368
368
 
369
- ## 6. ARCHIVOS MODIFICADOS
369
+ ## 6. MODIFIED FILES
370
370
 
371
371
  1. `src/helpers/dockerService/serviceComponents/containerActions.js`
372
372
  2. `src/hooks/creation/useContainerCreation.js`
@@ -382,40 +382,38 @@ Successfully compiled 28 files with Babel (815ms).
382
382
 
383
383
  ---
384
384
 
385
- ## 7. RECOMENDACIONES FUTURAS
385
+ ## 7. FUTURE RECOMMENDATIONS
386
386
 
387
- Aunque se han corregido los problemas críticos, el informe de auditoría (AUDIT_REPORT.md) contiene recomendaciones adicionales para mejoras futuras:
387
+ While the critical issues have been addressed, the internal audit yielded additional recommendations for future improvements:
388
388
 
389
- ### Prioridad Media
390
- - Agregar más tests unitarios
391
- - Implementar PropTypes o migrar a TypeScript
392
- - Extraer magic numbers a constantes
393
- - Mejorar sistema de logging
389
+ ### Medium Priority
390
+ - Add more unit tests
391
+ - Implement PropTypes or migrate to TypeScript
392
+ - Extract magic numbers into constants
393
+ - Improve the logging system
394
394
 
395
- ### Prioridad Baja
396
- - Implementar i18n (internacionalización)
397
- - Mejorar documentación JSDoc
398
- - Considerar websockets para actualizaciones en tiempo real
399
- - Implementar retry logic para reconexión Docker
395
+ ### Low Priority
396
+ - Implement i18n (internationalization)
397
+ - Improve JSDoc documentation
398
+ - Consider websockets for real-time updates
399
+ - Implement retry logic for Docker reconnection
400
400
 
401
401
  ---
402
402
 
403
- ## 8. CONCLUSIÓN
403
+ ## 8. CONCLUSION
404
404
 
405
- Se han aplicado **11 correcciones críticas** que mejoran significativamente:
405
+ We applied 11 critical fixes that significantly improve:
406
406
 
407
- - **Seguridad**: 0 vulnerabilidades
408
- - **Estabilidad**: Prevención de memory leaks y race conditions
409
- - **Portabilidad**: Funciona en Windows, Linux y macOS
410
- - **Calidad**: +140% más tests (5 → 12)
407
+ - Security: 0 vulnerabilities
408
+ - Stability: Prevention of memory leaks and race conditions
409
+ - Portability: Works on Windows, Linux, and macOS
410
+ - Quality: +140% more tests (5 → 12)
411
411
 
412
- Todas las correcciones han sido probadas y verificadas mediante:
413
- - ✅ Tests unitarios (12/12 pasando)
414
- - ✅ Build exitoso
415
- - ✅ Análisis de seguridad CodeQL (0 alertas)
416
-
417
- El proyecto ahora tiene una base más sólida y está listo para uso en producción.
412
+ All fixes have been tested and verified via:
413
+ - ✅ Unit tests (12/12 passing)
414
+ - ✅ Successful build
415
+ - ✅ CodeQL security analysis (0 alerts)
418
416
 
419
417
  ---
420
418
 
421
- **Fin del documento de correcciones**
419
+ **End of fixes document**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cdd-cli",
3
- "version": "3.1.3",
3
+ "version": "3.1.4",
4
4
  "description": "CLI Docker Dashboard",
5
5
  "main": "index.js",
6
6
  "scripts": {