@turboops/cli 1.0.0-dev.609 → 1.0.0-dev.611

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.
Files changed (2) hide show
  1. package/dist/index.js +91 -24
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -664,6 +664,12 @@ var apiClient = {
664
664
  async createStage(data) {
665
665
  return this.request("POST", "/deployment/stages/simple", data);
666
666
  },
667
+ /**
668
+ * Create a project token (for CI/CD)
669
+ */
670
+ async createProjectToken(data) {
671
+ return this.request("POST", "/deployment/tokens/simple", data);
672
+ },
667
673
  /**
668
674
  * Get deployment-ready servers
669
675
  */
@@ -1024,6 +1030,16 @@ async function requireAuth() {
1024
1030
  logger.error(`Invalid project token: ${error}`);
1025
1031
  process.exit(10 /* AUTH_ERROR */);
1026
1032
  }
1033
+ return;
1034
+ }
1035
+ const token = configService.getToken();
1036
+ if (token?.startsWith("turbo_cli_")) {
1037
+ const validation = await authService.checkCliToken();
1038
+ if (!validation.valid) {
1039
+ logger.error("Session expired or revoked. Please run `turbo login` to re-authenticate.");
1040
+ configService.clearToken();
1041
+ process.exit(10 /* AUTH_ERROR */);
1042
+ }
1027
1043
  }
1028
1044
  }
1029
1045
  async function requireProject() {
@@ -1542,6 +1558,35 @@ var initCommand = new Command3("init").description("Initialize TurboOps project
1542
1558
  process.exit(10 /* AUTH_ERROR */);
1543
1559
  }
1544
1560
  logger.success(`Angemeldet als ${result.user?.email || "Unknown"}`);
1561
+ } else {
1562
+ const validation = await authService.checkCliToken();
1563
+ if (!validation.valid) {
1564
+ logger.warning("Ihre Sitzung ist abgelaufen oder wurde widerrufen.");
1565
+ logger.info("Bitte melden Sie sich erneut an mit: turbo login");
1566
+ logger.newline();
1567
+ configService.clearToken();
1568
+ const { shouldLogin } = await prompts2({
1569
+ initial: true,
1570
+ message: "M\xF6chten Sie sich jetzt neu anmelden?",
1571
+ name: "shouldLogin",
1572
+ type: "confirm"
1573
+ });
1574
+ if (!shouldLogin) {
1575
+ addJsonData({ initialized: false, reason: "session_expired" });
1576
+ return;
1577
+ }
1578
+ const result = await authService.browserLogin();
1579
+ if (!result.success) {
1580
+ logger.error(`Anmeldung fehlgeschlagen: ${result.error || "Unbekannter Fehler"}`);
1581
+ addJsonData({
1582
+ error: result.error || "Unknown error",
1583
+ initialized: false,
1584
+ reason: "login_failed"
1585
+ });
1586
+ process.exit(10 /* AUTH_ERROR */);
1587
+ }
1588
+ logger.success(`Angemeldet als ${result.user?.email || "Unknown"}`);
1589
+ }
1545
1590
  }
1546
1591
  logger.newline();
