@turboops/cli 1.0.85-dev.1426 → 1.0.85

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 +55 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -194,7 +194,7 @@ function getPackageName() {
194
194
  }
195
195
 
196
196
  // src/services/config.ts
197
- var BUILD_ENV = true ? "dev" : void 0;
197
+ var BUILD_ENV = true ? "prod" : void 0;
198
198
  var API_URLS = {
199
199
  local: "http://localhost:3000",
200
200
  dev: "https://api.dev.turbo-ops.de",
@@ -753,6 +753,19 @@ var apiClient = {
753
753
  async getDeploymentStatus(deploymentId) {
754
754
  return this.request("GET", `/project/deployment/status/${deploymentId}`);
755
755
  },
756
+ /**
757
+ * Get container logs for a stage (Project Token endpoint for CI/CD)
758
+ */
759
+ async getContainerLogs(stageId, options) {
760
+ const params = new URLSearchParams();
761
+ if (options?.lines) params.set("lines", String(options.lines));
762
+ if (options?.service) params.set("service", options.service);
763
+ const query = params.toString();
764
+ return this.request(
765
+ "GET",
766
+ `/project/deployment/container-logs/${stageId}${query ? `?${query}` : ""}`
767
+ );
768
+ },
756
769
  /**
757
770
  * Wait for deployment to complete
758
771
  */
@@ -2725,6 +2738,7 @@ var deployCommand = new Command4("deploy").description("Trigger a deployment (fo
2725
2738
  if (finalStatus.errorMessage) {
2726
2739
  logger.error(`Error: ${finalStatus.errorMessage}`);
2727
2740
  }
2741
+ await printContainerLogs(env.id);
2728
2742
  process.exit(1 /* ERROR */);
2729
2743
  } else {
2730
2744
  logger.newline();
@@ -2742,6 +2756,46 @@ var deployCommand = new Command4("deploy").description("Trigger a deployment (fo
2742
2756
  process.exit(1 /* ERROR */);
2743
2757
  }
2744
2758
  });
2759
+ async function printContainerLogs(stageId) {
2760
+ try {
2761
+ const { data, error } = await apiClient.getContainerLogs(stageId, {
2762
+ lines: 50
2763
+ });
2764
+ if (error || !data?.logs?.length) {
2765
+ return;
2766
+ }
2767
+ logger.newline();
2768
+ logger.info(chalk6.bold("Container Logs (last 50 lines):"));
2769
+ logger.info(chalk6.dim("\u2500".repeat(80)));
2770
+ for (const log of data.logs) {
2771
+ const time = new Date(log.timestamp).toLocaleTimeString();
2772
+ const levelColor = getLogLevelColor(log.level);
2773
+ const container = log.container ? chalk6.dim(`[${log.container}]`) : "";
2774
+ if (!isJsonMode()) {
2775
+ console.log(
2776
+ ` ${chalk6.dim(time)} ${levelColor(log.level.padEnd(5))} ${container} ${log.message}`
2777
+ );
2778
+ }
2779
+ }
2780
+ logger.info(chalk6.dim("\u2500".repeat(80)));
2781
+ } catch {
2782
+ }
2783
+ }
2784
+ function getLogLevelColor(level) {
2785
+ switch (level.toLowerCase()) {
2786
+ case "error":
2787
+ case "fatal":
2788
+ return chalk6.red;
2789
+ case "warn":
2790
+ case "warning":
2791
+ return chalk6.yellow;
2792
+ case "debug":
2793
+ case "trace":
2794
+ return chalk6.dim;
2795
+ default:
2796
+ return chalk6.blue;
2797
+ }
2798
+ }
2745
2799
  function getStatusColor2(status) {
2746
2800
  switch (status) {
2747
2801
  case "running":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@turboops/cli",
3
- "version": "1.0.85-dev.1426",
3
+ "version": "1.0.85",
4
4
  "description": "TurboCLI - Command line interface for TurboOps deployments",
5
5
  "keywords": [
6
6
  "cli",