genbox 1.0.20 → 1.0.21

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.
@@ -110,8 +110,8 @@ exports.createCommand = new commander_1.Command('create')
110
110
  .option('--db-source <source>', 'Database source: staging, production')
111
111
  .option('-s, --size <size>', 'Server size: small, medium, large, xl')
112
112
  .option('-b, --branch <branch>', 'Git branch to checkout')
113
- .option('-nb, --new-branch <name>', 'Create a new branch with this name')
114
- .option('-sb, --source-branch <branch>', 'Source branch to create new branch from (defaults to current/default branch)')
113
+ .option('-n, --new-branch <name>', 'Create a new branch with this name')
114
+ .option('-f, --from-branch <branch>', 'Source branch to create new branch from (defaults to current/default branch)')
115
115
  .option('-y, --yes', 'Skip interactive prompts')
116
116
  .option('--dry-run', 'Show what would be created without actually creating')
117
117
  .action(async (name, options) => {
@@ -128,6 +128,20 @@ exports.createCommand = new commander_1.Command('create')
128
128
  // Support both v3 and v4 configs
129
129
  const config = loadResult.config;
130
130
  const profileResolver = new profile_resolver_1.ProfileResolver(configLoader);
131
+ // Validate branch options
132
+ if (options.newBranch && !options.fromBranch) {
133
+ console.error(chalk_1.default.red('Error: --new-branch (-n) requires --from-branch (-f) to specify the source branch'));
134
+ console.log(chalk_1.default.dim(' Example: genbox create my-env -n feature/new -f main'));
135
+ return;
136
+ }
137
+ // Auto-generate branch name if only -f is provided
138
+ let newBranchName = options.newBranch;
139
+ if (options.fromBranch && !options.newBranch) {
140
+ // Generate unique branch name: {genbox-name}-{short-timestamp}
141
+ const timestamp = Date.now().toString(36); // Short alphanumeric timestamp
142
+ newBranchName = `${name}-${timestamp}`;
143
+ console.log(chalk_1.default.dim(` Auto-generated branch name: ${newBranchName}`));
144
+ }
131
145
  // Build create options
132
146
  const createOptions = {
133
147
  name,
@@ -139,8 +153,8 @@ exports.createCommand = new commander_1.Command('create')
139
153
  dbSource: options.dbSource,
140
154
  size: options.size,
141
155
  branch: options.branch,
142
- newBranch: options.newBranch,
143
- sourceBranch: options.sourceBranch,
156
+ newBranch: newBranchName,
157
+ sourceBranch: options.fromBranch,
144
158
  yes: options.yes,
145
159
  dryRun: options.dryRun,
146
160
  };
@@ -424,8 +424,8 @@ exports.rebuildCommand = new commander_1.Command('rebuild')
424
424
  .argument('<name>', 'Name of the Genbox to rebuild')
425
425
  .option('-p, --profile <profile>', 'Use a predefined profile')
426
426
  .option('-b, --branch <branch>', 'Git branch to checkout')
427
- .option('-nb, --new-branch <name>', 'Create a new branch with this name')
428
- .option('-sb, --source-branch <branch>', 'Source branch to create new branch from')
427
+ .option('-n, --new-branch <name>', 'Create a new branch with this name')
428
+ .option('-f, --from-branch <branch>', 'Source branch to create new branch from')
429
429
  .option('-y, --yes', 'Skip interactive prompts')
430
430
  .action(async (name, options) => {
431
431
  try {
@@ -459,13 +459,27 @@ exports.rebuildCommand = new commander_1.Command('rebuild')
459
459
  }
460
460
  const config = loadResult.config;
461
461
  const profileResolver = new profile_resolver_1.ProfileResolver(configLoader);
462
+ // Validate branch options
463
+ if (options.newBranch && !options.fromBranch) {
464
+ console.error(chalk_1.default.red('Error: --new-branch (-n) requires --from-branch (-f) to specify the source branch'));
465
+ console.log(chalk_1.default.dim(' Example: genbox rebuild my-env -n feature/new -f main'));
466
+ return;
467
+ }
468
+ // Auto-generate branch name if only -f is provided
469
+ let newBranchName = options.newBranch;
470
+ if (options.fromBranch && !options.newBranch) {
471
+ // Generate unique branch name: {genbox-name}-{short-timestamp}
472
+ const timestamp = Date.now().toString(36);
473
+ newBranchName = `${name}-${timestamp}`;
474
+ console.log(chalk_1.default.dim(` Auto-generated branch name: ${newBranchName}`));
475
+ }
462
476
  // Build options for resolving
463
477
  const createOptions = {
464
478
  name,
465
479
  profile: options.profile,
466
480
  branch: options.branch,
467
- newBranch: options.newBranch,
468
- sourceBranch: options.sourceBranch,
481
+ newBranch: newBranchName,
482
+ sourceBranch: options.fromBranch,
469
483
  yes: options.yes,
470
484
  };
471
485
  console.log(chalk_1.default.blue('Resolving configuration...'));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "genbox",
3
- "version": "1.0.20",
3
+ "version": "1.0.21",
4
4
  "description": "Genbox CLI - AI-Powered Development Environments",
5
5
  "main": "dist/index.js",
6
6
  "bin": {