@kevisual/cli 0.1.14 → 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.
@@ -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: "https://kevisual.cn",
44024
+ url: kevisualUrl,
44016
44025
  id
44017
44026
  },
44018
44027
  description: "助手配置文件",
44019
- docs: "https://kevisual.cn/root/cli/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
 
@@ -102203,9 +102223,9 @@ var getLiveMdContent = (opts) => {
102203
102223
 
102204
102224
  ### 其他说明
102205
102225
 
102226
+ 1. 保活说明
102206
102227
  使用插件访问vscode web获取wss进行保活,避免长时间不操作导致的自动断开连接。
102207
102228
 
102208
- 保活说明
102209
102229
  方法1: 使用插件访问vscode web获取wss进行保活,避免长时间不操作导致的自动断开连接。
102210
102230
 
102211
102231
  1. 安装插件[CNB LIVE](https://chromewebstore.google.com/detail/cnb-live/iajpiophkcdghonpijkcgpjafbcjhkko?pli=1)
@@ -102217,6 +102237,9 @@ var getLiveMdContent = (opts) => {
102217
102237
  4. 运行cli命令,ev cnb live -c /workspace/live/keep.json.(直接对话opencode或者openclaw调用cnb-live技能即可)
102218
102238
 
102219
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导致的。
102220
102243
  `;
102221
102244
  const labels = [
102222
102245
  {
@@ -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: "https://kevisual.cn",
82894
+ url: kevisualUrl,
82886
82895
  id
82887
82896
  },
82888
82897
  description: "助手配置文件",
82889
- docs: "https://kevisual.cn/root/cli/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
 
@@ -126711,9 +126731,9 @@ var getLiveMdContent = (opts) => {
126711
126731
 
126712
126732
  ### 其他说明
126713
126733
 
126734
+ 1. 保活说明
126714
126735
  使用插件访问vscode web获取wss进行保活,避免长时间不操作导致的自动断开连接。
126715
126736
 
126716
- 保活说明
126717
126737
  方法1: 使用插件访问vscode web获取wss进行保活,避免长时间不操作导致的自动断开连接。
126718
126738
 
126719
126739
  1. 安装插件[CNB LIVE](https://chromewebstore.google.com/detail/cnb-live/iajpiophkcdghonpijkcgpjafbcjhkko?pli=1)
@@ -126725,6 +126745,9 @@ var getLiveMdContent = (opts) => {
126725
126745
  4. 运行cli命令,ev cnb live -c /workspace/live/keep.json.(直接对话opencode或者openclaw调用cnb-live技能即可)
126726
126746
 
126727
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导致的。
126728
126751
  `;
126729
126752
  const labels = [
126730
126753
  {
@@ -129138,6 +129161,7 @@ var {
129138
129161
  // src/server.ts
129139
129162
  import { spawnSync as spawnSync3 } from "node:child_process";
129140
129163
  import path22 from "node:path";
129164
+
129141
129165
  // src/module/get-bun-path.ts
129142
129166
  import fs24 from "node:fs";
129143
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: "https://kevisual.cn",
28821
+ url: kevisualUrl,
28813
28822
  id
28814
28823
  },
28815
28824
  description: "助手配置文件",
28816
- docs: "https://kevisual.cn/root/cli/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.14")
22316
- version2 = "0.1.14";
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>", "上传的默认路径").action(async (filePath, options) => {
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
- sync = this.getMergeSync(sync, syncDirectory.sync);
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
- const link = opts.link || "";
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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kevisual/cli",
3
- "version": "0.1.14",
3
+ "version": "0.1.15",
4
4
  "description": "envision 命令行工具",
5
5
  "type": "module",
6
6
  "basename": "/root/cli",