@kevisual/cli 0.0.64 → 0.0.66

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.
@@ -67104,7 +67104,7 @@ var wsProxy = (server, config2) => {
67104
67104
  wssApp.upgrade(request, socket, head);
67105
67105
  });
67106
67106
  };
67107
- // ../node_modules/.pnpm/@kevisual+local-app-manager@0.1.27_supports-color@10.2.2/node_modules/@kevisual/local-app-manager/dist/manager.mjs
67107
+ // ../node_modules/.pnpm/@kevisual+local-app-manager@0.1.28_supports-color@10.2.2/node_modules/@kevisual/local-app-manager/dist/manager.mjs
67108
67108
  var exports_manager = {};
67109
67109
  __export(exports_manager, {
67110
67110
  onAppShowInfo: () => onAppShowInfo,
@@ -67181,7 +67181,7 @@ var getConfigFile = (opts) => {
67181
67181
  return "";
67182
67182
  };
67183
67183
 
67184
- // ../node_modules/.pnpm/@kevisual+local-app-manager@0.1.27_supports-color@10.2.2/node_modules/@kevisual/local-app-manager/dist/manager.mjs
67184
+ // ../node_modules/.pnpm/@kevisual+local-app-manager@0.1.28_supports-color@10.2.2/node_modules/@kevisual/local-app-manager/dist/manager.mjs
67185
67185
  import path$1 from "node:path";
67186
67186
  import fs$4 from "node:fs";
67187
67187
  import { fork } from "node:child_process";
@@ -73713,8 +73713,7 @@ var existDenpend = [
73713
73713
  "@kevisual/use-config",
73714
73714
  "ioredis",
73715
73715
  "socket.io",
73716
- "minio",
73717
- "@msgpack/msgpack"
73716
+ "minio"
73718
73717
  ];
73719
73718
  var AppType = /* @__PURE__ */ ((AppType2) => {
73720
73719
  AppType2["SystemApp"] = "system-app";
@@ -73885,7 +73884,8 @@ class Manager {
73885
73884
  }
73886
73885
  } else {}
73887
73886
  } catch (e) {
73888
- console.error("load app", e);
73887
+ console.error(`load app error====[${app.type} | ${app.key}]
73888
+ `, e);
73889
73889
  }
73890
73890
  }
73891
73891
  pm2Connect.disconnect();
@@ -74136,7 +74136,7 @@ var clearMicroApp = (link) => {
74136
74136
  console.error(`Failed to unload module ${link}:`, error2);
74137
74137
  }
74138
74138
  };
74139
- // ../node_modules/.pnpm/@kevisual+local-app-manager@0.1.27_supports-color@10.2.2/node_modules/@kevisual/local-app-manager/dist/pm2.mjs
74139
+ // ../node_modules/.pnpm/@kevisual+local-app-manager@0.1.28_supports-color@10.2.2/node_modules/@kevisual/local-app-manager/dist/pm2.mjs
74140
74140
  import pm22 from "pm2";
74141
74141
  import { promisify as promisify2 } from "node:util";
74142
74142
  var disconnect = promisify2(pm22.disconnect).bind(pm22);
@@ -74445,6 +74445,35 @@ class AssistantQuery {
74445
74445
  return this.query.get(body, options);
74446
74446
  }
74447
74447
  }
74448
+ // src/module/npm-install.ts
74449
+ import { spawn, spawnSync } from "child_process";
74450
+ var checkPnpm = () => {
74451
+ try {
74452
+ spawnSync("pnpm", ["--version"]);
74453
+ return true;
74454
+ } catch (e) {
74455
+ return false;
74456
+ }
74457
+ };
74458
+ var installDeps = async (opts) => {
74459
+ const { appPath } = opts;
74460
+ const isProduction = opts.isProduction ?? true;
74461
+ const isPnpm = checkPnpm();
74462
+ const params = ["i"];
74463
+ if (isProduction && isPnpm) {
74464
+ params.push("--production");
74465
+ } else {
74466
+ params.push("--omit=dev");
74467
+ }
74468
+ console.log("installDeps", appPath, params);
74469
+ const syncSpawn = opts.sync ? spawnSync : spawn;
74470
+ if (isPnpm) {
74471
+ syncSpawn("pnpm", params, { cwd: appPath, stdio: "inherit", env: process.env });
74472
+ } else {
74473
+ syncSpawn("npm", params, { cwd: appPath, stdio: "inherit", env: process.env });
74474
+ }
74475
+ };
74476
+
74448
74477
  // src/services/init/index.ts
