natureco-cli 5.59.0 → 5.61.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/audit.js +26 -24
- package/src/commands/code.js +95 -87
- package/src/commands/code_v5.js +58 -56
- package/src/commands/medium.js +32 -30
- package/src/commands/migrate.js +54 -52
- package/src/commands/naturehub.js +32 -30
- package/src/commands/policy.js +32 -30
- package/src/commands/security.js +24 -22
- package/src/commands/seo.js +43 -41
- package/src/commands/xp.js +42 -40
package/src/commands/migrate.js
CHANGED
|
@@ -2,6 +2,8 @@ const fs = require('fs');
|
|
|
2
2
|
const path = require('path');
|
|
3
3
|
const os = require('os');
|
|
4
4
|
const chalk = require('chalk');
|
|
5
|
+
const { getLang: _gl } = require('../utils/i18n');
|
|
6
|
+
const L = (tr, en) => (_gl() === 'en' ? en : tr);
|
|
5
7
|
const { execSync } = require('child_process');
|
|
6
8
|
const { getConfig, setConfigValue } = require('../utils/config');
|
|
7
9
|
const { normalizeWindowsPaths } = require('../utils/path-utils');
|
|
@@ -42,25 +44,25 @@ async function migrate(options) {
|
|
|
42
44
|
return migrateHermes();
|
|
43
45
|
}
|
|
44
46
|
if (from !== 'openclaw') {
|
|
45
|
-
console.log(chalk.red('\n❌ Desteklenen kaynaklar: openclaw, claude-code, hermes\n'));
|
|
46
|
-
console.log(chalk.gray('Kullanım: natureco migrate --from openclaw'));
|
|
47
|
+
console.log(chalk.red(L('\n❌ Desteklenen kaynaklar: openclaw, claude-code, hermes\n', '\n❌ Supported sources: openclaw, claude-code, hermes\n')));
|
|
48
|
+
console.log(chalk.gray(L('Kullanım: natureco migrate --from openclaw', 'Usage: natureco migrate --from openclaw')));
|
|
47
49
|
console.log(chalk.gray(' natureco migrate --from claude-code'));
|
|
48
50
|
console.log(chalk.gray(' natureco migrate --from hermes\n'));
|
|
49
51
|
return;
|
|
50
52
|
}
|
|
51
53
|
|
|
52
|
-
console.log(chalk.yellow('\n⏳ OpenClaw → NatureCo migration başlıyor...\n'));
|
|
54
|
+
console.log(chalk.yellow(L('\n⏳ OpenClaw → NatureCo migration başlıyor...\n', '\n⏳ OpenClaw → NatureCo migration starting...\n')));
|
|
53
55
|
|
|
54
56
|
// OpenClaw directory
|
|
55
57
|
const openclawDir = options.openclawDir || path.join(os.homedir(), '.openclaw');
|
|
56
58
|
|
|
57
59
|
if (!fs.existsSync(openclawDir)) {
|
|
58
|
-
console.log(chalk.red(`❌ OpenClaw dizini
|
|
59
|
-
console.log(chalk.gray('--openclaw-dir ile farklı bir dizin belirtin.\n'));
|
|
60
|
+
console.log(chalk.red(`❌ ${L('OpenClaw dizini bulunamadı', 'OpenClaw directory not found')}: ${openclawDir}\n`));
|
|
61
|
+
console.log(chalk.gray(L('--openclaw-dir ile farklı bir dizin belirtin.\n', 'Specify a different directory with --openclaw-dir.\n')));
|
|
60
62
|
return;
|
|
61
63
|
}
|
|
62
64
|
|
|
63
|
-
console.log(chalk.cyan('OpenClaw dizini:'), chalk.white(openclawDir));
|
|
65
|
+
console.log(chalk.cyan(L('OpenClaw dizini:', 'OpenClaw directory:')), chalk.white(openclawDir));
|
|
64
66
|
console.log('');
|
|
65
67
|
|
|
66
68
|
const report = {
|
|
@@ -209,7 +211,7 @@ async function migrate(options) {
|
|
|
209
211
|
}
|
|
210
212
|
} catch (err) {
|
|
211
213
|
// Skip file if error
|
|
212
|
-
console.log(chalk.gray(`⚠️ ${path.basename(file)}
|
|
214
|
+
console.log(chalk.gray(`⚠️ ${path.basename(file)} ${L('okunamadı', 'could not be read')}`));
|
|
213
215
|
}
|
|
214
216
|
}
|
|
215
217
|
|
|
@@ -314,12 +316,12 @@ async function migrate(options) {
|
|
|
314
316
|
fs.writeFileSync(filePath, JSON.stringify(existing, null, 2));
|
|
315
317
|
} catch (err) {
|
|
316
318
|
// Skip file if error
|
|
317
|
-
console.log(chalk.gray(`⚠️ ${file} güncellenemedi`));
|
|
319
|
+
console.log(chalk.gray(`⚠️ ${file} ${L('güncellenemedi', 'could not be updated')}`));
|
|
318
320
|
}
|
|
319
321
|
}
|
|
320
322
|
|
|
321
323
|
if (memoryFiles.length > 0) {
|
|
322
|
-
console.log(chalk.green(`✅ Memory ${memoryFiles.length} bot dosyasına da
|
|
324
|
+
console.log(chalk.green(`✅ Memory ${memoryFiles.length} ${L('bot dosyasına da kopyalandı', 'files also copied to bots')}`));
|
|
323
325
|
}
|
|
324
326
|
} catch (err) {
|
|
325
327
|
// Silently fail if can't read memory directory
|
|
@@ -328,7 +330,7 @@ async function migrate(options) {
|
|
|
328
330
|
report.memory = memory;
|
|
329
331
|
}
|
|
330
332
|
} catch (err) {
|
|
331
|
-
console.log(chalk.gray('⚠️ Memory migration atlandı:', err.message));
|
|
333
|
+
console.log(chalk.gray(L('⚠️ Memory migration atlandı:', '⚠️ Memory migration skipped:'), err.message));
|
|
332
334
|
}
|
|
333
335
|
|
|
334
336
|
// 1.5. Workspace scripts migration
|
|
@@ -394,23 +396,23 @@ async function migrate(options) {
|
|
|
394
396
|
for (const envSource of envSources) {
|
|
395
397
|
if (fs.existsSync(envSource)) {
|
|
396
398
|
fs.copyFileSync(envSource, envDest);
|
|
397
|
-
console.log(chalk.green('✅ .env dosyası kopyalandı'));
|
|
399
|
+
console.log(chalk.green(L('✅ .env dosyası kopyalandı', '✅ .env file copied')));
|
|
398
400
|
break;
|
|
399
401
|
}
|
|
400
402
|
}
|
|
401
403
|
|
|
402
404
|
// Install npm packages
|
|
403
|
-
console.log(chalk.yellow('\n📦 Workspace npm paketleri kuruluyor...\n'));
|
|
405
|
+
console.log(chalk.yellow(L('\n📦 Workspace npm paketleri kuruluyor...\n', '\n📦 Installing workspace npm packages...\n')));
|
|
404
406
|
try {
|
|
405
407
|
execSync('npm install', { cwd: workspaceDir, stdio: 'inherit' });
|
|
406
|
-
console.log(chalk.green('\n✅ npm paketleri kuruldu\n'));
|
|
408
|
+
console.log(chalk.green(L('\n✅ npm paketleri kuruldu\n', '\n✅ npm packages installed\n')));
|
|
407
409
|
} catch (err) {
|
|
408
|
-
console.log(chalk.yellow('\n⚠️ npm install başarısız, manuel olarak çalıştırın:\n'));
|
|
410
|
+
console.log(chalk.yellow(L('\n⚠️ npm install başarısız, manuel olarak çalıştırın:\n', '\n⚠️ npm install failed, run manually:\n')));
|
|
409
411
|
console.log(chalk.cyan(` cd ${workspaceDir} && npm install\n`));
|
|
410
412
|
}
|
|
411
413
|
}
|
|
412
414
|
} catch (err) {
|
|
413
|
-
console.log(chalk.gray('⚠️ Workspace scripts migration atlandı:', err.message));
|
|
415
|
+
console.log(chalk.gray(L('⚠️ Workspace scripts migration atlandı:', '⚠️ Workspace scripts migration skipped:'), err.message));
|
|
414
416
|
}
|
|
415
417
|
|
|
416
418
|
// 2. Cron jobs migration
|
|
@@ -493,11 +495,11 @@ async function migrate(options) {
|
|
|
493
495
|
|
|
494
496
|
// Update report with actual added count
|
|
495
497
|
if (toAdd.length < naturecoCrons.length) {
|
|
496
|
-
console.log(chalk.yellow(`⚠️ ${naturecoCrons.length - toAdd.length} cron zaten mevcut,
|
|
498
|
+
console.log(chalk.yellow(`⚠️ ${naturecoCrons.length - toAdd.length} ${L('cron zaten mevcut, atlandı', 'crons already exist, skipped')}`));
|
|
497
499
|
}
|
|
498
500
|
}
|
|
499
501
|
} catch (err) {
|
|
500
|
-
console.log(chalk.gray('⚠️ Cron migration atlandı:', err.message));
|
|
502
|
+
console.log(chalk.gray(L('⚠️ Cron migration atlandı:', '⚠️ Cron migration skipped:'), err.message));
|
|
501
503
|
}
|
|
502
504
|
|
|
503
505
|
// 3. Telegram allowFrom migration
|
|
@@ -514,7 +516,7 @@ async function migrate(options) {
|
|
|
514
516
|
}
|
|
515
517
|
}
|
|
516
518
|
} catch (err) {
|
|
517
|
-
console.log(chalk.gray('⚠️ Telegram allowFrom migration atlandı:', err.message));
|
|
519
|
+
console.log(chalk.gray(L('⚠️ Telegram allowFrom migration atlandı:', '⚠️ Telegram allowFrom migration skipped:'), err.message));
|
|
518
520
|
}
|
|
519
521
|
|
|
520
522
|
// 4. WhatsApp session migration
|
|
@@ -534,7 +536,7 @@ async function migrate(options) {
|
|
|
534
536
|
report.whatsapp = true;
|
|
535
537
|
}
|
|
536
538
|
} catch (err) {
|
|
537
|
-
console.log(chalk.gray('⚠️ WhatsApp session migration atlandı:', err.message));
|
|
539
|
+
console.log(chalk.gray(L('⚠️ WhatsApp session migration atlandı:', '⚠️ WhatsApp session migration skipped:'), err.message));
|
|
538
540
|
}
|
|
539
541
|
|
|
540
542
|
// 5. Skills migration
|
|
@@ -560,16 +562,16 @@ async function migrate(options) {
|
|
|
560
562
|
}
|
|
561
563
|
|
|
562
564
|
if (report.skills > 0) {
|
|
563
|
-
console.log(chalk.green(`✅ Skills: ${report.skills} skill migrate edildi`));
|
|
564
|
-
console.log(chalk.gray(
|
|
565
|
+
console.log(chalk.green(`✅ Skills: ${report.skills} ${L('skill migrate edildi', 'skills migrated')}`));
|
|
566
|
+
console.log(chalk.gray(L(' Konum: ~/.natureco/skills/', ' Location: ~/.natureco/skills/')));
|
|
565
567
|
}
|
|
566
568
|
}
|
|
567
569
|
} catch (err) {
|
|
568
|
-
console.log(chalk.gray('⚠️ Skills migration atlandı:', err.message));
|
|
570
|
+
console.log(chalk.gray(L('⚠️ Skills migration atlandı:', '⚠️ Skills migration skipped:'), err.message));
|
|
569
571
|
}
|
|
570
572
|
|
|
571
573
|
// Print migration report
|
|
572
|
-
console.log(chalk.green('\n✅ Migration tamamlandı!\n'));
|
|
574
|
+
console.log(chalk.green(L('\n✅ Migration tamamlandı!\n', '\n✅ Migration complete!\n')));
|
|
573
575
|
|
|
574
576
|
if (report.memory) {
|
|
575
577
|
// Extract string facts for display (handle both string and object formats)
|
|
@@ -583,26 +585,26 @@ async function migrate(options) {
|
|
|
583
585
|
}
|
|
584
586
|
|
|
585
587
|
if (report.scripts > 0) {
|
|
586
|
-
console.log(chalk.green('✅ Scripts:'), chalk.white(`${report.scripts} script kopyalandı ve path'ler güncellendi`));
|
|
588
|
+
console.log(chalk.green('✅ Scripts:'), chalk.white(`${report.scripts} ${L("script kopyalandı ve path'ler güncellendi", 'scripts copied and paths updated')}`));
|
|
587
589
|
}
|
|
588
590
|
|
|
589
591
|
if (report.crons.total > 0) {
|
|
590
|
-
console.log(chalk.green('✅ Cron jobs:'), chalk.white(`${report.crons.total} job bulundu (${report.crons.active} aktif migrate edildi, ${report.crons.inactive} pasif atlandı)`));
|
|
592
|
+
console.log(chalk.green('✅ Cron jobs:'), chalk.white(`${report.crons.total} ${L('job bulundu', 'jobs found')} (${report.crons.active} ${L('aktif migrate edildi', 'active migrated')}, ${report.crons.inactive} ${L('pasif atlandı', 'inactive skipped')})`));
|
|
591
593
|
}
|
|
592
594
|
|
|
593
595
|
if (report.telegram && report.telegram.length > 0) {
|
|
594
596
|
console.log(chalk.green('✅ Telegram allowFrom:'), chalk.white(report.telegram.join(', ')));
|
|
595
597
|
} else if (report.telegram !== null) {
|
|
596
|
-
console.log(chalk.gray('⚠️ Telegram allowFrom: Bulunamadı'));
|
|
598
|
+
console.log(chalk.gray(L('⚠️ Telegram allowFrom: Bulunamadı', '⚠️ Telegram allowFrom: Not found')));
|
|
597
599
|
}
|
|
598
600
|
|
|
599
601
|
if (report.whatsapp) {
|
|
600
|
-
console.log(chalk.green('✅ WhatsApp session kopyalandı'));
|
|
602
|
+
console.log(chalk.green(L('✅ WhatsApp session kopyalandı', '✅ WhatsApp session copied')));
|
|
601
603
|
}
|
|
602
604
|
|
|
603
605
|
console.log('');
|
|
604
|
-
console.log(chalk.yellow('⚠️ Manuel kurulum gerekli:'));
|
|
605
|
-
console.log(chalk.gray(' - Provider URL ve API key ayarlayın:'));
|
|
606
|
+
console.log(chalk.yellow(L('⚠️ Manuel kurulum gerekli:', '⚠️ Manual setup required:')));
|
|
607
|
+
console.log(chalk.gray(L(' - Provider URL ve API key ayarlayın:', ' - Set Provider URL and API key:')));
|
|
606
608
|
console.log(chalk.cyan(' natureco config set providerUrl https://api.groq.com/openai/v1'));
|
|
607
609
|
console.log(chalk.cyan(' natureco config set providerApiKey gsk_xxx'));
|
|
608
610
|
console.log(chalk.cyan(' natureco config set providerModel llama-3.3-70b-versatile'));
|
|
@@ -633,18 +635,18 @@ function copyDirRecursive(src, dest) {
|
|
|
633
635
|
|
|
634
636
|
// ── Claude Code Migration ──────────────────────────────────────────────────────
|
|
635
637
|
async function migrateClaudeCode() {
|
|
636
|
-
console.log(chalk.yellow('\n⏳ Claude Code → NatureCo migration başlıyor...\n'));
|
|
638
|
+
console.log(chalk.yellow(L('\n⏳ Claude Code → NatureCo migration başlıyor...\n', '\n⏳ Claude Code → NatureCo migration starting...\n')));
|
|
637
639
|
|
|
638
640
|
const claudeDir = path.join(os.homedir(), '.claude');
|
|
639
641
|
const claudeSettings = path.join(claudeDir, 'settings.json');
|
|
640
642
|
const claudeProjects = path.join(os.homedir(), '.claude', 'projects');
|
|
641
643
|
|
|
642
644
|
if (!fs.existsSync(claudeSettings)) {
|
|
643
|
-
console.log(chalk.yellow('⚠ Claude Code settings bulunamadı: ~/.claude/settings.json\n'));
|
|
645
|
+
console.log(chalk.yellow(L('⚠ Claude Code settings bulunamadı: ~/.claude/settings.json\n', '⚠ Claude Code settings not found: ~/.claude/settings.json\n')));
|
|
644
646
|
} else {
|
|
645
647
|
try {
|
|
646
648
|
const settings = JSON.parse(fs.readFileSync(claudeSettings, 'utf-8'));
|
|
647
|
-
console.log(chalk.gray(' Claude Code ayarları bulundu.\n'));
|
|
649
|
+
console.log(chalk.gray(L(' Claude Code ayarları bulundu.\n', ' Claude Code settings found.\n')));
|
|
648
650
|
|
|
649
651
|
// Migrate allowed tools
|
|
650
652
|
if (settings.allowList?.length > 0) {
|
|
@@ -652,7 +654,7 @@ async function migrateClaudeCode() {
|
|
|
652
654
|
if (!config.policies) config.policies = {};
|
|
653
655
|
config.policies.claudeAllowedTools = settings.allowList;
|
|
654
656
|
setConfigValue('policies', config.policies);
|
|
655
|
-
console.log(chalk.green(` ✅ ${settings.allowList.length} izinli araç migrate edildi`));
|
|
657
|
+
console.log(chalk.green(` ✅ ${settings.allowList.length} ${L('izinli araç migrate edildi', 'allowed tools migrated')}`));
|
|
656
658
|
}
|
|
657
659
|
|
|
658
660
|
// Migrate permissions
|
|
@@ -660,10 +662,10 @@ async function migrateClaudeCode() {
|
|
|
660
662
|
const config = getConfig();
|
|
661
663
|
config.claudePermissions = settings.permissions;
|
|
662
664
|
setConfigValue('claudePermissions', settings.permissions);
|
|
663
|
-
console.log(chalk.green(' ✅ Claude izinleri migrate edildi'));
|
|
665
|
+
console.log(chalk.green(L(' ✅ Claude izinleri migrate edildi', ' ✅ Claude permissions migrated')));
|
|
664
666
|
}
|
|
665
667
|
} catch (err) {
|
|
666
|
-
console.log(chalk.red(` ❌ Claude settings okuma
|
|
668
|
+
console.log(chalk.red(` ❌ ${L('Claude settings okuma hatası', 'Claude settings read error')}: ${err.message}`));
|
|
667
669
|
}
|
|
668
670
|
}
|
|
669
671
|
|
|
@@ -676,7 +678,7 @@ async function migrateClaudeCode() {
|
|
|
676
678
|
});
|
|
677
679
|
|
|
678
680
|
if (projects.length > 0) {
|
|
679
|
-
console.log(chalk.gray(`\n Claude projeleri bulundu: ${projects.length}\n`));
|
|
681
|
+
console.log(chalk.gray(`\n ${L('Claude projeleri bulundu', 'Claude projects found')}: ${projects.length}\n`));
|
|
680
682
|
const projectsDir = path.join(os.homedir(), '.natureco', 'claude-projects');
|
|
681
683
|
fs.mkdirSync(projectsDir, { recursive: true });
|
|
682
684
|
|
|
@@ -685,14 +687,14 @@ async function migrateClaudeCode() {
|
|
|
685
687
|
const dst = path.join(projectsDir, project);
|
|
686
688
|
if (!fs.existsSync(dst)) {
|
|
687
689
|
fs.cpSync(src, dst, { recursive: true });
|
|
688
|
-
console.log(chalk.green(` ✅ Proje
|
|
690
|
+
console.log(chalk.green(` ✅ ${L('Proje kopyalandı', 'Project copied')}: ${project}`));
|
|
689
691
|
} else {
|
|
690
|
-
console.log(chalk.yellow(` ⚠ Proje zaten var,
|
|
692
|
+
console.log(chalk.yellow(` ⚠ ${L('Proje zaten var, atlandı', 'Project already exists, skipped')}: ${project}`));
|
|
691
693
|
}
|
|
692
694
|
}
|
|
693
695
|
}
|
|
694
696
|
} catch (err) {
|
|
695
|
-
console.log(chalk.yellow(` ⚠ Proje migrasyonu
|
|
697
|
+
console.log(chalk.yellow(` ⚠ ${L('Proje migrasyonu atlandı', 'Project migration skipped')}: ${err.message}`));
|
|
696
698
|
}
|
|
697
699
|
}
|
|
698
700
|
|
|
@@ -722,25 +724,25 @@ async function migrateClaudeCode() {
|
|
|
722
724
|
const memoryDir = path.join(os.homedir(), '.natureco', 'memory');
|
|
723
725
|
fs.mkdirSync(memoryDir, { recursive: true });
|
|
724
726
|
fs.writeFileSync(path.join(memoryDir, 'universal-provider.json'), JSON.stringify(memory, null, 2));
|
|
725
|
-
console.log(chalk.green(' ✅ Claude MEMORY.md migrate edildi'));
|
|
727
|
+
console.log(chalk.green(L(' ✅ Claude MEMORY.md migrate edildi', ' ✅ Claude MEMORY.md migrated')));
|
|
726
728
|
} catch (err) {
|
|
727
|
-
console.log(chalk.yellow(` ⚠ Memory migrasyonu
|
|
729
|
+
console.log(chalk.yellow(` ⚠ ${L('Memory migrasyonu atlandı', 'Memory migration skipped')}: ${err.message}`));
|
|
728
730
|
}
|
|
729
731
|
}
|
|
730
732
|
|
|
731
|
-
console.log(chalk.green('\n✅ Claude Code migration tamamlandı!\n'));
|
|
733
|
+
console.log(chalk.green(L('\n✅ Claude Code migration tamamlandı!\n', '\n✅ Claude Code migration complete!\n')));
|
|
732
734
|
}
|
|
733
735
|
|
|
734
736
|
// ── Hermes Migration ──────────────────────────────────────────────────────────
|
|
735
737
|
async function migrateHermes() {
|
|
736
|
-
console.log(chalk.yellow('\n⏳ Hermes → NatureCo migration başlıyor...\n'));
|
|
738
|
+
console.log(chalk.yellow(L('\n⏳ Hermes → NatureCo migration başlıyor...\n', '\n⏳ Hermes → NatureCo migration starting...\n')));
|
|
737
739
|
|
|
738
740
|
const hermesDir = path.join(os.homedir(), '.hermes');
|
|
739
741
|
const hermesConfig = path.join(hermesDir, 'config.json');
|
|
740
742
|
const hermesSessions = path.join(hermesDir, 'sessions');
|
|
741
743
|
|
|
742
744
|
if (!fs.existsSync(hermesDir)) {
|
|
743
|
-
console.log(chalk.yellow('⚠ Hermes dizini bulunamadı: ~/.hermes\n'));
|
|
745
|
+
console.log(chalk.yellow(L('⚠ Hermes dizini bulunamadı: ~/.hermes\n', '⚠ Hermes directory not found: ~/.hermes\n')));
|
|
744
746
|
return;
|
|
745
747
|
}
|
|
746
748
|
|
|
@@ -765,9 +767,9 @@ async function migrateHermes() {
|
|
|
765
767
|
if (config.temperature !== undefined) setConfigValue('temperature', ncConfig.temperature);
|
|
766
768
|
|
|
767
769
|
migrated.config = true;
|
|
768
|
-
console.log(chalk.green(' ✅ Hermes config migrate edildi'));
|
|
770
|
+
console.log(chalk.green(L(' ✅ Hermes config migrate edildi', ' ✅ Hermes config migrated')));
|
|
769
771
|
} catch (err) {
|
|
770
|
-
console.log(chalk.red(` ❌ Config okuma
|
|
772
|
+
console.log(chalk.red(` ❌ ${L('Config okuma hatası', 'Config read error')}: ${err.message}`));
|
|
771
773
|
}
|
|
772
774
|
}
|
|
773
775
|
|
|
@@ -788,10 +790,10 @@ async function migrateHermes() {
|
|
|
788
790
|
}
|
|
789
791
|
|
|
790
792
|
if (migrated.sessions > 0) {
|
|
791
|
-
console.log(chalk.green(` ✅ ${migrated.sessions} Hermes oturumu migrate edildi`));
|
|
793
|
+
console.log(chalk.green(` ✅ ${migrated.sessions} ${L('Hermes oturumu migrate edildi', 'Hermes sessions migrated')}`));
|
|
792
794
|
}
|
|
793
795
|
} catch (err) {
|
|
794
|
-
console.log(chalk.yellow(` ⚠ Session migrasyonu
|
|
796
|
+
console.log(chalk.yellow(` ⚠ ${L('Session migrasyonu atlandı', 'Session migration skipped')}: ${err.message}`));
|
|
795
797
|
}
|
|
796
798
|
}
|
|
797
799
|
|
|
@@ -820,18 +822,18 @@ async function migrateHermes() {
|
|
|
820
822
|
|
|
821
823
|
fs.writeFileSync(path.join(ncMemoryDir, 'hermes-migrated.json'), JSON.stringify(ncMem, null, 2));
|
|
822
824
|
migrated.memory = true;
|
|
823
|
-
console.log(chalk.green(' ✅ Hermes hafızası migrate edildi'));
|
|
825
|
+
console.log(chalk.green(L(' ✅ Hermes hafızası migrate edildi', ' ✅ Hermes memory migrated')));
|
|
824
826
|
} catch (err) {
|
|
825
|
-
console.log(chalk.yellow(` ⚠ Memory migrasyonu
|
|
827
|
+
console.log(chalk.yellow(` ⚠ ${L('Memory migrasyonu atlandı', 'Memory migration skipped')}: ${err.message}`));
|
|
826
828
|
}
|
|
827
829
|
}
|
|
828
830
|
|
|
829
831
|
if (!migrated.config && migrated.sessions === 0 && !migrated.memory) {
|
|
830
|
-
console.log(chalk.yellow(' ⚠ Hiçbir veri migrate edilemedi.\n'));
|
|
832
|
+
console.log(chalk.yellow(L(' ⚠ Hiçbir veri migrate edilemedi.\n', ' ⚠ No data could be migrated.\n')));
|
|
831
833
|
return;
|
|
832
834
|
}
|
|
833
835
|
|
|
834
|
-
console.log(chalk.green('\n✅ Hermes migration tamamlandı!\n'));
|
|
836
|
+
console.log(chalk.green(L('\n✅ Hermes migration tamamlandı!\n', '\n✅ Hermes migration complete!\n')));
|
|
835
837
|
}
|
|
836
838
|
|
|
837
839
|
module.exports = migrate;
|
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
const chalk = require('chalk');
|
|
15
|
+
const { getLang: _gl } = require('../utils/i18n');
|
|
16
|
+
const L = (tr, en) => (_gl() === 'en' ? en : tr);
|
|
15
17
|
const https = require('https');
|
|
16
18
|
const { URL } = require('url');
|
|
17
19
|
const audit = require('../utils/audit');
|
|
@@ -72,26 +74,26 @@ async function apiCall(path, options = {}) {
|
|
|
72
74
|
async function cmdPost(args) {
|
|
73
75
|
const text = args.join(' ').trim();
|
|
74
76
|
if (!text) {
|
|
75
|
-
console.log(chalk.red('\n Kullanım: natureco naturehub post "<mesaj>"\n'));
|
|
77
|
+
console.log(chalk.red(L('\n Kullanım: natureco naturehub post "<mesaj>"\n', '\n Usage: natureco naturehub post "<message>"\n')));
|
|
76
78
|
return;
|
|
77
79
|
}
|
|
78
80
|
|
|
79
81
|
const token = getApiKey();
|
|
80
82
|
if (!token) {
|
|
81
|
-
console.log(chalk.yellow('\n ⚠️ API key tanımlı değil. Önce `natureco login` ile giriş yapın.\n'));
|
|
83
|
+
console.log(chalk.yellow(L('\n ⚠️ API key tanımlı değil. Önce `natureco login` ile giriş yapın.\n', '\n ⚠️ API key not set. Log in first with `natureco login`.\n')));
|
|
82
84
|
saveLocal(text);
|
|
83
85
|
return;
|
|
84
86
|
}
|
|
85
87
|
|
|
86
88
|
const botId = getBotId();
|
|
87
89
|
if (!botId) {
|
|
88
|
-
console.log(chalk.yellow('\n ⚠️ Bot ID tanımlı değil. `natureco naturehub list` ile botlarınızı görün.\n'));
|
|
89
|
-
console.log(chalk.gray(' Ayarlamak için: natureco config set naturecoBotId <bot_id>\n'));
|
|
90
|
+
console.log(chalk.yellow(L('\n ⚠️ Bot ID tanımlı değil. `natureco naturehub list` ile botlarınızı görün.\n', '\n ⚠️ Bot ID not set. See your bots with `natureco naturehub list`.\n')));
|
|
91
|
+
console.log(chalk.gray(L(' Ayarlamak için: natureco config set naturecoBotId <bot_id>\n', ' To set: natureco config set naturecoBotId <bot_id>\n')));
|
|
90
92
|
saveLocal(text);
|
|
91
93
|
return;
|
|
92
94
|
}
|
|
93
95
|
|
|
94
|
-
console.log(chalk.cyan(`\n 📤 Bota mesaj gönderiliyor (${botId})...\n`));
|
|
96
|
+
console.log(chalk.cyan(`\n 📤 ${L('Bota mesaj gönderiliyor', 'Sending message to bot')} (${botId})...\n`));
|
|
95
97
|
console.log(chalk.gray(` "${text.slice(0, 200)}"\n`));
|
|
96
98
|
|
|
97
99
|
try {
|
|
@@ -100,11 +102,11 @@ async function cmdPost(args) {
|
|
|
100
102
|
token,
|
|
101
103
|
body: { message: text, user_id: 'cli' },
|
|
102
104
|
});
|
|
103
|
-
console.log(chalk.green(' ✓ Gönderildi!\n'));
|
|
105
|
+
console.log(chalk.green(L(' ✓ Gönderildi!\n', ' ✓ Sent!\n')));
|
|
104
106
|
if (result.reply) console.log(chalk.cyan(` 💬 Bot: ${result.reply}\n`));
|
|
105
107
|
audit.log(audit.ACTIONS.INFO, { source: 'naturehub', action: 'post', botId });
|
|
106
108
|
} catch (e) {
|
|
107
|
-
console.log(chalk.red(` ✗ Hata: ${e.message}\n`));
|
|
109
|
+
console.log(chalk.red(` ✗ ${L('Hata', 'Error')}: ${e.message}\n`));
|
|
108
110
|
saveLocal(text);
|
|
109
111
|
}
|
|
110
112
|
}
|
|
@@ -117,23 +119,23 @@ function saveLocal(text) {
|
|
|
117
119
|
const dir = path.dirname(file);
|
|
118
120
|
if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
|
|
119
121
|
fs.appendFileSync(file, JSON.stringify({ ts: new Date().toISOString(), text }) + '\n');
|
|
120
|
-
console.log(chalk.gray(` Kayıt: ${file}\n`));
|
|
122
|
+
console.log(chalk.gray(` ${L('Kayıt', 'Saved')}: ${file}\n`));
|
|
121
123
|
}
|
|
122
124
|
|
|
123
125
|
async function cmdList() {
|
|
124
126
|
const token = getApiKey();
|
|
125
127
|
if (!token) {
|
|
126
|
-
console.log(chalk.yellow('\n ⚠️ API key tanımlı değil.\n'));
|
|
128
|
+
console.log(chalk.yellow(L('\n ⚠️ API key tanımlı değil.\n', '\n ⚠️ API key not set.\n')));
|
|
127
129
|
return;
|
|
128
130
|
}
|
|
129
131
|
|
|
130
|
-
console.log(chalk.cyan('\n 🤖 Botlarınız\n'));
|
|
132
|
+
console.log(chalk.cyan(L('\n 🤖 Botlarınız\n', '\n 🤖 Your Bots\n')));
|
|
131
133
|
|
|
132
134
|
try {
|
|
133
135
|
const result = await apiCall('/bots', { method: 'GET', token });
|
|
134
136
|
const bots = Array.isArray(result) ? result : (result.bots || result.data || []);
|
|
135
137
|
if (bots.length === 0) {
|
|
136
|
-
console.log(chalk.gray(' Henüz botunuz yok.\n'));
|
|
138
|
+
console.log(chalk.gray(L(' Henüz botunuz yok.\n', ' You have no bots yet.\n')));
|
|
137
139
|
return;
|
|
138
140
|
}
|
|
139
141
|
for (const b of bots) {
|
|
@@ -141,22 +143,22 @@ async function cmdList() {
|
|
|
141
143
|
if (b.description) console.log(` ${chalk.gray(b.description)}`);
|
|
142
144
|
console.log('');
|
|
143
145
|
}
|
|
144
|
-
console.log(chalk.gray(' Bot ID ayarlamak için: natureco config set naturecoBotId <id>\n'));
|
|
146
|
+
console.log(chalk.gray(L(' Bot ID ayarlamak için: natureco config set naturecoBotId <id>\n', ' To set Bot ID: natureco config set naturecoBotId <id>\n')));
|
|
145
147
|
} catch (e) {
|
|
146
|
-
console.log(chalk.red(` ✗ Hata: ${e.message}\n`));
|
|
148
|
+
console.log(chalk.red(` ✗ ${L('Hata', 'Error')}: ${e.message}\n`));
|
|
147
149
|
}
|
|
148
150
|
}
|
|
149
151
|
|
|
150
152
|
async function cmdInfo(botId) {
|
|
151
153
|
const token = getApiKey();
|
|
152
154
|
if (!token) {
|
|
153
|
-
console.log(chalk.yellow('\n ⚠️ API key tanımlı değil.\n'));
|
|
155
|
+
console.log(chalk.yellow(L('\n ⚠️ API key tanımlı değil.\n', '\n ⚠️ API key not set.\n')));
|
|
154
156
|
return;
|
|
155
157
|
}
|
|
156
158
|
|
|
157
159
|
const id = botId || getBotId();
|
|
158
160
|
if (!id) {
|
|
159
|
-
console.log(chalk.yellow('\n Bot ID gerekli: natureco naturehub info <bot_id>\n'));
|
|
161
|
+
console.log(chalk.yellow(L('\n Bot ID gerekli: natureco naturehub info <bot_id>\n', '\n Bot ID required: natureco naturehub info <bot_id>\n')));
|
|
160
162
|
return;
|
|
161
163
|
}
|
|
162
164
|
|
|
@@ -164,35 +166,35 @@ async function cmdInfo(botId) {
|
|
|
164
166
|
try {
|
|
165
167
|
const result = await apiCall(`/bots/${id}`, { method: 'GET', token });
|
|
166
168
|
console.log(` ${chalk.bold('ID:')} ${result.id}`);
|
|
167
|
-
console.log(` ${chalk.bold('İsim:')} ${result.name || '-'}`);
|
|
168
|
-
console.log(` ${chalk.bold('Açıklama:')} ${result.description || '-'}`);
|
|
169
|
-
console.log(` ${chalk.bold('Durum:')} ${result.status || 'active'}`);
|
|
169
|
+
console.log(` ${chalk.bold(L('İsim:', 'Name:'))} ${result.name || '-'}`);
|
|
170
|
+
console.log(` ${chalk.bold(L('Açıklama:', 'Description:'))} ${result.description || '-'}`);
|
|
171
|
+
console.log(` ${chalk.bold(L('Durum:', 'Status:'))} ${result.status || 'active'}`);
|
|
170
172
|
console.log('');
|
|
171
173
|
} catch (e) {
|
|
172
|
-
console.log(chalk.red(` ✗ Hata: ${e.message}\n`));
|
|
174
|
+
console.log(chalk.red(` ✗ ${L('Hata', 'Error')}: ${e.message}\n`));
|
|
173
175
|
}
|
|
174
176
|
}
|
|
175
177
|
|
|
176
178
|
async function cmdConfig() {
|
|
177
179
|
const { getConfig } = require('../utils/config');
|
|
178
180
|
const cfg = getConfig();
|
|
179
|
-
console.log(chalk.cyan('\n ⚙️ NatureCo API Ayarları\n'));
|
|
180
|
-
console.log(chalk.gray(' API Key: ') + (cfg.apiKey ? chalk.green('✓ ayarlı') : chalk.yellow('yok')));
|
|
181
|
-
console.log(chalk.gray(' Bot ID: ') + (cfg.naturecoBotId ? chalk.green(cfg.naturecoBotId) : chalk.yellow('ayarlanmamış')));
|
|
182
|
-
console.log(chalk.gray('\n Giriş: ') + chalk.cyan('natureco login'));
|
|
181
|
+
console.log(chalk.cyan(L('\n ⚙️ NatureCo API Ayarları\n', '\n ⚙️ NatureCo API Settings\n')));
|
|
182
|
+
console.log(chalk.gray(' API Key: ') + (cfg.apiKey ? chalk.green(L('✓ ayarlı', '✓ set')) : chalk.yellow(L('yok', 'none'))));
|
|
183
|
+
console.log(chalk.gray(' Bot ID: ') + (cfg.naturecoBotId ? chalk.green(cfg.naturecoBotId) : chalk.yellow(L('ayarlanmamış', 'not set'))));
|
|
184
|
+
console.log(chalk.gray(L('\n Giriş: ', '\n Login: ')) + chalk.cyan('natureco login'));
|
|
183
185
|
console.log(chalk.gray(' Bot ID: ') + chalk.cyan('natureco config set naturecoBotId <id>'));
|
|
184
|
-
console.log(chalk.gray(' Botlar: ') + chalk.cyan('natureco naturehub list'));
|
|
186
|
+
console.log(chalk.gray(L(' Botlar: ', ' Bots: ')) + chalk.cyan('natureco naturehub list'));
|
|
185
187
|
console.log('');
|
|
186
188
|
}
|
|
187
189
|
|
|
188
190
|
async function naturehub(args) {
|
|
189
191
|
const [action, ...params] = args || [];
|
|
190
192
|
if (!action || action === 'help') {
|
|
191
|
-
console.log(chalk.yellow('\n Kullanım:'));
|
|
192
|
-
console.log(chalk.gray(' natureco naturehub post "<mesaj>" Bota mesaj gönder'));
|
|
193
|
-
console.log(chalk.gray(' natureco naturehub list Botları listele'));
|
|
194
|
-
console.log(chalk.gray(' natureco naturehub info [bot_id] Bot detayı'));
|
|
195
|
-
console.log(chalk.gray(' natureco naturehub config Ayarlar'));
|
|
193
|
+
console.log(chalk.yellow(L('\n Kullanım:', '\n Usage:')));
|
|
194
|
+
console.log(chalk.gray(L(' natureco naturehub post "<mesaj>" Bota mesaj gönder', ' natureco naturehub post "<message>" Send message to bot')));
|
|
195
|
+
console.log(chalk.gray(L(' natureco naturehub list Botları listele', ' natureco naturehub list List bots')));
|
|
196
|
+
console.log(chalk.gray(L(' natureco naturehub info [bot_id] Bot detayı', ' natureco naturehub info [bot_id] Bot details')));
|
|
197
|
+
console.log(chalk.gray(L(' natureco naturehub config Ayarlar', ' natureco naturehub config Settings')));
|
|
196
198
|
console.log('');
|
|
197
199
|
return;
|
|
198
200
|
}
|
|
@@ -200,7 +202,7 @@ async function naturehub(args) {
|
|
|
200
202
|
if (action === 'list') return cmdList();
|
|
201
203
|
if (action === 'info') return cmdInfo(params[0]);
|
|
202
204
|
if (action === 'config') return cmdConfig();
|
|
203
|
-
console.log(chalk.red(`\n Bilinmeyen action: ${action}\n`));
|
|
205
|
+
console.log(chalk.red(`\n ${L('Bilinmeyen action', 'Unknown action')}: ${action}\n`));
|
|
204
206
|
}
|
|
205
207
|
|
|
206
208
|
module.exports = naturehub;
|