genbox 1.0.69 → 1.0.70

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.
@@ -1241,6 +1241,8 @@ function inferPortSource(app) {
1241
1241
  return 'package.json scripts.dev (--port flag)';
1242
1242
  if (app.scripts?.dev?.includes('PORT='))
1243
1243
  return 'package.json scripts.dev (PORT= env)';
1244
+ if (app.framework)
1245
+ return `${app.framework} default`;
1244
1246
  return 'framework default';
1245
1247
  }
1246
1248
  function inferStageReason(script) {
@@ -858,7 +858,14 @@ exports.rebuildCommand = new commander_1.Command('rebuild')
858
858
  console.log(chalk_1.default.red(`✗ Rebuild failed: ${rebuildResult.error}`));
859
859
  console.log(chalk_1.default.dim(` Failed during: ${currentStep}`));
860
860
  }
861
- // Notify API about the rebuild (for tracking)
861
+ // Build services map to update on API
862
+ const services = {};
863
+ for (const app of resolved.apps) {
864
+ if (app.port) {
865
+ services[app.name] = { port: app.port, healthcheck: app.healthcheck };
866
+ }
867
+ }
868
+ // Notify API about the rebuild (for tracking and status update)
862
869
  try {
863
870
  await (0, api_1.fetchApi)(`/genboxes/${genbox._id}/soft-rebuild-completed`, {
864
871
  method: 'POST',
@@ -867,6 +874,7 @@ exports.rebuildCommand = new commander_1.Command('rebuild')
867
874
  branch: resolved.repos[0]?.branch,
868
875
  newBranch: resolved.repos[0]?.newBranch,
869
876
  sourceBranch: resolved.repos[0]?.sourceBranch,
877
+ services, // Update services map
870
878
  }),
871
879
  });
872
880
  }
@@ -64,6 +64,8 @@ class ProjectScanner {
64
64
  const compose = options.skipCompose ? null : await this.composeParser.parse(root);
65
65
  // Layer 5: Discover apps (different approach based on structure)
66
66
  const apps = await this.discoverApps(root, structure, compose, options.exclude);
67
+ // Layer 5.5: Apply framework detection to apps (ports, commands, etc.)
68
+ await this.applyFrameworkDefaults(root, apps, frameworks);
67
69
  // Layer 6: Analyze environment variables (skip if option set)
68
70
  const envAnalysis = options.skipEnv
69
71
  ? { required: [], optional: [], secrets: [], references: [], sources: [] }
@@ -341,6 +343,42 @@ class ProjectScanner {
341
343
  // If it has a start script, it's probably an app
342
344
  return hasStartScript ? 'backend' : 'library';
343
345
  }
346
+ /**
347
+ * Apply framework defaults (ports, commands) to discovered apps
348
+ */
349
+ async applyFrameworkDefaults(root, apps, frameworks) {
350
+ const path = require('path');
351
+ for (const app of apps) {
352
+ // Skip if app already has a port (from docker-compose or package.json)
353
+ if (app.port)
354
+ continue;
355
+ // Skip libraries
356
+ if (app.type === 'library')
357
+ continue;
358
+ // Get the app's directory
359
+ const appPath = path.isAbsolute(app.path) ? app.path : path.join(root, app.path);
360
+ // Detect framework for this specific app
361
+ const runtime = { language: 'node' }; // Default to node
362
+ const appFramework = await this.frameworkDetector.detectForApp(appPath, runtime);
363
+ if (appFramework) {
364
+ // Apply framework name if not already set
365
+ if (!app.framework) {
366
+ app.framework = appFramework.name;
367
+ }
368
+ // Apply default port from framework
369
+ if (!app.port && appFramework.defaultPort) {
370
+ app.port = appFramework.defaultPort;
371
+ }
372
+ }
373
+ else if (app.framework) {
374
+ // App has framework name but we need to look up its default port
375
+ const matchingFramework = frameworks.find(f => f.name === app.framework);
376
+ if (matchingFramework?.defaultPort && !app.port) {
377
+ app.port = matchingFramework.defaultPort;
378
+ }
379
+ }
380
+ }
381
+ }
344
382
  async detectGit(root) {
345
383
  const { execSync } = require('child_process');
346
384
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "genbox",
3
- "version": "1.0.69",
3
+ "version": "1.0.70",
4
4
  "description": "Genbox CLI - AI-Powered Development Environments",
5
5
  "main": "dist/index.js",
6
6
  "bin": {