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.
Files changed (2) hide show
  1. package/bin/imtoagent-real +20 -7
  2. package/package.json +1 -1
@@ -41,18 +41,31 @@ switch (command) {
41
41
  case 'daemon':
42
42
  await cmdDaemon();
43
43
  break;
44
- case undefined:
45
- case 'help':
46
- case '--help':
47
- case '-h':
48
- // 无命令 + 无配置 → 自动引导进入 setup
49
- if (!command && !fs.existsSync(path.join(getDataDir(), 'config.json'))) {
50
- console.log('⚠️ 未检测到配置文件,请先完成初始配置\n');
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();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "imtoagent",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "IM ↔ Agent 统一网关 — 飞书/Telegram/微信/企业微信对接 Claude Code/Codex/OpenCode",
5
5
  "type": "module",
6
6
  "bin": {