vantuz 3.5.16 → 4.0.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.
Files changed (2) hide show
  1. package/index.js +96 -560
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -106,7 +106,7 @@ async function main() {
106
106
  // 5. Ana Döngü
107
107
  while (true) {
108
108
  printHeader();
109
- await showDashboard(licenseStatus.data);
109
+ await showDashboard(licenseStatus.data || { customer: 'Misafir', expires: '2099-01-01' });
110
110
 
111
111
  const { action } = await inquirer.prompt([
112
112
  {
@@ -119,7 +119,6 @@ async function main() {
119
119
  { name: '🧠 Pazar Analizi', value: 'ai' },
120
120
  { name: '💬 AI Takımı ile Sohbet', value: 'ai_chat' },
121
121
  { name: '🏪 Mağazalarım', value: 'stores' },
122
- { name: '➕ Mağaza Ekle', value: 'add_store' },
123
122
  { name: '⚙️ Ayarlar', value: 'settings' },
124
123
  { name: '🚪 Çıkış', value: 'exit' }
125
124
  ]
@@ -241,587 +240,124 @@ async function showDashboard(licenseData) {
241
240
  const orders = await db.Order.count();
242
241
 
243
242
  console.log(chalk.bold(`🏢 Lisans Sahibi: ${chalk.cyan(licenseData.customer)}`));
244
- console.log(chalk.grey('─'.repeat(45)));
245
-
246
- if (stores.length > 0) {
247
- console.log(chalk.cyan('\n 📋 AKTİF MAĞAZALAR:'));
248
- stores.forEach((store, i) => {
249
- const status = store.isActive ? chalk.green('●') : chalk.red('○');
250
- console.log(chalk.white(` ${i+1}. ${status} ${store.name || store.platform} ${chalk.grey(`(${store.platform})`)}`));
251
- });
252
- } else {
253
- console.log(chalk.yellow('\n ⚠️ Hiç mağaza eklenmemiş'));
254
- }
255
-
256
- console.log(chalk.grey('\n ──────────────────────────────────────────'));
257
- console.log(chalk.white(` 📦 Toplam Sipariş: ${orders}`));
258
- console.log(chalk.grey('─────────────────────────────────────────\n'));
243
+ console.log(`📦 Aktif Mağazalar: ${stores.length} | Toplam Sipariş: ${orders}`);
244
+ console.log(chalk.grey('----------------------------------------'));
259
245
  }
260
246
 
261
247
  async function handleAction(action) {
262
248
  const inquirer = require('inquirer');
263
249
  const chalk = require('chalk');
264
250
 
265
- switch(action) {
266
- case 'orders':
267
- console.log(chalk.cyan('\n📦 Sipariş Yönetimi'));
251
+ if (action === 'products') {
252
+ await productManager.manageProducts();
253
+ } else if (action === 'ai_chat') {
254
+ // AI Chat
255
+ let companyInfo = config.get('companyInfo');
256
+ if (!companyInfo || !companyInfo.market) {
257
+ console.log(chalk.cyan('\n🏢 FİRMA KAYDI'));
268
258
  console.log(chalk.grey('─'.repeat(40)));
269
- const orders = await db.Order.findAll({ limit: 20 });
270
- if (orders.length === 0) {
271
- console.log(chalk.yellow(' Henüz sipariş yok.'));
272
- } else {
273
- orders.forEach(o => {
274
- console.log(` ${o.id} | ${o.status} | ${o.total} TL`);
275
- });
276
- }
277
- console.log(chalk.grey('\n [Geri dönmek için Enter tuşuna bas]'));
278
- await inquirer.prompt([{ type: 'input', name: 'back', message: '' }]);
279
- break;
280
-
281
- case 'products':
282
- await productManager.manageProducts();
283
- break;
259
+ const info = await inquirer.prompt([
260
+ { type: 'input', name: 'companyName', message: 'Firma Adı:' },
261
+ { type: 'input', name: 'market', message: 'Hedef Pazar:' },
262
+ { type: 'input', name: 'products', message: 'Ne satıyorsunuz?:' }
263
+ ]);
264
+ companyInfo = { ...info, registeredAt: new Date().toISOString() };
265
+ config.set('companyInfo', companyInfo);
266
+ }
267
+
268
+ console.log(chalk.cyan('\n💬 VANTUZ AI ASİSTAN'));
269
+ console.log(chalk.grey('─'.repeat(40)));
270
+ console.log(chalk.white(` 🏢 ${companyInfo.companyName} | 📍 ${companyInfo.market}\n`));
271
+
272
+ while (true) {
273
+ const { message } = await inquirer.prompt([
274
+ { type: 'input', name: 'message', message: chalk.cyan('💬 ') }
275
+ ]);
276
+ if (message === 'exit' || message === 'çıkış') break;
284
277
 
285
- case 'ai':
286
- console.log(chalk.cyan('\n🧠 Pazar Analizi'));
287
- console.log(chalk.grey('─'.repeat(40)));
288
- console.log(chalk.green(' 📊 Raporlar yükleniyor...'));
278
+ const lower = message.toLowerCase();
279
+ let response = '';
289
280
 
290
- const stores = await db.Store.findAll();
291
- console.log(chalk.white(`\n 📈 Toplam Mağaza: ${stores.length}`));
292
- console.log(chalk.white(` 🛒 Aktif Ürünler: ${await db.Product.count()}`));
281
+ if (lower.includes('pazar') || lower.includes('araştır')) {
282
+ response = `📊 ${companyInfo.market} pazarında araştırma yapıyorum...\n\n• Fiyat analizi\n• Rakip takibi\n• Kar marjı`;
283
+ } else if (lower.includes('stok') || lower.includes('ürün')) {
284
+ response = `📦 Stok durumu:\n\n• Toplam ürün: ${await db.Product.count()}\n• Mağaza: ${(await db.Store.findAll()).length}`;
285
+ } else if (lower.includes('sipariş')) {
286
+ response = `📦 Sipariş durumu:\n\n• Toplam: ${await db.Order.count()}`;
287
+ } else {
288
+ response = `💬 "${message}" anladım.\n\nKomutlar: "pazar araştır", "stok durumu", "siparişler"`;
289
+ }
293
290
 
294
- // Trendyol: new, preparing, approved, kargolanmadi => bekleyen sipariş
295
- const pendingOrders = await db.Order.count({
296
- where: {
297
- status: { in: ['new', 'preparing', 'approved', 'kargolanmadi', 'pending'] }
298
- }
291
+ console.log(chalk.white('\n' + response + '\n'));
292
+ }
293
+ } else if (action === 'stores') {
294
+ // Mağazalarım
295
+ console.log(chalk.cyan('\n🏪 MAĞAZALARIM'));
296
+ console.log(chalk.grey('─'.repeat(40)));
297
+ const stores = await db.Store.findAll();
298
+ if (stores.length === 0) {
299
+ console.log(chalk.yellow(' Hiç mağaza yok.\n'));
300
+ } else {
301
+ stores.forEach((s, i) => {
302
+ console.log(chalk.white(` ${i+1}. ${s.name} (${s.platform})`));
299
303
  });
300
- console.log(chalk.white(` 📦 Bekleyen Siparişler: ${pendingOrders}`));
301
-
302
- console.log(chalk.cyan('\n 🤖 Yapay Zeka Analizi:'));
303
- console.log(chalk.white(' • Fiyatlandırma önerileri hazırlanıyor...'));
304
- console.log(chalk.white(' • Stok optimizasyonu analiz ediliyor...'));
305
- console.log(chalk.white(' Rakip takibi aktif...\n'));
306
-
307
- console.log(chalk.grey('\n [Geri dönmek için Enter tuşuna bas]'));
308
- await inquirer.prompt([{ type: 'input', name: 'back', message: '' }]);
309
- break;
310
-
311
- case 'add_store':
312
- await setupWizard();
313
- break;
314
-
315
- case 'settings':
316
- console.log(chalk.cyan('\n⚙️ Ayarlar'));
317
- console.log(chalk.grey('─'.repeat(40)));
318
- const { settingAction } = await inquirer.prompt([
319
- {
320
- type: 'list',
321
- name: 'settingAction',
322
- message: 'Ayarlar:',
323
- choices: [
324
- '🔑 Lisans Anahtarı Değiştir',
325
- '🤖 Yapay Zeka Model Ayarları',
326
- '🔔 Bildirim Ayarları',
327
- '🕐 Otomatik Senkron Saatleri',
328
- '📱 Telegram/WhatsApp Bağlantısı',
329
- '🔙 Geri'
330
- ]
331
- }
332
- ]);
333
-
334
- if (settingAction === '🔑 Lisans Anahtarı Değiştir') {
335
- const { newKey } = await inquirer.prompt([
336
- { type: 'input', name: 'newKey', message: 'Yeni lisans anahtarı:' }
337
- ]);
338
- const result = licenseManager.verifyLicense(newKey);
339
- if (result.valid) {
340
- config.set('licenseKey', newKey);
341
- console.log(chalk.green(' ✅ Lisans güncellendi!'));
342
- } else {
343
- console.log(chalk.red(' ❌ Geçersiz anahtar: ' + result.reason));
344
- }
345
- } else if (settingAction === '🤖 Yapay Zeka Model Ayarları') {
346
- const { provider } = await inquirer.prompt([
347
- {
348
- type: 'list',
349
- name: 'provider',
350
- message: 'AI Sağlayıcı:',
351
- choices: ['OpenAI', 'Anthropic', 'Google Gemini', 'xAI', 'OpenCode', 'Geri']
352
- }
353
- ]);
354
- if (provider !== 'Geri') {
355
- config.set('ai.provider', provider);
356
-
357
- // Auth tipi seçimi
358
- const authTypes = {
359
- 'OpenAI': ['API Key', 'OAuth (ChatGPT)'],
360
- 'Anthropic': ['API Key', 'Setup Token'],
361
- 'Google Gemini': ['API Key', 'OAuth (Gemini CLI)'],
362
- 'xAI': ['API Key'],
363
- 'OpenCode': ['API Key', 'OAuth (Zen)']
364
- };
365
-
366
- const availableAuth = authTypes[provider] || ['API Key'];
367
-
368
- const { authType } = await inquirer.prompt([
369
- {
370
- type: 'list',
371
- name: 'authType',
372
- message: 'Kimlik Doğrulama Türü:',
373
- choices: availableAuth
374
- }
375
- ]);
376
-
377
- if (authType.includes('OAuth') || authType.includes('CLI')) {
378
- console.log(chalk.cyan(`\n 🔐 ${provider} OAuth/CLI Auth:`));
379
- console.log(chalk.grey(' ─────────────────────────\n'));
380
-
381
- if (provider === 'OpenCode') {
382
- console.log(chalk.white(' 1. https://opencode.ai/subscription aç'));
383
- console.log(chalk.white(' 2. OAuth ile giriş yap'));
384
- console.log(chalk.white(' 3. API key\'i al\n'));
385
- } else if (provider === 'Google Gemini') {
386
- console.log(chalk.yellow(' 📱 Gemini CLI için:'));
387
- console.log(chalk.white(' Terminalde: gemini auth login'));
388
- console.log(chalk.white(' Yetkilendirmeden sonra buraya dön\n'));
389
- }
390
-
391
- const { oauthCode } = await inquirer.prompt([
392
- { type: 'input', name: 'oauthCode', message: 'Token/Key (varsa):', default: '' }
393
- ]);
394
-
395
- if (oauthCode && oauthCode.length > 5) {
396
- config.set('ai.apiKey', oauthCode.trim());
397
- config.set('ai.authType', 'oauth');
398
- console.log(chalk.green(' ✅ Auth kaydedildi!'));
399
- } else {
400
- console.log(chalk.yellow(' ⚠️ Token girilmedi, API Key ile devam ediliyor...'));
401
- }
402
- } else if (authType === 'Setup Token') {
403
- console.log(chalk.cyan('\n 🔑 Anthropic Setup Token:'));
404
- console.log(chalk.grey(' console.anthropic.com -> Settings\n'));
405
-
406
- const { setupToken } = await inquirer.prompt([
407
- { type: 'password', name: 'setupToken', message: 'Setup Token:', mask: '*' }
408
- ]);
409
-
410
- if (setupToken && setupToken.length > 10) {
411
- config.set('ai.apiKey', setupToken.trim());
412
- config.set('ai.authType', 'setup-token');
413
- console.log(chalk.green(' ✅ Setup token kaydedildi!'));
414
- }
415
- } else {
416
- // API Key
417
- const providerKeyNames = {
418
- 'OpenAI': 'OPENAI_API_KEY',
419
- 'Anthropic': 'ANTHROPIC_API_KEY',
420
- 'Google Gemini': 'GEMINI_API_KEY',
421
- 'xAI': 'XAI_API_KEY',
422
- 'OpenCode': 'OPENCODE_API_KEY'
423
- };
424
-
425
- console.log(chalk.cyan(`\n 🔑 ${provider} API Key:`));
426
- console.log(chalk.grey(` (Ortam: ${providerKeyNames[provider]})\n`));
427
-
428
- const { apiKey } = await inquirer.prompt([
429
- { type: 'password', name: 'apiKey', message: 'API Key:', mask: '*' }
430
- ]);
431
-
432
- if (apiKey && apiKey.length > 5) {
433
- config.set('ai.apiKey', apiKey.trim());
434
- config.set('ai.authType', 'api-key');
435
- console.log(chalk.green(' ✅ API Key kaydedildi!'));
436
- }
437
- }
438
- }
439
- } else if (settingAction === '🔙 Geri') {
440
- return;
304
+ }
305
+ console.log(chalk.grey('\n [Devam için Enter]'));
306
+ await inquirer.prompt([{ type: 'input', name: 'ok', message: '' }]);
307
+ } else if (action === 'settings') {
308
+ // Settings
309
+ console.log(chalk.cyan('\n⚙️ AYARLAR'));
310
+ console.log(chalk.grey('─'.repeat(40)));
311
+
312
+ const { setting } = await inquirer.prompt([
313
+ {
314
+ type: 'list',
315
+ name: 'setting',
316
+ message: 'Ayarlar:',
317
+ choices: [
318
+ '🔑 Lisans Değiştir',
319
+ '🤖 AI Model Ayarları',
320
+ '🔙 Geri'
321
+ ]
441
322
  }
442
- break;
443
-
444
- case 'ai_chat':
445
- // Önce firma bilgilerini kontrol et
446
- let companyInfo = config.get('companyInfo');
447
-
448
- if (!companyInfo || !companyInfo.market) {
449
- console.log(chalk.cyan('\n🏢 FİRMA KAYDI'));
450
- console.log(chalk.grey(''.repeat(40)));
451
- console.log(chalk.yellow(' İlk kez kullanıyorsunuz! Size özel deneyim için birkaç soru:\n'));
452
-
453
- const info = await inquirer.prompt([
454
- { type: 'input', name: 'companyName', message: 'Firma Adı:' },
455
- { type: 'input', name: 'market', message: 'Hedef Pazar (Trendyol/Hepsiburada/Amazon/n11/Çiçeksepeti/Tümü):' },
456
- { type: 'input', name: 'products', message: 'Ne satıyorsunuz? (Ürün kategorisi):' },
457
- { type: 'input', name: 'targetCountry', message: 'Yurt dışı satış hedefi varsa (opsiyonel):' }
458
- ]);
459
-
460
- companyInfo = {
461
- ...info,
462
- registeredAt: new Date().toISOString()
463
- };
464
- config.set('companyInfo', companyInfo);
465
- console.log(chalk.green('\n ✅ Firma bilgileri kaydedildi!\n'));
323
+ ]);
324
+
325
+ if (setting === '🔑 Lisans Değiştir') {
326
+ const { newKey } = await inquirer.prompt([
327
+ { type: 'input', name: 'newKey', message: 'Yeni lisans anahtarı:' }
328
+ ]);
329
+ const result = licenseManager.verifyLicense(newKey);
330
+ if (result.valid) {
331
+ config.set('licenseKey', newKey);
332
+ console.log(chalk.green(' Lisans güncellendi!'));
333
+ } else {
334
+ console.log(chalk.red(' ❌ Geçersiz: ' + result.reason));
466
335
  }
336
+ } else if (setting === '🤖 AI Model Ayarları') {
337
+ console.log(chalk.yellow('\n 📝 AI Model Ayarları:'));
467
338
 
468
- console.log(chalk.cyan('\n💬 VANTUZ AI ASİSTAN'));
469
- console.log(chalk.grey('─'.repeat(40)));
470
- console.log(chalk.white(` 🏢 ${companyInfo.companyName} | 📍 ${companyInfo.market} | 🛍️ ${companyInfo.products}\n`));
471
-
472
- const { chatMode } = await inquirer.prompt([
339
+ const { provider } = await inquirer.prompt([
473
340
  {
474
341
  type: 'list',
475
- name: 'chatMode',
476
- message: 'Sohbet Modu:',
477
- choices: [
478
- '🐺 Vantuz ile Direkt Sohbet',
479
- '👥 Ekip Toplantısı (Tüm Ajanlar)',
480
- '🐺 @milo - Strateji & Büyüme',
481
- '📊 @josh - Finans & Raporlama',
482
- '📢 @marketing - İçerik & SEO',
483
- '🔧 @dev - Teknik Destek',
484
- '🔙 Geri'
485
- ]
342
+ name: 'provider',
343
+ message: 'Sağlayıcı:',
344
+ choices: ['OpenAI', 'Anthropic', 'Gemini', 'OpenCode', 'Geri']
486
345
  }
487
346
  ]);
488
347
 
489
- if (chatMode === '🔙 Geri') break;
490
-
491
- console.log(chalk.green('\n ✓ Sohbete başladınız.'));
492
- console.log(chalk.grey(' (Çıkmak için "exit" yazın)\n'));
493
-
494
- // Ana sohbet döngüsü
495
- while (true) {
496
- const { message } = await inquirer.prompt([
497
- { type: 'input', name: 'message', message: chalk.cyan('💬 ') }
498
- ]);
499
-
500
- if (message === 'exit' || message === 'çıkış' || message === 'q') break;
501
-
502
- // Basit yanıt sistemi (gerçek AI entegrasyonu sonra)
503
- let response = '';
504
- const lowerMsg = message.toLowerCase();
505
-
506
- if (chatMode === '🐺 Vantuz ile Direkt Sohbet') {
507
- if (lowerMsg.includes('pazar') || lowerMsg.includes('araştır')) {
508
- response = `📊 ${companyInfo.market} pazarında ${companyInfo.products} kategorisinde araştırma yapıyorum...\n\n` +
509
- `• Rakiplerin ortalama fiyat aralığı belirleniyor\n` +
510
- `• En çok satan ürünler tespit ediliyor\n` +
511
- `• Kar marjı analizi hazırlanıyor\n\n` +
512
- `🔄 Detaylı rapor için "@milo" ile görüşebilirsiniz.`;
513
- } else if (lowerMsg.includes('stok') || lowerMsg.includes('ürün')) {
514
- response = `📦 Ürün ve stok yönetimi:\n\n` +
515
- `• Trendyol'da ${companyInfo.products} kategorisinde X ürününüz var\n` +
516
- `• Yüksek stoklu ürünler: Ürün A, Ürün B\n` +
517
- `• Kritik stok: 5 ürün\n\n` +
518
- `🤖 Detaylı analiz için "@josh" ile görüşebilirsiniz.`;
519
- } else if (lowerMsg.includes('fiyat') || lowerMsg.includes('kar')) {
520
- response = `💰 Fiyatlandırma önerileri:\n\n` +
521
- `• Mevcut kar marjı: %25\n` +
522
- `• Rakip ortalaması: %22\n` +
523
- `• Önerilen: Fiyatları %3 artır\n\n` +
524
- `📈 Detaylı analiz için "@josh" ile görüşün.`;
525
- } else if (lowerMsg.includes('komut') || lowerMsg.includes('ne yaparsın')) {
526
- response = `🤖 Vantuz olarak yapabileceklerim:\n\n` +
527
- `• 📊 Pazar araştırması yapabilirim\n` +
528
- `• 📦 Stok takibi ve öneriler\n` +
529
- `• 💰 Fiyat optimizasyonu\n` +
530
- `• 📢 SEO uyumlu ürün açıklamaları\n` +
531
- `• 👥 Ekip toplantısı düzenleyebilirim\n\n` +
532
- `Bana ne yapmamı istersiniz?`;
533
- } else {
534
- response = `💬 Anladım: "${message}"\n\n` +
535
- `📌 Şu komutları deneyebilirsiniz:\n` +
536
- ` • "pazar araştır" - Pazar analizi\n` +
537
- ` • "stok durumu" - Ürün takibi\n` +
538
- ` • "fiyat önerisi" - Kar marjı\n` +
539
- ` • "toplantı yap" - Ekip toplantısı\n\n` +
540
- `Veya direkt bir ajanla konuşabilirsiniz (@milo, @josh, @marketing, @dev)`;
541
- }
542
- } else if (chatMode === '👥 Ekip Toplantısı') {
543
- response = `👥 **EKİP TOPLANTISI**\n\n` +
544
- `📋 Güncel Durum:\n` +
545
- `• @milo: Strateji belirleniyor\n` +
546
- `• @josh: Finansal rapor hazırlanıyor\n` +
547
- `• @marketing: Yeni kampanya planlanıyor\n` +
548
- `• @dev: Sistem sağlığı: ✅\n\n` +
549
- `💬 Toplantı konusu: "${message}"\n\n` +
550
- `🔄 Herkesin görüşünü alıyorum...`;
551
- } else {
552
- // Belirli ajan
553
- const agentName = chatMode.match(/@(\w+)/)?.[1] || 'asistan';
554
- response = `🐺 **@${agentName}** diyor ki:\n\n` +
555
- `"${message}" mesajınızı aldım.\n\n` +
556
- `✅ Görevlerinizi analiz ediyorum.\n` +
557
- `📊 Gerektiğinde diğer ajanlarla koordinasyon sağlayacağım.\n\n` +
558
- `💬 Başka bir isteğiniz var mı?`;
559
- }
560
-
561
- console.log(chalk.white('\n' + response + '\n'));
562
- }
563
- break;
564
-
565
- case 'model_ayarlari':
566
- while (true) {
567
- console.clear();
568
- console.log(chalk.cyan('\n⚙️ YAPAY Zeka AYARLARI'));
569
- console.log(chalk.grey('═'.repeat(45)));
570
-
571
- // Mevcut durumu göster
572
- const currentProvider = config.get('ai.provider') || 'OpenAI';
573
- const currentModel = config.get('ai.model') || 'gpt-4';
574
- const apiKey = config.get('ai.apiKey');
575
- const hasKey = apiKey && apiKey.length > 10;
576
-
577
- console.log(chalk.white('\n 📊 MEVCUT AYARLAR:\n'));
578
- console.log(chalk.white(` 🌍 Sağlayıcı: ${chalk.cyan(currentProvider)}`));
579
- console.log(chalk.white(` 🤖 Model: ${chalk.cyan(currentModel)}`));
580
- console.log(chalk.white(` 🔑 API Key: ${hasKey ? chalk.green('●'.repeat(8)) + apiKey.slice(-4) : chalk.red('Ayarlanmamış')}`));
581
- console.log(chalk.grey('\n ─────────────────────────────────────\n'));
582
-
583
- const { modelAction } = await inquirer.prompt([
584
- {
585
- type: 'list',
586
- name: 'modelAction',
587
- message: 'İşlem Seçin:',
588
- choices: [
589
- '🔑 API Key Ayarla/Güncelle',
590
- '🌐 Sağlayıcı Değiştir (OpenAI/Anthropic/Gemini/xAI)',
591
- '🤖 Model Seç',
592
- '🧪 Bağlantı Testi Yap',
593
- '📋 Yapılandırma Dosyası (.env) Oluştur',
594
- '🔙 Geri'
595
- ]
596
- }
348
+ if (provider !== 'Geri') {
349
+ const { apiKey } = await inquirer.prompt([
350
+ { type: 'password', name: 'apiKey', message: 'API Key:', mask: '*' }
597
351
  ]);
598
352
 
599
- if (modelAction === '🔙 Geri') break;
600
-
601
- if (modelAction.includes('API Key')) {
602
- console.log(chalk.yellow('\n 📝 API Key girin (遮蔽 olarak saklanacak):'));
603
- const { apiKeyInput } = await inquirer.prompt([
604
- { type: 'password', name: 'apiKeyInput', message: 'API Key:', mask: '*' }
605
- ]);
606
-
607
- if (apiKeyInput && apiKeyInput.length > 10) {
608
- config.set('ai.apiKey', apiKeyInput.trim());
609
- console.log(chalk.green('\n ✅ API Key kaydedildi!'));
610
- } else {
611
- console.log(chalk.red('\n ❌ Geçersiz API Key!'));
612
- }
613
- await new Promise(r => setTimeout(r, 1500));
614
-
615
- } else if (modelAction.includes('Sağlayıcı')) {
616
- const { provider } = await inquirer.prompt([
617
- {
618
- type: 'list',
619
- name: 'provider',
620
- message: 'AI Sağlayıcı:',
621
- choices: [
622
- { name: '🔵 OpenAI (GPT-4, GPT-3.5)', value: 'OpenAI' },
623
- { name: '🟣 Anthropic (Claude 3)', value: 'Anthropic' },
624
- { name: '🟡 Google Gemini', value: 'Gemini' },
625
- { name: '⚫ xAI Grok', value: 'xAI' },
626
- { name: '💜 OpenCode (Claude)', value: 'OpenCode' },
627
- { name: '🔙 Geri', value: 'back' }
628
- ]
629
- }
630
- ]);
631
-
632
- if (provider !== 'back') {
633
- config.set('ai.provider', provider);
634
-
635
- // Provider'a göre default model
636
- const defaultModels = {
637
- 'OpenAI': 'openai/gpt-4-turbo-preview',
638
- 'Anthropic': 'anthropic/claude-3-5-sonnet-20240620',
639
- 'Gemini': 'google/gemini-1.5-pro',
640
- 'xAI': 'xai/grok-2',
641
- 'OpenCode': 'opencode/claude-opus-4-6'
642
- };
643
- config.set('ai.model', defaultModels[provider]);
644
- console.log(chalk.green(`\n ✅ ${provider} seçildi!`));
645
- }
646
- await new Promise(r => setTimeout(r, 1500));
647
-
648
- } else if (modelAction.includes('Model')) {
649
- const provider = config.get('ai.provider') || 'OpenAI';
650
-
651
- const modelsByProvider = {
652
- 'OpenAI': [
653
- { name: 'GPT-4 Turbo (Önerilen)', value: 'openai/gpt-4-turbo-preview' },
654
- { name: 'GPT-4', value: 'openai/gpt-4' },
655
- { name: 'GPT-3.5 Turbo', value: 'openai/gpt-3.5-turbo' }
656
- ],
657
- 'Anthropic': [
658
- { name: 'Claude 3.5 Sonnet (Önerilen)', value: 'anthropic/claude-3-5-sonnet-20240620' },
659
- { name: 'Claude 3 Opus', value: 'anthropic/claude-3-opus-20240229' },
660
- { name: 'Claude 3 Haiku', value: 'anthropic/claude-3-haiku-20240307' }
661
- ],
662
- 'Gemini': [
663
- { name: 'Gemini 1.5 Pro (Önerilen)', value: 'google/gemini-1.5-pro' },
664
- { name: 'Gemini 1.5 Flash', value: 'google/gemini-1.5-flash' },
665
- { name: 'Gemini 1.0 Pro', value: 'google/gemini-pro' }
666
- ],
667
- 'xAI': [
668
- { name: 'Grok 2 (Önerilen)', value: 'xai/grok-2' },
669
- { name: 'Grok Beta', value: 'xai/grok-beta' }
670
- ],
671
- 'OpenCode': [
672
- { name: 'Claude Opus 4.6 (Önerilen)', value: 'opencode/claude-opus-4-6' },
673
- { name: 'Claude Sonnet 4.5', value: 'opencode/claude-sonnet-4-5' }
674
- ]
675
- };
676
-
677
- const { model } = await inquirer.prompt([
678
- {
679
- type: 'list',
680
- name: 'model',
681
- message: `${provider} Modelleri:`,
682
- choices: modelsByProvider[provider] || [{ name: 'Varsayılan', value: 'default' }]
683
- }
684
- ]);
685
-
686
- config.set('ai.model', model);
687
- console.log(chalk.green(`\n ✅ Model: ${model}`));
688
- await new Promise(r => setTimeout(r, 1500));
689
-
690
- } else if (modelAction.includes('Bağlantı')) {
691
- console.log(chalk.yellow('\n 🔄 Bağlantı test ediliyor...\n'));
692
-
693
- const apiKey = config.get('ai.apiKey');
694
- const provider = config.get('ai.provider') || 'OpenAI';
695
-
696
- if (!apiKey) {
697
- console.log(chalk.red(' ❌ API Key ayarlanmamış!'));
698
- } else {
699
- // Basit test
700
- console.log(chalk.white(` 📡 Provider: ${provider}`));
701
- console.log(chalk.white(` 🔑 Key: ${apiKey.slice(0,8)}...${apiKey.slice(-4)}`));
702
-
703
- // Gerçek test yerine basit kontrol
704
- const isValid = apiKey.length > 20 && (apiKey.startsWith('sk-') || apiKey.startsWith('xai-'));
705
-
706
- if (isValid) {
707
- console.log(chalk.green('\n ✅ Bağlantı başarılı!'));
708
- console.log(chalk.grey(' AI modeli kullanıma hazır.'));
709
- } else {
710
- console.log(chalk.yellow('\n ⚠️ API Key formatı beklenenden farklı.'));
711
- console.log(chalk.grey(' Key veya formatı kontrol edin.'));
712
- }
713
- }
714
- await inquirer.prompt([{ type: 'input', name: 'ok', message: '\n Devam...' }]);
715
-
716
- } else if (modelAction.includes('Yapılandırma')) {
717
- console.log(chalk.cyan('\n 📋 .env dosyası oluşturuluyor...\n'));
718
-
719
- const envContent = `# Vantuz AI Yapılandırması
720
- # Bu dosyayı projenizin ana klasörüne .env olarak kaydedin
721
-
722
- # OpenAI (GPT-4)
723
- # OPENAI_API_KEY=sk-...
724
-
725
- # Anthropic (Claude)
726
- # ANTHROPIC_API_KEY=sk-ant-...
727
-
728
- # xAI (Grok)
729
- # XAI_API_KEY=xai-...
730
-
731
- # Aktif Sağlayıcı (openai, anthropic, gemini, xai)
732
- AI_PROVIDER=openai
733
- AI_MODEL=gpt-4
734
- `;
735
-
736
- const fs = require('fs');
737
- fs.writeFileSync('.env.vantuz', envContent);
738
- console.log(chalk.green(' ✅ .env.vantuz dosyası oluşturuldu!'));
739
- console.log(chalk.grey(' Dosyayı .env olarak yeniden adlandırın ve API key\'lerinizi girin.'));
740
- await inquirer.prompt([{ type: 'input', name: 'ok', message: '\n Devam...' }]);
741
- }
742
- }
743
- break;
744
-
745
- case 'stores':
746
- while (true) {
747
- console.clear();
748
- console.log(chalk.cyan('\n🏪 MAĞAZA YÖNETİMİ'));
749
- console.log(chalk.grey('═'.repeat(45)));
750
-
751
- const stores = await db.Store.findAll();
752
-
753
- if (stores.length === 0) {
754
- console.log(chalk.yellow('\n Hiç mağaza eklenmemiş.\n'));
755
- } else {
756
- console.log(chalk.white('\n # | Platform | Mağaza Adı | Durum'));
757
- console.log(chalk.grey(' ──────────────────────────────────────────────'));
758
- stores.forEach((store, i) => {
759
- const status = store.isActive ? chalk.green('Aktif') : chalk.red('Pasif');
760
- const name = store.name || store.storeName || '-';
761
- console.log(chalk.white(` ${i+1} | ${(store.platform || '-').padEnd(15)} | ${name.substring(0,15).padEnd(15)} | ${status}`));
762
- });
763
- }
764
-
765
- console.log(chalk.grey('\n ──────────────────────────────────────────\n'));
766
-
767
- const { storeAction } = await inquirer.prompt([
768
- {
769
- type: 'list',
770
- name: 'storeAction',
771
- message: 'İşlem:',
772
- choices: [
773
- '➕ Yeni Mağaza Ekle',
774
- ...(stores.length > 0 ? ['✏️ Mağaza Düzenle', '🗑️ Mağaza Sil', '🔄 Durum Değiştir'] : []),
775
- '🔙 Geri'
776
- ]
777
- }
778
- ]);
779
-
780
- if (storeAction === '🔙 Geri') break;
781
-
782
- if (storeAction.includes('Ekle')) {
783
- await setupWizard();
784
- } else if (storeAction.includes('Sil')) {
785
- const storeList = stores.map(s => `${s.name || s.platform} (${s.platform})`);
786
- const { selectedStore } = await inquirer.prompt([
787
- { type: 'list', name: 'selectedStore', message: 'Silinecek mağaza:', choices: storeList }
788
- ]);
789
-
790
- const idx = storeList.indexOf(selectedStore);
791
- if (idx >= 0) {
792
- await db.Store.destroy({ where: { id: stores[idx].id } });
793
- console.log(chalk.green(' ✅ Mağaza silindi!'));
794
- await new Promise(r => setTimeout(r, 1000));
795
- }
796
- } else if (storeAction.includes('Durum')) {
797
- const storeList = stores.map(s => `${s.name || s.platform} (${s.platform})`);
798
- const { selectedStore } = await inquirer.prompt([
799
- { type: 'list', name: 'selectedStore', message: 'Durumu değiştirilecek mağaza:', choices: storeList }
800
- ]);
801
-
802
- const idx = storeList.indexOf(selectedStore);
803
- if (idx >= 0) {
804
- const store = stores[idx];
805
- await db.Store.update({ active: !store.isActive }, { where: { id: store.id } });
806
- console.log(chalk.green(` ✅ Durum değiştirildi!`));
807
- await new Promise(r => setTimeout(r, 1000));
808
- }
809
- } else if (storeAction.includes('Düzenle')) {
810
- console.log(chalk.yellow('\n ⚠️ Düzenleme özelliği yakında!'));
811
- await new Promise(r => setTimeout(r, 1500));
353
+ if (apiKey) {
354
+ config.set('ai.provider', provider);
355
+ config.set('ai.apiKey', apiKey);
356
+ console.log(chalk.green(' Kaydedildi!'));
812
357
  }
813
358
  }
814
- break;
815
-
816
- case 'exit':
817
- case 'quit':
818
- console.log(chalk.yellow('\n👋 Vantuz kapatılıyor...'));
819
- console.log(chalk.grey(' Görüşmek üzere! 🐙\n'));
820
- process.exit(0);
821
- break;
822
-
823
- default:
824
- console.log(chalk.yellow(' ⚠️ Bu özellik henüz aktif değil.'));
359
+ }
360
+ await inquirer.prompt([{ type: 'input', name: 'ok', message: '\n Devam...' }]);
825
361
  }
826
362
  }
827
363
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vantuz",
3
- "version": "3.5.16",
3
+ "version": "4.0.0",
4
4
  "description": "Yapay Zeka Destekli Yeni Nesil E-Ticaret Yönetim Platformu (CLI)",
5
5
  "main": "index.js",
6
6
  "bin": {