feat: 助手配置与服务命令扩展及依赖更新

This commit is contained in:
2025-04-27 03:26:50 +08:00
parent f2abfbf17c
commit 75d181ef43
25 changed files with 296 additions and 64 deletions

View File

@@ -0,0 +1,31 @@
import { program, Command } from '@/program.ts';
import { spawnSync } from 'node:child_process';
const command = new Command('server')
.description('启动服务')
.option('-d, --daemon', '是否以守护进程方式运行')
.option('-n, --name <name>', '服务名称')
.option('-p, --port <port>', '服务端口')
.option('-s, --start', '是否启动服务')
.action((options) => {
const { port } = options;
const shellCommands = [];
if (options.daemon) {
shellCommands.push('-d');
}
if (options.name) {
shellCommands.push(`-n ${options.name}`);
}
if (options.start) {
shellCommands.push('-s');
}
if (port) {
shellCommands.push(`-p ${port}`);
}
console.log(`Assistant server shell command: asst-server ${shellCommands.join(' ')}`);
const child = spawnSync('asst-server', shellCommands, {
stdio: 'inherit',
shell: true,
});
});
program.addCommand(command);