openxgen 0.5.0 → 0.6.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/dist/index.js +250 -83
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -12,23 +12,29 @@ var __export = (target, all) => {
|
|
|
12
12
|
// src/config/store.ts
|
|
13
13
|
var store_exports = {};
|
|
14
14
|
__export(store_exports, {
|
|
15
|
+
addEnvironment: () => addEnvironment,
|
|
15
16
|
addProvider: () => addProvider,
|
|
16
17
|
clearAuth: () => clearAuth,
|
|
17
18
|
getAccessToken: () => getAccessToken,
|
|
19
|
+
getActiveEnvironment: () => getActiveEnvironment,
|
|
18
20
|
getAuth: () => getAuth,
|
|
19
21
|
getConfig: () => getConfig,
|
|
20
22
|
getDefaultProvider: () => getDefaultProvider,
|
|
23
|
+
getEnvStore: () => getEnvStore,
|
|
24
|
+
getEnvironments: () => getEnvironments,
|
|
21
25
|
getProviders: () => getProviders,
|
|
22
26
|
getProvidersStore: () => getProvidersStore,
|
|
23
27
|
getRefreshToken: () => getRefreshToken,
|
|
24
28
|
getServer: () => getServer,
|
|
29
|
+
removeEnvironment: () => removeEnvironment,
|
|
25
30
|
removeProvider: () => removeProvider,
|
|
26
31
|
requireAuth: () => requireAuth,
|
|
27
32
|
requireServer: () => requireServer,
|
|
28
33
|
setAuth: () => setAuth,
|
|
29
34
|
setConfig: () => setConfig,
|
|
30
35
|
setDefaultProvider: () => setDefaultProvider,
|
|
31
|
-
setServer: () => setServer
|
|
36
|
+
setServer: () => setServer,
|
|
37
|
+
switchEnvironment: () => switchEnvironment
|
|
32
38
|
});
|
|
33
39
|
import { existsSync, mkdirSync, readFileSync, writeFileSync, chmodSync } from "fs";
|
|
34
40
|
import { homedir } from "os";
|
|
@@ -121,6 +127,41 @@ function setDefaultProvider(id) {
|
|
|
121
127
|
writeJson(PROVIDERS_FILE, store, true);
|
|
122
128
|
return true;
|
|
123
129
|
}
|
|
130
|
+
function getEnvStore() {
|
|
131
|
+
return { ...DEFAULT_ENV_STORE, ...readJson(ENVIRONMENTS_FILE, DEFAULT_ENV_STORE) };
|
|
132
|
+
}
|
|
133
|
+
function getEnvironments() {
|
|
134
|
+
return getEnvStore().environments;
|
|
135
|
+
}
|
|
136
|
+
function addEnvironment(env) {
|
|
137
|
+
const store = getEnvStore();
|
|
138
|
+
store.environments = store.environments.filter((e) => e.id !== env.id);
|
|
139
|
+
store.environments.push(env);
|
|
140
|
+
if (!store.activeId) store.activeId = env.id;
|
|
141
|
+
writeJson(ENVIRONMENTS_FILE, store);
|
|
142
|
+
}
|
|
143
|
+
function removeEnvironment(id) {
|
|
144
|
+
const store = getEnvStore();
|
|
145
|
+
const before = store.environments.length;
|
|
146
|
+
store.environments = store.environments.filter((e) => e.id !== id);
|
|
147
|
+
if (store.activeId === id) store.activeId = store.environments[0]?.id ?? null;
|
|
148
|
+
writeJson(ENVIRONMENTS_FILE, store);
|
|
149
|
+
return store.environments.length < before;
|
|
150
|
+
}
|
|
151
|
+
function switchEnvironment(id) {
|
|
152
|
+
const store = getEnvStore();
|
|
153
|
+
const env = store.environments.find((e) => e.id === id);
|
|
154
|
+
if (!env) return false;
|
|
155
|
+
store.activeId = id;
|
|
156
|
+
writeJson(ENVIRONMENTS_FILE, store);
|
|
157
|
+
setServer(env.url);
|
|
158
|
+
return true;
|
|
159
|
+
}
|
|
160
|
+
function getActiveEnvironment() {
|
|
161
|
+
const store = getEnvStore();
|
|
162
|
+
if (!store.activeId) return null;
|
|
163
|
+
return store.environments.find((e) => e.id === store.activeId) ?? null;
|
|
164
|
+
}
|
|
124
165
|
function requireServer() {
|
|
125
166
|
const server = getServer();
|
|
126
167
|
if (!server) {
|
|
@@ -139,7 +180,7 @@ function requireAuth() {
|
|
|
139
180
|
}
|
|
140
181
|
return auth;
|
|
141
182
|
}
|
|
142
|
-
var XGEN_DIR, CONFIG_FILE, AUTH_FILE, PROVIDERS_FILE, DEFAULT_CONFIG, DEFAULT_PROVIDERS;
|
|
183
|
+
var XGEN_DIR, CONFIG_FILE, AUTH_FILE, PROVIDERS_FILE, DEFAULT_CONFIG, DEFAULT_PROVIDERS, ENVIRONMENTS_FILE, DEFAULT_ENV_STORE;
|
|
143
184
|
var init_store = __esm({
|
|
144
185
|
"src/config/store.ts"() {
|
|
145
186
|
"use strict";
|
|
@@ -154,6 +195,8 @@ var init_store = __esm({
|
|
|
154
195
|
streamLogs: false
|
|
155
196
|
};
|
|
156
197
|
DEFAULT_PROVIDERS = { providers: [], defaultId: null };
|
|
198
|
+
ENVIRONMENTS_FILE = join(XGEN_DIR, "environments.json");
|
|
199
|
+
DEFAULT_ENV_STORE = { environments: [], activeId: null };
|
|
157
200
|
}
|
|
158
201
|
});
|
|
159
202
|
|
|
@@ -343,7 +386,7 @@ async function getWorkflowDetail(workflowId) {
|
|
|
343
386
|
async function getWorkflowListDetail() {
|
|
344
387
|
const client2 = getClient();
|
|
345
388
|
const res = await client2.get("/api/workflow/list/detail");
|
|
346
|
-
return res.data;
|
|
389
|
+
return res.data.workflows ?? res.data;
|
|
347
390
|
}
|
|
348
391
|
async function executeWorkflowStream(request) {
|
|
349
392
|
const client2 = getClient();
|
|
@@ -379,66 +422,6 @@ var init_workflow = __esm({
|
|
|
379
422
|
}
|
|
380
423
|
});
|
|
381
424
|
|
|
382
|
-
// src/commands/workflow/list.ts
|
|
383
|
-
var list_exports = {};
|
|
384
|
-
__export(list_exports, {
|
|
385
|
-
workflowList: () => workflowList
|
|
386
|
-
});
|
|
387
|
-
import chalk4 from "chalk";
|
|
388
|
-
async function workflowList(opts) {
|
|
389
|
-
requireAuth();
|
|
390
|
-
try {
|
|
391
|
-
if (opts.detail) {
|
|
392
|
-
const workflows = await getWorkflowListDetail();
|
|
393
|
-
if (!workflows || workflows.length === 0) {
|
|
394
|
-
console.log(chalk4.yellow("\n\uC6CC\uD06C\uD50C\uB85C\uC6B0\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.\n"));
|
|
395
|
-
return;
|
|
396
|
-
}
|
|
397
|
-
printHeader(`\uC6CC\uD06C\uD50C\uB85C\uC6B0 \uBAA9\uB85D (${workflows.length}\uAC1C)`);
|
|
398
|
-
console.log();
|
|
399
|
-
printTable(
|
|
400
|
-
["#", "ID", "\uC774\uB984", "\uBC30\uD3EC", "\uC5C5\uB370\uC774\uD2B8"],
|
|
401
|
-
workflows.map((w, i) => [
|
|
402
|
-
String(i + 1),
|
|
403
|
-
(w.workflow_id ?? w.id ?? "-").slice(0, 12),
|
|
404
|
-
truncate(w.workflow_name ?? "-", 30),
|
|
405
|
-
w.deploy_status === "deployed" ? chalk4.green("\uBC30\uD3EC\uB428") : chalk4.gray("\uBBF8\uBC30\uD3EC"),
|
|
406
|
-
formatDate(w.updated_at)
|
|
407
|
-
])
|
|
408
|
-
);
|
|
409
|
-
} else {
|
|
410
|
-
const workflows = await listWorkflows();
|
|
411
|
-
if (!workflows || workflows.length === 0) {
|
|
412
|
-
console.log(chalk4.yellow("\n\uC6CC\uD06C\uD50C\uB85C\uC6B0\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.\n"));
|
|
413
|
-
return;
|
|
414
|
-
}
|
|
415
|
-
printHeader(`\uC6CC\uD06C\uD50C\uB85C\uC6B0 \uBAA9\uB85D (${workflows.length}\uAC1C)`);
|
|
416
|
-
console.log();
|
|
417
|
-
printTable(
|
|
418
|
-
["#", "ID", "\uC774\uB984"],
|
|
419
|
-
workflows.map((w, i) => [
|
|
420
|
-
String(i + 1),
|
|
421
|
-
(w.workflow_id ?? w.id ?? "-").slice(0, 12),
|
|
422
|
-
w.workflow_name ?? "-"
|
|
423
|
-
])
|
|
424
|
-
);
|
|
425
|
-
}
|
|
426
|
-
console.log();
|
|
427
|
-
} catch (err) {
|
|
428
|
-
const msg = err.message;
|
|
429
|
-
printError(`\uC6CC\uD06C\uD50C\uB85C\uC6B0 \uBAA9\uB85D \uC870\uD68C \uC2E4\uD328: ${msg}`);
|
|
430
|
-
process.exit(1);
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
var init_list = __esm({
|
|
434
|
-
"src/commands/workflow/list.ts"() {
|
|
435
|
-
"use strict";
|
|
436
|
-
init_store();
|
|
437
|
-
init_workflow();
|
|
438
|
-
init_format();
|
|
439
|
-
}
|
|
440
|
-
});
|
|
441
|
-
|
|
442
425
|
// src/utils/sse.ts
|
|
443
426
|
async function parseSSEStream(stream, onEvent, onDone, onError) {
|
|
444
427
|
let buffer = "";
|
|
@@ -1980,10 +1963,17 @@ function showStatus() {
|
|
|
1980
1963
|
const provider = getDefaultProvider();
|
|
1981
1964
|
const server = getServer();
|
|
1982
1965
|
const auth = getAuth();
|
|
1966
|
+
const activeEnv = getActiveEnvironment();
|
|
1967
|
+
const envs = getEnvironments();
|
|
1983
1968
|
console.log(divider("\uC0C1\uD0DC"));
|
|
1984
1969
|
console.log();
|
|
1985
1970
|
console.log(provider ? statusDot(true, chalk12.bold("AI \uC5D0\uC774\uC804\uD2B8"), `${provider.name} \xB7 ${provider.model}`) : statusDot(false, "AI \uC5D0\uC774\uC804\uD2B8", "\uBBF8\uC124\uC815"));
|
|
1986
1971
|
console.log(server && auth ? statusDot(true, chalk12.bold("XGEN \uC11C\uBC84"), `${auth.username} \xB7 ${server.replace("https://", "")}`) : server ? statusDot(false, "XGEN \uC11C\uBC84", `${server.replace("https://", "")} \xB7 \uB85C\uADF8\uC778 \uD544\uC694`) : statusDot(false, "XGEN \uC11C\uBC84", "\uBBF8\uC5F0\uACB0"));
|
|
1972
|
+
if (activeEnv) {
|
|
1973
|
+
console.log(statusDot(true, chalk12.bold("\uD658\uACBD"), `${activeEnv.name} (${envs.length}\uAC1C \uB4F1\uB85D)`));
|
|
1974
|
+
} else if (envs.length > 0) {
|
|
1975
|
+
console.log(statusDot(false, "\uD658\uACBD", `${envs.length}\uAC1C \uB4F1\uB85D`));
|
|
1976
|
+
}
|
|
1987
1977
|
console.log();
|
|
1988
1978
|
}
|
|
1989
1979
|
async function homeMenu() {
|
|
@@ -2019,26 +2009,40 @@ async function homeMenu() {
|
|
|
2019
2009
|
});
|
|
2020
2010
|
items.push({
|
|
2021
2011
|
key: "w",
|
|
2022
|
-
label: "\uC6CC\uD06C\uD50C\uB85C\uC6B0 \
|
|
2023
|
-
hint: "\
|
|
2024
|
-
action: async () => {
|
|
2025
|
-
const { workflowList: workflowList2 } = await Promise.resolve().then(() => (init_list(), list_exports));
|
|
2026
|
-
await workflowList2({ detail: true });
|
|
2027
|
-
}
|
|
2028
|
-
});
|
|
2029
|
-
items.push({
|
|
2030
|
-
key: "r",
|
|
2031
|
-
label: "\uC6CC\uD06C\uD50C\uB85C\uC6B0 \uC2E4\uD589",
|
|
2032
|
-
hint: "ID \uC785\uB825 \u2192 \uC2E4\uD589",
|
|
2012
|
+
label: "\uC6CC\uD06C\uD50C\uB85C\uC6B0 \uAD00\uB9AC",
|
|
2013
|
+
hint: "\uBAA9\uB85D \uC870\uD68C \u2192 \uC120\uD0DD \u2192 \uC2E4\uD589/\uC815\uBCF4",
|
|
2033
2014
|
action: async () => {
|
|
2034
|
-
const {
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2015
|
+
const { listWorkflows: listWorkflows2 } = await Promise.resolve().then(() => (init_workflow(), workflow_exports));
|
|
2016
|
+
const wfs = await listWorkflows2();
|
|
2017
|
+
if (!wfs.length) {
|
|
2018
|
+
console.log(chalk12.yellow("\n \uC6CC\uD06C\uD50C\uB85C\uC6B0\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.\n"));
|
|
2019
|
+
return;
|
|
2020
|
+
}
|
|
2021
|
+
console.log(chalk12.bold(`
|
|
2022
|
+
\uC6CC\uD06C\uD50C\uB85C\uC6B0 (${wfs.length}\uAC1C)
|
|
2023
|
+
`));
|
|
2024
|
+
wfs.forEach((w, i) => {
|
|
2025
|
+
const id = (w.workflow_id ?? w.id ?? "").toString();
|
|
2026
|
+
const deployed = w.is_deployed;
|
|
2027
|
+
const tag = deployed ? chalk12.green(" [\uBC30\uD3EC]") : "";
|
|
2028
|
+
console.log(` ${chalk12.cyan(`${String(i + 1).padStart(3)}.`)} ${w.workflow_name}${tag}`);
|
|
2029
|
+
console.log(` ${chalk12.gray(id)}`);
|
|
2030
|
+
});
|
|
2031
|
+
console.log();
|
|
2032
|
+
console.log(chalk12.gray(" \uBC88\uD638 \uC785\uB825 \u2192 \uC2E4\uD589 / Enter \u2192 \uB3CC\uC544\uAC00\uAE30"));
|
|
2033
|
+
const choice2 = await ask(chalk12.cyan("\n \u276F "));
|
|
2034
|
+
if (!choice2) return;
|
|
2035
|
+
const wi = parseInt(choice2) - 1;
|
|
2036
|
+
if (wi < 0 || wi >= wfs.length) return;
|
|
2037
|
+
const selected2 = wfs[wi];
|
|
2038
|
+
const wfId = (selected2.workflow_id ?? selected2.id ?? "").toString();
|
|
2039
|
+
console.log(chalk12.green(`
|
|
2040
|
+
\u2713 ${selected2.workflow_name}
|
|
2041
|
+
`));
|
|
2042
|
+
const input = await ask(chalk12.white(" \uBA54\uC2DC\uC9C0: "));
|
|
2039
2043
|
if (!input) return;
|
|
2040
2044
|
const { workflowRun: workflowRun2 } = await Promise.resolve().then(() => (init_run(), run_exports));
|
|
2041
|
-
await workflowRun2(
|
|
2045
|
+
await workflowRun2(wfId, input, { logs: false, interactive: false });
|
|
2042
2046
|
}
|
|
2043
2047
|
});
|
|
2044
2048
|
items.push({
|
|
@@ -2138,6 +2142,15 @@ async function homeMenu() {
|
|
|
2138
2142
|
showStatus();
|
|
2139
2143
|
}
|
|
2140
2144
|
});
|
|
2145
|
+
items.push({
|
|
2146
|
+
key: "e",
|
|
2147
|
+
label: "\uD658\uACBD \uAD00\uB9AC",
|
|
2148
|
+
hint: `${getEnvironments().length}\uAC1C \uB4F1\uB85D \u2014 \uC11C\uBC84 \uC804\uD658`,
|
|
2149
|
+
action: async () => {
|
|
2150
|
+
await environmentMenu();
|
|
2151
|
+
showStatus();
|
|
2152
|
+
}
|
|
2153
|
+
});
|
|
2141
2154
|
console.log(divider("\uBA54\uB274"));
|
|
2142
2155
|
console.log();
|
|
2143
2156
|
if (hasServer) {
|
|
@@ -2154,7 +2167,7 @@ async function homeMenu() {
|
|
|
2154
2167
|
}
|
|
2155
2168
|
console.log();
|
|
2156
2169
|
console.log(chalk12.gray(" \uC124\uC815"));
|
|
2157
|
-
for (const item of items.filter((i) => ["s", "p"].includes(i.key))) {
|
|
2170
|
+
for (const item of items.filter((i) => ["s", "p", "e"].includes(i.key))) {
|
|
2158
2171
|
console.log(` ${chalk12.cyan.bold(item.key + ".")} ${item.label} ${chalk12.gray("\u2014 " + item.hint)}`);
|
|
2159
2172
|
}
|
|
2160
2173
|
console.log(` ${chalk12.gray("q. \uC885\uB8CC")}`);
|
|
@@ -2279,6 +2292,112 @@ async function providerMenu() {
|
|
|
2279
2292
|
}
|
|
2280
2293
|
}
|
|
2281
2294
|
}
|
|
2295
|
+
async function environmentMenu() {
|
|
2296
|
+
const envs = getEnvironments();
|
|
2297
|
+
const active = getActiveEnvironment();
|
|
2298
|
+
console.log();
|
|
2299
|
+
console.log(box(["\uD658\uACBD \uAD00\uB9AC \u2014 XGEN \uC11C\uBC84 \uD504\uB85C\uD544"]));
|
|
2300
|
+
console.log();
|
|
2301
|
+
if (envs.length > 0) {
|
|
2302
|
+
for (const e of envs) {
|
|
2303
|
+
const mark = e.id === active?.id ? chalk12.green("\u25CF ") : chalk12.gray(" ");
|
|
2304
|
+
console.log(` ${mark}${chalk12.bold(e.name)} ${chalk12.gray(e.url)}`);
|
|
2305
|
+
if (e.description) console.log(` ${chalk12.gray(e.description)}`);
|
|
2306
|
+
}
|
|
2307
|
+
console.log();
|
|
2308
|
+
} else {
|
|
2309
|
+
console.log(chalk12.gray(" \uB4F1\uB85D\uB41C \uD658\uACBD \uC5C6\uC74C\n"));
|
|
2310
|
+
}
|
|
2311
|
+
const opts = ["\uC0C8 \uD658\uACBD \uCD94\uAC00", "\uAE30\uBCF8 \uD504\uB9AC\uC14B \uB4F1\uB85D (\uBCF8\uC0AC/\uC81C\uC8FC/\uB86F\uB370\uBAB0)"];
|
|
2312
|
+
if (envs.length > 0) opts.push("\uD658\uACBD \uC804\uD658 + \uB85C\uADF8\uC778");
|
|
2313
|
+
if (envs.length > 0) opts.push("\uC0AD\uC81C");
|
|
2314
|
+
opts.push("\uB3CC\uC544\uAC00\uAE30");
|
|
2315
|
+
opts.forEach((o, i) => console.log(` ${chalk12.cyan(`${i + 1}.`)} ${o}`));
|
|
2316
|
+
console.log();
|
|
2317
|
+
const c = await ask(chalk12.cyan(" \u276F "));
|
|
2318
|
+
const ci = parseInt(c);
|
|
2319
|
+
if (ci === 1) {
|
|
2320
|
+
const name = await ask(chalk12.white(" \uC774\uB984: "));
|
|
2321
|
+
const url = await ask(chalk12.white(" URL: "));
|
|
2322
|
+
const email = await ask(chalk12.white(" \uC774\uBA54\uC77C (\uC120\uD0DD): "));
|
|
2323
|
+
const desc = await ask(chalk12.white(" \uC124\uBA85 (\uC120\uD0DD): "));
|
|
2324
|
+
if (name && url) {
|
|
2325
|
+
const id = name.toLowerCase().replace(/[^a-z0-9]/g, "-");
|
|
2326
|
+
addEnvironment({ id, name, url: url.replace(/\/+$/, ""), email: email || void 0, description: desc || void 0 });
|
|
2327
|
+
console.log(chalk12.green(`
|
|
2328
|
+
\u2713 ${name} \uCD94\uAC00\uB428
|
|
2329
|
+
`));
|
|
2330
|
+
}
|
|
2331
|
+
} else if (ci === 2) {
|
|
2332
|
+
const presets = [
|
|
2333
|
+
{ id: "hq", name: "\uBCF8\uC0AC (244)", url: "https://xgen.x2bee.com", email: "admin@plateer.com", description: "\uBCF8\uC0AC \uBC30\uD3EC \uD658\uACBD" },
|
|
2334
|
+
{ id: "jeju", name: "\uC81C\uC8FC (243)", url: "https://jeju-xgen.x2bee.com", email: "admin@plateer.com", description: "\uC81C\uC8FC \uC11C\uBC84" },
|
|
2335
|
+
{ id: "lotte", name: "\uB86F\uB370\uBAB0 (DGX)", url: "https://lotteimall-xgen.x2bee.com", description: "\uB86F\uB370\uBAB0 DGX Spark" }
|
|
2336
|
+
];
|
|
2337
|
+
console.log(chalk12.bold("\n \uAE30\uBCF8 \uD658\uACBD \uD504\uB9AC\uC14B:\n"));
|
|
2338
|
+
presets.forEach((p, i) => {
|
|
2339
|
+
console.log(` ${chalk12.cyan(`${i + 1}.`)} ${p.name} ${chalk12.gray(p.url)}`);
|
|
2340
|
+
});
|
|
2341
|
+
console.log(` ${chalk12.cyan(`${presets.length + 1}.`)} \uC804\uBD80 \uB4F1\uB85D`);
|
|
2342
|
+
console.log();
|
|
2343
|
+
const pc = await ask(chalk12.cyan(" \u276F "));
|
|
2344
|
+
const pi = parseInt(pc);
|
|
2345
|
+
if (pi === presets.length + 1) {
|
|
2346
|
+
for (const p of presets) addEnvironment(p);
|
|
2347
|
+
console.log(chalk12.green(` \u2713 ${presets.length}\uAC1C \uD658\uACBD \uB4F1\uB85D\uB428
|
|
2348
|
+
`));
|
|
2349
|
+
} else if (pi >= 1 && pi <= presets.length) {
|
|
2350
|
+
addEnvironment(presets[pi - 1]);
|
|
2351
|
+
console.log(chalk12.green(` \u2713 ${presets[pi - 1].name} \uB4F1\uB85D\uB428
|
|
2352
|
+
`));
|
|
2353
|
+
}
|
|
2354
|
+
} else if (opts[ci - 1] === "\uD658\uACBD \uC804\uD658 + \uB85C\uADF8\uC778") {
|
|
2355
|
+
console.log();
|
|
2356
|
+
envs.forEach((e, i) => {
|
|
2357
|
+
const mark = e.id === active?.id ? chalk12.green("\u25CF ") : " ";
|
|
2358
|
+
console.log(` ${mark}${chalk12.cyan(`${i + 1}.`)} ${e.name} ${chalk12.gray(e.url)}`);
|
|
2359
|
+
});
|
|
2360
|
+
console.log();
|
|
2361
|
+
const ei = parseInt(await ask(chalk12.cyan(" \u276F "))) - 1;
|
|
2362
|
+
if (ei >= 0 && ei < envs.length) {
|
|
2363
|
+
switchEnvironment(envs[ei].id);
|
|
2364
|
+
console.log(chalk12.green(`
|
|
2365
|
+
\u2713 ${envs[ei].name} \uC804\uD658\uB428 \u2192 ${envs[ei].url}`));
|
|
2366
|
+
if (envs[ei].email) {
|
|
2367
|
+
const pw = await ask(chalk12.white(` \uBE44\uBC00\uBC88\uD638 (${envs[ei].email}): `));
|
|
2368
|
+
if (pw) {
|
|
2369
|
+
try {
|
|
2370
|
+
const { apiLogin: apiLogin2 } = await Promise.resolve().then(() => (init_auth(), auth_exports));
|
|
2371
|
+
const { setAuth: setAuth2 } = await Promise.resolve().then(() => (init_store(), store_exports));
|
|
2372
|
+
const result = await apiLogin2(envs[ei].email, pw);
|
|
2373
|
+
if (result.success && result.access_token) {
|
|
2374
|
+
setAuth2({ accessToken: result.access_token, refreshToken: result.refresh_token ?? "", userId: result.user_id ?? "", username: result.username ?? "", isAdmin: false, expiresAt: null });
|
|
2375
|
+
console.log(chalk12.green(` \u2713 \uB85C\uADF8\uC778: ${result.username}
|
|
2376
|
+
`));
|
|
2377
|
+
} else {
|
|
2378
|
+
console.log(chalk12.red(` \u2717 ${result.message}
|
|
2379
|
+
`));
|
|
2380
|
+
}
|
|
2381
|
+
} catch (err) {
|
|
2382
|
+
console.log(chalk12.red(` \u2717 ${err.message}
|
|
2383
|
+
`));
|
|
2384
|
+
}
|
|
2385
|
+
}
|
|
2386
|
+
}
|
|
2387
|
+
console.log();
|
|
2388
|
+
}
|
|
2389
|
+
} else if (opts[ci - 1] === "\uC0AD\uC81C") {
|
|
2390
|
+
console.log();
|
|
2391
|
+
envs.forEach((e, i) => console.log(` ${chalk12.cyan(`${i + 1}.`)} ${e.name}`));
|
|
2392
|
+
console.log();
|
|
2393
|
+
const di = parseInt(await ask(chalk12.white(" \uC0AD\uC81C \uBC88\uD638: "))) - 1;
|
|
2394
|
+
if (di >= 0 && di < envs.length) {
|
|
2395
|
+
removeEnvironment(envs[di].id);
|
|
2396
|
+
console.log(chalk12.green(` \u2713 \uC0AD\uC81C: ${envs[di].name}
|
|
2397
|
+
`));
|
|
2398
|
+
}
|
|
2399
|
+
}
|
|
2400
|
+
}
|
|
2282
2401
|
var init_home = __esm({
|
|
2283
2402
|
"src/commands/home.ts"() {
|
|
2284
2403
|
"use strict";
|
|
@@ -2686,8 +2805,56 @@ function registerLoginCommand(program2) {
|
|
|
2686
2805
|
});
|
|
2687
2806
|
}
|
|
2688
2807
|
|
|
2689
|
-
// src/commands/workflow/
|
|
2690
|
-
|
|
2808
|
+
// src/commands/workflow/list.ts
|
|
2809
|
+
init_store();
|
|
2810
|
+
init_workflow();
|
|
2811
|
+
init_format();
|
|
2812
|
+
import chalk4 from "chalk";
|
|
2813
|
+
async function workflowList(opts) {
|
|
2814
|
+
requireAuth();
|
|
2815
|
+
try {
|
|
2816
|
+
if (opts.detail) {
|
|
2817
|
+
const workflows = await getWorkflowListDetail();
|
|
2818
|
+
if (!workflows || workflows.length === 0) {
|
|
2819
|
+
console.log(chalk4.yellow("\n\uC6CC\uD06C\uD50C\uB85C\uC6B0\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.\n"));
|
|
2820
|
+
return;
|
|
2821
|
+
}
|
|
2822
|
+
printHeader(`\uC6CC\uD06C\uD50C\uB85C\uC6B0 \uBAA9\uB85D (${workflows.length}\uAC1C)`);
|
|
2823
|
+
console.log();
|
|
2824
|
+
printTable(
|
|
2825
|
+
["#", "ID", "\uC774\uB984", "\uBC30\uD3EC", "\uC5C5\uB370\uC774\uD2B8"],
|
|
2826
|
+
workflows.map((w, i) => [
|
|
2827
|
+
String(i + 1),
|
|
2828
|
+
(w.workflow_id ?? w.id ?? "-").slice(0, 12),
|
|
2829
|
+
truncate(w.workflow_name ?? "-", 30),
|
|
2830
|
+
w.is_deployed ? chalk4.green("\uBC30\uD3EC\uB428") : chalk4.gray("\uBBF8\uBC30\uD3EC"),
|
|
2831
|
+
formatDate(w.updated_at)
|
|
2832
|
+
])
|
|
2833
|
+
);
|
|
2834
|
+
} else {
|
|
2835
|
+
const workflows = await listWorkflows();
|
|
2836
|
+
if (!workflows || workflows.length === 0) {
|
|
2837
|
+
console.log(chalk4.yellow("\n\uC6CC\uD06C\uD50C\uB85C\uC6B0\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.\n"));
|
|
2838
|
+
return;
|
|
2839
|
+
}
|
|
2840
|
+
printHeader(`\uC6CC\uD06C\uD50C\uB85C\uC6B0 \uBAA9\uB85D (${workflows.length}\uAC1C)`);
|
|
2841
|
+
console.log();
|
|
2842
|
+
printTable(
|
|
2843
|
+
["#", "ID", "\uC774\uB984"],
|
|
2844
|
+
workflows.map((w, i) => [
|
|
2845
|
+
String(i + 1),
|
|
2846
|
+
(w.workflow_id ?? w.id ?? "-").slice(0, 12),
|
|
2847
|
+
w.workflow_name ?? "-"
|
|
2848
|
+
])
|
|
2849
|
+
);
|
|
2850
|
+
}
|
|
2851
|
+
console.log();
|
|
2852
|
+
} catch (err) {
|
|
2853
|
+
const msg = err.message;
|
|
2854
|
+
printError(`\uC6CC\uD06C\uD50C\uB85C\uC6B0 \uBAA9\uB85D \uC870\uD68C \uC2E4\uD328: ${msg}`);
|
|
2855
|
+
process.exit(1);
|
|
2856
|
+
}
|
|
2857
|
+
}
|
|
2691
2858
|
|
|
2692
2859
|
// src/commands/workflow/info.ts
|
|
2693
2860
|
init_store();
|