vantuz 3.4.1 → 3.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.
Files changed (70) hide show
  1. package/LICENSE +45 -45
  2. package/admin-keygen.js +51 -0
  3. package/cli.js +685 -585
  4. package/config.js +733 -733
  5. package/core/agent-loop.js +190 -190
  6. package/core/ai-provider.js +298 -261
  7. package/core/automation.js +523 -523
  8. package/core/brand-analyst.js +101 -0
  9. package/core/channels.js +167 -167
  10. package/core/dashboard.js +230 -230
  11. package/core/database.js +135 -36
  12. package/core/eia-monitor.js +3 -1
  13. package/core/engine.js +648 -636
  14. package/core/gateway.js +447 -447
  15. package/core/learning.js +214 -214
  16. package/core/license.js +113 -0
  17. package/core/marketplace-adapter.js +168 -168
  18. package/core/memory.js +190 -190
  19. package/core/migrations/001-initial-schema.sql +1 -1
  20. package/core/queue.js +120 -120
  21. package/core/self-healer.js +314 -314
  22. package/core/unified-product.js +214 -214
  23. package/core/vision-service.js +113 -113
  24. package/index.js +217 -174
  25. package/modules/crm/sentiment-crm.js +231 -231
  26. package/modules/healer/listing-healer.js +201 -201
  27. package/modules/oracle/predictor.js +214 -214
  28. package/modules/researcher/agent.js +169 -169
  29. package/modules/team/agents/base.js +92 -92
  30. package/modules/team/agents/dev.js +33 -33
  31. package/modules/team/agents/josh.js +40 -40
  32. package/modules/team/agents/marketing.js +33 -33
  33. package/modules/team/agents/milo.js +36 -36
  34. package/modules/team/index.js +78 -78
  35. package/modules/team/shared-memory.js +87 -87
  36. package/modules/war-room/competitor-tracker.js +250 -250
  37. package/modules/war-room/pricing-engine.js +308 -308
  38. package/nodes/warehouse.js +238 -238
  39. package/onboard.js +1 -1
  40. package/package.json +7 -6
  41. package/platforms/pttavm.js +14 -14
  42. package/plugins/vantuz/index.js +528 -528
  43. package/plugins/vantuz/memory/hippocampus.js +465 -464
  44. package/plugins/vantuz/package.json +20 -20
  45. package/plugins/vantuz/platforms/_template.js +118 -118
  46. package/plugins/vantuz/platforms/amazon.js +236 -236
  47. package/plugins/vantuz/platforms/ciceksepeti.js +166 -166
  48. package/plugins/vantuz/platforms/hepsiburada.js +180 -180
  49. package/plugins/vantuz/platforms/index.js +165 -165
  50. package/plugins/vantuz/platforms/n11.js +229 -229
  51. package/plugins/vantuz/platforms/pazarama.js +154 -154
  52. package/plugins/vantuz/platforms/pttavm.js +127 -127
  53. package/plugins/vantuz/platforms/trendyol.js +326 -326
  54. package/plugins/vantuz/services/alerts.js +253 -253
  55. package/plugins/vantuz/services/license.js +34 -34
  56. package/plugins/vantuz/services/scheduler.js +232 -232
  57. package/plugins/vantuz/tools/analytics.js +152 -152
  58. package/plugins/vantuz/tools/crossborder.js +187 -187
  59. package/plugins/vantuz/tools/nl-parser.js +211 -211
  60. package/plugins/vantuz/tools/product.js +110 -110
  61. package/plugins/vantuz/tools/quick-report.js +175 -175
  62. package/plugins/vantuz/tools/repricer.js +314 -314
  63. package/plugins/vantuz/tools/sentiment.js +115 -115
  64. package/plugins/vantuz/tools/vision.js +257 -257
  65. package/private.pem +28 -0
  66. package/public.pem +9 -0
  67. package/server/app.js +260 -260
  68. package/server/public/index.html +514 -514
  69. package/start.bat +33 -33
  70. package/vantuz.sqlite +0 -0
