@layr-labs/ecloud-cli 0.2.0-dev.2 → 0.2.0
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.
- package/VERSION +2 -2
- package/dist/commands/auth/generate.js +2 -2
- package/dist/commands/auth/generate.js.map +1 -1
- package/dist/commands/auth/login.js.map +1 -1
- package/dist/commands/auth/logout.js.map +1 -1
- package/dist/commands/auth/migrate.js.map +1 -1
- package/dist/commands/auth/whoami.js +5 -3
- package/dist/commands/auth/whoami.js.map +1 -1
- package/dist/commands/billing/cancel.js +6 -3
- package/dist/commands/billing/cancel.js.map +1 -1
- package/dist/commands/billing/status.js +6 -3
- package/dist/commands/billing/status.js.map +1 -1
- package/dist/commands/billing/subscribe.js +12 -7
- package/dist/commands/billing/subscribe.js.map +1 -1
- package/dist/commands/compute/app/create.js.map +1 -1
- package/dist/commands/compute/app/deploy.js +614 -86
- package/dist/commands/compute/app/deploy.js.map +1 -1
- package/dist/commands/compute/app/info.js +59 -10
- package/dist/commands/compute/app/info.js.map +1 -1
- package/dist/commands/compute/app/list.js +10 -9
- package/dist/commands/compute/app/list.js.map +1 -1
- package/dist/commands/compute/app/logs.js +61 -11
- package/dist/commands/compute/app/logs.js.map +1 -1
- package/dist/commands/compute/app/profile/set.js +145 -20
- package/dist/commands/compute/app/profile/set.js.map +1 -1
- package/dist/commands/compute/app/releases.js +1111 -0
- package/dist/commands/compute/app/releases.js.map +1 -0
- package/dist/commands/compute/app/start.js +61 -11
- package/dist/commands/compute/app/start.js.map +1 -1
- package/dist/commands/compute/app/stop.js +61 -11
- package/dist/commands/compute/app/stop.js.map +1 -1
- package/dist/commands/compute/app/terminate.js +61 -11
- package/dist/commands/compute/app/terminate.js.map +1 -1
- package/dist/commands/compute/app/upgrade.js +615 -52
- package/dist/commands/compute/app/upgrade.js.map +1 -1
- package/dist/commands/compute/build/info.js +500 -0
- package/dist/commands/compute/build/info.js.map +1 -0
- package/dist/commands/compute/build/list.js +494 -0
- package/dist/commands/compute/build/list.js.map +1 -0
- package/dist/commands/compute/build/logs.js +459 -0
- package/dist/commands/compute/build/logs.js.map +1 -0
- package/dist/commands/compute/build/status.js +481 -0
- package/dist/commands/compute/build/status.js.map +1 -0
- package/dist/commands/compute/build/submit.js +618 -0
- package/dist/commands/compute/build/submit.js.map +1 -0
- package/dist/commands/compute/build/verify.js +439 -0
- package/dist/commands/compute/build/verify.js.map +1 -0
- package/dist/commands/compute/environment/list.js.map +1 -1
- package/dist/commands/compute/environment/set.js.map +1 -1
- package/dist/commands/compute/environment/show.js.map +1 -1
- package/dist/commands/compute/undelegate.js +11 -9
- package/dist/commands/compute/undelegate.js.map +1 -1
- package/dist/commands/telemetry/disable.js.map +1 -1
- package/dist/commands/telemetry/enable.js.map +1 -1
- package/dist/commands/telemetry/status.js.map +1 -1
- package/dist/commands/upgrade.js.map +1 -1
- package/dist/commands/version.js.map +1 -1
- package/package.json +7 -2
|
@@ -7,6 +7,7 @@ import { Command, Args } from "@oclif/core";
|
|
|
7
7
|
import {
|
|
8
8
|
createComputeModule,
|
|
9
9
|
createBillingModule,
|
|
10
|
+
createBuildModule,
|
|
10
11
|
getEnvironmentConfig as getEnvironmentConfig2,
|
|
11
12
|
requirePrivateKey,
|
|
12
13
|
getPrivateKeyWithSource
|
|
@@ -14,6 +15,7 @@ import {
|
|
|
14
15
|
|
|
15
16
|
// src/flags.ts
|
|
16
17
|
import { Flags } from "@oclif/core";
|
|
18
|
+
import { getBuildType as getBuildType2 } from "@layr-labs/ecloud-sdk";
|
|
17
19
|
|
|
18
20
|
// src/utils/prompts.ts
|
|
19
21
|
import { input, select, password, confirm as inquirerConfirm } from "@inquirer/prompts";
|
|
@@ -95,6 +97,27 @@ function saveGlobalConfig(config) {
|
|
|
95
97
|
const content = dumpYaml(config, { lineWidth: -1 });
|
|
96
98
|
fs.writeFileSync(configPath, content, { mode: 420 });
|
|
97
99
|
}
|
|
100
|
+
function normalizeDirectoryPath(directoryPath) {
|
|
101
|
+
const resolved = path.resolve(directoryPath);
|
|
102
|
+
try {
|
|
103
|
+
return fs.realpathSync(resolved);
|
|
104
|
+
} catch {
|
|
105
|
+
return resolved;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
function getLinkedAppForDirectory(environment, directoryPath) {
|
|
109
|
+
if (!directoryPath) {
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
const config = loadGlobalConfig();
|
|
113
|
+
const links = config.directory_links?.[environment];
|
|
114
|
+
if (!links) {
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
const normalizedPath = normalizeDirectoryPath(directoryPath);
|
|
118
|
+
const appId = links[normalizedPath];
|
|
119
|
+
return appId || null;
|
|
120
|
+
}
|
|
98
121
|
function getDefaultEnvironment() {
|
|
99
122
|
const config = loadGlobalConfig();
|
|
100
123
|
return config.default_environment;
|
|
@@ -191,7 +214,7 @@ function listApps(environment) {
|
|
|
191
214
|
|
|
192
215
|
// src/utils/version.ts
|
|
193
216
|
function getCliVersion() {
|
|
194
|
-
return true ? "0.2.0
|
|
217
|
+
return true ? "0.2.0" : "0.0.0";
|
|
195
218
|
}
|
|
196
219
|
function getClientId() {
|
|
197
220
|
return `ecloud-cli/v${getCliVersion()}`;
|
|
@@ -220,6 +243,9 @@ function addHexPrefix(value) {
|
|
|
220
243
|
}
|
|
221
244
|
return `0x${value}`;
|
|
222
245
|
}
|
|
246
|
+
function getCurrentProjectPath() {
|
|
247
|
+
return process.env.INIT_CWD || process.cwd();
|
|
248
|
+
}
|
|
223
249
|
var ContractAppStatusStarted = 1;
|
|
224
250
|
var ContractAppStatusStopped = 2;
|
|
225
251
|
var ContractAppStatusTerminated = 3;
|
|
@@ -358,6 +384,7 @@ Select an app to ${action}:
|
|
|
358
384
|
switch (action) {
|
|
359
385
|
case "view":
|
|
360
386
|
case "view info for":
|
|
387
|
+
case "view releases for":
|
|
361
388
|
case "set profile for":
|
|
362
389
|
return true;
|
|
363
390
|
case "start":
|
|
@@ -386,7 +413,19 @@ Select an app to ${action}:
|
|
|
386
413
|
index: i
|
|
387
414
|
});
|
|
388
415
|
}
|
|
416
|
+
const linkedAppId = getLinkedAppForDirectory(environment, getCurrentProjectPath());
|
|
417
|
+
const normalizedLinkedAppId = linkedAppId ? linkedAppId.toLowerCase() : "";
|
|
389
418
|
appItems.sort((a, b) => {
|
|
419
|
+
if (normalizedLinkedAppId) {
|
|
420
|
+
const aLinked = String(a.addr).toLowerCase() === normalizedLinkedAppId;
|
|
421
|
+
const bLinked = String(b.addr).toLowerCase() === normalizedLinkedAppId;
|
|
422
|
+
if (aLinked && !bLinked) {
|
|
423
|
+
return -1;
|
|
424
|
+
}
|
|
425
|
+
if (bLinked && !aLinked) {
|
|
426
|
+
return 1;
|
|
427
|
+
}
|
|
428
|
+
}
|
|
390
429
|
const aPriority = getStatusPriority(a.status, false);
|
|
391
430
|
const bPriority = getStatusPriority(b.status, false);
|
|
392
431
|
if (aPriority !== bPriority) {
|
|
@@ -452,7 +491,18 @@ async function getAppIDInteractiveFromRegistry(environment, action) {
|
|
|
452
491
|
}
|
|
453
492
|
throw new Error(`Invalid app ID address: ${appIDInput}`);
|
|
454
493
|
}
|
|
455
|
-
const
|
|
494
|
+
const entries = Object.entries(allApps);
|
|
495
|
+
const linkedAppId = getLinkedAppForDirectory(environment, getCurrentProjectPath());
|
|
496
|
+
if (linkedAppId) {
|
|
497
|
+
const linkedIndex = entries.findIndex(
|
|
498
|
+
([, appId]) => String(appId).toLowerCase() === linkedAppId.toLowerCase()
|
|
499
|
+
);
|
|
500
|
+
if (linkedIndex > 0) {
|
|
501
|
+
const [linkedEntry] = entries.splice(linkedIndex, 1);
|
|
502
|
+
entries.unshift(linkedEntry);
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
const choices = entries.map(([name, appID]) => {
|
|
456
506
|
const displayName = `${name} (${appID})`;
|
|
457
507
|
return { name: displayName, value: appID };
|
|
458
508
|
});
|
|
@@ -580,7 +630,8 @@ var commonFlags = {
|
|
|
580
630
|
environment: Flags.string({
|
|
581
631
|
required: false,
|
|
582
632
|
description: "Deployment environment to use",
|
|
583
|
-
env: "ECLOUD_ENV"
|
|
633
|
+
env: "ECLOUD_ENV",
|
|
634
|
+
default: async () => getDefaultEnvironment() || (getBuildType2() === "dev" ? "sepolia-dev" : "sepolia")
|
|
584
635
|
}),
|
|
585
636
|
"private-key": Flags.string({
|
|
586
637
|
required: false,
|
|
@@ -598,12 +649,11 @@ var commonFlags = {
|
|
|
598
649
|
default: false
|
|
599
650
|
})
|
|
600
651
|
};
|
|
601
|
-
async function validateCommonFlags(flags) {
|
|
602
|
-
if (!flags["environment"]) {
|
|
603
|
-
flags["environment"] = getDefaultEnvironment();
|
|
604
|
-
}
|
|
652
|
+
async function validateCommonFlags(flags, options) {
|
|
605
653
|
flags["environment"] = await getEnvironmentInteractive(flags["environment"]);
|
|
606
|
-
|
|
654
|
+
if (options?.requirePrivateKey !== false) {
|
|
655
|
+
flags["private-key"] = await getPrivateKeyInteractive(flags["private-key"]);
|
|
656
|
+
}
|
|
607
657
|
return flags;
|
|
608
658
|
}
|
|
609
659
|
|
|
@@ -647,7 +697,7 @@ import {
|
|
|
647
697
|
addMetric,
|
|
648
698
|
addMetricWithDimensions,
|
|
649
699
|
emitMetrics,
|
|
650
|
-
getBuildType as
|
|
700
|
+
getBuildType as getBuildType3
|
|
651
701
|
} from "@layr-labs/ecloud-sdk";
|
|
652
702
|
function createCLITelemetryClient() {
|
|
653
703
|
const userUUID = getOrCreateUserUUID();
|
|
@@ -665,7 +715,7 @@ async function withTelemetry(command, action) {
|
|
|
665
715
|
metrics.properties["command"] = command.id || command.constructor.name;
|
|
666
716
|
const environment = getDefaultEnvironment() || "sepolia";
|
|
667
717
|
metrics.properties["environment"] = environment;
|
|
668
|
-
const buildType =
|
|
718
|
+
const buildType = getBuildType3() || "prod";
|
|
669
719
|
metrics.properties["build_type"] = buildType;
|
|
670
720
|
const cliVersion = command.config.version;
|
|
671
721
|
if (cliVersion) {
|
|
@@ -713,7 +763,7 @@ var AppLifecycleStop = class _AppLifecycleStop extends Command {
|
|
|
713
763
|
return withTelemetry(this, async () => {
|
|
714
764
|
const { args, flags } = await this.parse(_AppLifecycleStop);
|
|
715
765
|
const compute = await createComputeClient(flags);
|
|
716
|
-
const environment = flags.environment
|
|
766
|
+
const environment = flags.environment;
|
|
717
767
|
const environmentConfig = getEnvironmentConfig3(environment);
|
|
718
768
|
const rpcUrl = flags.rpcUrl || environmentConfig.defaultRPCURL;
|
|
719
769
|
const privateKey = flags["private-key"] || await getPrivateKeyInteractive(environment);
|