1547
1592
  const { projectSlug } = await prompts2({
@@ -1667,6 +1712,18 @@ async function createNewProject(slug, verbose = false) {
1667
1712
  process.exit(13 /* API_ERROR */);
1668
1713
  }
1669
1714
  logger.success(`Projekt "${newProject.name}" wurde erstellt!`);
1715
+ if (newProject.projectToken) {
1716
+ logger.newline();
1717
+ logger.header("CI/CD Projekt-Token");
1718
+ console.log(chalk5.yellow.bold(" WICHTIG: Diesen Token jetzt kopieren - er wird nur einmal angezeigt!"));
1719
+ logger.newline();
1720
+ console.log(chalk5.cyan(" Token: ") + chalk5.green.bold(newProject.projectToken));
1721
+ logger.newline();
1722
+ console.log(chalk5.dim(" Diesen Token als CI/CD Secret hinterlegen:"));
1723
+ console.log(chalk5.dim(" \u2192 GitLab: Settings \u2192 CI/CD \u2192 Variables \u2192 TURBOOPS_TOKEN"));
1724
+ console.log(chalk5.dim(" \u2192 GitHub: Settings \u2192 Secrets \u2192 Actions \u2192 TURBOOPS_TOKEN"));
1725
+ logger.newline();
1726
+ }
1670
1727
  configService.setProject(newProject.slug);
1671
1728
  logger.newline();
1672
1729
  const { shouldCreateStage } = await prompts2({
@@ -1838,30 +1895,40 @@ async function showFinalSummary(project) {
1838
1895
  console.log(` ${chalk5.bold(env.slug)} - ${env.name} (${env.type})`);
1839
1896
  }
1840
1897
  }
1841
- logger.newline();
1842
- logger.header("CI/CD Token einrichten");
1843
- console.log(chalk5.cyan(" 1. Projekt-Token erstellen:"));
1844
- console.log(` ${chalk5.dim("\u2192")} TurboOps Web-UI \xF6ffnen`);
1845
- console.log(` ${chalk5.dim("\u2192")} Projekt "${project.name}" ausw\xE4hlen`);
1846
- console.log(` ${chalk5.dim("\u2192")} Settings \u2192 Tokens \u2192 "Neuer Token"`);
1847
- logger.newline();
1848
- console.log(chalk5.cyan(" 2. Token als CI/CD Secret hinterlegen:"));
1849
- console.log(chalk5.dim(" GitLab:"));
1850
- console.log(` ${chalk5.dim("\u2192")} Settings \u2192 CI/CD \u2192 Variables`);
1851
- console.log(` ${chalk5.dim("\u2192")} Variable: ${chalk5.bold("TURBOOPS_TOKEN")} = <dein-token>`);
1852
- console.log(` ${chalk5.dim("\u2192")} Flags: Protected, Masked`);
1853
- logger.newline();
1854
- console.log(chalk5.dim(" GitHub:"));
1855
- console.log(` ${chalk5.dim("\u2192")} Settings \u2192 Secrets and variables \u2192 Actions`);
1856
- console.log(` ${chalk5.dim("\u2192")} New repository secret: ${chalk5.bold("TURBOOPS_TOKEN")}`);
1857
- logger.newline();
1858
- logger.header("N\xE4chste Schritte");
1859
- logger.list([
1860
- "Projekt-Token in TurboOps erstellen (siehe oben)",
1861
- "Token als CI/CD Secret hinterlegen",
1862
- "Pipeline committen und pushen",
1863
- "`turbo status` ausf\xFChren um Deployments zu pr\xFCfen"
1864
- ]);
1898
+ if (project.projectToken) {
1899
+ logger.newline();
1900
+ logger.header("N\xE4chste Schritte");
1901
+ logger.list([
1902
+ `Token als CI/CD Secret hinterlegen (${chalk5.bold("TURBOOPS_TOKEN")})`,
1903
+ "Pipeline committen und pushen",
1904
+ "`turbo status` ausf\xFChren um Deployments zu pr\xFCfen"
1905
+ ]);
1906
+ } else {
1907
+ logger.newline();
1908
+ logger.header("CI/CD Token einrichten");
1909
+ console.log(chalk5.cyan(" 1. Projekt-Token erstellen:"));
1910
+ console.log(` ${chalk5.dim("\u2192")} TurboOps Web-UI \xF6ffnen`);
1911
+ console.log(` ${chalk5.dim("\u2192")} Projekt "${project.name}" ausw\xE4hlen`);
1912
+ console.log(` ${chalk5.dim("\u2192")} Settings \u2192 Tokens \u2192 "Neuer Token"`);
1913
+ logger.newline();
1914
+ console.log(chalk5.cyan(" 2. Token als CI/CD Secret hinterlegen:"));
1915
+ console.log(chalk5.dim(" GitLab:"));
1916
+ console.log(` ${chalk5.dim("\u2192")} Settings \u2192 CI/CD \u2192 Variables`);
1917
+ console.log(` ${chalk5.dim("\u2192")} Variable: ${chalk5.bold("TURBOOPS_TOKEN")} = <dein-token>`);
1918
+ console.log(` ${chalk5.dim("\u2192")} Flags: Protected, Masked`);
1919
+ logger.newline();
1920
+ console.log(chalk5.dim(" GitHub:"));
1921
+ console.log(` ${chalk5.dim("\u2192")} Settings \u2192 Secrets and variables \u2192 Actions`);
1922
+ console.log(` ${chalk5.dim("\u2192")} New repository secret: ${chalk5.bold("TURBOOPS_TOKEN")}`);
1923
+ logger.newline();
1924
+ logger.header("N\xE4chste Schritte");
1925
+ logger.list([
1926
+ "Projekt-Token in TurboOps erstellen (siehe oben)",
1927
+ "Token als CI/CD Secret hinterlegen",
1928
+ "Pipeline committen und pushen",
1929
+ "`turbo status` ausf\xFChren um Deployments zu pr\xFCfen"
1930
+ ]);
1931
+ }
1865
1932
  }
1866
1933
  async function offerAiAssistance(projectSlug, projectId, verbose = false) {
1867
1934
  const detection = await detectProjectConfig();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@turboops/cli",
3
- "version": "1.0.0-dev.609",
3
+ "version": "1.0.0-dev.611",
4
4
  "description": "TurboCLI - Command line interface for TurboOps deployments",
5
5
  "author": "lenne.tech GmbH",
6
6
  "license": "MIT",