vantuz 3.0.0 → 3.0.1
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/cli.js +19 -7
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -11,12 +11,18 @@
|
|
|
11
11
|
|
|
12
12
|
import fs from 'fs';
|
|
13
13
|
import path from 'path';
|
|
14
|
-
import
|
|
14
|
+
import os from 'os';
|
|
15
15
|
import readline from 'readline';
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
const
|
|
17
|
+
// Config dosyaları kullanıcının home dizininde saklanır
|
|
18
|
+
const VANTUZ_HOME = path.join(os.homedir(), '.vantuz');
|
|
19
|
+
const CONFIG_PATH = path.join(VANTUZ_HOME, '.env');
|
|
20
|
+
const CONFIG_JSON = path.join(VANTUZ_HOME, 'config.json');
|
|
21
|
+
|
|
22
|
+
// Dizin yoksa oluştur
|
|
23
|
+
if (!fs.existsSync(VANTUZ_HOME)) {
|
|
24
|
+
fs.mkdirSync(VANTUZ_HOME, { recursive: true });
|
|
25
|
+
}
|
|
20
26
|
|
|
21
27
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
22
28
|
// RENK KODLARI
|
|
@@ -89,6 +95,11 @@ function saveEnv(env) {
|
|
|
89
95
|
fs.writeFileSync(CONFIG_PATH, lines.join('\n'));
|
|
90
96
|
}
|
|
91
97
|
|
|
98
|
+
function hasAnyAIKey(env) {
|
|
99
|
+
return env.OPENAI_API_KEY || env.ANTHROPIC_API_KEY ||
|
|
100
|
+
env.DEEPSEEK_API_KEY || env.GROQ_API_KEY || env.GEMINI_API_KEY;
|
|
101
|
+
}
|
|
102
|
+
|
|
92
103
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
93
104
|
// READLINE HELPER
|
|
94
105
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
@@ -219,7 +230,7 @@ async function runTUI() {
|
|
|
219
230
|
console.log(c('dim', ' Komutlar: /help, /stok, /fiyat, /rapor, /cikis\n'));
|
|
220
231
|
|
|
221
232
|
// Check AI config
|
|
222
|
-
const hasAI = env
|
|
233
|
+
const hasAI = hasAnyAIKey(env);
|
|
223
234
|
if (!hasAI) {
|
|
224
235
|
console.log(c('yellow', ' ⚠️ AI sağlayıcı yapılandırılmamış.'));
|
|
225
236
|
console.log(c('dim', ' → vantuz config komutunu çalıştırın\n'));
|
|
@@ -334,7 +345,7 @@ async function processChat(input, config, env) {
|
|
|
334
345
|
}
|
|
335
346
|
|
|
336
347
|
// Default response
|
|
337
|
-
if (!env
|
|
348
|
+
if (!hasAnyAIKey(env)) {
|
|
338
349
|
return 'AI yanıtı için API anahtarı gerekli. "vantuz config" ile ayarlayın.';
|
|
339
350
|
}
|
|
340
351
|
|
|
@@ -355,7 +366,7 @@ async function runStatus() {
|
|
|
355
366
|
|
|
356
367
|
// AI
|
|
357
368
|
const aiProvider = config.aiProvider || 'Ayarlanmamış';
|
|
358
|
-
const hasAIKey = env
|
|
369
|
+
const hasAIKey = hasAnyAIKey(env);
|
|
359
370
|
console.log(` AI Sağlayıcı: ${aiProvider} ${hasAIKey ? c('green', '✓') : c('red', '✗')}`);
|
|
360
371
|
|
|
361
372
|
// Platforms
|
|
@@ -378,6 +389,7 @@ async function runStatus() {
|
|
|
378
389
|
}
|
|
379
390
|
|
|
380
391
|
console.log(`\n Toplam: ${connected}/${platforms.length} platform bağlı`);
|
|
392
|
+
console.log(c('dim', `\n Config: ${CONFIG_PATH}`));
|
|
381
393
|
console.log();
|
|
382
394
|
}
|
|
383
395
|
|