natureco-cli 2.14.10 → 2.15.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 +1 -1
- package/src/commands/dashboard.js +2 -2
- package/src/commands/setup.js +356 -169
package/package.json
CHANGED
|
@@ -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.
|
|
214
|
+
<div class="version-badge" id="version-badge">v2.15.0</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.
|
|
344
|
+
version: 'v2.15.0',
|
|
345
345
|
bots: cfg.bots || [],
|
|
346
346
|
telegramToken: cfg.telegramToken || null,
|
|
347
347
|
whatsappConnected: cfg.whatsappConnected || false,
|
package/src/commands/setup.js
CHANGED
|
@@ -1,221 +1,408 @@
|
|
|
1
1
|
const chalk = require('chalk');
|
|
2
|
-
const boxen = require('boxen');
|
|
3
2
|
const inquirer = require('inquirer');
|
|
4
3
|
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const os = require('os');
|
|
5
6
|
const { saveConfig, CONFIG_DIR, CONFIG_FILE } = require('../utils/config');
|
|
7
|
+
const { saveMemory } = require('../utils/memory');
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
{
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
9
|
+
// ─── Dil metinleri ────────────────────────────────────────────────────────────
|
|
10
|
+
const LANG = {
|
|
11
|
+
tr: {
|
|
12
|
+
welcome: '🌿 NatureCo CLI — Kurulum',
|
|
13
|
+
welcomeSub: 'Birkaç adımda hazır olacaksın.',
|
|
14
|
+
step: (n, t) => chalk.gray(`[${n}/6]`) + ' ' + chalk.cyan.bold(t),
|
|
15
|
+
done: '✓',
|
|
16
|
+
// Adım 1
|
|
17
|
+
providerTitle: 'AI Provider seç',
|
|
18
|
+
providerQ: 'Hangi AI provider kullanmak istiyorsunuz?',
|
|
19
|
+
customUrl: 'Provider URL girin (örn: https://api.example.com/v1):',
|
|
20
|
+
apiKeyQ: 'API Key girin:',
|
|
21
|
+
modelQ: 'Model seç:',
|
|
22
|
+
customModel: 'Model adı girin (örn: llama-3.3-70b-versatile):',
|
|
23
|
+
customEntry: 'Özel URL gir',
|
|
24
|
+
customModelEntry: 'Özel model adı gir',
|
|
25
|
+
// Adım 2
|
|
26
|
+
botNameTitle: 'Bot adı',
|
|
27
|
+
botNameQ: 'Botunun adı ne olsun?',
|
|
28
|
+
botNameDefault: 'NatureBot',
|
|
29
|
+
// Adım 3
|
|
30
|
+
userNameTitle: 'Kullanıcı adı',
|
|
31
|
+
userNameQ: 'Senin adın ne? (hafıza için)',
|
|
32
|
+
userNameDefault:'Kullanıcı',
|
|
33
|
+
// Adım 4
|
|
34
|
+
integTitle: 'Entegrasyonlar',
|
|
35
|
+
integQ: 'Hangi entegrasyonları kurmak istiyorsunuz?',
|
|
36
|
+
integSkip: 'Şimdilik atla',
|
|
37
|
+
integNote: (list) => `Seçilen: ${list.join(', ')} — kurulum için ilgili komutu çalıştır.`,
|
|
38
|
+
integCmds: {
|
|
39
|
+
Telegram: 'natureco telegram connect',
|
|
40
|
+
WhatsApp: 'natureco whatsapp connect',
|
|
41
|
+
Discord: 'natureco discord connect',
|
|
42
|
+
Slack: 'natureco slack connect',
|
|
43
|
+
},
|
|
44
|
+
// Adım 5
|
|
45
|
+
gatewayTitle: 'Gateway',
|
|
46
|
+
gatewayQ: 'Gateway şimdi başlatılsın mı? (arka planda çalışır)',
|
|
47
|
+
gatewayYes: 'Gateway başlatılıyor...',
|
|
48
|
+
gatewaySkip: 'Sonra başlatmak için: natureco gateway start',
|
|
49
|
+
// Adım 6
|
|
50
|
+
chatTitle: 'Hazır!',
|
|
51
|
+
chatQ: 'Hemen chat başlatmak ister misin?',
|
|
52
|
+
chatStart: 'Chat başlatılıyor...',
|
|
53
|
+
chatSkip: 'Başlamak için: natureco chat',
|
|
54
|
+
// Özet
|
|
55
|
+
summaryTitle: '✅ Kurulum tamamlandı!',
|
|
56
|
+
summaryProvider:'Provider',
|
|
57
|
+
summaryModel: 'Model',
|
|
58
|
+
summaryBot: 'Bot adı',
|
|
59
|
+
summaryUser: 'Kullanıcı',
|
|
60
|
+
summaryConfig: 'Config',
|
|
61
|
+
// Hata
|
|
62
|
+
urlRequired: 'URL gerekli',
|
|
63
|
+
urlInvalid: 'URL http:// veya https:// ile başlamalı',
|
|
64
|
+
apiKeyRequired: 'API key gerekli',
|
|
65
|
+
modelRequired: 'Model adı gerekli',
|
|
66
|
+
nameRequired: 'İsim gerekli',
|
|
67
|
+
},
|
|
68
|
+
en: {
|
|
69
|
+
welcome: '🌿 NatureCo CLI — Setup',
|
|
70
|
+
welcomeSub: 'You\'ll be ready in a few steps.',
|
|
71
|
+
step: (n, t) => chalk.gray(`[${n}/6]`) + ' ' + chalk.cyan.bold(t),
|
|
72
|
+
done: '✓',
|
|
73
|
+
// Step 1
|
|
74
|
+
providerTitle: 'AI Provider',
|
|
75
|
+
providerQ: 'Which AI provider do you want to use?',
|
|
76
|
+
customUrl: 'Enter provider URL (e.g. https://api.example.com/v1):',
|
|
77
|
+
apiKeyQ: 'Enter API Key:',
|
|
78
|
+
modelQ: 'Select model:',
|
|
79
|
+
customModel: 'Enter model name (e.g. llama-3.3-70b-versatile):',
|
|
80
|
+
customEntry: 'Enter custom URL',
|
|
81
|
+
customModelEntry: 'Enter custom model name',
|
|
82
|
+
// Step 2
|
|
83
|
+
botNameTitle: 'Bot name',
|
|
84
|
+
botNameQ: 'What should your bot be called?',
|
|
85
|
+
botNameDefault: 'NatureBot',
|
|
86
|
+
// Step 3
|
|
87
|
+
userNameTitle: 'Your name',
|
|
88
|
+
userNameQ: 'What is your name? (for memory)',
|
|
89
|
+
userNameDefault:'User',
|
|
90
|
+
// Step 4
|
|
91
|
+
integTitle: 'Integrations',
|
|
92
|
+
integQ: 'Which integrations do you want to set up?',
|
|
93
|
+
integSkip: 'Skip for now',
|
|
94
|
+
integNote: (list) => `Selected: ${list.join(', ')} — run the relevant command to connect.`,
|
|
95
|
+
integCmds: {
|
|
96
|
+
Telegram: 'natureco telegram connect',
|
|
97
|
+
WhatsApp: 'natureco whatsapp connect',
|
|
98
|
+
Discord: 'natureco discord connect',
|
|
99
|
+
Slack: 'natureco slack connect',
|
|
100
|
+
},
|
|
101
|
+
// Step 5
|
|
102
|
+
gatewayTitle: 'Gateway',
|
|
103
|
+
gatewayQ: 'Start the gateway now? (runs in background)',
|
|
104
|
+
gatewayYes: 'Starting gateway...',
|
|
105
|
+
gatewaySkip: 'To start later: natureco gateway start',
|
|
106
|
+
// Step 6
|
|
107
|
+
chatTitle: 'All set!',
|
|
108
|
+
chatQ: 'Start chatting now?',
|
|
109
|
+
chatStart: 'Starting chat...',
|
|
110
|
+
chatSkip: 'To start: natureco chat',
|
|
111
|
+
// Summary
|
|
112
|
+
summaryTitle: '✅ Setup complete!',
|
|
113
|
+
summaryProvider:'Provider',
|
|
114
|
+
summaryModel: 'Model',
|
|
115
|
+
summaryBot: 'Bot name',
|
|
116
|
+
summaryUser: 'User',
|
|
117
|
+
summaryConfig: 'Config',
|
|
118
|
+
// Errors
|
|
119
|
+
urlRequired: 'URL is required',
|
|
120
|
+
urlInvalid: 'URL must start with http:// or https://',
|
|
121
|
+
apiKeyRequired: 'API key is required',
|
|
122
|
+
modelRequired: 'Model name is required',
|
|
123
|
+
nameRequired: 'Name is required',
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
// ─── Provider presets ─────────────────────────────────────────────────────────
|
|
128
|
+
const PROVIDER_PRESETS = (customLabel) => [
|
|
129
|
+
{ name: 'Groq (recommended — fast & free)', value: 'https://api.groq.com/openai/v1' },
|
|
130
|
+
{ name: 'OpenAI', value: 'https://api.openai.com/v1' },
|
|
131
|
+
{ name: 'Anthropic', value: 'https://api.anthropic.com' },
|
|
132
|
+
{ name: 'Together AI', value: 'https://api.together.xyz/v1' },
|
|
133
|
+
{ name: 'Fireworks AI', value: 'https://api.fireworks.ai/inference/v1' },
|
|
134
|
+
{ name: 'DeepSeek', value: 'https://api.deepseek.com/v1' },
|
|
135
|
+
{ name: 'OpenRouter', value: 'https://openrouter.ai/api/v1' },
|
|
136
|
+
{ name: 'Ollama (local)', value: 'http://localhost:11434/v1' },
|
|
137
|
+
{ name: 'LM Studio (local)', value: 'http://localhost:1234/v1' },
|
|
138
|
+
{ name: customLabel, value: 'custom' },
|
|
139
|
+
];
|
|
20
140
|
|
|
141
|
+
const COMMON_MODELS = {
|
|
142
|
+
'api.groq.com': ['llama-3.3-70b-versatile','llama-3.1-8b-instant','llama-3.1-70b-versatile','mixtral-8x7b-32768','gemma2-9b-it'],
|
|
143
|
+
'api.openai.com': ['gpt-4o','gpt-4o-mini','gpt-4-turbo','gpt-3.5-turbo'],
|
|
144
|
+
'api.anthropic.com': ['claude-opus-4-7','claude-sonnet-4-6','claude-haiku-4-5-20251001'],
|
|
145
|
+
'api.together.xyz': ['meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo','meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo','mistralai/Mixtral-8x7B-Instruct-v0.1'],
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
// ─── Yardımcı: adım başlığı ───────────────────────────────────────────────────
|
|
149
|
+
function printStep(L, n, title) {
|
|
150
|
+
console.log('');
|
|
151
|
+
console.log(chalk.gray('─'.repeat(50)));
|
|
152
|
+
console.log(L.step(n, title));
|
|
153
|
+
console.log('');
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function printDone(L, msg) {
|
|
157
|
+
console.log(chalk.green(` ${L.done} ${msg}`));
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// ─── Ana fonksiyon ────────────────────────────────────────────────────────────
|
|
161
|
+
async function setup() {
|
|
21
162
|
console.clear();
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
console.log(
|
|
163
|
+
|
|
164
|
+
// ── Karşılama ──────────────────────────────────────────────────────────────
|
|
165
|
+
console.log('');
|
|
166
|
+
console.log(chalk.green.bold(' (\\_/)'));
|
|
167
|
+
console.log(chalk.green.bold(' (•ᴥ•)'));
|
|
168
|
+
console.log(chalk.green(' />🌿'));
|
|
169
|
+
console.log('');
|
|
170
|
+
|
|
171
|
+
// ── ADIM 0: Dil seçimi ─────────────────────────────────────────────────────
|
|
172
|
+
const { lang } = await inquirer.prompt([{
|
|
173
|
+
type: 'list',
|
|
174
|
+
name: 'lang',
|
|
175
|
+
message: 'Language / Dil:',
|
|
176
|
+
choices: [
|
|
177
|
+
{ name: '🇹🇷 Türkçe', value: 'tr' },
|
|
178
|
+
{ name: '🇬🇧 English', value: 'en' },
|
|
179
|
+
],
|
|
180
|
+
}]);
|
|
181
|
+
|
|
182
|
+
const L = LANG[lang];
|
|
183
|
+
|
|
184
|
+
console.log('');
|
|
185
|
+
console.log(chalk.green.bold(` ${L.welcome}`));
|
|
186
|
+
console.log(chalk.gray(` ${L.welcomeSub}`));
|
|
25
187
|
|
|
26
188
|
// Klasör oluştur
|
|
27
|
-
console.log(chalk.cyan('✦ ~/.natureco/ klasörü oluşturuluyor...'));
|
|
28
189
|
if (!fs.existsSync(CONFIG_DIR)) {
|
|
29
190
|
fs.mkdirSync(CONFIG_DIR, { recursive: true });
|
|
30
191
|
}
|
|
31
|
-
console.log(chalk.green(' ✓ Klasör oluşturuldu\n'));
|
|
32
192
|
|
|
33
|
-
// Mevcut config
|
|
193
|
+
// Mevcut config
|
|
34
194
|
let existingConfig = {};
|
|
35
195
|
if (fs.existsSync(CONFIG_FILE)) {
|
|
36
|
-
try {
|
|
37
|
-
const data = fs.readFileSync(CONFIG_FILE, 'utf-8');
|
|
38
|
-
existingConfig = JSON.parse(data);
|
|
39
|
-
} catch {
|
|
40
|
-
existingConfig = {};
|
|
41
|
-
}
|
|
196
|
+
try { existingConfig = JSON.parse(fs.readFileSync(CONFIG_FILE, 'utf-8')); } catch {}
|
|
42
197
|
}
|
|
43
198
|
|
|
44
|
-
// Provider
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
const PROVIDER_PRESETS = [
|
|
48
|
-
{ name: 'Groq (önerilen - hızlı ve ücretsiz)', value: 'https://api.groq.com/openai/v1' },
|
|
49
|
-
{ name: 'OpenAI', value: 'https://api.openai.com/v1' },
|
|
50
|
-
{ name: 'Anthropic', value: 'https://api.anthropic.com' },
|
|
51
|
-
{ name: 'Together AI', value: 'https://api.together.xyz/v1' },
|
|
52
|
-
{ name: 'Fireworks AI', value: 'https://api.fireworks.ai/inference/v1' },
|
|
53
|
-
{ name: 'DeepSeek', value: 'https://api.deepseek.com/v1' },
|
|
54
|
-
{ name: 'OpenRouter', value: 'https://openrouter.ai/api/v1' },
|
|
55
|
-
{ name: 'Ollama (local)', value: 'http://localhost:11434/v1' },
|
|
56
|
-
{ name: 'LM Studio (local)', value: 'http://localhost:1234/v1' },
|
|
57
|
-
{ name: 'Özel URL gir', value: 'custom' },
|
|
58
|
-
];
|
|
59
|
-
|
|
60
|
-
process.stdin.resume();
|
|
61
|
-
const { providerChoice } = await inquirer.prompt([
|
|
62
|
-
{
|
|
63
|
-
type: 'list',
|
|
64
|
-
name: 'providerChoice',
|
|
65
|
-
message: 'Hangi AI provider kullanmak istiyorsunuz?',
|
|
66
|
-
choices: PROVIDER_PRESETS,
|
|
67
|
-
default: PROVIDER_PRESETS[0].value,
|
|
68
|
-
},
|
|
69
|
-
]);
|
|
199
|
+
// ── ADIM 1: Provider + API key + Model ────────────────────────────────────
|
|
200
|
+
printStep(L, 1, L.providerTitle);
|
|
70
201
|
|
|
71
|
-
|
|
202
|
+
const { providerChoice } = await inquirer.prompt([{
|
|
203
|
+
type: 'list',
|
|
204
|
+
name: 'providerChoice',
|
|
205
|
+
message: L.providerQ,
|
|
206
|
+
choices: PROVIDER_PRESETS(L.customEntry),
|
|
207
|
+
default: 'https://api.groq.com/openai/v1',
|
|
208
|
+
}]);
|
|
72
209
|
|
|
210
|
+
let providerUrl = providerChoice;
|
|
73
211
|
if (providerChoice === 'custom') {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
return 'URL gerekli';
|
|
83
|
-
}
|
|
84
|
-
if (!input.startsWith('http://') && !input.startsWith('https://')) {
|
|
85
|
-
return 'URL http:// veya https:// ile başlamalı';
|
|
86
|
-
}
|
|
87
|
-
return true;
|
|
88
|
-
},
|
|
212
|
+
const { customUrl } = await inquirer.prompt([{
|
|
213
|
+
type: 'input',
|
|
214
|
+
name: 'customUrl',
|
|
215
|
+
message: L.customUrl,
|
|
216
|
+
validate: (v) => {
|
|
217
|
+
if (!v.trim()) return L.urlRequired;
|
|
218
|
+
if (!v.startsWith('http://') && !v.startsWith('https://')) return L.urlInvalid;
|
|
219
|
+
return true;
|
|
89
220
|
},
|
|
90
|
-
]);
|
|
221
|
+
}]);
|
|
91
222
|
providerUrl = customUrl.trim();
|
|
92
223
|
}
|
|
93
224
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
validate: (input) => {
|
|
102
|
-
if (!input || input.trim().length === 0) {
|
|
103
|
-
return 'API key gerekli';
|
|
104
|
-
}
|
|
105
|
-
return true;
|
|
106
|
-
},
|
|
107
|
-
},
|
|
108
|
-
]);
|
|
109
|
-
|
|
110
|
-
// Model seçimi
|
|
111
|
-
const COMMON_MODELS = {
|
|
112
|
-
'api.groq.com': [
|
|
113
|
-
'llama-3.3-70b-versatile',
|
|
114
|
-
'llama-3.1-8b-instant',
|
|
115
|
-
'llama-3.1-70b-versatile',
|
|
116
|
-
'mixtral-8x7b-32768',
|
|
117
|
-
'gemma2-9b-it',
|
|
118
|
-
],
|
|
119
|
-
'api.openai.com': [
|
|
120
|
-
'gpt-4o',
|
|
121
|
-
'gpt-4o-mini',
|
|
122
|
-
'gpt-4-turbo',
|
|
123
|
-
'gpt-3.5-turbo',
|
|
124
|
-
],
|
|
125
|
-
'api.anthropic.com': [
|
|
126
|
-
'claude-opus-4-7',
|
|
127
|
-
'claude-sonnet-4-6',
|
|
128
|
-
'claude-haiku-4-5-20251001',
|
|
129
|
-
],
|
|
130
|
-
'api.together.xyz': [
|
|
131
|
-
'meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo',
|
|
132
|
-
'meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo',
|
|
133
|
-
'mistralai/Mixtral-8x7B-Instruct-v0.1',
|
|
134
|
-
],
|
|
135
|
-
};
|
|
225
|
+
const { providerApiKey } = await inquirer.prompt([{
|
|
226
|
+
type: 'password',
|
|
227
|
+
name: 'providerApiKey',
|
|
228
|
+
message: L.apiKeyQ,
|
|
229
|
+
mask: '*',
|
|
230
|
+
validate: (v) => v.trim() ? true : L.apiKeyRequired,
|
|
231
|
+
}]);
|
|
136
232
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
// Provider URL'den model listesi çıkar
|
|
233
|
+
// Model listesi
|
|
234
|
+
let modelChoices = [L.customModelEntry];
|
|
140
235
|
for (const [domain, models] of Object.entries(COMMON_MODELS)) {
|
|
141
236
|
if (providerUrl.includes(domain)) {
|
|
142
|
-
modelChoices = [...models,
|
|
237
|
+
modelChoices = [...models, L.customModelEntry];
|
|
143
238
|
break;
|
|
144
239
|
}
|
|
145
240
|
}
|
|
146
241
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
choices: modelChoices,
|
|
154
|
-
},
|
|
155
|
-
]);
|
|
242
|
+
const { modelChoice } = await inquirer.prompt([{
|
|
243
|
+
type: 'list',
|
|
244
|
+
name: 'modelChoice',
|
|
245
|
+
message: L.modelQ,
|
|
246
|
+
choices: modelChoices,
|
|
247
|
+
}]);
|
|
156
248
|
|
|
157
249
|
let providerModel = modelChoice;
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
message: 'Model adı girin (örn: llama-3.3-70b-versatile):',
|
|
166
|
-
validate: (input) => {
|
|
167
|
-
if (!input || input.trim().length === 0) {
|
|
168
|
-
return 'Model adı gerekli';
|
|
169
|
-
}
|
|
170
|
-
return true;
|
|
171
|
-
},
|
|
172
|
-
},
|
|
173
|
-
]);
|
|
250
|
+
if (modelChoice === L.customModelEntry) {
|
|
251
|
+
const { customModel } = await inquirer.prompt([{
|
|
252
|
+
type: 'input',
|
|
253
|
+
name: 'customModel',
|
|
254
|
+
message: L.customModel,
|
|
255
|
+
validate: (v) => v.trim() ? true : L.modelRequired,
|
|
256
|
+
}]);
|
|
174
257
|
providerModel = customModel.trim();
|
|
175
258
|
}
|
|
176
259
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
260
|
+
printDone(L, `${providerUrl.replace('https://', '').split('/')[0]} · ${providerModel}`);
|
|
261
|
+
|
|
262
|
+
// ── ADIM 2: Bot adı ────────────────────────────────────────────────────────
|
|
263
|
+
printStep(L, 2, L.botNameTitle);
|
|
264
|
+
|
|
265
|
+
const { botName } = await inquirer.prompt([{
|
|
266
|
+
type: 'input',
|
|
267
|
+
name: 'botName',
|
|
268
|
+
message: L.botNameQ,
|
|
269
|
+
default: existingConfig.botName || L.botNameDefault,
|
|
270
|
+
validate: (v) => v.trim() ? true : L.nameRequired,
|
|
271
|
+
}]);
|
|
272
|
+
|
|
273
|
+
printDone(L, botName.trim());
|
|
274
|
+
|
|
275
|
+
// ── ADIM 3: Kullanıcı adı ──────────────────────────────────────────────────
|
|
276
|
+
printStep(L, 3, L.userNameTitle);
|
|
277
|
+
|
|
278
|
+
const { userName } = await inquirer.prompt([{
|
|
279
|
+
type: 'input',
|
|
280
|
+
name: 'userName',
|
|
281
|
+
message: L.userNameQ,
|
|
282
|
+
default: existingConfig.userName || L.userNameDefault,
|
|
283
|
+
validate: (v) => v.trim() ? true : L.nameRequired,
|
|
284
|
+
}]);
|
|
285
|
+
|
|
286
|
+
printDone(L, userName.trim());
|
|
287
|
+
|
|
288
|
+
// ── ADIM 4: Entegrasyonlar ─────────────────────────────────────────────────
|
|
289
|
+
printStep(L, 4, L.integTitle);
|
|
187
290
|
|
|
188
|
-
|
|
291
|
+
const { integrations } = await inquirer.prompt([{
|
|
292
|
+
type: 'checkbox',
|
|
293
|
+
name: 'integrations',
|
|
294
|
+
message: L.integQ,
|
|
295
|
+
choices: [
|
|
296
|
+
{ name: 'Telegram', value: 'Telegram' },
|
|
297
|
+
{ name: 'WhatsApp', value: 'WhatsApp' },
|
|
298
|
+
{ name: 'Discord', value: 'Discord' },
|
|
299
|
+
{ name: 'Slack', value: 'Slack' },
|
|
300
|
+
],
|
|
301
|
+
}]);
|
|
302
|
+
|
|
303
|
+
if (integrations.length > 0) {
|
|
304
|
+
printDone(L, integrations.join(', '));
|
|
305
|
+
console.log('');
|
|
306
|
+
integrations.forEach(integ => {
|
|
307
|
+
console.log(chalk.gray(` → ${L.integCmds[integ]}`));
|
|
308
|
+
});
|
|
309
|
+
} else {
|
|
310
|
+
printDone(L, L.integSkip);
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
// ── ADIM 5: Gateway ────────────────────────────────────────────────────────
|
|
314
|
+
printStep(L, 5, L.gatewayTitle);
|
|
315
|
+
|
|
316
|
+
const { startGateway } = await inquirer.prompt([{
|
|
317
|
+
type: 'confirm',
|
|
318
|
+
name: 'startGateway',
|
|
319
|
+
message: L.gatewayQ,
|
|
320
|
+
default: integrations.includes('WhatsApp'),
|
|
321
|
+
}]);
|
|
322
|
+
|
|
323
|
+
// ── Config kaydet ──────────────────────────────────────────────────────────
|
|
189
324
|
const config = {
|
|
325
|
+
...existingConfig,
|
|
190
326
|
setupCompleted: true,
|
|
191
327
|
setupDate: new Date().toISOString(),
|
|
192
|
-
|
|
328
|
+
language: lang,
|
|
329
|
+
providerUrl,
|
|
193
330
|
providerApiKey: providerApiKey.trim(),
|
|
194
|
-
providerModel
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
331
|
+
providerModel,
|
|
332
|
+
botName: botName.trim(),
|
|
333
|
+
userName: userName.trim(),
|
|
334
|
+
debug: existingConfig.debug || false,
|
|
335
|
+
skills: existingConfig.skills || { enabled: true, list: [] },
|
|
336
|
+
mcpServers: existingConfig.mcpServers || {},
|
|
198
337
|
};
|
|
199
338
|
|
|
200
339
|
saveConfig(config);
|
|
201
340
|
|
|
202
|
-
//
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
341
|
+
// Hafızaya kullanıcı adı ve bot adı kaydet
|
|
342
|
+
const botId = 'universal-provider';
|
|
343
|
+
try {
|
|
344
|
+
saveMemory(botId, {
|
|
345
|
+
name: userName.trim(),
|
|
346
|
+
botName: botName.trim(),
|
|
347
|
+
nickname: '',
|
|
348
|
+
preferences: [],
|
|
349
|
+
facts: [],
|
|
350
|
+
lastSeen: new Date().toISOString(),
|
|
351
|
+
});
|
|
352
|
+
} catch {}
|
|
353
|
+
|
|
354
|
+
// ── Özet ───────────────────────────────────────────────────────────────────
|
|
208
355
|
console.log('');
|
|
209
|
-
console.log(chalk.
|
|
356
|
+
console.log(chalk.gray('─'.repeat(50)));
|
|
357
|
+
console.log(chalk.green.bold(` ${L.summaryTitle}`));
|
|
210
358
|
console.log('');
|
|
211
|
-
console.log(chalk.gray('
|
|
212
|
-
console.log(chalk.
|
|
213
|
-
console.log(chalk.
|
|
214
|
-
console.log(chalk.
|
|
215
|
-
console.log(chalk.
|
|
359
|
+
console.log(chalk.gray(` ${L.summaryProvider}:`), chalk.white(providerUrl.replace('https://', '').split('/')[0]));
|
|
360
|
+
console.log(chalk.gray(` ${L.summaryModel}:`), chalk.white(providerModel));
|
|
361
|
+
console.log(chalk.gray(` ${L.summaryBot}:`), chalk.cyan(botName.trim()));
|
|
362
|
+
console.log(chalk.gray(` ${L.summaryUser}:`), chalk.white(userName.trim()));
|
|
363
|
+
console.log(chalk.gray(` ${L.summaryConfig}:`), chalk.gray(CONFIG_FILE));
|
|
216
364
|
console.log('');
|
|
217
|
-
|
|
365
|
+
|
|
366
|
+
// Gateway başlat
|
|
367
|
+
if (startGateway) {
|
|
368
|
+
console.log(chalk.cyan(` ${L.gatewayYes}`));
|
|
369
|
+
try {
|
|
370
|
+
const { spawn } = require('child_process');
|
|
371
|
+
const gatewayBin = path.join(__dirname, '..', '..', 'bin', 'natureco.js');
|
|
372
|
+
spawn(process.execPath, [gatewayBin, 'gateway', 'start'], {
|
|
373
|
+
detached: true,
|
|
374
|
+
stdio: 'ignore',
|
|
375
|
+
}).unref();
|
|
376
|
+
printDone(L, 'Gateway');
|
|
377
|
+
} catch (e) {
|
|
378
|
+
console.log(chalk.yellow(` ⚠ ${e.message}`));
|
|
379
|
+
}
|
|
380
|
+
} else {
|
|
381
|
+
console.log(chalk.gray(` ${L.gatewaySkip}`));
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
// ── ADIM 6: Chat ───────────────────────────────────────────────────────────
|
|
385
|
+
printStep(L, 6, L.chatTitle);
|
|
386
|
+
|
|
387
|
+
const { startChat } = await inquirer.prompt([{
|
|
388
|
+
type: 'confirm',
|
|
389
|
+
name: 'startChat',
|
|
390
|
+
message: L.chatQ,
|
|
391
|
+
default: true,
|
|
392
|
+
}]);
|
|
393
|
+
|
|
218
394
|
console.log('');
|
|
395
|
+
|
|
396
|
+
if (startChat) {
|
|
397
|
+
console.log(chalk.cyan(` ${L.chatStart}`));
|
|
398
|
+
console.log('');
|
|
399
|
+
// Chat komutunu çalıştır
|
|
400
|
+
const chat = require('./chat');
|
|
401
|
+
await chat([], {});
|
|
402
|
+
} else {
|
|
403
|
+
console.log(chalk.gray(` ${L.chatSkip}`));
|
|
404
|
+
console.log('');
|
|
405
|
+
}
|
|
219
406
|
}
|
|
220
407
|
|
|
221
408
|
module.exports = setup;
|