@kevisual/cli 0.1.8 → 0.1.9
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/assistant-opencode.js +1659 -20711
- package/dist/assistant-server.js +1773 -20832
- package/dist/assistant.js +180 -112
- package/dist/envision.js +104 -67
- package/package.json +3 -3
package/dist/assistant.js
CHANGED
|
@@ -28809,7 +28809,7 @@ class AssistantConfig {
|
|
|
28809
28809
|
home: "/root/home",
|
|
28810
28810
|
proxy: [],
|
|
28811
28811
|
share: {
|
|
28812
|
-
enabled:
|
|
28812
|
+
enabled: true,
|
|
28813
28813
|
url: "https://kevisual.cn/ws/proxy"
|
|
28814
28814
|
}
|
|
28815
28815
|
};
|
|
@@ -51106,7 +51106,7 @@ function filter(data, query) {
|
|
|
51106
51106
|
return executor.execute(ast, data);
|
|
51107
51107
|
}
|
|
51108
51108
|
|
|
51109
|
-
// ../node_modules/.pnpm/@kevisual+api@0.0.
|
|
51109
|
+
// ../node_modules/.pnpm/@kevisual+api@0.0.59_@types+react@19.2.10_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@kevisual/api/query/query-proxy/router-api-proxy.ts
|
|
51110
51110
|
var initApi = async (opts) => {
|
|
51111
51111
|
const router = opts?.router;
|
|
51112
51112
|
const item = opts?.item;
|
|
@@ -71237,7 +71237,7 @@ ${line}`;
|
|
|
71237
71237
|
}
|
|
71238
71238
|
}
|
|
71239
71239
|
|
|
71240
|
-
// ../node_modules/.pnpm/@kevisual+api@0.0.
|
|
71240
|
+
// ../node_modules/.pnpm/@kevisual+api@0.0.59_@types+react@19.2.10_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@kevisual/api/dist/query-login-node.js
|
|
71241
71241
|
import { homedir as homedir2 } from "node:os";
|
|
71242
71242
|
import { join, dirname } from "node:path";
|
|
71243
71243
|
import fs12 from "node:fs";
|
|
@@ -72250,18 +72250,26 @@ class QueryLogin extends BaseQuery {
|
|
|
72250
72250
|
message: "登录失败"
|
|
72251
72251
|
};
|
|
72252
72252
|
}
|
|
72253
|
-
async refreshLoginUser(
|
|
72254
|
-
const res = await this.queryRefreshToken(
|
|
72253
|
+
async refreshLoginUser(opts) {
|
|
72254
|
+
const res = await this.queryRefreshToken(opts);
|
|
72255
72255
|
if (res.code === 200) {
|
|
72256
|
-
const { accessToken, refreshToken
|
|
72256
|
+
const { accessToken, refreshToken, accessTokenExpiresIn } = res?.data || {};
|
|
72257
72257
|
this.storage.setItem("token", accessToken || "");
|
|
72258
|
-
await this.beforeSetLoginUser({ accessToken, refreshToken
|
|
72258
|
+
await this.beforeSetLoginUser({ accessToken, refreshToken, accessTokenExpiresIn, check401: false });
|
|
72259
72259
|
}
|
|
72260
72260
|
return res;
|
|
72261
72261
|
}
|
|
72262
|
-
async queryRefreshToken(
|
|
72262
|
+
async queryRefreshToken(opts) {
|
|
72263
|
+
const refreshToken = opts?.refreshToken;
|
|
72264
|
+
let accessToken = opts?.accessToken;
|
|
72263
72265
|
const _refreshToken = refreshToken || await this.cacheStore.getRefreshToken();
|
|
72264
|
-
let data = {
|
|
72266
|
+
let data = {};
|
|
72267
|
+
if (accessToken) {
|
|
72268
|
+
data.accessToken = accessToken;
|
|
72269
|
+
}
|
|
72270
|
+
if (_refreshToken) {
|
|
72271
|
+
data.refreshToken = _refreshToken;
|
|
72272
|
+
}
|
|
72265
72273
|
if (!_refreshToken) {
|
|
72266
72274
|
await this.cacheStore.clearCurrentUser();
|
|
72267
72275
|
return {
|
|
@@ -72281,7 +72289,7 @@ class QueryLogin extends BaseQuery {
|
|
|
72281
72289
|
if (response?.code === 401) {
|
|
72282
72290
|
const hasRefreshToken = await that.cacheStore.getRefreshToken();
|
|
72283
72291
|
if (hasRefreshToken) {
|
|
72284
|
-
const res = await that.queryRefreshToken(hasRefreshToken);
|
|
72292
|
+
const res = await that.queryRefreshToken({ refreshToken: hasRefreshToken });
|
|
72285
72293
|
if (res.code === 200) {
|
|
72286
72294
|
const { accessToken, refreshToken, accessTokenExpiresIn } = res?.data || {};
|
|
72287
72295
|
that.storage.setItem("token", accessToken || "");
|
|
@@ -72699,11 +72707,6 @@ class AssistantQuery {
|
|
|
72699
72707
|
}
|
|
72700
72708
|
async getToken() {
|
|
72701
72709
|
const token = await this.queryLogin.getToken();
|
|
72702
|
-
if (!token)
|
|
72703
|
-
return "";
|
|
72704
|
-
const isExpired = await this.queryLogin.checkTokenValid();
|
|
72705
|
-
console.log("Token 是否过期", isExpired, token);
|
|
72706
|
-
console.log("info", this.queryLogin.cacheStore.cacheData);
|
|
72707
72710
|
return token;
|
|
72708
72711
|
}
|
|
72709
72712
|
}
|
|
@@ -72757,14 +72760,18 @@ app.createRouteList();
|
|
|
72757
72760
|
|
|
72758
72761
|
// src/module/light-code/index.ts
|
|
72759
72762
|
var initLightCode = async (opts) => {
|
|
72760
|
-
|
|
72763
|
+
const token = await assistantQuery.getToken();
|
|
72764
|
+
if (!token) {
|
|
72765
|
+
logger.error("[light-code] 当前未登录,无法初始化 light-code");
|
|
72766
|
+
return;
|
|
72767
|
+
}
|
|
72761
72768
|
const config4 = opts.config;
|
|
72762
72769
|
const app2 = opts.router;
|
|
72763
|
-
|
|
72770
|
+
logger.log("[light-code] 初始化 light-code 路由");
|
|
72764
72771
|
const query = config4.query;
|
|
72765
72772
|
const sync2 = opts.sync ?? "remote";
|
|
72766
72773
|
if (!config4 || !app2) {
|
|
72767
|
-
|
|
72774
|
+
logger.error("[light-code] initLightCode 缺少必要参数, config 或 app");
|
|
72768
72775
|
return;
|
|
72769
72776
|
}
|
|
72770
72777
|
const lightcodeDir = opts.rootPath;
|
|
@@ -87113,6 +87120,23 @@ class AssistantApp extends Manager2 {
|
|
|
87113
87120
|
this.config = config5;
|
|
87114
87121
|
this.resolver = new ModuleResolver(config5.configPath.configDir);
|
|
87115
87122
|
}
|
|
87123
|
+
async init(opts) {
|
|
87124
|
+
const manager = this;
|
|
87125
|
+
await manager.load({ runtime: "client" });
|
|
87126
|
+
console.log("Assistant App Loaded");
|
|
87127
|
+
await manager.checkLocalUser();
|
|
87128
|
+
const token = await assistantQuery.getToken();
|
|
87129
|
+
if (token) {
|
|
87130
|
+
console.log("用户已登录,正在初始化远程应用连接...");
|
|
87131
|
+
await manager.initRemoteApp({ token });
|
|
87132
|
+
await manager.initRemoteApp();
|
|
87133
|
+
await manager.initRouterProxyLightApp();
|
|
87134
|
+
}
|
|
87135
|
+
await manager.initRouterProxyApp();
|
|
87136
|
+
if (opts?.isServer) {
|
|
87137
|
+
await manager.initRoutes();
|
|
87138
|
+
}
|
|
87139
|
+
}
|
|
87116
87140
|
async pageList() {
|
|
87117
87141
|
const pages = await import_fast_glob3.default(["*/*/package.json"], {
|
|
87118
87142
|
cwd: this.pagesPath,
|
|
@@ -87168,7 +87192,11 @@ class AssistantApp extends Manager2 {
|
|
|
87168
87192
|
}
|
|
87169
87193
|
let token = opts?.token;
|
|
87170
87194
|
if (!token) {
|
|
87171
|
-
token = await assistantQuery.
|
|
87195
|
+
token = await assistantQuery.getToken();
|
|
87196
|
+
}
|
|
87197
|
+
if (!token) {
|
|
87198
|
+
logger.error("[remote-app] cli当前未登录,无法连接远程app");
|
|
87199
|
+
return;
|
|
87172
87200
|
}
|
|
87173
87201
|
let shareUrl = share?.url;
|
|
87174
87202
|
if (!shareUrl) {
|
|
@@ -87218,11 +87246,10 @@ class AssistantApp extends Manager2 {
|
|
|
87218
87246
|
}
|
|
87219
87247
|
}
|
|
87220
87248
|
}
|
|
87221
|
-
async
|
|
87249
|
+
async initRouterProxyApp() {
|
|
87222
87250
|
const config5 = this.config.getConfig();
|
|
87223
|
-
|
|
87251
|
+
let routerProxy = config5?.router?.proxy || [];
|
|
87224
87252
|
const base = config5.router?.base ?? false;
|
|
87225
|
-
const lightcode = config5.router?.lightcode ?? true;
|
|
87226
87253
|
if (base) {
|
|
87227
87254
|
routerProxy.push({
|
|
87228
87255
|
type: "router",
|
|
@@ -87231,41 +87258,13 @@ class AssistantApp extends Manager2 {
|
|
|
87231
87258
|
}
|
|
87232
87259
|
});
|
|
87233
87260
|
}
|
|
87234
|
-
|
|
87235
|
-
routerProxy.push({
|
|
87236
|
-
type: "lightcode",
|
|
87237
|
-
lightcode: {
|
|
87238
|
-
id: "main",
|
|
87239
|
-
sync: "remote",
|
|
87240
|
-
rootPath: path12.join(this.config.configPath.appsDir, "light-code", "code")
|
|
87241
|
-
}
|
|
87242
|
-
});
|
|
87243
|
-
}
|
|
87261
|
+
routerProxy = routerProxy.filter((item) => item.type === "router");
|
|
87244
87262
|
if (routerProxy.length === 0) {
|
|
87245
87263
|
return;
|
|
87246
87264
|
}
|
|
87247
87265
|
for (const proxyInfo of routerProxy) {
|
|
87248
|
-
if (proxyInfo.type !== "router"
|
|
87249
|
-
console.warn('路由的type必须是"router"
|
|
87250
|
-
continue;
|
|
87251
|
-
}
|
|
87252
|
-
if (proxyInfo.type === "lightcode") {
|
|
87253
|
-
const schema = zod_default.object({
|
|
87254
|
-
rootPath: zod_default.string().describe("light-code 代码存放路径"),
|
|
87255
|
-
sync: zod_default.enum(["remote", "local", "both"]).describe("同步方式,remote: 仅从远程拉取,local: 仅上传本地代码,both: 双向同步").default("remote")
|
|
87256
|
-
});
|
|
87257
|
-
const parseRes = schema.safeParse(proxyInfo.lightcode);
|
|
87258
|
-
if (!parseRes.success) {
|
|
87259
|
-
console.warn("lightcode 配置错误", parseRes.error);
|
|
87260
|
-
continue;
|
|
87261
|
-
}
|
|
87262
|
-
const lightcodeConfig = parseRes.data;
|
|
87263
|
-
initLightCode({
|
|
87264
|
-
router: this.mainApp,
|
|
87265
|
-
config: this.config,
|
|
87266
|
-
sync: lightcodeConfig.sync,
|
|
87267
|
-
rootPath: lightcodeConfig.rootPath
|
|
87268
|
-
});
|
|
87266
|
+
if (proxyInfo.type !== "router") {
|
|
87267
|
+
console.warn('路由的type必须是"router"');
|
|
87269
87268
|
continue;
|
|
87270
87269
|
}
|
|
87271
87270
|
const url4 = proxyInfo.router.url;
|
|
@@ -87292,6 +87291,47 @@ class AssistantApp extends Manager2 {
|
|
|
87292
87291
|
}
|
|
87293
87292
|
}
|
|
87294
87293
|
}
|
|
87294
|
+
async initRouterProxyLightApp() {
|
|
87295
|
+
const config5 = this.config.getConfig();
|
|
87296
|
+
let routerProxy = config5?.router?.proxy || [];
|
|
87297
|
+
const lightcode = config5.router?.lightcode ?? true;
|
|
87298
|
+
if (lightcode) {
|
|
87299
|
+
routerProxy.push({
|
|
87300
|
+
type: "lightcode",
|
|
87301
|
+
lightcode: {
|
|
87302
|
+
id: "main",
|
|
87303
|
+
sync: "remote",
|
|
87304
|
+
rootPath: path12.join(this.config.configPath.appsDir, "light-code", "code")
|
|
87305
|
+
}
|
|
87306
|
+
});
|
|
87307
|
+
}
|
|
87308
|
+
routerProxy = routerProxy.filter((item) => item.type === "lightcode");
|
|
87309
|
+
if (routerProxy.length === 0) {
|
|
87310
|
+
return;
|
|
87311
|
+
}
|
|
87312
|
+
for (const proxyInfo of routerProxy) {
|
|
87313
|
+
if (proxyInfo.type !== "lightcode") {
|
|
87314
|
+
console.warn('路由的type必须是"lightcode"');
|
|
87315
|
+
continue;
|
|
87316
|
+
}
|
|
87317
|
+
const schema = zod_default.object({
|
|
87318
|
+
rootPath: zod_default.string().describe("light-code 代码存放路径"),
|
|
87319
|
+
sync: zod_default.enum(["remote", "local", "both"]).describe("同步方式,remote: 仅从远程拉取,local: 仅上传本地代码,both: 双向同步").default("remote")
|
|
87320
|
+
});
|
|
87321
|
+
const parseRes = schema.safeParse(proxyInfo.lightcode);
|
|
87322
|
+
if (!parseRes.success) {
|
|
87323
|
+
console.warn("lightcode 配置错误", parseRes.error);
|
|
87324
|
+
continue;
|
|
87325
|
+
}
|
|
87326
|
+
const lightcodeConfig = parseRes.data;
|
|
87327
|
+
await initLightCode({
|
|
87328
|
+
router: this.mainApp,
|
|
87329
|
+
config: this.config,
|
|
87330
|
+
sync: lightcodeConfig.sync,
|
|
87331
|
+
rootPath: lightcodeConfig.rootPath
|
|
87332
|
+
});
|
|
87333
|
+
}
|
|
87334
|
+
}
|
|
87295
87335
|
async initRoutes() {
|
|
87296
87336
|
const routes = this.config.getConfig().routes || [];
|
|
87297
87337
|
for (const route of routes) {
|
|
@@ -87312,32 +87352,51 @@ class AssistantApp extends Manager2 {
|
|
|
87312
87352
|
var checkLocalUser = async (opts) => {
|
|
87313
87353
|
const { assistantApp } = opts;
|
|
87314
87354
|
const config5 = assistantApp.config.getConfig();
|
|
87315
|
-
const auth = config5?.auth;
|
|
87316
|
-
|
|
87317
|
-
|
|
87318
|
-
|
|
87319
|
-
|
|
87320
|
-
|
|
87321
|
-
|
|
87355
|
+
const auth = config5?.auth || {};
|
|
87356
|
+
const isLogin = await assistantQuery.queryLogin.getToken();
|
|
87357
|
+
logger.log("[assistant] 正在检查本地用户登录状态...", "user", auth.username, "是否已登录", !!isLogin);
|
|
87358
|
+
const saveAuth = (auth2, opts2) => {
|
|
87359
|
+
auth2.username = auth2.username ?? opts2.username;
|
|
87360
|
+
auth2.share = auth2.share ?? opts2.share;
|
|
87361
|
+
const app2 = config5?.app || {};
|
|
87362
|
+
if (!app2?.id) {
|
|
87363
|
+
app2.id = opts2.appId || "dev-cnb";
|
|
87364
|
+
}
|
|
87365
|
+
assistantApp.config.setConfig({
|
|
87366
|
+
auth: auth2,
|
|
87367
|
+
app: app2
|
|
87368
|
+
});
|
|
87369
|
+
};
|
|
87370
|
+
if (!auth?.username && isLogin) {
|
|
87371
|
+
const userInfo = await assistantQuery.queryLogin.checkLocalUser();
|
|
87372
|
+
saveAuth(auth, { username: userInfo.username, share: "protected" });
|
|
87373
|
+
return;
|
|
87322
87374
|
}
|
|
87323
|
-
|
|
87324
|
-
|
|
87375
|
+
if (isLogin)
|
|
87376
|
+
return;
|
|
87377
|
+
const cnbToken = useKey2("CNB_API_KEY");
|
|
87378
|
+
if (cnbToken) {
|
|
87379
|
+
logger.info("[cnb]检测到 CNB_API_KEY,正在尝试使用 CNB_API_KEY 登录...");
|
|
87325
87380
|
const res = await assistantQuery.queryLogin.loginByCnb({ cnbToken });
|
|
87326
87381
|
if (res.code === 200) {
|
|
87327
|
-
logger.info("CNB登录成功,用户信息已更新");
|
|
87328
87382
|
const userInfo = await assistantQuery.queryLogin.checkLocalUser();
|
|
87329
|
-
|
|
87330
|
-
|
|
87331
|
-
|
|
87332
|
-
|
|
87333
|
-
app2.id = "dev-cnb";
|
|
87334
|
-
}
|
|
87335
|
-
assistantApp.config.setConfig({
|
|
87336
|
-
auth,
|
|
87337
|
-
app: app2
|
|
87338
|
-
});
|
|
87383
|
+
if (!userInfo.username) {
|
|
87384
|
+
saveAuth(auth, { username: userInfo.username, share: "protected" });
|
|
87385
|
+
}
|
|
87386
|
+
return;
|
|
87339
87387
|
} else {
|
|
87340
|
-
|
|
87388
|
+
logger.error("CNB登录失败,无法获取用户信息", res);
|
|
87389
|
+
}
|
|
87390
|
+
}
|
|
87391
|
+
const accessToken = useKey2("KEVISUAL_TOKEN");
|
|
87392
|
+
if (accessToken) {
|
|
87393
|
+
logger.info("[cnb]检测到 KEVISUAL_TOKEN,正在尝试使用 KEVISUAL_TOKEN 登录...");
|
|
87394
|
+
const res = await assistantQuery.queryLogin.refreshLoginUser({ accessToken, refreshToken: "" });
|
|
87395
|
+
if (res.code === 200) {
|
|
87396
|
+
if (!auth.username) {
|
|
87397
|
+
const userInfo = await assistantQuery.queryLogin.checkLocalUser();
|
|
87398
|
+
saveAuth(auth, { username: userInfo.username, share: "protected" });
|
|
87399
|
+
}
|
|
87341
87400
|
}
|
|
87342
87401
|
}
|
|
87343
87402
|
};
|
|
@@ -87371,10 +87430,10 @@ var runProgram = (args2) => {
|
|
|
87371
87430
|
import path13 from "node:path";
|
|
87372
87431
|
import fs17 from "node:fs";
|
|
87373
87432
|
|
|
87374
|
-
// ../node_modules/.pnpm/@inquirer+core@11.1.
|
|
87433
|
+
// ../node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/key.js
|
|
87375
87434
|
var isTabKey = (key) => key.name === "tab";
|
|
87376
87435
|
var isEnterKey = (key) => key.name === "enter" || key.name === "return";
|
|
87377
|
-
// ../node_modules/.pnpm/@inquirer+core@11.1.
|
|
87436
|
+
// ../node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/errors.js
|
|
87378
87437
|
class AbortPromptError extends Error {
|
|
87379
87438
|
name = "AbortPromptError";
|
|
87380
87439
|
message = "Prompt was aborted";
|
|
@@ -87400,10 +87459,10 @@ class HookError extends Error {
|
|
|
87400
87459
|
class ValidationError extends Error {
|
|
87401
87460
|
name = "ValidationError";
|
|
87402
87461
|
}
|
|
87403
|
-
// ../node_modules/.pnpm/@inquirer+core@11.1.
|
|
87462
|
+
// ../node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/use-state.js
|
|
87404
87463
|
import { AsyncResource as AsyncResource2 } from "node:async_hooks";
|
|
87405
87464
|
|
|
87406
|
-
// ../node_modules/.pnpm/@inquirer+core@11.1.
|
|
87465
|
+
// ../node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/hook-engine.js
|
|
87407
87466
|
import { AsyncLocalStorage, AsyncResource } from "node:async_hooks";
|
|
87408
87467
|
var hookStorage = new AsyncLocalStorage;
|
|
87409
87468
|
function createStore(rl) {
|
|
@@ -87508,7 +87567,7 @@ var effectScheduler = {
|
|
|
87508
87567
|
}
|
|
87509
87568
|
};
|
|
87510
87569
|
|
|
87511
|
-
// ../node_modules/.pnpm/@inquirer+core@11.1.
|
|
87570
|
+
// ../node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/use-state.js
|
|
87512
87571
|
function useState(defaultValue) {
|
|
87513
87572
|
return withPointer((pointer) => {
|
|
87514
87573
|
const setState = AsyncResource2.bind(function setState2(newValue) {
|
|
@@ -87526,7 +87585,7 @@ function useState(defaultValue) {
|
|
|
87526
87585
|
});
|
|
87527
87586
|
}
|
|
87528
87587
|
|
|
87529
|
-
// ../node_modules/.pnpm/@inquirer+core@11.1.
|
|
87588
|
+
// ../node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/use-effect.js
|
|
87530
87589
|
function useEffect(cb, depArray) {
|
|
87531
87590
|
withPointer((pointer) => {
|
|
87532
87591
|
const oldDeps = pointer.get();
|
|
@@ -87538,7 +87597,7 @@ function useEffect(cb, depArray) {
|
|
|
87538
87597
|
});
|
|
87539
87598
|
}
|
|
87540
87599
|
|
|
87541
|
-
// ../node_modules/.pnpm/@inquirer+core@11.1.
|
|
87600
|
+
// ../node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/theme.js
|
|
87542
87601
|
import { styleText } from "node:util";
|
|
87543
87602
|
|
|
87544
87603
|
// ../node_modules/.pnpm/@inquirer+figures@2.0.3/node_modules/@inquirer/figures/dist/index.js
|
|
@@ -87830,7 +87889,7 @@ var figures = shouldUseMain ? mainSymbols : fallbackSymbols;
|
|
|
87830
87889
|
var dist_default = figures;
|
|
87831
87890
|
var replacements = Object.entries(specialMainSymbols);
|
|
87832
87891
|
|
|
87833
|
-
// ../node_modules/.pnpm/@inquirer+core@11.1.
|
|
87892
|
+
// ../node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/theme.js
|
|
87834
87893
|
var defaultTheme = {
|
|
87835
87894
|
prefix: {
|
|
87836
87895
|
idle: styleText("blue", "?"),
|
|
@@ -87851,7 +87910,7 @@ var defaultTheme = {
|
|
|
87851
87910
|
}
|
|
87852
87911
|
};
|
|
87853
87912
|
|
|
87854
|
-
// ../node_modules/.pnpm/@inquirer+core@11.1.
|
|
87913
|
+
// ../node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/make-theme.js
|
|
87855
87914
|
function isPlainObject5(value) {
|
|
87856
87915
|
if (typeof value !== "object" || value === null)
|
|
87857
87916
|
return false;
|
|
@@ -87879,7 +87938,7 @@ function makeTheme(...themes) {
|
|
|
87879
87938
|
return deepMerge(...themesToMerge);
|
|
87880
87939
|
}
|
|
87881
87940
|
|
|
87882
|
-
// ../node_modules/.pnpm/@inquirer+core@11.1.
|
|
87941
|
+
// ../node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/use-prefix.js
|
|
87883
87942
|
function usePrefix({ status = "idle", theme }) {
|
|
87884
87943
|
const [showLoader, setShowLoader] = useState(false);
|
|
87885
87944
|
const [tick, setTick] = useState(0);
|
|
@@ -87909,12 +87968,12 @@ function usePrefix({ status = "idle", theme }) {
|
|
|
87909
87968
|
const iconName = status === "loading" ? "idle" : status;
|
|
87910
87969
|
return typeof prefix === "string" ? prefix : prefix[iconName] ?? prefix["idle"];
|
|
87911
87970
|
}
|
|
87912
|
-
// ../node_modules/.pnpm/@inquirer+core@11.1.
|
|
87971
|
+
// ../node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/use-ref.js
|
|
87913
87972
|
function useRef(val) {
|
|
87914
87973
|
return useState({ current: val })[0];
|
|
87915
87974
|
}
|
|
87916
87975
|
|
|
87917
|
-
// ../node_modules/.pnpm/@inquirer+core@11.1.
|
|
87976
|
+
// ../node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/use-keypress.js
|
|
87918
87977
|
function useKeypress(userHandler) {
|
|
87919
87978
|
const signal = useRef(userHandler);
|
|
87920
87979
|
signal.current = userHandler;
|
|
@@ -87932,7 +87991,7 @@ function useKeypress(userHandler) {
|
|
|
87932
87991
|
};
|
|
87933
87992
|
}, []);
|
|
87934
87993
|
}
|
|
87935
|
-
// ../node_modules/.pnpm/@inquirer+core@11.1.
|
|
87994
|
+
// ../node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/utils.js
|
|
87936
87995
|
var import_cli_width = __toESM(require_cli_width(), 1);
|
|
87937
87996
|
|
|
87938
87997
|
// ../node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js
|
|
@@ -88276,7 +88335,7 @@ function wrapAnsi(string5, columns, options) {
|
|
|
88276
88335
|
`);
|
|
88277
88336
|
}
|
|
88278
88337
|
|
|
88279
|
-
// ../node_modules/.pnpm/@inquirer+core@11.1.
|
|
88338
|
+
// ../node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/utils.js
|
|
88280
88339
|
function breakLines(content, width) {
|
|
88281
88340
|
return content.split(`
|
|
88282
88341
|
`).flatMap((line) => wrapAnsi(line, width, { trim: false, hard: true }).split(`
|
|
@@ -88287,7 +88346,7 @@ function readlineWidth() {
|
|
|
88287
88346
|
return import_cli_width.default({ defaultWidth: 80, output: readline().output });
|
|
88288
88347
|
}
|
|
88289
88348
|
|
|
88290
|
-
// ../node_modules/.pnpm/@inquirer+core@11.1.
|
|
88349
|
+
// ../node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/create-prompt.js
|
|
88291
88350
|
var import_mute_stream = __toESM(require_lib(), 1);
|
|
88292
88351
|
import * as readline2 from "node:readline";
|
|
88293
88352
|
import { AsyncResource as AsyncResource3 } from "node:async_hooks";
|
|
@@ -88500,7 +88559,7 @@ var {
|
|
|
88500
88559
|
unload
|
|
88501
88560
|
} = signalExitWrap(processOk(process8) ? new SignalExit(process8) : new SignalExitFallback);
|
|
88502
88561
|
|
|
88503
|
-
// ../node_modules/.pnpm/@inquirer+core@11.1.
|
|
88562
|
+
// ../node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/screen-manager.js
|
|
88504
88563
|
import { stripVTControlCharacters } from "node:util";
|
|
88505
88564
|
|
|
88506
88565
|
// ../node_modules/.pnpm/@inquirer+ansi@2.0.3/node_modules/@inquirer/ansi/dist/index.js
|
|
@@ -88519,7 +88578,7 @@ var cursorTo = (x, y) => {
|
|
|
88519
88578
|
var eraseLine = ESC2 + "2K";
|
|
88520
88579
|
var eraseLines = (lines) => lines > 0 ? (eraseLine + cursorUp(1)).repeat(lines - 1) + eraseLine + cursorLeft : "";
|
|
88521
88580
|
|
|
88522
|
-
// ../node_modules/.pnpm/@inquirer+core@11.1.
|
|
88581
|
+
// ../node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/screen-manager.js
|
|
88523
88582
|
var height = (content) => content.split(`
|
|
88524
88583
|
`).length;
|
|
88525
88584
|
var lastLine = (content) => content.split(`
|
|
@@ -88584,7 +88643,7 @@ class ScreenManager {
|
|
|
88584
88643
|
}
|
|
88585
88644
|
}
|
|
88586
88645
|
|
|
88587
|
-
// ../node_modules/.pnpm/@inquirer+core@11.1.
|
|
88646
|
+
// ../node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/promise-polyfill.js
|
|
88588
88647
|
class PromisePolyfill extends Promise {
|
|
88589
88648
|
static withResolver() {
|
|
88590
88649
|
let resolve;
|
|
@@ -88597,7 +88656,8 @@ class PromisePolyfill extends Promise {
|
|
|
88597
88656
|
}
|
|
88598
88657
|
}
|
|
88599
88658
|
|
|
88600
|
-
// ../node_modules/.pnpm/@inquirer+core@11.1.
|
|
88659
|
+
// ../node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/create-prompt.js
|
|
88660
|
+
var nativeSetImmediate = globalThis.setImmediate;
|
|
88601
88661
|
function getCallSites() {
|
|
88602
88662
|
const _prepareStackTrace = Error.prepareStackTrace;
|
|
88603
88663
|
let result = [];
|
|
@@ -88621,6 +88681,7 @@ function createPrompt(view) {
|
|
|
88621
88681
|
const cleanups = new Set;
|
|
88622
88682
|
const output = new import_mute_stream.default;
|
|
88623
88683
|
output.pipe(context.output ?? process.stdout);
|
|
88684
|
+
output.mute();
|
|
88624
88685
|
const rl = readline2.createInterface({
|
|
88625
88686
|
terminal: true,
|
|
88626
88687
|
input,
|
|
@@ -88644,30 +88705,37 @@ function createPrompt(view) {
|
|
|
88644
88705
|
const sigint = () => reject(new ExitPromptError(`User force closed the prompt with SIGINT`));
|
|
88645
88706
|
rl.on("SIGINT", sigint);
|
|
88646
88707
|
cleanups.add(() => rl.removeListener("SIGINT", sigint));
|
|
88647
|
-
const checkCursorPos = () => screen.checkCursorPos();
|
|
88648
|
-
rl.input.on("keypress", checkCursorPos);
|
|
88649
|
-
cleanups.add(() => rl.input.removeListener("keypress", checkCursorPos));
|
|
88650
88708
|
return withHooks(rl, (cycle) => {
|
|
88651
88709
|
const hooksCleanup = AsyncResource3.bind(() => effectScheduler.clearAll());
|
|
88652
88710
|
rl.on("close", hooksCleanup);
|
|
88653
88711
|
cleanups.add(() => rl.removeListener("close", hooksCleanup));
|
|
88654
|
-
|
|
88655
|
-
|
|
88656
|
-
|
|
88657
|
-
|
|
88658
|
-
|
|
88659
|
-
|
|
88660
|
-
const
|
|
88661
|
-
|
|
88712
|
+
const startCycle = () => {
|
|
88713
|
+
const checkCursorPos = () => screen.checkCursorPos();
|
|
88714
|
+
rl.input.on("keypress", checkCursorPos);
|
|
88715
|
+
cleanups.add(() => rl.input.removeListener("keypress", checkCursorPos));
|
|
88716
|
+
cycle(() => {
|
|
88717
|
+
try {
|
|
88718
|
+
const nextView = view(config6, (value) => {
|
|
88719
|
+
setImmediate(() => resolve(value));
|
|
88720
|
+
});
|
|
88721
|
+
if (nextView === undefined) {
|
|
88722
|
+
const callerFilename = callSites[1]?.getFileName();
|
|
88723
|
+
throw new Error(`Prompt functions must return a string.
|
|
88662
88724
|
at ${callerFilename}`);
|
|
88725
|
+
}
|
|
88726
|
+
const [content, bottomContent] = typeof nextView === "string" ? [nextView] : nextView;
|
|
88727
|
+
screen.render(content, bottomContent);
|
|
88728
|
+
effectScheduler.run();
|
|
88729
|
+
} catch (error54) {
|
|
88730
|
+
reject(error54);
|
|
88663
88731
|
}
|
|
88664
|
-
|
|
88665
|
-
|
|
88666
|
-
|
|
88667
|
-
|
|
88668
|
-
|
|
88669
|
-
|
|
88670
|
-
}
|
|
88732
|
+
});
|
|
88733
|
+
};
|
|
88734
|
+
if ("readableFlowing" in input) {
|
|
88735
|
+
nativeSetImmediate(startCycle);
|
|
88736
|
+
} else {
|
|
88737
|
+
startCycle();
|
|
88738
|
+
}
|
|
88671
88739
|
return Object.assign(promise4.then((answer) => {
|
|
88672
88740
|
effectScheduler.clearAll();
|
|
88673
88741
|
return answer;
|
|
@@ -88683,7 +88751,7 @@ function createPrompt(view) {
|
|
|
88683
88751
|
};
|
|
88684
88752
|
return prompt;
|
|
88685
88753
|
}
|
|
88686
|
-
// ../node_modules/.pnpm/@inquirer+confirm@6.0.
|
|
88754
|
+
// ../node_modules/.pnpm/@inquirer+confirm@6.0.8_@types+node@25.3.0/node_modules/@inquirer/confirm/dist/index.js
|
|
88687
88755
|
function getBooleanValue(value, defaultValue) {
|
|
88688
88756
|
let answer = defaultValue !== false;
|
|
88689
88757
|
if (/^(y|yes)/i.test(value))
|