genbox 1.0.32 → 1.0.33
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/init.js +18 -5
- package/dist/commands/scan.js +47 -0
- package/package.json +1 -1
package/dist/commands/init.js
CHANGED
|
@@ -1845,11 +1845,24 @@ function convertDetectedToScan(detected) {
|
|
|
1845
1845
|
}));
|
|
1846
1846
|
// Convert infrastructure to compose analysis
|
|
1847
1847
|
let compose = null;
|
|
1848
|
-
|
|
1848
|
+
const hasInfra = detected.infrastructure && detected.infrastructure.length > 0;
|
|
1849
|
+
const hasDockerServices = detected.docker_services && detected.docker_services.length > 0;
|
|
1850
|
+
if (hasInfra || hasDockerServices) {
|
|
1849
1851
|
compose = {
|
|
1850
1852
|
files: ['docker-compose.yml'],
|
|
1851
|
-
applications: []
|
|
1852
|
-
|
|
1853
|
+
applications: (detected.docker_services || []).map(svc => ({
|
|
1854
|
+
name: svc.name,
|
|
1855
|
+
image: svc.image,
|
|
1856
|
+
build: svc.build_context ? {
|
|
1857
|
+
context: svc.build_context,
|
|
1858
|
+
dockerfile: svc.dockerfile,
|
|
1859
|
+
} : undefined,
|
|
1860
|
+
ports: svc.port ? [{ host: svc.port, container: svc.port }] : [],
|
|
1861
|
+
environment: {},
|
|
1862
|
+
dependsOn: svc.depends_on || [],
|
|
1863
|
+
volumes: [],
|
|
1864
|
+
})),
|
|
1865
|
+
databases: (detected.infrastructure || [])
|
|
1853
1866
|
.filter(i => i.type === 'database')
|
|
1854
1867
|
.map(i => ({
|
|
1855
1868
|
name: i.name,
|
|
@@ -1859,7 +1872,7 @@ function convertDetectedToScan(detected) {
|
|
|
1859
1872
|
dependsOn: [],
|
|
1860
1873
|
volumes: [],
|
|
1861
1874
|
})),
|
|
1862
|
-
caches: detected.infrastructure
|
|
1875
|
+
caches: (detected.infrastructure || [])
|
|
1863
1876
|
.filter(i => i.type === 'cache')
|
|
1864
1877
|
.map(i => ({
|
|
1865
1878
|
name: i.name,
|
|
@@ -1869,7 +1882,7 @@ function convertDetectedToScan(detected) {
|
|
|
1869
1882
|
dependsOn: [],
|
|
1870
1883
|
volumes: [],
|
|
1871
1884
|
})),
|
|
1872
|
-
queues: detected.infrastructure
|
|
1885
|
+
queues: (detected.infrastructure || [])
|
|
1873
1886
|
.filter(i => i.type === 'queue')
|
|
1874
1887
|
.map(i => ({
|
|
1875
1888
|
name: i.name,
|
package/dist/commands/scan.js
CHANGED
|
@@ -239,6 +239,30 @@ async function interactiveSelection(detected) {
|
|
|
239
239
|
// Filter scripts to only selected ones
|
|
240
240
|
result.scripts = detected.scripts.filter(s => selectedScripts.includes(s.path));
|
|
241
241
|
}
|
|
242
|
+
// === Docker Services Selection ===
|
|
243
|
+
if (detected.docker_services && detected.docker_services.length > 0) {
|
|
244
|
+
console.log('');
|
|
245
|
+
console.log(chalk_1.default.blue('=== Detected Docker Services ===\n'));
|
|
246
|
+
for (const svc of detected.docker_services) {
|
|
247
|
+
const portInfo = svc.port ? ` port:${svc.port}` : '';
|
|
248
|
+
console.log(` ${chalk_1.default.cyan(svc.name)}${portInfo}`);
|
|
249
|
+
if (svc.build_context) {
|
|
250
|
+
console.log(chalk_1.default.dim(` build: ${svc.dockerfile || 'Dockerfile'}`));
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
console.log();
|
|
254
|
+
const dockerChoices = detected.docker_services.map(svc => ({
|
|
255
|
+
name: `${svc.name}${svc.port ? ` (port ${svc.port})` : ''}`,
|
|
256
|
+
value: svc.name,
|
|
257
|
+
checked: true, // Default: include all
|
|
258
|
+
}));
|
|
259
|
+
const selectedDocker = await prompts.checkbox({
|
|
260
|
+
message: 'Select Docker services to include:',
|
|
261
|
+
choices: dockerChoices,
|
|
262
|
+
});
|
|
263
|
+
// Filter docker services to only selected ones
|
|
264
|
+
result.docker_services = detected.docker_services.filter(svc => selectedDocker.includes(svc.name));
|
|
265
|
+
}
|
|
242
266
|
// === Infrastructure Selection ===
|
|
243
267
|
if (detected.infrastructure && detected.infrastructure.length > 0) {
|
|
244
268
|
console.log('');
|
|
@@ -482,6 +506,18 @@ function convertScanToDetected(scan, root) {
|
|
|
482
506
|
source: 'docker-compose.yml',
|
|
483
507
|
});
|
|
484
508
|
}
|
|
509
|
+
// Save Docker application services (services with build context)
|
|
510
|
+
if (scan.compose.applications && scan.compose.applications.length > 0) {
|
|
511
|
+
detected.docker_services = scan.compose.applications.map(app => ({
|
|
512
|
+
name: app.name,
|
|
513
|
+
build_context: app.build?.context,
|
|
514
|
+
dockerfile: app.build?.dockerfile,
|
|
515
|
+
image: app.image,
|
|
516
|
+
port: app.ports?.[0]?.host,
|
|
517
|
+
depends_on: app.dependsOn?.length ? app.dependsOn : undefined,
|
|
518
|
+
source: 'docker-compose.yml',
|
|
519
|
+
}));
|
|
520
|
+
}
|
|
485
521
|
}
|
|
486
522
|
// Git info
|
|
487
523
|
if (scan.git) {
|
|
@@ -649,6 +685,17 @@ function showSummary(detected) {
|
|
|
649
685
|
console.log(` ${parts.join(' ')}`);
|
|
650
686
|
}
|
|
651
687
|
}
|
|
688
|
+
// Docker Services (applications with build context)
|
|
689
|
+
if (detected.docker_services && detected.docker_services.length > 0) {
|
|
690
|
+
console.log(`\n Docker Services (${detected.docker_services.length}):`);
|
|
691
|
+
for (const svc of detected.docker_services) {
|
|
692
|
+
const portInfo = svc.port ? ` port:${svc.port}` : '';
|
|
693
|
+
console.log(` ${chalk_1.default.cyan(svc.name)}${portInfo}`);
|
|
694
|
+
if (svc.build_context) {
|
|
695
|
+
console.log(chalk_1.default.dim(` build: ${svc.build_context}`));
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
}
|
|
652
699
|
// Infrastructure
|
|
653
700
|
if (detected.infrastructure && detected.infrastructure.length > 0) {
|
|
654
701
|
console.log(`\n Infrastructure (${detected.infrastructure.length}):`);
|