@layr-labs/ecloud-cli 0.4.0-dev.0 → 0.4.0-dev.2

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 (56) hide show
  1. package/VERSION +2 -0
  2. package/dist/commands/auth/whoami.js +1 -0
  3. package/dist/commands/auth/whoami.js.map +1 -1
  4. package/dist/commands/billing/__tests__/status.test.js +89 -22
  5. package/dist/commands/billing/__tests__/status.test.js.map +1 -1
  6. package/dist/commands/billing/__tests__/subscribe.test.js +88 -20
  7. package/dist/commands/billing/__tests__/subscribe.test.js.map +1 -1
  8. package/dist/commands/billing/__tests__/top-up.test.js +139 -201
  9. package/dist/commands/billing/__tests__/top-up.test.js.map +1 -1
  10. package/dist/commands/billing/cancel.js +88 -19
  11. package/dist/commands/billing/cancel.js.map +1 -1
  12. package/dist/commands/billing/status.js +89 -21
  13. package/dist/commands/billing/status.js.map +1 -1
  14. package/dist/commands/billing/subscribe.js +88 -19
  15. package/dist/commands/billing/subscribe.js.map +1 -1
  16. package/dist/commands/billing/top-up.js +102 -91
  17. package/dist/commands/billing/top-up.js.map +1 -1
  18. package/dist/commands/compute/app/create.js +1 -0
  19. package/dist/commands/compute/app/create.js.map +1 -1
  20. package/dist/commands/compute/app/deploy.js +38 -24
  21. package/dist/commands/compute/app/deploy.js.map +1 -1
  22. package/dist/commands/compute/app/info.js +2 -1
  23. package/dist/commands/compute/app/info.js.map +1 -1
  24. package/dist/commands/compute/app/list.js +2 -1
  25. package/dist/commands/compute/app/list.js.map +1 -1
  26. package/dist/commands/compute/app/logs.js +5 -8
  27. package/dist/commands/compute/app/logs.js.map +1 -1
  28. package/dist/commands/compute/app/profile/set.js +5 -8
  29. package/dist/commands/compute/app/profile/set.js.map +1 -1
  30. package/dist/commands/compute/app/releases.js +2 -1
  31. package/dist/commands/compute/app/releases.js.map +1 -1
  32. package/dist/commands/compute/app/start.js +5 -8
  33. package/dist/commands/compute/app/start.js.map +1 -1
  34. package/dist/commands/compute/app/stop.js +5 -8
  35. package/dist/commands/compute/app/stop.js.map +1 -1
  36. package/dist/commands/compute/app/terminate.js +5 -8
  37. package/dist/commands/compute/app/terminate.js.map +1 -1
  38. package/dist/commands/compute/app/upgrade.js +36 -14
  39. package/dist/commands/compute/app/upgrade.js.map +1 -1
  40. package/dist/commands/compute/build/info.js +9 -12
  41. package/dist/commands/compute/build/info.js.map +1 -1
  42. package/dist/commands/compute/build/list.js +9 -12
  43. package/dist/commands/compute/build/list.js.map +1 -1
  44. package/dist/commands/compute/build/logs.js +9 -12
  45. package/dist/commands/compute/build/logs.js.map +1 -1
  46. package/dist/commands/compute/build/status.js +9 -12
  47. package/dist/commands/compute/build/status.js.map +1 -1
  48. package/dist/commands/compute/build/submit.js +32 -10
  49. package/dist/commands/compute/build/submit.js.map +1 -1
  50. package/dist/commands/compute/build/verify.js +9 -12
  51. package/dist/commands/compute/build/verify.js.map +1 -1
  52. package/dist/commands/compute/environment/set.js +1 -0
  53. package/dist/commands/compute/environment/set.js.map +1 -1
  54. package/dist/commands/compute/undelegate.js +5 -8
  55. package/dist/commands/compute/undelegate.js.map +1 -1
  56. package/package.json +2 -2
