@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
@@ -312,7 +312,7 @@ function listApps(environment) {
312
312
 
313
313
  // src/utils/version.ts
314
314
  function getCliVersion() {
315
- return true ? "0.4.0-dev.0" : "0.0.0";
315
+ return true ? "0.4.0-dev.2" : "0.0.0";
316
316
  }
317
317
  function getClientId() {
318
318
  return `ecloud-cli/v${getCliVersion()}`;
@@ -335,6 +335,7 @@ async function getAppInfosChunked(userApiClient, appIds, addressCount) {
335
335
  }
336
336
 
337
337
  // src/utils/prompts.ts
338
+ import { execSync } from "child_process";
338
339
  function addHexPrefix2(value) {
339
340
  if (value.startsWith("0x")) {
340
341
  return value;
@@ -368,6 +369,30 @@ Found Dockerfile in ${cwd}`);
368
369
  throw new Error(`Unexpected choice: ${choice}`);
369
370
  }
370
371
  }
372
+ function detectGitRepoInfo() {
373
+ const git = (cmd) => execSync(cmd, { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }).trim();
374
+ const detectRepoUrl = () => {
375
+ try {
376
+ const remote = git("git remote get-url origin").replace(/^git@github\.com:(.+?)(?:\.git)?$/, "https://github.com/$1").replace(/\.git$/, "");
377
+ if (/^https:\/\/github\.com\/[^/]+\/[^/]+/.test(remote)) return remote;
378
+ } catch {
379
+ }
380
+ };
381
+ const detectCommitSha = () => {
382
+ try {
383
+ const branch = git("git rev-parse --abbrev-ref HEAD");
384
+ if (!branch || branch === "HEAD") return;
385
+ const lsRemote = git(`git ls-remote origin refs/heads/${branch}`);
386
+ return lsRemote.match(/^([0-9a-f]{40})\s/i)?.[1];
387
+ } catch {
388
+ }
389
+ };
390
+ try {
391
+ return { repoUrl: detectRepoUrl(), commitSha: detectCommitSha() };
392
+ } catch {
393
+ return {};
394
+ }
395
+ }
371
396
  async function promptUseVerifiableBuild() {
372
397
  return confirmWithDefault("Build from verifiable source?", false);
373
398
  }
@@ -381,9 +406,10 @@ async function promptVerifiableSourceType() {
381
406
  });
382
407
  }
383
408
  async function promptVerifiableGitSourceInputs() {
409
+ const detected = detectGitRepoInfo();
384
410
  const repoUrl = (await input({
385
411
  message: "Enter public git repository URL:",
386
- default: "",
412
+ default: detected.repoUrl ?? "",
387
413
  validate: (value) => {
388
414
  if (!value.trim()) return "Repository URL is required";
389
415
  try {
@@ -406,7 +432,7 @@ async function promptVerifiableGitSourceInputs() {
406
432
  })).trim();
407
433
  const gitRef = (await input({
408
434
  message: "Enter git commit SHA (40 hex chars):",
409
- default: "",
435
+ default: repoUrl === detected.repoUrl ? detected.commitSha ?? "" : "",
410
436
  validate: (value) => {
411
437
  const trimmed = value.trim();
412
438
  if (!trimmed) return "Commit SHA is required";
@@ -504,7 +530,7 @@ async function getCredentialsFromHelper(registry) {
504
530
  if (!credsStore) {
505
531
  return void 0;
506
532
  }
507
- const { execSync } = await import("child_process");
533
+ const { execSync: execSync2 } = await import("child_process");
508
534
  const helper = `docker-credential-${credsStore}`;
509
535
  try {
510
536
  const registryVariants = [];
@@ -521,7 +547,7 @@ async function getCredentialsFromHelper(registry) {
521
547
  }
522
548
  for (const variant of registryVariants) {
523
549
  try {
524
- const output = execSync(`echo "${variant}" | ${helper} get`, {
550
+ const output = execSync2(`echo "${variant}" | ${helper} get`, {
525
551
  encoding: "utf-8"
526
552
  });
527
553
  const creds = JSON.parse(output);
@@ -762,8 +788,8 @@ async function getEnvFileInteractive(envFilePath) {
762
788
  var SKU_TIER_NAMES = {
763
789
  "g1-micro-1v": "Starter 1",
764
790
  "g1-small-1v": "Starter 2",
765
- "g1-custom-2-4096s": "Growth 1",
766
- "g1-standard-2s": "Growth 2",
791
+ "g1-custom-2-4096s": "Pro 1",
792
+ "g1-standard-2s": "Pro 2",
767
793
  "g1-standard-4t": "Enterprise 1",
768
794
  "g1-standard-8t": "Enterprise 2"
769
795
  };
@@ -1191,8 +1217,8 @@ async function getPrivateKeyInteractive(privateKey) {
1191
1217
  }
1192
1218
  return privateKey;
1193
1219
  }
1194
- const { getPrivateKeyWithSource: getPrivateKeyWithSource2 } = await import("@layr-labs/ecloud-sdk");
1195
- const result = await getPrivateKeyWithSource2({ privateKey: void 0 });
1220
+ const { getPrivateKeyWithSource } = await import("@layr-labs/ecloud-sdk");
1221
+ const result = await getPrivateKeyWithSource({ privateKey: void 0 });
1196
1222
  if (result) {
1197
1223
  return result.key;
1198
1224
  }
@@ -1295,12 +1321,8 @@ import {
1295
1321
  createBillingModule,
1296
1322
  createBuildModule,
1297
1323
  getEnvironmentConfig as getEnvironmentConfig3,
1298
- requirePrivateKey,
1299
- getPrivateKeyWithSource,
1300
- addHexPrefix as addHexPrefix3
1324
+ requirePrivateKey
1301
1325
  } from "@layr-labs/ecloud-sdk";
1302
- import { createWalletClient, custom } from "viem";
1303
- import { privateKeyToAccount as privateKeyToAccount4 } from "viem/accounts";
1304
1326
  async function createComputeClient(flags) {
1305
1327
  flags = await validateCommonFlags(flags);
1306
1328
  const environment = flags.environment;