@deinossrl/dgp-agent 1.5.10 → 1.5.12

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.
Files changed (3) hide show
  1. package/CHANGELOG.md +63 -0
  2. package/index.mjs +68 -66
  3. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,68 @@
1
1
  # Changelog - DGP Agent
2
2
 
3
+ ## [1.5.12] - 2026-01-13
4
+
5
+ ### Added
6
+ - **Progreso en consola local**: Ahora `pg_dump` y `pg_restore` muestran el progreso detallado también en la terminal local del agente, además de enviarlo a la web.
7
+ - Feedback visual inmediato en la terminal para operaciones de backup y restore.
8
+
9
+ ## [1.5.11] - 2026-01-12
10
+
11
+ ### Added
12
+ - CHANGELOG actualizado con historial completo de versiones 1.5.7 a 1.5.10
13
+
14
+ ### Documentation
15
+ - Tooltips mejorados en la UI de backup/restore con información detallada
16
+ - Mejor documentación para entender qué hace cada opción
17
+
18
+ ## [1.5.10] - 2026-01-12
19
+
20
+ ### Changed
21
+ - La opción `exclude_system_schemas` ahora aplica para TODOS los tipos de conexión (no solo Supabase)
22
+ - El usuario decide siempre si excluir schemas del sistema (mayor control)
23
+ - Mejor documentación en la UI con tooltips explicativos
24
+
25
+ ### Added
26
+ - Tooltip detallado en opción "Excluir schemas del sistema" mostrando los 12 schemas que se excluyen
27
+ - Tooltip detallado en opción "Limpiar antes de restaurar" explicando qué borra y qué NO toca
28
+
29
+ ## [1.5.9] - 2026-01-12
30
+
31
+ ### Added
32
+ - Opción en UI para excluir schemas del sistema de Supabase al crear backups
33
+ - Checkbox "Excluir schemas del sistema" (marcado por defecto en Supabase)
34
+ - Excluye automáticamente: storage, auth, extensions, realtime, vault, graphql, pgsodium, etc.
35
+ - Previene errores de "must be owner" al restaurar
36
+
37
+ ### Changed
38
+ - Agente respeta el flag `exclude_system_schemas` enviado desde la UI
39
+
40
+ ## [1.5.8] - 2026-01-12
41
+
42
+ ### Added
43
+ - **Progreso con porcentaje en pg_restore**: Usa `pg_restore --list` para contar objetos totales
44
+ - Muestra progreso preciso: "Progreso: 67% (180/268) - creating TABLE public.orders"
45
+ - **Progreso mejorado en pg_dump**: Conteo de objetos procesados con porcentaje estimado
46
+ - Log final con total de objetos exportados
47
+
48
+ ### Changed
49
+ - Cambiado de spawn bloqueante a spawn asíncrono para capturar salida en tiempo real
50
+ - Logs de progreso cada 2 segundos para no saturar la base de datos
51
+ - Mejor estimación de progreso cuando se especifican schemas/tables
52
+
53
+ ## [1.5.7] - 2026-01-12
54
+
55
+ ### Added
56
+ - **Progreso en tiempo real para pg_dump**: Ahora muestra qué tabla/schema se está procesando
57
+ - Flag `--verbose` agregado a pg_dump para obtener información de progreso
58
+ - Mensajes cada 2 segundos: "pg_dump: dumping data for table public.users"
59
+ - Contador de objetos procesados durante el backup
60
+
61
+ ### Changed
62
+ - Cambiado de spawnSync (bloqueante) a spawn (asíncrono) en pg_dump
63
+ - Captura stderr en tiempo real para mostrar progreso al usuario
64
+ - Mejor experiencia en backups grandes (muestra que está vivo y progresando)
65
+
3
66
  ## [1.5.6] - 2026-01-12
4
67
 
5
68
  ### Fixed
package/index.mjs CHANGED
@@ -261,7 +261,7 @@ function saveSshKeyLocally(sshPrivateKey) {
261
261
  if (process.platform === 'win32') {
262
262
  try {
263
263
  shellSync(`icacls "${keyPath}" /inheritance:r /grant:r "%USERNAME%:RW"`);
264
- } catch {}
264
+ } catch { }
265
265
  }
266
266
  }
267
267
 
@@ -513,7 +513,7 @@ function getRepoContext() {
513
513
  context.project.scripts = Object.keys(pkg.scripts || {});
514
514
  context.project.dependencies = Object.keys(pkg.dependencies || {});
515
515
  context.project.devDependencies = Object.keys(pkg.devDependencies || {});
516
- } catch (e) {}
516
+ } catch (e) { }
517
517
  }
518
518
 
