natureco-cli 2.2.7 → 2.2.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "natureco-cli",
3
- "version": "2.2.7",
3
+ "version": "2.2.8",
4
4
  "description": "NatureCo AI Bot Terminal Interface",
5
5
  "main": "bin/natureco.js",
6
6
  "bin": {
@@ -211,7 +211,7 @@ body::before{
211
211
  <div class="header-bot-name" id="header-bot-name">Nature Bot</div>
212
212
  <div class="header-bot-model" id="header-bot-model">NatureCo</div>
213
213
  </div>
214
- <div class="version-badge" id="version-badge">v2.2.7</div>
214
+ <div class="version-badge" id="version-badge">v2.2.8</div>
215
215
  </div>
216
216
  <div class="messages" id="messages"></div>
217
217
  <div class="input-area">
@@ -341,7 +341,7 @@ function dashboard(action) {
341
341
  apiKey: cfg.apiKey,
342
342
  defaultBot: cfg.defaultBot,
343
343
  defaultBotId: cfg.defaultBotId,
344
- version: 'v2.2.7',
344
+ version: 'v2.2.8',
345
345
  bots: cfg.bots || [],
346
346
  telegramToken: cfg.telegramToken || null,
347
347
  whatsappConnected: cfg.whatsappConnected || false,
@@ -22,39 +22,16 @@ async function discord(action) {
22
22
  }
23
23
 
24
24
  async function connectDiscord() {
25
- const apiKey = getApiKey();
26
-
27
- if (!apiKey) {
28
- console.log(chalk.red('\n❌ Not logged in. Run "natureco login" first.\n'));
29
- process.exit(1);
30
- }
31
-
32
25
  const config = getConfig();
33
26
 
34
- console.log(chalk.yellow('\n⏳ Loading bots...\n'));
35
-
36
- let botList;
37
- try {
38
- botList = await getBots(apiKey);
39
- } catch (err) {
40
- console.log(chalk.red(`\n❌ Error: ${err.message}\n`));
41
- process.exit(1);
42
- }
43
-
44
- if (!botList || !botList.bots || botList.bots.length === 0) {
45
- console.log(chalk.gray('No bots found. Create one at https://developers.natureco.me\n'));
27
+ if (!config.providerUrl) {
28
+ console.log(chalk.red('\n❌ Setup yapılmamış. Önce "natureco setup" çalıştırın.\n'));
46
29
  process.exit(1);
47
30
  }
48
31
 
49
32
  process.stdin.resume();
50
33
 
51
34
  const answers = await inquirer.prompt([
52
- {
53
- type: 'list',
54
- name: 'botId',
55
- message: 'Select bot to connect:',
56
- choices: botList.bots.map(b => ({ name: b.name, value: b.id })),
57
- },
58
35
  {
59
36
  type: 'input',
60
37
  name: 'token',
@@ -63,44 +40,22 @@ async function connectDiscord() {
63
40
  },
64
41
  ]);
65
42
 
66
- const selectedBot = botList.bots.find(b => b.id === answers.botId);
67
-
68
- console.log(chalk.yellow('\n⏳ Connecting to Discord...\n'));
69
-
70
- try {
71
- const response = await fetch('https://api.natureco.me/api/agent/discord/connect', {
72
- method: 'POST',
73
- headers: {
74
- 'Content-Type': 'application/json',
75
- 'Authorization': `Bearer ${apiKey}`,
76
- },
77
- body: JSON.stringify({
78
- agent_id: answers.botId,
79
- discord_bot_token: answers.token.trim(),
80
- }),
81
- });
82
-
83
- if (!response.ok) {
84
- const error = await response.text();
85
- throw new Error(error);
86
- }
87
-
88
- const data = await response.json();
89
-
90
- console.log(chalk.green('✅ Discord connected successfully!\n'));
91
- console.log(chalk.cyan('Bot:'), chalk.white(selectedBot.name));
92
- console.log(chalk.cyan('Discord Bot:'), chalk.white(data.bot_username || 'Unknown'));
93
- console.log(chalk.gray('\nYour bot is now active on Discord.'));
94
- console.log(chalk.gray('Users can interact with /sor command.\n'));
95
-
96
- // Save to config
97
- config.discordToken = answers.token.trim();
98
- config.discordBotId = answers.botId;
99
- saveConfig(config);
100
- } catch (err) {
101
- console.log(chalk.red(`\n❌ Connection failed: ${err.message}\n`));
102
- process.exit(1);
103
- }
43
+ // Discord için bot ID oluştur (timestamp-based)
44
+ const botId = `discord_${Date.now()}`;
45
+ const selectedBot = { name: 'Discord Bot', id: botId };
46
+
47
+ console.log(chalk.yellow('\n⏳ Discord bağlantısı kaydediliyor...\n'));
48
+
49
+ // Save to config (v2.x - no backend call)
50
+ config.discordToken = answers.token.trim();
51
+ config.discordBotId = botId;
52
+ saveConfig(config);
53
+
54
+ console.log(chalk.green('✅ Discord token kaydedildi!\n'));
55
+ console.log(chalk.cyan('Bot ID:'), chalk.white(botId));
56
+ console.log(chalk.cyan('Token:'), chalk.white(answers.token.slice(0, 20) + '...'));
57
+ console.log(chalk.gray('\nNot: Discord botunuzu Discord Developer Portal\'dan yapılandırmanız gerekiyor.'));
58
+ console.log(chalk.gray('Token config\'e kaydedildi: ~/.natureco/config.json\n'));
104
59
  }
105
60
 
106
61
  async function disconnectDiscord() {
@@ -22,39 +22,16 @@ async function slack(action) {
22
22
  }
23
23
 
24
24
  async function connectSlack() {
25
- const apiKey = getApiKey();
26
-
27
- if (!apiKey) {
28
- console.log(chalk.red('\n❌ Not logged in. Run "natureco login" first.\n'));
29
- process.exit(1);
30
- }
31
-
32
25
  const config = getConfig();
33
26
 
34
- console.log(chalk.yellow('\n⏳ Loading bots...\n'));
35
-
36
- let botList;
37
- try {
38
- botList = await getBots(apiKey);
39
- } catch (err) {
40
- console.log(chalk.red(`\n❌ Error: ${err.message}\n`));
41
- process.exit(1);
42
- }
43
-
44
- if (!botList || !botList.bots || botList.bots.length === 0) {
45
- console.log(chalk.gray('No bots found. Create one at https://developers.natureco.me\n'));
27
+ if (!config.providerUrl) {
28
+ console.log(chalk.red('\n❌ Setup yapılmamış. Önce "natureco setup" çalıştırın.\n'));
46
29
  process.exit(1);
47
30
  }
48
31
 
49
32
  process.stdin.resume();
50
33
 
51
34
  const answers = await inquirer.prompt([
52
- {
53
- type: 'list',
54
- name: 'botId',
55
- message: 'Select bot to connect:',
56
- choices: botList.bots.map(b => ({ name: b.name, value: b.id })),
57
- },
58
35
  {
59
36
  type: 'input',
60
37
  name: 'token',
@@ -68,44 +45,22 @@ async function connectSlack() {
68
45
  },
69
46
  ]);
70
47
 
71
- const selectedBot = botList.bots.find(b => b.id === answers.botId);
48
+ // Slack için bot ID oluştur (timestamp-based)
49
+ const botId = `slack_${Date.now()}`;
50
+ const selectedBot = { name: 'Slack Bot', id: botId };
72
51
 
73
- console.log(chalk.yellow('\n⏳ Connecting to Slack...\n'));
52
+ console.log(chalk.yellow('\n⏳ Slack bağlantısı kaydediliyor...\n'));
74
53
 
75
- try {
76
- const response = await fetch('https://api.natureco.me/api/agent/slack/connect', {
77
- method: 'POST',
78
- headers: {
79
- 'Content-Type': 'application/json',
80
- 'Authorization': `Bearer ${apiKey}`,
81
- },
82
- body: JSON.stringify({
83
- agent_id: answers.botId,
84
- slack_bot_token: answers.token.trim(),
85
- }),
86
- });
87
-
88
- if (!response.ok) {
89
- const error = await response.text();
90
- throw new Error(error);
91
- }
92
-
93
- const data = await response.json();
94
-
95
- console.log(chalk.green('✅ Slack connected successfully!\n'));
96
- console.log(chalk.cyan('Bot:'), chalk.white(selectedBot.name));
97
- console.log(chalk.cyan('Slack Bot:'), chalk.white(data.bot_name || 'Unknown'));
98
- console.log(chalk.gray('\nYour bot is now active on Slack.'));
99
- console.log(chalk.gray('Users can mention the bot or use slash commands.\n'));
100
-
101
- // Save to config
102
- config.slackToken = answers.token.trim();
103
- config.slackBotId = answers.botId;
104
- saveConfig(config);
105
- } catch (err) {
106
- console.log(chalk.red(`\n❌ Connection failed: ${err.message}\n`));
107
- process.exit(1);
108
- }
54
+ // Save to config (v2.x - no backend call)
55
+ config.slackToken = answers.token.trim();
56
+ config.slackBotId = botId;
57
+ saveConfig(config);
58
+
59
+ console.log(chalk.green(' Slack token kaydedildi!\n'));
60
+ console.log(chalk.cyan('Bot ID:'), chalk.white(botId));
61
+ console.log(chalk.cyan('Token:'), chalk.white(answers.token.slice(0, 20) + '...'));
62
+ console.log(chalk.gray('\nNot: Slack botunuzu Slack App settings\'ten yapılandırmanız gerekiyor.'));
63
+ console.log(chalk.gray('Token config\'e kaydedildi: ~/.natureco/config.json\n'));
109
64
  }
110
65
 
111
66
  async function disconnectSlack() {
@@ -58,42 +58,18 @@ async function whatsapp(action) {
58
58
  }
59
59
 
60
60
  async function connectWhatsApp() {
61
- const apiKey = getApiKey();
62
-
63
- if (!apiKey) {
64
- console.log(chalk.red('\n❌ Not logged in. Run "natureco login" first.\n'));
65
- process.exit(1);
66
- }
67
-
68
61
  const config = getConfig();
69
62
 
70
- console.log(chalk.yellow('\n⏳ Loading bots...\n'));
71
-
72
- let botList;
73
- try {
74
- botList = await getBots(apiKey);
75
- } catch (err) {
76
- console.log(chalk.red(`\n❌ Error: ${err.message}\n`));
77
- process.exit(1);
78
- }
79
-
80
- if (!botList || !botList.bots || botList.bots.length === 0) {
81
- console.log(chalk.gray('No bots found. Create one at https://developers.natureco.me\n'));
63
+ if (!config.providerUrl) {
64
+ console.log(chalk.red('\n❌ Setup yapılmamış. Önce "natureco setup" çalıştırın.\n'));
82
65
  process.exit(1);
83
66
  }
84
67
 
85
- process.stdin.resume();
86
-
87
- const { botId } = await inquirer.prompt([
88
- {
89
- type: 'list',
90
- name: 'botId',
91
- message: 'Select bot to connect:',
92
- choices: botList.bots.map(b => ({ name: b.name, value: b.id })),
93
- },
94
- ]);
68
+ console.log(chalk.yellow('\n⏳ WhatsApp bağlantısı hazırlanıyor...\n'));
95
69
 
96
- const selectedBot = botList.bots.find(b => b.id === botId);
70
+ // WhatsApp için bot ID oluştur (timestamp-based)
71
+ const botId = `whatsapp_${Date.now()}`;
72
+ const selectedBot = { name: 'WhatsApp Bot', id: botId };
97
73
 
98
74
  console.log(chalk.cyan('\n📱 WhatsApp bağlantısı başlatılıyor...'));
99
75
  console.log(chalk.gray('Telefonunuzda WhatsApp\'ı açın ve QR kodu taratın.\n'));