@ganakailabs/cloudeval-cli 0.26.2 → 0.26.4

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.
@@ -38,10 +38,10 @@ import {
38
38
  } from "./chunk-3MIP274G.js";
39
39
  import {
40
40
  Banner
41
- } from "./chunk-QZTBYLF7.js";
41
+ } from "./chunk-HEJJ6LSM.js";
42
42
  import {
43
43
  CLI_VERSION
44
- } from "./chunk-25ILWQUX.js";
44
+ } from "./chunk-AJJXSTOE.js";
45
45
  import {
46
46
  raisedButtonStyle,
47
47
  terminalTheme
@@ -3,8 +3,8 @@ import {
3
3
  bannerMetaColor,
4
4
  bannerSegmentColor,
5
5
  splitBannerLineSegments
6
- } from "./chunk-QZTBYLF7.js";
7
- import "./chunk-25ILWQUX.js";
6
+ } from "./chunk-HEJJ6LSM.js";
7
+ import "./chunk-AJJXSTOE.js";
8
8
  import "./chunk-ZDKRIOMB.js";
9
9
  export {
10
10
  Banner,
@@ -1,5 +1,5 @@
1
1
  // src/version.ts
2
- var CLI_VERSION = "0.26.2";
2
+ var CLI_VERSION = "0.26.4";
3
3
 
4
4
  export {
5
5
  CLI_VERSION
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  CLI_VERSION
3
- } from "./chunk-25ILWQUX.js";
3
+ } from "./chunk-AJJXSTOE.js";
4
4
  import {
5
5
  shouldUseColor,
6
6
  terminalTheme
package/dist/cli.js CHANGED
@@ -36,7 +36,7 @@ import {
36
36
  } from "./chunk-3MIP274G.js";
37
37
  import {
38
38
  CLI_VERSION
39
- } from "./chunk-25ILWQUX.js";
39
+ } from "./chunk-AJJXSTOE.js";
40
40
 
41
41
  // src/runtime/prepareInk.ts
42
42
  import fs from "fs";
@@ -1188,6 +1188,7 @@ var completeCliWords = (words) => {
1188
1188
  };
1189
1189
 
1190
1190
  // src/outputFormatter.ts
1191
+ import { once } from "events";
1191
1192
  var showSensitiveIdsByDefault = false;
1192
1193
  var SENSITIVE_IDENTIFIER_KEYS = /* @__PURE__ */ new Set([
1193
1194
  "accountid",
@@ -1456,13 +1457,18 @@ ${JSON.stringify(data, null, 2)}
1456
1457
  }
1457
1458
  return formatTextRecord(data);
1458
1459
  };
1460
+ var writeTextToStream = async (stream, text) => {
1461
+ if (!stream.write(text)) {
1462
+ await once(stream, "drain");
1463
+ }
1464
+ };
1459
1465
  var writeFormattedOutput = async (input) => {
1460
1466
  const text = formatOutput(input);
1461
1467
  if (input.output) {
1462
1468
  await writePrivateOutputFile(input.output, text);
1463
1469
  return;
1464
1470
  }
1465
- process.stdout.write(text);
1471
+ await writeTextToStream(process.stdout, text);
1466
1472
  };
1467
1473
  var writePrivateOutputFile = async (output, text) => {
1468
1474
  const fs14 = await import("fs/promises");
@@ -2474,6 +2480,23 @@ var entriesAsNamedRecords = (value, amountKey = "amount") => {
2474
2480
  [amountKey]: amount
2475
2481
  }));
2476
2482
  };
