@layr-labs/ecloud-cli 0.2.0-dev → 0.2.0-dev.1

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 (71) hide show
  1. package/VERSION +2 -2
  2. package/dist/commands/auth/generate.js +4 -4
  3. package/dist/commands/auth/generate.js.map +1 -1
  4. package/dist/commands/auth/login.js +2 -2
  5. package/dist/commands/auth/login.js.map +1 -1
  6. package/dist/commands/auth/logout.js +2 -2
  7. package/dist/commands/auth/logout.js.map +1 -1
  8. package/dist/commands/auth/migrate.js +2 -2
  9. package/dist/commands/auth/migrate.js.map +1 -1
  10. package/dist/commands/auth/whoami.js +7 -5
  11. package/dist/commands/auth/whoami.js.map +1 -1
  12. package/dist/commands/billing/cancel.js +9 -7
  13. package/dist/commands/billing/cancel.js.map +1 -1
  14. package/dist/commands/billing/status.js +8 -5
  15. package/dist/commands/billing/status.js.map +1 -1
  16. package/dist/commands/billing/subscribe.js +14 -10
  17. package/dist/commands/billing/subscribe.js.map +1 -1
  18. package/dist/commands/compute/app/create.js +2 -2
  19. package/dist/commands/compute/app/create.js.map +1 -1
  20. package/dist/commands/compute/app/deploy.js +105 -105
  21. package/dist/commands/compute/app/deploy.js.map +1 -1
  22. package/dist/commands/compute/app/info.js +55 -8
  23. package/dist/commands/compute/app/info.js.map +1 -1
  24. package/dist/commands/compute/app/list.js +8 -9
  25. package/dist/commands/compute/app/list.js.map +1 -1
  26. package/dist/commands/compute/app/logs.js +58 -11
  27. package/dist/commands/compute/app/logs.js.map +1 -1
  28. package/dist/commands/compute/app/profile/set.js +147 -22
  29. package/dist/commands/compute/app/profile/set.js.map +1 -1
  30. package/dist/commands/compute/app/releases.js +110 -143
  31. package/dist/commands/compute/app/releases.js.map +1 -1
  32. package/dist/commands/compute/app/start.js +58 -11
  33. package/dist/commands/compute/app/start.js.map +1 -1
  34. package/dist/commands/compute/app/stop.js +58 -11
  35. package/dist/commands/compute/app/stop.js.map +1 -1
  36. package/dist/commands/compute/app/terminate.js +58 -11
  37. package/dist/commands/compute/app/terminate.js.map +1 -1
  38. package/dist/commands/compute/app/upgrade.js +121 -67
  39. package/dist/commands/compute/app/upgrade.js.map +1 -1
  40. package/dist/commands/compute/build/info.js +8 -9
  41. package/dist/commands/compute/build/info.js.map +1 -1
  42. package/dist/commands/compute/build/list.js +50 -131
  43. package/dist/commands/compute/build/list.js.map +1 -1
  44. package/dist/commands/compute/build/logs.js +9 -10
  45. package/dist/commands/compute/build/logs.js.map +1 -1
  46. package/dist/commands/compute/build/status.js +9 -10
  47. package/dist/commands/compute/build/status.js.map +1 -1
  48. package/dist/commands/compute/build/submit.js +8 -9
  49. package/dist/commands/compute/build/submit.js.map +1 -1
  50. package/dist/commands/compute/build/verify.js +59 -12
  51. package/dist/commands/compute/build/verify.js.map +1 -1
  52. package/dist/commands/compute/environment/list.js +2 -2
  53. package/dist/commands/compute/environment/list.js.map +1 -1
  54. package/dist/commands/compute/environment/set.js +2 -2
  55. package/dist/commands/compute/environment/set.js.map +1 -1
  56. package/dist/commands/compute/environment/show.js +2 -2
  57. package/dist/commands/compute/environment/show.js.map +1 -1
  58. package/dist/commands/compute/undelegate.js +8 -9
  59. package/dist/commands/compute/undelegate.js.map +1 -1
  60. package/dist/commands/{telemetry.js → telemetry/disable.js} +15 -64
  61. package/dist/commands/telemetry/disable.js.map +1 -0
  62. package/dist/commands/telemetry/enable.js +164 -0
  63. package/dist/commands/telemetry/enable.js.map +1 -0
  64. package/dist/commands/telemetry/status.js +159 -0
  65. package/dist/commands/telemetry/status.js.map +1 -0
  66. package/dist/commands/upgrade.js +2 -2
  67. package/dist/commands/upgrade.js.map +1 -1
  68. package/dist/commands/version.js +2 -2
  69. package/dist/commands/version.js.map +1 -1
  70. package/package.json +4 -2
  71. package/dist/commands/telemetry.js.map +0 -1
