genbox 1.0.47 → 1.0.48
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 +3 -8
- package/dist/commands/db-sync.js +1 -1
- package/dist/commands/init.js +1 -1
- package/dist/commands/migrate.js +18 -215
- package/dist/commands/profiles.js +5 -11
- package/dist/commands/push.js +19 -24
- package/dist/commands/rebuild.js +3 -8
- package/dist/commands/validate.js +13 -13
- package/dist/config-explainer.js +1 -1
- package/dist/config-loader.js +74 -150
- package/dist/profile-resolver.js +15 -23
- package/dist/schema-v4.js +35 -35
- package/dist/strict-mode.js +57 -126
- package/package.json +1 -1
- package/dist/migration.js +0 -335
- package/dist/schema-v3.js +0 -48
package/dist/commands/create.js
CHANGED
|
@@ -238,7 +238,7 @@ exports.createCommand = new commander_1.Command('create')
|
|
|
238
238
|
return;
|
|
239
239
|
}
|
|
240
240
|
const configVersion = (0, schema_v4_1.getConfigVersion)(loadResult.config);
|
|
241
|
-
if (configVersion === '
|
|
241
|
+
if (configVersion === 'invalid') {
|
|
242
242
|
console.log(chalk_1.default.red('Unknown config version'));
|
|
243
243
|
console.log(chalk_1.default.dim('Run "genbox init" to create a new configuration.'));
|
|
244
244
|
return;
|
|
@@ -735,13 +735,8 @@ function buildPayload(resolved, config, publicKey, privateKey, configLoader) {
|
|
|
735
735
|
// Build services map
|
|
736
736
|
const services = {};
|
|
737
737
|
for (const app of resolved.apps) {
|
|
738
|
-
if (app.
|
|
739
|
-
|
|
740
|
-
services[name] = { port: svc.port, healthcheck: svc.healthcheck };
|
|
741
|
-
}
|
|
742
|
-
}
|
|
743
|
-
else if (app.port) {
|
|
744
|
-
services[app.name] = { port: app.port };
|
|
738
|
+
if (app.port) {
|
|
739
|
+
services[app.name] = { port: app.port, healthcheck: app.healthcheck };
|
|
745
740
|
}
|
|
746
741
|
}
|
|
747
742
|
// Build files bundle
|
package/dist/commands/db-sync.js
CHANGED
|
@@ -78,7 +78,7 @@ exports.dbSyncCommand
|
|
|
78
78
|
const config = loadResult.config;
|
|
79
79
|
const source = options.source;
|
|
80
80
|
// Validate source environment exists
|
|
81
|
-
if (config.version ===
|
|
81
|
+
if (config.version === 4 && !config.environments?.[source]) {
|
|
82
82
|
console.log(chalk_1.default.yellow(`Environment '${source}' not configured in genbox.yaml`));
|
|
83
83
|
console.log(chalk_1.default.dim('Available environments:'));
|
|
84
84
|
for (const env of Object.keys(config.environments || {})) {
|
package/dist/commands/init.js
CHANGED
|
@@ -969,7 +969,7 @@ function generateDefaultProfiles(detected, environments) {
|
|
|
969
969
|
// Config Generation
|
|
970
970
|
// =============================================================================
|
|
971
971
|
/**
|
|
972
|
-
* Generate
|
|
972
|
+
* Generate GenboxConfig from detected config and user inputs
|
|
973
973
|
*/
|
|
974
974
|
function generateConfig(detected, settings, repos, environments, profiles) {
|
|
975
975
|
// Convert apps
|
package/dist/commands/migrate.js
CHANGED
|
@@ -2,49 +2,9 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Migrate Command
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* - Creates backup of original
|
|
8
|
-
* - Applies migration
|
|
9
|
-
*
|
|
10
|
-
* Usage:
|
|
11
|
-
* genbox migrate # Interactive migration
|
|
12
|
-
* genbox migrate --dry-run # Show changes without applying
|
|
13
|
-
* genbox migrate --yes # Skip confirmation
|
|
5
|
+
* Legacy command that now informs users to use genbox init instead.
|
|
6
|
+
* Only v4 configuration is supported.
|
|
14
7
|
*/
|
|
15
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
16
|
-
if (k2 === undefined) k2 = k;
|
|
17
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
18
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
19
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
20
|
-
}
|
|
21
|
-
Object.defineProperty(o, k2, desc);
|
|
22
|
-
}) : (function(o, m, k, k2) {
|
|
23
|
-
if (k2 === undefined) k2 = k;
|
|
24
|
-
o[k2] = m[k];
|
|
25
|
-
}));
|
|
26
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
27
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
28
|
-
}) : function(o, v) {
|
|
29
|
-
o["default"] = v;
|
|
30
|
-
});
|
|
31
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
32
|
-
var ownKeys = function(o) {
|
|
33
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
34
|
-
var ar = [];
|
|
35
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
36
|
-
return ar;
|
|
37
|
-
};
|
|
38
|
-
return ownKeys(o);
|
|
39
|
-
};
|
|
40
|
-
return function (mod) {
|
|
41
|
-
if (mod && mod.__esModule) return mod;
|
|
42
|
-
var result = {};
|
|
43
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
44
|
-
__setModuleDefault(result, mod);
|
|
45
|
-
return result;
|
|
46
|
-
};
|
|
47
|
-
})();
|
|
48
8
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
49
9
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
50
10
|
};
|
|
@@ -52,197 +12,40 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
52
12
|
exports.deprecationsCommand = exports.migrateCommand = void 0;
|
|
53
13
|
const commander_1 = require("commander");
|
|
54
14
|
const chalk_1 = __importDefault(require("chalk"));
|
|
55
|
-
const fs = __importStar(require("fs"));
|
|
56
|
-
const yaml = __importStar(require("js-yaml"));
|
|
57
|
-
const prompts_1 = require("@inquirer/prompts");
|
|
58
15
|
const config_loader_1 = require("../config-loader");
|
|
59
|
-
const migration_1 = require("../migration");
|
|
60
16
|
exports.migrateCommand = new commander_1.Command('migrate')
|
|
61
|
-
.description('Migrate genbox.yaml
|
|
62
|
-
.
|
|
63
|
-
.option('-y, --yes', 'Skip confirmation prompts')
|
|
64
|
-
.option('--no-backup', 'Skip creating backup file')
|
|
65
|
-
.option('--json', 'Output migration plan as JSON')
|
|
66
|
-
.action(async (options) => {
|
|
17
|
+
.description('Migrate genbox.yaml (deprecated - only v4 is supported)')
|
|
18
|
+
.action(async () => {
|
|
67
19
|
const cwd = process.cwd();
|
|
68
20
|
console.log(chalk_1.default.cyan('\n🔄 Genbox Configuration Migration\n'));
|
|
69
21
|
try {
|
|
70
|
-
// Load current configuration
|
|
71
22
|
const configLoader = new config_loader_1.ConfigLoader();
|
|
72
23
|
const loadResult = await configLoader.load(cwd);
|
|
73
|
-
if (!loadResult.found
|
|
24
|
+
if (!loadResult.found) {
|
|
74
25
|
console.log(chalk_1.default.red('Not a genbox project'));
|
|
75
26
|
console.log(chalk_1.default.dim('No genbox.yaml found in current directory.'));
|
|
27
|
+
console.log(chalk_1.default.dim('Run "genbox init" to initialize a new project.'));
|
|
76
28
|
process.exit(1);
|
|
77
29
|
}
|
|
78
|
-
|
|
79
|
-
// Check if migration is needed
|
|
80
|
-
if (!(0, migration_1.needsMigration)(config)) {
|
|
30
|
+
if (loadResult.config?.version === 4) {
|
|
81
31
|
console.log(chalk_1.default.green('✓ Configuration is already at v4. No migration needed.'));
|
|
82
32
|
return;
|
|
83
33
|
}
|
|
84
|
-
//
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
console.log(chalk_1.default.yellow(` • ${dep.path}: ${dep.message}`));
|
|
90
|
-
console.log(chalk_1.default.dim(` → ${dep.suggestion}`));
|
|
91
|
-
}
|
|
92
|
-
console.log();
|
|
93
|
-
}
|
|
94
|
-
// Get migration summary
|
|
95
|
-
const summary = (0, migration_1.getMigrationSummary)(config);
|
|
96
|
-
console.log(chalk_1.default.bold('Migration Summary:\n'));
|
|
97
|
-
console.log(` Fields to migrate: ${summary.fieldsToMigrate}`);
|
|
98
|
-
console.log(` Deprecated patterns: ${summary.deprecatedPatterns}`);
|
|
99
|
-
if (summary.estimatedChanges.length > 0) {
|
|
100
|
-
console.log(chalk_1.default.bold('\n Changes to be made:'));
|
|
101
|
-
for (const change of summary.estimatedChanges) {
|
|
102
|
-
console.log(` • ${change}`);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
// Perform migration
|
|
106
|
-
const result = (0, migration_1.migrateV3ToV4)(config);
|
|
107
|
-
if (options.json) {
|
|
108
|
-
console.log(JSON.stringify({
|
|
109
|
-
summary,
|
|
110
|
-
changes: result.changes,
|
|
111
|
-
warnings: result.warnings,
|
|
112
|
-
config: result.config,
|
|
113
|
-
}, null, 2));
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
// Show detailed changes
|
|
117
|
-
console.log(chalk_1.default.bold('\n📝 Detailed Changes:\n'));
|
|
118
|
-
for (const change of result.changes) {
|
|
119
|
-
const icon = change.type === 'add' ? '+' :
|
|
120
|
-
change.type === 'remove' ? '-' :
|
|
121
|
-
change.type === 'rename' ? '→' : '~';
|
|
122
|
-
const color = change.type === 'add' ? chalk_1.default.green :
|
|
123
|
-
change.type === 'remove' ? chalk_1.default.red :
|
|
124
|
-
chalk_1.default.yellow;
|
|
125
|
-
console.log(color(` ${icon} ${change.path}: ${change.description}`));
|
|
126
|
-
}
|
|
127
|
-
// Show warnings
|
|
128
|
-
if (result.warnings.length > 0) {
|
|
129
|
-
console.log(chalk_1.default.yellow.bold('\n⚠️ Warnings:\n'));
|
|
130
|
-
for (const warning of result.warnings) {
|
|
131
|
-
console.log(chalk_1.default.yellow(` • ${warning}`));
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
// Dry run stops here
|
|
135
|
-
if (options.dryRun) {
|
|
136
|
-
console.log(chalk_1.default.bold('\n📄 Migrated Configuration (preview):\n'));
|
|
137
|
-
console.log(chalk_1.default.dim('---'));
|
|
138
|
-
console.log(yaml.dump(result.config, { lineWidth: 120, noRefs: true }));
|
|
139
|
-
console.log(chalk_1.default.dim('---'));
|
|
140
|
-
console.log(chalk_1.default.cyan('\nThis was a dry run. No changes were made.'));
|
|
141
|
-
console.log('Run ' + chalk_1.default.bold('genbox migrate') + ' (without --dry-run) to apply changes.');
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
// Confirm migration
|
|
145
|
-
if (!options.yes) {
|
|
146
|
-
console.log();
|
|
147
|
-
const confirmed = await (0, prompts_1.confirm)({
|
|
148
|
-
message: 'Apply these changes to genbox.yaml?',
|
|
149
|
-
default: true,
|
|
150
|
-
});
|
|
151
|
-
if (!confirmed) {
|
|
152
|
-
console.log(chalk_1.default.yellow('Migration cancelled.'));
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
// Find the config file path
|
|
157
|
-
const projectSource = loadResult.sources.find(s => s.type === 'project');
|
|
158
|
-
if (!projectSource) {
|
|
159
|
-
console.log(chalk_1.default.red('Could not find project config file path.'));
|
|
160
|
-
process.exit(1);
|
|
161
|
-
}
|
|
162
|
-
const configPath = projectSource.path;
|
|
163
|
-
// Create backup
|
|
164
|
-
if (options.backup !== false) {
|
|
165
|
-
const backupPath = configPath.replace('.yaml', '.v3.yaml.bak');
|
|
166
|
-
fs.copyFileSync(configPath, backupPath);
|
|
167
|
-
console.log(chalk_1.default.dim(`\nBackup created: ${backupPath}`));
|
|
168
|
-
}
|
|
169
|
-
// Write migrated config
|
|
170
|
-
const migratedContent = yaml.dump(result.config, {
|
|
171
|
-
lineWidth: 120,
|
|
172
|
-
noRefs: true,
|
|
173
|
-
quotingType: '"',
|
|
174
|
-
forceQuotes: false,
|
|
175
|
-
});
|
|
176
|
-
// Add header comment
|
|
177
|
-
const header = `# Genbox Configuration v4
|
|
178
|
-
# Migrated from v3 on ${new Date().toISOString()}
|
|
179
|
-
# See: https://genbox.dev/docs/config-v4
|
|
180
|
-
|
|
181
|
-
`;
|
|
182
|
-
fs.writeFileSync(configPath, header + migratedContent);
|
|
183
|
-
console.log(chalk_1.default.green.bold('\n✓ Migration complete!'));
|
|
184
|
-
console.log(`\n Updated: ${configPath}`);
|
|
185
|
-
// Next steps
|
|
186
|
-
console.log(chalk_1.default.bold('\n📝 Next steps:\n'));
|
|
187
|
-
console.log(' 1. Review the migrated configuration');
|
|
188
|
-
console.log(' 2. Run ' + chalk_1.default.cyan('genbox validate') + ' to check for issues');
|
|
189
|
-
console.log(' 3. Run ' + chalk_1.default.cyan('genbox scan') + ' to update detected.yaml');
|
|
190
|
-
console.log(' 4. Run ' + chalk_1.default.cyan('genbox resolve') + ' to verify resolution');
|
|
191
|
-
console.log();
|
|
192
|
-
// Show v4 benefits
|
|
193
|
-
console.log(chalk_1.default.bold('🎉 v4 Benefits:\n'));
|
|
194
|
-
console.log(' • Explicit connections with ' + chalk_1.default.cyan('connects_to'));
|
|
195
|
-
console.log(' • Clear infrastructure with ' + chalk_1.default.cyan('provides'));
|
|
196
|
-
console.log(' • Opt-in detection with ' + chalk_1.default.cyan('$detect') + ' markers');
|
|
197
|
-
console.log(' • Strict mode for predictable behavior');
|
|
198
|
-
console.log();
|
|
34
|
+
// Old config version
|
|
35
|
+
console.log(chalk_1.default.yellow('⚠️ Legacy configuration detected.\n'));
|
|
36
|
+
console.log('Only v4 configuration format is supported.');
|
|
37
|
+
console.log('Please run ' + chalk_1.default.cyan('genbox init') + ' to create a new v4 configuration.\n');
|
|
38
|
+
console.log('Your existing configuration will be backed up automatically.');
|
|
199
39
|
}
|
|
200
40
|
catch (error) {
|
|
201
|
-
console.error(chalk_1.default.red('
|
|
41
|
+
console.error(chalk_1.default.red('Error:'), error);
|
|
202
42
|
process.exit(1);
|
|
203
43
|
}
|
|
204
44
|
});
|
|
205
|
-
/**
|
|
206
|
-
* Show deprecation warnings subcommand
|
|
207
|
-
*/
|
|
208
45
|
exports.deprecationsCommand = new commander_1.Command('deprecations')
|
|
209
|
-
.description('Check for deprecated patterns
|
|
210
|
-
.
|
|
211
|
-
.
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
const configLoader = new config_loader_1.ConfigLoader();
|
|
215
|
-
const loadResult = await configLoader.load(cwd);
|
|
216
|
-
if (!loadResult.found || !loadResult.config) {
|
|
217
|
-
console.log(chalk_1.default.red('Not a genbox project'));
|
|
218
|
-
console.log(chalk_1.default.dim('No genbox.yaml found in current directory.'));
|
|
219
|
-
process.exit(1);
|
|
220
|
-
}
|
|
221
|
-
const deprecations = (0, migration_1.checkDeprecations)(loadResult.config);
|
|
222
|
-
if (options.json) {
|
|
223
|
-
console.log(JSON.stringify(deprecations, null, 2));
|
|
224
|
-
return;
|
|
225
|
-
}
|
|
226
|
-
if (deprecations.length === 0) {
|
|
227
|
-
console.log(chalk_1.default.green('✓ No deprecated patterns found.'));
|
|
228
|
-
return;
|
|
229
|
-
}
|
|
230
|
-
console.log(chalk_1.default.yellow.bold(`\nFound ${deprecations.length} deprecated pattern(s):\n`));
|
|
231
|
-
for (const dep of deprecations) {
|
|
232
|
-
const icon = dep.severity === 'error' ? '✗' : '⚠';
|
|
233
|
-
const color = dep.severity === 'error' ? chalk_1.default.red : chalk_1.default.yellow;
|
|
234
|
-
console.log(color(`${icon} ${dep.path}`));
|
|
235
|
-
console.log(` ${dep.message}`);
|
|
236
|
-
console.log(chalk_1.default.dim(` → ${dep.suggestion}`));
|
|
237
|
-
if (dep.autoMigrate) {
|
|
238
|
-
console.log(chalk_1.default.dim(' (can be auto-migrated)'));
|
|
239
|
-
}
|
|
240
|
-
console.log();
|
|
241
|
-
}
|
|
242
|
-
console.log(chalk_1.default.bold('Run ' + chalk_1.default.cyan('genbox migrate') + ' to fix these issues.\n'));
|
|
243
|
-
}
|
|
244
|
-
catch (error) {
|
|
245
|
-
console.error(chalk_1.default.red('Check failed:'), error);
|
|
246
|
-
process.exit(1);
|
|
247
|
-
}
|
|
46
|
+
.description('Check for deprecated patterns (deprecated - only v4 is supported)')
|
|
47
|
+
.action(async () => {
|
|
48
|
+
console.log(chalk_1.default.yellow('\n⚠️ This command is deprecated.\n'));
|
|
49
|
+
console.log('Only v4 configuration format is supported.');
|
|
50
|
+
console.log('Run ' + chalk_1.default.cyan('genbox validate') + ' to check your v4 configuration.\n');
|
|
248
51
|
});
|
|
@@ -58,7 +58,7 @@ exports.profilesCommand = new commander_1.Command('profiles')
|
|
|
58
58
|
return;
|
|
59
59
|
}
|
|
60
60
|
const version = (0, schema_v4_1.getConfigVersion)(loadResult.config);
|
|
61
|
-
if (version === '
|
|
61
|
+
if (version === 'invalid') {
|
|
62
62
|
console.log(chalk_1.default.yellow('Unknown config version'));
|
|
63
63
|
console.log(chalk_1.default.dim('Run "genbox init" to create a v4 configuration'));
|
|
64
64
|
return;
|
|
@@ -118,7 +118,7 @@ exports.profilesCommand
|
|
|
118
118
|
return;
|
|
119
119
|
}
|
|
120
120
|
const configVersion = (0, schema_v4_1.getConfigVersion)(loadResult.config);
|
|
121
|
-
if (configVersion === '
|
|
121
|
+
if (configVersion === 'invalid') {
|
|
122
122
|
console.log(chalk_1.default.red('Unknown config version'));
|
|
123
123
|
return;
|
|
124
124
|
}
|
|
@@ -174,12 +174,6 @@ exports.profilesCommand
|
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
|
-
else if (v3Profile.infrastructure) {
|
|
178
|
-
console.log(` ${chalk_1.default.bold('Infrastructure:')}`);
|
|
179
|
-
for (const [name, mode] of Object.entries(v3Profile.infrastructure)) {
|
|
180
|
-
console.log(` ${name}: ${mode}`);
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
177
|
console.log(chalk_1.default.dim('───────────────────────────────────────────────'));
|
|
184
178
|
console.log('');
|
|
185
179
|
console.log(chalk_1.default.dim(`Use: genbox create <name> --profile ${name}`));
|
|
@@ -202,7 +196,7 @@ exports.profilesCommand
|
|
|
202
196
|
return;
|
|
203
197
|
}
|
|
204
198
|
const configVersion = (0, schema_v4_1.getConfigVersion)(loadResult.config);
|
|
205
|
-
if (configVersion === '
|
|
199
|
+
if (configVersion === 'invalid') {
|
|
206
200
|
console.log(chalk_1.default.red('Unknown config version'));
|
|
207
201
|
return;
|
|
208
202
|
}
|
|
@@ -271,7 +265,7 @@ exports.profilesCommand
|
|
|
271
265
|
description: description || undefined,
|
|
272
266
|
size: size,
|
|
273
267
|
apps: selectedApps,
|
|
274
|
-
|
|
268
|
+
default_connection: connectTo !== 'local' ? connectTo : undefined,
|
|
275
269
|
database: dbMode !== 'none' ? {
|
|
276
270
|
mode: dbMode.startsWith('copy') ? 'copy' : dbMode.startsWith('remote') ? 'remote' : 'local',
|
|
277
271
|
source: dbMode.includes('staging') ? 'staging' : dbMode.includes('production') ? 'production' : undefined,
|
|
@@ -310,7 +304,7 @@ exports.profilesCommand
|
|
|
310
304
|
return;
|
|
311
305
|
}
|
|
312
306
|
const configVersion = (0, schema_v4_1.getConfigVersion)(loadResult.config);
|
|
313
|
-
if (configVersion === '
|
|
307
|
+
if (configVersion === 'invalid') {
|
|
314
308
|
console.log(chalk_1.default.red('Unknown config version'));
|
|
315
309
|
return;
|
|
316
310
|
}
|
package/dist/commands/push.js
CHANGED
|
@@ -98,7 +98,7 @@ function displayV3Summary(config, envVars, payload) {
|
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
// Display infrastructure
|
|
101
|
-
const infraNames = Object.keys(config.
|
|
101
|
+
const infraNames = Object.keys(config.provides || {});
|
|
102
102
|
if (infraNames.length > 0) {
|
|
103
103
|
console.log(` ${chalk_1.default.bold('Infra:')} ${infraNames.join(', ')}`);
|
|
104
104
|
}
|
|
@@ -169,18 +169,20 @@ exports.pushCommand = new commander_1.Command('push')
|
|
|
169
169
|
process.exit(1);
|
|
170
170
|
}
|
|
171
171
|
const config = loadResult.config;
|
|
172
|
-
const
|
|
172
|
+
const isV4 = config?.version === 4;
|
|
173
173
|
// Load env vars
|
|
174
174
|
const envVars = configLoader.loadEnvVars(process.cwd());
|
|
175
175
|
console.log(chalk_1.default.blue('Preparing workspace configuration...'));
|
|
176
176
|
console.log('');
|
|
177
|
-
// Build
|
|
177
|
+
// Build payload (v4 only)
|
|
178
178
|
let payload;
|
|
179
|
-
if (
|
|
179
|
+
if (isV4) {
|
|
180
180
|
payload = buildV3Payload(config, envVars);
|
|
181
181
|
}
|
|
182
182
|
else {
|
|
183
|
-
|
|
183
|
+
console.log(chalk_1.default.red('Error: Only version 4 configuration is supported.'));
|
|
184
|
+
console.log(chalk_1.default.dim('Run "genbox init" to create a v4 configuration.'));
|
|
185
|
+
process.exit(1);
|
|
184
186
|
}
|
|
185
187
|
// Process files to upload (for both versions)
|
|
186
188
|
const configAny = config;
|
|
@@ -212,13 +214,8 @@ exports.pushCommand = new commander_1.Command('push')
|
|
|
212
214
|
console.log(chalk_1.default.yellow('Warning: No SSH private key found in ~/.ssh/'));
|
|
213
215
|
}
|
|
214
216
|
}
|
|
215
|
-
// Display
|
|
216
|
-
|
|
217
|
-
displayV3Summary(config, envVars, payload);
|
|
218
|
-
}
|
|
219
|
-
else {
|
|
220
|
-
displayLegacySummary(payload);
|
|
221
|
-
}
|
|
217
|
+
// Display summary
|
|
218
|
+
displayV3Summary(config, envVars, payload);
|
|
222
219
|
console.log('');
|
|
223
220
|
// Dry run mode
|
|
224
221
|
if (options.dryRun) {
|
|
@@ -246,18 +243,16 @@ exports.pushCommand = new commander_1.Command('push')
|
|
|
246
243
|
console.log('');
|
|
247
244
|
console.log(chalk_1.default.dim('Your configuration is now available in the cloud.'));
|
|
248
245
|
console.log(chalk_1.default.dim('Team members can run "genbox create <name>" to provision environments.'));
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
console.log(chalk_1.default.dim(` ... and ${profileNames.length - 5} more`));
|
|
260
|
-
}
|
|
246
|
+
const v4Config = config;
|
|
247
|
+
const profileNames = Object.keys(v4Config.profiles || {});
|
|
248
|
+
if (profileNames.length > 0) {
|
|
249
|
+
console.log('');
|
|
250
|
+
console.log(chalk_1.default.dim('Available profiles:'));
|
|
251
|
+
for (const name of profileNames.slice(0, 5)) {
|
|
252
|
+
console.log(chalk_1.default.dim(` genbox create <name> --profile ${name}`));
|
|
253
|
+
}
|
|
254
|
+
if (profileNames.length > 5) {
|
|
255
|
+
console.log(chalk_1.default.dim(` ... and ${profileNames.length - 5} more`));
|
|
261
256
|
}
|
|
262
257
|
}
|
|
263
258
|
if (Object.keys(envVars).length === 0) {
|
package/dist/commands/rebuild.js
CHANGED
|
@@ -176,13 +176,8 @@ function buildRebuildPayload(resolved, config, publicKey, privateKey, configLoad
|
|
|
176
176
|
// Build services map
|
|
177
177
|
const services = {};
|
|
178
178
|
for (const app of resolved.apps) {
|
|
179
|
-
if (app.
|
|
180
|
-
|
|
181
|
-
services[name] = { port: svc.port, healthcheck: svc.healthcheck };
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
else if (app.port) {
|
|
185
|
-
services[app.name] = { port: app.port };
|
|
179
|
+
if (app.port) {
|
|
180
|
+
services[app.name] = { port: app.port, healthcheck: app.healthcheck };
|
|
186
181
|
}
|
|
187
182
|
}
|
|
188
183
|
// Build files bundle
|
|
@@ -470,7 +465,7 @@ exports.rebuildCommand = new commander_1.Command('rebuild')
|
|
|
470
465
|
return;
|
|
471
466
|
}
|
|
472
467
|
const configVersion = (0, schema_v4_1.getConfigVersion)(loadResult.config);
|
|
473
|
-
if (configVersion === '
|
|
468
|
+
if (configVersion === 'invalid') {
|
|
474
469
|
console.log(chalk_1.default.red('Unknown config version'));
|
|
475
470
|
return;
|
|
476
471
|
}
|
|
@@ -249,12 +249,12 @@ function validateSchema(config, errors, warnings) {
|
|
|
249
249
|
suggestion: 'Add "version: 3" at the top of genbox.yaml',
|
|
250
250
|
});
|
|
251
251
|
}
|
|
252
|
-
else if (config.version !==
|
|
253
|
-
|
|
252
|
+
else if (config.version !== 4) {
|
|
253
|
+
errors.push({
|
|
254
254
|
path: 'version',
|
|
255
|
-
message: `Version ${config.version}
|
|
256
|
-
severity: '
|
|
257
|
-
suggestion: '
|
|
255
|
+
message: `Version ${config.version} is not supported`,
|
|
256
|
+
severity: 'error',
|
|
257
|
+
suggestion: 'Only version 4 is supported. Run "genbox init" to create a v4 configuration.',
|
|
258
258
|
});
|
|
259
259
|
}
|
|
260
260
|
if (!config.project?.name) {
|
|
@@ -316,8 +316,8 @@ function validateReferences(config, errors, _warnings) {
|
|
|
316
316
|
}
|
|
317
317
|
}
|
|
318
318
|
// Validate connect_to references
|
|
319
|
-
if (profile.
|
|
320
|
-
for (const [appName, connections] of Object.entries(profile.
|
|
319
|
+
if (profile.default_connection) {
|
|
320
|
+
for (const [appName, connections] of Object.entries(profile.default_connection)) {
|
|
321
321
|
if (!appNames.has(appName)) {
|
|
322
322
|
errors.push({
|
|
323
323
|
path: `profiles.${profileName}.connect_to.${appName}`,
|
|
@@ -328,7 +328,7 @@ function validateReferences(config, errors, _warnings) {
|
|
|
328
328
|
// Validate connection targets
|
|
329
329
|
for (const [targetName] of Object.entries(connections || {})) {
|
|
330
330
|
// Infrastructure names are in the infrastructure section (it's a Record, not array)
|
|
331
|
-
const infraNames = new Set(Object.keys(config.
|
|
331
|
+
const infraNames = new Set(Object.keys(config.provides || {}));
|
|
332
332
|
if (!appNames.has(targetName) && !infraNames.has(targetName)) {
|
|
333
333
|
errors.push({
|
|
334
334
|
path: `profiles.${profileName}.connect_to.${appName}.${targetName}`,
|
|
@@ -372,11 +372,11 @@ function validateProfiles(config, errors, warnings) {
|
|
|
372
372
|
}
|
|
373
373
|
function validateDependencies(config, errors, warnings) {
|
|
374
374
|
const appNames = new Set(Object.keys(config.apps || {}));
|
|
375
|
-
const infraNames = new Set(Object.keys(config.
|
|
375
|
+
const infraNames = new Set(Object.keys(config.provides || {}));
|
|
376
376
|
// Check app dependencies
|
|
377
377
|
for (const [appName, appConfig] of Object.entries(config.apps || {})) {
|
|
378
|
-
if (appConfig.
|
|
379
|
-
for (const depName of Object.keys(appConfig.
|
|
378
|
+
if (appConfig.connects_to) {
|
|
379
|
+
for (const depName of Object.keys(appConfig.connects_to)) {
|
|
380
380
|
if (!infraNames.has(depName) && !appNames.has(depName)) {
|
|
381
381
|
errors.push({
|
|
382
382
|
path: `apps.${appName}.dependencies.${depName}`,
|
|
@@ -391,7 +391,7 @@ function validateDependencies(config, errors, warnings) {
|
|
|
391
391
|
// Check for circular dependencies
|
|
392
392
|
const appDeps = new Map();
|
|
393
393
|
for (const [appName, appConfig] of Object.entries(config.apps || {})) {
|
|
394
|
-
const deps = Object.keys(appConfig.
|
|
394
|
+
const deps = Object.keys(appConfig.connects_to || {}).filter(d => appNames.has(d));
|
|
395
395
|
appDeps.set(appName, deps);
|
|
396
396
|
}
|
|
397
397
|
for (const appName of appNames) {
|
|
@@ -407,7 +407,7 @@ function validateDependencies(config, errors, warnings) {
|
|
|
407
407
|
}
|
|
408
408
|
// Warn about apps with no dependencies defined
|
|
409
409
|
for (const [appName, appConfig] of Object.entries(config.apps || {})) {
|
|
410
|
-
if (!appConfig.
|
|
410
|
+
if (!appConfig.connects_to || Object.keys(appConfig.connects_to).length === 0) {
|
|
411
411
|
if (appConfig.type === 'backend' || appConfig.type === 'worker') {
|
|
412
412
|
warnings.push({
|
|
413
413
|
path: `apps.${appName}.dependencies`,
|
package/dist/config-explainer.js
CHANGED