@layr-labs/ecloud-cli 0.3.4-dev → 0.4.0-dev

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 (48) hide show
  1. package/VERSION +2 -2
  2. package/dist/commands/auth/whoami.js +1 -0
  3. package/dist/commands/auth/whoami.js.map +1 -1
  4. package/dist/commands/billing/cancel.js +8 -7
  5. package/dist/commands/billing/cancel.js.map +1 -1
  6. package/dist/commands/billing/status.js +20 -19
  7. package/dist/commands/billing/status.js.map +1 -1
  8. package/dist/commands/billing/subscribe.js +13 -12
  9. package/dist/commands/billing/subscribe.js.map +1 -1
  10. package/dist/commands/compute/app/create.js +1 -0
  11. package/dist/commands/compute/app/create.js.map +1 -1
  12. package/dist/commands/compute/app/deploy.js +50 -21
  13. package/dist/commands/compute/app/deploy.js.map +1 -1
  14. package/dist/commands/compute/app/info.js +32 -31
  15. package/dist/commands/compute/app/info.js.map +1 -1
  16. package/dist/commands/compute/app/list.js +31 -30
  17. package/dist/commands/compute/app/list.js.map +1 -1
  18. package/dist/commands/compute/app/logs.js +2 -1
  19. package/dist/commands/compute/app/logs.js.map +1 -1
  20. package/dist/commands/compute/app/profile/set.js +6 -5
  21. package/dist/commands/compute/app/profile/set.js.map +1 -1
  22. package/dist/commands/compute/app/releases.js +18 -17
  23. package/dist/commands/compute/app/releases.js.map +1 -1
  24. package/dist/commands/compute/app/start.js +6 -5
  25. package/dist/commands/compute/app/start.js.map +1 -1
  26. package/dist/commands/compute/app/stop.js +6 -5
  27. package/dist/commands/compute/app/stop.js.map +1 -1
  28. package/dist/commands/compute/app/terminate.js +6 -5
  29. package/dist/commands/compute/app/terminate.js.map +1 -1
  30. package/dist/commands/compute/app/upgrade.js +51 -22
  31. package/dist/commands/compute/app/upgrade.js.map +1 -1
  32. package/dist/commands/compute/build/info.js +16 -15
  33. package/dist/commands/compute/build/info.js.map +1 -1
  34. package/dist/commands/compute/build/list.js +13 -12
  35. package/dist/commands/compute/build/list.js.map +1 -1
  36. package/dist/commands/compute/build/logs.js +4 -3
  37. package/dist/commands/compute/build/logs.js.map +1 -1
  38. package/dist/commands/compute/build/status.js +9 -8
  39. package/dist/commands/compute/build/status.js.map +1 -1
  40. package/dist/commands/compute/build/submit.js +16 -15
  41. package/dist/commands/compute/build/submit.js.map +1 -1
  42. package/dist/commands/compute/build/verify.js +10 -9
  43. package/dist/commands/compute/build/verify.js.map +1 -1
  44. package/dist/commands/compute/environment/set.js +1 -0
  45. package/dist/commands/compute/environment/set.js.map +1 -1
  46. package/dist/commands/compute/undelegate.js +6 -5
  47. package/dist/commands/compute/undelegate.js.map +1 -1
  48. package/package.json +2 -2
@@ -205,6 +205,7 @@ import { getBuildType as getBuildType3 } from "@layr-labs/ecloud-sdk";
205
205
 
206
206
  // src/utils/prompts.ts
207
207
  import { input, select, password, confirm as inquirerConfirm } from "@inquirer/prompts";
208
+ import chalk from "chalk";
208
209
  import fs3 from "fs";
209
210
  import path3 from "path";
210
211
  import os3 from "os";
