@jadenrazo/cloudcost-mcp 0.3.0 → 0.5.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.
@@ -43,9 +43,7 @@ var _gcpDiskPricing = null;
43
43
  var _regionPriceMultipliers = null;
44
44
  function getResourceEquivalents() {
45
45
  if (_resourceEquivalents === null) {
46
- _resourceEquivalents = loadJsonFile(
47
- "resource-equivalents.json"
48
- );
46
+ _resourceEquivalents = loadJsonFile("resource-equivalents.json");
49
47
  }
50
48
  return _resourceEquivalents;
51
49
  }
@@ -69,25 +67,19 @@ function getStorageMap() {
69
67
  }
70
68
  function getAwsInstances() {
71
69
  if (_awsInstances === null) {
72
- _awsInstances = loadJsonFile(
73
- "instance-types/aws-instances.json"
74
- );
70
+ _awsInstances = loadJsonFile("instance-types/aws-instances.json");
75
71
  }
76
72
  return _awsInstances;
77
73
  }
78
74
  function getAzureVmSizes() {
79
75
  if (_azureVmSizes === null) {
80
- _azureVmSizes = loadJsonFile(
81
- "instance-types/azure-vm-sizes.json"
82
- );
76
+ _azureVmSizes = loadJsonFile("instance-types/azure-vm-sizes.json");
83
77
  }
84
78
  return _azureVmSizes;
85
79
  }
86
80
  function getGcpMachineTypes() {
87
81
  if (_gcpMachineTypes === null) {
88
- _gcpMachineTypes = loadJsonFile(
89
- "instance-types/gcp-machine-types.json"
90
- );
82
+ _gcpMachineTypes = loadJsonFile("instance-types/gcp-machine-types.json");
91
83
  }
92
84
  return _gcpMachineTypes;
93
85
  }
@@ -125,9 +117,7 @@ function getGcpDiskPricing() {
125
117
  }
126
118
  function getRegionPriceMultipliers() {
127
119
  if (_regionPriceMultipliers === null) {
128
- _regionPriceMultipliers = loadJsonFile(
129
- "region-price-multipliers.json"
130
- );
120
+ _regionPriceMultipliers = loadJsonFile("region-price-multipliers.json");
131
121
  }
132
122
  return _regionPriceMultipliers;
133
123
  }
@@ -161,4 +151,4 @@ export {
161
151
  getRegionPriceMultipliers,
162
152
  _resetLoaderCache
163
153
  };
164
- //# sourceMappingURL=chunk-XDBTEI42.js.map
154
+ //# sourceMappingURL=chunk-TRRAOOVF.js.map
package/dist/cli.js CHANGED
@@ -9,8 +9,8 @@ import {
9
9
  loadConfig,
10
10
  optimizeCost,
11
11
  whatIf
12
- } from "./chunk-EI63JCAA.js";
13
- import "./chunk-XDBTEI42.js";
12
+ } from "./chunk-E7KOWAMW.js";
13
+ import "./chunk-TRRAOOVF.js";
14
14
 
15
15
  // src/cli.ts
16
16
  import { readFileSync, existsSync, statSync } from "fs";
@@ -103,7 +103,8 @@ function printText(data) {
103
103
  process.stdout.write(JSON.stringify(data, null, 2) + "\n");
104
104
  }
105
105
  function printUsage() {
106
- process.stdout.write(`
106
+ process.stdout.write(
107
+ `
107
108
  CloudCost \u2014 multi-cloud Terraform cost estimator
108
109
 
109
110
  Usage:
@@ -129,7 +130,8 @@ Examples:
129
130
  cloudcost optimize ./terraform --providers aws,gcp
130
131
  cloudcost estimate main.tf --provider gcp --json
131
132
  cloudcost what-if ./terraform --changes changes.json --provider aws
132
- `.trimStart());
133
+ `.trimStart()
134
+ );
133
135
  }
134
136
  async function runAnalyze(args, files, tfvars) {
135
137
  const result = await analyzeTerraform({ files, tfvars, include_dependencies: false });
@@ -234,9 +236,7 @@ async function runWhatIf(args, files, tfvars, pricingEngine, config) {
234
236
  } else if (parsedChanges !== null && typeof parsedChanges === "object" && "changes" in parsedChanges && Array.isArray(parsedChanges["changes"])) {
235
237
  changesArray = parsedChanges["changes"];
236
238
  } else {
237
- throw new Error(
238
- `Changes file must contain a JSON array or an object with a "changes" array`
239
- );
239
+ throw new Error(`Changes file must contain a JSON array or an object with a "changes" array`);
240
240
  }
241
241
  const changes = changesArray.map((item, index) => {
242
242
  if (item === null || typeof item !== "object") {
@@ -250,9 +250,7 @@ async function runWhatIf(args, files, tfvars, pricingEngine, config) {
250
250
  throw new Error(`Change at index ${index} is missing a valid "attribute"`);
251
251
  }
252
252
  if (typeof c["new_value"] !== "string" && typeof c["new_value"] !== "number") {
253
- throw new Error(
254
- `Change at index ${index} "new_value" must be a string or number`
255
- );
253
+ throw new Error(`Change at index ${index} "new_value" must be a string or number`);
256
254
  }
257
255
  return {
258
256
  resource_id: c["resource_id"],
@@ -304,8 +302,10 @@ async function main() {
304
302
  files = loadTerraformFiles(args.path);
305
303
  tfvars = loadTfvars(args.path);
306
304
  } catch (err) {
307
- process.stderr.write(`Error loading Terraform files: ${err instanceof Error ? err.message : String(err)}
308
- `);
305
+ process.stderr.write(
306
+ `Error loading Terraform files: ${err instanceof Error ? err.message : String(err)}
307
+ `
308
+ );
309
309
  process.exit(1);
310
310
  }
311
311
  const config = loadConfig();