@turboops/cli 1.0.0-dev.710 → 1.0.0-dev.712
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/index.js +45 -13
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -697,6 +697,12 @@ var apiClient = {
|
|
|
697
697
|
async updateProjectConfig(projectId, config) {
|
|
698
698
|
return this.request("PATCH", `/cli/deployment/projects/${projectId}/config`, config);
|
|
699
699
|
},
|
|
700
|
+
/**
|
|
701
|
+
* Upload compose file content to project (CLI endpoint)
|
|
702
|
+
*/
|
|
703
|
+
async uploadCompose(projectId, content, message) {
|
|
704
|
+
return this.request("POST", `/cli/deployment/projects/${projectId}/compose`, { content, message });
|
|
705
|
+
},
|
|
700
706
|
/**
|
|
701
707
|
* Generate CI/CD pipeline configuration (CLI endpoint)
|
|
702
708
|
*/
|
|
@@ -748,7 +754,7 @@ var apiClient = {
|
|
|
748
754
|
if (Date.now() - startTime > timeout) {
|
|
749
755
|
throw new Error(`Deployment timeout after ${timeout / 1e3} seconds`);
|
|
750
756
|
}
|
|
751
|
-
await new Promise((
|
|
757
|
+
await new Promise((resolve4) => setTimeout(resolve4, pollInterval));
|
|
752
758
|
}
|
|
753
759
|
}
|
|
754
760
|
};
|
|
@@ -865,7 +871,7 @@ var authService = {
|
|
|
865
871
|
if (result.status === "expired" || result.status === "consumed") {
|
|
866
872
|
return { error: "Autorisierungscode abgelaufen oder bereits verwendet", success: false };
|
|
867
873
|
}
|
|
868
|
-
await new Promise((
|
|
874
|
+
await new Promise((resolve4) => setTimeout(resolve4, pollInterval));
|
|
869
875
|
}
|
|
870
876
|
return { error: "Zeit\xFCberschreitung bei der Anmeldung", success: false };
|
|
871
877
|
},
|
|
@@ -1260,6 +1266,8 @@ function getStatusColor(status) {
|
|
|
1260
1266
|
}
|
|
1261
1267
|
|
|
1262
1268
|
// src/commands/init.ts
|
|
1269
|
+
import { readFileSync as readFileSync2, existsSync as existsSync3 } from "fs";
|
|
1270
|
+
import { resolve } from "path";
|
|
1263
1271
|
import chalk5 from "chalk";
|
|
1264
1272
|
import { Command as Command3 } from "commander";
|
|
1265
1273
|
import prompts2 from "prompts";
|
|
@@ -1346,7 +1354,7 @@ var aiToolsService = {
|
|
|
1346
1354
|
text: `${config.name} arbeitet...`,
|
|
1347
1355
|
color: "cyan"
|
|
1348
1356
|
}).start();
|
|
1349
|
-
return new Promise((
|
|
1357
|
+
return new Promise((resolve4) => {
|
|
1350
1358
|
if (verbose) {
|
|
1351
1359
|
spinner.stop();
|
|
1352
1360
|
console.log(chalk4.dim("[DEBUG] Spawning child process..."));
|
|
@@ -1457,14 +1465,14 @@ var aiToolsService = {
|
|
|
1457
1465
|
spinner.fail(`${config.name} fehlgeschlagen (Exit Code: ${code})`);
|
|
1458
1466
|
}
|
|
1459
1467
|
logger.newline();
|
|
1460
|
-
|
|
1468
|
+
resolve4(code === 0);
|
|
1461
1469
|
});
|
|
1462
1470
|
child.on("error", (err) => {
|
|
1463
1471
|
if (verbose) {
|
|
1464
1472
|
console.log(chalk4.red(`[ERROR] Spawn error: ${err.message}`));
|
|
1465
1473
|
}
|
|
1466
1474
|
spinner.fail(`Fehler beim Ausf\xFChren von ${config.name}: ${err.message}`);
|
|
1467
|
-
|
|
1475
|
+
resolve4(false);
|
|
1468
1476
|
});
|
|
1469
1477
|
});
|
|
1470
1478
|
}
|
|
@@ -1656,6 +1664,7 @@ async function setupProject(project, verbose = false) {
|
|
|
1656
1664
|
}
|
|
1657
1665
|
}
|
|
1658
1666
|
await offerAiAssistance(project.slug, project.id, verbose);
|
|
1667
|
+
await detectAndUploadCompose(project.slug);
|
|
1659
1668
|
await showFinalSummary(project);
|
|
1660
1669
|
}
|
|
1661
1670
|
async function createNewProject(slug, verbose = false) {
|
|
@@ -1752,6 +1761,7 @@ async function createNewProject(slug, verbose = false) {
|
|
|
1752
1761
|
await createDefaultStages(newProject.id, newProject.slug);
|
|
1753
1762
|
}
|
|
1754
1763
|
await offerAiAssistance(newProject.slug, newProject.id, verbose);
|
|
1764
|
+
await detectAndUploadCompose(newProject.slug);
|
|
1755
1765
|
await showFinalSummary(newProject);
|
|
1756
1766
|
}
|
|
1757
1767
|
var DEFAULT_STAGES = [
|
|
@@ -2199,6 +2209,28 @@ Erstelle alle notwendigen Dateien basierend auf der erkannten Projektstruktur un
|
|
|
2199
2209
|
});
|
|
2200
2210
|
}
|
|
2201
2211
|
}
|
|
2212
|
+
async function detectAndUploadCompose(projectSlug) {
|
|
2213
|
+
const { data: project } = await apiClient.getProject(projectSlug);
|
|
2214
|
+
const composePath = project?.detectedConfig?.composePath;
|
|
2215
|
+
if (!composePath) {
|
|
2216
|
+
return;
|
|
2217
|
+
}
|
|
2218
|
+
const fullPath = resolve(process.cwd(), composePath);
|
|
2219
|
+
if (!existsSync3(fullPath)) {
|
|
2220
|
+
return;
|
|
2221
|
+
}
|
|
2222
|
+
try {
|
|
2223
|
+
const content = readFileSync2(fullPath, "utf-8");
|
|
2224
|
+
const { error } = await apiClient.uploadCompose(project.id, content, "Uploaded via turbo init");
|
|
2225
|
+
if (error) {
|
|
2226
|
+
logger.warning(`Compose-Upload fehlgeschlagen: ${error}`);
|
|
2227
|
+
} else {
|
|
2228
|
+
logger.success(`Docker-Compose (${composePath}) am Projekt gespeichert.`);
|
|
2229
|
+
}
|
|
2230
|
+
} catch {
|
|
2231
|
+
logger.warning(`Compose-Datei ${composePath} konnte nicht gelesen werden.`);
|
|
2232
|
+
}
|
|
2233
|
+
}
|
|
2202
2234
|
async function integratePipelineWithAI(detection, projectSlug, verbose = false, projectId) {
|
|
2203
2235
|
const tool = await aiToolsService.selectTool();
|
|
2204
2236
|
if (!tool) return;
|
|
@@ -2335,8 +2367,8 @@ Erstelle die Datei "${pipelineFile}".`;
|
|
|
2335
2367
|
}
|
|
2336
2368
|
|
|
2337
2369
|
// src/commands/deploy.ts
|
|
2338
|
-
import { readFileSync as
|
|
2339
|
-
import { resolve } from "path";
|
|
2370
|
+
import { readFileSync as readFileSync3, existsSync as existsSync4 } from "fs";
|
|
2371
|
+
import { resolve as resolve2 } from "path";
|
|
2340
2372
|
import { Command as Command4 } from "commander";
|
|
2341
2373
|
import chalk6 from "chalk";
|
|
2342
2374
|
function detectCiCommitSha() {
|
|
@@ -2388,17 +2420,17 @@ var deployCommand = new Command4("deploy").description("Trigger a deployment (fo
|
|
|
2388
2420
|
}
|
|
2389
2421
|
let composeFileContent;
|
|
2390
2422
|
if (typeof options.compose === "string") {
|
|
2391
|
-
const composePath =
|
|
2392
|
-
if (!
|
|
2423
|
+
const composePath = resolve2(options.compose);
|
|
2424
|
+
if (!existsSync4(composePath)) {
|
|
2393
2425
|
logger.error(`Compose file not found: ${composePath}`);
|
|
2394
2426
|
process.exit(11 /* CONFIG_ERROR */);
|
|
2395
2427
|
}
|
|
2396
|
-
composeFileContent =
|
|
2428
|
+
composeFileContent = readFileSync3(composePath, "utf-8");
|
|
2397
2429
|
logger.info(`Using compose file: ${composePath}`);
|
|
2398
2430
|
} else if (project.detectedConfig?.composePath) {
|
|
2399
|
-
const composePath =
|
|
2400
|
-
if (
|
|
2401
|
-
composeFileContent =
|
|
2431
|
+
const composePath = resolve2(process.cwd(), project.detectedConfig.composePath);
|
|
2432
|
+
if (existsSync4(composePath)) {
|
|
2433
|
+
composeFileContent = readFileSync3(composePath, "utf-8");
|
|
2402
2434
|
logger.info(`Using project compose file: ${project.detectedConfig.composePath}`);
|
|
2403
2435
|
}
|
|
2404
2436
|
}
|