natureco-cli 5.4.21 → 5.5.0

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": "5.4.21",
3
+ "version": "5.5.0",
4
4
  "description": "OpenClaw'dan daha güvenli, daha hızlı, daha ucuz AI agent CLI. Multi-agent, self-evolving skills, audit log, maliyet optimizasyonu ve NatureCo platform-native.",
5
5
  "bin": {
6
6
  "natureco": "bin/natureco.js"
@@ -61,14 +61,22 @@
61
61
  "node": ">=18.0.0"
62
62
  },
63
63
  "dependencies": {
64
+ "@anthropic-ai/sdk": "^0.105.0",
64
65
  "@inquirer/prompts": "^8.5.0",
66
+ "@slack/web-api": "^7.17.0",
65
67
  "@whiskeysockets/baileys": "^7.0.0-rc10",
66
68
  "chalk": "^4.1.2",
67
- "commander": "^11.1.0", "node-cron": "^4.2.1",
69
+ "commander": "^11.1.0",
70
+ "discord.js": "^14.26.4",
71
+ "irc": "^0.5.2",
72
+ "mattermost": "^3.4.0",
73
+ "node-cron": "^4.2.1",
68
74
  "node-telegram-bot-api": "^0.67.0",
75
+ "openai": "^6.44.0",
69
76
  "pino": "^8.21.0",
70
77
  "qrcode-terminal": "^0.12.0",
71
78
  "semver": "^7.8.1",
79
+ "twilio": "^6.0.2",
72
80
  "ws": "^8.20.0"
73
81
  },
