@deinossrl/dgp-agent 1.2.5 → 1.2.6

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 (2) hide show
  1. package/index.mjs +54 -3
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -443,6 +443,9 @@ async function executeCommand(command) {
443
443
  await updateCommandStatus(command.id, 'success', { status });
444
444
  return { success: true, status };
445
445
 
446
+ case 'git_commit_push':
447
+ return await executeGitCommitPush(command);
448
+
446
449
  case 'rollback':
447
450
  logError('Rollback not implemented yet');
448
451
  await updateCommandStatus(command.id, 'failed', {}, 'Rollback not implemented');
@@ -455,6 +458,53 @@ async function executeCommand(command) {
455
458
  }
456
459
  }
457
460
 
461
+ /**
462
+ * Ejecuta git add, commit y push
463
+ */
464
+ async function executeGitCommitPush(command) {
465
+ const { message, add_all } = command.params || {};
466
+
467
+ if (!message) {
468
+ await updateCommandStatus(command.id, 'failed', {}, 'Commit message is required');
469
+ return { success: false };
470
+ }
471
+
472
+ try {
473
+ // Marcar como running
474
+ await updateCommandStatus(command.id, 'running', {});
475
+
476
+ logInfo('Executing git commit + push...');
477
+
478
+ // git add
479
+ if (add_all) {
480
+ logCommand('git add .');
481
+ await shellAsync('git add .');
482
+ }
483
+
484
+ // git commit
485
+ logCommand(`git commit -m "${message}"`);
486
+ const commitResult = await shellAsync(`git commit -m "${message}"`);
487
+ logSuccess('Commit created');
488
+
489
+ // git push
490
+ const branch = shellSync('git branch --show-current').trim();
491
+ logCommand(`git push origin ${branch}`);
492
+ await shellAsync(`git push origin ${branch}`);
493
+ logSuccess('Push completed');
494
+
495
+ await updateCommandStatus(command.id, 'completed', {
496
+ commit: commitResult,
497
+ branch: branch
498
+ });
499
+
500
+ return { success: true };
501
+ } catch (error) {
502
+ logError(`Git commit/push failed: ${error.message}`);
503
+ await updateCommandStatus(command.id, 'failed', {}, error.message);
504
+ return { success: false, error: error.message };
505
+ }
506
+ }
507
+
458
508
  /**
459
509
  * Muestra el estado en consola
460
510
  */
@@ -488,7 +538,7 @@ async function runAgent(deployMode = false) {
488
538
  console.log('');
489
539
  console.log(`${colors.green}╔═══════════════════════════════════════════════════════╗${colors.reset}`);
490
540
  console.log(`${colors.green}║ DGP Agent - Despliegue-GPT Local Agent ║${colors.reset}`);
491
- console.log(`${colors.green}║ @deinossrl/dgp-agent v1.2.5 ║${colors.reset}`);
541
+ console.log(`${colors.green}║ @deinossrl/dgp-agent v1.2.6 ║${colors.reset}`);
492
542
  console.log(`${colors.green}╚═══════════════════════════════════════════════════════╝${colors.reset}`);
493
543
  console.log('');
494
544
 
@@ -604,7 +654,7 @@ async function showStatus() {
604
654
  function showHelp() {
605
655
  console.log(`
606
656
  ${colors.bold}${colors.cyan}DGP Agent - Despliegue-GPT Local Agent${colors.reset}
607
- ${colors.gray}@deinossrl/dgp-agent v1.2.5${colors.reset}
657
+ ${colors.gray}@deinossrl/dgp-agent v1.2.6${colors.reset}
608
658
 
609
659
  ${colors.bold}DESCRIPCIÓN${colors.reset}
610
660
  Agente local que reporta el estado de tu repositorio Git
@@ -652,6 +702,7 @@ ${colors.bold}REQUISITOS PARA DEPLOY${colors.reset}
652
702
  - Permisos sudo para reload nginx (vía sudoers sin password)
653
703
 
654
704
  ${colors.bold}CHANGELOG${colors.reset}
705
+ ${colors.cyan}v1.2.6${colors.reset} - Comando git_commit_push desde la UI
655
706
  ${colors.cyan}v1.2.5${colors.reset} - Sincronización de versiones y changelog
656
707
  ${colors.cyan}v1.2.4${colors.reset} - Mejoras en ejecución async de comandos shell
657
708
  ${colors.cyan}v1.2.0${colors.reset} - Modo deploy con polling de comandos remotos
@@ -686,7 +737,7 @@ switch (command) {
686
737
  case 'version':
687
738
  case '-v':
688
739
  case '--version':
689
- console.log('@deinossrl/dgp-agent v1.2.5');
740
+ console.log('@deinossrl/dgp-agent v1.2.6');
690
741
  break;
691
742
  default:
692
743
  runAgent(false); // Status-only mode
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deinossrl/dgp-agent",
3
- "version": "1.2.5",
3
+ "version": "1.2.6",
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": {