cloudburn 0.2.0 → 0.3.1

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/cli.js +10 -32
  2. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -53,6 +53,7 @@ var registerRulesListCommand = (program) => {
53
53
 
54
54
  // src/commands/scan.ts
55
55
  import { CloudBurnScanner } from "@cloudburn/sdk";
56
+ import { InvalidArgumentError } from "commander";
56
57
 
57
58
  // src/exit-codes.ts
58
59
  var EXIT_CODE_OK = 0;
@@ -61,35 +62,6 @@ var EXIT_CODE_POLICY_VIOLATION = 1;
61
62
  // src/formatters/json.ts
62
63
  var formatJson = (result) => JSON.stringify(result, null, 2);
63
64
 
64
- // src/formatters/markdown.ts
65
- var formatLocation = (finding) => finding.location ? `${finding.location.path}:${finding.location.startLine}:${finding.location.startColumn}` : "";
66
- var formatMarkdown = (result) => {
67
- if (result.providers.length === 0) {
68
- return "## CloudBurn Findings\n\nNo findings.";
69
- }
70
- const sections = result.providers.flatMap((providerGroup) => {
71
- const providerSections = [`### ${providerGroup.provider}`];
72
- for (const ruleGroup of providerGroup.rules) {
73
- const hasLocations = ruleGroup.findings.some((finding) => finding.location);
74
- const rows = ruleGroup.findings.map(
75
- (finding) => hasLocations ? `| ${ruleGroup.source} | ${ruleGroup.service} | ${finding.resourceId} | ${ruleGroup.message} | ${formatLocation(finding)} |` : `| ${ruleGroup.source} | ${ruleGroup.service} | ${finding.resourceId} | ${ruleGroup.message} |`
76
- ).join("\n");
77
- providerSections.push(`#### ${ruleGroup.ruleId}`);
78
- providerSections.push(
79
- hasLocations ? `| Source | Service | Resource | Message | Location |
80
- | --- | --- | --- | --- | --- |
81
- ${rows}` : `| Source | Service | Resource | Message |
82
- | --- | --- | --- | --- |
83
- ${rows}`
84
- );
85
- }
86
- return providerSections;
87
- });
88
- return `## CloudBurn Findings
89
-
90
- ${sections.join("\n\n")}`;
91
- };
92
-
93
65
  // src/formatters/shared.ts
94
66
  var flattenScanResult = (result) => result.providers.flatMap(
95
67
  (providerGroup) => providerGroup.rules.flatMap(
@@ -163,17 +135,23 @@ var formatTable = (result) => {
163
135
  };
164
136
 
165
137
  // src/commands/scan.ts
138
+ var supportedScanFormats = ["table", "json", "sarif"];
139
+ var parseScanFormat = (value) => {
140
+ if (supportedScanFormats.includes(value)) {
141
+ return value;
142
+ }
143
+ throw new InvalidArgumentError(`Invalid format "${value}". Allowed formats: ${supportedScanFormats.join(", ")}.`);
144
+ };
166
145
  var formatters = {
167
146
  json: formatJson,
168
- markdown: formatMarkdown,
169
147
  sarif: formatSarif,
170
148
  table: formatTable
171
149
  };
172
150
  var registerScanCommand = (program) => {
173
- program.command("scan [path]").description("Run static IaC scan or live AWS scan").option("--live", "Run live AWS scan").option("--format <format>", "Output format: table|json|markdown|sarif", "table").option("--exit-code", "Exit with code 1 when findings exist").action(async (path, options) => {
151
+ program.command("scan [path]").description("Run static IaC scan or live AWS scan").option("--live", "Run live AWS scan").option("--format <format>", "Output format: table|json|sarif", parseScanFormat, "table").option("--exit-code", "Exit with code 1 when findings exist").action(async (path, options) => {
174
152
  const scanner = new CloudBurnScanner();
175
153
  const result = options.live ? await scanner.scanLive() : await scanner.scanStatic(path ?? process.cwd());
176
- const format = formatters[options.format ?? "table"] ?? formatTable;
154
+ const format = formatters[options.format ?? "table"];
177
155
  const output = format(result);
178
156
  process.stdout.write(`${output}
179
157
  `);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloudburn",
3
- "version": "0.2.0",
3
+ "version": "0.3.1",
4
4
  "description": "Cloudburn CLI for cloud cost optimization",
5
5
  "type": "module",
6
6
  "bin": {
@@ -11,7 +11,7 @@
11
11
  ],
12
12
  "dependencies": {
13
13
  "commander": "^13.1.0",
14
- "@cloudburn/sdk": "0.4.0"
14
+ "@cloudburn/sdk": "0.6.0"
15
15
  },
16
16
  "devDependencies": {
17
17
  "@biomejs/biome": "^2.4.6",