2483
+ var displayNumber = (value, fallback = "not available") => {
2484
+ const number = numberFrom(value);
2485
+ return number === void 0 ? fallback : String(number);
2486
+ };
2487
+ var formatMoney = (amount, currency, fallback = "not available") => {
2488
+ if (amount === void 0) {
2489
+ return fallback;
2490
+ }
2491
+ return [amount, currency].filter(Boolean).join(" ");
2492
+ };
2493
+ var formatValidation = (validation) => {
2494
+ const policyFailed = displayNumber(
2495
+ validation?.policyChecks?.failed ?? validation?.psRule?.failed
2496
+ );
2497
+ const unitFailed = displayNumber(validation?.unitTests?.failed);
2498
+ return `Policy checks ${policyFailed} failed, unit tests ${unitFailed} failed`;
2499
+ };
2477
2500
  var extractPillars = (waf) => {
2478
2501
  const fromArray = waf?.parsed?.score?.pillars;
2479
2502
  if (Array.isArray(fromArray)) {
@@ -2532,6 +2555,12 @@ var extractValidation = ({
2532
2555
  failed: numberFrom(psRuleSummary?.failed_rules, psRuleSummary?.failedRules, failedRules.length),
2533
2556
  errors: numberFrom(psRuleSummary?.error_rules, psRuleSummary?.errorRules)
2534
2557
  },
2558
+ policyChecks: {
2559
+ total: numberFrom(psRuleSummary?.total_rules, psRuleSummary?.totalRules, rules.length),
2560
+ passed: numberFrom(psRuleSummary?.passed_rules, psRuleSummary?.passedRules),
2561
+ failed: numberFrom(psRuleSummary?.failed_rules, psRuleSummary?.failedRules, failedRules.length),
2562
+ errors: numberFrom(psRuleSummary?.error_rules, psRuleSummary?.errorRules)
2563
+ },
2535
2564
  unitTests: {
2536
2565
  status: unitSummary?.status,
2537
2566
  total: numberFrom(unitSummary?.total_tests, unitSummary?.totalTests),
@@ -2568,16 +2597,26 @@ var evaluateGate = ({
2568
2597
  cost?.report?.processed?.totalMonthlyCost,
2569
2598
  cost?.parsed?.totalSpend?.amount,
2570
2599
  cost?.parsed?.total_spend?.amount,
2571
- cost?.raw?.total
2600
+ cost?.raw?.total,
2601
+ preload?.reports?.cost?.metrics?.monthly_cost,
2602
+ preload?.reports?.cost?.metrics?.monthlyCost,
2603
+ preload?.latest_payloads?.cost?.summary?.monthly_cost,
2604
+ preload?.latest_payloads?.cost?.summary?.monthlyCost,
2605
+ preload?.latest_payloads?.cost?.summary?.total_monthly_cost,
2606
+ preload?.latest_payloads?.cost?.summary?.totalMonthlyCost
2572
2607
  );
2573
2608
  const currency = String(
2574
- cost?.report?.metadata?.currency ?? cost?.parsed?.totalSpend?.currency ?? cost?.parsed?.total_spend?.currency ?? cost?.raw?.currency ?? ""
2609
+ cost?.report?.metadata?.currency ?? cost?.parsed?.totalSpend?.currency ?? cost?.parsed?.total_spend?.currency ?? cost?.raw?.currency ?? preload?.reports?.cost?.metrics?.currency ?? preload?.latest_payloads?.cost?.summary?.currency ?? ""
2575
2610
  ) || void 0;
2576
2611
  const savings = numberFrom(
2577
2612
  cost?.report?.processed?.opportunity_summary?.total_monthly_savings,
2578
2613
  cost?.report?.processed?.opportunitySummary?.totalMonthlySavings,
2579
2614
  cost?.parsed?.estimatedSavings?.amount,
2580
- cost?.parsed?.estimated_savings?.amount
2615
+ cost?.parsed?.estimated_savings?.amount,
2616
+ preload?.reports?.cost?.metrics?.estimated_savings,
2617
+ preload?.reports?.cost?.metrics?.estimatedSavings,
2618
+ preload?.latest_payloads?.cost?.summary?.estimated_savings,
2619
+ preload?.latest_payloads?.cost?.summary?.estimatedSavings
2581
2620
  );
2582
2621
  const pillars = extractPillars(waf).map((pillar) => {
2583
2622
  const threshold = gateConfig?.pillarScoreMins[pillar.id] ?? gateConfig?.pillarScoreMin;
@@ -2647,7 +2686,7 @@ var evaluateGate = ({
2647
2686
  const failedUnitTests = validation.unitTests.failed ?? 0;
2648
2687
  if (gateConfig.failOnValidationErrors && (failedPsRules > 0 || failedUnitTests > 0)) {
2649
2688
  failures.push(
2650
- `validation has ${failedPsRules} failed PSRule checks and ${failedUnitTests} failed unit tests`
2689
+ `validation has ${failedPsRules} failed policy checks and ${failedUnitTests} failed unit tests`
2651
2690
  );
2652
2691
  }
2653
2692
  if (gateConfig.maxMonthlyCost !== void 0 && monthlyCost !== void 0 && monthlyCost > gateConfig.maxMonthlyCost) {
@@ -2832,8 +2871,8 @@ var buildAiSummaryPrompt = (data) => [
2832
2871
  `Gate: ${String(data.gate?.status ?? "unknown").toUpperCase()}`,
2833
2872
  `Well-Architected score: ${data.gate?.wellArchitected?.overall?.score ?? data.gate?.overallScore ?? "unknown"}`,
2834
2873
  `High-risk findings: ${data.gate?.wellArchitected?.risks?.high ?? data.gate?.highRisk ?? "unknown"}`,
2835
- `Monthly cost: ${data.gate?.cost?.monthly?.amount ?? data.gate?.monthlyCost ?? "unknown"}`,
2836
- `Validation: PSRule failed ${data.gate?.validation?.psRule?.failed ?? "unknown"}, unit tests failed ${data.gate?.validation?.unitTests?.failed ?? "unknown"}`,
2874
+ `Monthly cost: ${formatMoney(data.gate?.cost?.monthly?.amount ?? data.gate?.monthlyCost, data.gate?.cost?.monthly?.currency)}`,
2875
+ `Validation: ${formatValidation(data.gate?.validation)}`,
2837
2876
  Array.isArray(data.gate?.failures) && data.gate.failures.length ? `Gate failures: ${data.gate.failures.join("; ")}` : "Gate failures: none reported"
2838
2877
  ].join("\n");
2839
2878
  var generateAiSummary = async ({
@@ -2909,8 +2948,8 @@ var buildMarkdownSummary = (data) => {
2909
2948
  `- **Commit:** \`${String(data.commitSha ?? "unknown").slice(0, 12)}\``,
2910
2949
  `- **Gate:** ${gateStatus}`,
2911
2950
  `- **Well-Architected score:** ${score}`,
2912
- `- **Cost:** ${cost?.amount ?? "unknown"} ${cost?.currency ?? ""}`.trim(),
2913
- `- **Validation:** PSRule ${validation?.psRule?.failed ?? "unknown"} failed, unit tests ${validation?.unitTests?.failed ?? "unknown"} failed`
2951
+ `- **Cost:** ${formatMoney(cost?.amount, cost?.currency)}`,
2952
+ `- **Validation:** ${formatValidation(validation)}`
2914
2953
  ];
2915
2954
  if (Array.isArray(data.gate?.failures) && data.gate.failures.length) {
2916
2955
  lines.push("", "#### Gate failures", "", ...data.gate.failures.map((failure) => `- ${failure}`));
@@ -2923,7 +2962,7 @@ var buildMarkdownSummary = (data) => {
2923
2962
  "",
2924
2963
  "#### Cost drilldown",
2925
2964
  "",
2926
- `- Cost: ${cost?.amount ?? "unknown"} ${cost?.currency ?? ""}${cost?.threshold !== void 0 ? ` (max ${cost.threshold})` : ""}`.trim()
2965
+ `- Cost: ${formatMoney(cost?.amount, cost?.currency)}${cost?.threshold !== void 0 ? ` (max ${cost.threshold})` : ""}`
2927
2966
  );
2928
2967
  }
2929
2968
  if (validation) {
@@ -2931,7 +2970,7 @@ var buildMarkdownSummary = (data) => {
2931
2970
  "",
2932
2971
  "#### Validation drilldown",
2933
2972
  "",
2934
- `- Validation: PSRule ${validation.psRule?.failed ?? "unknown"} failed, unit tests ${validation.unitTests?.failed ?? "unknown"} failed`
2973
+ `- Validation: ${formatValidation(validation)}`
2935
2974
  );
2936
2975
  }
2937
2976
  if (data.aiSummary?.markdown) {
@@ -14928,7 +14967,7 @@ program.command("tui").description("Open the CloudEval Terminal UI").option(
14928
14967
  const { assertSecureBaseUrl } = await import("./dist-QLN52XKY.js");
14929
14968
  const [{ render }, { App }] = await Promise.all([
14930
14969
  import("ink"),
14931
- import("./App-RTGF4RMI.js")
14970
+ import("./App-SM7XELZQ.js")
14932
14971
  ]);
14933
14972
  const baseUrl = await resolveBaseUrl(options, command);
14934
14973
  assertSecureBaseUrl(baseUrl);
@@ -14986,7 +15025,7 @@ program.command("chat").description("Start an interactive chat session").option(
14986
15025
  const { assertSecureBaseUrl } = await import("./dist-QLN52XKY.js");
14987
15026
  const [{ render }, { App }] = await Promise.all([
14988
15027
  import("ink"),
14989
- import("./App-RTGF4RMI.js")
15028
+ import("./App-SM7XELZQ.js")
14990
15029
  ]);
14991
15030
  const baseUrl = await resolveBaseUrl(options, command);
14992
15031
  assertSecureBaseUrl(baseUrl);
@@ -15740,7 +15779,7 @@ Error: ${errorMsg}
15740
15779
  program.command("banner").description("Preview the startup banner and terminal capabilities").action(async () => {
15741
15780
  const { render } = await import("ink");
15742
15781
  const BannerPreview = React.lazy(async () => ({
15743
- default: (await import("./Banner-H2UMEBYX.js")).Banner
15782
+ default: (await import("./Banner-T3BVRZV3.js")).Banner
15744
15783
  }));
15745
15784
  render(
15746
15785
  /* @__PURE__ */ jsx(React.Suspense, { fallback: null, children: /* @__PURE__ */ jsx(BannerPreview, { disable: false }) })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ganakailabs/cloudeval-cli",
3
- "version": "0.26.2",
3
+ "version": "0.26.4",
4
4
  "license": "LicenseRef-CloudEval-CLI",
5
5
  "type": "module",
6
6
  "description": "CloudEval CLI for cloud architecture, cost, report, automation, and MCP workflows.",
package/sbom.spdx.json CHANGED
@@ -14,7 +14,7 @@
14
14
  {
15
15
  "SPDXID": "SPDXRef-Package-CloudEval-CLI",
16
16
  "name": "CloudEval CLI",
17
- "versionInfo": "0.26.2",
17
+ "versionInfo": "0.26.4",
18
18
  "downloadLocation": "https://github.com/ganakailabs/cloudeval-cli",
19
19
  "filesAnalyzed": false,
20
20
  "licenseConcluded": "LicenseRef-CloudEval-CLI",