package/index.js CHANGED
@@ -1,175 +1,218 @@
1
1
  #!/usr/bin/env node
2
-
3
- const fs = require('fs');
4
- const clear = require('console-clear');
5
- const figlet = require('figlet');
6
- const chalk = require('chalk');
7
- const inquirer = require('inquirer');
8
- const boxen = require('boxen');
9
- const ora = require('ora');
10
- const Conf = require('conf');
11
- const db = require('./core/database');
12
- const licenseManager = require('./core/license-manager');
13
-
14
- // ... (Diğer importlar aynı) ...
15
- const productManager = require('./core/product-manager');
16
- const platforms = {
17
- trendyol: require('./platforms/trendyol')
18
- };
19
-
20
- const config = new Conf({ projectName: 'vantuz' });
21
-
22
- // --- GİZLİ ADMIN MODU ---
23
- // KODDAN SİLİNDİ. Lisans üretimi harici araçla yapılır.
24
-
25
- const printHeader = () => {
26
- clear();
27
- console.log(chalk.cyan(figlet.textSync('VANTUZ', { horizontalLayout: 'full' })));
28
- console.log(chalk.grey(' 🐙 E-Ticaretin Yapay Zeka Beyni | v2.2 Enterprise\n'));
29
- };
30
-
31
- async function main() {
32
- printHeader();
33
-
34
- // 1. Karşılama ve İlk Kurulum Kontrolü
35
- const isFirstRun = !config.get('installed');
36
-
37
- if (isFirstRun) {
38
- await welcomeScreen();
39
- }
40
-
41
- // 2. Lisans Kontrolü
42
- let licenseKey = config.get('licenseKey');
43
- let licenseStatus = licenseKey ? licenseManager.verifyLicense(licenseKey) : { valid: false };
44
-
45
- if (!licenseStatus.valid) {
46
- if (licenseKey) console.log(chalk.red(`⚠️ Lisans Hatası: ${licenseStatus.reason}`));
47
-
48
- console.log(boxen(chalk.white('🔒 VANTUZ Lisans Aktivasyonu\nDevam etmek için satıcınızdan aldığınız anahtarı girin.'), { padding: 1, borderColor: 'cyan', borderStyle: 'classic' }));
49
- await activateLicense();
50
- } else {
51
- const daysLeft = Math.floor((new Date(licenseStatus.data.expiry) - new Date()) / (1000 * 60 * 60 * 24));
52
- console.log(chalk.green(`✅ Lisanslı: ${licenseStatus.data.customer} (Kalan Süre: ${daysLeft} Gün)`));
53
- await new Promise(r => setTimeout(r, 1000));
54
- }
55
-
56
- // 3. Veritabanı ve Sistem
57
- const spinner = ora('Sistem nöronları başlatılıyor...').start();
58
- await db.initDB();
59
- spinner.succeed('Çekirdek Aktif');
60
-
61
- // 4. Mağaza Kontrolü
62
- const storeCount = await db.Store.count();
63
- if (storeCount === 0) {
64
- console.log(chalk.yellow('\n⚠️ Hiçbir mağaza bağlı değil.'));
65
- await setupWizard();
66
- }
67
-
68
- // 5. Ana Döngü
69
- while (true) {
70
- printHeader();
71
- await showDashboard(licenseStatus.data);
72
-
73
- const { action } = await inquirer.prompt([
74
- {
75
- type: 'list',
76
- name: 'action',
77
- message: 'Komut Merkezi:',
78
- choices: [
79
- { name: '📦 Sipariş Yönetimi', value: 'orders' },
80
- { name: '🛍️ Ürün & Stok (Vision AI)', value: 'products' },
81
- { name: '🧠 Pazar Analizi', value: 'ai' },
82
- { name: '⚙️ Ayarlar', value: 'settings' },
83
- { name: '🚪 Çıkış', value: 'exit' }
84
- ]
85
- }
86
- ]);
87
-
88
- if (action === 'exit') process.exit(0);
89
- await handleAction(action);
90
- }
91
- }
92
-
93
- async function welcomeScreen() {
94
- clear();
95
- console.log(chalk.cyan(figlet.textSync('Merhaba!', { horizontalLayout: 'full' })));
96
- console.log(boxen(chalk.white(`
97
- VANTUZ'a Hoşgeldiniz.
98
-
99
- Bu yazılım, e-ticaret operasyonlarınızı yapay zeka ile yönetmenizi sağlar.
100
- Kuruluma başlamadan önce lütfen şunları hazırlayın:
101
-
102
- 1. Lisans Anahtarınız
103
- 2. Pazaryeri API Bilgileriniz (Trendyol, Hepsiburada vb.)
104
- 3. (Opsiyonel) OpenAI API Anahtarı - Vision özelliği için
105
-
106
- Başlamaya hazır mısınız?
107
- `), { padding: 1, borderStyle: 'double', borderColor: 'green' }));
108
-
109
- const { ready } = await inquirer.prompt([{ type: 'confirm', name: 'ready', message: 'Kuruluma Başla', default: true }]);
110
- if (!ready) {
111
- console.log(chalk.yellow('Kurulum iptal edildi. Çıkılıyor...'));
112
- process.exit(0);
113
- }
114
- config.set('installed', true);
115
- }
116
-
117
- async function activateLicense() {
118
- const { key } = await inquirer.prompt([{ type: 'password', name: 'key', message: 'Lisans Anahtarı:', mask: '*' }]);
119
- const spinner = ora('Anahtar doğrulanıyor...').start();
120
- await new Promise(r => setTimeout(r, 1500)); // Dramatik bekleme
121
-
122
- const status = licenseManager.verifyLicense(key);
123
-
124
- if (status.valid) {
125
- spinner.succeed(`Lisans Aktif: ${status.data.customer}`);
126
- config.set('licenseKey', key);
127
- await new Promise(r => setTimeout(r, 1000));
128
- } else {
129
- spinner.fail(`Hata: ${status.reason}`);
130
- console.log(chalk.yellow('Lütfen geçerli bir anahtar girin veya satıcınızla görüşün.'));
131
- process.exit(1);
132
- }
133
- }
134
-
135
- // ... (setupWizard, showDashboard, handleAction fonksiyonları aynı kalacak, sadece ufak revizyonlar) ...
136
-
137
- // setupWizard fonksiyonunu güncelleme (Mağaza kurulumu)
138
- async function setupWizard() {
139
- console.log(chalk.bold('\n🛒 Mağaza Bağlantı Sihirbazı\n'));
140
- const { storeName } = await inquirer.prompt([{ type: 'input', name: 'storeName', message: 'Mağaza Adı:' }]);
141
-
142
- // Platform seçimi ve API girişi buraya gelecek (önceki koddan)
143
- // ...
144
-
145
- // Demo için sadece Trendyol ekleyelim
146
- console.log(chalk.cyan('\n👉 Trendyol Entegrasyonu:'));
147
- const creds = await inquirer.prompt([
148
- { type: 'password', name: 'supplierId', message: 'Supplier ID:', mask: '*' },
149
- { type: 'password', name: 'apiKey', message: 'API Key:', mask: '*' },
150
- { type: 'password', name: 'apiSecret', message: 'API Secret:', mask: '*' }
151
- ]);
152
-
153
- await db.Store.create({ name: storeName, platform: 'trendyol', credentials: creds });
154
- console.log(chalk.green('\n✅ Mağaza Bağlandı!'));
155
- await new Promise(r => setTimeout(r, 1500));
156
- }
157
-
158
- async function showDashboard(licenseData) {
159
- const stores = await db.Store.findAll();
160
- const orders = await db.Order.count();
161
-
162
- console.log(chalk.bold(`🏢 Lisans Sahibi: ${chalk.cyan(licenseData.customer)}`));
163
- console.log(`📦 Aktif Mağazalar: ${stores.length} | Toplam Sipariş: ${orders}`);
164
- console.log(chalk.grey('----------------------------------------'));
165
- }
166
-
167
- async function handleAction(action) {
168
- if (action === 'products') await productManager.manageProducts();
169
- // Diğer aksiyonlar...
170
- }
171
-
172
- main().catch(err => {
173
- console.error(err);
174
- process.exit(1);
175
- });
2
+
3
+ const fs = require('fs');
4
+ const clear = require('console-clear');
5
+ const figlet = require('figlet');
6
+ const chalk = require('chalk');
7
+ const inquirer = require('inquirer');
8
+ const boxen = require('boxen');
9
+ const ora = require('ora');
10
+ const Conf = require('conf');
11
+ const db = require('./core/database');
12
+ const licenseManager = require('./core/license-manager');
13
+
14
+ // ... (Diğer importlar aynı) ...
15
+ const productManager = require('./core/product-manager');
16
+ const brandAnalyst = require('./core/brand-analyst');
17
+ const platforms = {
18
+ trendyol: require('./platforms/trendyol')
19
+ };
20
+
21
+ const config = new Conf({ projectName: 'vantuz' });
22
+
23
+ // --- GİZLİ ADMIN MODU ---
24
+ // KODDAN SİLİNDİ. Lisans üretimi harici araçla yapılır.
25
+
26
+ const printHeader = () => {
27
+ clear();
28
+ console.log(chalk.cyan(figlet.textSync('VANTUZ', { horizontalLayout: 'full' })));
29
+ console.log(chalk.grey(' 🐙 E-Ticaretin Yapay Zeka Beyni | v2.2 Enterprise\n'));
30
+ };
31
+
32
+ async function main() {
33
+ printHeader();
34
+
35
+ // 1. Karşılama ve İlk Kurulum Kontrolü
36
+ const isFirstRun = !config.get('installed');
37
+
38
+ if (isFirstRun) {
39
+ await welcomeScreen();
40
+ }
41
+
42
+ // 2. Lisans Kontrolü
43
+ let licenseKey = config.get('licenseKey');
44
+ let licenseStatus = licenseKey ? licenseManager.verifyLicense(licenseKey) : { valid: false };
45
+
46
+ if (!licenseStatus.valid) {
47
+ if (licenseKey) console.log(chalk.red(`⚠️ Lisans Hatası: ${licenseStatus.reason}`));
48
+
49
+ console.log(boxen(chalk.white('🔒 VANTUZ Lisans Aktivasyonu\nDevam etmek için satıcınızdan aldığınız anahtarı girin.'), { padding: 1, borderColor: 'cyan', borderStyle: 'classic' }));
50
+ await activateLicense();
51
+ } else {
52
+ const daysLeft = Math.floor((new Date(licenseStatus.data.expiry) - new Date()) / (1000 * 60 * 60 * 24));
53
+ console.log(chalk.green(`✅ Lisanslı: ${licenseStatus.data.customer} (Kalan Süre: ${daysLeft} Gün)`));
54
+ await new Promise(r => setTimeout(r, 1000));
55
+ }
56
+
57
+ // 3. Veritabanı ve Sistem
58
+ const spinner = ora('Sistem nöronları başlatılıyor...').start();
59
+ await db.initDB();
60
+ spinner.succeed('Çekirdek Aktif');
61
+
62
+ // 4. Mağaza Kontrolü
63
+ const storeCount = await db.Store.count();
64
+ if (storeCount === 0) {
65
+ console.log(chalk.yellow('\n⚠️ Hiçbir mağaza bağlı değil.'));
66
+ await setupWizard();
67
+ }
68
+
69
+ // 5. Ana Döngü
70
+ while (true) {
71
+ printHeader();
72
+ await showDashboard(licenseStatus.data);
73
+
74
+ const { action } = await inquirer.prompt([
75
+ {
76
+ type: 'list',
77
+ name: 'action',
78
+ message: 'Komut Merkezi:',
79
+ choices: [
80
+ { name: '📦 Sipariş Yönetimi', value: 'orders' },
81
+ { name: '🛍️ Ürün & Stok (Vision AI)', value: 'products' },
82
+ { name: '🧠 Pazar Analizi', value: 'ai' },
83
+ { name: ' Mağaza Ekle', value: 'add_store' },
84
+ { name: '⚙️ Ayarlar', value: 'settings' },
85
+ { name: '🚪 Çıkış', value: 'exit' }
86
+ ]
87
+ }
88
+ ]);
89
+
90
+ if (action === 'exit') process.exit(0);
91
+ await handleAction(action);
92
+ }
93
+ }
94
+
95
+ async function welcomeScreen() {
96
+ clear();
97
+ console.log(chalk.cyan(figlet.textSync('Merhaba!', { horizontalLayout: 'full' })));
98
+ console.log(boxen(chalk.white(`
99
+ VANTUZ'a Hoşgeldiniz.
100
+
101
+ Bu yazılım, e-ticaret operasyonlarınızı yapay zeka ile yönetmenizi sağlar.
102
+ Kuruluma başlamadan önce lütfen şunları hazırlayın:
103
+
104
+ 1. Lisans Anahtarınız
105
+ 2. Pazaryeri API Bilgileriniz (Trendyol, Hepsiburada vb.)
106
+ 3. (Opsiyonel) OpenAI API Anahtarı - Vision özelliği için
107
+
108
+ Başlamaya hazır mısınız?
109
+ `), { padding: 1, borderStyle: 'double', borderColor: 'green' }));
110
+
111
+ const { ready } = await inquirer.prompt([{ type: 'confirm', name: 'ready', message: 'Kuruluma Başla', default: true }]);
112
+ if (!ready) {
113
+ console.log(chalk.yellow('Kurulum iptal edildi. Çıkılıyor...'));
114
+ process.exit(0);
115
+ }
116
+ config.set('installed', true);
117
+ }
118
+
119
+ async function activateLicense() {
120
+ const { key } = await inquirer.prompt([{ type: 'password', name: 'key', message: 'Lisans Anahtarı:', mask: '*' }]);
121
+ const spinner = ora('Anahtar doğrulanıyor...').start();
122
+ await new Promise(r => setTimeout(r, 1500)); // Dramatik bekleme
123
+
124
+ const status = licenseManager.verifyLicense(key);
125
+
126
+ if (status.valid) {
127
+ spinner.succeed(`Lisans Aktif: ${status.data.customer}`);
128
+ config.set('licenseKey', key);
129
+ await new Promise(r => setTimeout(r, 1000));
130
+ } else {
131
+ spinner.fail(`Hata: ${status.reason}`);
132
+ console.log(chalk.yellow('Lütfen geçerli bir anahtar girin veya satıcınızla görüşün.'));
133
+ process.exit(1);
134
+ }
135
+ }
136
+
137
+ // ... (setupWizard, showDashboard, handleAction fonksiyonları aynı kalacak, sadece ufak revizyonlar) ...
138
+
139
+ // setupWizard fonksiyonunu güncelleme (Mağaza kurulumu)
140
+ async function setupWizard() {
141
+ console.log(chalk.bold('\n🛒 Mağaza Bağlantı Sihirbazı\n'));
142
+ const { storeName } = await inquirer.prompt([{ type: 'input', name: 'storeName', message: 'Mağaza Adı:' }]);
143
+
144
+ const { platform } = await inquirer.prompt([
145
+ {
146
+ type: 'list',
147
+ name: 'platform',
148
+ message: 'Pazaryeri Seçin:',
149
+ choices: [
150
+ { name: '🟧 Trendyol', value: 'trendyol' },
151
+ { name: '🟧 Hepsiburada', value: 'hepsiburada' },
152
+ { name: '🐞 N11', value: 'n11' },
153
+ { name: '📦 Amazon (SP-API)', value: 'amazon' }
154
+ ]
155
+ }
156
+ ]);
157
+
158
+ let creds = {};
159
+
160
+ if (platform === 'trendyol') {
161
+ console.log(chalk.cyan('\n👉 Trendyol Entegrasyonu:'));
162
+ creds = await inquirer.prompt([
163
+ { type: 'password', name: 'supplierId', message: 'Supplier ID:', mask: '*' },
164
+ { type: 'password', name: 'apiKey', message: 'API Key:', mask: '*' },
165
+ { type: 'password', name: 'apiSecret', message: 'API Secret:', mask: '*' }
166
+ ]);
167
+ } else if (platform === 'hepsiburada') {
168
+ console.log(chalk.cyan('\n👉 Hepsiburada Entegrasyonu:'));
169
+ creds = await inquirer.prompt([
170
+ { type: 'input', name: 'merchantId', message: 'Merchant ID:' },
171
+ { type: 'password', name: 'username', message: 'Username (MP):', mask: '*' },
172
+ { type: 'password', name: 'password', message: 'Password:', mask: '*' }
173
+ ]);
174
+ } else if (platform === 'n11') {
175
+ console.log(chalk.cyan('\n👉 N11 Entegrasyonu:'));
176
+ creds = await inquirer.prompt([
177
+ { type: 'password', name: 'apiKey', message: 'API Key:', mask: '*' },
178
+ { type: 'password', name: 'apiSecret', message: 'API Secret:', mask: '*' }
179
+ ]);
180
+ } else if (platform === 'amazon') {
181
+ console.log(chalk.cyan('\n👉 Amazon SP-API Entegrasyonu:'));
182
+ creds = await inquirer.prompt([
183
+ { type: 'input', name: 'sellerId', message: 'Seller ID:' },
184
+ { type: 'password', name: 'clientId', message: 'Client ID:', mask: '*' },
185
+ { type: 'password', name: 'clientSecret', message: 'Client Secret:', mask: '*' },
186
+ { type: 'password', name: 'refreshToken', message: 'Refresh Token:', mask: '*' },
187
+ { type: 'list', name: 'region', message: 'Bölge:', choices: ['eu', 'na', 'tr'], default: 'tr' }
188
+ ]);
189
+ }
190
+
191
+ await db.Store.create({ name: storeName, platform, credentials: creds });
192
+ console.log(chalk.green(`\n✅ ${storeName} (${platform}) Başarıyla Bağlandı!`));
193
+
194
+ // AI Brand Analysis
195
+ await brandAnalyst.analyzeAndSave(storeName, config);
196
+
197
+ await new Promise(r => setTimeout(r, 1500));
198
+ }
199
+
200
+ async function showDashboard(licenseData) {
201
+ const stores = await db.Store.findAll();
202
+ const orders = await db.Order.count();
203
+
204
+ console.log(chalk.bold(`🏢 Lisans Sahibi: ${chalk.cyan(licenseData.customer)}`));
205
+ console.log(`📦 Aktif Mağazalar: ${stores.length} | Toplam Sipariş: ${orders}`);
206
+ console.log(chalk.grey('----------------------------------------'));
207
+ }
208
+
209
+ async function handleAction(action) {
210
+ if (action === 'products') await productManager.manageProducts();
211
+ if (action === 'add_store') await setupWizard();
212
+ // Diğer aksiyonlar...
213
+ }
214
+
215
+ main().catch(err => {
216
+ console.error(err);
217
+ process.exit(1);
218
+ });