@layr-labs/ecloud-cli 0.2.0 → 0.2.2-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 +16 -3
  3. package/dist/commands/auth/whoami.js.map +1 -1
  4. package/dist/commands/billing/cancel.js +44 -5
  5. package/dist/commands/billing/cancel.js.map +1 -1
  6. package/dist/commands/billing/status.js +44 -5
  7. package/dist/commands/billing/status.js.map +1 -1
  8. package/dist/commands/billing/subscribe.js +44 -5
  9. package/dist/commands/billing/subscribe.js.map +1 -1
  10. package/dist/commands/compute/app/create.js +16 -3
  11. package/dist/commands/compute/app/create.js.map +1 -1
  12. package/dist/commands/compute/app/deploy.js +120 -25
  13. package/dist/commands/compute/app/deploy.js.map +1 -1
  14. package/dist/commands/compute/app/info.js +124 -35
  15. package/dist/commands/compute/app/info.js.map +1 -1
  16. package/dist/commands/compute/app/list.js +78 -17
  17. package/dist/commands/compute/app/list.js.map +1 -1
  18. package/dist/commands/compute/app/logs.js +69 -28
  19. package/dist/commands/compute/app/logs.js.map +1 -1
  20. package/dist/commands/compute/app/profile/set.js +109 -40
  21. package/dist/commands/compute/app/profile/set.js.map +1 -1
  22. package/dist/commands/compute/app/releases.js +82 -120
  23. package/dist/commands/compute/app/releases.js.map +1 -1
  24. package/dist/commands/compute/app/start.js +77 -35
  25. package/dist/commands/compute/app/start.js.map +1 -1
  26. package/dist/commands/compute/app/stop.js +77 -35
  27. package/dist/commands/compute/app/stop.js.map +1 -1
  28. package/dist/commands/compute/app/terminate.js +77 -35
  29. package/dist/commands/compute/app/terminate.js.map +1 -1
  30. package/dist/commands/compute/app/upgrade.js +117 -39
  31. package/dist/commands/compute/app/upgrade.js.map +1 -1
  32. package/dist/commands/compute/build/info.js +56 -16
  33. package/dist/commands/compute/build/info.js.map +1 -1
  34. package/dist/commands/compute/build/list.js +72 -67
  35. package/dist/commands/compute/build/list.js.map +1 -1
  36. package/dist/commands/compute/build/logs.js +55 -13
  37. package/dist/commands/compute/build/logs.js.map +1 -1
  38. package/dist/commands/compute/build/status.js +55 -13
  39. package/dist/commands/compute/build/status.js.map +1 -1
  40. package/dist/commands/compute/build/submit.js +68 -9
  41. package/dist/commands/compute/build/submit.js.map +1 -1
  42. package/dist/commands/compute/build/verify.js +55 -13
  43. package/dist/commands/compute/build/verify.js.map +1 -1
  44. package/dist/commands/compute/environment/set.js +20 -7
  45. package/dist/commands/compute/environment/set.js.map +1 -1
  46. package/dist/commands/compute/undelegate.js +46 -10
  47. package/dist/commands/compute/undelegate.js.map +1 -1
  48. package/package.json +2 -2
@@ -3,8 +3,8 @@
3
3
  // src/commands/compute/build/list.ts
4
4
  import { Command, Flags as Flags2 } from "@oclif/core";
5
5
  import chalk2 from "chalk";
6
- import { privateKeyToAccount as privateKeyToAccount3 } from "viem/accounts";
7
- import { addHexPrefix } from "@layr-labs/ecloud-sdk";
6
+ import { privateKeyToAccount as privateKeyToAccount4 } from "viem/accounts";
7
+ import { addHexPrefix as addHexPrefix2 } from "@layr-labs/ecloud-sdk";
8
8
 
9
9
  // src/flags.ts
10
10
  import { Flags } from "@oclif/core";
@@ -16,9 +16,9 @@ import fs3 from "fs";
16
16
  import path3 from "path";
17
17
  import os3 from "os";
18
18
  import { isAddress as isAddress2 } from "viem";
