@layr-labs/ecloud-cli 0.2.0-dev.2 → 0.2.0-dev.3

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 (58) hide show
  1. package/VERSION +2 -2
  2. package/dist/commands/auth/generate.js +2 -2
  3. package/dist/commands/auth/generate.js.map +1 -1
  4. package/dist/commands/auth/login.js.map +1 -1
  5. package/dist/commands/auth/logout.js.map +1 -1
  6. package/dist/commands/auth/migrate.js.map +1 -1
  7. package/dist/commands/auth/whoami.js +5 -3
  8. package/dist/commands/auth/whoami.js.map +1 -1
  9. package/dist/commands/billing/cancel.js +6 -3
  10. package/dist/commands/billing/cancel.js.map +1 -1
  11. package/dist/commands/billing/status.js +6 -3
  12. package/dist/commands/billing/status.js.map +1 -1
  13. package/dist/commands/billing/subscribe.js +12 -7
  14. package/dist/commands/billing/subscribe.js.map +1 -1
  15. package/dist/commands/compute/app/create.js.map +1 -1
  16. package/dist/commands/compute/app/deploy.js +614 -86
  17. package/dist/commands/compute/app/deploy.js.map +1 -1
  18. package/dist/commands/compute/app/info.js +59 -10
  19. package/dist/commands/compute/app/info.js.map +1 -1
  20. package/dist/commands/compute/app/list.js +10 -9
  21. package/dist/commands/compute/app/list.js.map +1 -1
  22. package/dist/commands/compute/app/logs.js +61 -11
  23. package/dist/commands/compute/app/logs.js.map +1 -1
  24. package/dist/commands/compute/app/profile/set.js +145 -20
  25. package/dist/commands/compute/app/profile/set.js.map +1 -1
  26. package/dist/commands/compute/app/releases.js +1111 -0
  27. package/dist/commands/compute/app/releases.js.map +1 -0
  28. package/dist/commands/compute/app/start.js +61 -11
  29. package/dist/commands/compute/app/start.js.map +1 -1
  30. package/dist/commands/compute/app/stop.js +61 -11
  31. package/dist/commands/compute/app/stop.js.map +1 -1
  32. package/dist/commands/compute/app/terminate.js +61 -11
  33. package/dist/commands/compute/app/terminate.js.map +1 -1
  34. package/dist/commands/compute/app/upgrade.js +615 -52
  35. package/dist/commands/compute/app/upgrade.js.map +1 -1
  36. package/dist/commands/compute/build/info.js +500 -0
  37. package/dist/commands/compute/build/info.js.map +1 -0
  38. package/dist/commands/compute/build/list.js +494 -0
  39. package/dist/commands/compute/build/list.js.map +1 -0
  40. package/dist/commands/compute/build/logs.js +459 -0
  41. package/dist/commands/compute/build/logs.js.map +1 -0
  42. package/dist/commands/compute/build/status.js +481 -0
  43. package/dist/commands/compute/build/status.js.map +1 -0
  44. package/dist/commands/compute/build/submit.js +618 -0
  45. package/dist/commands/compute/build/submit.js.map +1 -0
  46. package/dist/commands/compute/build/verify.js +439 -0
  47. package/dist/commands/compute/build/verify.js.map +1 -0
  48. package/dist/commands/compute/environment/list.js.map +1 -1
  49. package/dist/commands/compute/environment/set.js.map +1 -1
  50. package/dist/commands/compute/environment/show.js.map +1 -1
  51. package/dist/commands/compute/undelegate.js +11 -9
  52. package/dist/commands/compute/undelegate.js.map +1 -1
  53. package/dist/commands/telemetry/disable.js.map +1 -1
  54. package/dist/commands/telemetry/enable.js.map +1 -1
  55. package/dist/commands/telemetry/status.js.map +1 -1
  56. package/dist/commands/upgrade.js.map +1 -1
  57. package/dist/commands/version.js.map +1 -1
  58. package/package.json +7 -2
