genbox 1.0.89 → 1.0.91

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.
@@ -958,37 +958,8 @@ function generateSetupScript(resolved, config, envFilesToMove = []) {
958
958
  lines.push('rm -rf /home/dev/.env-staging 2>/dev/null || true');
959
959
  lines.push('');
960
960
  }
961
- // Change to project directory
962
- if (resolved.repos.length > 0) {
963
- lines.push(`cd ${resolved.repos[0].path} || exit 1`);
964
- lines.push('');
965
- }
966
- // Install dependencies - detect package manager from lockfiles
967
- lines.push('# Install dependencies');
968
- lines.push('if [ -f "pnpm-lock.yaml" ]; then');
969
- lines.push(' echo "Installing dependencies with pnpm..."');
970
- lines.push(' pnpm install --frozen-lockfile');
971
- lines.push('elif [ -f "yarn.lock" ]; then');
972
- lines.push(' echo "Installing dependencies with yarn..."');
973
- lines.push(' yarn install --frozen-lockfile');
974
- lines.push('elif [ -f "bun.lockb" ]; then');
975
- lines.push(' echo "Installing dependencies with bun..."');
976
- lines.push(' bun install --frozen-lockfile');
977
- lines.push('elif [ -f "package-lock.json" ]; then');
978
- lines.push(' echo "Installing dependencies with npm..."');
979
- lines.push(' npm ci');
980
- lines.push('fi');
981
- // Start Docker if API is included locally
982
- const hasLocalApi = resolved.apps.some(a => a.name === 'api' || a.type === 'backend');
983
- if (hasLocalApi) {
984
- lines.push('');
985
- lines.push('echo "Starting Docker services..."');
986
- lines.push('if [ -f "docker-compose.yml" ] || [ -f "compose.yml" ]; then');
987
- lines.push(' docker compose up -d');
988
- lines.push('fi');
989
- }
990
- lines.push('');
991
- lines.push('echo "Setup complete!"');
961
+ // NOTE: Dependencies installation, Docker setup, and app startup are handled
962
+ // by the API's cloud-init setup script. This script only handles env file processing.
992
963
  return lines.join('\n');
993
964
  }
994
965
  /**
@@ -331,6 +331,38 @@ async function selectApps(detected) {
331
331
  }
332
332
  return { ...detected, apps: filteredApps };
333
333
  }
334
+ /**
335
+ * Interactive infrastructure selection
336
+ */
337
+ async function selectInfrastructure(detected) {
338
+ if (!detected.infrastructure || detected.infrastructure.length === 0) {
339
+ return detected;
340
+ }
341
+ console.log('');
342
+ console.log(chalk_1.default.blue('=== Detected Infrastructure ==='));
343
+ console.log('');
344
+ for (const infra of detected.infrastructure) {
345
+ const parts = [
346
+ chalk_1.default.cyan(infra.name),
347
+ `(${infra.type})`,
348
+ infra.image ? `[${infra.image}]` : '',
349
+ infra.port ? `port:${infra.port}` : '',
350
+ ].filter(Boolean);
351
+ console.log(` ${parts.join(' ')}`);
352
+ }
353
+ console.log('');
354
+ const infraChoices = detected.infrastructure.map(infra => ({
355
+ name: `${infra.name} (${infra.type}${infra.image ? `, ${infra.image}` : ''})`,
356
+ value: infra.name,
357
+ checked: true, // Infrastructure is typically required, so default to selected
358
+ }));
359
+ const selectedInfra = await prompts.checkbox({
360
+ message: 'Select infrastructure to include:',
361
+ choices: infraChoices,
362
+ });
363
+ const filteredInfra = detected.infrastructure.filter(infra => selectedInfra.includes(infra.name));
364
+ return { ...detected, infrastructure: filteredInfra.length > 0 ? filteredInfra : undefined };
365
+ }
334
366
  /**
335
367
  * Interactive app editing
336
368
  */
@@ -1832,9 +1864,10 @@ exports.initCommand = new commander_1.Command('init')
1832
1864
  return;
1833
1865
  }
1834
1866
  // =========================================
1835
- // PHASE 2: App Configuration
1867
+ // PHASE 2: App & Infrastructure Configuration
1836
1868
  // =========================================
1837
1869
  detected = await selectApps(detected);
1870
+ detected = await selectInfrastructure(detected);
1838
1871
  if (!options.skipEdit) {
1839
1872
  detected = await editApps(detected);
1840
1873
  }
@@ -141,26 +141,40 @@ class ComposeParser {
141
141
  }
142
142
  findComposeFiles(root) {
143
143
  const files = [];
144
- const patterns = [
145
- 'docker-compose.yml',
146
- 'docker-compose.yaml',
147
- 'docker-compose.dev.yml',
148
- 'docker-compose.dev.yaml',
149
- 'docker-compose.local.yml',
150
- 'docker-compose.local.yaml',
151
- 'docker-compose.override.yml',
152
- 'docker-compose.override.yaml',
153
- 'docker-compose.secure.yml',
154
- 'docker-compose.secure.yaml',
155
- 'compose.yml',
156
- 'compose.yaml',
157
- ];
158
- for (const pattern of patterns) {
159
- const filePath = path.join(root, pattern);
160
- if (fs.existsSync(filePath)) {
161
- files.push(filePath);
144
+ const seenPaths = new Set();
145
+ const findRecursively = (dir, depth = 0) => {
146
+ // Limit depth to avoid going too deep
147
+ if (depth > 5)
148
+ return;
149
+ try {
150
+ const entries = fs.readdirSync(dir, { withFileTypes: true });
151
+ for (const entry of entries) {
152
+ const fullPath = path.join(dir, entry.name);
153
+ if (entry.isDirectory()) {
154
+ // Skip hidden dirs and node_modules
155
+ if (entry.name.startsWith('.') || entry.name === 'node_modules')
156
+ continue;
157
+ findRecursively(fullPath, depth + 1);
158
+ }
159
+ else if (entry.isFile()) {
160
+ // Check if it's a docker-compose file
161
+ const name = entry.name.toLowerCase();
162
+ if ((name.startsWith('docker-compose') || name.startsWith('compose')) &&
163
+ (name.endsWith('.yml') || name.endsWith('.yaml'))) {
164
+ const realPath = fs.realpathSync(fullPath);
165
+ if (!seenPaths.has(realPath)) {
166
+ seenPaths.add(realPath);
167
+ files.push(fullPath);
168
+ }
169
+ }
170
+ }
171
+ }
162
172
  }
163
- }
173
+ catch {
174
+ // Ignore errors reading directories
175
+ }
176
+ };
177
+ findRecursively(root);
164
178
  return files;
165
179
  }
166
180
  normalizeService(name, config, root) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "genbox",
3
- "version": "1.0.89",
3
+ "version": "1.0.91",
4
4
  "description": "Genbox CLI - AI-Powered Development Environments",
5
5
  "main": "dist/index.js",
6
6
  "bin": {