@kevisual/cli 0.1.9 → 0.1.11

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.
@@ -23667,7 +23667,7 @@ var require_lib2 = __commonJS((exports, module) => {
23667
23667
  };
23668
23668
  });
23669
23669
 
23670
- // ../node_modules/.pnpm/@kevisual+router@0.0.83/node_modules/@kevisual/router/dist/router.js
23670
+ // ../node_modules/.pnpm/@kevisual+router@0.0.84/node_modules/@kevisual/router/dist/router.js
23671
23671
  import { createRequire as createRequire2 } from "node:module";
23672
23672
  import { webcrypto as crypto2 } from "node:crypto";
23673
23673
  import http from "node:http";
@@ -40587,6 +40587,7 @@ class QueryRouter {
40587
40587
  const maxNextRoute = this.maxNextRoute;
40588
40588
  ctx = ctx || {};
40589
40589
  ctx.currentPath = path;
40590
+ ctx.currentId = route?.id;
40590
40591
  ctx.currentKey = key;
40591
40592
  ctx.currentRoute = route;
40592
40593
  ctx.index = (ctx.index || 0) + 1;
@@ -40600,7 +40601,7 @@ class QueryRouter {
40600
40601
  ctx.code = 500;
40601
40602
  ctx.message = "Too many nextRoute";
40602
40603
  ctx.body = null;
40603
- return;
40604
+ return ctx;
40604
40605
  }
40605
40606
  if (route && route.middleware && route.middleware.length > 0) {
40606
40607
  const errorMiddleware = [];
@@ -40675,7 +40676,9 @@ class QueryRouter {
40675
40676
  }
40676
40677
  return ctx;
40677
40678
  }
40678
- if (ctx.end) {}
40679
+ if (ctx.end) {
40680
+ return ctx;
40681
+ }
40679
40682
  }
40680
40683
  }
40681
40684
  }
