yuangs 1.2.1 → 1.2.3

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.
Files changed (2) hide show
  1. package/cli.js +16 -12
  2. package/package.json +1 -1
package/cli.js CHANGED
@@ -92,18 +92,22 @@ async function handleAICommand() {
92
92
  });
93
93
 
94
94
  const askLoop = () => {
95
- rl.question(chalk.green('你:'), async (q) => {
96
- const trimmed = q.trim();
97
- if (!trimmed) {
98
- // 空行就继续问
99
- return askLoop();
100
- }
101
- await askOnce(trimmed, model);
102
- askLoop();
103
- });
104
- };
105
-
106
- askLoop();
95
+ rl.question(chalk.green('你:'), async (q) => {
96
+ const trimmed = q.trim();
97
+
98
+ // ✨ 新增:优雅退出
99
+ if (['exit', 'quit', 'bye'].includes(trimmed.toLowerCase())) {
100
+ console.log(chalk.cyan('👋 再见!'));
101
+ rl.close();
102
+ process.exit(0);
103
+ }
104
+
105
+ if (!trimmed) {
106
+ return askLoop();
107
+ }
108
+ await askOnce(trimmed, model);
109
+ askLoop();
110
+ });
107
111
  return;
108
112
  }
109
113
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yuangs",
3
- "version": "1.2.1",
3
+ "version": "1.2.3",
4
4
  "description": "苑广山的个人应用集合 CLI(彩色版)",
5
5
  "main": "index.js",
6
6
  "bin": {