genbox 1.0.56 → 1.0.58

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.
@@ -278,6 +278,26 @@ function buildRebuildPayload(resolved, config, publicKey, privateKey, configLoad
278
278
  gitToken: envVars.GIT_TOKEN,
279
279
  };
280
280
  }
281
+ /**
282
+ * Validate git configuration and warn about missing credentials
283
+ */
284
+ function validateGitCredentials(repos, gitToken, privateKey) {
285
+ const warnings = [];
286
+ const errors = [];
287
+ for (const repo of repos) {
288
+ const isHttps = repo.url.startsWith('https://');
289
+ const isSsh = repo.url.startsWith('git@') || repo.url.includes('ssh://');
290
+ const isPrivateRepo = repo.url.includes('github.com') && !repo.url.includes('/public/');
291
+ if (isHttps && !gitToken && isPrivateRepo) {
292
+ warnings.push(`Repository '${repo.name}' uses HTTPS URL but GIT_TOKEN is not set.`);
293
+ warnings.push(` Add GIT_TOKEN=<your-github-token> to .env.genbox for private repos.`);
294
+ }
295
+ if (isSsh && !privateKey) {
296
+ warnings.push(`Repository '${repo.name}' uses SSH URL but no SSH key was injected.`);
297
+ }
298
+ }
299
+ return { warnings, errors };
300
+ }
281
301
  /**
282
302
  * Generate setup script
283
303
  */
@@ -494,9 +514,10 @@ exports.rebuildCommand = new commander_1.Command('rebuild')
494
514
  const effectiveApps = storedApps; // Use stored apps for rebuild
495
515
  // For branch: CLI options override, then stored newBranch (if it was created), then stored branch
496
516
  const effectiveBranch = options.branch || storedNewBranch || storedBranch;
497
- // For new branch creation: only use CLI options (user must explicitly request new branch on rebuild)
498
- const effectiveNewBranch = newBranchName;
499
- const effectiveSourceBranch = options.fromBranch;
517
+ // For new branch creation: use CLI options OR stored values (to re-create branch if first attempt failed)
518
+ // If storedNewBranch exists with storedSourceBranch, the branch may not have been created yet
519
+ const effectiveNewBranch = newBranchName || (storedNewBranch && storedSourceBranch ? storedNewBranch : undefined);
520
+ const effectiveSourceBranch = options.fromBranch || (storedNewBranch && storedSourceBranch ? storedSourceBranch : undefined);
500
521
  // For database: use CLI option, or stored database config (convert 'snapshot' to 'copy')
501
522
  const storedDbMode = genbox.database?.mode === 'snapshot' ? 'copy' : genbox.database?.mode;
502
523
  const effectiveDbMode = options.db || storedDbMode;
@@ -708,6 +729,32 @@ exports.rebuildCommand = new commander_1.Command('rebuild')
708
729
  }
709
730
  }
710
731
  }
732
+ // Validate git credentials before rebuilding
733
+ const envVarsForValidation = configLoader.loadEnvVars(process.cwd());
734
+ const gitValidation = validateGitCredentials(resolved.repos.map(r => ({ url: r.url, name: r.name })), envVarsForValidation.GIT_TOKEN, privateKeyContent);
735
+ if (gitValidation.warnings.length > 0) {
736
+ console.log('');
737
+ console.log(chalk_1.default.yellow('⚠ Git Authentication Warnings:'));
738
+ for (const warning of gitValidation.warnings) {
739
+ console.log(chalk_1.default.yellow(` ${warning}`));
740
+ }
741
+ console.log('');
742
+ if (!options.yes) {
743
+ const proceed = await prompts.confirm({
744
+ message: 'Git clone may fail without credentials. Continue anyway?',
745
+ default: false,
746
+ });
747
+ if (!proceed) {
748
+ console.log(chalk_1.default.dim('Cancelled. Add GIT_TOKEN to .env.genbox and try again.'));
749
+ return;
750
+ }
751
+ }
752
+ else {
753
+ console.log(chalk_1.default.red('Error: Missing git credentials with --yes flag'));
754
+ console.log(chalk_1.default.dim('Add GIT_TOKEN=<your-github-token> to .env.genbox'));
755
+ return;
756
+ }
757
+ }
711
758
  // Build payload
712
759
  const payload = buildRebuildPayload(resolved, config, publicKey, privateKeyContent, configLoader);
713
760
  // Add database info to payload if we have a snapshot
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "genbox",
3
- "version": "1.0.56",
3
+ "version": "1.0.58",
4
4
  "description": "Genbox CLI - AI-Powered Development Environments",
5
5
  "main": "dist/index.js",
6
6
  "bin": {