genbox 1.0.55 → 1.0.57
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/commands/create.js +41 -0
- package/dist/commands/rebuild.js +4 -3
- package/package.json +1 -1
package/dist/commands/create.js
CHANGED
|
@@ -430,6 +430,27 @@ exports.createCommand = new commander_1.Command('create')
|
|
|
430
430
|
}
|
|
431
431
|
}
|
|
432
432
|
}
|
|
433
|
+
// Validate git credentials and warn if missing
|
|
434
|
+
const envVarsForValidation = configLoader.loadEnvVars(process.cwd());
|
|
435
|
+
const gitValidation = validateGitCredentials(resolved.repos.map(r => ({ url: r.url, name: r.name })), envVarsForValidation.GIT_TOKEN, privateKeyContent);
|
|
436
|
+
if (gitValidation.warnings.length > 0) {
|
|
437
|
+
console.log('');
|
|
438
|
+
console.log(chalk_1.default.yellow('⚠ Git Authentication Warnings:'));
|
|
439
|
+
for (const warning of gitValidation.warnings) {
|
|
440
|
+
console.log(chalk_1.default.yellow(` ${warning}`));
|
|
441
|
+
}
|
|
442
|
+
console.log('');
|
|
443
|
+
if (!options.yes) {
|
|
444
|
+
const continueAnyway = await prompts.confirm({
|
|
445
|
+
message: 'Continue anyway? (cloning private repos may fail)',
|
|
446
|
+
default: false,
|
|
447
|
+
});
|
|
448
|
+
if (!continueAnyway) {
|
|
449
|
+
console.log(chalk_1.default.dim('Cancelled.'));
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
}
|
|
433
454
|
// Handle database copy - dump locally and upload to S3
|
|
434
455
|
let snapshotId;
|
|
435
456
|
let snapshotS3Key;
|
|
@@ -914,6 +935,26 @@ function buildAppEnvContent(sections, appName, serviceUrlMap) {
|
|
|
914
935
|
.trim();
|
|
915
936
|
return envContent;
|
|
916
937
|
}
|
|
938
|
+
/**
|
|
939
|
+
* Validate git configuration and warn about missing credentials
|
|
940
|
+
*/
|
|
941
|
+
function validateGitCredentials(repos, gitToken, privateKey) {
|
|
942
|
+
const warnings = [];
|
|
943
|
+
const errors = [];
|
|
944
|
+
for (const repo of repos) {
|
|
945
|
+
const isHttps = repo.url.startsWith('https://');
|
|
946
|
+
const isSsh = repo.url.startsWith('git@') || repo.url.includes('ssh://');
|
|
947
|
+
const isPrivateRepo = repo.url.includes('github.com') && !repo.url.includes('/public/');
|
|
948
|
+
if (isHttps && !gitToken && isPrivateRepo) {
|
|
949
|
+
warnings.push(`Repository '${repo.name}' uses HTTPS URL but GIT_TOKEN is not set.`);
|
|
950
|
+
warnings.push(` Add GIT_TOKEN=<your-github-token> to .env.genbox for private repos.`);
|
|
951
|
+
}
|
|
952
|
+
if (isSsh && !privateKey) {
|
|
953
|
+
warnings.push(`Repository '${repo.name}' uses SSH URL but no SSH key was injected.`);
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
return { warnings, errors };
|
|
957
|
+
}
|
|
917
958
|
/**
|
|
918
959
|
* Build API payload from resolved config
|
|
919
960
|
*/
|
package/dist/commands/rebuild.js
CHANGED
|
@@ -494,9 +494,10 @@ exports.rebuildCommand = new commander_1.Command('rebuild')
|
|
|
494
494
|
const effectiveApps = storedApps; // Use stored apps for rebuild
|
|
495
495
|
// For branch: CLI options override, then stored newBranch (if it was created), then stored branch
|
|
496
496
|
const effectiveBranch = options.branch || storedNewBranch || storedBranch;
|
|
497
|
-
// For new branch creation:
|
|
498
|
-
|
|
499
|
-
const
|
|
497
|
+
// For new branch creation: use CLI options OR stored values (to re-create branch if first attempt failed)
|
|
498
|
+
// If storedNewBranch exists with storedSourceBranch, the branch may not have been created yet
|
|
499
|
+
const effectiveNewBranch = newBranchName || (storedNewBranch && storedSourceBranch ? storedNewBranch : undefined);
|
|
500
|
+
const effectiveSourceBranch = options.fromBranch || (storedNewBranch && storedSourceBranch ? storedSourceBranch : undefined);
|
|
500
501
|
// For database: use CLI option, or stored database config (convert 'snapshot' to 'copy')
|
|
501
502
|
const storedDbMode = genbox.database?.mode === 'snapshot' ? 'copy' : genbox.database?.mode;
|
|
502
503
|
const effectiveDbMode = options.db || storedDbMode;
|