519
519
  if (context.files.includes('requirements.txt') || context.files.includes('setup.py')) {
@@ -1531,11 +1531,66 @@ async function findOrInstallPgDump() {
1531
1531
  const extractCmd = `powershell -command "Expand-Archive -Path '${zipPath}' -DestinationPath '${BIN_DIR}' -Force"`;
1532
1532
  execSync(extractCmd);
1533
1533
 
1534
- // Los binarios estarán en BIN_DIR/pgsql/bin/
1534
+ // Los binarios estarán en BIN_DIR/pgsql/bin/
1535
+ const extractedPgDump = join(BIN_DIR, 'pgsql', 'bin', 'pg_dump.exe');
1536
+
1537
+ if (existsSync(extractedPgDump)) {
1538
+ // Copiar pg_dump.exe, pg_restore.exe y TODAS las DLLs al BIN_DIR raíz
1539
+ const binSrcDir = join(BIN_DIR, 'pgsql', 'bin');
1540
+
1541
+ // Copiar pg_dump.exe, pg_restore.exe y psql.exe
1542
+ execSync(`copy "${extractedPgDump}" "${localPgDump}"`, { shell: 'cmd.exe' });
1543
+
1544
+ const extractedPgRestore = join(BIN_DIR, 'pgsql', 'bin', 'pg_restore.exe');
1545
+ const localPgRestore = join(BIN_DIR, 'pg_restore.exe');
1546
+ if (existsSync(extractedPgRestore)) {
1547
+ execSync(`copy "${extractedPgRestore}" "${localPgRestore}"`, { shell: 'cmd.exe' });
1548
+ }
1549
+
1550
+ const extractedPsql = join(BIN_DIR, 'pgsql', 'bin', 'psql.exe');
1551
+ const localPsql = join(BIN_DIR, 'psql.exe');
1552
+ if (existsSync(extractedPsql)) {
1553
+ execSync(`copy "${extractedPsql}" "${localPsql}"`, { shell: 'cmd.exe' });
1554
+ }
1555
+
1556
+ // Copiar TODAS las DLLs (no solo algunas específicas)
1557
+ execSync(`copy "${binSrcDir}\\*.dll" "${BIN_DIR}\\"`, { shell: 'cmd.exe' });
1558
+
1559
+ // Limpiar archivos temporales
1560
+ unlinkSync(zipPath);
1561
+ // Eliminar carpeta pgsql para ahorrar espacio
1562
+ try {
1563
+ execSync(`rmdir /s /q "${join(BIN_DIR, 'pgsql')}"`, { shell: 'cmd.exe' });
1564
+ } catch (e) {
1565
+ // Ignorar si falla el borrado
1566
+ }
1567
+
1568
+ logSuccess('pg_dump instalado correctamente con todas las dependencias');
1569
+ resolve(localPgDump);
1570
+ } else {
1571
+ reject(new Error('No se pudo extraer pg_dump del archivo'));
1572
+ }
1573
+ } catch (extractError) {
1574
+ reject(new Error(`Error al extraer: ${extractError.message}`));
1575
+ }
1576
+ }, 3000); // Esperar 3 segundos para que Windows libere el archivo
1577
+ });
1578
+ }).on('error', reject);
1579
+ } else {
1580
+ response.pipe(file);
1581
+ file.on('finish', () => {
1582
+ file.close();
1583
+ logInfo('Descarga completada. Extrayendo...');
1584
+
1585
+ // Dar tiempo a Windows para liberar el handle del archivo
1586
+ setTimeout(() => {
1587
+ try {
1588
+ const extractCmd = `powershell -command "Expand-Archive -Path '${zipPath}' -DestinationPath '${BIN_DIR}' -Force"`;
1589
+ execSync(extractCmd);
1590
+
1535
1591
  const extractedPgDump = join(BIN_DIR, 'pgsql', 'bin', 'pg_dump.exe');
1536
1592
 
1537
1593
  if (existsSync(extractedPgDump)) {
1538
- // Copiar pg_dump.exe, pg_restore.exe y TODAS las DLLs al BIN_DIR raíz
1539
1594
  const binSrcDir = join(BIN_DIR, 'pgsql', 'bin');
1540
1595
 
1541
1596
  // Copiar pg_dump.exe, pg_restore.exe y psql.exe
@@ -1553,16 +1608,16 @@ async function findOrInstallPgDump() {
1553
1608
  execSync(`copy "${extractedPsql}" "${localPsql}"`, { shell: 'cmd.exe' });
1554
1609
  }
1555
1610
 
1556
- // Copiar TODAS las DLLs (no solo algunas específicas)
1611
+ // Copiar TODAS las DLLs
1557
1612
  execSync(`copy "${binSrcDir}\\*.dll" "${BIN_DIR}\\"`, { shell: 'cmd.exe' });
1558
1613
 
1559
- // Limpiar archivos temporales
1560
1614
  unlinkSync(zipPath);
1561
- // Eliminar carpeta pgsql para ahorrar espacio
1615
+
1616
+ // Eliminar carpeta pgsql
1562
1617
  try {
1563
1618
  execSync(`rmdir /s /q "${join(BIN_DIR, 'pgsql')}"`, { shell: 'cmd.exe' });
1564
1619
  } catch (e) {
1565
- // Ignorar si falla el borrado
1620
+ // Ignorar
1566
1621
  }
1567
1622
 
1568
1623
  logSuccess('pg_dump instalado correctamente con todas las dependencias');
@@ -1570,61 +1625,6 @@ async function findOrInstallPgDump() {
1570
1625
  } else {
1571
1626
  reject(new Error('No se pudo extraer pg_dump del archivo'));
1572
1627
  }
1573
- } catch (extractError) {
1574
- reject(new Error(`Error al extraer: ${extractError.message}`));
1575
- }
1576
- }, 3000); // Esperar 3 segundos para que Windows libere el archivo
1577
- });
1578
- }).on('error', reject);
1579
- } else {
1580
- response.pipe(file);
1581
- file.on('finish', () => {
1582
- file.close();
1583
- logInfo('Descarga completada. Extrayendo...');
1584
-
1585
- // Dar tiempo a Windows para liberar el handle del archivo
1586
- setTimeout(() => {
1587
- try {
1588
- const extractCmd = `powershell -command "Expand-Archive -Path '${zipPath}' -DestinationPath '${BIN_DIR}' -Force"`;
1589
- execSync(extractCmd);
1590
-
1591
- const extractedPgDump = join(BIN_DIR, 'pgsql', 'bin', 'pg_dump.exe');
1592
-
1593
- if (existsSync(extractedPgDump)) {
1594
- const binSrcDir = join(BIN_DIR, 'pgsql', 'bin');
1595
-
1596
- // Copiar pg_dump.exe, pg_restore.exe y psql.exe
1597
- execSync(`copy "${extractedPgDump}" "${localPgDump}"`, { shell: 'cmd.exe' });
1598
-
1599
- const extractedPgRestore = join(BIN_DIR, 'pgsql', 'bin', 'pg_restore.exe');
1600
- const localPgRestore = join(BIN_DIR, 'pg_restore.exe');
1601
- if (existsSync(extractedPgRestore)) {
1602
- execSync(`copy "${extractedPgRestore}" "${localPgRestore}"`, { shell: 'cmd.exe' });
1603
- }
1604
-
1605
- const extractedPsql = join(BIN_DIR, 'pgsql', 'bin', 'psql.exe');
1606
- const localPsql = join(BIN_DIR, 'psql.exe');
1607
- if (existsSync(extractedPsql)) {
1608
- execSync(`copy "${extractedPsql}" "${localPsql}"`, { shell: 'cmd.exe' });
1609
- }
1610
-
1611
- // Copiar TODAS las DLLs
1612
- execSync(`copy "${binSrcDir}\\*.dll" "${BIN_DIR}\\"`, { shell: 'cmd.exe' });
1613
-
1614
- unlinkSync(zipPath);
1615
-
1616
- // Eliminar carpeta pgsql
1617
- try {
1618
- execSync(`rmdir /s /q "${join(BIN_DIR, 'pgsql')}"`, { shell: 'cmd.exe' });
1619
- } catch (e) {
1620
- // Ignorar
1621
- }
1622
-
1623
- logSuccess('pg_dump instalado correctamente con todas las dependencias');
1624
- resolve(localPgDump);
1625
- } else {
1626
- reject(new Error('No se pudo extraer pg_dump del archivo'));
1627
- }
1628
1628
  } catch (extractError) {
1629
1629
  reject(new Error(`Error al extraer: ${extractError.message}`));
1630
1630
  }
@@ -1850,7 +1850,8 @@ async function executePgDump(command) {
1850
1850
  }
1851
1851
 
1852
1852
  progressMsg += relevantLine.substring(0, 80);
1853
- addCommandLog('info', progressMsg).catch(() => {});
1853
+ logInfo(progressMsg); // Muestra en consola local
1854
+ addCommandLog('info', progressMsg).catch(() => { });
1854
1855
  lastLogTime = now;
1855
1856
  }
1856
1857
  }
@@ -1874,7 +1875,7 @@ async function executePgDump(command) {
1874
1875
  } else {
1875
1876
  // Log final con total de objetos procesados
1876
1877
  if (objectCount > 0) {
1877
- addCommandLog('success', `Backup completado: ${objectCount} objetos exportados`).catch(() => {});
1878
+ addCommandLog('success', `Backup completado: ${objectCount} objetos exportados`).catch(() => { });
1878
1879
  }
1879
1880
  resolve();
1880
1881
  }
@@ -2348,7 +2349,8 @@ async function executePgRestore(command) {
2348
2349
  progressMsg += ` - ${relevantLine}`;
2349
2350
  }
2350
2351
 
2351
- addCommandLog('info', progressMsg).catch(() => {});
2352
+ logInfo(progressMsg); // Muestra en consola local
2353
+ addCommandLog('info', progressMsg).catch(() => { });
2352
2354
  lastLogTime = now;
2353
2355
  }
2354
2356
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deinossrl/dgp-agent",
3
- "version": "1.5.10",
3
+ "version": "1.5.12",
4
4
  "description": "Agente local para Despliegue-GPT - Reporta el estado del repositorio Git a la plataforma TenMinute IA",
5
5
  "main": "index.mjs",
6
6
  "bin": {
@@ -33,4 +33,4 @@
33
33
  "dependencies": {
34
34
  "@supabase/supabase-js": "^2.39.0"
35
35
  }
36
- }
36
+ }