@@ -311,7 +312,7 @@ function listApps(environment) {
311
312
 
312
313
  // src/utils/version.ts
313
314
  function getCliVersion() {
314
- return true ? "0.3.4-dev" : "0.0.0";
315
+ return true ? "0.4.0-dev" : "0.0.0";
315
316
  }
316
317
  function getClientId() {
317
318
  return `ecloud-cli/v${getCliVersion()}`;
@@ -758,6 +759,30 @@ async function getEnvFileInteractive(envFilePath) {
758
759
  throw new Error(`Unexpected choice: ${choice}`);
759
760
  }
760
761
  }
762
+ var SKU_TIER_NAMES = {
763
+ "g1-micro-1v": "Starter 1",
764
+ "g1-small-1v": "Starter 2",
765
+ "g1-custom-2-4096s": "Growth 1",
766
+ "g1-standard-2s": "Growth 2",
767
+ "g1-standard-4t": "Enterprise 1",
768
+ "g1-standard-8t": "Enterprise 2"
769
+ };
770
+ function formatSkuChoice(it) {
771
+ if (it.vcpus != null && it.memory_mb != null && it.monthly_price_usd != null && it.hourly_price_usd != null) {
772
+ const tier = SKU_TIER_NAMES[it.sku] ?? it.sku;
773
+ const isShared = it.description.toLowerCase().includes("shared");
774
+ const vcpuLabel = isShared ? `Shared ${it.vcpus} vCPU` : `${it.vcpus} vCPU`;
775
+ const memLabel = it.memory_mb >= 1024 ? `${it.memory_mb / 1024} GB` : `${it.memory_mb} MB`;
776
+ const specs = `${vcpuLabel} + ${memLabel}`;
777
+ const pricing = `$${it.hourly_price_usd.toFixed(2)}/hr ($${it.monthly_price_usd.toFixed(2)}/mo)`;
778
+ const platform = it.platform ?? "";
779
+ const tierPad = tier.padEnd(14);
780
+ const specsPad = specs.padEnd(22);
781
+ const platformPad = platform.padEnd(20);
782
+ return `${tierPad} ${specsPad} ${platformPad} ${pricing}`.trimEnd();
783
+ }
784
+ return `${it.sku} - ${it.description}`;
785
+ }
761
786
  async function getInstanceTypeInteractive(instanceType, defaultSKU, availableTypes) {
762
787
  if (instanceType) {
763
788
  const valid = availableTypes.find((t) => t.sku === instanceType);
@@ -768,19 +793,22 @@ async function getInstanceTypeInteractive(instanceType, defaultSKU, availableTyp
768
793
  throw new Error(`Invalid instance-type: ${instanceType} (must be one of: ${validSKUs})`);
769
794
  }
770
795
  const isCurrentType = defaultSKU !== "";
771
- if (defaultSKU === "" && availableTypes.length > 0) {
772
- defaultSKU = availableTypes[0].sku;
796
+ const hasPricing = availableTypes.some((t) => t.monthly_price_usd != null);
797
+ if (hasPricing) {
798
+ console.log("\nPay for what you use \u2014 no upfront costs, per-hour billing.\n");
799
+ console.log(` ${chalk.bold("Shielded VM (vTPM)")}: Verified boot and runtime attestation.`);
800
+ console.log(` ${chalk.bold("SEV-SNP (TEE)")}: Verified boot, runtime attestation, and hardware-encrypted memory (AMD).`);
801
+ console.log(` ${chalk.bold("TDX (TEE)")}: Verified boot, runtime attestation, and hardware-encrypted memory (Intel).
802
+ `);
773
803
  }
774
804
  if (isCurrentType && defaultSKU) {
775
- console.log(`
776
- Select instance type (current: ${defaultSKU}):`);
777
- } else {
778
- console.log("\nSelect instance type:");
805
+ console.log(`Current instance type: ${defaultSKU}
806
+ `);
779
807
  }
780
808
  const choices = availableTypes.map((it) => {
781
- let name = `${it.sku} - ${it.description}`;
782
- if (it.sku === defaultSKU) {
783
- name += isCurrentType ? " (current)" : " (default)";
809
+ let name = formatSkuChoice(it);
810
+ if (isCurrentType && it.sku === defaultSKU) {
811
+ name += " (current)";
784
812
  }
785
813
  return { name, value: it.sku };
786
814
  });
@@ -1323,7 +1351,7 @@ async function createBuildClient(flags) {
1323
1351
  }
1324
1352
 
1325
1353
  // src/commands/compute/app/upgrade.ts
1326
- import chalk from "chalk";
1354
+ import chalk2 from "chalk";
1327
1355
 
1328
1356
  // src/utils/build.ts
1329
1357
  function formatSourceLink(repoUrl, gitRef) {
@@ -1538,7 +1566,7 @@ var AppUpgrade = class _AppUpgrade extends Command {
1538
1566
  }),
1539
1567
  "instance-type": Flags2.string({
1540
1568
  required: false,
1541
- description: "Machine instance type to use e.g. g1-standard-4t, g1-standard-8t",
1569
+ description: "Machine instance type (e.g., g1-standard-4t, g1-standard-2s, g1-micro-1v)",
1542
1570
  env: "ECLOUD_INSTANCE_TYPE"
1543
1571
  }),
1544
1572
  "resource-usage-monitoring": Flags2.string({
@@ -1655,7 +1683,7 @@ var AppUpgrade = class _AppUpgrade extends Command {
1655
1683
  if (includeTlsCaddyfile && !inputs.caddyfilePath) {
1656
1684
  inputs.caddyfilePath = "Caddyfile";
1657
1685
  }
1658
- this.log(chalk.blue("Building from source with verifiable build..."));
1686
+ this.log(chalk2.blue("Building from source with verifiable build..."));
1659
1687
  this.log("");
1660
1688
  const buildClient2 = await getBuildClient();
1661
1689
  const { build, verified } = await runVerifiableBuildAndVerify(buildClient2, inputs, {
@@ -1687,7 +1715,7 @@ var AppUpgrade = class _AppUpgrade extends Command {
1687
1715
  } catch (e) {
1688
1716
  this.error(e?.message || String(e));
1689
1717
  }
1690
- this.log(chalk.blue("Resolving and verifying prebuilt verifiable image..."));
1718
+ this.log(chalk2.blue("Resolving and verifying prebuilt verifiable image..."));
1691
1719
  this.log("");
1692
1720
  const digest = await resolveDockerHubImageDigest(imageRef2);
1693
1721
  const buildClient2 = await getBuildClient();
@@ -1719,7 +1747,7 @@ var AppUpgrade = class _AppUpgrade extends Command {
1719
1747
  const { publicClient, walletClient } = createViemClients({
1720
1748
  privateKey,
1721
1749
  rpcUrl,
1722
- environment: environmentConfig.name
1750
+ environment
1723
1751
  });
1724
1752
  const userApiClient = new UserApiClient3(
1725
1753
  environmentConfig,
@@ -1734,6 +1762,7 @@ var AppUpgrade = class _AppUpgrade extends Command {
1734
1762
  } catch {
1735
1763
  }
1736
1764
  const availableTypes = await fetchAvailableInstanceTypes(
1765
+ environment,
1737
1766
  environmentConfig,
1738
1767
  privateKey,
1739
1768
  rpcUrl
@@ -1766,12 +1795,12 @@ var AppUpgrade = class _AppUpgrade extends Command {
1766
1795
  resourceUsageMonitoring
1767
1796
  });
1768
1797
  this.log(`
1769
- Estimated transaction cost: ${chalk.cyan(gasEstimate.maxCostEth)} ETH`);
1798
+ Estimated transaction cost: ${chalk2.cyan(gasEstimate.maxCostEth)} ETH`);
1770
1799
  if (isMainnet(environmentConfig)) {
1771
1800
  const confirmed = await confirm(`Continue with upgrade?`);
1772
1801
  if (!confirmed) {
1773
1802
  this.log(`
1774
- ${chalk.gray(`Upgrade cancelled`)}`);
1803
+ ${chalk2.gray(`Upgrade cancelled`)}`);
1775
1804
  return;
1776
1805
  }
1777
1806
  }
@@ -1785,20 +1814,20 @@ ${chalk.gray(`Upgrade cancelled`)}`);
1785
1814
  }
1786
1815
  this.log(
1787
1816
  `
1788
- \u2705 ${chalk.green(`App upgraded successfully ${chalk.bold(`(id: ${res.appId}, image: ${res.imageRef})`)}`)}`
1817
+ \u2705 ${chalk2.green(`App upgraded successfully ${chalk2.bold(`(id: ${res.appId}, image: ${res.imageRef})`)}`)}`
1789
1818
  );
1790
1819
  const dashboardUrl = getDashboardUrl(environment, res.appId);
1791
1820
  this.log(`
1792
- ${chalk.gray("View your app:")} ${chalk.blue.underline(dashboardUrl)}`);
1821
+ ${chalk2.gray("View your app:")} ${chalk2.blue.underline(dashboardUrl)}`);
1793
1822
  });
1794
1823
  }
1795
1824
  };
1796
- async function fetchAvailableInstanceTypes(environmentConfig, privateKey, rpcUrl) {
1825
+ async function fetchAvailableInstanceTypes(environment, environmentConfig, privateKey, rpcUrl) {
1797
1826
  try {
1798
1827
  const { publicClient, walletClient } = createViemClients({
1799
1828
  privateKey,
1800
1829
  rpcUrl,
1801
- environment: environmentConfig.name
1830
+ environment
1802
1831
  });
1803
1832
  const userApiClient = new UserApiClient3(environmentConfig, walletClient, publicClient, { clientId: getClientId() });
1804
1833
  const skuList = await userApiClient.getSKUs();
@@ -1808,7 +1837,7 @@ async function fetchAvailableInstanceTypes(environmentConfig, privateKey, rpcUrl
1808
1837
  return skuList.skus;
1809
1838
  } catch (err) {
1810
1839
  console.warn(`Failed to fetch instance types: ${err.message}`);
1811
- return [{ sku: "g1-standard-4t", description: "Standard 4-thread instance" }];
1840
+ return [{ sku: "g1-standard-4t", description: "4 vCPUs, 16 GB memory, TDX" }];
1812
1841
  }
1813
1842
  }
1814
1843
  export {