genbox 1.0.45 → 1.0.46

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.
@@ -223,7 +223,7 @@ exports.createCommand = new commander_1.Command('create')
223
223
  .option('-s, --size <size>', 'Server size: small, medium, large, xl')
224
224
  .option('-b, --branch <branch>', 'Use existing git branch (skips new branch creation)')
225
225
  .option('-n, --new-branch <name>', 'Create a new branch with this name (defaults to env name)')
226
- .option('-f, --from-branch <branch>', 'Source branch to create new branch from (defaults to main)')
226
+ .option('-f, --from-branch <branch>', 'Source branch to create new branch from (defaults to config default or main)')
227
227
  .option('-y, --yes', 'Skip interactive prompts')
228
228
  .option('--dry-run', 'Show what would be created without actually creating')
229
229
  .action(async (nameArg, options) => {
@@ -287,13 +287,13 @@ exports.createCommand = new commander_1.Command('create')
287
287
  // Silently continue for other errors - the create API will validate
288
288
  }
289
289
  // Determine branch configuration
290
- // Default: create new branch from 'main' with name = environment name
290
+ // Default: create new branch from configured default (or 'main') with name = environment name
291
291
  let newBranchName = options.newBranch;
292
292
  let sourceBranch = options.fromBranch;
293
- // If -n (--new-branch) is provided without -f (--from-branch), default source to 'main'
293
+ // If -n (--new-branch) is provided without -f (--from-branch), default source to configured default branch
294
294
  if (options.newBranch && !options.fromBranch) {
295
- sourceBranch = 'main';
296
- console.log(chalk_1.default.dim(` Source branch not specified, using 'main'`));
295
+ sourceBranch = config.defaults?.branch || 'main';
296
+ console.log(chalk_1.default.dim(` Source branch not specified, using '${sourceBranch}'`));
297
297
  }
298
298
  // If -f (--from-branch) is provided without -n (--new-branch), use env name as branch name
299
299
  if (options.fromBranch && !options.newBranch) {
@@ -325,18 +325,19 @@ exports.createCommand = new commander_1.Command('create')
325
325
  if (!options.branch && !options.fromBranch && !options.newBranch && !options.yes && resolved.repos.length > 0) {
326
326
  resolved = await promptForBranchOptions(resolved, config, name);
327
327
  }
328
- // Default behavior when -y (non-interactive) and no branch options: create new branch from main
328
+ // Default behavior when -y (non-interactive) and no branch options: create new branch from configured default
329
329
  if (!options.branch && !options.fromBranch && !options.newBranch && options.yes && resolved.repos.length > 0) {
330
+ const baseBranch = config.defaults?.branch || 'main';
330
331
  resolved = {
331
332
  ...resolved,
332
333
  repos: resolved.repos.map(repo => ({
333
334
  ...repo,
334
335
  branch: name, // Branch name same as environment name
335
336
  newBranch: name,
336
- sourceBranch: 'main',
337
+ sourceBranch: baseBranch,
337
338
  })),
338
339
  };
339
- console.log(chalk_1.default.dim(` Creating new branch '${name}' from 'main'`));
340
+ console.log(chalk_1.default.dim(` Creating new branch '${name}' from '${baseBranch}'`));
340
341
  }
341
342
  // Display resolved configuration
342
343
  displayResolvedConfig(resolved);
@@ -528,19 +529,19 @@ function displayResolvedConfig(resolved) {
528
529
  }
529
530
  /**
530
531
  * Prompt for branch options interactively
531
- * Default behavior: create new branch from 'main' with branch name = environment name
532
+ * Default behavior: create new branch from configured default (or 'main') with branch name = environment name
532
533
  */
533
534
  async function promptForBranchOptions(resolved, config, envName) {
534
- // Get the default branch from config or first repo
535
- const defaultBranch = config.defaults?.branch || resolved.repos[0]?.branch || 'main';
535
+ // Get the default/base branch from config (used as source for new branches)
536
+ const baseBranch = config.defaults?.branch || 'main';
536
537
  console.log(chalk_1.default.blue('=== Branch Configuration ==='));
537
538
  console.log('');
538
539
  const branchChoice = await prompts.select({
539
540
  message: 'Branch option:',
540
541
  choices: [
541
542
  {
542
- name: `${chalk_1.default.green('Create new branch')} '${chalk_1.default.cyan(envName)}' from 'main' ${chalk_1.default.dim('(recommended)')}`,
543
- value: 'new-from-main',
543
+ name: `${chalk_1.default.green('Create new branch')} '${chalk_1.default.cyan(envName)}' from '${baseBranch}' ${chalk_1.default.dim('(recommended)')}`,
544
+ value: 'new-from-default',
544
545
  },
545
546
  {
546
547
  name: `Create new branch from a different source`,
@@ -551,21 +552,21 @@ async function promptForBranchOptions(resolved, config, envName) {
551
552
  value: 'existing',
552
553
  },
553
554
  {
554
- name: `Use default branch (${defaultBranch}) without creating new branch`,
555
+ name: `Use '${baseBranch}' directly without creating new branch`,
555
556
  value: 'default',
556
557
  },
557
558
  ],
558
- default: 'new-from-main',
559
+ default: 'new-from-default',
559
560
  });
560
- if (branchChoice === 'new-from-main') {
561
- // Create new branch from main with name = environment name
561
+ if (branchChoice === 'new-from-default') {
562
+ // Create new branch from configured default with name = environment name
562
563
  return {
563
564
  ...resolved,
564
565
  repos: resolved.repos.map(repo => ({
565
566
  ...repo,
566
567
  branch: envName,
567
568
  newBranch: envName,
568
- sourceBranch: 'main',
569
+ sourceBranch: baseBranch,
569
570
  })),
570
571
  };
571
572
  }
@@ -604,7 +605,7 @@ async function promptForBranchOptions(resolved, config, envName) {
604
605
  if (branchChoice === 'existing') {
605
606
  const branchName = await prompts.input({
606
607
  message: 'Enter branch name:',
607
- default: defaultBranch,
608
+ default: baseBranch,
608
609
  validate: (value) => {
609
610
  if (!value.trim())
610
611
  return 'Branch name is required';
@@ -675,12 +675,15 @@ exports.initCommand = new commander_1.Command('init')
675
675
  v4Config.defaults.install_claude_code = true;
676
676
  }
677
677
  }
678
- // Get default branch (use detected branch or allow override)
678
+ // Get default/base branch (source branch for creating new environment branches)
679
679
  const detectedBranch = scan.git?.branch || 'main';
680
680
  let defaultBranch = detectedBranch;
681
681
  if (!nonInteractive && !options.fromScan) {
682
+ console.log('');
683
+ console.log(chalk_1.default.dim(' When creating environments, a new branch is created from this base branch.'));
684
+ console.log(chalk_1.default.dim(' The new branch name defaults to the environment name.'));
682
685
  const branchInput = await prompts.input({
683
- message: 'Default branch for new environments:',
686
+ message: 'Base branch for new environment branches:',
684
687
  default: detectedBranch,
685
688
  });
686
689
  defaultBranch = branchInput || detectedBranch;
@@ -1132,7 +1132,7 @@ function showSummary(detected) {
1132
1132
  if (detected.git?.remote) {
1133
1133
  console.log(`\n Git: ${detected.git.provider || 'git'} (${detected.git.type})`);
1134
1134
  console.log(` Remote: ${chalk_1.default.dim(detected.git.remote)}`);
1135
- console.log(` Branch: ${chalk_1.default.cyan(detected.git.branch || 'main')} ${chalk_1.default.dim('← default branch for new environments')}`);
1135
+ console.log(` Branch: ${chalk_1.default.cyan(detected.git.branch || 'main')} ${chalk_1.default.dim('← base branch for new environment branches')}`);
1136
1136
  }
1137
1137
  // Per-app git repos (for multi-repo workspaces)
1138
1138
  const appsWithGit = Object.entries(detected.apps).filter(([, app]) => app.git);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "genbox",
3
- "version": "1.0.45",
3
+ "version": "1.0.46",
4
4
  "description": "Genbox CLI - AI-Powered Development Environments",
5
5
  "main": "dist/index.js",
6
6
  "bin": {