@fivetu53/soul-chat 1.0.1 → 1.0.2
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/bin/index.js +19 -0
- package/package.json +1 -1
package/bin/index.js
CHANGED
|
@@ -1026,6 +1026,25 @@ async function showMemories() {
|
|
|
1026
1026
|
|
|
1027
1027
|
// 主程序
|
|
1028
1028
|
async function main() {
|
|
1029
|
+
// 处理命令行参数
|
|
1030
|
+
const args = process.argv.slice(2);
|
|
1031
|
+
if (args[0] === 'update') {
|
|
1032
|
+
console.log('\n 正在更新 Soul Chat...\n');
|
|
1033
|
+
try {
|
|
1034
|
+
execSync('npm update -g @fivetu53/soul-chat', { stdio: 'inherit' });
|
|
1035
|
+
console.log('\n 更新完成!\n');
|
|
1036
|
+
} catch (err) {
|
|
1037
|
+
console.log('\n 更新失败,请手动运行: npm update -g @fivetu53/soul-chat\n');
|
|
1038
|
+
}
|
|
1039
|
+
process.exit(0);
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
if (args[0] === 'version' || args[0] === '-v' || args[0] === '--version') {
|
|
1043
|
+
const pkg = JSON.parse(fs.readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
|
|
1044
|
+
console.log(`Soul Chat v${pkg.version}`);
|
|
1045
|
+
process.exit(0);
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1029
1048
|
process.on('SIGINT', () => {
|
|
1030
1049
|
cleanup();
|
|
1031
1050
|
process.exit();
|