@layr-labs/ecloud-cli 1.0.0-dev.7 → 1.0.0-dev.8
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/admin/admins/add.js +7 -1
- package/dist/commands/admin/admins/add.js.map +1 -1
- package/dist/commands/admin/admins/list.js +7 -1
- package/dist/commands/admin/admins/list.js.map +1 -1
- package/dist/commands/admin/admins/remove.js +7 -1
- package/dist/commands/admin/admins/remove.js.map +1 -1
- package/dist/commands/admin/coupons/create.js +7 -1
- package/dist/commands/admin/coupons/create.js.map +1 -1
- package/dist/commands/admin/coupons/deactivate.js +7 -1
- package/dist/commands/admin/coupons/deactivate.js.map +1 -1
- package/dist/commands/admin/coupons/get.js +7 -1
- package/dist/commands/admin/coupons/get.js.map +1 -1
- package/dist/commands/admin/coupons/list.js +7 -1
- package/dist/commands/admin/coupons/list.js.map +1 -1
- package/dist/commands/admin/coupons/redeem.js +7 -1
- package/dist/commands/admin/coupons/redeem.js.map +1 -1
- package/dist/commands/auth/whoami.js +7 -1
- package/dist/commands/auth/whoami.js.map +1 -1
- package/dist/commands/billing/__tests__/status.test.js +79 -3
- package/dist/commands/billing/__tests__/status.test.js.map +1 -1
- package/dist/commands/billing/__tests__/subscribe.test.js +7 -1
- package/dist/commands/billing/__tests__/subscribe.test.js.map +1 -1
- package/dist/commands/billing/__tests__/top-up.test.js +473 -6
- package/dist/commands/billing/__tests__/top-up.test.js.map +1 -1
- package/dist/commands/billing/cancel.js +8 -3
- package/dist/commands/billing/cancel.js.map +1 -1
- package/dist/commands/billing/list-cards.js +7 -1
- package/dist/commands/billing/list-cards.js.map +1 -1
- package/dist/commands/billing/redeem-coupon.js +7 -1
- package/dist/commands/billing/redeem-coupon.js.map +1 -1
- package/dist/commands/billing/status.js +33 -1
- package/dist/commands/billing/status.js.map +1 -1
- package/dist/commands/billing/subscribe.js +7 -1
- package/dist/commands/billing/subscribe.js.map +1 -1
- package/dist/commands/billing/top-up.js +369 -7
- package/dist/commands/billing/top-up.js.map +1 -1
- package/dist/commands/compute/app/__tests__/status.test.js +1017 -0
- package/dist/commands/compute/app/__tests__/status.test.js.map +1 -0
- package/dist/commands/compute/app/create.js.map +1 -1
- package/dist/commands/compute/app/deploy.js +300 -68
- package/dist/commands/compute/app/deploy.js.map +1 -1
- package/dist/commands/compute/app/info.js +8 -2
- package/dist/commands/compute/app/info.js.map +1 -1
- package/dist/commands/compute/app/list.js +8 -2
- package/dist/commands/compute/app/list.js.map +1 -1
- package/dist/commands/compute/app/logs.js +11 -4
- package/dist/commands/compute/app/logs.js.map +1 -1
- package/dist/commands/compute/app/profile/set.js +11 -4
- package/dist/commands/compute/app/profile/set.js.map +1 -1
- package/dist/commands/compute/app/releases.js +8 -2
- package/dist/commands/compute/app/releases.js.map +1 -1
- package/dist/commands/compute/app/start.js +15 -8
- package/dist/commands/compute/app/start.js.map +1 -1
- package/dist/commands/compute/app/status.js +845 -0
- package/dist/commands/compute/app/status.js.map +1 -0
- package/dist/commands/compute/app/stop.js +15 -8
- package/dist/commands/compute/app/stop.js.map +1 -1
- package/dist/commands/compute/app/terminate.js +15 -8
- package/dist/commands/compute/app/terminate.js.map +1 -1
- package/dist/commands/compute/app/upgrade.js +297 -67
- package/dist/commands/compute/app/upgrade.js.map +1 -1
- package/dist/commands/compute/build/info.js +8 -2
- package/dist/commands/compute/build/info.js.map +1 -1
- package/dist/commands/compute/build/list.js +8 -2
- package/dist/commands/compute/build/list.js.map +1 -1
- package/dist/commands/compute/build/logs.js +8 -2
- package/dist/commands/compute/build/logs.js.map +1 -1
- package/dist/commands/compute/build/status.js +8 -2
- package/dist/commands/compute/build/status.js.map +1 -1
- package/dist/commands/compute/build/submit.js +8 -2
- package/dist/commands/compute/build/submit.js.map +1 -1
- package/dist/commands/compute/build/verify.js +8 -2
- package/dist/commands/compute/build/verify.js.map +1 -1
- package/dist/commands/compute/environment/set.js.map +1 -1
- package/dist/commands/compute/undelegate.js +11 -4
- package/dist/commands/compute/undelegate.js.map +1 -1
- package/dist/hooks/init/__tests__/version-check.test.js +32 -2
- package/dist/hooks/init/__tests__/version-check.test.js.map +1 -1
- package/dist/hooks/init/version-check.js +6 -1
- package/dist/hooks/init/version-check.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,845 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/commands/compute/app/status.ts
|
|
4
|
+
import { Command, Args, Flags as Flags2 } from "@oclif/core";
|
|
5
|
+
import { getEnvironmentConfig as getEnvironmentConfig4, UserApiClient as UserApiClient3, WatchTimeoutError } from "@layr-labs/ecloud-sdk";
|
|
6
|
+
|
|
7
|
+
// src/flags.ts
|
|
8
|
+
import { Flags } from "@oclif/core";
|
|
9
|
+
import { getBuildType as getBuildType2 } from "@layr-labs/ecloud-sdk";
|
|
10
|
+
|
|
11
|
+
// src/utils/prompts.ts
|
|
12
|
+
import { input, select, password, confirm as inquirerConfirm } from "@inquirer/prompts";
|
|
13
|
+
import chalk from "chalk";
|
|
14
|
+
import fs3 from "fs";
|
|
15
|
+
import path3 from "path";
|
|
16
|
+
import os3 from "os";
|
|
17
|
+
import { isAddress as isAddress2 } from "viem";
|
|
18
|
+
import { privateKeyToAccount as privateKeyToAccount3 } from "viem/accounts";
|
|
19
|
+
import {
|
|
20
|
+
getEnvironmentConfig as getEnvironmentConfig2,
|
|
21
|
+
getAvailableEnvironments,
|
|
22
|
+
getAllAppsByDeveloper as getAllAppsByDeveloper2,
|
|
23
|
+
getCategoryDescriptions,
|
|
24
|
+
fetchTemplateCatalog,
|
|
25
|
+
PRIMARY_LANGUAGES,
|
|
26
|
+
validateAppName,
|
|
27
|
+
validateImageReference,
|
|
28
|
+
validateFilePath,
|
|
29
|
+
validatePrivateKeyFormat,
|
|
30
|
+
extractAppNameFromImage,
|
|
31
|
+
UserApiClient as UserApiClient2
|
|
32
|
+
} from "@layr-labs/ecloud-sdk";
|
|
33
|
+
|
|
34
|
+
// src/utils/appResolver.ts
|
|
35
|
+
import { isAddress } from "viem";
|
|
36
|
+
import { privateKeyToAccount as privateKeyToAccount2 } from "viem/accounts";
|
|
37
|
+
import {
|
|
38
|
+
UserApiClient,
|
|
39
|
+
getAllAppsByDeveloper
|
|
40
|
+
} from "@layr-labs/ecloud-sdk";
|
|
41
|
+
|
|
42
|
+
// src/utils/viemClients.ts
|
|
43
|
+
import {
|
|
44
|
+
createPublicClient,
|
|
45
|
+
http
|
|
46
|
+
} from "viem";
|
|
47
|
+
import { privateKeyToAccount } from "viem/accounts";
|
|
48
|
+
import {
|
|
49
|
+
getEnvironmentConfig,
|
|
50
|
+
addHexPrefix,
|
|
51
|
+
createViemClients as sdkCreateViemClients,
|
|
52
|
+
getChainFromID
|
|
53
|
+
} from "@layr-labs/ecloud-sdk";
|
|
54
|
+
function createViemClients(options) {
|
|
55
|
+
const privateKey = addHexPrefix(options.privateKey);
|
|
56
|
+
const environmentConfig = getEnvironmentConfig(options.environment);
|
|
57
|
+
const rpcUrl = options.rpcUrl || environmentConfig.defaultRPCURL;
|
|
58
|
+
const chain = getChainFromID(environmentConfig.chainID);
|
|
59
|
+
const { publicClient, walletClient } = sdkCreateViemClients({
|
|
60
|
+
privateKey,
|
|
61
|
+
rpcUrl,
|
|
62
|
+
chainId: environmentConfig.chainID
|
|
63
|
+
});
|
|
64
|
+
const account = privateKeyToAccount(privateKey);
|
|
65
|
+
return {
|
|
66
|
+
publicClient,
|
|
67
|
+
walletClient,
|
|
68
|
+
chain,
|
|
69
|
+
address: account.address
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// src/utils/globalConfig.ts
|
|
74
|
+
import * as fs from "fs";
|
|
75
|
+
import * as path from "path";
|
|
76
|
+
import * as os from "os";
|
|
77
|
+
import { load as loadYaml, dump as dumpYaml } from "js-yaml";
|
|
78
|
+
import { getBuildType } from "@layr-labs/ecloud-sdk";
|
|
79
|
+
import * as crypto from "crypto";
|
|
80
|
+
var GLOBAL_CONFIG_FILE = "config.yaml";
|
|
81
|
+
var PROFILE_CACHE_TTL_MS = 24 * 60 * 60 * 1e3;
|
|
82
|
+
function getGlobalConfigDir() {
|
|
83
|
+
const configHome = process.env.XDG_CONFIG_HOME;
|
|
84
|
+
let baseDir;
|
|
85
|
+
if (configHome && path.isAbsolute(configHome)) {
|
|
86
|
+
baseDir = configHome;
|
|
87
|
+
} else {
|
|
88
|
+
baseDir = path.join(os.homedir(), ".config");
|
|
89
|
+
}
|
|
90
|
+
const buildType = getBuildType();
|
|
91
|
+
const buildSuffix = buildType === "dev" ? "-dev" : "";
|
|
92
|
+
const configDirName = `ecloud${buildSuffix}`;
|
|
93
|
+
return path.join(baseDir, configDirName);
|
|
94
|
+
}
|
|
95
|
+
function getGlobalConfigPath() {
|
|
96
|
+
return path.join(getGlobalConfigDir(), GLOBAL_CONFIG_FILE);
|
|
97
|
+
}
|
|
98
|
+
function loadGlobalConfig() {
|
|
99
|
+
const configPath = getGlobalConfigPath();
|
|
100
|
+
if (!fs.existsSync(configPath)) {
|
|
101
|
+
return {
|
|
102
|
+
first_run: true
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
try {
|
|
106
|
+
const content = fs.readFileSync(configPath, "utf-8");
|
|
107
|
+
const config = loadYaml(content);
|
|
108
|
+
return config || { first_run: true };
|
|
109
|
+
} catch {
|
|
110
|
+
return {
|
|
111
|
+
first_run: true
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
function saveGlobalConfig(config) {
|
|
116
|
+
const configPath = getGlobalConfigPath();
|
|
117
|
+
const configDir = path.dirname(configPath);
|
|
118
|
+
fs.mkdirSync(configDir, { recursive: true, mode: 493 });
|
|
119
|
+
const content = dumpYaml(config, { lineWidth: -1 });
|
|
120
|
+
fs.writeFileSync(configPath, content, { mode: 420 });
|
|
121
|
+
}
|
|
122
|
+
function normalizeDirectoryPath(directoryPath) {
|
|
123
|
+
const resolved = path.resolve(directoryPath);
|
|
124
|
+
try {
|
|
125
|
+
return fs.realpathSync(resolved);
|
|
126
|
+
} catch {
|
|
127
|
+
return resolved;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
function getLinkedAppForDirectory(environment, directoryPath) {
|
|
131
|
+
if (!directoryPath) {
|
|
132
|
+
return null;
|
|
133
|
+
}
|
|
134
|
+
const config = loadGlobalConfig();
|
|
135
|
+
const links = config.directory_links?.[environment];
|
|
136
|
+
if (!links) {
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
139
|
+
const normalizedPath = normalizeDirectoryPath(directoryPath);
|
|
140
|
+
const appId = links[normalizedPath];
|
|
141
|
+
return appId || null;
|
|
142
|
+
}
|
|
143
|
+
function getDefaultEnvironment() {
|
|
144
|
+
const config = loadGlobalConfig();
|
|
145
|
+
return config.default_environment;
|
|
146
|
+
}
|
|
147
|
+
function getProfileCache(environment) {
|
|
148
|
+
const config = loadGlobalConfig();
|
|
149
|
+
const cacheEntry = config.profile_cache?.[environment];
|
|
150
|
+
if (!cacheEntry) {
|
|
151
|
+
return null;
|
|
152
|
+
}
|
|
153
|
+
const now = Date.now();
|
|
154
|
+
if (now - cacheEntry.updated_at > PROFILE_CACHE_TTL_MS) {
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
157
|
+
return cacheEntry.profiles;
|
|
158
|
+
}
|
|
159
|
+
function setProfileCache(environment, profiles) {
|
|
160
|
+
const config = loadGlobalConfig();
|
|
161
|
+
if (!config.profile_cache) {
|
|
162
|
+
config.profile_cache = {};
|
|
163
|
+
}
|
|
164
|
+
config.profile_cache[environment] = {
|
|
165
|
+
updated_at: Date.now(),
|
|
166
|
+
profiles
|
|
167
|
+
};
|
|
168
|
+
saveGlobalConfig(config);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// src/utils/appNames.ts
|
|
172
|
+
import * as fs2 from "fs";
|
|
173
|
+
import * as path2 from "path";
|
|
174
|
+
import * as os2 from "os";
|
|
175
|
+
import { load as loadYaml2, dump as dumpYaml2 } from "js-yaml";
|
|
176
|
+
var CONFIG_DIR = path2.join(os2.homedir(), ".eigenx");
|
|
177
|
+
var APPS_DIR = path2.join(CONFIG_DIR, "apps");
|
|
178
|
+
var APP_REGISTRY_VERSION = "1.0.0";
|
|
179
|
+
function getAppRegistryPath(environment) {
|
|
180
|
+
return path2.join(APPS_DIR, `${environment}.yaml`);
|
|
181
|
+
}
|
|
182
|
+
function loadAppRegistry(environment) {
|
|
183
|
+
const filePath = getAppRegistryPath(environment);
|
|
184
|
+
if (!fs2.existsSync(filePath)) {
|
|
185
|
+
return {
|
|
186
|
+
version: APP_REGISTRY_VERSION,
|
|
187
|
+
apps: {}
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
try {
|
|
191
|
+
const content = fs2.readFileSync(filePath, "utf-8");
|
|
192
|
+
const registry = loadYaml2(content);
|
|
193
|
+
if (!registry.apps) {
|
|
194
|
+
registry.apps = {};
|
|
195
|
+
}
|
|
196
|
+
return registry;
|
|
197
|
+
} catch {
|
|
198
|
+
return {
|
|
199
|
+
version: APP_REGISTRY_VERSION,
|
|
200
|
+
apps: {}
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
function listApps(environment) {
|
|
205
|
+
const registry = loadAppRegistry(environment);
|
|
206
|
+
const result = {};
|
|
207
|
+
for (const [name, app] of Object.entries(registry.apps)) {
|
|
208
|
+
if (app?.app_id) {
|
|
209
|
+
result[name] = String(app.app_id);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
return result;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// src/utils/version.ts
|
|
216
|
+
function getCliVersion() {
|
|
217
|
+
return true ? "1.0.0-dev.8" : "0.0.0";
|
|
218
|
+
}
|
|
219
|
+
function getClientId() {
|
|
220
|
+
return `ecloud-cli/v${getCliVersion()}`;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
// src/utils/appResolver.ts
|
|
224
|
+
var CHUNK_SIZE = 10;
|
|
225
|
+
async function getAppInfosChunked(userApiClient, appIds, addressCount) {
|
|
226
|
+
if (appIds.length === 0) {
|
|
227
|
+
return [];
|
|
228
|
+
}
|
|
229
|
+
const chunks = [];
|
|
230
|
+
for (let i = 0; i < appIds.length; i += CHUNK_SIZE) {
|
|
231
|
+
chunks.push(appIds.slice(i, i + CHUNK_SIZE));
|
|
232
|
+
}
|
|
233
|
+
const chunkResults = await Promise.all(
|
|
234
|
+
chunks.map((chunk) => userApiClient.getInfos(chunk, addressCount))
|
|
235
|
+
);
|
|
236
|
+
return chunkResults.flat();
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
// src/utils/prompts.ts
|
|
240
|
+
import { execSync } from "child_process";
|
|
241
|
+
function addHexPrefix2(value) {
|
|
242
|
+
if (value.startsWith("0x")) {
|
|
243
|
+
return value;
|
|
244
|
+
}
|
|
245
|
+
return `0x${value}`;
|
|
246
|
+
}
|
|
247
|
+
function ensureInteractive(missingFlagHint) {
|
|
248
|
+
if (!process.stdin.isTTY) {
|
|
249
|
+
throw new Error(
|
|
250
|
+
`Cannot prompt in non-interactive mode. Provide ${missingFlagHint} via CLI flags or environment variables.`
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
function getCurrentProjectPath() {
|
|
255
|
+
return process.env.INIT_CWD || process.cwd();
|
|
256
|
+
}
|
|
257
|
+
var ContractAppStatusStarted = 1;
|
|
258
|
+
var ContractAppStatusStopped = 2;
|
|
259
|
+
var ContractAppStatusTerminated = 3;
|
|
260
|
+
var ContractAppStatusSuspended = 4;
|
|
261
|
+
function getContractStatusString(status) {
|
|
262
|
+
switch (status) {
|
|
263
|
+
case ContractAppStatusStarted:
|
|
264
|
+
return "Started";
|
|
265
|
+
case ContractAppStatusStopped:
|
|
266
|
+
return "Stopped";
|
|
267
|
+
case ContractAppStatusTerminated:
|
|
268
|
+
return "Terminated";
|
|
269
|
+
case ContractAppStatusSuspended:
|
|
270
|
+
return "Suspended";
|
|
271
|
+
default:
|
|
272
|
+
return "Unknown";
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
function getStatusPriority(status, isExited) {
|
|
276
|
+
if (isExited) {
|
|
277
|
+
return 1;
|
|
278
|
+
}
|
|
279
|
+
switch (status) {
|
|
280
|
+
case ContractAppStatusStarted:
|
|
281
|
+
return 0;
|
|
282
|
+
case ContractAppStatusStopped:
|
|
283
|
+
return 2;
|
|
284
|
+
case ContractAppStatusTerminated:
|
|
285
|
+
return 3;
|
|
286
|
+
default:
|
|
287
|
+
return 4;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
function formatAppDisplay(environmentName, appID, profileName) {
|
|
291
|
+
if (profileName) {
|
|
292
|
+
return `${profileName} (${environmentName}:${appID})`;
|
|
293
|
+
}
|
|
294
|
+
return `${environmentName}:${appID}`;
|
|
295
|
+
}
|
|
296
|
+
async function getOrPromptAppID(appIDOrOptions, environment) {
|
|
297
|
+
let options;
|
|
298
|
+
if (environment !== void 0) {
|
|
299
|
+
options = {
|
|
300
|
+
appID: appIDOrOptions,
|
|
301
|
+
environment
|
|
302
|
+
};
|
|
303
|
+
} else if (appIDOrOptions && typeof appIDOrOptions === "object" && "environment" in appIDOrOptions) {
|
|
304
|
+
options = appIDOrOptions;
|
|
305
|
+
} else {
|
|
306
|
+
options = {
|
|
307
|
+
appID: appIDOrOptions,
|
|
308
|
+
environment: "sepolia"
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
if (options.appID) {
|
|
312
|
+
const normalized = typeof options.appID === "string" ? addHexPrefix2(options.appID) : options.appID;
|
|
313
|
+
if (isAddress2(normalized)) {
|
|
314
|
+
return normalized;
|
|
315
|
+
}
|
|
316
|
+
const profileCache = getProfileCache(options.environment);
|
|
317
|
+
if (profileCache) {
|
|
318
|
+
const searchName = options.appID.toLowerCase();
|
|
319
|
+
for (const [appId, name] of Object.entries(profileCache)) {
|
|
320
|
+
if (name.toLowerCase() === searchName) {
|
|
321
|
+
return appId;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
const apps = listApps(options.environment);
|
|
326
|
+
const foundAppID = apps[options.appID];
|
|
327
|
+
if (foundAppID) {
|
|
328
|
+
return addHexPrefix2(foundAppID);
|
|
329
|
+
}
|
|
330
|
+
throw new Error(
|
|
331
|
+
`App name '${options.appID}' not found in environment '${options.environment}'. Name lookup uses a local cache that may be stale. Try using the app ID (0x...) directly, or run 'ecloud compute app list' to refresh the cache.`
|
|
332
|
+
);
|
|
333
|
+
}
|
|
334
|
+
ensureInteractive("app-id argument");
|
|
335
|
+
return getAppIDInteractive(options);
|
|
336
|
+
}
|
|
337
|
+
async function getAppIDInteractive(options) {
|
|
338
|
+
const action = options.action || "view";
|
|
339
|
+
const environment = options.environment || "sepolia";
|
|
340
|
+
const environmentConfig = getEnvironmentConfig2(environment);
|
|
341
|
+
if (!options.privateKey || !options.rpcUrl) {
|
|
342
|
+
return getAppIDInteractiveFromRegistry(environment, action);
|
|
343
|
+
}
|
|
344
|
+
console.log(`
|
|
345
|
+
Select an app to ${action}:
|
|
346
|
+
`);
|
|
347
|
+
const privateKeyHex = addHexPrefix2(options.privateKey);
|
|
348
|
+
const account = privateKeyToAccount3(privateKeyHex);
|
|
349
|
+
const developerAddr = account.address;
|
|
350
|
+
const { publicClient, walletClient } = createViemClients({
|
|
351
|
+
privateKey: options.privateKey,
|
|
352
|
+
rpcUrl: options.rpcUrl,
|
|
353
|
+
environment
|
|
354
|
+
});
|
|
355
|
+
const { apps, appConfigs } = await getAllAppsByDeveloper2(
|
|
356
|
+
publicClient,
|
|
357
|
+
environmentConfig,
|
|
358
|
+
developerAddr
|
|
359
|
+
);
|
|
360
|
+
if (apps.length === 0) {
|
|
361
|
+
throw new Error("no apps found for your address");
|
|
362
|
+
}
|
|
363
|
+
const profileNames = {};
|
|
364
|
+
let cachedProfiles = getProfileCache(environment);
|
|
365
|
+
if (!cachedProfiles) {
|
|
366
|
+
try {
|
|
367
|
+
const userApiClient = new UserApiClient2(environmentConfig, walletClient, publicClient, {
|
|
368
|
+
clientId: getClientId()
|
|
369
|
+
});
|
|
370
|
+
const appInfos = await getAppInfosChunked(userApiClient, apps);
|
|
371
|
+
const freshProfiles = {};
|
|
372
|
+
for (const info of appInfos) {
|
|
373
|
+
if (info.profile?.name) {
|
|
374
|
+
const normalizedId = String(info.address).toLowerCase();
|
|
375
|
+
freshProfiles[normalizedId] = info.profile.name;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
setProfileCache(environment, freshProfiles);
|
|
379
|
+
cachedProfiles = freshProfiles;
|
|
380
|
+
} catch {
|
|
381
|
+
cachedProfiles = {};
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
for (const [appId, name] of Object.entries(cachedProfiles)) {
|
|
385
|
+
profileNames[appId.toLowerCase()] = name;
|
|
386
|
+
}
|
|
387
|
+
const localApps = listApps(environment);
|
|
388
|
+
for (const [name, appID] of Object.entries(localApps)) {
|
|
389
|
+
const normalizedID = String(appID).toLowerCase();
|
|
390
|
+
if (!profileNames[normalizedID]) {
|
|
391
|
+
profileNames[normalizedID] = name;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
const isEligible = (status) => {
|
|
395
|
+
switch (action) {
|
|
396
|
+
case "view":
|
|
397
|
+
case "view info for":
|
|
398
|
+
case "view releases for":
|
|
399
|
+
case "set profile for":
|
|
400
|
+
return true;
|
|
401
|
+
case "start":
|
|
402
|
+
return status === ContractAppStatusStopped || status === ContractAppStatusSuspended;
|
|
403
|
+
case "stop":
|
|
404
|
+
return status === ContractAppStatusStarted;
|
|
405
|
+
default:
|
|
406
|
+
return status !== ContractAppStatusTerminated && status !== ContractAppStatusSuspended;
|
|
407
|
+
}
|
|
408
|
+
};
|
|
409
|
+
const appItems = [];
|
|
410
|
+
for (let i = 0; i < apps.length; i++) {
|
|
411
|
+
const appAddr = apps[i];
|
|
412
|
+
const config = appConfigs[i];
|
|
413
|
+
const status = config.status;
|
|
414
|
+
if (!isEligible(status)) {
|
|
415
|
+
continue;
|
|
416
|
+
}
|
|
417
|
+
const statusStr = getContractStatusString(status);
|
|
418
|
+
const profileName = profileNames[String(appAddr).toLowerCase()] || "";
|
|
419
|
+
const displayName = formatAppDisplay(environmentConfig.name, appAddr, profileName);
|
|
420
|
+
appItems.push({
|
|
421
|
+
addr: appAddr,
|
|
422
|
+
display: `${displayName} - ${statusStr}`,
|
|
423
|
+
status,
|
|
424
|
+
index: i
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
const linkedAppId = getLinkedAppForDirectory(environment, getCurrentProjectPath());
|
|
428
|
+
const normalizedLinkedAppId = linkedAppId ? linkedAppId.toLowerCase() : "";
|
|
429
|
+
appItems.sort((a, b) => {
|
|
430
|
+
if (normalizedLinkedAppId) {
|
|
431
|
+
const aLinked = String(a.addr).toLowerCase() === normalizedLinkedAppId;
|
|
432
|
+
const bLinked = String(b.addr).toLowerCase() === normalizedLinkedAppId;
|
|
433
|
+
if (aLinked && !bLinked) {
|
|
434
|
+
return -1;
|
|
435
|
+
}
|
|
436
|
+
if (bLinked && !aLinked) {
|
|
437
|
+
return 1;
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
const aPriority = getStatusPriority(a.status, false);
|
|
441
|
+
const bPriority = getStatusPriority(b.status, false);
|
|
442
|
+
if (aPriority !== bPriority) {
|
|
443
|
+
return aPriority - bPriority;
|
|
444
|
+
}
|
|
445
|
+
return b.index - a.index;
|
|
446
|
+
});
|
|
447
|
+
if (appItems.length === 0) {
|
|
448
|
+
switch (action) {
|
|
449
|
+
case "start":
|
|
450
|
+
throw new Error("no startable apps found - only Stopped apps can be started");
|
|
451
|
+
case "stop":
|
|
452
|
+
throw new Error("no running apps found - only Running apps can be stopped");
|
|
453
|
+
default:
|
|
454
|
+
throw new Error("no active apps found");
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
const choices = appItems.map((item) => ({
|
|
458
|
+
name: item.display,
|
|
459
|
+
value: item.addr
|
|
460
|
+
}));
|
|
461
|
+
const selected = await select({
|
|
462
|
+
message: "Select app:",
|
|
463
|
+
choices
|
|
464
|
+
});
|
|
465
|
+
return selected;
|
|
466
|
+
}
|
|
467
|
+
async function getAppIDInteractiveFromRegistry(environment, action) {
|
|
468
|
+
const allApps = {};
|
|
469
|
+
const cachedProfiles = getProfileCache(environment);
|
|
470
|
+
if (cachedProfiles) {
|
|
471
|
+
for (const [appId, name] of Object.entries(cachedProfiles)) {
|
|
472
|
+
allApps[name] = appId;
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
const localApps = listApps(environment);
|
|
476
|
+
for (const [name, appId] of Object.entries(localApps)) {
|
|
477
|
+
if (!allApps[name]) {
|
|
478
|
+
allApps[name] = appId;
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
if (Object.keys(allApps).length === 0) {
|
|
482
|
+
console.log("\nNo apps found in registry.");
|
|
483
|
+
console.log("You can enter an app ID (address) or app name.");
|
|
484
|
+
console.log();
|
|
485
|
+
const appIDInput = await input({
|
|
486
|
+
message: "Enter app ID or name:",
|
|
487
|
+
default: "",
|
|
488
|
+
validate: (value) => {
|
|
489
|
+
if (!value) {
|
|
490
|
+
return "App ID or name cannot be empty";
|
|
491
|
+
}
|
|
492
|
+
const normalized2 = addHexPrefix2(value);
|
|
493
|
+
if (isAddress2(normalized2)) {
|
|
494
|
+
return true;
|
|
495
|
+
}
|
|
496
|
+
return "Invalid app ID address";
|
|
497
|
+
}
|
|
498
|
+
});
|
|
499
|
+
const normalized = addHexPrefix2(appIDInput);
|
|
500
|
+
if (isAddress2(normalized)) {
|
|
501
|
+
return normalized;
|
|
502
|
+
}
|
|
503
|
+
throw new Error(`Invalid app ID address: ${appIDInput}`);
|
|
504
|
+
}
|
|
505
|
+
const entries = Object.entries(allApps);
|
|
506
|
+
const linkedAppId = getLinkedAppForDirectory(environment, getCurrentProjectPath());
|
|
507
|
+
if (linkedAppId) {
|
|
508
|
+
const linkedIndex = entries.findIndex(
|
|
509
|
+
([, appId]) => String(appId).toLowerCase() === linkedAppId.toLowerCase()
|
|
510
|
+
);
|
|
511
|
+
if (linkedIndex > 0) {
|
|
512
|
+
const [linkedEntry] = entries.splice(linkedIndex, 1);
|
|
513
|
+
entries.unshift(linkedEntry);
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
const choices = entries.map(([name, appID]) => {
|
|
517
|
+
const displayName = `${name} (${appID})`;
|
|
518
|
+
return { name: displayName, value: appID };
|
|
519
|
+
});
|
|
520
|
+
choices.push({ name: "Enter custom app ID or name", value: "custom" });
|
|
521
|
+
console.log(`
|
|
522
|
+
Select an app to ${action}:`);
|
|
523
|
+
const selected = await select({
|
|
524
|
+
message: "Choose app:",
|
|
525
|
+
choices
|
|
526
|
+
});
|
|
527
|
+
if (selected === "custom") {
|
|
528
|
+
const appIDInput = await input({
|
|
529
|
+
message: "Enter app ID or name:",
|
|
530
|
+
default: "",
|
|
531
|
+
validate: (value) => {
|
|
532
|
+
if (!value) {
|
|
533
|
+
return "App ID or name cannot be empty";
|
|
534
|
+
}
|
|
535
|
+
const normalized2 = addHexPrefix2(value);
|
|
536
|
+
if (isAddress2(normalized2)) {
|
|
537
|
+
return true;
|
|
538
|
+
}
|
|
539
|
+
if (allApps[value]) {
|
|
540
|
+
return true;
|
|
541
|
+
}
|
|
542
|
+
return "Invalid app ID or name not found";
|
|
543
|
+
}
|
|
544
|
+
});
|
|
545
|
+
const normalized = addHexPrefix2(appIDInput);
|
|
546
|
+
if (isAddress2(normalized)) {
|
|
547
|
+
return normalized;
|
|
548
|
+
}
|
|
549
|
+
const foundAppID = allApps[appIDInput];
|
|
550
|
+
if (foundAppID) {
|
|
551
|
+
return addHexPrefix2(foundAppID);
|
|
552
|
+
}
|
|
553
|
+
throw new Error(`Failed to resolve app ID from input: ${appIDInput}`);
|
|
554
|
+
}
|
|
555
|
+
return addHexPrefix2(selected);
|
|
556
|
+
}
|
|
557
|
+
async function getPrivateKeyInteractive(privateKey) {
|
|
558
|
+
if (privateKey) {
|
|
559
|
+
if (!validatePrivateKeyFormat(privateKey)) {
|
|
560
|
+
throw new Error("Invalid private key format");
|
|
561
|
+
}
|
|
562
|
+
return privateKey;
|
|
563
|
+
}
|
|
564
|
+
const { getPrivateKeyWithSource } = await import("@layr-labs/ecloud-sdk");
|
|
565
|
+
const result = await getPrivateKeyWithSource({ privateKey: void 0 });
|
|
566
|
+
if (result) {
|
|
567
|
+
return result.key;
|
|
568
|
+
}
|
|
569
|
+
ensureInteractive("--private-key or ECLOUD_PRIVATE_KEY");
|
|
570
|
+
const key = await password({
|
|
571
|
+
message: "Enter private key:",
|
|
572
|
+
mask: true,
|
|
573
|
+
validate: (value) => {
|
|
574
|
+
if (!value.trim()) {
|
|
575
|
+
return "Private key is required";
|
|
576
|
+
}
|
|
577
|
+
if (!validatePrivateKeyFormat(value)) {
|
|
578
|
+
return "Invalid private key format (must be 64 hex characters, optionally prefixed with 0x)";
|
|
579
|
+
}
|
|
580
|
+
return true;
|
|
581
|
+
}
|
|
582
|
+
});
|
|
583
|
+
return key.trim();
|
|
584
|
+
}
|
|
585
|
+
async function getEnvironmentInteractive(environment) {
|
|
586
|
+
if (environment) {
|
|
587
|
+
getEnvironmentConfig2(environment);
|
|
588
|
+
return environment;
|
|
589
|
+
}
|
|
590
|
+
ensureInteractive("--environment or ECLOUD_ENV");
|
|
591
|
+
const availableEnvs = getAvailableEnvironments();
|
|
592
|
+
let defaultEnv;
|
|
593
|
+
const configDefaultEnv = getDefaultEnvironment();
|
|
594
|
+
if (configDefaultEnv && availableEnvs.includes(configDefaultEnv)) {
|
|
595
|
+
try {
|
|
596
|
+
getEnvironmentConfig2(configDefaultEnv);
|
|
597
|
+
defaultEnv = configDefaultEnv;
|
|
598
|
+
} catch {
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
const choices = [];
|
|
602
|
+
if (availableEnvs.includes("sepolia")) {
|
|
603
|
+
choices.push({ name: "sepolia - Ethereum Sepolia testnet", value: "sepolia" });
|
|
604
|
+
}
|
|
605
|
+
if (availableEnvs.includes("sepolia-dev")) {
|
|
606
|
+
choices.push({ name: "sepolia-dev - Ethereum Sepolia testnet (dev)", value: "sepolia-dev" });
|
|
607
|
+
}
|
|
608
|
+
if (availableEnvs.includes("mainnet-alpha")) {
|
|
609
|
+
choices.push({
|
|
610
|
+
name: "mainnet-alpha - Ethereum mainnet (\u26A0\uFE0F uses real funds)",
|
|
611
|
+
value: "mainnet-alpha"
|
|
612
|
+
});
|
|
613
|
+
}
|
|
614
|
+
if (choices.length === 0) {
|
|
615
|
+
throw new Error("No environments available in this build");
|
|
616
|
+
}
|
|
617
|
+
const env = await select({
|
|
618
|
+
message: "Select environment:",
|
|
619
|
+
choices,
|
|
620
|
+
default: defaultEnv
|
|
621
|
+
});
|
|
622
|
+
return env;
|
|
623
|
+
}
|
|
624
|
+
var MAX_IMAGE_SIZE = 4 * 1024 * 1024;
|
|
625
|
+
|
|
626
|
+
// src/flags.ts
|
|
627
|
+
import { formatEther, parseGwei } from "viem";
|
|
628
|
+
var commonFlags = {
|
|
629
|
+
environment: Flags.string({
|
|
630
|
+
required: false,
|
|
631
|
+
description: "Deployment environment to use",
|
|
632
|
+
env: "ECLOUD_ENV",
|
|
633
|
+
default: async () => getDefaultEnvironment() || (getBuildType2() === "dev" ? "sepolia-dev" : "mainnet-alpha")
|
|
634
|
+
}),
|
|
635
|
+
"private-key": Flags.string({
|
|
636
|
+
required: false,
|
|
637
|
+
description: "Private key for signing transactions",
|
|
638
|
+
env: "ECLOUD_PRIVATE_KEY"
|
|
639
|
+
}),
|
|
640
|
+
"rpc-url": Flags.string({
|
|
641
|
+
required: false,
|
|
642
|
+
description: "RPC URL to connect to blockchain",
|
|
643
|
+
env: "ECLOUD_RPC_URL"
|
|
644
|
+
}),
|
|
645
|
+
verbose: Flags.boolean({
|
|
646
|
+
required: false,
|
|
647
|
+
description: "Enable verbose logging (default: false)",
|
|
648
|
+
default: false
|
|
649
|
+
}),
|
|
650
|
+
"max-fee-per-gas": Flags.string({
|
|
651
|
+
required: false,
|
|
652
|
+
description: "Override max fee per gas in gwei (e.g., 50)",
|
|
653
|
+
env: "ECLOUD_MAX_FEE_PER_GAS"
|
|
654
|
+
}),
|
|
655
|
+
"max-priority-fee": Flags.string({
|
|
656
|
+
required: false,
|
|
657
|
+
description: "Override max priority fee per gas in gwei (e.g., 5)",
|
|
658
|
+
env: "ECLOUD_MAX_PRIORITY_FEE"
|
|
659
|
+
}),
|
|
660
|
+
nonce: Flags.string({
|
|
661
|
+
required: false,
|
|
662
|
+
description: 'Override transaction nonce (integer or "latest" to replace a stuck transaction)'
|
|
663
|
+
}),
|
|
664
|
+
"non-interactive": Flags.boolean({
|
|
665
|
+
required: false,
|
|
666
|
+
description: "Assume non-interactive mode: default safe prompts and error all-at-once on missing required inputs",
|
|
667
|
+
env: "ECLOUD_NON_INTERACTIVE",
|
|
668
|
+
default: false
|
|
669
|
+
})
|
|
670
|
+
};
|
|
671
|
+
async function validateCommonFlags(flags, options) {
|
|
672
|
+
flags["environment"] = await getEnvironmentInteractive(flags["environment"]);
|
|
673
|
+
if (options?.requirePrivateKey !== false) {
|
|
674
|
+
flags["private-key"] = await getPrivateKeyInteractive(flags["private-key"]);
|
|
675
|
+
}
|
|
676
|
+
return flags;
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
// src/client.ts
|
|
680
|
+
import {
|
|
681
|
+
createComputeModule,
|
|
682
|
+
createBillingModule,
|
|
683
|
+
createBuildModule,
|
|
684
|
+
createAdminModule,
|
|
685
|
+
getEnvironmentConfig as getEnvironmentConfig3,
|
|
686
|
+
requirePrivateKey
|
|
687
|
+
} from "@layr-labs/ecloud-sdk";
|
|
688
|
+
async function createComputeClient(flags, options = {}) {
|
|
689
|
+
flags = await validateCommonFlags(flags);
|
|
690
|
+
const environment = flags.environment;
|
|
691
|
+
const environmentConfig = getEnvironmentConfig3(environment);
|
|
692
|
+
const rpcUrl = flags["rpc-url"] || environmentConfig.defaultRPCURL;
|
|
693
|
+
const { key: privateKey, source } = await requirePrivateKey({
|
|
694
|
+
privateKey: flags["private-key"]
|
|
695
|
+
});
|
|
696
|
+
if (flags.verbose) {
|
|
697
|
+
console.log(`Using private key from: ${source}`);
|
|
698
|
+
}
|
|
699
|
+
const { walletClient, publicClient } = createViemClients({
|
|
700
|
+
privateKey,
|
|
701
|
+
rpcUrl,
|
|
702
|
+
environment
|
|
703
|
+
});
|
|
704
|
+
return createComputeModule({
|
|
705
|
+
verbose: flags.verbose,
|
|
706
|
+
walletClient,
|
|
707
|
+
publicClient,
|
|
708
|
+
environment,
|
|
709
|
+
clientId: getClientId(),
|
|
710
|
+
skipTelemetry: true,
|
|
711
|
+
// CLI already has telemetry, skip SDK telemetry
|
|
712
|
+
logger: options.logger
|
|
713
|
+
});
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
// src/commands/compute/app/status.ts
|
|
717
|
+
import chalk2 from "chalk";
|
|
718
|
+
var AppStatus = class _AppStatus extends Command {
|
|
719
|
+
static description = "Show an app's current status. Use --wait to block until it settles instead of polling `app info` in a loop.";
|
|
720
|
+
static examples = [
|
|
721
|
+
"<%= config.bin %> compute app status 0xabc...",
|
|
722
|
+
"<%= config.bin %> compute app status 0xabc... --json",
|
|
723
|
+
"<%= config.bin %> compute app status 0xabc... --wait",
|
|
724
|
+
"ECLOUD_WATCH_TIMEOUT_SECONDS=120 <%= config.bin %> compute app status 0xabc... --wait"
|
|
725
|
+
];
|
|
726
|
+
static args = {
|
|
727
|
+
"app-id": Args.string({
|
|
728
|
+
description: "App ID or name (env: ECLOUD_APP_ID)",
|
|
729
|
+
required: false
|
|
730
|
+
})
|
|
731
|
+
};
|
|
732
|
+
static flags = {
|
|
733
|
+
...commonFlags,
|
|
734
|
+
wait: Flags2.boolean({
|
|
735
|
+
description: "Block until the app reaches a terminal status (Running/Stopped) or the watch timeout elapses, instead of returning immediately",
|
|
736
|
+
default: false
|
|
737
|
+
}),
|
|
738
|
+
"watch-timeout": Flags2.integer({
|
|
739
|
+
description: "With --wait: maximum seconds to wait before returning a recovery hint (default: 600)",
|
|
740
|
+
env: "ECLOUD_WATCH_TIMEOUT_SECONDS"
|
|
741
|
+
}),
|
|
742
|
+
json: Flags2.boolean({
|
|
743
|
+
description: "Output machine-readable JSON ({ appId, status })",
|
|
744
|
+
default: false
|
|
745
|
+
})
|
|
746
|
+
};
|
|
747
|
+
async run() {
|
|
748
|
+
const { args, flags } = await this.parse(_AppStatus);
|
|
749
|
+
const validatedFlags = await validateCommonFlags(flags);
|
|
750
|
+
const environment = validatedFlags.environment;
|
|
751
|
+
const environmentConfig = getEnvironmentConfig4(environment);
|
|
752
|
+
const rpcUrl = validatedFlags["rpc-url"] || environmentConfig.defaultRPCURL;
|
|
753
|
+
const privateKey = validatedFlags["private-key"];
|
|
754
|
+
const appID = await getOrPromptAppID({
|
|
755
|
+
appID: args["app-id"] ?? process.env.ECLOUD_APP_ID,
|
|
756
|
+
environment,
|
|
757
|
+
privateKey,
|
|
758
|
+
rpcUrl,
|
|
759
|
+
action: "check status of"
|
|
760
|
+
});
|
|
761
|
+
const { publicClient, walletClient } = createViemClients({
|
|
762
|
+
privateKey,
|
|
763
|
+
rpcUrl,
|
|
764
|
+
environment
|
|
765
|
+
});
|
|
766
|
+
const userApiClient = new UserApiClient3(environmentConfig, walletClient, publicClient, {
|
|
767
|
+
clientId: getClientId()
|
|
768
|
+
});
|
|
769
|
+
const initialStatus = await this.readStatus(userApiClient, appID);
|
|
770
|
+
if (flags.wait && isTransitionalStatus(initialStatus)) {
|
|
771
|
+
const compute = await createComputeClient(
|
|
772
|
+
validatedFlags,
|
|
773
|
+
flags.json ? { logger: stderrLogger } : {}
|
|
774
|
+
);
|
|
775
|
+
try {
|
|
776
|
+
await compute.app.watchDeployment(appID, {
|
|
777
|
+
timeoutSeconds: flags["watch-timeout"]
|
|
778
|
+
});
|
|
779
|
+
} catch (err) {
|
|
780
|
+
if (err instanceof WatchTimeoutError) {
|
|
781
|
+
if (!flags.json) {
|
|
782
|
+
this.warn(
|
|
783
|
+
`Timed out after ${err.elapsedSeconds}s waiting for ${appID}. Check 'ecloud compute app info ${appID}' or the orchestrator logs.`
|
|
784
|
+
);
|
|
785
|
+
}
|
|
786
|
+
} else {
|
|
787
|
+
throw err;
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
const finalStatus = await this.readStatus(userApiClient, appID);
|
|
791
|
+
this.emit(appID, finalStatus, flags.json);
|
|
792
|
+
return;
|
|
793
|
+
}
|
|
794
|
+
this.emit(appID, initialStatus, flags.json);
|
|
795
|
+
}
|
|
796
|
+
/** Fetch the current status for an app, defaulting to "Unknown". */
|
|
797
|
+
async readStatus(userApiClient, appID) {
|
|
798
|
+
const statuses = await userApiClient.getStatuses([appID]);
|
|
799
|
+
return statuses[0]?.status || "Unknown";
|
|
800
|
+
}
|
|
801
|
+
/** Write the status as JSON (machine-readable) or a formatted line. */
|
|
802
|
+
emit(appID, status, json) {
|
|
803
|
+
if (json) {
|
|
804
|
+
this.log(JSON.stringify({ appId: appID, status }));
|
|
805
|
+
return;
|
|
806
|
+
}
|
|
807
|
+
this.log(`${chalk2.bold(appID)}: ${formatStatus(status)}`);
|
|
808
|
+
}
|
|
809
|
+
};
|
|
810
|
+
var TRANSITIONAL_STATUSES = /* @__PURE__ */ new Set([
|
|
811
|
+
"created",
|
|
812
|
+
"deploying",
|
|
813
|
+
"upgrading",
|
|
814
|
+
"resuming",
|
|
815
|
+
"stopping",
|
|
816
|
+
"terminating"
|
|
817
|
+
]);
|
|
818
|
+
function isTransitionalStatus(status) {
|
|
819
|
+
return TRANSITIONAL_STATUSES.has(status.toLowerCase());
|
|
820
|
+
}
|
|
821
|
+
var stderrLogger = {
|
|
822
|
+
debug: (...args) => console.error(...args),
|
|
823
|
+
info: (...args) => console.error(...args),
|
|
824
|
+
warn: (...args) => console.error(...args),
|
|
825
|
+
error: (...args) => console.error(...args)
|
|
826
|
+
};
|
|
827
|
+
function formatStatus(status) {
|
|
828
|
+
switch (status.toLowerCase()) {
|
|
829
|
+
case "running":
|
|
830
|
+
case "started":
|
|
831
|
+
return chalk2.green(status);
|
|
832
|
+
case "failed":
|
|
833
|
+
case "terminated":
|
|
834
|
+
return chalk2.red(status);
|
|
835
|
+
case "stopped":
|
|
836
|
+
case "suspended":
|
|
837
|
+
return chalk2.yellow(status);
|
|
838
|
+
default:
|
|
839
|
+
return status;
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
export {
|
|
843
|
+
AppStatus as default
|
|
844
|
+
};
|
|
845
|
+
//# sourceMappingURL=status.js.map
|