@ganakailabs/cloudeval-cli 0.21.2 → 0.23.0

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.
@@ -3,8 +3,8 @@ import {
3
3
  bannerMetaColor,
4
4
  bannerSegmentColor,
5
5
  splitBannerLineSegments
6
- } from "./chunk-CJWMEKKP.js";
7
- import "./chunk-32EP3DJT.js";
6
+ } from "./chunk-5BLEZWMN.js";
7
+ import "./chunk-Y6LNVH7K.js";
8
8
  import "./chunk-ZDKRIOMB.js";
9
9
  export {
10
10
  Banner,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  Onboarding
3
- } from "./chunk-Q5D5HYWW.js";
4
- import "./chunk-LDDHLUZH.js";
3
+ } from "./chunk-LVR2XXJK.js";
4
+ import "./chunk-DLACXFC6.js";
5
5
  import "./chunk-ZDKRIOMB.js";
6
6
  export {
7
7
  Onboarding
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  CLI_VERSION
3
- } from "./chunk-32EP3DJT.js";
3
+ } from "./chunk-Y6LNVH7K.js";
4
4
  import {
5
5
  shouldUseColor,
6
6
  terminalTheme
@@ -81,9 +81,20 @@ var BannerArtLine = ({ line, lineIndex, totalLines }) => /* @__PURE__ */ jsx(Tex
81
81
  },
82
82
  `${index}-${segment.text}`
83
83
  )) });
84
+ var BannerDetailText = ({ line }) => /* @__PURE__ */ jsx(Text, { wrap: "truncate", children: line.segments.map((segment, index) => /* @__PURE__ */ jsx(
85
+ Text,
86
+ {
87
+ color: segment.color,
88
+ dimColor: segment.dimColor,
89
+ bold: segment.bold,
90
+ children: segment.text
91
+ },
92
+ `${line.key}-${index}`
93
+ )) });
84
94
  var Banner = ({
85
95
  disable = false,
86
96
  details = [],
97
+ detailLines = [],
87
98
  terminalColumns
88
99
  }) => {
89
100
  if (disable) return null;
@@ -91,7 +102,11 @@ var Banner = ({
91
102
  const art = wordArt;
92
103
  const width = artWidth(art);
93
104
  const showArt = columns >= width;
94
- const showDetailsBesideArt = showArt && details.length > 0 && columns >= width + 42;
105
+ const resolvedDetailLines = detailLines.length > 0 ? detailLines : details.map((detail, index) => ({
106
+ key: `legacy-${index}`,
107
+ segments: [{ text: detail, dimColor: true }]
108
+ }));
109
+ const showDetailsBesideArt = showArt && resolvedDetailLines.length > 0 && columns >= width + 42;
95
110
  const version = process.env.CLOUDEVAL_CLI_VERSION ?? CLI_VERSION;
96
111
  return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", alignItems: "flex-start", marginBottom: 1, children: [
97
112
  showArt ? /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -111,7 +126,7 @@ var Banner = ({
111
126
  "CLI v",
112
127
  version
113
128
  ] }),
114
- details.map((detail) => /* @__PURE__ */ jsx(Text, { dimColor: true, wrap: "truncate", children: detail }, detail))
129
+ resolvedDetailLines.map((line) => /* @__PURE__ */ jsx(BannerDetailText, { line }, line.key))
115
130
  ] }) : null
116
131
  ] })
117
132
  ] }) : null,
@@ -120,7 +135,7 @@ var Banner = ({
120
135
  "CLI v",
121
136
  version
122
137
  ] }),
123
- details.map((detail) => /* @__PURE__ */ jsx(Text, { dimColor: true, wrap: "truncate", children: detail }, detail))
138
+ resolvedDetailLines.map((line) => /* @__PURE__ */ jsx(BannerDetailText, { line }, line.key))
124
139
  ] }) : null
125
140
  ] });
126
141
  };