@@ -11,6 +11,7 @@ import {
11
11
 
12
12
  // src/flags.ts
13
13
  import { Flags } from "@oclif/core";
14
+ import { getBuildType as getBuildType2 } from "@layr-labs/ecloud-sdk";
14
15
 
15
16
  // src/utils/prompts.ts
16
17
  import { input, select, password, confirm as inquirerConfirm } from "@inquirer/prompts";
@@ -92,6 +93,27 @@ function saveGlobalConfig(config) {
92
93
  const content = dumpYaml(config, { lineWidth: -1 });
93
94
  fs.writeFileSync(configPath, content, { mode: 420 });
94
95
  }
96
+ function normalizeDirectoryPath(directoryPath) {
97
+ const resolved = path.resolve(directoryPath);
98
+ try {
99
+ return fs.realpathSync(resolved);
100
+ } catch {
101
+ return resolved;
102
+ }
103
+ }
104
+ function getLinkedAppForDirectory(environment, directoryPath) {
105
+ if (!directoryPath) {
106
+ return null;
107
+ }
108
+ const config = loadGlobalConfig();
109
+ const links = config.directory_links?.[environment];
110
+ if (!links) {
111
+ return null;
112
+ }
113
+ const normalizedPath = normalizeDirectoryPath(directoryPath);
114
+ const appId = links[normalizedPath];
115
+ return appId || null;
116
+ }
95
117
  function getDefaultEnvironment() {
96
118
  const config = loadGlobalConfig();
97
119
  return config.default_environment;
@@ -166,7 +188,7 @@ function listApps(environment) {
166
188
 
167
189
  // src/utils/version.ts
168
190
  function getCliVersion() {
169
- return true ? "0.2.0-dev.2" : "0.0.0";
191
+ return true ? "0.2.0-dev.3" : "0.0.0";
170
192
  }
171
193
  function getClientId() {
172
194
  return `ecloud-cli/v${getCliVersion()}`;
@@ -195,6 +217,9 @@ function addHexPrefix(value) {
195
217
  }
196
218
  return `0x${value}`;
197
219
  }
220
+ function getCurrentProjectPath() {
221
+ return process.env.INIT_CWD || process.cwd();
222
+ }
198
223
  var ContractAppStatusStarted = 1;
199
224
  var ContractAppStatusStopped = 2;
200
225
  var ContractAppStatusTerminated = 3;
@@ -333,6 +358,7 @@ Select an app to ${action}:
333
358
  switch (action) {
334
359
  case "view":
335
360
  case "view info for":
361
+ case "view releases for":
336
362
  case "set profile for":
337
363
  return true;
338
364
  case "start":
@@ -361,7 +387,19 @@ Select an app to ${action}:
361
387
  index: i
362
388
  });
363
389
  }
390
+ const linkedAppId = getLinkedAppForDirectory(environment, getCurrentProjectPath());
391
+ const normalizedLinkedAppId = linkedAppId ? linkedAppId.toLowerCase() : "";
364
392
  appItems.sort((a, b) => {
393
+ if (normalizedLinkedAppId) {
394
+ const aLinked = String(a.addr).toLowerCase() === normalizedLinkedAppId;
395
+ const bLinked = String(b.addr).toLowerCase() === normalizedLinkedAppId;
396
+ if (aLinked && !bLinked) {
397
+ return -1;
398
+ }
399
+ if (bLinked && !aLinked) {
400
+ return 1;
401
+ }
402
+ }
365
403
  const aPriority = getStatusPriority(a.status, false);
366
404
  const bPriority = getStatusPriority(b.status, false);
367
405
  if (aPriority !== bPriority) {
@@ -427,7 +465,18 @@ async function getAppIDInteractiveFromRegistry(environment, action) {
427
465
  }
428
466
  throw new Error(`Invalid app ID address: ${appIDInput}`);
429
467
  }
430
- const choices = Object.entries(allApps).map(([name, appID]) => {
468
+ const entries = Object.entries(allApps);
469
+ const linkedAppId = getLinkedAppForDirectory(environment, getCurrentProjectPath());
470
+ if (linkedAppId) {
471
+ const linkedIndex = entries.findIndex(
472
+ ([, appId]) => String(appId).toLowerCase() === linkedAppId.toLowerCase()
473
+ );
474
+ if (linkedIndex > 0) {
475
+ const [linkedEntry] = entries.splice(linkedIndex, 1);
476
+ entries.unshift(linkedEntry);
477
+ }
478
+ }
479
+ const choices = entries.map(([name, appID]) => {
431
480
  const displayName = `${name} (${appID})`;
432
481
  return { name: displayName, value: appID };
433
482
  });
@@ -546,7 +595,8 @@ var commonFlags = {
546
595
  environment: Flags.string({
547
596
  required: false,
548
597
  description: "Deployment environment to use",
549
- env: "ECLOUD_ENV"
598
+ env: "ECLOUD_ENV",
599
+ default: async () => getDefaultEnvironment() || (getBuildType2() === "dev" ? "sepolia-dev" : "sepolia")
550
600
  }),
551
601
  "private-key": Flags.string({
552
602
  required: false,
@@ -564,12 +614,11 @@ var commonFlags = {
564
614
  default: false
565
615
  })
566
616
  };
567
- async function validateCommonFlags(flags) {
568
- if (!flags["environment"]) {
569
- flags["environment"] = getDefaultEnvironment();
570
- }
617
+ async function validateCommonFlags(flags, options) {
571
618
  flags["environment"] = await getEnvironmentInteractive(flags["environment"]);
572
- flags["private-key"] = await getPrivateKeyInteractive(flags["private-key"]);
619
+ if (options?.requirePrivateKey !== false) {
620
+ flags["private-key"] = await getPrivateKeyInteractive(flags["private-key"]);
621
+ }
573
622
  return flags;
574
623
  }
575
624
 
@@ -724,7 +773,7 @@ var AppInfo2 = class _AppInfo extends Command {
724
773
  async run() {
725
774
  const { args, flags } = await this.parse(_AppInfo);
726
775
  const validatedFlags = await validateCommonFlags(flags);
727
- const environment = validatedFlags.environment || "sepolia";
776
+ const environment = validatedFlags.environment;
728
777
  const environmentConfig = getEnvironmentConfig2(environment);
729
778
  const rpcUrl = validatedFlags["rpc-url"] || environmentConfig.defaultRPCURL;
730
779
  const privateKey = validatedFlags["private-key"];
@@ -809,7 +858,7 @@ async function showCountdown(seconds) {
809
858
  for (let i = seconds; i >= 0; i--) {
810
859
  process.stdout.write(chalk2.gray(`\rRefreshing in ${i}...`));
811
860
  if (i > 0) {
812
- await new Promise((resolve) => setTimeout(resolve, 1e3));
861
+ await new Promise((resolve2) => setTimeout(resolve2, 1e3));
813
862
  }
814
863
  }
815
864
  }