74
82
  "devDependencies": {
@@ -0,0 +1,51 @@
1
+ /**
2
+ * v5.5.0: Kanal baglanti yardimcisi
3
+ * Tum kanallar ayni "zaten kayitli" kontrolunu kullaniyor
4
+ */
5
+
6
+ const inquirer = require('inquirer');
7
+ const chalk = require('chalk');
8
+
9
+ /**
10
+ * Eger kanal tokeni zaten kayitliysa kullaniciya sor:
11
+ * - "Token degistirmek istiyor musun?"
12
+ * - Hayir: mevcut token kullanilir, return false (yeni prompt'a gerek yok)
13
+ * - Evet: return true (yeni token alinmali)
14
+ */
15
+ async function checkExistingToken(config, channelKey, channelName) {
16
+ if (!config[channelKey]) {
17
+ return true; // Yeni token al
18
+ }
19
+
20
+ // Mevcut token goster (maskelenmis)
21
+ const token = String(config[channelKey]);
22
+ const masked = token.length > 20
23
+ ? token.slice(0, 15) + '...' + token.slice(-5)
24
+ : token.slice(0, 3) + '***';
25
+
26
+ console.log(chalk.green('\n✓ ' + channelName + ' token zaten kayıtlı: ' + masked));
27
+
28
+ if (config[channelKey + 'BotId']) {
29
+ console.log(chalk.gray(' Bot ID: ' + config[channelKey + 'BotId']));
30
+ }
31
+ if (config[channelKey.replace('Token', 'AllowedChats')]) {
32
+ console.log(chalk.gray(' İzinli sohbet: ' + config[channelKey.replace('Token', 'AllowedChats')].join(', ')));
33
+ }
34
+ console.log('');
35
+
36
+ const ans = await inquirer.prompt([{
37
+ type: 'confirm',
38
+ name: 'change',
39
+ message: 'Token değiştirmek istiyor musun?',
40
+ default: false,
41
+ }]);
42
+
43
+ if (!ans.change) {
44
+ console.log(chalk.green('\n✅ Mevcut token kullanılacak.\n'));
45
+ console.log(chalk.gray('Gateway başlatmak için: natureco gateway start\n'));
46
+ return false; // Mevcut kullanilacak
47
+ }
48
+ return true; // Yeni alinacak
49
+ }
50
+
51
+ module.exports = { checkExistingToken };
@@ -1,114 +1,116 @@
1
- const chalk = require('chalk');
2
- const inquirer = require('../utils/inquirer-wrapper');
3
- const { getApiKey, getConfig, saveConfig } = require('../utils/config');
4
- const { getBots } = require('../utils/api');
5
-
6
- async function discord(action) {
7
- if (!action || action === 'connect') {
8
- return connectDiscord();
9
- }
10
-
11
- if (action === 'disconnect') {
12
- return disconnectDiscord();
13
- }
14
-
15
- if (action === 'status') {
16
- return statusDiscord();
17
- }
18
-
19
- console.log(chalk.red('\n❌ Unknown action\n'));
20
- console.log(chalk.gray('Available actions: connect, disconnect, status\n'));
21
- process.exit(1);
22
- }
23
-
24
- async function connectDiscord() {
25
- const config = getConfig();
26
-
27
- if (!config.providerUrl) {
28
- console.log(chalk.red('\n❌ Setup yapılmamış. Önce "natureco setup" çalıştırın.\n'));
29
- process.exit(1);
30
- }
31
-
32
- process.stdin.resume();
33
-
34
- const answers = await inquirer.prompt([
35
- {
36
- type: 'input',
37
- name: 'token',
38
- message: 'Discord bot token:',
39
- validate: (val) => val.trim() !== '' || 'Token cannot be empty',
40
- },
41
- ]);
42
-
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'));
59
- }
60
-
61
- async function disconnectDiscord() {
62
- const config = getConfig();
63
-
64
- if (!config.discordToken) {
65
- console.log(chalk.gray('\n⚠️ No Discord connection found\n'));
66
- return;
67
- }
68
-
69
- process.stdin.resume();
70
-
71
- const { confirm } = await inquirer.prompt([
72
- {
73
- type: 'confirm',
74
- name: 'confirm',
75
- message: 'Are you sure you want to disconnect Discord?',
76
- default: false,
77
- },
78
- ]);
79
-
80
- if (!confirm) {
81
- console.log(chalk.gray('\nCancelled\n'));
82
- return;
83
- }
84
-
85
- // Remove from config
86
- delete config.discordToken;
87
- delete config.discordBotId;
88
- saveConfig(config);
89
-
90
- console.log(chalk.green('\n✅ Discord disconnected\n'));
91
- console.log(chalk.gray('Note: The bot is still registered on Discord.'));
92
- console.log(chalk.gray('You may need to manually remove it from Discord Developer Portal.\n'));
93
- }
94
-
95
- function statusDiscord() {
96
- const config = getConfig();
97
-
98
- if (!config.discordToken) {
99
- console.log(chalk.gray('\n⚠️ Discord not connected\n'));
100
- console.log(chalk.gray('Connect with: natureco discord connect\n'));
101
- return;
102
- }
103
-
104
- console.log(chalk.green('\n✅ Discord connected\n'));
105
- console.log(chalk.cyan('Token:'), chalk.white(config.discordToken.slice(0, 20) + '...'));
106
-
107
- if (config.discordBotId) {
108
- console.log(chalk.cyan('Bot ID:'), chalk.white(config.discordBotId));
109
- }
110
-
111
- console.log(chalk.gray('\nDisconnect with: natureco discord disconnect\n'));
112
- }
113
-
114
- module.exports = discord;
1
+ const chalk = require('chalk');
2
+ const inquirer = require('../utils/inquirer-wrapper');
3
+ const { getApiKey, getConfig, saveConfig } = require('../utils/config');
4
+ const { getBots } = require('../utils/api');
5
+
6
+ const { checkExistingToken } = require('./channel-helper');
7
+
8
+ async function discord(action) {
9
+ if (!action || action === 'connect') {
10
+ return connectDiscord();
11
+ }
12
+
13
+ if (action === 'disconnect') {
14
+ return disconnectDiscord();
15
+ }
16
+
17
+ if (action === 'status') {
18
+ return statusDiscord();
19
+ }
20
+
21
+ console.log(chalk.red('\n❌ Unknown action\n'));
22
+ console.log(chalk.gray('Available actions: connect, disconnect, status\n'));
23
+ process.exit(1);
24
+ }
25
+
26
+ async function connectDiscord() {
27
+ const config = getConfig();
28
+
29
+ if (!config.providerUrl) {
30
+ console.log(chalk.red('\n❌ Setup yapılmamış. Önce "natureco setup" çalıştırın.\n'));
31
+ process.exit(1);
32
+ }
33
+
34
+ process.stdin.resume();
35
+
36
+ const answers = await inquirer.prompt([
37
+ {
38
+ type: 'input',
39
+ name: 'token',
40
+ message: 'Discord bot token:',
41
+ validate: (val) => val.trim() !== '' || 'Token cannot be empty',
42
+ },
43
+ ]);
44
+
45
+ // Discord için bot ID oluştur (timestamp-based)
46
+ const botId = `discord_${Date.now()}`;
47
+ const selectedBot = { name: 'Discord Bot', id: botId };
48
+
49
+ console.log(chalk.yellow('\n⏳ Discord bağlantısı kaydediliyor...\n'));
50
+
51
+ // Save to config (v2.x - no backend call)
52
+ config.discordToken = answers.token.trim();
53
+ config.discordBotId = botId;
54
+ saveConfig(config);
55
+
56
+ console.log(chalk.green(' Discord token kaydedildi!\n'));
57
+ console.log(chalk.cyan('Bot ID:'), chalk.white(botId));
58
+ console.log(chalk.cyan('Token:'), chalk.white(answers.token.slice(0, 20) + '...'));
59
+ console.log(chalk.gray('\nNot: Discord botunuzu Discord Developer Portal\'dan yapılandırmanız gerekiyor.'));
60
+ console.log(chalk.gray('Token config\'e kaydedildi: ~/.natureco/config.json\n'));
61
+ }
62
+
63
+ async function disconnectDiscord() {
64
+ const config = getConfig();
65
+
66
+ if (!config.discordToken) {
67
+ console.log(chalk.gray('\n⚠️ No Discord connection found\n'));
68
+ return;
69
+ }
70
+
71
+ process.stdin.resume();
72
+
73
+ const { confirm } = await inquirer.prompt([
74
+ {
75
+ type: 'confirm',
76
+ name: 'confirm',
77
+ message: 'Are you sure you want to disconnect Discord?',
78
+ default: false,
79
+ },
80
+ ]);
81
+
82
+ if (!confirm) {
83
+ console.log(chalk.gray('\nCancelled\n'));
84
+ return;
85
+ }
86
+
87
+ // Remove from config
88
+ delete config.discordToken;
89
+ delete config.discordBotId;
90
+ saveConfig(config);
91
+
92
+ console.log(chalk.green('\n✅ Discord disconnected\n'));
93
+ console.log(chalk.gray('Note: The bot is still registered on Discord.'));
94
+ console.log(chalk.gray('You may need to manually remove it from Discord Developer Portal.\n'));
95
+ }
96
+
97
+ function statusDiscord() {
98
+ const config = getConfig();
99
+
100
+ if (!config.discordToken) {
101
+ console.log(chalk.gray('\n⚠️ Discord not connected\n'));
102
+ console.log(chalk.gray('Connect with: natureco discord connect\n'));
103
+ return;
104
+ }
105
+
106
+ console.log(chalk.green('\n✅ Discord connected\n'));
107
+ console.log(chalk.cyan('Token:'), chalk.white(config.discordToken.slice(0, 20) + '...'));
108
+
109
+ if (config.discordBotId) {
110
+ console.log(chalk.cyan('Bot ID:'), chalk.white(config.discordBotId));
111
+ }
112
+
113
+ console.log(chalk.gray('\nDisconnect with: natureco discord disconnect\n'));
114
+ }
115
+
116
+ module.exports = discord;