@@ -8,6 +8,7 @@ import { addHexPrefix } from "@layr-labs/ecloud-sdk";
8
8
 
9
9
  // src/flags.ts
10
10
  import { Flags } from "@oclif/core";
11
+ import { getBuildType as getBuildType2 } from "@layr-labs/ecloud-sdk";
11
12
 
12
13
  // src/utils/prompts.ts
13
14
  import { input, select, password, confirm as inquirerConfirm } from "@inquirer/prompts";
@@ -126,7 +127,7 @@ var APPS_DIR = path2.join(CONFIG_DIR, "apps");
126
127
 
127
128
  // src/utils/version.ts
128
129
  function getCliVersion() {
129
- return true ? "0.2.0-dev" : "0.0.0";
130
+ return true ? "0.2.0-dev.1" : "0.0.0";
130
131
  }
131
132
  function getClientId() {
132
133
  return `ecloud-cli/v${getCliVersion()}`;
@@ -211,7 +212,8 @@ var commonFlags = {
211
212
  environment: Flags.string({
212
213
  required: false,
213
214
  description: "Deployment environment to use",
214
- env: "ECLOUD_ENV"
215
+ env: "ECLOUD_ENV",
216
+ default: async () => getDefaultEnvironment() || (getBuildType2() === "dev" ? "sepolia-dev" : "sepolia")
215
217
  }),
216
218
  "private-key": Flags.string({
217
219
  required: false,
@@ -230,9 +232,6 @@ var commonFlags = {
230
232
  })
231
233
  };
232
234
  async function validateCommonFlags(flags, options) {
233
- if (!flags["environment"]) {
234
- flags["environment"] = getDefaultEnvironment();
235
- }
236
235
  flags["environment"] = await getEnvironmentInteractive(flags["environment"]);
237
236
  if (options?.requirePrivateKey !== false) {
238
237
  flags["private-key"] = await getPrivateKeyInteractive(flags["private-key"]);
@@ -269,15 +268,15 @@ import {
269
268
  addMetric,
270
269
  addMetricWithDimensions,
271
270
  emitMetrics,
272
- getBuildType as getBuildType2
271
+ getBuildType as getBuildType3
273
272
  } from "@layr-labs/ecloud-sdk";
274
273
  function createCLITelemetryClient() {
275
274
  const userUUID = getOrCreateUserUUID();
276
275
  const environment = createAppEnvironment(userUUID);
277
276
  const telemetryEnabled = getGlobalTelemetryPreference();
278
277
  return createTelemetryClient(environment, "ecloud-cli", {
279
- telemetryEnabled: telemetryEnabled === true
280
- // Only enabled if explicitly set to true
278
+ telemetryEnabled: telemetryEnabled !== false
279
+ // Enabled by default, disabled only if explicitly set to false
281
280
  });
282
281
  }
283
282
  async function withTelemetry(command, action) {
@@ -287,7 +286,7 @@ async function withTelemetry(command, action) {
287
286
  metrics.properties["command"] = command.id || command.constructor.name;
288
287
  const environment = getDefaultEnvironment() || "sepolia";
289
288
  metrics.properties["environment"] = environment;
290
- const buildType = getBuildType2() || "prod";
289
+ const buildType = getBuildType3() || "prod";
291
290
  metrics.properties["build_type"] = buildType;
292
291
  const cliVersion = command.config.version;
293
292
  if (cliVersion) {
@@ -332,31 +331,29 @@ function formatBuildStatus(status) {
332
331
  return color ? color(status) : status;
333
332
  }
334
333
 
335
- // src/utils/cliTable.ts
334
+ // src/commands/compute/build/list.ts
335
+ import Table from "cli-table3";
336
+
337
+ // src/utils/cliFormat.ts
336
338
  function terminalWidth(fallback = 120) {
337
339
  const cols = typeof process.stdout.columns === "number" ? process.stdout.columns : void 0;
338
340
  return cols && cols > 0 ? cols : fallback;
339
341
  }
340
- function stripAnsi(s) {
341
- return s.replace(/\u001b\[[0-9;]*m/g, "");
342
- }
343
- function padRight(s, width) {
344
- const plain = stripAnsi(s);
345
- const delta = width - plain.length;
346
- return delta > 0 ? s + " ".repeat(delta) : s;
347
- }
348
- function shortenMiddle(value, max) {
349
- if (value.length <= max) return value;
350
- if (max <= 3) return value.slice(0, max);
351
- const keep = max - 1;
352
- const head = Math.ceil(keep * 0.6);
353
- const tail = keep - head;
354
- return `${value.slice(0, head)}\u2026${value.slice(value.length - tail)}`;
355
- }
356
- function truncateCell(s, width) {
357
- const plain = stripAnsi(s);
358
- if (plain.length <= width) return s;
359
- return shortenMiddle(plain, width);
342
+ function formatHumanTime(value) {
343
+ const raw = String(value ?? "").trim();
344
+ if (!raw) return "-";
345
+ if (/^\d+$/.test(raw)) {
346
+ const n = Number(raw);
347
+ if (Number.isFinite(n) && n > 0) {
348
+ const ms = raw.length <= 10 ? n * 1e3 : n;
349
+ const d2 = new Date(ms);
350
+ if (!Number.isNaN(d2.getTime())) return d2.toLocaleString();
351
+ }
352
+ return raw;
353
+ }
354
+ const d = new Date(raw);
355
+ if (Number.isNaN(d.getTime())) return raw;
356
+ return d.toLocaleString();
360
357
  }
361
358
  function formatRepoDisplay(repoUrl) {
362
359
  const normalized = String(repoUrl || "").replace(/\.git$/i, "").replace(/\/+$/, "");
@@ -376,22 +373,6 @@ function formatImageDisplay(imageUrl) {
376
373
  const s = String(imageUrl || "");
377
374
  return s.replace(/^docker\.io\//i, "");
378
375
  }
379
- function formatHumanTime(value) {
380
- const raw = String(value ?? "").trim();
381
- if (!raw) return "-";
382
- if (/^\d+$/.test(raw)) {
383
- const n = Number(raw);
384
- if (Number.isFinite(n) && n > 0) {
385
- const ms = raw.length <= 10 ? n * 1e3 : n;
386
- const d2 = new Date(ms);
387
- if (!Number.isNaN(d2.getTime())) return d2.toLocaleString();
388
- }
389
- return raw;
390
- }
391
- const d = new Date(raw);
392
- if (Number.isNaN(d.getTime())) return raw;
393
- return d.toLocaleString();
394
- }
395
376
  function provenanceSummary(options) {
396
377
  const parts = [];
397
378
  if (options.provenanceJson) parts.push("prov\u2713");
@@ -456,62 +437,14 @@ var BuildList = class _BuildList extends Command {
456
437
  dependencies: b.dependencies
457
438
  })
458
439
  }));
459
- const headers = {
460
- buildId: chalk2.bold("ID"),
461
- status: chalk2.bold("Status"),
462
- repo: chalk2.bold("Repo"),
463
- commit: chalk2.bold("Commit"),
464
- image: chalk2.bold("Image"),
465
- created: chalk2.bold("Created"),
466
- prov: chalk2.bold("Prov")
467
- };
468
- const sep = " ";
469
440
  const tw = terminalWidth();
470
- const maxContentLen = (key) => Math.max(headers[key].length, ...rows.map((r) => stripAnsi(String(r[key])).length));
471
- const min = {
472
- buildId: 36,
473
- status: 7,
474
- repo: 18,
475
- commit: 40,
476
- image: 18,
477
- created: 18,
478
- prov: 12
479
- };
480
- const max = {
481
- buildId: 36,
482
- status: 10,
483
- repo: 48,
484
- commit: 40,
485
- image: 48,
486
- created: 24,
487
- prov: 18
488
- };
489
- let widths = {
490
- buildId: Math.min(max.buildId, Math.max(min.buildId, maxContentLen("buildId"))),
491
- status: Math.min(max.status, Math.max(min.status, maxContentLen("status"))),
492
- repo: Math.min(max.repo, Math.max(min.repo, maxContentLen("repo"))),
493
- commit: Math.min(max.commit, Math.max(min.commit, maxContentLen("commit"))),
494
- image: Math.min(max.image, Math.max(min.image, maxContentLen("image"))),
495
- created: Math.min(max.created, Math.max(min.created, maxContentLen("created"))),
496
- prov: Math.min(max.prov, Math.max(min.prov, maxContentLen("prov")))
497
- };
498
- const totalWidth = () => widths.buildId + widths.status + widths.repo + widths.commit + widths.image + widths.created + widths.prov + sep.length * 6;
499
- const shrink = (key, amount) => {
500
- const newW = Math.max(min[key], widths[key] - amount);
501
- widths[key] = newW;
502
- };
503
- while (totalWidth() > tw && (widths.repo > min.repo || widths.image > min.image)) {
504
- if (widths.repo > min.repo) shrink("repo", 1);
505
- if (totalWidth() <= tw) break;
506
- if (widths.image > min.image) shrink("image", 1);
507
- }
508
- const shouldStack = totalWidth() > tw;
441
+ const shouldStack = tw < 110;
509
442
  this.log("");
510
443
  this.log(chalk2.bold(`Builds for ${billingAddress} (${validatedFlags.environment}):`));
511
444
  this.log("");
512
445
  if (shouldStack) {
513
446
  for (const r of rows) {
514
- this.log(`${padRight(r.status, 10)} ${chalk2.cyan(r.buildId)} ${r.created}`);
447
+ this.log(`${r.status} ${chalk2.cyan(r.buildId)} ${r.created}`);
515
448
  this.log(` Repo: ${r.repo}`);
516
449
  this.log(` Commit: ${r.commit}`);
517
450
  this.log(` Image: ${r.image}`);
@@ -519,43 +452,29 @@ var BuildList = class _BuildList extends Command {
519
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"));
520
453
  }
521
454
  } else {
522
- const headerLine = [
523
- padRight(headers.buildId, widths.buildId),
524
- padRight(headers.status, widths.status),
525
- padRight(headers.repo, widths.repo),
526
- padRight(headers.commit, widths.commit),
527
- padRight(headers.image, widths.image),
528
- padRight(headers.created, widths.created),
529
- padRight(headers.prov, widths.prov)
530
- ].join(sep);
531
- const ruleLine = [
532
- "-".repeat(widths.buildId),
533
- "-".repeat(widths.status),
534
- "-".repeat(widths.repo),
535
- "-".repeat(widths.commit),
536
- "-".repeat(widths.image),
537
- "-".repeat(widths.created),
538
- "-".repeat(widths.prov)
539
- ].join(sep);
540
- this.log(headerLine);
541
- this.log(ruleLine);
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: [] }
473
+ });
542
474
  for (const r of rows) {
543
- this.log(
544
- [
545
- padRight(r.buildId, widths.buildId),
546
- padRight(r.status, widths.status),
547
- // never truncate status
548
- padRight(truncateCell(shortenMiddle(r.repo, widths.repo), widths.repo), widths.repo),
549
- padRight(r.commit, widths.commit),
550
- padRight(
551
- truncateCell(shortenMiddle(r.image, widths.image), widths.image),
552
- widths.image
553
- ),
554
- padRight(truncateCell(r.created, widths.created), widths.created),
555
- padRight(truncateCell(r.prov, widths.prov), widths.prov)
556
- ].join(sep)
557
- );
475
+ table.push([r.buildId, r.status, r.repo, r.commit, r.image, r.created, r.prov]);
558
476
  }
477
+ this.log(table.toString());
559
478
  }
560
479
  this.log("");
561
480
  this.log(chalk2.gray(`Showing ${builds.length} build(s) (limit=${limit}, offset=${offset})`));