19
- import { privateKeyToAccount as privateKeyToAccount2 } from "viem/accounts";
19
+ import { privateKeyToAccount as privateKeyToAccount3 } from "viem/accounts";
20
20
  import {
21
- getEnvironmentConfig,
21
+ getEnvironmentConfig as getEnvironmentConfig2,
22
22
  getAvailableEnvironments,
23
23
  isEnvironmentAvailable,
24
24
  getAllAppsByDeveloper as getAllAppsByDeveloper2,
@@ -35,12 +35,43 @@ import {
35
35
 
36
36
  // src/utils/appResolver.ts
37
37
  import { isAddress } from "viem";
38
- import { privateKeyToAccount } from "viem/accounts";
38
+ import { privateKeyToAccount as privateKeyToAccount2 } from "viem/accounts";
39
39
  import {
40
40
  UserApiClient,
41
41
  getAllAppsByDeveloper
42
42
  } from "@layr-labs/ecloud-sdk";
43
43
 
44
+ // src/utils/viemClients.ts
45
+ import {
46
+ createPublicClient,
47
+ http
48
+ } from "viem";
49
+ import { privateKeyToAccount } from "viem/accounts";
50
+ import {
51
+ getEnvironmentConfig,
52
+ addHexPrefix,
53
+ createViemClients as sdkCreateViemClients,
54
+ getChainFromID
55
+ } from "@layr-labs/ecloud-sdk";
56
+ function createViemClients(options) {
57
+ const privateKey = addHexPrefix(options.privateKey);
58
+ const environmentConfig = getEnvironmentConfig(options.environment);
59
+ const rpcUrl = options.rpcUrl || environmentConfig.defaultRPCURL;
60
+ const chain = getChainFromID(environmentConfig.chainID);
61
+ const { publicClient, walletClient } = sdkCreateViemClients({
62
+ privateKey,
63
+ rpcUrl,
64
+ chainId: environmentConfig.chainID
65
+ });
66
+ const account = privateKeyToAccount(privateKey);
67
+ return {
68
+ publicClient,
69
+ walletClient,
70
+ chain,
71
+ address: account.address
72
+ };
73
+ }
74
+
44
75
  // src/utils/globalConfig.ts
45
76
  import * as fs from "fs";
46
77
  import * as path from "path";
@@ -127,7 +158,7 @@ var APPS_DIR = path2.join(CONFIG_DIR, "apps");
127
158
 
128
159
  // src/utils/version.ts
129
160
  function getCliVersion() {
130
- return true ? "0.2.0" : "0.0.0";
161
+ return true ? "0.2.2-dev" : "0.0.0";
131
162
  }
132
163
  function getClientId() {
133
164
  return `ecloud-cli/v${getCliVersion()}`;
@@ -164,7 +195,7 @@ async function getPrivateKeyInteractive(privateKey) {
164
195
  async function getEnvironmentInteractive(environment) {
165
196
  if (environment) {
166
197
  try {
167
- getEnvironmentConfig(environment);
198
+ getEnvironmentConfig2(environment);
168
199
  if (!isEnvironmentAvailable(environment)) {
169
200
  throw new Error(`Environment ${environment} is not available in this build`);
170
201
  }
@@ -177,7 +208,7 @@ async function getEnvironmentInteractive(environment) {
177
208
  const configDefaultEnv = getDefaultEnvironment();
178
209
  if (configDefaultEnv && availableEnvs.includes(configDefaultEnv)) {
179
210
  try {
180
- getEnvironmentConfig(configDefaultEnv);
211
+ getEnvironmentConfig2(configDefaultEnv);
181
212
  defaultEnv = configDefaultEnv;
182
213
  } catch {
183
214
  }
@@ -244,16 +275,27 @@ import {
244
275
  createComputeModule,
245
276
  createBillingModule,
246
277
  createBuildModule,
247
- getEnvironmentConfig as getEnvironmentConfig2,
278
+ getEnvironmentConfig as getEnvironmentConfig3,
248
279
  requirePrivateKey,
249
280
  getPrivateKeyWithSource
250
281
  } from "@layr-labs/ecloud-sdk";
251
282
  async function createBuildClient(flags) {
252
283
  flags = await validateCommonFlags(flags, { requirePrivateKey: false });
284
+ const environment = flags.environment || "mainnet";
285
+ const environmentConfig = getEnvironmentConfig3(environment);
286
+ const rpcUrl = flags["rpc-url"] || environmentConfig.defaultRPCURL;
287
+ let walletClient;
288
+ if (flags["private-key"]) {
289
+ walletClient = createViemClients({
290
+ privateKey: flags["private-key"],
291
+ rpcUrl,
292
+ environment
293
+ }).walletClient;
294
+ }
253
295
  return createBuildModule({
254
296
  verbose: flags.verbose,
255
- privateKey: flags["private-key"],
256
- environment: flags.environment,
297
+ walletClient,
298
+ environment,
257
299
  clientId: getClientId(),
258
300
  skipTelemetry: true
259
301
  // CLI already has telemetry, skip SDK telemetry
@@ -331,14 +373,7 @@ function formatBuildStatus(status) {
331
373
  return color ? color(status) : status;
332
374
  }
333
375
 
334
- // src/commands/compute/build/list.ts
335
- import Table from "cli-table3";
336
-
337
376
  // src/utils/cliFormat.ts
338
- function terminalWidth(fallback = 120) {
339
- const cols = typeof process.stdout.columns === "number" ? process.stdout.columns : void 0;
340
- return cols && cols > 0 ? cols : fallback;
341
- }
342
377
  function formatHumanTime(value) {
343
378
  const raw = String(value ?? "").trim();
344
379
  if (!raw) return "-";
@@ -410,8 +445,8 @@ var BuildList = class _BuildList extends Command {
410
445
  const { flags } = await this.parse(_BuildList);
411
446
  const validatedFlags = await validateCommonFlags(flags);
412
447
  const client = await createBuildClient(validatedFlags);
413
- const billingAddress = privateKeyToAccount3(
414
- addHexPrefix(validatedFlags["private-key"])
448
+ const billingAddress = privateKeyToAccount4(
449
+ addHexPrefix2(validatedFlags["private-key"])
415
450
  ).address;
416
451
  const limit = Math.max(1, Math.min(100, flags.limit ?? 20));
417
452
  const offset = Math.max(0, flags.offset ?? 0);
@@ -424,57 +459,27 @@ var BuildList = class _BuildList extends Command {
424
459
  this.log(`No builds found for ${billingAddress}`);
425
460
  return;
426
461
  }
427
- const rows = builds.map((b) => ({
428
- buildId: b.buildId || "-",
429
- status: formatBuildStatus(b.status),
430
- repo: formatRepoDisplay(b.repoUrl || "-"),
431
- commit: b.gitRef || "-",
432
- image: formatImageDisplay(b.imageUrl || "-"),
433
- created: formatHumanTime(b.createdAt),
434
- prov: provenanceSummary({
435
- provenanceJson: b.provenanceJson,
436
- provenanceSignature: b.provenanceSignature,
437
- dependencies: b.dependencies
438
- })
439
- }));
440
- const tw = terminalWidth();
441
- const shouldStack = tw < 110;
442
462
  this.log("");
443
463
  this.log(chalk2.bold(`Builds for ${billingAddress} (${validatedFlags.environment}):`));
444
464
  this.log("");
445
- if (shouldStack) {
446
- for (const r of rows) {
447
- this.log(`${r.status} ${chalk2.cyan(r.buildId)} ${r.created}`);
448
- this.log(` Repo: ${r.repo}`);
449
- this.log(` Commit: ${r.commit}`);
450
- this.log(` Image: ${r.image}`);
451
- this.log(` Prov: ${r.prov}`);
452
- this.log(chalk2.gray(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
453
- }
454
- } else {
455
- const fixed = 37 + 10 + 20 + 14 + 8;
456
- const remaining = Math.max(30, tw - fixed);
457
- const repoW = Math.max(18, Math.floor(remaining * 0.28));
458
- const commitW = Math.max(18, Math.floor(remaining * 0.36));
459
- const imageW = Math.max(18, remaining - repoW - commitW);
460
- const table = new Table({
461
- head: [
462
- chalk2.bold("ID"),
463
- chalk2.bold("Status"),
464
- chalk2.bold("Repo"),
465
- chalk2.bold("Commit"),
466
- chalk2.bold("Image"),
467
- chalk2.bold("Created"),
468
- chalk2.bold("Prov")
469
- ],
470
- colWidths: [37, 10, repoW, commitW, imageW, 20, 14],
471
- wordWrap: true,
472
- style: { "padding-left": 0, "padding-right": 1, head: [], border: [] }
465
+ for (const b of builds) {
466
+ const buildId = b.buildId || "-";
467
+ const status = formatBuildStatus(b.status);
468
+ const repo = formatRepoDisplay(b.repoUrl || "-");
469
+ const commit = b.gitRef || "-";
470
+ const image = formatImageDisplay(b.imageUrl || "-");
471
+ const created = formatHumanTime(b.createdAt);
472
+ const prov = provenanceSummary({
473
+ provenanceJson: b.provenanceJson,
474
+ provenanceSignature: b.provenanceSignature,
475
+ dependencies: b.dependencies
473
476
  });
474
- for (const r of rows) {
475
- table.push([r.buildId, r.status, r.repo, r.commit, r.image, r.created, r.prov]);
476
- }
477
- this.log(table.toString());
477
+ this.log(`${status} ${chalk2.cyan(buildId)} ${created}`);
478
+ this.log(` Repo: ${repo}`);
479
+ this.log(` Commit: ${commit}`);
480
+ this.log(` Image: ${image}`);
481
+ this.log(` Prov: ${prov}`);
482
+ this.log(chalk2.gray(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
478
483
  }
479
484
  this.log("");
480
485
  this.log(chalk2.gray(`Showing ${builds.length} build(s) (limit=${limit}, offset=${offset})`));