zdev 0.1.1 → 0.1.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/dist/index.js +15 -1
- package/package.json +1 -1
- package/src/commands/start.ts +18 -1
package/dist/index.js
CHANGED
|
@@ -2490,7 +2490,21 @@ async function start(featureName, projectPath = ".", options = {}) {
|
|
|
2490
2490
|
const worktreeName = `${repoName}-${featureName}`;
|
|
2491
2491
|
const worktreePath = getWorktreePath(worktreeName);
|
|
2492
2492
|
const branchName = `feature/${featureName}`;
|
|
2493
|
-
|
|
2493
|
+
let baseBranch = options.baseBranch;
|
|
2494
|
+
if (!baseBranch) {
|
|
2495
|
+
const candidates = ["origin/main", "origin/master", "main", "master"];
|
|
2496
|
+
for (const candidate of candidates) {
|
|
2497
|
+
const check = run("git", ["rev-parse", "--verify", candidate], { cwd: fullPath });
|
|
2498
|
+
if (check.success) {
|
|
2499
|
+
baseBranch = candidate;
|
|
2500
|
+
break;
|
|
2501
|
+
}
|
|
2502
|
+
}
|
|
2503
|
+
if (!baseBranch) {
|
|
2504
|
+
console.error(`❌ Could not detect base branch. Use --base-branch to specify.`);
|
|
2505
|
+
process.exit(1);
|
|
2506
|
+
}
|
|
2507
|
+
}
|
|
2494
2508
|
console.log(`\uD83D\uDC02 Starting feature: ${featureName}`);
|
|
2495
2509
|
console.log(` Project: ${repoName}`);
|
|
2496
2510
|
console.log(` Branch: ${branchName}`);
|
package/package.json
CHANGED
package/src/commands/start.ts
CHANGED
|
@@ -72,7 +72,24 @@ export async function start(
|
|
|
72
72
|
const worktreeName = `${repoName}-${featureName}`;
|
|
73
73
|
const worktreePath = getWorktreePath(worktreeName);
|
|
74
74
|
const branchName = `feature/${featureName}`;
|
|
75
|
-
|
|
75
|
+
|
|
76
|
+
// Auto-detect base branch if not specified
|
|
77
|
+
let baseBranch = options.baseBranch;
|
|
78
|
+
if (!baseBranch) {
|
|
79
|
+
// Try common base branches in order
|
|
80
|
+
const candidates = ["origin/main", "origin/master", "main", "master"];
|
|
81
|
+
for (const candidate of candidates) {
|
|
82
|
+
const check = run("git", ["rev-parse", "--verify", candidate], { cwd: fullPath });
|
|
83
|
+
if (check.success) {
|
|
84
|
+
baseBranch = candidate;
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
if (!baseBranch) {
|
|
89
|
+
console.error(`❌ Could not detect base branch. Use --base-branch to specify.`);
|
|
90
|
+
process.exit(1);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
76
93
|
|
|
77
94
|
console.log(`🐂 Starting feature: ${featureName}`);
|
|
78
95
|
console.log(` Project: ${repoName}`);
|