feat: add argument parsing and module resolution for assistant app
- Implemented argument parsing in args.ts to handle root, home, and help options. - Added parseHomeArg and parseHelpArg functions for command line argument handling. - Created ModuleResolver class in assistant-app-resolve.ts to resolve module paths, including scoped packages and relative paths. - Introduced caching mechanism for package.json reads to improve performance. - Added utility functions for checking file existence and clearing the cache.
This commit is contained in:
17
assistant/src/command/asst-server/reload.ts
Normal file
17
assistant/src/command/asst-server/reload.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { program, Command } from '@/program.ts';
|
||||
import { spawnSync } from 'node:child_process';
|
||||
|
||||
const reload = new Command('reload')
|
||||
.description('重载正在运行的 Assistant Server 服务')
|
||||
.action(() => {
|
||||
console.log('正在重载 Assistant Server 服务...');
|
||||
const cwd = 'pm2 restart assistant-server';
|
||||
const child = spawnSync('pm2', ['restart', 'assistant-server'], {
|
||||
stdio: 'inherit',
|
||||
shell: true,
|
||||
cwd: cwd,
|
||||
});
|
||||
console.log('Assistant Server 服务重载完成。');
|
||||
});
|
||||
|
||||
program.addCommand(reload);
|
||||
Reference in New Issue
Block a user