@@ -3257,8 +3257,11 @@ var buildQuickProjectPayload = (input) => {
3257
3257
  if (!providerValues.has(provider)) {
3258
3258
  throw new Error(`Unsupported cloud provider '${provider}'.`);
3259
3259
  }
3260
+ if (input.cloudSync && provider !== "azure") {
3261
+ throw new Error("Cloud sync project creation currently supports Azure only.");
3262
+ }
3260
3263
  const name = input.name?.trim() || inferred?.suggestedName || "Quick Project";
3261
- const description = input.description?.trim() || inferred?.suggestedDescription || `Template project for ${name}`;
3264
+ const description = input.description?.trim() || inferred?.suggestedDescription || (input.cloudSync ? `Cloud sync project for ${name}` : `Template project for ${name}`);
3262
3265
  const connection = {
3263
3266
  user_id: input.userId,
3264
3267
  name: `${name} Connection`,
@@ -3302,6 +3305,45 @@ var responseJson = async (response, label) => {
3302
3305
  return await response.json();
3303
3306
  };
3304
3307
  var appendConnectionBody = (payload, input) => {
3308
+ if (input.cloudSync) {
3309
+ return JSON.stringify({
3310
+ ...payload,
3311
+ subscription_id: input.cloudSync.subscriptionId,
3312
+ target_resource_groups: input.cloudSync.resourceGroups ?? [],
3313
+ credentials: {
3314
+ tenant_id: input.cloudSync.tenantId,
3315
+ client_id: input.cloudSync.clientId,
3316
+ client_secret: input.cloudSync.clientSecret,
3317
+ subscription_id: input.cloudSync.subscriptionId
3318
+ }
3319
+ });
3320
+ }
3321
+ if (input.workspaceFiles?.length) {
3322
+ const entryPath = input.workspaceEntry || input.workspaceFiles[0]?.path;
3323
+ const entry = input.workspaceFiles.find((file) => file.path === entryPath);
3324
+ if (!entry) {
3325
+ throw new Error(`Workspace entry file '${entryPath}' was not found.`);
3326
+ }
3327
+ const formData2 = new FormData();
3328
+ formData2.append("user_id", payload.user_id);
3329
+ formData2.append("name", payload.name);
3330
+ formData2.append("cloud_provider", payload.cloud_provider);
3331
+ formData2.append("description", payload.description);
3332
+ formData2.append("type", payload.type);
3333
+ formData2.append("auto_sync", String(payload.auto_sync ?? true));
3334
+ formData2.append("visualization_source_path", entry.path);
3335
+ formData2.append("template_file", entry.blob, entry.path);
3336
+ const workspaceFilePaths = [];
3337
+ for (const file of input.workspaceFiles) {
3338
+ if (file.path === entry.path) {
3339
+ continue;
3340
+ }
3341
+ workspaceFilePaths.push(file.path);
3342
+ formData2.append("workspace_files", file.blob, file.path);
3343
+ }
3344
+ formData2.append("workspace_file_paths", JSON.stringify(workspaceFilePaths));
3345
+ return formData2;
3346
+ }
3305
3347
  if (!input.templateFile && !input.parametersFile) {
3306
3348
  return JSON.stringify(payload);
3307
3349
  }
@@ -3339,10 +3381,16 @@ var headersForBody = (authToken, body) => {
3339
3381
  return getCLIHeaders(authToken);
3340
3382
  };
3341
3383
  var createQuickProject = async (input) => {
3342
- if (!input.templateUrl && !input.templateFile) {
3343
- throw new Error("Provide --template-url or --template-file.");
3384
+ if (!input.templateUrl && !input.templateFile && !input.workspaceFiles?.length && !input.cloudSync) {
3385
+ throw new Error("Provide --template-url, --template-file, --workspace-dir, or --cloud-sync.");
3344
3386
  }
3345
3387
  const built = buildQuickProjectPayload(input);
3388
+ if (input.cloudSync) {
3389
+ built.connection.type = "sync";
3390
+ built.connection.auto_sync = true;
3391
+ built.project.type = "sync";
3392
+ built.project.report_config.include_cost_forecast = true;
3393
+ }
3346
3394
  const apiBase = normalizeApiBase(input.baseUrl);
3347
3395
  const connectionBody = appendConnectionBody(built.connection, input);
3348
3396
  const connection = await responseJson(
@@ -3369,12 +3417,31 @@ var createQuickProject = async (input) => {
3369
3417
  }),
3370
3418
  "Project creation"
3371
3419
  );
3420
+ let iacPipeline;
3421
+ if (input.workspaceFiles?.length) {
3422
+ iacPipeline = await responseJson(
3423
+ await fetch(
3424
+ `${apiBase}/projects/${encodeURIComponent(String(project.id))}/iac/pipeline?user_id=${encodeURIComponent(input.userId)}`,
3425
+ {
3426
+ method: "POST",
3427
+ headers: withIdempotencyHeader(getCLIHeaders(input.authToken)),
3428
+ body: JSON.stringify({
3429
+ import_request: { source: "connection", connection_id: connectionId },
3430
+ resolve: true,
3431
+ refresh_analysis: true
3432
+ })
3433
+ }
3434
+ ),
3435
+ "IaC pipeline"
3436
+ );
3437
+ }
3372
3438
  return {
3373
3439
  project,
3374
3440
  connection,
3375
3441
  syncStatus: connection.sync_status ?? connection.sync_job ?? null,
3376
3442
  normalizedTemplateUrl: built.normalizedTemplateUrl,
3377
- inferred: built.inferred
3443
+ inferred: built.inferred,
3444
+ iacPipeline
3378
3445
  };
3379
3446
  };
3380
3447
  var listConnections = async (options) => {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  completeOnboarding
3
- } from "./chunk-LDDHLUZH.js";
3
+ } from "./chunk-DLACXFC6.js";
4
4
  import {
5
5
  terminalTheme
6
6
  } from "./chunk-ZDKRIOMB.js";
@@ -1,5 +1,5 @@
1
1
  // src/version.ts
2
- var CLI_VERSION = "0.21.2";
2
+ var CLI_VERSION = "0.23.0";
3
3
 
4
4
  export {
5
5
  CLI_VERSION