@@ -305,13 +305,14 @@ function findAvailableName(environment, baseName) {
305
305
 
306
306
  // src/utils/version.ts
307
307
  function getCliVersion() {
308
- return true ? "0.4.0-dev.0" : "0.0.0";
308
+ return true ? "0.4.0-dev.2" : "0.0.0";
309
309
  }
310
310
  function getClientId() {
311
311
  return `ecloud-cli/v${getCliVersion()}`;
312
312
  }
313
313
 
314
314
  // src/utils/prompts.ts
315
+ import { execSync } from "child_process";
315
316
  async function getDockerfileInteractive(dockerfilePath) {
316
317
  if (dockerfilePath) {
317
318
  return dockerfilePath;
@@ -339,6 +340,30 @@ Found Dockerfile in ${cwd}`);
339
340
  throw new Error(`Unexpected choice: ${choice}`);
340
341
  }
341
342
  }
343
+ function detectGitRepoInfo() {
344
+ const git = (cmd) => execSync(cmd, { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }).trim();
345
+ const detectRepoUrl = () => {
346
+ try {
347
+ const remote = git("git remote get-url origin").replace(/^git@github\.com:(.+?)(?:\.git)?$/, "https://github.com/$1").replace(/\.git$/, "");
348
+ if (/^https:\/\/github\.com\/[^/]+\/[^/]+/.test(remote)) return remote;
349
+ } catch {
350
+ }
351
+ };
352
+ const detectCommitSha = () => {
353
+ try {
354
+ const branch = git("git rev-parse --abbrev-ref HEAD");
355
+ if (!branch || branch === "HEAD") return;
356
+ const lsRemote = git(`git ls-remote origin refs/heads/${branch}`);
357
+ return lsRemote.match(/^([0-9a-f]{40})\s/i)?.[1];
358
+ } catch {
359
+ }
360
+ };
361
+ try {
362
+ return { repoUrl: detectRepoUrl(), commitSha: detectCommitSha() };
363
+ } catch {
364
+ return {};
365
+ }
366
+ }
342
367
  async function promptUseVerifiableBuild() {
343
368
  return confirmWithDefault("Build from verifiable source?", false);
344
369
  }
@@ -352,9 +377,10 @@ async function promptVerifiableSourceType() {
352
377
  });
353
378
  }
354
379
  async function promptVerifiableGitSourceInputs() {
380
+ const detected = detectGitRepoInfo();
355
381
  const repoUrl = (await input({
356
382
  message: "Enter public git repository URL:",
357
- default: "",
383
+ default: detected.repoUrl ?? "",
358
384
  validate: (value) => {
359
385
  if (!value.trim()) return "Repository URL is required";
360
386
  try {
@@ -377,7 +403,7 @@ async function promptVerifiableGitSourceInputs() {
377
403
  })).trim();
378
404
  const gitRef = (await input({
379
405
  message: "Enter git commit SHA (40 hex chars):",
380
- default: "",
406
+ default: repoUrl === detected.repoUrl ? detected.commitSha ?? "" : "",
381
407
  validate: (value) => {
382
408
  const trimmed = value.trim();
383
409
  if (!trimmed) return "Commit SHA is required";
@@ -475,7 +501,7 @@ async function getCredentialsFromHelper(registry) {
475
501
  if (!credsStore) {
476
502
  return void 0;
477
503
  }
478
- const { execSync } = await import("child_process");
504
+ const { execSync: execSync2 } = await import("child_process");
479
505
  const helper = `docker-credential-${credsStore}`;
480
506
  try {
481
507
  const registryVariants = [];
@@ -492,7 +518,7 @@ async function getCredentialsFromHelper(registry) {
492
518
  }
493
519
  for (const variant of registryVariants) {
494
520
  try {
495
- const output = execSync(`echo "${variant}" | ${helper} get`, {
521
+ const output = execSync2(`echo "${variant}" | ${helper} get`, {
496
522
  encoding: "utf-8"
497
523
  });
498
524
  const creds = JSON.parse(output);
@@ -771,8 +797,8 @@ async function getEnvFileInteractive(envFilePath) {
771
797
  var SKU_TIER_NAMES = {
772
798
  "g1-micro-1v": "Starter 1",
773
799
  "g1-small-1v": "Starter 2",
774
- "g1-custom-2-4096s": "Growth 1",
775
- "g1-standard-2s": "Growth 2",
800
+ "g1-custom-2-4096s": "Pro 1",
801
+ "g1-standard-2s": "Pro 2",
776
802
  "g1-standard-4t": "Enterprise 1",
777
803
  "g1-standard-8t": "Enterprise 2"
778
804
  };
@@ -898,8 +924,8 @@ async function getPrivateKeyInteractive(privateKey) {
898
924
  }
899
925
  return privateKey;
900
926
  }
901
- const { getPrivateKeyWithSource: getPrivateKeyWithSource2 } = await import("@layr-labs/ecloud-sdk");
902
- const result = await getPrivateKeyWithSource2({ privateKey: void 0 });
927
+ const { getPrivateKeyWithSource } = await import("@layr-labs/ecloud-sdk");
928
+ const result = await getPrivateKeyWithSource({ privateKey: void 0 });
903
929
  if (result) {
904
930
  return result.key;
905
931
  }
@@ -1237,12 +1263,8 @@ import {
1237
1263
  createBillingModule,
1238
1264
  createBuildModule,
1239
1265
  getEnvironmentConfig as getEnvironmentConfig3,
1240
- requirePrivateKey,
1241
- getPrivateKeyWithSource,
1242
- addHexPrefix as addHexPrefix2
1266
+ requirePrivateKey
1243
1267
  } from "@layr-labs/ecloud-sdk";
1244
- import { createWalletClient, custom } from "viem";
1245
- import { privateKeyToAccount as privateKeyToAccount4 } from "viem/accounts";
1246
1268
  async function createComputeClient(flags) {
1247
1269
  flags = await validateCommonFlags(flags);
1248
1270
  const environment = flags.environment;
@@ -1521,13 +1543,6 @@ var AppDeploy = class _AppDeploy extends Command {
1521
1543
  options: ["enable", "disable"],
1522
1544
  env: "ECLOUD_RESOURCE_USAGE_MONITORING"
1523
1545
  }),
1524
- "bill-to": Flags2.string({
1525
- required: false,
1526
- description: "Billing mode: developer (default) or app (isolated billing)",
1527
- options: ["developer", "app"],
1528
- default: "developer",
1529
- env: "ECLOUD_BILL_TO"
1530
- }),
1531
1546
  website: Flags2.string({
1532
1547
  required: false,
1533
1548
  description: "App website URL (optional)"
@@ -1745,7 +1760,6 @@ var AppDeploy = class _AppDeploy extends Command {
1745
1760
  flags["resource-usage-monitoring"]
1746
1761
  );
1747
1762
  const logVisibility = logSettings.publicLogs ? "public" : logSettings.logRedirect ? "private" : "off";
1748
- const billTo = flags["bill-to"];
1749
1763
  const { prepared, gasEstimate } = isVerifiable ? await compute.app.prepareDeployFromVerifiableBuild({
1750
1764
  name: appName,
1751
1765
  imageRef,
@@ -1754,7 +1768,7 @@ var AppDeploy = class _AppDeploy extends Command {
1754
1768
  instanceType,
1755
1769
  logVisibility,
1756
1770
  resourceUsageMonitoring,
1757
- billTo
1771
+ billTo: "developer"
1758
1772
  }) : await compute.app.prepareDeploy({
1759
1773
  name: appName,
1760
1774
  dockerfile: dockerfilePath,
@@ -1763,7 +1777,7 @@ var AppDeploy = class _AppDeploy extends Command {
1763
1777
  instanceType,
1764
1778
  logVisibility,
1765
1779
  resourceUsageMonitoring,
1766
- billTo
1780
+ billTo: "developer"
1767
1781
  });
1768
1782
  this.log(`
1769
1783
  Estimated transaction cost: ${chalk2.cyan(gasEstimate.maxCostEth)} ETH`);