imtoagent 0.2.3 → 0.2.4
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/imtoagent-real +20 -7
- package/package.json +1 -1
package/bin/imtoagent-real
CHANGED
|
@@ -41,18 +41,31 @@ switch (command) {
|
|
|
41
41
|
case 'daemon':
|
|
42
42
|
await cmdDaemon();
|
|
43
43
|
break;
|
|
44
|
-
case undefined:
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
if (!
|
|
50
|
-
|
|
44
|
+
case undefined: {
|
|
45
|
+
// 无命令 → 没完成 setup 自动进向导,已完成显示帮助
|
|
46
|
+
const dataDir = getDataDir();
|
|
47
|
+
const configPath = path.join(dataDir, 'config.json');
|
|
48
|
+
let needsSetup = !fs.existsSync(configPath);
|
|
49
|
+
if (!needsSetup) {
|
|
50
|
+
try {
|
|
51
|
+
const raw = fs.readFileSync(configPath, 'utf-8');
|
|
52
|
+
// 如果配置里还有 YOUR_ 占位符,说明还没完成 setup
|
|
53
|
+
needsSetup = /YOUR_[A-Z_]+/.test(raw);
|
|
54
|
+
} catch { needsSetup = true; }
|
|
55
|
+
}
|
|
56
|
+
if (needsSetup) {
|
|
57
|
+
console.log('👋 欢迎使用 imtoagent,请先完成初始配置\n');
|
|
51
58
|
await cmdSetup();
|
|
52
59
|
} else {
|
|
53
60
|
printHelp();
|
|
54
61
|
}
|
|
55
62
|
break;
|
|
63
|
+
}
|
|
64
|
+
case 'help':
|
|
65
|
+
case '--help':
|
|
66
|
+
case '-h':
|
|
67
|
+
printHelp();
|
|
68
|
+
break;
|
|
56
69
|
default:
|
|
57
70
|
console.error(`❌ 未知命令: ${command}`);
|
|
58
71
|
printHelp();
|