genbox 1.0.96 → 1.0.97

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.
@@ -66,6 +66,8 @@ class ProjectScanner {
66
66
  const apps = await this.discoverApps(root, structure, compose, options.exclude);
67
67
  // Layer 5.5: Apply framework detection to apps (ports, commands, etc.)
68
68
  await this.applyFrameworkDefaults(root, apps, frameworks);
69
+ // Layer 5.6: Ensure unique ports for all apps (avoid collisions)
70
+ this.ensureUniquePorts(apps);
69
71
  // Layer 6: Analyze environment variables (skip if option set)
70
72
  const envAnalysis = options.skipEnv
71
73
  ? { required: [], optional: [], secrets: [], references: [], sources: [] }
@@ -382,6 +384,28 @@ class ProjectScanner {
382
384
  }
383
385
  }
384
386
  }
387
+ /**
388
+ * Ensure all apps have unique ports.
389
+ * When multiple apps have the same port, increment subsequent ones.
390
+ */
391
+ ensureUniquePorts(apps) {
392
+ const usedPorts = new Set();
393
+ for (const app of apps) {
394
+ // Skip libraries and apps without ports
395
+ if (app.type === 'library' || !app.port)
396
+ continue;
397
+ let port = app.port;
398
+ // If port is already used, find the next available one
399
+ while (usedPorts.has(port)) {
400
+ port++;
401
+ }
402
+ // Update app port if it changed
403
+ if (port !== app.port) {
404
+ app.port = port;
405
+ }
406
+ usedPorts.add(port);
407
+ }
408
+ }
385
409
  async detectGit(root) {
386
410
  const { execSync } = require('child_process');
387
411
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "genbox",
3
- "version": "1.0.96",
3
+ "version": "1.0.97",
4
4
  "description": "Genbox CLI - AI-Powered Development Environments",
5
5
  "main": "dist/index.js",
6
6
  "bin": {