s9n-devops-agent 1.5.8 → 1.5.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "s9n-devops-agent",
3
- "version": "1.5.8",
3
+ "version": "1.5.9",
4
4
  "description": "CS_DevOpsAgent - Intelligent Git Automation System with multi-agent support and session management",
5
5
  "type": "module",
6
6
  "main": "src/cs-devops-agent-worker.js",
@@ -1681,8 +1681,72 @@ The DevOps agent is monitoring this worktree for changes.
1681
1681
  console.log(`${CONFIG.colors.dim}Could not check git status${CONFIG.colors.reset}`);
1682
1682
  }
1683
1683
 
1684
+ // Ask about merging to target branch before cleanup
1685
+ let rl = readline.createInterface({
1686
+ input: process.stdin,
1687
+ output: process.stdout
1688
+ });
1689
+
1690
+ console.log(`\n${CONFIG.colors.yellow}Worktree Cleanup Options${CONFIG.colors.reset}`);
1691
+
1692
+ const mergeFirst = await new Promise(resolve => {
1693
+ rl.question(`\nMerge ${session.branchName} to target branch before cleanup? (y/N): `, resolve);
1694
+ });
1695
+ rl.close();
1696
+
1697
+ if (mergeFirst.toLowerCase() === 'y') {
1698
+ // Get target branch from merge config or ask
1699
+ let targetBranch = session.mergeConfig?.targetBranch || 'main';
1700
+
1701
+ rl = readline.createInterface({
1702
+ input: process.stdin,
1703
+ output: process.stdout
1704
+ });
1705
+
1706
+ const confirmTarget = await new Promise(resolve => {
1707
+ rl.question(`Target branch [${targetBranch}]: `, resolve);
1708
+ });
1709
+ rl.close();
1710
+
1711
+ if (confirmTarget.trim()) {
1712
+ targetBranch = confirmTarget.trim();
1713
+ }
1714
+
1715
+ try {
1716
+ console.log(`\n${CONFIG.colors.blue}Merging ${session.branchName} into ${targetBranch}...${CONFIG.colors.reset}`);
1717
+
1718
+ // Switch to target branch in main repo
1719
+ execSync(`git checkout ${targetBranch}`, { cwd: this.repoRoot, stdio: 'pipe' });
1720
+
1721
+ // Pull latest
1722
+ execSync(`git pull origin ${targetBranch}`, { cwd: this.repoRoot, stdio: 'pipe' });
1723
+
1724
+ // Merge the session branch
1725
+ execSync(`git merge --no-ff ${session.branchName} -m "Merge session ${sessionId}: ${session.task}"`, {
1726
+ cwd: this.repoRoot,
1727
+ stdio: 'pipe'
1728
+ });
1729
+
1730
+ // Push merged changes
1731
+ execSync(`git push origin ${targetBranch}`, { cwd: this.repoRoot, stdio: 'pipe' });
1732
+
1733
+ console.log(`${CONFIG.colors.green}✓${CONFIG.colors.reset} Successfully merged to ${targetBranch}`);
1734
+
1735
+ // Delete remote branch after successful merge
1736
+ try {
1737
+ execSync(`git push origin --delete ${session.branchName}`, { cwd: this.repoRoot, stdio: 'pipe' });
1738
+ console.log(`${CONFIG.colors.green}✓${CONFIG.colors.reset} Deleted remote branch ${session.branchName}`);
1739
+ } catch (err) {
1740
+ console.log(`${CONFIG.colors.dim}Could not delete remote branch${CONFIG.colors.reset}`);
1741
+ }
1742
+ } catch (err) {
1743
+ console.error(`${CONFIG.colors.red}✗ Merge failed: ${err.message}${CONFIG.colors.reset}`);
1744
+ console.log(`${CONFIG.colors.yellow}You may need to resolve conflicts manually${CONFIG.colors.reset}`);
1745
+ }
1746
+ }
1747
+
1684
1748
  // Ask about removing worktree
1685
- const rl = readline.createInterface({
1749
+ rl = readline.createInterface({
1686
1750
  input: process.stdin,
1687
1751
  output: process.stdout
1688
1752
  });
@@ -1698,6 +1762,14 @@ The DevOps agent is monitoring this worktree for changes.
1698
1762
  execSync(`git worktree remove "${session.worktreePath}" --force`, { stdio: 'pipe' });
1699
1763
  console.log(`${CONFIG.colors.green}✓${CONFIG.colors.reset} Worktree removed`);
1700
1764
 
1765
+ // Delete local branch
1766
+ try {
1767
+ execSync(`git branch -D ${session.branchName}`, { cwd: this.repoRoot, stdio: 'pipe' });
1768
+ console.log(`${CONFIG.colors.green}✓${CONFIG.colors.reset} Deleted local branch ${session.branchName}`);
1769
+ } catch (err) {
1770
+ console.log(`${CONFIG.colors.dim}Could not delete local branch${CONFIG.colors.reset}`);
1771
+ }
1772
+
1701
1773
  // Prune worktree list
1702
1774
  execSync('git worktree prune', { stdio: 'pipe' });
1703
1775
  } catch (err) {
@@ -41,7 +41,7 @@ show_copyright() {
41
41
  echo "======================================================================"
42
42
  echo
43
43
  echo " CS_DevOpsAgent - Intelligent Git Automation System"
44
- echo " Version 1.5.8 | Build 20251009.10"
44
+ echo " Version 1.5.9 | Build 20251009.11"
45
45
  echo " "
46
46
  echo " Copyright (c) 2024 SecondBrain Labs"
47
47
  echo " Author: Sachin Dev Duggal"