s9n-devops-agent 1.6.1 → 1.6.2

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.6.1",
3
+ "version": "1.6.2",
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",
@@ -1797,35 +1797,67 @@ console.log();
1797
1797
  // Get current branch
1798
1798
  const currentBranchName = await currentBranch();
1799
1799
 
1800
- // Ask about merging to target branch first
1801
- const defaultTarget = 'main';
1802
- console.log("\n" + "─".repeat(60));
1803
- console.log("MERGE TO TARGET BRANCH");
1804
- console.log("─".repeat(60));
1805
- console.log(`\nMerge \x1b[1m${currentBranchName}\x1b[0m → \x1b[1m${defaultTarget}\x1b[0m before cleanup?`);
1806
- console.log(" y/yes - Merge to target branch");
1807
- console.log(" n/no - Skip merge");
1800
+ // Get the main repo root
1801
+ const repoRoot = path.resolve(currentDir, '../../../');
1808
1802
 
1809
- rl.prompt();
1810
- const mergeAnswer = await new Promise(resolve => {
1811
- rl.once('line', resolve);
1812
- });
1803
+ // Read session lock file to get merge configuration
1804
+ let mergeConfig = null;
1805
+ let shouldMerge = false;
1806
+ let targetBranch = 'main';
1813
1807
 
1814
- let mergeCompleted = false;
1815
- if (mergeAnswer.toLowerCase() === 'y' || mergeAnswer.toLowerCase() === 'yes') {
1816
- // Ask for target branch confirmation
1817
- console.log(`\nTarget branch [${defaultTarget}]: `);
1808
+ try {
1809
+ const lockFile = path.join(repoRoot, 'local_deploy', 'session-locks', `${sessionId}.lock`);
1810
+ if (fs.existsSync(lockFile)) {
1811
+ const sessionData = JSON.parse(fs.readFileSync(lockFile, 'utf8'));
1812
+ mergeConfig = sessionData.mergeConfig;
1813
+ }
1814
+ } catch (err) {
1815
+ console.log(`\x1b[2mCould not read session config: ${err.message}\x1b[0m`);
1816
+ }
1817
+
1818
+ // Check if auto-merge is configured
1819
+ if (mergeConfig && mergeConfig.autoMerge && mergeConfig.targetBranch) {
1820
+ // Auto-merge is configured
1821
+ shouldMerge = true;
1822
+ targetBranch = mergeConfig.targetBranch;
1823
+ console.log("\n" + "─".repeat(60));
1824
+ console.log("AUTO-MERGE CONFIGURED");
1825
+ console.log("─".repeat(60));
1826
+ console.log(`\nAuto-merging \x1b[1m${currentBranchName}\x1b[0m → \x1b[1m${targetBranch}\x1b[0m`);
1827
+ console.log(`\x1b[2m(Configured during session start)\x1b[0m`);
1828
+ } else {
1829
+ // No auto-merge configured, ask the user
1830
+ console.log("\n" + "─".repeat(60));
1831
+ console.log("MERGE TO TARGET BRANCH");
1832
+ console.log("─".repeat(60));
1833
+ console.log(`\nMerge \x1b[1m${currentBranchName}\x1b[0m → target branch before cleanup?`);
1834
+ console.log(" y/yes - Merge to target branch");
1835
+ console.log(" n/no - Skip merge");
1836
+
1818
1837
  rl.prompt();
1819
- const targetAnswer = await new Promise(resolve => {
1838
+ const mergeAnswer = await new Promise(resolve => {
1820
1839
  rl.once('line', resolve);
1821
1840
  });
1822
1841
 
1823
- const targetBranch = targetAnswer.trim() || defaultTarget;
1842
+ shouldMerge = mergeAnswer.toLowerCase() === 'y' || mergeAnswer.toLowerCase() === 'yes';
1824
1843
 
1825
- try {
1826
- // Get the main repo root
1827
- const repoRoot = path.resolve(currentDir, '../../../');
1844
+ if (shouldMerge) {
1845
+ // Ask for target branch
1846
+ console.log(`\nTarget branch [${targetBranch}]: `);
1847
+ rl.prompt();
1848
+ const targetAnswer = await new Promise(resolve => {
1849
+ rl.once('line', resolve);
1850
+ });
1828
1851
 
1852
+ if (targetAnswer.trim()) {
1853
+ targetBranch = targetAnswer.trim();
1854
+ }
1855
+ }
1856
+ }
1857
+
1858
+ let mergeCompleted = false;
1859
+ if (shouldMerge) {
1860
+ try {
1829
1861
  console.log(`\n\x1b[34mMerging ${currentBranchName} into ${targetBranch}...\x1b[0m`);
1830
1862
 
1831
1863
  // Check if target branch exists locally
@@ -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.6.1 | Build 20251009.13"
44
+ echo " Version 1.6.2 | Build 20251009.14"
45
45
  echo " "
46
46
  echo " Copyright (c) 2024 SecondBrain Labs"
47
47
  echo " Author: Sachin Dev Duggal"