cloudburn 0.9.7 → 0.9.9
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 +4 -4
- package/dist/cli.js +45 -45
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -60,21 +60,21 @@ Use `discover` to run the same rules against live AWS resources.
|
|
|
60
60
|
|
|
61
61
|
Run `cloudburn discover init` first. It automatically configures AWS Resource Explorer indexes, which CloudBurn uses as its live service catalog before it evaluates rules.
|
|
62
62
|
|
|
63
|
-
By default, `cloudburn discover` runs against your active AWS region. You can pass `--region <region>` to target
|
|
63
|
+
By default, `cloudburn discover` runs against your active AWS region. You can pass `--region <region>` to target one explicit region.
|
|
64
64
|
|
|
65
65
|
```bash
|
|
66
66
|
cloudburn discover init
|
|
67
67
|
cloudburn discover
|
|
68
68
|
cloudburn discover --region eu-central-1
|
|
69
|
-
cloudburn discover --region all
|
|
70
69
|
cloudburn discover --config .cloudburn.yml --enabled-rules CLDBRN-AWS-EBS-1
|
|
71
70
|
cloudburn discover --service ec2,s3
|
|
72
|
-
cloudburn discover
|
|
71
|
+
cloudburn --debug discover --region eu-central-1
|
|
73
72
|
cloudburn rules list
|
|
74
73
|
cloudburn rules list --service ec2 --source discovery
|
|
75
74
|
```
|
|
76
75
|
|
|
77
|
-
|
|
76
|
+
The CLI targets one region per run. Multi-region discovery remains available through the SDK and still needs an AWS Resource Explorer aggregator plus an unfiltered default view in the aggregator region.
|
|
77
|
+
Use `--debug` to print SDK and provider execution tracing to `stderr` without changing the normal `stdout` format.
|
|
78
78
|
|
|
79
79
|
## Shell Completion
|
|
80
80
|
|
package/dist/cli.js
CHANGED
|
@@ -1023,9 +1023,24 @@ var registerConfigCommand = (program) => {
|
|
|
1023
1023
|
};
|
|
1024
1024
|
|
|
1025
1025
|
// src/commands/discover.ts
|
|
1026
|
-
import {
|
|
1026
|
+
import { assertSupportedAwsRegion, CloudBurnClient } from "@cloudburn/sdk";
|
|
1027
1027
|
import { InvalidArgumentError as InvalidArgumentError3 } from "commander";
|
|
1028
1028
|
|
|
1029
|
+
// src/debug.ts
|
|
1030
|
+
var isDebugEnabled = (command) => {
|
|
1031
|
+
const options = command.optsWithGlobals();
|
|
1032
|
+
return options.debug === true;
|
|
1033
|
+
};
|
|
1034
|
+
var resolveCliDebugLogger = (command) => {
|
|
1035
|
+
if (!isDebugEnabled(command)) {
|
|
1036
|
+
return void 0;
|
|
1037
|
+
}
|
|
1038
|
+
return (message) => {
|
|
1039
|
+
process.stderr.write(`[debug] ${message}
|
|
1040
|
+
`);
|
|
1041
|
+
};
|
|
1042
|
+
};
|
|
1043
|
+
|
|
1029
1044
|
// src/commands/config-options.ts
|
|
1030
1045
|
import { builtInRuleMetadata } from "@cloudburn/sdk";
|
|
1031
1046
|
import { InvalidArgumentError as InvalidArgumentError2 } from "commander";
|
|
@@ -1119,18 +1134,25 @@ var buildInitializationStatusData = (result, message, format) => {
|
|
|
1119
1134
|
};
|
|
1120
1135
|
var parseAwsRegion = (value) => {
|
|
1121
1136
|
try {
|
|
1122
|
-
return
|
|
1137
|
+
return assertSupportedAwsRegion(value);
|
|
1123
1138
|
} catch (err) {
|
|
1124
1139
|
throw new InvalidArgumentError3(err instanceof Error ? err.message : "Invalid AWS region.");
|
|
1125
1140
|
}
|
|
1126
1141
|
};
|
|
1127
|
-
var
|
|
1128
|
-
|
|
1129
|
-
|
|
1142
|
+
var resolveDiscoveryTarget = (region) => region === void 0 ? { mode: "current" } : { mode: "regions", regions: [region] };
|
|
1143
|
+
var resolveNestedRegionOption = (command, subcommandName) => {
|
|
1144
|
+
const rootCommand = command.parent?.parent;
|
|
1145
|
+
const rawArgs = rootCommand?.rawArgs ?? [];
|
|
1146
|
+
const subcommandIndex = rawArgs.lastIndexOf(subcommandName);
|
|
1147
|
+
if (subcommandIndex === -1) {
|
|
1148
|
+
return void 0;
|
|
1149
|
+
}
|
|
1150
|
+
const optionIndex = rawArgs.indexOf("--region", subcommandIndex + 1);
|
|
1151
|
+
if (optionIndex === -1 || optionIndex + 1 >= rawArgs.length) {
|
|
1152
|
+
return void 0;
|
|
1130
1153
|
}
|
|
1131
|
-
return
|
|
1154
|
+
return rawArgs[optionIndex + 1];
|
|
1132
1155
|
};
|
|
1133
|
-
var resolveDiscoveryTarget = (region) => region === void 0 ? { mode: "current" } : region === "all" ? { mode: "all" } : { mode: "region", region };
|
|
1134
1156
|
var toDiscoveryConfigOverride = (options) => {
|
|
1135
1157
|
if (options.enabledRules === void 0 && options.disabledRules === void 0 && options.service === void 0) {
|
|
1136
1158
|
return void 0;
|
|
@@ -1154,10 +1176,10 @@ var runCommand = async (action) => {
|
|
|
1154
1176
|
};
|
|
1155
1177
|
var registerDiscoverCommand = (program) => {
|
|
1156
1178
|
const discoverCommand = setCommandExamples(
|
|
1157
|
-
program.command("discover").description("Run a live AWS discovery").
|
|
1179
|
+
program.command("discover").description("Run a live AWS discovery").option(
|
|
1158
1180
|
"--region <region>",
|
|
1159
|
-
|
|
1160
|
-
|
|
1181
|
+
"AWS region to discover. Defaults to the current AWS region from AWS_REGION when omitted.",
|
|
1182
|
+
parseAwsRegion
|
|
1161
1183
|
).option("--config <path>", "Explicit CloudBurn config file to load").option(
|
|
1162
1184
|
"--enabled-rules <ruleIds>",
|
|
1163
1185
|
"Comma-separated rule IDs to enable. When set, CloudBurn checks only these rules. By default, all rules are enabled.",
|
|
@@ -1172,7 +1194,8 @@ var registerDiscoverCommand = (program) => {
|
|
|
1172
1194
|
parseDiscoveryServiceList
|
|
1173
1195
|
).option("--exit-code", "Exit with code 1 when findings exist").action(async (options, command) => {
|
|
1174
1196
|
await runCommand(async () => {
|
|
1175
|
-
const
|
|
1197
|
+
const debugLogger = resolveCliDebugLogger(command);
|
|
1198
|
+
const scanner = new CloudBurnClient({ debugLogger });
|
|
1176
1199
|
const configOverride = toDiscoveryConfigOverride(options);
|
|
1177
1200
|
const loadedConfig = await scanner.loadConfig(options.config);
|
|
1178
1201
|
const discoveryOptions = {
|
|
@@ -1198,18 +1221,15 @@ var registerDiscoverCommand = (program) => {
|
|
|
1198
1221
|
[
|
|
1199
1222
|
"cloudburn discover",
|
|
1200
1223
|
"cloudburn discover --region eu-central-1",
|
|
1201
|
-
"cloudburn discover --region all",
|
|
1202
1224
|
"cloudburn discover status",
|
|
1203
|
-
"cloudburn discover list-enabled-regions",
|
|
1204
1225
|
"cloudburn discover init"
|
|
1205
1226
|
]
|
|
1206
1227
|
);
|
|
1207
1228
|
discoverCommand.command("status").description("Show Resource Explorer status across all enabled AWS regions").action(async (_options, command) => {
|
|
1208
1229
|
await runCommand(async () => {
|
|
1209
|
-
const
|
|
1210
|
-
const
|
|
1211
|
-
const
|
|
1212
|
-
const status = await scanner.getDiscoveryStatus({ region });
|
|
1230
|
+
const debugLogger = resolveCliDebugLogger(command);
|
|
1231
|
+
const scanner = new CloudBurnClient({ debugLogger });
|
|
1232
|
+
const status = await scanner.getDiscoveryStatus({ region: void 0 });
|
|
1213
1233
|
const format = resolveOutputFormat(command);
|
|
1214
1234
|
const rows = format === "json" ? status.regions.map((regionStatus) => ({
|
|
1215
1235
|
...regionStatus,
|
|
@@ -1252,28 +1272,6 @@ var registerDiscoverCommand = (program) => {
|
|
|
1252
1272
|
format
|
|
1253
1273
|
);
|
|
1254
1274
|
process.stdout.write(`${output}
|
|
1255
|
-
`);
|
|
1256
|
-
return EXIT_CODE_OK;
|
|
1257
|
-
});
|
|
1258
|
-
});
|
|
1259
|
-
discoverCommand.command("list-enabled-regions").description("List AWS regions with a local or aggregator Resource Explorer index").action(async (_options, command) => {
|
|
1260
|
-
await runCommand(async () => {
|
|
1261
|
-
const scanner = new CloudBurnClient();
|
|
1262
|
-
const regions = await scanner.listEnabledDiscoveryRegions();
|
|
1263
|
-
const format = resolveOutputFormat(command);
|
|
1264
|
-
const output = renderResponse(
|
|
1265
|
-
{
|
|
1266
|
-
kind: "record-list",
|
|
1267
|
-
columns: [
|
|
1268
|
-
{ key: "region", header: "Region" },
|
|
1269
|
-
{ key: "type", header: "Type" }
|
|
1270
|
-
],
|
|
1271
|
-
emptyMessage: "No Resource Explorer indexes are enabled.",
|
|
1272
|
-
rows: regions
|
|
1273
|
-
},
|
|
1274
|
-
format
|
|
1275
|
-
);
|
|
1276
|
-
process.stdout.write(`${output}
|
|
1277
1275
|
`);
|
|
1278
1276
|
return EXIT_CODE_OK;
|
|
1279
1277
|
});
|
|
@@ -1284,9 +1282,9 @@ var registerDiscoverCommand = (program) => {
|
|
|
1284
1282
|
parseAwsRegion
|
|
1285
1283
|
).action(async (options, command) => {
|
|
1286
1284
|
await runCommand(async () => {
|
|
1287
|
-
const
|
|
1288
|
-
const
|
|
1289
|
-
const region = options.region ?? (
|
|
1285
|
+
const debugLogger = resolveCliDebugLogger(command);
|
|
1286
|
+
const scanner = new CloudBurnClient({ debugLogger });
|
|
1287
|
+
const region = options.region ?? resolveNestedRegionOption(command, "init");
|
|
1290
1288
|
const result = await scanner.initializeDiscovery({ region });
|
|
1291
1289
|
const message = describeInitializationMessage(result);
|
|
1292
1290
|
const format = resolveOutputFormat(command);
|
|
@@ -1304,7 +1302,8 @@ var registerDiscoverCommand = (program) => {
|
|
|
1304
1302
|
});
|
|
1305
1303
|
discoverCommand.command("supported-resource-types").description("List Resource Explorer supported AWS resource types").action(async (_options, command) => {
|
|
1306
1304
|
await runCommand(async () => {
|
|
1307
|
-
const
|
|
1305
|
+
const debugLogger = resolveCliDebugLogger(command);
|
|
1306
|
+
const scanner = new CloudBurnClient({ debugLogger });
|
|
1308
1307
|
const resourceTypes = await scanner.listSupportedDiscoveryResourceTypes();
|
|
1309
1308
|
const format = resolveOutputFormat(command);
|
|
1310
1309
|
const output = renderResponse(
|
|
@@ -1434,7 +1433,8 @@ var registerScanCommand = (program) => {
|
|
|
1434
1433
|
parseRuleIdList
|
|
1435
1434
|
).option("--service <services>", "Comma-separated services to include in the scan rule set.", parseIaCServiceList).option("--exit-code", "Exit with code 1 when findings exist").action(async (path, options, command) => {
|
|
1436
1435
|
try {
|
|
1437
|
-
const
|
|
1436
|
+
const debugLogger = resolveCliDebugLogger(command);
|
|
1437
|
+
const scanner = new CloudBurnClient2({ debugLogger });
|
|
1438
1438
|
const configOverride = toScanConfigOverride(options);
|
|
1439
1439
|
const loadedConfig = await scanner.loadConfig(options.config);
|
|
1440
1440
|
const scanPath = path ?? process.cwd();
|
|
@@ -1474,7 +1474,7 @@ var isCliEntrypoint = (moduleUrl, argvEntry = process.argv[1]) => {
|
|
|
1474
1474
|
};
|
|
1475
1475
|
var createProgram = () => {
|
|
1476
1476
|
const program = createCliCommand();
|
|
1477
|
-
program.name("cloudburn").usage("[command]").description("Know what you spend. Fix what you waste.").version("0.9.
|
|
1477
|
+
program.name("cloudburn").usage("[command]").description("Know what you spend. Fix what you waste.").version("0.9.9").option("--debug", "Write execution trace messages to stderr").option("--format <format>", OUTPUT_FORMAT_OPTION_DESCRIPTION, parseOutputFormat);
|
|
1478
1478
|
configureCliHelp(program);
|
|
1479
1479
|
registerCompletionCommand(program);
|
|
1480
1480
|
registerConfigCommand(program);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cloudburn",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.9",
|
|
4
4
|
"description": "Cloudburn CLI for cloud cost optimization",
|
|
5
5
|
"homepage": "https://cloudburn.io/docs",
|
|
6
6
|
"bugs": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"commander": "^13.1.0",
|
|
23
|
-
"@cloudburn/sdk": "0.
|
|
23
|
+
"@cloudburn/sdk": "0.21.1"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@biomejs/biome": "^2.4.6",
|