@kevisual/cli 0.0.63 → 0.0.65
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-server.js +46 -15
- package/dist/assistant.js +47 -16
- package/dist/envision.js +1285 -609
- package/package.json +8 -4
package/dist/assistant-server.js
CHANGED
|
@@ -66735,9 +66735,7 @@ function parseArgs(args) {
|
|
|
66735
66735
|
i++;
|
|
66736
66736
|
}
|
|
66737
66737
|
}
|
|
66738
|
-
|
|
66739
|
-
result.home = true;
|
|
66740
|
-
}
|
|
66738
|
+
result.home = true;
|
|
66741
66739
|
if (arg === "--help" || arg === "-h") {
|
|
66742
66740
|
result.help = true;
|
|
66743
66741
|
}
|
|
@@ -74445,6 +74443,35 @@ class AssistantQuery {
|
|
|
74445
74443
|
return this.query.get(body, options);
|
|
74446
74444
|
}
|
|
74447
74445
|
}
|
|
74446
|
+
// src/module/npm-install.ts
|
|
74447
|
+
import { spawn, spawnSync } from "child_process";
|
|
74448
|
+
var checkPnpm = () => {
|
|
74449
|
+
try {
|
|
74450
|
+
spawnSync("pnpm", ["--version"]);
|
|
74451
|
+
return true;
|
|
74452
|
+
} catch (e) {
|
|
74453
|
+
return false;
|
|
74454
|
+
}
|
|
74455
|
+
};
|
|
74456
|
+
var installDeps = async (opts) => {
|
|
74457
|
+
const { appPath } = opts;
|
|
74458
|
+
const isProduction = opts.isProduction ?? true;
|
|
74459
|
+
const isPnpm = checkPnpm();
|
|
74460
|
+
const params = ["i"];
|
|
74461
|
+
if (isProduction && isPnpm) {
|
|
74462
|
+
params.push("--production");
|
|
74463
|
+
} else {
|
|
74464
|
+
params.push("--omit=dev");
|
|
74465
|
+
}
|
|
74466
|
+
console.log("installDeps", appPath, params);
|
|
74467
|
+
const syncSpawn = opts.sync ? spawnSync : spawn;
|
|
74468
|
+
if (isPnpm) {
|
|
74469
|
+
syncSpawn("pnpm", params, { cwd: appPath, stdio: "inherit", env: process.env });
|
|
74470
|
+
} else {
|
|
74471
|
+
syncSpawn("npm", params, { cwd: appPath, stdio: "inherit", env: process.env });
|
|
74472
|
+
}
|
|
74473
|
+
};
|
|
74474
|
+
|
|
74448
74475
|
// src/services/init/index.ts
|
|
74449
74476
|
class AssistantInit extends AssistantConfig {
|
|
74450
74477
|
#query;
|
|
@@ -74536,8 +74563,8 @@ class AssistantInit extends AssistantConfig {
|
|
|
74536
74563
|
"description": "assistant-app package pnpm, node pkgs projects",
|
|
74537
74564
|
"type": "module",
|
|
74538
74565
|
"scripts": {
|
|
74539
|
-
"start": "pm2 start apps/code-center/
|
|
74540
|
-
"proxy": "pm2 start apps/page-proxy/
|
|
74566
|
+
"start": "pm2 start apps/root/code-center/app.mjs --name root/code-center",
|
|
74567
|
+
"proxy": "pm2 start apps/root/page-proxy/app.mjs --name root/page-proxy"
|
|
74541
74568
|
},
|
|
74542
74569
|
"keywords": [],
|
|
74543
74570
|
"author": "",
|
|
@@ -74545,6 +74572,7 @@ class AssistantInit extends AssistantConfig {
|
|
|
74545
74572
|
"dependencies": {
|
|
74546
74573
|
"@kevisual/router": "latest",
|
|
74547
74574
|
"@kevisual/use-config": "latest",
|
|
74575
|
+
"@kevisual/query": "latest",
|
|
74548
74576
|
"ioredis": "latest",
|
|
74549
74577
|
"minio": "latest",
|
|
74550
74578
|
"pg": "latest",
|
|
@@ -74564,7 +74592,10 @@ class AssistantInit extends AssistantConfig {
|
|
|
74564
74592
|
}
|
|
74565
74593
|
}
|
|
74566
74594
|
`);
|
|
74567
|
-
console.log(chalk2.green("助手 package.json
|
|
74595
|
+
console.log(chalk2.green("助手 package.json 文件创建成功, 正在安装依赖..."));
|
|
74596
|
+
installDeps({ appPath: path8.dirname(packagePath), isProduction: true }).then(() => {
|
|
74597
|
+
console.log(chalk2.green("助手依赖安装完成"));
|
|
74598
|
+
});
|
|
74568
74599
|
}
|
|
74569
74600
|
return {
|
|
74570
74601
|
create
|
|
@@ -77128,7 +77159,7 @@ var dist_default2 = createPrompt((config3, done) => {
|
|
|
77128
77159
|
// ../node_modules/.pnpm/@inquirer+external-editor@2.0.1_@types+node@24.10.1/node_modules/@inquirer/external-editor/dist/index.js
|
|
77129
77160
|
var import_chardet = __toESM(require_lib2(), 1);
|
|
77130
77161
|
var import_iconv_lite = __toESM(require_lib3(), 1);
|
|
77131
|
-
import { spawn, spawnSync } from "child_process";
|
|
77162
|
+
import { spawn as spawn2, spawnSync as spawnSync2 } from "child_process";
|
|
77132
77163
|
import { readFileSync, unlinkSync, writeFileSync } from "fs";
|
|
77133
77164
|
import path10 from "node:path";
|
|
77134
77165
|
import os3 from "node:os";
|
|
@@ -77306,7 +77337,7 @@ class ExternalEditor {
|
|
|
77306
77337
|
}
|
|
77307
77338
|
launchEditor() {
|
|
77308
77339
|
try {
|
|
77309
|
-
const editorProcess =
|
|
77340
|
+
const editorProcess = spawnSync2(this.editor.bin, this.editor.args.concat([this.tempFile]), { stdio: "inherit" });
|
|
77310
77341
|
this.lastExitStatus = editorProcess.status ?? 0;
|
|
77311
77342
|
} catch (launchError) {
|
|
77312
77343
|
throw new LaunchEditorError(launchError);
|
|
@@ -77314,7 +77345,7 @@ class ExternalEditor {
|
|
|
77314
77345
|
}
|
|
77315
77346
|
launchEditorAsync(callback) {
|
|
77316
77347
|
try {
|
|
77317
|
-
const editorProcess =
|
|
77348
|
+
const editorProcess = spawn2(this.editor.bin, this.editor.args.concat([this.tempFile]), { stdio: "inherit" });
|
|
77318
77349
|
editorProcess.on("exit", (code) => {
|
|
77319
77350
|
this.lastExitStatus = code;
|
|
77320
77351
|
setImmediate(callback);
|
|
@@ -78435,9 +78466,9 @@ var inquirer = {
|
|
|
78435
78466
|
var dist_default12 = inquirer;
|
|
78436
78467
|
|
|
78437
78468
|
// src/services/app/index.ts
|
|
78438
|
-
import { spawnSync as
|
|
78469
|
+
import { spawnSync as spawnSync3 } from "child_process";
|
|
78439
78470
|
var runCommand = (command, args) => {
|
|
78440
|
-
const result =
|
|
78471
|
+
const result = spawnSync3(command, args, {
|
|
78441
78472
|
stdio: "inherit",
|
|
78442
78473
|
shell: true
|
|
78443
78474
|
});
|
|
@@ -87308,7 +87339,7 @@ var {
|
|
|
87308
87339
|
} = import__.default;
|
|
87309
87340
|
|
|
87310
87341
|
// src/server.ts
|
|
87311
|
-
import { spawnSync as
|
|
87342
|
+
import { spawnSync as spawnSync4 } from "child_process";
|
|
87312
87343
|
var runServer = async (port, listenPath = "127.0.0.1") => {
|
|
87313
87344
|
let _port;
|
|
87314
87345
|
if (port) {
|
|
@@ -87350,19 +87381,19 @@ var runServer = async (port, listenPath = "127.0.0.1") => {
|
|
|
87350
87381
|
port: _port
|
|
87351
87382
|
};
|
|
87352
87383
|
};
|
|
87353
|
-
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) => {
|
|
87384
|
+
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) => {
|
|
87354
87385
|
if (options.daemon) {
|
|
87355
87386
|
const [_interpreter, execPath] = process.argv;
|
|
87356
87387
|
const name = options.name;
|
|
87357
87388
|
const port = options.port;
|
|
87358
|
-
let pm2Command = `pm2 start ${execPath} --name ${name} -- -s `;
|
|
87389
|
+
let pm2Command = `pm2 start ${execPath} --interpreter ${options.interpreter} --name ${name} -- -s `;
|
|
87359
87390
|
if (port) {
|
|
87360
87391
|
pm2Command += ` -p ${port}`;
|
|
87361
87392
|
}
|
|
87362
87393
|
if (options.home) {
|
|
87363
87394
|
pm2Command += ` --home`;
|
|
87364
87395
|
}
|
|
87365
|
-
const result =
|
|
87396
|
+
const result = spawnSync4(pm2Command, {
|
|
87366
87397
|
shell: true,
|
|
87367
87398
|
stdio: "inherit"
|
|
87368
87399
|
});
|
package/dist/assistant.js
CHANGED
|
@@ -41507,9 +41507,7 @@ function parseArgs(args) {
|
|
|
41507
41507
|
i++;
|
|
41508
41508
|
}
|
|
41509
41509
|
}
|
|
41510
|
-
|
|
41511
|
-
result.home = true;
|
|
41512
|
-
}
|
|
41510
|
+
result.home = true;
|
|
41513
41511
|
if (arg === "--help" || arg === "-h") {
|
|
41514
41512
|
result.help = true;
|
|
41515
41513
|
}
|
|
@@ -66388,6 +66386,35 @@ class HttpsPem {
|
|
|
66388
66386
|
}
|
|
66389
66387
|
}
|
|
66390
66388
|
|
|
66389
|
+
// src/module/npm-install.ts
|
|
66390
|
+
import { spawn, spawnSync } from "child_process";
|
|
66391
|
+
var checkPnpm = () => {
|
|
66392
|
+
try {
|
|
66393
|
+
spawnSync("pnpm", ["--version"]);
|
|
66394
|
+
return true;
|
|
66395
|
+
} catch (e) {
|
|
66396
|
+
return false;
|
|
66397
|
+
}
|
|
66398
|
+
};
|
|
66399
|
+
var installDeps = async (opts) => {
|
|
66400
|
+
const { appPath } = opts;
|
|
66401
|
+
const isProduction = opts.isProduction ?? true;
|
|
66402
|
+
const isPnpm = checkPnpm();
|
|
66403
|
+
const params = ["i"];
|
|
66404
|
+
if (isProduction && isPnpm) {
|
|
66405
|
+
params.push("--production");
|
|
66406
|
+
} else {
|
|
66407
|
+
params.push("--omit=dev");
|
|
66408
|
+
}
|
|
66409
|
+
console.log("installDeps", appPath, params);
|
|
66410
|
+
const syncSpawn = opts.sync ? spawnSync : spawn;
|
|
66411
|
+
if (isPnpm) {
|
|
66412
|
+
syncSpawn("pnpm", params, { cwd: appPath, stdio: "inherit", env: process.env });
|
|
66413
|
+
} else {
|
|
66414
|
+
syncSpawn("npm", params, { cwd: appPath, stdio: "inherit", env: process.env });
|
|
66415
|
+
}
|
|
66416
|
+
};
|
|
66417
|
+
|
|
66391
66418
|
// src/services/init/index.ts
|
|
66392
66419
|
class AssistantInit extends AssistantConfig {
|
|
66393
66420
|
#query;
|
|
@@ -66479,8 +66506,8 @@ class AssistantInit extends AssistantConfig {
|
|
|
66479
66506
|
"description": "assistant-app package pnpm, node pkgs projects",
|
|
66480
66507
|
"type": "module",
|
|
66481
66508
|
"scripts": {
|
|
66482
|
-
"start": "pm2 start apps/code-center/
|
|
66483
|
-
"proxy": "pm2 start apps/page-proxy/
|
|
66509
|
+
"start": "pm2 start apps/root/code-center/app.mjs --name root/code-center",
|
|
66510
|
+
"proxy": "pm2 start apps/root/page-proxy/app.mjs --name root/page-proxy"
|
|
66484
66511
|
},
|
|
66485
66512
|
"keywords": [],
|
|
66486
66513
|
"author": "",
|
|
@@ -66488,6 +66515,7 @@ class AssistantInit extends AssistantConfig {
|
|
|
66488
66515
|
"dependencies": {
|
|
66489
66516
|
"@kevisual/router": "latest",
|
|
66490
66517
|
"@kevisual/use-config": "latest",
|
|
66518
|
+
"@kevisual/query": "latest",
|
|
66491
66519
|
"ioredis": "latest",
|
|
66492
66520
|
"minio": "latest",
|
|
66493
66521
|
"pg": "latest",
|
|
@@ -66507,7 +66535,10 @@ class AssistantInit extends AssistantConfig {
|
|
|
66507
66535
|
}
|
|
66508
66536
|
}
|
|
66509
66537
|
`);
|
|
66510
|
-
console.log(chalk2.green("助手 package.json
|
|
66538
|
+
console.log(chalk2.green("助手 package.json 文件创建成功, 正在安装依赖..."));
|
|
66539
|
+
installDeps({ appPath: path7.dirname(packagePath), isProduction: true }).then(() => {
|
|
66540
|
+
console.log(chalk2.green("助手依赖安装完成"));
|
|
66541
|
+
});
|
|
66511
66542
|
}
|
|
66512
66543
|
return {
|
|
66513
66544
|
create
|
|
@@ -68216,7 +68247,7 @@ var dist_default2 = createPrompt((config2, done) => {
|
|
|
68216
68247
|
// ../node_modules/.pnpm/@inquirer+external-editor@2.0.1_@types+node@24.10.1/node_modules/@inquirer/external-editor/dist/index.js
|
|
68217
68248
|
var import_chardet = __toESM(require_lib2(), 1);
|
|
68218
68249
|
var import_iconv_lite = __toESM(require_lib3(), 1);
|
|
68219
|
-
import { spawn, spawnSync } from "child_process";
|
|
68250
|
+
import { spawn as spawn2, spawnSync as spawnSync2 } from "child_process";
|
|
68220
68251
|
import { readFileSync, unlinkSync, writeFileSync } from "fs";
|
|
68221
68252
|
import path8 from "node:path";
|
|
68222
68253
|
import os3 from "node:os";
|
|
@@ -68394,7 +68425,7 @@ class ExternalEditor {
|
|
|
68394
68425
|
}
|
|
68395
68426
|
launchEditor() {
|
|
68396
68427
|
try {
|
|
68397
|
-
const editorProcess =
|
|
68428
|
+
const editorProcess = spawnSync2(this.editor.bin, this.editor.args.concat([this.tempFile]), { stdio: "inherit" });
|
|
68398
68429
|
this.lastExitStatus = editorProcess.status ?? 0;
|
|
68399
68430
|
} catch (launchError) {
|
|
68400
68431
|
throw new LaunchEditorError(launchError);
|
|
@@ -68402,7 +68433,7 @@ class ExternalEditor {
|
|
|
68402
68433
|
}
|
|
68403
68434
|
launchEditorAsync(callback) {
|
|
68404
68435
|
try {
|
|
68405
|
-
const editorProcess =
|
|
68436
|
+
const editorProcess = spawn2(this.editor.bin, this.editor.args.concat([this.tempFile]), { stdio: "inherit" });
|
|
68406
68437
|
editorProcess.on("exit", (code) => {
|
|
68407
68438
|
this.lastExitStatus = code;
|
|
68408
68439
|
setImmediate(callback);
|
|
@@ -69590,9 +69621,9 @@ Init.addCommand(npmCommand);
|
|
|
69590
69621
|
// src/services/app/index.ts
|
|
69591
69622
|
import path10 from "path";
|
|
69592
69623
|
import fs11 from "fs";
|
|
69593
|
-
import { spawnSync as
|
|
69624
|
+
import { spawnSync as spawnSync3 } from "child_process";
|
|
69594
69625
|
var runCommand = (command, args) => {
|
|
69595
|
-
const result =
|
|
69626
|
+
const result = spawnSync3(command, args, {
|
|
69596
69627
|
stdio: "inherit",
|
|
69597
69628
|
shell: true
|
|
69598
69629
|
});
|
|
@@ -69774,7 +69805,7 @@ var pageListCommand = new Command("page-list").alias("pl").option("-a, --all", "
|
|
|
69774
69805
|
program.addCommand(pageListCommand);
|
|
69775
69806
|
|
|
69776
69807
|
// src/command/asst-server/index.ts
|
|
69777
|
-
import { spawnSync as
|
|
69808
|
+
import { spawnSync as spawnSync4 } from "node:child_process";
|
|
69778
69809
|
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
69810
|
const { port } = options;
|
|
69780
69811
|
const [_interpreter, execPath] = process.argv;
|
|
@@ -69797,13 +69828,13 @@ var command = new Command("server").description("启动服务").option("-d, --da
|
|
|
69797
69828
|
const basename = _interpreter.split("/").pop();
|
|
69798
69829
|
if (basename.includes("bun")) {
|
|
69799
69830
|
console.log(`Assistant server shell command: bun src/run-server.ts server ${shellCommands.join(" ")}`);
|
|
69800
|
-
const child =
|
|
69831
|
+
const child = spawnSync4(_interpreter, ["src/run-server.ts", ...shellCommands], {
|
|
69801
69832
|
stdio: "inherit",
|
|
69802
69833
|
shell: true
|
|
69803
69834
|
});
|
|
69804
69835
|
} else {
|
|
69805
69836
|
console.log(`Assistant server shell command: asst-server ${shellCommands.join(" ")}`);
|
|
69806
|
-
const child =
|
|
69837
|
+
const child = spawnSync4("asst-server", shellCommands, {
|
|
69807
69838
|
stdio: "inherit",
|
|
69808
69839
|
shell: true
|
|
69809
69840
|
});
|
|
@@ -69847,7 +69878,7 @@ commdands.forEach((name) => {
|
|
|
69847
69878
|
});
|
|
69848
69879
|
|
|
69849
69880
|
// src/command/run-scripts/index.ts
|
|
69850
|
-
import { spawnSync as
|
|
69881
|
+
import { spawnSync as spawnSync5 } from "node:child_process";
|
|
69851
69882
|
var runScriptsCommand = new Command("run-scripts").alias("run").arguments("<cmd> [env]").description("运行脚本,在assistant.config.json中配置的脚本").action(async (cmd, env3) => {
|
|
69852
69883
|
assistantConfig2.checkMounted();
|
|
69853
69884
|
const configs = assistantConfig2.getCacheAssistantConfig();
|
|
@@ -69859,7 +69890,7 @@ var runScriptsCommand = new Command("run-scripts").alias("run").arguments("<cmd>
|
|
|
69859
69890
|
return;
|
|
69860
69891
|
}
|
|
69861
69892
|
const command2 = [script, ...env3 ? [env3] : []].join(" ");
|
|
69862
|
-
const res =
|
|
69893
|
+
const res = spawnSync5(command2, { shell: true, stdio: "inherit", cwd: assistantConfig2.configDir });
|
|
69863
69894
|
if (res.error) {
|
|
69864
69895
|
console.error(`Error running script "${cmd}":`, res.error);
|
|
69865
69896
|
return;
|