@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.
- package/README.md +5 -0
- package/dist/{App-5ITWBHXF.js → App-G6ACKT3M.js} +800 -521
- package/dist/{Banner-4PWWKMRZ.js → Banner-UIKOHSAV.js} +2 -2
- package/dist/{Onboarding-4N4WIORR.js → Onboarding-QUB2SCWP.js} +2 -2
- package/dist/{chunk-CJWMEKKP.js → chunk-5BLEZWMN.js} +19 -4
- package/dist/{chunk-LDDHLUZH.js → chunk-DLACXFC6.js} +71 -4
- package/dist/{chunk-Q5D5HYWW.js → chunk-LVR2XXJK.js} +1 -1
- package/dist/{chunk-32EP3DJT.js → chunk-Y6LNVH7K.js} +1 -1
- package/dist/cli.js +271 -62
- package/dist/{dist-AGQQPJUD.js → dist-AS6Z6RQQ.js} +1 -1
- package/package.json +2 -2
- package/sbom.spdx.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CLI_VERSION
|
|
3
|
-
} from "./chunk-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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 --
|
|
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) => {
|