74449
74478
  class AssistantInit extends AssistantConfig {
74450
74479
  #query;
@@ -74536,8 +74565,8 @@ class AssistantInit extends AssistantConfig {
74536
74565
  "description": "assistant-app package pnpm, node pkgs projects",
74537
74566
  "type": "module",
74538
74567
  "scripts": {
74539
- "start": "pm2 start apps/code-center/dist/app.mjs --name code-center",
74540
- "proxy": "pm2 start apps/page-proxy/dist/app.mjs --name page-proxy"
74568
+ "start": "pm2 start apps/root/code-center/app.mjs --name root/code-center",
74569
+ "proxy": "pm2 start apps/root/page-proxy/app.mjs --name root/page-proxy"
74541
74570
  },
74542
74571
  "keywords": [],
74543
74572
  "author": "",
@@ -74545,6 +74574,7 @@ class AssistantInit extends AssistantConfig {
74545
74574
  "dependencies": {
74546
74575
  "@kevisual/router": "latest",
74547
74576
  "@kevisual/use-config": "latest",
74577
+ "@kevisual/query": "latest",
74548
74578
  "ioredis": "latest",
74549
74579
  "minio": "latest",
74550
74580
  "pg": "latest",
@@ -74564,7 +74594,10 @@ class AssistantInit extends AssistantConfig {
74564
74594
  }
74565
74595
  }
74566
74596
  `);
74567
- console.log(chalk2.green("助手 package.json 文件创建成功"));
74597
+ console.log(chalk2.green("助手 package.json 文件创建成功, 正在安装依赖..."));
74598
+ installDeps({ appPath: path8.dirname(packagePath), isProduction: true }).then(() => {
74599
+ console.log(chalk2.green("助手依赖安装完成"));
74600
+ });
74568
74601
  }
74569
74602
  return {
74570
74603
  create
@@ -77130,7 +77163,7 @@ var dist_default2 = createPrompt((config3, done) => {
77130
77163
  // ../node_modules/.pnpm/@inquirer+external-editor@2.0.1_@types+node@24.10.1/node_modules/@inquirer/external-editor/dist/index.js
77131
77164
  var import_chardet = __toESM(require_lib2(), 1);
77132
77165
  var import_iconv_lite = __toESM(require_lib3(), 1);
77133
- import { spawn, spawnSync } from "child_process";
77166
+ import { spawn as spawn2, spawnSync as spawnSync2 } from "child_process";
77134
77167
  import { readFileSync, unlinkSync, writeFileSync } from "fs";
77135
77168
  import path10 from "node:path";
77136
77169
  import os3 from "node:os";
@@ -77308,7 +77341,7 @@ class ExternalEditor {
77308
77341
  }
77309
77342
  launchEditor() {
77310
77343
  try {
77311
- const editorProcess = spawnSync(this.editor.bin, this.editor.args.concat([this.tempFile]), { stdio: "inherit" });
77344
+ const editorProcess = spawnSync2(this.editor.bin, this.editor.args.concat([this.tempFile]), { stdio: "inherit" });
77312
77345
  this.lastExitStatus = editorProcess.status ?? 0;
77313
77346
  } catch (launchError) {
77314
77347
  throw new LaunchEditorError(launchError);
@@ -77316,7 +77349,7 @@ class ExternalEditor {
77316
77349
  }
77317
77350
  launchEditorAsync(callback) {
77318
77351
  try {
77319
- const editorProcess = spawn(this.editor.bin, this.editor.args.concat([this.tempFile]), { stdio: "inherit" });
77352
+ const editorProcess = spawn2(this.editor.bin, this.editor.args.concat([this.tempFile]), { stdio: "inherit" });
77320
77353
  editorProcess.on("exit", (code) => {
77321
77354
  this.lastExitStatus = code;
77322
77355
  setImmediate(callback);
@@ -78437,9 +78470,9 @@ var inquirer = {
78437
78470
  var dist_default12 = inquirer;
78438
78471
 
78439
78472
  // src/services/app/index.ts
78440
- import { spawnSync as spawnSync2 } from "child_process";
78473
+ import { spawnSync as spawnSync3 } from "child_process";
78441
78474
  var runCommand = (command, args) => {
78442
- const result = spawnSync2(command, args, {
78475
+ const result = spawnSync3(command, args, {
78443
78476
  stdio: "inherit",
78444
78477
  shell: true
78445
78478
  });
@@ -81839,7 +81872,7 @@ var {
81839
81872
  } = import__.default;
81840
81873
 
81841
81874
  // src/server.ts
81842
- import { spawnSync as spawnSync3 } from "child_process";
81875
+ import { spawnSync as spawnSync4 } from "child_process";
81843
81876
  var runServer = async (port, listenPath = "127.0.0.1") => {
81844
81877
  let _port;
81845
81878
  if (port) {
@@ -81881,19 +81914,19 @@ var runServer = async (port, listenPath = "127.0.0.1") => {
81881
81914
  port: _port
81882
81915
  };
81883
81916
  };
81884
- program.description("启动服务").option("-d, --daemon", "是否以守护进程方式运行").option("-n, --name <name>", "服务名称", "assistant-server").option("-p, --port <port>", "服务端口").option("-s, --start", "是否启动服务").option("-i, --home", "home目录").action(async (options) => {
81917
+ program.description("启动服务").option("-d, --daemon", "是否以守护进程方式运行").option("-n, --name <name>", "服务名称", "assistant-server").option("-p, --port <port>", "服务端口").option("-s, --start", "是否启动服务").option("-e, --interpreter <interpreter>", "指定使用的解释器", "bun").option("-i, --home", "home目录").action(async (options) => {
81885
81918
  if (options.daemon) {
81886
81919
  const [_interpreter, execPath] = process.argv;
81887
81920
  const name = options.name;
81888
81921
  const port = options.port;
81889
- let pm2Command = `pm2 start ${execPath} --name ${name} -- -s `;
81922
+ let pm2Command = `pm2 start ${execPath} --interpreter ${options.interpreter} --name ${name} -- -s `;
81890
81923
  if (port) {
81891
81924
  pm2Command += ` -p ${port}`;
81892
81925
  }
81893
81926
  if (options.home) {
81894
81927
  pm2Command += ` --home`;
81895
81928
  }
81896
- const result = spawnSync3(pm2Command, {
81929
+ const result = spawnSync4(pm2Command, {
81897
81930
  shell: true,
81898
81931
  stdio: "inherit"
81899
81932
  });
package/dist/assistant.js CHANGED
@@ -41648,7 +41648,7 @@ var import_websocket_server = __toESM(require_websocket_server(), 1);
41648
41648
  var wss = new import_websocket_server.default({
41649
41649
  noServer: true
41650
41650
  });
41651
- // ../node_modules/.pnpm/@kevisual+local-app-manager@0.1.27_supports-color@10.2.2/node_modules/@kevisual/local-app-manager/dist/manager.mjs
41651
+ // ../node_modules/.pnpm/@kevisual+local-app-manager@0.1.28_supports-color@10.2.2/node_modules/@kevisual/local-app-manager/dist/manager.mjs
41652
41652
  var exports_manager = {};
41653
41653
  __export(exports_manager, {
41654
41654
  onAppShowInfo: () => onAppShowInfo,
@@ -41725,7 +41725,7 @@ var getConfigFile = (opts) => {
41725
41725
  return "";
41726
41726
  };
41727
41727
 
41728
- // ../node_modules/.pnpm/@kevisual+local-app-manager@0.1.27_supports-color@10.2.2/node_modules/@kevisual/local-app-manager/dist/manager.mjs
41728
+ // ../node_modules/.pnpm/@kevisual+local-app-manager@0.1.28_supports-color@10.2.2/node_modules/@kevisual/local-app-manager/dist/manager.mjs
41729
41729
  import path$1 from "node:path";
41730
41730
  import fs$4 from "node:fs";
41731
41731
  import { fork } from "node:child_process";
@@ -48257,8 +48257,7 @@ var existDenpend = [
48257
48257
  "@kevisual/use-config",
48258
48258
  "ioredis",
48259
48259
  "socket.io",
48260
- "minio",
48261
- "@msgpack/msgpack"
48260
+ "minio"
48262
48261
  ];
48263
48262
  var AppType = /* @__PURE__ */ ((AppType2) => {
48264
48263
  AppType2["SystemApp"] = "system-app";
@@ -48429,7 +48428,8 @@ class Manager {
48429
48428
  }
48430
48429
  } else {}
48431
48430
  } catch (e) {
48432
- console.error("load app", e);
48431
+ console.error(`load app error====[${app.type} | ${app.key}]
48432
+ `, e);
48433
48433
  }
48434
48434
  }
48435
48435
  pm2Connect.disconnect();
@@ -48680,7 +48680,7 @@ var clearMicroApp = (link) => {
48680
48680
  console.error(`Failed to unload module ${link}:`, error2);
48681
48681
  }
48682
48682
  };
48683
- // ../node_modules/.pnpm/@kevisual+local-app-manager@0.1.27_supports-color@10.2.2/node_modules/@kevisual/local-app-manager/dist/pm2.mjs
48683
+ // ../node_modules/.pnpm/@kevisual+local-app-manager@0.1.28_supports-color@10.2.2/node_modules/@kevisual/local-app-manager/dist/pm2.mjs
48684
48684
  import pm22 from "pm2";
48685
48685
  import { promisify as promisify2 } from "node:util";
48686
48686
  var disconnect = promisify2(pm22.disconnect).bind(pm22);
@@ -66388,6 +66388,35 @@ class HttpsPem {
66388
66388
  }
66389
66389
  }
66390
66390
 
66391
+ // src/module/npm-install.ts
66392
+ import { spawn, spawnSync } from "child_process";
66393
+ var checkPnpm = () => {
66394
+ try {
66395
+ spawnSync("pnpm", ["--version"]);
66396
+ return true;
66397
+ } catch (e) {
66398
+ return false;
66399
+ }
66400
+ };
66401
+ var installDeps = async (opts) => {
66402
+ const { appPath } = opts;
66403
+ const isProduction = opts.isProduction ?? true;
66404
+ const isPnpm = checkPnpm();
66405
+ const params = ["i"];
66406
+ if (isProduction && isPnpm) {
66407
+ params.push("--production");
66408
+ } else {
66409
+ params.push("--omit=dev");
66410
+ }
66411
+ console.log("installDeps", appPath, params);
66412
+ const syncSpawn = opts.sync ? spawnSync : spawn;
66413
+ if (isPnpm) {
66414
+ syncSpawn("pnpm", params, { cwd: appPath, stdio: "inherit", env: process.env });
66415
+ } else {
66416
+ syncSpawn("npm", params, { cwd: appPath, stdio: "inherit", env: process.env });
66417
+ }
66418
+ };
66419
+
66391
66420
  // src/services/init/index.ts
66392
66421
  class AssistantInit extends AssistantConfig {
66393
66422
  #query;
@@ -66479,8 +66508,8 @@ class AssistantInit extends AssistantConfig {
66479
66508
  "description": "assistant-app package pnpm, node pkgs projects",
66480
66509
  "type": "module",
66481
66510
  "scripts": {
66482
- "start": "pm2 start apps/code-center/dist/app.mjs --name code-center",
66483
- "proxy": "pm2 start apps/page-proxy/dist/app.mjs --name page-proxy"
66511
+ "start": "pm2 start apps/root/code-center/app.mjs --name root/code-center",
66512
+ "proxy": "pm2 start apps/root/page-proxy/app.mjs --name root/page-proxy"
66484
66513
  },
66485
66514
  "keywords": [],
66486
66515
  "author": "",
@@ -66488,6 +66517,7 @@ class AssistantInit extends AssistantConfig {
66488
66517
  "dependencies": {
66489
66518
  "@kevisual/router": "latest",
66490
66519
  "@kevisual/use-config": "latest",
66520
+ "@kevisual/query": "latest",
66491
66521
  "ioredis": "latest",
66492
66522
  "minio": "latest",
66493
66523
  "pg": "latest",
@@ -66507,7 +66537,10 @@ class AssistantInit extends AssistantConfig {
66507
66537
  }
66508
66538
  }
66509
66539
  `);
66510
- console.log(chalk2.green("助手 package.json 文件创建成功"));
66540
+ console.log(chalk2.green("助手 package.json 文件创建成功, 正在安装依赖..."));
66541
+ installDeps({ appPath: path7.dirname(packagePath), isProduction: true }).then(() => {
66542
+ console.log(chalk2.green("助手依赖安装完成"));
66543
+ });
66511
66544
  }
66512
66545
  return {
66513
66546
  create
@@ -68216,7 +68249,7 @@ var dist_default2 = createPrompt((config2, done) => {
68216
68249
  // ../node_modules/.pnpm/@inquirer+external-editor@2.0.1_@types+node@24.10.1/node_modules/@inquirer/external-editor/dist/index.js
68217
68250
  var import_chardet = __toESM(require_lib2(), 1);
68218
68251
  var import_iconv_lite = __toESM(require_lib3(), 1);
68219
- import { spawn, spawnSync } from "child_process";
68252
+ import { spawn as spawn2, spawnSync as spawnSync2 } from "child_process";
68220
68253
  import { readFileSync, unlinkSync, writeFileSync } from "fs";
68221
68254
  import path8 from "node:path";
68222
68255
  import os3 from "node:os";
@@ -68394,7 +68427,7 @@ class ExternalEditor {
68394
68427
  }
68395
68428
  launchEditor() {
68396
68429
  try {
68397
- const editorProcess = spawnSync(this.editor.bin, this.editor.args.concat([this.tempFile]), { stdio: "inherit" });
68430
+ const editorProcess = spawnSync2(this.editor.bin, this.editor.args.concat([this.tempFile]), { stdio: "inherit" });
68398
68431
  this.lastExitStatus = editorProcess.status ?? 0;
68399
68432
  } catch (launchError) {
68400
68433
  throw new LaunchEditorError(launchError);
@@ -68402,7 +68435,7 @@ class ExternalEditor {
68402
68435
  }
68403
68436
  launchEditorAsync(callback) {
68404
68437
  try {
68405
- const editorProcess = spawn(this.editor.bin, this.editor.args.concat([this.tempFile]), { stdio: "inherit" });
68438
+ const editorProcess = spawn2(this.editor.bin, this.editor.args.concat([this.tempFile]), { stdio: "inherit" });
68406
68439
  editorProcess.on("exit", (code) => {
68407
68440
  this.lastExitStatus = code;
68408
68441
  setImmediate(callback);
@@ -69590,9 +69623,9 @@ Init.addCommand(npmCommand);
69590
69623
  // src/services/app/index.ts
69591
69624
  import path10 from "path";
69592
69625
  import fs11 from "fs";
69593
- import { spawnSync as spawnSync2 } from "child_process";
69626
+ import { spawnSync as spawnSync3 } from "child_process";
69594
69627
  var runCommand = (command, args) => {
69595
- const result = spawnSync2(command, args, {
69628
+ const result = spawnSync3(command, args, {
69596
69629
  stdio: "inherit",
69597
69630
  shell: true
69598
69631
  });
@@ -69774,7 +69807,7 @@ var pageListCommand = new Command("page-list").alias("pl").option("-a, --all", "
69774
69807
  program.addCommand(pageListCommand);
69775
69808
 
69776
69809
  // src/command/asst-server/index.ts
69777
- import { spawnSync as spawnSync3 } from "node:child_process";
69810
+ import { spawnSync as spawnSync4 } from "node:child_process";
69778
69811
  var command = new Command("server").description("启动服务").option("-d, --daemon", "是否以守护进程方式运行").option("-n, --name <name>", "服务名称").option("-p, --port <port>", "服务端口").option("-s, --start", "是否启动服务").option("-i, --home", "是否以home方式运行").action((options) => {
69779
69812
  const { port } = options;
69780
69813
  const [_interpreter, execPath] = process.argv;
@@ -69797,13 +69830,13 @@ var command = new Command("server").description("启动服务").option("-d, --da
69797
69830
  const basename = _interpreter.split("/").pop();
69798
69831
  if (basename.includes("bun")) {
69799
69832
  console.log(`Assistant server shell command: bun src/run-server.ts server ${shellCommands.join(" ")}`);
69800
- const child = spawnSync3(_interpreter, ["src/run-server.ts", ...shellCommands], {
69833
+ const child = spawnSync4(_interpreter, ["src/run-server.ts", ...shellCommands], {
69801
69834
  stdio: "inherit",
69802
69835
  shell: true
69803
69836
  });
69804
69837
  } else {
69805
69838
  console.log(`Assistant server shell command: asst-server ${shellCommands.join(" ")}`);
69806
- const child = spawnSync3("asst-server", shellCommands, {
69839
+ const child = spawnSync4("asst-server", shellCommands, {
69807
69840
  stdio: "inherit",
69808
69841
  shell: true
69809
69842
  });
@@ -69847,7 +69880,7 @@ commdands.forEach((name) => {
69847
69880
  });
69848
69881
 
69849
69882
  // src/command/run-scripts/index.ts
69850
- import { spawnSync as spawnSync4 } from "node:child_process";
69883
+ import { spawnSync as spawnSync5 } from "node:child_process";
69851
69884
  var runScriptsCommand = new Command("run-scripts").alias("run").arguments("<cmd> [env]").description("运行脚本,在assistant.config.json中配置的脚本").action(async (cmd, env3) => {
69852
69885
  assistantConfig2.checkMounted();
69853
69886
  const configs = assistantConfig2.getCacheAssistantConfig();
@@ -69859,7 +69892,7 @@ var runScriptsCommand = new Command("run-scripts").alias("run").arguments("<cmd>
69859
69892
  return;
69860
69893
  }
69861
69894
  const command2 = [script, ...env3 ? [env3] : []].join(" ");
69862
- const res = spawnSync4(command2, { shell: true, stdio: "inherit", cwd: assistantConfig2.configDir });
69895
+ const res = spawnSync5(command2, { shell: true, stdio: "inherit", cwd: assistantConfig2.configDir });
69863
69896
  if (res.error) {
69864
69897
  console.error(`Error running script "${cmd}":`, res.error);
69865
69898
  return;