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:
2026-01-31 17:42:53 +08:00
parent 51822506d7
commit a80a3ede46
11 changed files with 517 additions and 337 deletions

View 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);