@@ -40869,7 +40872,7 @@ class QueryRouter {
40869
40872
  description: "列出当前应用下的所有的路由信息",
40870
40873
  middleware: opts?.middleware || [],
40871
40874
  run: async (ctx) => {
40872
- const tokenUser = ctx.state.tokenUser;
40875
+ const tokenUser = ctx.state;
40873
40876
  let isUser = !!tokenUser;
40874
40877
  const list = this.getList(opts?.filter).filter((item) => {
40875
40878
  if (item.id === "auth" || item.id === "auth-can" || item.id === "check-auth-admin" || item.id === "auth-admin") {
@@ -40899,6 +40902,56 @@ class QueryRouter {
40899
40902
  toJSONSchema = toJSONSchema3;
40900
40903
  fromJSONSchema = fromJSONSchema3;
40901
40904
  }
40905
+
40906
+ class QueryRouterServer extends QueryRouter {
40907
+ handle;
40908
+ constructor(opts) {
40909
+ super();
40910
+ const initHandle = opts?.initHandle ?? true;
40911
+ if (initHandle || opts?.handleFn) {
40912
+ this.handle = this.getHandle(this, opts?.handleFn, opts?.context);
40913
+ }
40914
+ this.setContext({ needSerialize: false, ...opts?.context });
40915
+ if (opts?.appId) {
40916
+ this.appId = opts.appId;
40917
+ } else {
40918
+ this.appId = randomId(16);
40919
+ }
40920
+ }
40921
+ setHandle(wrapperFn, ctx) {
40922
+ this.handle = this.getHandle(this, wrapperFn, ctx);
40923
+ }
40924
+ addRoute(route, opts) {
40925
+ this.add(route, opts);
40926
+ }
40927
+ Route = Route;
40928
+ route(...args) {
40929
+ const [path, key, opts] = args;
40930
+ if (typeof path === "object") {
40931
+ return new Route(path.path, path.key, path);
40932
+ }
40933
+ if (typeof path === "string") {
40934
+ if (opts) {
40935
+ return new Route(path, key, opts);
40936
+ }
40937
+ if (key && typeof key === "object") {
40938
+ return new Route(path, key?.key || "", key);
40939
+ }
40940
+ return new Route(path, key);
40941
+ }
40942
+ return new Route(path, key, opts);
40943
+ }
40944
+ prompt(description) {
40945
+ return new Route(undefined, undefined, { description });
40946
+ }
40947
+ async run(msg, ctx) {
40948
+ const handle = this.handle;
40949
+ if (handle) {
40950
+ return handle(msg, ctx);
40951
+ }
40952
+ return super.run(msg, ctx);
40953
+ }
40954
+ }
40902
40955
  var isNode = typeof process !== "undefined" && process.versions != null && process.versions.node != null;
40903
40956
  var isBrowser = typeof window !== "undefined" && typeof document !== "undefined" && typeof document.createElement === "function";
40904
40957
  var isDeno = typeof Deno !== "undefined" && typeof Deno.version === "object" && typeof Deno.version.deno === "string";
@@ -41766,11 +41819,11 @@ class BunServer extends ServerBase {
41766
41819
  }
41767
41820
  }
41768
41821
 
41769
- class App extends QueryRouter {
41822
+ class App extends QueryRouterServer {
41770
41823
  router;
41771
41824
  server;
41772
41825
  constructor(opts) {
41773
- super();
41826
+ super({ initHandle: false, context: { needSerialize: true, ...opts?.routerContext } });
41774
41827
  const router = this;
41775
41828
  let server = opts?.server;
41776
41829
  if (!server) {
@@ -41782,7 +41835,6 @@ class App extends QueryRouter {
41782
41835
  }
41783
41836
  }
41784
41837
  server.setHandle(router.getHandle(router, opts?.routerHandle, opts?.routerContext));
41785
- router.setContext({ needSerialize: true, ...opts?.routerContext });
41786
41838
  this.router = router;
41787
41839
  this.server = server;
41788
41840
  if (opts?.appId) {
@@ -41795,42 +41847,7 @@ class App extends QueryRouter {
41795
41847
  listen(...args) {
41796
41848
  this.server.listen(...args);
41797
41849
  }
41798
- addRoute(route, opts) {
41799
- super.add(route, opts);
41800
- }
41801
41850
  Route = Route;
41802
- route(...args) {
41803
- const [path, key, opts] = args;
41804
- if (typeof path === "object") {
41805
- return new Route(path.path, path.key, path);
41806
- }
41807
- if (typeof path === "string") {
41808
- if (opts) {
41809
- return new Route(path, key, opts);
41810
- }
41811
- if (key && typeof key === "object") {
41812
- return new Route(path, key?.key || "", key);
41813
- }
41814
- return new Route(path, key);
41815
- }
41816
- return new Route(path, key, opts);
41817
- }
41818
- prompt(...args) {
41819
- const [desc] = args;
41820
- let description = "";
41821
- if (typeof desc === "string") {
41822
- description = desc;
41823
- } else if (typeof desc === "function") {
41824
- description = desc() || "";
41825
- }
41826
- return new Route("", "", { description });
41827
- }
41828
- async call(message, ctx) {
41829
- return await super.call(message, ctx);
41830
- }
41831
- async run(msg, ctx) {
41832
- return await super.run(msg, ctx);
41833
- }
41834
41851
  static handleRequest(req, res) {
41835
41852
  return handleServer(req, res);
41836
41853
  }
@@ -41845,7 +41862,7 @@ class App extends QueryRouter {
41845
41862
  }
41846
41863
  }
41847
41864
 
41848
- // ../node_modules/.pnpm/@kevisual+router@0.0.83/node_modules/@kevisual/router/dist/router-simple.js
41865
+ // ../node_modules/.pnpm/@kevisual+router@0.0.84/node_modules/@kevisual/router/dist/router-simple.js
41849
41866
  import url3 from "node:url";
41850
41867
  var __create3 = Object.create;
41851
41868
  var __getProtoOf3 = Object.getPrototypeOf;
@@ -52297,7 +52314,7 @@ class Query {
52297
52314
  }
52298
52315
  }
52299
52316
 
52300
- // ../node_modules/.pnpm/@kevisual+router@0.0.83/node_modules/@kevisual/router/dist/router-browser.js
52317
+ // ../node_modules/.pnpm/@kevisual+router@0.0.84/node_modules/@kevisual/router/dist/router-browser.js
52301
52318
  var __create5 = Object.create;
52302
52319
  var __getProtoOf5 = Object.getPrototypeOf;
52303
52320
  var __defProp5 = Object.defineProperty;
@@ -83457,6 +83474,15 @@ var installDeps = async (opts) => {
83457
83474
  syncSpawn("npm", params, { cwd: appPath, stdio: "inherit", env: process.env, shell: true });
83458
83475
  }
83459
83476
  };
83477
+ var execCommand = (command, options = {}) => {
83478
+ const { cwd } = options;
83479
+ return spawnSync(command, {
83480
+ stdio: "inherit",
83481
+ shell: true,
83482
+ cwd,
83483
+ env: process.env
83484
+ });
83485
+ };
83460
83486
 
83461
83487
  // src/services/init/update-pkgs.ts
83462
83488
  var import_semver = __toESM(require_semver2(), 1);
@@ -83740,7 +83766,7 @@ var simpleRouter = useContextKey("simpleRouter", () => {
83740
83766
  });
83741
83767
  app.createRouteList();
83742
83768
 
83743
- // ../node_modules/.pnpm/@kevisual+router@0.0.83/node_modules/@kevisual/router/dist/opencode.js
83769
+ // ../node_modules/.pnpm/@kevisual+router@0.0.84/node_modules/@kevisual/router/dist/opencode.js
83744
83770
  import { webcrypto as crypto4 } from "node:crypto";
83745
83771
  var __create6 = Object.create;
83746
83772
  var __getProtoOf6 = Object.getPrototypeOf;
@@ -98339,7 +98365,7 @@ var addCallFn = (app2) => {
98339
98365
  path: "call",
98340
98366
  key: "",
98341
98367
  description: "调用",
98342
- middleware: ["auth"],
98368
+ middleware: ["auth-admin"],
98343
98369
  metadata: {
98344
98370
  tags: ["opencode"],
98345
98371
  ...createSkill2({
@@ -98353,7 +98379,7 @@ var addCallFn = (app2) => {
98353
98379
  args: {
98354
98380
  path: tool2.schema.string().describe("应用路径,例如 cnb"),
98355
98381
  key: tool2.schema.string().optional().describe("应用key,例如 list-repos"),
98356
- payload: tool2.schema.object({}).optional().describe("调用参数")
98382
+ payload: tool2.schema.object({}).optional().describe('调用参数, 为对象, 例如 { "query": "javascript" }')
98357
98383
  }
98358
98384
  })
98359
98385
  }
@@ -98381,8 +98407,13 @@ var createRouterAgentPluginFn = (opts) => {
98381
98407
  if (!router.hasRoute("call", "")) {
98382
98408
  addCallFn(router);
98383
98409
  }
98384
- if (!router.hasRoute("auth", "")) {
98385
- router.route({ path: "auth", key: "", id: "auth", description: "认证" }).define(async (ctx) => {}).addTo(router);
98410
+ if (router) {
98411
+ router.route({ path: "auth", key: "", id: "auth", description: "认证" }).define(async (ctx) => {}).addTo(router, {
98412
+ overwrite: false
98413
+ });
98414
+ router.route({ path: "auth-admin", key: "", id: "auth-admin", description: "认证" }).define(async (ctx) => {}).addTo(router, {
98415
+ overwrite: false
98416
+ });
98386
98417
  }
98387
98418
  const _routes = filter2(router.routes, opts?.query || "");
98388
98419
  const routes = _routes.filter((r) => {
@@ -98396,7 +98427,7 @@ var createRouterAgentPluginFn = (opts) => {
98396
98427
  return false;
98397
98428
  });
98398
98429
  const AgentPlugin = async (pluginInput) => {
98399
- useContextKey3("plugin-input", () => pluginInput, true);
98430
+ useContextKey3("plugin-input", () => pluginInput, { isNew: true });
98400
98431
  const hooks = opts?.hooks ? await opts.hooks(pluginInput) : {};
98401
98432
  return {
98402
98433
  ...hooks,
@@ -98531,7 +98562,8 @@ app.route({
98531
98562
  title: "查看客户端 IP 地址",
98532
98563
  summary: "获取当前客户端的 IP 地址信息"
98533
98564
  })
98534
- }
98565
+ },
98566
+ middleware: ["auth-admin"]
98535
98567
  }).define(async (ctx) => {
98536
98568
  const networkInterfaces = os3.networkInterfaces();
98537
98569
  const ipAddresses = [];
@@ -100093,11 +100125,7 @@ app.route({
100093
100125
  message: "客户端重启命令已执行"
100094
100126
  };
100095
100127
  } catch (error111) {
100096
- ctx.status = 500;
100097
- ctx.body = {
100098
- message: "重启客户端失败",
100099
- error: error111.message
100100
- };
100128
+ ctx.throw(500, "重启客户端失败");
100101
100129
  }
100102
100130
  }).addTo(app);
100103
100131
 
@@ -100270,11 +100298,11 @@ app.route({
100270
100298
  })
100271
100299
  }
100272
100300
  }).define(async (ctx) => {
100273
- const { path: path14, key = "" } = ctx.query;
100301
+ const { path: path14, key = "" } = ctx.args;
100274
100302
  if (!path14) {
100275
100303
  ctx.throw("路径path不能为空");
100276
100304
  }
100277
- const res = await ctx.run({ path: path14, key, payload: ctx.query.payload || {} }, {
100305
+ const res = await ctx.run({ path: path14, key, payload: ctx.args.payload || {} }, {
100278
100306
  ...ctx
100279
100307
  });
100280
100308
  ctx.forward(res);
@@ -102141,27 +102169,32 @@ app.route({
102141
102169
  // src/routes/cnb-board/live/live-content.ts
102142
102170
  var import_dayjs = __toESM(require_dayjs_min(), 1);
102143
102171
  import os7 from "node:os";
102172
+ import { execSync as execSync3 } from "node:child_process";
102144
102173
  var getLiveMdContent = (opts) => {
102145
102174
  const more = opts?.more ?? false;
102146
102175
  const url4 = useKey2("CNB_VSCODE_PROXY_URI") || "";
102147
102176
  const token = useKey2("CNB_TOKEN") || "";
102148
102177
  const openclawPort = useKey2("OPENCLAW_PORT") || "80";
102149
- const openclawUrl = url4?.replace("{{port}}", openclawPort);
102178
+ const openclawUrl = url4.replace("{{port}}", openclawPort);
102150
102179
  const openclawUrlSecret = openclawUrl + "/openclaw?token=" + token;
102151
102180
  const opencodePort = useKey2("OPENCODE_PORT") || "100";
102152
- const opencodeUrl = url4?.replace("{{port}}", opencodePort);
102181
+ const opencodeUrl = url4.replace("{{port}}", opencodePort);
102153
102182
  const _opencodeURL = new URL(opencodeUrl);
102154
102183
  _opencodeURL.username = "root";
102155
102184
  _opencodeURL.password = token;
102156
102185
  const opencodeUrlSecret = _opencodeURL.toString();
102157
- const kevisualUrl = url4?.replace("{{port}}", "51515");
102186
+ const kevisualUrl = url4.replace("{{port}}", "51515");
102187
+ const openWebUrl = url4.replace("{{port}}", "200");
102158
102188
  const vscodeWebUrl = useKey2("CNB_VSCODE_WEB_URL") || "";
102159
102189
  const TEMPLATE = `# 开发环境模式配置
102160
102190
 
102161
102191
  ### 服务访问地址
102162
102192
  #### nginx 反向代理访问(推荐)
102163
- - OpenClaw: ${openclawUrl}
102193
+ - OpenClaw: ${openclawUrl + "/openclaw"}
102164
102194
  - OpenCode: ${opencodeUrl}
102195
+ - VSCode Web: ${vscodeWebUrl}
102196
+ - OpenWebUI: ${openWebUrl}
102197
+ - Kevisual: ${kevisualUrl}
102165
102198
 
102166
102199
  ### 直接访问
102167
102200
  - Kevisual: ${kevisualUrl}
@@ -102185,7 +102218,7 @@ var getLiveMdContent = (opts) => {
102185
102218
  - wss: vscode web的websocket地址
102186
102219
  - cookie: vscode web的cookie,保持和浏览器一致
102187
102220
  - url: vscode web的访问地址,可以直接访问vscode web
102188
- 4. 运行cli命令,ev cnb live -c /workspace/live/keep.json
102221
+ 4. 运行cli命令,ev cnb live -c /workspace/live/keep.json.(直接对话opencode或者openclaw调用cnb-live技能即可)
102189
102222
 
102190
102223
  `;
102191
102224
  const labels = [
@@ -102204,6 +102237,11 @@ var getLiveMdContent = (opts) => {
102204
102237
  value: token,
102205
102238
  description: "CNB 临时 Token,保持和环境变量 CNB_TOKEN 一致"
102206
102239
  },
102240
+ {
102241
+ title: "openWebUrl",
102242
+ value: openWebUrl,
102243
+ description: "OpenWebUI 的访问地址,可以通过该地址访问 OpenWebUI 服务"
102244
+ },
102207
102245
  {
102208
102246
  title: "openclawUrl",
102209
102247
  value: openclawUrl,
@@ -102236,7 +102274,7 @@ var getLiveMdContent = (opts) => {
102236
102274
  };
102237
102275
  var createOSInfo = (more = false) => {
102238
102276
  const labels = [];
102239
- const startTimer = useKey2("CNB_BUILD_START_TIME") || 0;
102277
+ const startTimer = useKey2("CNB_BUILD_START_TIME") || "";
102240
102278
  const cpus = os7.cpus();
102241
102279
  let totalIdle = 0;
102242
102280
  let totalTick = 0;
@@ -102247,10 +102285,26 @@ var createOSInfo = (more = false) => {
102247
102285
  totalIdle += cpu.times.idle;
102248
102286
  });
102249
102287
  const cpuUsage = ((1 - totalIdle / totalTick) * 100).toFixed(2);
102250
- const totalMem = os7.totalmem();
102251
- const freeMem = os7.freemem();
102252
- const usedMem = totalMem - freeMem;
102253
- const memUsage = (usedMem / totalMem * 100).toFixed(2);
102288
+ let memUsed = 0;
102289
+ let memTotal = 0;
102290
+ let memFree = 0;
102291
+ try {
102292
+ const freeOutput = execSync3("free -b", { encoding: "utf-8" });
102293
+ const lines = freeOutput.trim().split(`
102294
+ `);
102295
+ const memLine = lines.find((line) => line.startsWith("Mem:"));
102296
+ if (memLine) {
102297
+ const parts = memLine.split(/\s+/);
102298
+ memTotal = parseInt(parts[1]);
102299
+ memUsed = parseInt(parts[2]);
102300
+ memFree = parseInt(parts[3]);
102301
+ }
102302
+ } catch (e) {
102303
+ memTotal = os7.totalmem();
102304
+ memFree = os7.freemem();
102305
+ memUsed = memTotal - memFree;
102306
+ }
102307
+ const memUsage = memTotal > 0 ? (memUsed / memTotal * 100).toFixed(2) : "0.00";
102254
102308
  const formatBytes = (bytes) => {
102255
102309
  const sizes = ["B", "KB", "MB", "GB", "TB"];
102256
102310
  if (bytes === 0)
@@ -102259,8 +102313,6 @@ var createOSInfo = (more = false) => {
102259
102313
  return (bytes / Math.pow(1024, i)).toFixed(2) + " " + sizes[i];
102260
102314
  };
102261
102315
  const bootTime = os7.uptime();
102262
- const bootTimeDate = new Date(Date.now() - bootTime * 1000);
102263
- const bootTimeStr = import_dayjs.default(bootTimeDate).format("YYYY-MM-DD HH:mm:ss");
102264
102316
  const formatUptime = (seconds) => {
102265
102317
  const days = Math.floor(seconds / 86400);
102266
102318
  const hours = Math.floor(seconds % 86400 / 3600);
@@ -102268,7 +102320,13 @@ var createOSInfo = (more = false) => {
102268
102320
  const secs = Math.floor(seconds % 60);
102269
102321
  return `${days}天 ${hours}小时 ${minutes}分钟 ${secs}秒`;
102270
102322
  };
102271
- const diskInfo = "可通过 df -h 命令获取";
102323
+ let diskUsage = "";
102324
+ try {
102325
+ const duOutput = execSync3("du -sh .", { encoding: "utf-8" });
102326
+ diskUsage = duOutput.trim().split("\t")[0];
102327
+ } catch (e) {
102328
+ diskUsage = "获取失败";
102329
+ }
102272
102330
  labels.push({
102273
102331
  title: "cpuUsage",
102274
102332
  value: `${cpuUsage}%`,
@@ -102279,33 +102337,35 @@ var createOSInfo = (more = false) => {
102279
102337
  description: "CPU 核心数"
102280
102338
  }, {
102281
102339
  title: "memoryUsed",
102282
- value: formatBytes(usedMem),
102340
+ value: formatBytes(memUsed),
102283
102341
  description: "已使用内存"
102284
102342
  }, {
102285
102343
  title: "memoryTotal",
102286
- value: formatBytes(totalMem),
102344
+ value: formatBytes(memTotal),
102287
102345
  description: "总内存"
102346
+ }, {
102347
+ title: "memoryFree",
102348
+ value: formatBytes(memFree),
102349
+ description: "空闲内存"
102288
102350
  }, {
102289
102351
  title: "memoryUsage",
102290
102352
  value: `${memUsage}%`,
102291
102353
  description: "内存使用率"
102292
102354
  }, {
102293
- title: "diskInfo",
102294
- value: diskInfo,
102295
- description: "磁盘信息 (请使用 df -h 命令查看)"
102296
- }, {
102297
- title: "bootTime",
102298
- value: bootTimeStr,
102299
- description: "系统启动时间"
102355
+ title: "diskUsage",
102356
+ value: diskUsage,
102357
+ description: "当前目录磁盘使用情况"
102300
102358
  }, {
102301
102359
  title: "uptime",
102302
102360
  value: formatUptime(bootTime),
102303
102361
  description: "系统运行时间"
102304
102362
  });
102305
102363
  if (startTimer) {
102306
- const buildStartTime = import_dayjs.default(parseInt(startTimer)).format("YYYY-MM-DD HH:mm:ss");
102307
- const buildUptime = Date.now() - parseInt(startTimer);
102364
+ const buildStartTime = import_dayjs.default(startTimer).format("YYYY-MM-DD HH:mm:ss");
102365
+ const buildStartTimestamp = import_dayjs.default(startTimer).valueOf();
102366
+ const buildUptime = Date.now() - buildStartTimestamp;
102308
102367
  const buildUptimeStr = formatUptime(Math.floor(buildUptime / 1000));
102368
+ const maxRunTime = useKey2("CNB_PIPELINE_MAX_RUN_TIME") || 0;
102309
102369
  labels.push({
102310
102370
  title: "buildStartTime",
102311
102371
  value: buildStartTime,
@@ -102315,6 +102375,25 @@ var createOSInfo = (more = false) => {
102315
102375
  value: buildUptimeStr,
102316
102376
  description: "构建已运行时间"
102317
102377
  });
102378
+ if (maxRunTime > 0) {
102379
+ const now = import_dayjs.default();
102380
+ const today4am = now.hour(4).minute(0).second(0).millisecond(0);
102381
+ let timeTo4 = today4am.valueOf() - now.valueOf();
102382
+ if (timeTo4 < 0) {
102383
+ timeTo4 = today4am.add(1, "day").valueOf() - now.valueOf();
102384
+ }
102385
+ const timeTo4Str = `[距离晚上4点重启时间: ${formatUptime(Math.floor(timeTo4 / 1000))}]`;
102386
+ labels.push({
102387
+ title: "buildMaxRunTime",
102388
+ value: formatUptime(Math.floor(maxRunTime / 1000)),
102389
+ description: "构建最大运行时间(限制时间)"
102390
+ });
102391
+ labels.unshift({
102392
+ title: "剩余时间",
102393
+ value: formatUptime(Math.floor((maxRunTime - buildUptime) / 1000)) + " " + timeTo4Str,
102394
+ description: "构建剩余时间"
102395
+ });
102396
+ }
102318
102397
  }
102319
102398
  if (more) {
102320
102399
  const loadavg = os7.loadavg();
@@ -102353,8 +102432,26 @@ var createOSInfo = (more = false) => {
102353
102432
 
102354
102433
  // src/routes/cnb-board/cnb-dev-env.ts
102355
102434
  app.route({
102356
- path: "cnb-board",
102357
- key: "live-repo-info",
102435
+ path: "cnb_board",
102436
+ key: "live",
102437
+ description: "获取cnb-board live的mdContent内容",
102438
+ middleware: ["auth-admin"],
102439
+ metadata: {
102440
+ args: {
102441
+ more: zod_default.boolean().optional().describe("是否获取更多系统信息,默认false")
102442
+ }
102443
+ }
102444
+ }).define(async (ctx) => {
102445
+ const more = ctx.query?.more ?? false;
102446
+ const list4 = getLiveMdContent({ more });
102447
+ ctx.body = {
102448
+ title: "开发环境模式配置",
102449
+ list: list4
102450
+ };
102451
+ }).addTo(app);
102452
+ app.route({
102453
+ path: "cnb_board",
102454
+ key: "live_repo_info",
102358
102455
  description: "获取cnb-board live的repo信息",
102359
102456
  middleware: ["auth-admin"]
102360
102457
  }).define(async (ctx) => {
@@ -102401,8 +102498,8 @@ app.route({
102401
102498
  };
102402
102499
  }).addTo(app);
102403
102500
  app.route({
102404
- path: "cnb-board",
102405
- key: "live-build-info",
102501
+ path: "cnb_board",
102502
+ key: "live_build_info",
102406
102503
  description: "获取cnb-board live的构建信息",
102407
102504
  middleware: ["auth-admin"]
102408
102505
  }).define(async (ctx) => {
@@ -102544,8 +102641,8 @@ app.route({
102544
102641
  };
102545
102642
  }).addTo(app);
102546
102643
  app.route({
102547
- path: "cnb-board",
102548
- key: "live-pull-info",
102644
+ path: "cnb_board",
102645
+ key: "live_pull_info",
102549
102646
  description: "获取cnb-board live的PR信息",
102550
102647
  middleware: ["auth-admin"]
102551
102648
  }).define(async (ctx) => {
@@ -102642,8 +102739,8 @@ app.route({
102642
102739
  };
102643
102740
  }).addTo(app);
102644
102741
  app.route({
102645
- path: "cnb-board",
102646
- key: "live-npc-info",
102742
+ path: "cnb_board",
102743
+ key: "live_npc_info",
102647
102744
  description: "获取cnb-board live的NPC信息",
102648
102745
  middleware: ["auth-admin"]
102649
102746
  }).define(async (ctx) => {
@@ -102685,8 +102782,8 @@ app.route({
102685
102782
  };
102686
102783
  }).addTo(app);
102687
102784
  app.route({
102688
- path: "cnb-board",
102689
- key: "live-comment-info",
102785
+ path: "cnb_board",
102786
+ key: "live_comment_info",
102690
102787
  description: "获取cnb-board live的评论信息",
102691
102788
  middleware: ["auth-admin"]
102692
102789
  }).define(async (ctx) => {
@@ -102731,22 +102828,24 @@ app.route({
102731
102828
  // src/routes/cnb-board/index.ts
102732
102829
  app.route({
102733
102830
  path: "cnb-board",
102734
- key: "live",
102735
- description: "获取cnb-board live的mdContent内容",
102736
- middleware: ["auth-admin"],
102737
- metadata: {
102738
- args: {
102739
- more: zod_default.boolean().optional().describe("是否获取更多系统信息,默认false")
102740
- }
102741
- }
102831
+ key: "is-cnb-board",
102832
+ description: "检查是否是 cnb-board 环境",
102833
+ middleware: ["auth-admin"]
102742
102834
  }).define(async (ctx) => {
102743
- const more = ctx.query?.more ?? false;
102744
- const list4 = getLiveMdContent({ more });
102835
+ const isCNB = useKey2("CNB");
102745
102836
  ctx.body = {
102746
- title: "开发环境模式配置",
102747
- list: list4
102837
+ isCNB: !!isCNB
102748
102838
  };
102749
102839
  }).addTo(app);
102840
+ app.route({
102841
+ path: "cnb-board",
102842
+ key: "exit",
102843
+ description: "cnb的工作环境退出程序",
102844
+ middleware: ["auth-admin"]
102845
+ }).define(async (ctx) => {
102846
+ const cmd = "kill 1";
102847
+ execCommand(cmd);
102848
+ }).addTo(app);
102750
102849
 
102751
102850
  // ../node_modules/.pnpm/lru-cache@11.2.6/node_modules/lru-cache/dist/esm/index.min.js
102752
102851
  var M = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date;
@@ -103462,7 +103561,7 @@ var import_busboy = __toESM(require_lib2(), 1);
103462
103561
  import path16 from "path";
103463
103562
  import fs19 from "fs";
103464
103563
 
103465
- // ../node_modules/.pnpm/@kevisual+router@0.0.83/node_modules/@kevisual/router/src/server/cookie.ts
103564
+ // ../node_modules/.pnpm/@kevisual+router@0.0.84/node_modules/@kevisual/router/src/server/cookie.ts
103466
103565
  var NullObject2 = /* @__PURE__ */ (() => {
103467
103566
  const C2 = function() {};
103468
103567
  C2.prototype = Object.create(null);