@kevisual/cli 0.1.13 → 0.1.15
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 +37 -15
- package/dist/assistant-server.js +38 -15
- package/dist/assistant.js +21 -2
- package/dist/envision.js +27 -19
- package/package.json +1 -1
|
@@ -44010,13 +44010,22 @@ class AssistantConfig {
|
|
|
44010
44010
|
getDefaultInitAssistantConfig() {
|
|
44011
44011
|
const id = randomId2();
|
|
44012
44012
|
const isCNB = !!useKey("CNB");
|
|
44013
|
+
let kevisualUrl = "https://kevisual.cn";
|
|
44014
|
+
if (isCNB) {
|
|
44015
|
+
const uri = getCNBUrl();
|
|
44016
|
+
if (uri) {
|
|
44017
|
+
kevisualUrl = uri;
|
|
44018
|
+
} else {
|
|
44019
|
+
kevisualUrl = "http://kevisual.cn";
|
|
44020
|
+
}
|
|
44021
|
+
}
|
|
44013
44022
|
return {
|
|
44014
44023
|
app: {
|
|
44015
|
-
url:
|
|
44024
|
+
url: kevisualUrl,
|
|
44016
44025
|
id
|
|
44017
44026
|
},
|
|
44018
44027
|
description: "助手配置文件",
|
|
44019
|
-
docs:
|
|
44028
|
+
docs: `${kevisualUrl}/root/cli/docs/`,
|
|
44020
44029
|
home: isCNB ? "/root/cli-center" : "/root/home",
|
|
44021
44030
|
proxy: [],
|
|
44022
44031
|
share: {
|
|
@@ -44035,6 +44044,16 @@ var parseIfJson2 = (content) => {
|
|
|
44035
44044
|
}
|
|
44036
44045
|
};
|
|
44037
44046
|
var randomId2 = () => Math.random().toString(36).substring(2, 8);
|
|
44047
|
+
var getCNBUrl = () => {
|
|
44048
|
+
const isCNB = !!useKey("CNB");
|
|
44049
|
+
const uri = useKey("CNB_VSCODE_PROXY_URI");
|
|
44050
|
+
if (!isCNB)
|
|
44051
|
+
return null;
|
|
44052
|
+
if (uri) {
|
|
44053
|
+
return uri.replace("{{port}}", "51515");
|
|
44054
|
+
}
|
|
44055
|
+
return null;
|
|
44056
|
+
};
|
|
44038
44057
|
// src/module/assistant/proxy/utils.ts
|
|
44039
44058
|
var isBun3 = typeof Bun !== "undefined" && Bun?.version != null;
|
|
44040
44059
|
var isNode3 = typeof process !== "undefined" && process?.versions != null && process.versions?.node != null;
|
|
@@ -98500,7 +98519,6 @@ async function reload3() {
|
|
|
98500
98519
|
});
|
|
98501
98520
|
});
|
|
98502
98521
|
}
|
|
98503
|
-
|
|
98504
98522
|
// src/routes/config/index.ts
|
|
98505
98523
|
app.route({
|
|
98506
98524
|
path: "config",
|
|
@@ -98522,12 +98540,14 @@ app.route({
|
|
|
98522
98540
|
app.route({
|
|
98523
98541
|
path: "config",
|
|
98524
98542
|
key: "getId",
|
|
98525
|
-
description: "获取appId"
|
|
98543
|
+
description: "获取appId和访问地址"
|
|
98526
98544
|
}).define(async (ctx) => {
|
|
98527
98545
|
const config7 = assistantConfig2.getCacheAssistantConfig();
|
|
98528
98546
|
const appId = config7?.app?.id || null;
|
|
98547
|
+
let kevisualUrl = getCNBUrl() || "https://kevisual.cn";
|
|
98529
98548
|
ctx.body = {
|
|
98530
|
-
id: appId
|
|
98549
|
+
id: appId,
|
|
98550
|
+
url: kevisualUrl
|
|
98531
98551
|
};
|
|
98532
98552
|
}).addTo(app);
|
|
98533
98553
|
|
|
@@ -102194,11 +102214,6 @@ var getLiveMdContent = (opts) => {
|
|
|
102194
102214
|
- OpenWebUI: ${openWebUrl}
|
|
102195
102215
|
- Kevisual: ${kevisualUrl}
|
|
102196
102216
|
|
|
102197
|
-
### 直接访问
|
|
102198
|
-
- Kevisual: ${kevisualUrl}
|
|
102199
|
-
- OpenCode: ${url4?.replace("{{port}}", "4096")}
|
|
102200
|
-
- VSCode Web: ${vscodeWebUrl}
|
|
102201
|
-
|
|
102202
102217
|
### 密码访问
|
|
102203
102218
|
- OpenClaw: ${openclawUrlSecret}
|
|
102204
102219
|
- OpenCode: ${opencodeUrlSecret}
|
|
@@ -102208,8 +102223,11 @@ var getLiveMdContent = (opts) => {
|
|
|
102208
102223
|
|
|
102209
102224
|
### 其他说明
|
|
102210
102225
|
|
|
102226
|
+
1. 保活说明
|
|
102211
102227
|
使用插件访问vscode web获取wss进行保活,避免长时间不操作导致的自动断开连接。
|
|
102212
102228
|
|
|
102229
|
+
方法1: 使用插件访问vscode web获取wss进行保活,避免长时间不操作导致的自动断开连接。
|
|
102230
|
+
|
|
102213
102231
|
1. 安装插件[CNB LIVE](https://chromewebstore.google.com/detail/cnb-live/iajpiophkcdghonpijkcgpjafbcjhkko?pli=1)
|
|
102214
102232
|
2. 打开vscode web获取,点击插件,获取json数据,替换keep.json中的数据,保持在线状态。
|
|
102215
102233
|
3. keep.json中的数据结构说明:
|
|
@@ -102218,6 +102236,10 @@ var getLiveMdContent = (opts) => {
|
|
|
102218
102236
|
- url: vscode web的访问地址,可以直接访问vscode web
|
|
102219
102237
|
4. 运行cli命令,ev cnb live -c /workspace/live/keep.json.(直接对话opencode或者openclaw调用cnb-live技能即可)
|
|
102220
102238
|
|
|
102239
|
+
方法2:环境变量设置CNB_COOKIE,直接opencode或者openclaw的ui界面对话说,cnb-keep-live保活,他会自动调用保活,同时不需要点cnb-lie插件获取配置。
|
|
102240
|
+
|
|
102241
|
+
2. Opencode web访问说明
|
|
102242
|
+
Opencode打开web地址,需要在浏览器输入用户名和密码,用户名固定为root,密码为CNB_TOKEN的值. 纯连接打开包含账号密码,第一次点击后,需要把账号密码清理掉才能访问,opencode的bug导致的。
|
|
102221
102243
|
`;
|
|
102222
102244
|
const labels = [
|
|
102223
102245
|
{
|
|
@@ -102348,7 +102370,7 @@ var createOSInfo = (more = false) => {
|
|
|
102348
102370
|
}, {
|
|
102349
102371
|
key: "cpuCores",
|
|
102350
102372
|
title: "CPU 核心数",
|
|
102351
|
-
value:
|
|
102373
|
+
value: cpus.length,
|
|
102352
102374
|
description: "CPU 核心数"
|
|
102353
102375
|
}, {
|
|
102354
102376
|
key: "memoryUsed",
|
|
@@ -102390,8 +102412,8 @@ var createOSInfo = (more = false) => {
|
|
|
102390
102412
|
}, {
|
|
102391
102413
|
key: "buildUptime",
|
|
102392
102414
|
title: "构建已运行时间",
|
|
102393
|
-
value:
|
|
102394
|
-
description:
|
|
102415
|
+
value: buildUptime,
|
|
102416
|
+
description: `构建已运行时间: ${buildUptimeStr}`
|
|
102395
102417
|
});
|
|
102396
102418
|
if (maxRunTime > 0) {
|
|
102397
102419
|
const now = import_dayjs.default();
|
|
@@ -102410,8 +102432,8 @@ var createOSInfo = (more = false) => {
|
|
|
102410
102432
|
labels.unshift({
|
|
102411
102433
|
key: "remainingTime",
|
|
102412
102434
|
title: "剩余时间",
|
|
102413
|
-
value:
|
|
102414
|
-
description: "构建剩余时间"
|
|
102435
|
+
value: maxRunTime - buildUptime,
|
|
102436
|
+
description: "构建剩余时间" + formatUptime(Math.floor((maxRunTime - buildUptime) / 1000)) + " " + timeTo4Str
|
|
102415
102437
|
});
|
|
102416
102438
|
}
|
|
102417
102439
|
}
|
package/dist/assistant-server.js
CHANGED
|
@@ -82880,13 +82880,22 @@ class AssistantConfig {
|
|
|
82880
82880
|
getDefaultInitAssistantConfig() {
|
|
82881
82881
|
const id = randomId2();
|
|
82882
82882
|
const isCNB = !!useKey2("CNB");
|
|
82883
|
+
let kevisualUrl = "https://kevisual.cn";
|
|
82884
|
+
if (isCNB) {
|
|
82885
|
+
const uri = getCNBUrl();
|
|
82886
|
+
if (uri) {
|
|
82887
|
+
kevisualUrl = uri;
|
|
82888
|
+
} else {
|
|
82889
|
+
kevisualUrl = "http://kevisual.cn";
|
|
82890
|
+
}
|
|
82891
|
+
}
|
|
82883
82892
|
return {
|
|
82884
82893
|
app: {
|
|
82885
|
-
url:
|
|
82894
|
+
url: kevisualUrl,
|
|
82886
82895
|
id
|
|
82887
82896
|
},
|
|
82888
82897
|
description: "助手配置文件",
|
|
82889
|
-
docs:
|
|
82898
|
+
docs: `${kevisualUrl}/root/cli/docs/`,
|
|
82890
82899
|
home: isCNB ? "/root/cli-center" : "/root/home",
|
|
82891
82900
|
proxy: [],
|
|
82892
82901
|
share: {
|
|
@@ -82905,6 +82914,16 @@ var parseIfJson2 = (content) => {
|
|
|
82905
82914
|
}
|
|
82906
82915
|
};
|
|
82907
82916
|
var randomId2 = () => Math.random().toString(36).substring(2, 8);
|
|
82917
|
+
var getCNBUrl = () => {
|
|
82918
|
+
const isCNB = !!useKey2("CNB");
|
|
82919
|
+
const uri = useKey2("CNB_VSCODE_PROXY_URI");
|
|
82920
|
+
if (!isCNB)
|
|
82921
|
+
return null;
|
|
82922
|
+
if (uri) {
|
|
82923
|
+
return uri.replace("{{port}}", "51515");
|
|
82924
|
+
}
|
|
82925
|
+
return null;
|
|
82926
|
+
};
|
|
82908
82927
|
// src/module/assistant/proxy/http-proxy.ts
|
|
82909
82928
|
import http3 from "node:http";
|
|
82910
82929
|
import https2 from "node:https";
|
|
@@ -122986,7 +123005,6 @@ async function reload3() {
|
|
|
122986
123005
|
});
|
|
122987
123006
|
});
|
|
122988
123007
|
}
|
|
122989
|
-
|
|
122990
123008
|
// src/routes/config/index.ts
|
|
122991
123009
|
app.route({
|
|
122992
123010
|
path: "config",
|
|
@@ -123008,12 +123026,14 @@ app.route({
|
|
|
123008
123026
|
app.route({
|
|
123009
123027
|
path: "config",
|
|
123010
123028
|
key: "getId",
|
|
123011
|
-
description: "获取appId"
|
|
123029
|
+
description: "获取appId和访问地址"
|
|
123012
123030
|
}).define(async (ctx) => {
|
|
123013
123031
|
const config6 = assistantConfig2.getCacheAssistantConfig();
|
|
123014
123032
|
const appId = config6?.app?.id || null;
|
|
123033
|
+
let kevisualUrl = getCNBUrl() || "https://kevisual.cn";
|
|
123015
123034
|
ctx.body = {
|
|
123016
|
-
id: appId
|
|
123035
|
+
id: appId,
|
|
123036
|
+
url: kevisualUrl
|
|
123017
123037
|
};
|
|
123018
123038
|
}).addTo(app);
|
|
123019
123039
|
|
|
@@ -126702,11 +126722,6 @@ var getLiveMdContent = (opts) => {
|
|
|
126702
126722
|
- OpenWebUI: ${openWebUrl}
|
|
126703
126723
|
- Kevisual: ${kevisualUrl}
|
|
126704
126724
|
|
|
126705
|
-
### 直接访问
|
|
126706
|
-
- Kevisual: ${kevisualUrl}
|
|
126707
|
-
- OpenCode: ${url4?.replace("{{port}}", "4096")}
|
|
126708
|
-
- VSCode Web: ${vscodeWebUrl}
|
|
126709
|
-
|
|
126710
126725
|
### 密码访问
|
|
126711
126726
|
- OpenClaw: ${openclawUrlSecret}
|
|
126712
126727
|
- OpenCode: ${opencodeUrlSecret}
|
|
@@ -126716,8 +126731,11 @@ var getLiveMdContent = (opts) => {
|
|
|
126716
126731
|
|
|
126717
126732
|
### 其他说明
|
|
126718
126733
|
|
|
126734
|
+
1. 保活说明
|
|
126719
126735
|
使用插件访问vscode web获取wss进行保活,避免长时间不操作导致的自动断开连接。
|
|
126720
126736
|
|
|
126737
|
+
方法1: 使用插件访问vscode web获取wss进行保活,避免长时间不操作导致的自动断开连接。
|
|
126738
|
+
|
|
126721
126739
|
1. 安装插件[CNB LIVE](https://chromewebstore.google.com/detail/cnb-live/iajpiophkcdghonpijkcgpjafbcjhkko?pli=1)
|
|
126722
126740
|
2. 打开vscode web获取,点击插件,获取json数据,替换keep.json中的数据,保持在线状态。
|
|
126723
126741
|
3. keep.json中的数据结构说明:
|
|
@@ -126726,6 +126744,10 @@ var getLiveMdContent = (opts) => {
|
|
|
126726
126744
|
- url: vscode web的访问地址,可以直接访问vscode web
|
|
126727
126745
|
4. 运行cli命令,ev cnb live -c /workspace/live/keep.json.(直接对话opencode或者openclaw调用cnb-live技能即可)
|
|
126728
126746
|
|
|
126747
|
+
方法2:环境变量设置CNB_COOKIE,直接opencode或者openclaw的ui界面对话说,cnb-keep-live保活,他会自动调用保活,同时不需要点cnb-lie插件获取配置。
|
|
126748
|
+
|
|
126749
|
+
2. Opencode web访问说明
|
|
126750
|
+
Opencode打开web地址,需要在浏览器输入用户名和密码,用户名固定为root,密码为CNB_TOKEN的值. 纯连接打开包含账号密码,第一次点击后,需要把账号密码清理掉才能访问,opencode的bug导致的。
|
|
126729
126751
|
`;
|
|
126730
126752
|
const labels = [
|
|
126731
126753
|
{
|
|
@@ -126856,7 +126878,7 @@ var createOSInfo = (more = false) => {
|
|
|
126856
126878
|
}, {
|
|
126857
126879
|
key: "cpuCores",
|
|
126858
126880
|
title: "CPU 核心数",
|
|
126859
|
-
value:
|
|
126881
|
+
value: cpus.length,
|
|
126860
126882
|
description: "CPU 核心数"
|
|
126861
126883
|
}, {
|
|
126862
126884
|
key: "memoryUsed",
|
|
@@ -126898,8 +126920,8 @@ var createOSInfo = (more = false) => {
|
|
|
126898
126920
|
}, {
|
|
126899
126921
|
key: "buildUptime",
|
|
126900
126922
|
title: "构建已运行时间",
|
|
126901
|
-
value:
|
|
126902
|
-
description:
|
|
126923
|
+
value: buildUptime,
|
|
126924
|
+
description: `构建已运行时间: ${buildUptimeStr}`
|
|
126903
126925
|
});
|
|
126904
126926
|
if (maxRunTime > 0) {
|
|
126905
126927
|
const now = import_dayjs.default();
|
|
@@ -126918,8 +126940,8 @@ var createOSInfo = (more = false) => {
|
|
|
126918
126940
|
labels.unshift({
|
|
126919
126941
|
key: "remainingTime",
|
|
126920
126942
|
title: "剩余时间",
|
|
126921
|
-
value:
|
|
126922
|
-
description: "构建剩余时间"
|
|
126943
|
+
value: maxRunTime - buildUptime,
|
|
126944
|
+
description: "构建剩余时间" + formatUptime(Math.floor((maxRunTime - buildUptime) / 1000)) + " " + timeTo4Str
|
|
126923
126945
|
});
|
|
126924
126946
|
}
|
|
126925
126947
|
}
|
|
@@ -129139,6 +129161,7 @@ var {
|
|
|
129139
129161
|
// src/server.ts
|
|
129140
129162
|
import { spawnSync as spawnSync3 } from "node:child_process";
|
|
129141
129163
|
import path22 from "node:path";
|
|
129164
|
+
|
|
129142
129165
|
// src/module/get-bun-path.ts
|
|
129143
129166
|
import fs24 from "node:fs";
|
|
129144
129167
|
import path21 from "node:path";
|
package/dist/assistant.js
CHANGED
|
@@ -28807,13 +28807,22 @@ class AssistantConfig {
|
|
|
28807
28807
|
getDefaultInitAssistantConfig() {
|
|
28808
28808
|
const id = randomId();
|
|
28809
28809
|
const isCNB = !!useKey("CNB");
|
|
28810
|
+
let kevisualUrl = "https://kevisual.cn";
|
|
28811
|
+
if (isCNB) {
|
|
28812
|
+
const uri = getCNBUrl();
|
|
28813
|
+
if (uri) {
|
|
28814
|
+
kevisualUrl = uri;
|
|
28815
|
+
} else {
|
|
28816
|
+
kevisualUrl = "http://kevisual.cn";
|
|
28817
|
+
}
|
|
28818
|
+
}
|
|
28810
28819
|
return {
|
|
28811
28820
|
app: {
|
|
28812
|
-
url:
|
|
28821
|
+
url: kevisualUrl,
|
|
28813
28822
|
id
|
|
28814
28823
|
},
|
|
28815
28824
|
description: "助手配置文件",
|
|
28816
|
-
docs:
|
|
28825
|
+
docs: `${kevisualUrl}/root/cli/docs/`,
|
|
28817
28826
|
home: isCNB ? "/root/cli-center" : "/root/home",
|
|
28818
28827
|
proxy: [],
|
|
28819
28828
|
share: {
|
|
@@ -28832,6 +28841,16 @@ var parseIfJson = (content) => {
|
|
|
28832
28841
|
}
|
|
28833
28842
|
};
|
|
28834
28843
|
var randomId = () => Math.random().toString(36).substring(2, 8);
|
|
28844
|
+
var getCNBUrl = () => {
|
|
28845
|
+
const isCNB = !!useKey("CNB");
|
|
28846
|
+
const uri = useKey("CNB_VSCODE_PROXY_URI");
|
|
28847
|
+
if (!isCNB)
|
|
28848
|
+
return null;
|
|
28849
|
+
if (uri) {
|
|
28850
|
+
return uri.replace("{{port}}", "51515");
|
|
28851
|
+
}
|
|
28852
|
+
return null;
|
|
28853
|
+
};
|
|
28835
28854
|
// src/module/assistant/proxy/utils.ts
|
|
28836
28855
|
var isBun = typeof Bun !== "undefined" && Bun?.version != null;
|
|
28837
28856
|
var isNode = typeof process !== "undefined" && process?.versions != null && process.versions?.node != null;
|
package/dist/envision.js
CHANGED
|
@@ -22312,8 +22312,8 @@ InitEnv.init();
|
|
|
22312
22312
|
var version = useContextKey("version", () => {
|
|
22313
22313
|
let version2 = "0.0.64";
|
|
22314
22314
|
try {
|
|
22315
|
-
if ("0.1.
|
|
22316
|
-
version2 = "0.1.
|
|
22315
|
+
if ("0.1.15")
|
|
22316
|
+
version2 = "0.1.15";
|
|
22317
22317
|
} catch (e) {}
|
|
22318
22318
|
return version2;
|
|
22319
22319
|
});
|
|
@@ -28538,7 +28538,7 @@ var getPackageJson = (opts) => {
|
|
|
28538
28538
|
return null;
|
|
28539
28539
|
}
|
|
28540
28540
|
};
|
|
28541
|
-
var command2 = new Command("deploy").description("把前端文件传到服务器").argument("<filePath>", "Path to the file to be uploaded, filepath or directory").option("-v, --version <version>", "verbose").option("-k, --key <key>", "key").option("-y, --yes <yes>", "yes").option("-o, --org <org>", "org").option("-u, --update", "load current app. set current version in product。 redis 缓存更新").option("-s, --showBackend", "show backend url, 部署的后端应用,显示执行的cli命令").option("-d, --dot", "是否上传隐藏文件").option("--dir, --directory <directory>", "
|
|
28541
|
+
var command2 = new Command("deploy").description("把前端文件传到服务器").argument("<filePath>", "Path to the file to be uploaded, filepath or directory").option("-v, --version <version>", "verbose").option("-k, --key <key>", "key").option("-y, --yes <yes>", "yes").option("-o, --org <org>", "org").option("-u, --update", "load current app. set current version in product。 redis 缓存更新").option("-s, --showBackend", "show backend url, 部署的后端应用,显示执行的cli命令").option("-d, --dot", "是否上传隐藏文件").option("--dir, --directory <directory>", "上传的prefix路径,默认为空,例如设置为static,则会上传到/${username}/resources/${key}/${version}/static/路径下").action(async (filePath, options) => {
|
|
28542
28542
|
try {
|
|
28543
28543
|
let { version: version2, key, yes, update, org, showBackend } = options;
|
|
28544
28544
|
const dot = !!options.dot;
|
|
@@ -28646,7 +28646,7 @@ var command2 = new Command("deploy").description("把前端文件传到服务器
|
|
|
28646
28646
|
}
|
|
28647
28647
|
});
|
|
28648
28648
|
var uploadFilesV2 = async (files, directory, opts) => {
|
|
28649
|
-
const { key, version: version2, username } = opts || {};
|
|
28649
|
+
const { key, version: version2, username, directory: prefix } = opts || {};
|
|
28650
28650
|
for (let i = 0;i < files.length; i++) {
|
|
28651
28651
|
const file = files[i];
|
|
28652
28652
|
const filePath = path3.join(directory, file);
|
|
@@ -28659,7 +28659,7 @@ var uploadFilesV2 = async (files, directory, opts) => {
|
|
|
28659
28659
|
filepath: file
|
|
28660
28660
|
});
|
|
28661
28661
|
const _baseURL = getBaseURL();
|
|
28662
|
-
const url = new URL(`/${username}/resources/${key}/${version2}/${file}`, _baseURL);
|
|
28662
|
+
const url = new URL(`/${username}/resources/${key}/${version2}/${prefix ? prefix + "/" : ""}${file}`, _baseURL);
|
|
28663
28663
|
const token2 = await storage.getItem("token");
|
|
28664
28664
|
const check = () => {
|
|
28665
28665
|
const checkUrl = new URL(url.toString());
|
|
@@ -29997,8 +29997,11 @@ class SyncBase {
|
|
|
29997
29997
|
async getSyncList(opts) {
|
|
29998
29998
|
const config2 = this.config;
|
|
29999
29999
|
let sync = config2?.sync || {};
|
|
30000
|
+
const local2 = opts?.getLocalFile ?? true;
|
|
30000
30001
|
const syncDirectory = await this.getSyncDirectoryList();
|
|
30001
|
-
|
|
30002
|
+
if (local2) {
|
|
30003
|
+
sync = this.getMergeSync(sync, syncDirectory.sync);
|
|
30004
|
+
}
|
|
30002
30005
|
const syncKeys = Object.keys(sync);
|
|
30003
30006
|
const baseURL3 = this.baseURL;
|
|
30004
30007
|
const syncList = syncKeys.map((key) => {
|
|
@@ -30299,10 +30302,14 @@ var syncCreateList = new Command("create").option("-d --dir <dir>", "配置目
|
|
|
30299
30302
|
logger.info(newJson);
|
|
30300
30303
|
}
|
|
30301
30304
|
});
|
|
30302
|
-
var clone = new Command("clone").option("-d --dir <dir>", "配置目录").option("-c --config <config>", "配置文件的名字", "kevisual.json").option("-i --link <link>", "克隆链接, 比 kevisual.json 优先级更高").description("检查目录").action(async (opts) => {
|
|
30303
|
-
|
|
30305
|
+
var clone = new Command("clone").option("-d --dir <dir>", "配置目录").option("-c --config <config>", "配置文件的名字", "kevisual.json").option("-i --link <link>", "克隆链接, 比 kevisual.json 优先级更高").option("-l --local", "值对sync的列表进行clone处理,只对sync列表处理").description("检查目录").action(async (opts) => {
|
|
30306
|
+
let link = opts.link || "";
|
|
30307
|
+
const local2 = opts.local || false;
|
|
30304
30308
|
const sync = new SyncBase({ dir: opts.dir, baseURL, configFilename: opts.config });
|
|
30305
30309
|
if (link) {
|
|
30310
|
+
if (!link.endsWith(".json")) {
|
|
30311
|
+
link = link + (link.endsWith("/") ? "" : "/") + "kevisual.json";
|
|
30312
|
+
}
|
|
30306
30313
|
const res = await query.fetchText(link);
|
|
30307
30314
|
if (res.code === 200) {
|
|
30308
30315
|
fs14.writeFileSync(sync.configPath, JSON.stringify(res.data, null, 2));
|
|
@@ -30312,7 +30319,7 @@ var clone = new Command("clone").option("-d --dir <dir>", "配置目录").option
|
|
|
30312
30319
|
}
|
|
30313
30320
|
await sync.init();
|
|
30314
30321
|
}
|
|
30315
|
-
const syncList2 = await sync.getSyncList();
|
|
30322
|
+
const syncList2 = await sync.getSyncList({ getLocalFile: !local2 });
|
|
30316
30323
|
logger.debug(syncList2);
|
|
30317
30324
|
logger.info(`检查目录
|
|
30318
30325
|
`);
|
|
@@ -30338,21 +30345,22 @@ var clone = new Command("clone").option("-d --dir <dir>", "配置目录").option
|
|
|
30338
30345
|
const rp = sync.getRelativePath(item2.pathname);
|
|
30339
30346
|
if (!rp)
|
|
30340
30347
|
return false;
|
|
30341
|
-
if (rp.absolute.endsWith("gitignore.txt")) {
|
|
30342
|
-
const newPath = rp.absolute.replace("gitignore.txt", ".gitignore");
|
|
30343
|
-
rp.absolute = newPath;
|
|
30344
|
-
rp.relative = path10.relative(sync.dir, newPath);
|
|
30345
|
-
} else if (rp.absolute.endsWith(".dot")) {
|
|
30346
|
-
const filename = path10.basename(rp.absolute, ".dot");
|
|
30347
|
-
const newPath = path10.join(path10.dirname(rp.absolute), `.${filename}`);
|
|
30348
|
-
rp.absolute = newPath;
|
|
30349
|
-
rp.relative = path10.relative(sync.dir, newPath);
|
|
30350
|
-
}
|
|
30351
30348
|
return { ...item2, relative: rp.relative, absolute: rp.absolute };
|
|
30352
30349
|
}).filter((i) => i);
|
|
30353
30350
|
for (const matchItem of matchList) {
|
|
30354
30351
|
if (!matchItem)
|
|
30355
30352
|
continue;
|
|
30353
|
+
if (local2) {
|
|
30354
|
+
const some = syncList2.some((syncItem) => {
|
|
30355
|
+
if (syncItem.url === matchItem.url) {
|
|
30356
|
+
return true;
|
|
30357
|
+
}
|
|
30358
|
+
return false;
|
|
30359
|
+
});
|
|
30360
|
+
if (!some) {
|
|
30361
|
+
continue;
|
|
30362
|
+
}
|
|
30363
|
+
}
|
|
30356
30364
|
let needDownload = true;
|
|
30357
30365
|
let hash = "";
|
|
30358
30366
|
await sync.getDir(matchItem.absolute, true);
|