vantuz 3.5.11 → 3.5.15
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/index.js +191 -19
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -118,6 +118,7 @@ async function main() {
|
|
|
118
118
|
{ name: '🛍️ Ürün & Stok (Vision AI)', value: 'products' },
|
|
119
119
|
{ name: '🧠 Pazar Analizi', value: 'ai' },
|
|
120
120
|
{ name: '💬 AI Takımı ile Sohbet', value: 'ai_chat' },
|
|
121
|
+
{ name: '🏪 Mağazalarım', value: 'stores' },
|
|
121
122
|
{ name: '➕ Mağaza Ekle', value: 'add_store' },
|
|
122
123
|
{ name: '⚙️ Ayarlar', value: 'settings' },
|
|
123
124
|
{ name: '🚪 Çıkış', value: 'exit' }
|
|
@@ -240,8 +241,21 @@ async function showDashboard(licenseData) {
|
|
|
240
241
|
const orders = await db.Order.count();
|
|
241
242
|
|
|
242
243
|
console.log(chalk.bold(`🏢 Lisans Sahibi: ${chalk.cyan(licenseData.customer)}`));
|
|
243
|
-
console.log(
|
|
244
|
-
|
|
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.active ? 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'));
|
|
245
259
|
}
|
|
246
260
|
|
|
247
261
|
async function handleAction(action) {
|
|
@@ -334,12 +348,93 @@ async function handleAction(action) {
|
|
|
334
348
|
type: 'list',
|
|
335
349
|
name: 'provider',
|
|
336
350
|
message: 'AI Sağlayıcı:',
|
|
337
|
-
choices: ['OpenAI', 'Anthropic', 'Google Gemini', 'xAI
|
|
351
|
+
choices: ['OpenAI', 'Anthropic', 'Google Gemini', 'xAI', 'OpenCode', 'Geri']
|
|
338
352
|
}
|
|
339
353
|
]);
|
|
340
354
|
if (provider !== 'Geri') {
|
|
341
355
|
config.set('ai.provider', provider);
|
|
342
|
-
|
|
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
|
+
}
|
|
343
438
|
}
|
|
344
439
|
} else if (settingAction === '🔙 Geri') {
|
|
345
440
|
return;
|
|
@@ -528,6 +623,7 @@ async function handleAction(action) {
|
|
|
528
623
|
{ name: '🟣 Anthropic (Claude 3)', value: 'Anthropic' },
|
|
529
624
|
{ name: '🟡 Google Gemini', value: 'Gemini' },
|
|
530
625
|
{ name: '⚫ xAI Grok', value: 'xAI' },
|
|
626
|
+
{ name: '💜 OpenCode (Claude)', value: 'OpenCode' },
|
|
531
627
|
{ name: '🔙 Geri', value: 'back' }
|
|
532
628
|
]
|
|
533
629
|
}
|
|
@@ -538,10 +634,11 @@ async function handleAction(action) {
|
|
|
538
634
|
|
|
539
635
|
// Provider'a göre default model
|
|
540
636
|
const defaultModels = {
|
|
541
|
-
'OpenAI': 'gpt-4',
|
|
542
|
-
'Anthropic': 'claude-3-
|
|
543
|
-
'Gemini': 'gemini-pro',
|
|
544
|
-
'xAI': 'grok-
|
|
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'
|
|
545
642
|
};
|
|
546
643
|
config.set('ai.model', defaultModels[provider]);
|
|
547
644
|
console.log(chalk.green(`\n ✅ ${provider} seçildi!`));
|
|
@@ -553,23 +650,27 @@ async function handleAction(action) {
|
|
|
553
650
|
|
|
554
651
|
const modelsByProvider = {
|
|
555
652
|
'OpenAI': [
|
|
556
|
-
{ name: 'GPT-4 Turbo (Önerilen)', value: 'gpt-4-turbo-preview' },
|
|
557
|
-
{ name: 'GPT-4', value: 'gpt-4' },
|
|
558
|
-
{ name: 'GPT-3.5 Turbo', value: 'gpt-3.5-turbo' }
|
|
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' }
|
|
559
656
|
],
|
|
560
657
|
'Anthropic': [
|
|
561
|
-
{ name: 'Claude 3
|
|
562
|
-
{ name: 'Claude 3
|
|
563
|
-
{ name: 'Claude 3 Haiku', value: 'claude-3-haiku-20240307' }
|
|
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' }
|
|
564
661
|
],
|
|
565
662
|
'Gemini': [
|
|
566
|
-
{ name: 'Gemini Pro (Önerilen)', value: 'gemini-pro' },
|
|
567
|
-
{ name: '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' }
|
|
568
666
|
],
|
|
569
667
|
'xAI': [
|
|
570
|
-
{ name: 'Grok
|
|
571
|
-
{ name: 'Grok
|
|
572
|
-
]
|
|
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' }
|
|
573
674
|
]
|
|
574
675
|
};
|
|
575
676
|
|
|
@@ -641,6 +742,77 @@ AI_MODEL=gpt-4
|
|
|
641
742
|
}
|
|
642
743
|
break;
|
|
643
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.active ? 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.active }, { 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));
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
break;
|
|
815
|
+
|
|
644
816
|
case 'exit':
|
|
645
817
|
case 'quit':
|
|
646
818
|
console.log(chalk.yellow('\n👋 Vantuz kapatılıyor...'));
|