edsger 0.6.3 → 0.6.4

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.
@@ -89,14 +89,12 @@ export function getAvailableExecutionModes() {
89
89
  'only_technical_design',
90
90
  'only_code_implementation',
91
91
  'only_functional_testing',
92
- 'only_pull_request',
93
92
  'only_code_refine',
94
93
  'only_code_review',
95
94
  'from_feature_analysis',
96
95
  'from_technical_design',
97
96
  'from_code_implementation',
98
97
  'from_functional_testing',
99
- 'from_pull_request',
100
98
  'from_code_review',
101
99
  ];
102
100
  }
@@ -16,20 +16,36 @@ const getCurrentBranch = () => {
16
16
  }
17
17
  };
18
18
  /**
19
- * Create and switch to a new branch
19
+ * Check if a branch exists
20
20
  */
21
- const createAndSwitchBranch = (branch, verbose) => {
21
+ const branchExists = (branch) => {
22
22
  try {
23
+ execSync(`git rev-parse --verify ${branch}`, { encoding: 'utf-8' });
24
+ return true;
25
+ }
26
+ catch {
27
+ return false;
28
+ }
29
+ };
30
+ /**
31
+ * Switch to an existing branch
32
+ */
33
+ const switchToBranch = (branch, verbose) => {
34
+ try {
35
+ // First check if branch exists
36
+ if (!branchExists(branch)) {
37
+ throw new Error(`Branch '${branch}' does not exist. The branch should have been created during code implementation phase.`);
38
+ }
23
39
  if (verbose) {
24
- console.log(`🔀 Creating and switching to branch: ${branch}`);
40
+ console.log(`🔀 Switching to branch: ${branch}`);
25
41
  }
26
- execSync(`git checkout -b ${branch}`, { encoding: 'utf-8' });
42
+ execSync(`git checkout ${branch}`, { encoding: 'utf-8' });
27
43
  if (verbose) {
28
- console.log(`✅ Switched to new branch: ${branch}`);
44
+ console.log(`✅ Switched to branch: ${branch}`);
29
45
  }
30
46
  }
31
47
  catch (error) {
32
- throw new Error(`Failed to create and switch to branch ${branch}: ${error}`);
48
+ throw new Error(`Failed to switch to branch ${branch}: ${error}`);
33
49
  }
34
50
  };
35
51
  /**
@@ -114,13 +130,13 @@ export async function createPullRequest(config, feature) {
114
130
  if (verbose) {
115
131
  console.log(`🔍 Current branch: ${currentBranch}`);
116
132
  }
117
- // If we're on the base branch, create and switch to dev branch
133
+ // If we're on the base branch, switch to dev branch (should already exist)
118
134
  if (currentBranch === baseBranch) {
119
135
  const devBranch = `dev/${feature.id}`;
120
136
  if (verbose) {
121
137
  console.log(`⚠️ Currently on ${baseBranch} branch, switching to ${devBranch}`);
122
138
  }
123
- createAndSwitchBranch(devBranch, verbose);
139
+ switchToBranch(devBranch, verbose);
124
140
  currentBranch = devBranch;
125
141
  }
126
142
  // Extract feature ID from current branch (dev/feature-id)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "edsger",
3
- "version": "0.6.3",
3
+ "version": "0.6.4",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "edsger": "dist/index.js"