s9n-devops-agent 1.5.9 → 1.6.0
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
|
@@ -1689,15 +1689,15 @@ The DevOps agent is monitoring this worktree for changes.
|
|
|
1689
1689
|
|
|
1690
1690
|
console.log(`\n${CONFIG.colors.yellow}Worktree Cleanup Options${CONFIG.colors.reset}`);
|
|
1691
1691
|
|
|
1692
|
+
// Get target branch from merge config or default to 'main'
|
|
1693
|
+
let targetBranch = session.mergeConfig?.targetBranch || 'main';
|
|
1694
|
+
|
|
1692
1695
|
const mergeFirst = await new Promise(resolve => {
|
|
1693
|
-
rl.question(`\nMerge ${session.branchName}
|
|
1696
|
+
rl.question(`\nMerge ${CONFIG.colors.bright}${session.branchName}${CONFIG.colors.reset} → ${CONFIG.colors.bright}${targetBranch}${CONFIG.colors.reset} before cleanup? (y/N): `, resolve);
|
|
1694
1697
|
});
|
|
1695
1698
|
rl.close();
|
|
1696
1699
|
|
|
1697
1700
|
if (mergeFirst.toLowerCase() === 'y') {
|
|
1698
|
-
// Get target branch from merge config or ask
|
|
1699
|
-
let targetBranch = session.mergeConfig?.targetBranch || 'main';
|
|
1700
|
-
|
|
1701
1701
|
rl = readline.createInterface({
|
|
1702
1702
|
input: process.stdin,
|
|
1703
1703
|
output: process.stdout
|
|
@@ -1715,11 +1715,42 @@ The DevOps agent is monitoring this worktree for changes.
|
|
|
1715
1715
|
try {
|
|
1716
1716
|
console.log(`\n${CONFIG.colors.blue}Merging ${session.branchName} into ${targetBranch}...${CONFIG.colors.reset}`);
|
|
1717
1717
|
|
|
1718
|
+
// Check if target branch exists locally
|
|
1719
|
+
let branchExists = false;
|
|
1720
|
+
try {
|
|
1721
|
+
execSync(`git rev-parse --verify ${targetBranch}`, { cwd: this.repoRoot, stdio: 'pipe' });
|
|
1722
|
+
branchExists = true;
|
|
1723
|
+
} catch (err) {
|
|
1724
|
+
// Branch doesn't exist locally
|
|
1725
|
+
}
|
|
1726
|
+
|
|
1727
|
+
if (!branchExists) {
|
|
1728
|
+
// Check if branch exists on remote
|
|
1729
|
+
try {
|
|
1730
|
+
execSync(`git ls-remote --heads origin ${targetBranch}`, { cwd: this.repoRoot, stdio: 'pipe' });
|
|
1731
|
+
// Branch exists on remote, fetch it
|
|
1732
|
+
console.log(`${CONFIG.colors.dim}Target branch doesn't exist locally, fetching from remote...${CONFIG.colors.reset}`);
|
|
1733
|
+
execSync(`git fetch origin ${targetBranch}:${targetBranch}`, { cwd: this.repoRoot, stdio: 'pipe' });
|
|
1734
|
+
} catch (err) {
|
|
1735
|
+
// Branch doesn't exist on remote either, create it
|
|
1736
|
+
console.log(`${CONFIG.colors.yellow}Target branch '${targetBranch}' doesn't exist. Creating it...${CONFIG.colors.reset}`);
|
|
1737
|
+
execSync(`git checkout -b ${targetBranch}`, { cwd: this.repoRoot, stdio: 'pipe' });
|
|
1738
|
+
execSync(`git push -u origin ${targetBranch}`, { cwd: this.repoRoot, stdio: 'pipe' });
|
|
1739
|
+
console.log(`${CONFIG.colors.green}✓${CONFIG.colors.reset} Created new branch ${targetBranch}`);
|
|
1740
|
+
}
|
|
1741
|
+
}
|
|
1742
|
+
|
|
1718
1743
|
// Switch to target branch in main repo
|
|
1719
1744
|
execSync(`git checkout ${targetBranch}`, { cwd: this.repoRoot, stdio: 'pipe' });
|
|
1720
1745
|
|
|
1721
|
-
// Pull latest
|
|
1722
|
-
|
|
1746
|
+
// Pull latest (if branch already existed)
|
|
1747
|
+
if (branchExists) {
|
|
1748
|
+
try {
|
|
1749
|
+
execSync(`git pull origin ${targetBranch}`, { cwd: this.repoRoot, stdio: 'pipe' });
|
|
1750
|
+
} catch (err) {
|
|
1751
|
+
console.log(`${CONFIG.colors.dim}Could not pull latest changes (may be new branch)${CONFIG.colors.reset}`);
|
|
1752
|
+
}
|
|
1753
|
+
}
|
|
1723
1754
|
|
|
1724
1755
|
// Merge the session branch
|
|
1725
1756
|
execSync(`git merge --no-ff ${session.branchName} -m "Merge session ${sessionId}: ${session.task}"`, {
|
package/start-devops-session.sh
CHANGED
|
@@ -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.
|
|
44
|
+
echo " Version 1.6.0 | Build 20251009.12"
|
|
45
45
|
echo " "
|
|
46
46
|
echo " Copyright (c) 2024 SecondBrain Labs"
|
|
47
47
|
echo " Author: Sachin Dev Duggal"
|