zdev 0.1.0 → 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 CHANGED
@@ -2379,7 +2379,7 @@ async function create(projectName, options = {}) {
2379
2379
  run("git", ["commit", "-m", "Initial commit from zdev create"], { cwd: targetPath });
2380
2380
  console.log(` Git initialized`);
2381
2381
  console.log(`
2382
- ${"".repeat(50)}`);
2382
+ ${"-".repeat(50)}`);
2383
2383
  console.log(`✅ Project "${projectName}" created!
2384
2384
  `);
2385
2385
  console.log(`\uD83D\uDCC1 Location: ${targetPath}`);
@@ -2393,7 +2393,7 @@ ${"─".repeat(50)}`);
2393
2393
  console.log(` bunx convex dev # Setup Convex project`);
2394
2394
  }
2395
2395
  console.log(` bun dev # Start dev server`);
2396
- console.log(`${"".repeat(50)}`);
2396
+ console.log(`${"-".repeat(50)}`);
2397
2397
  }
2398
2398
 
2399
2399
  // src/commands/init.ts
@@ -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
- const baseBranch = options.baseBranch || "origin/main";
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}`);
@@ -2655,7 +2669,7 @@ async function start(featureName, projectPath = ".", options = {}) {
2655
2669
  config.allocations[worktreeName] = allocation;
2656
2670
  saveConfig(config);
2657
2671
  console.log(`
2658
- ${"".repeat(50)}`);
2672
+ ${"-".repeat(50)}`);
2659
2673
  console.log(`✅ Feature "${featureName}" is ready!
2660
2674
  `);
2661
2675
  console.log(`\uD83D\uDCC1 Worktree: ${worktreePath}`);
@@ -2667,7 +2681,7 @@ ${"─".repeat(50)}`);
2667
2681
  \uD83D\uDCDD Commands:`);
2668
2682
  console.log(` cd ${worktreePath}`);
2669
2683
  console.log(` zdev stop ${featureName} --project ${fullPath}`);
2670
- console.log(`${"".repeat(50)}`);
2684
+ console.log(`${"-".repeat(50)}`);
2671
2685
  }
2672
2686
 
2673
2687
  // src/commands/stop.ts
@@ -2763,7 +2777,7 @@ async function list(options = {}) {
2763
2777
  console.log(`\uD83D\uDD17 Traefik: not running`);
2764
2778
  }
2765
2779
  console.log(`
2766
- ${"".repeat(60)}`);
2780
+ ${"-".repeat(60)}`);
2767
2781
  if (allocations.length === 0) {
2768
2782
  console.log(`
2769
2783
  No active features.
@@ -2793,7 +2807,7 @@ No active features.
2793
2807
  console.log(` Started: ${new Date(alloc.started).toLocaleString()}`);
2794
2808
  console.log();
2795
2809
  }
2796
- console.log(`${"".repeat(60)}`);
2810
+ console.log(`${"-".repeat(60)}`);
2797
2811
  console.log(`
2798
2812
  Commands:`);
2799
2813
  console.log(` zdev stop <feature> Stop servers for a feature`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zdev",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Multi-agent worktree development environment for cloud dev with preview URLs",
5
5
  "type": "module",
6
6
  "bin": {
@@ -365,7 +365,7 @@ export async function create(
365
365
  console.log(` Git initialized`);
366
366
 
367
367
  // Summary
368
- console.log(`\n${"".repeat(50)}`);
368
+ console.log(`\n${"-".repeat(50)}`);
369
369
  console.log(`✅ Project "${projectName}" created!\n`);
370
370
  console.log(`📁 Location: ${targetPath}`);
371
371
  console.log(`\n📝 Next steps:`);
@@ -377,5 +377,5 @@ export async function create(
377
377
  console.log(` bunx convex dev # Setup Convex project`);
378
378
  }
379
379
  console.log(` bun dev # Start dev server`);
380
- console.log(`${"".repeat(50)}`);
380
+ console.log(`${"-".repeat(50)}`);
381
381
  }
@@ -31,7 +31,7 @@ export async function list(options: ListOptions = {}): Promise<void> {
31
31
  console.log(`🔗 Traefik: not running`);
32
32
  }
33
33
 
34
- console.log(`\n${"".repeat(60)}`);
34
+ console.log(`\n${"-".repeat(60)}`);
35
35
 
36
36
  if (allocations.length === 0) {
37
37
  console.log(`\nNo active features.\n`);
@@ -71,7 +71,7 @@ export async function list(options: ListOptions = {}): Promise<void> {
71
71
  console.log();
72
72
  }
73
73
 
74
- console.log(`${"".repeat(60)}`);
74
+ console.log(`${"-".repeat(60)}`);
75
75
  console.log(`\nCommands:`);
76
76
  console.log(` zdev stop <feature> Stop servers for a feature`);
77
77
  console.log(` zdev clean <feature> Remove worktree after merge`);
@@ -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
- const baseBranch = options.baseBranch || "origin/main";
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}`);
@@ -292,7 +309,7 @@ export async function start(
292
309
  saveConfig(config);
293
310
 
294
311
  // Summary
295
- console.log(`\n${"".repeat(50)}`);
312
+ console.log(`\n${"-".repeat(50)}`);
296
313
  console.log(`✅ Feature "${featureName}" is ready!\n`);
297
314
  console.log(`📁 Worktree: ${worktreePath}`);
298
315
  console.log(`🌐 Local: http://localhost:${ports.frontend}`);
@@ -302,5 +319,5 @@ export async function start(
302
319
  console.log(`\n📝 Commands:`);
303
320
  console.log(` cd ${worktreePath}`);
304
321
  console.log(` zdev stop ${featureName} --project ${fullPath}`);
305
- console.log(`${"".repeat(50)}`);
322
+ console.log(`${"-".repeat(50)}`);
306
323
  }