natureco-cli 2.23.28 → 2.23.30

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 (96) hide show
  1. package/README.md +94 -11
  2. package/bin/natureco.js +470 -10
  3. package/package.json +10 -6
  4. package/src/commands/admin-rpc.js +219 -0
  5. package/src/commands/agent.js +89 -0
  6. package/src/commands/approvals.js +53 -0
  7. package/src/commands/backup.js +124 -0
  8. package/src/commands/bonjour.js +167 -0
  9. package/src/commands/capability.js +64 -0
  10. package/src/commands/channels.js +94 -4
  11. package/src/commands/chat.js +11 -25
  12. package/src/commands/clickclack.js +130 -0
  13. package/src/commands/commitments.js +32 -0
  14. package/src/commands/completion.js +76 -0
  15. package/src/commands/config.js +111 -68
  16. package/src/commands/configure.js +93 -0
  17. package/src/commands/crestodian.js +92 -0
  18. package/src/commands/daemon.js +60 -0
  19. package/src/commands/device-pair.js +248 -0
  20. package/src/commands/devices.js +110 -0
  21. package/src/commands/directory.js +47 -0
  22. package/src/commands/dns.js +58 -0
  23. package/src/commands/docs.js +43 -0
  24. package/src/commands/doctor.js +121 -16
  25. package/src/commands/exec-policy.js +71 -0
  26. package/src/commands/gateway-server.js +1175 -30
  27. package/src/commands/gateway.js +11 -20
  28. package/src/commands/health.js +18 -0
  29. package/src/commands/help.js +6 -0
  30. package/src/commands/imessage.js +169 -0
  31. package/src/commands/infer.js +73 -0
  32. package/src/commands/irc.js +119 -0
  33. package/src/commands/mattermost.js +164 -0
  34. package/src/commands/memory-cmd.js +134 -1
  35. package/src/commands/message.js +30 -4
  36. package/src/commands/migrate.js +213 -2
  37. package/src/commands/models.js +584 -216
  38. package/src/commands/node.js +98 -0
  39. package/src/commands/nodes.js +106 -0
  40. package/src/commands/oc-path.js +200 -0
  41. package/src/commands/onboard.js +70 -0
  42. package/src/commands/open-prose.js +67 -0
  43. package/src/commands/plugins.js +415 -172
  44. package/src/commands/policy.js +176 -0
  45. package/src/commands/proxy.js +155 -0
  46. package/src/commands/qr.js +28 -0
  47. package/src/commands/sandbox.js +125 -0
  48. package/src/commands/secrets.js +118 -0
  49. package/src/commands/security.js +149 -1
  50. package/src/commands/setup.js +114 -10
  51. package/src/commands/signal.js +495 -0
  52. package/src/commands/skills.js +20 -29
  53. package/src/commands/sms.js +168 -0
  54. package/src/commands/system.js +53 -0
  55. package/src/commands/tasks.js +328 -79
  56. package/src/commands/terminal.js +21 -0
  57. package/src/commands/thread-ownership.js +157 -0
  58. package/src/commands/transcripts.js +72 -0
  59. package/src/commands/voice.js +82 -0
  60. package/src/commands/vydra.js +98 -0
  61. package/src/commands/webhooks.js +79 -0
  62. package/src/commands/whatsapp.js +7 -21
  63. package/src/commands/workboard.js +207 -0
  64. package/src/tools/audio_understanding.js +154 -0
  65. package/src/tools/bash.js +63 -29
  66. package/src/tools/browser.js +112 -0
  67. package/src/tools/canvas.js +104 -0
  68. package/src/tools/document_extract.js +84 -0
  69. package/src/tools/duckduckgo.js +54 -0
  70. package/src/tools/exa_search.js +66 -0
  71. package/src/tools/firecrawl.js +104 -0
  72. package/src/tools/image_generation.js +99 -0
  73. package/src/tools/llm_task.js +118 -0
  74. package/src/tools/media_understanding.js +128 -0
  75. package/src/tools/music_generation.js +113 -0
  76. package/src/tools/parallel_search.js +77 -0
  77. package/src/tools/phone_control.js +80 -0
  78. package/src/tools/phone_control_enhanced.js +184 -0
  79. package/src/tools/searxng.js +61 -0
  80. package/src/tools/speech_to_text.js +135 -0
  81. package/src/tools/text_to_speech.js +105 -0
  82. package/src/tools/thread_ownership.js +88 -0
  83. package/src/tools/video_generation.js +72 -0
  84. package/src/tools/web_readability.js +104 -0
  85. package/src/utils/api.js +3 -20
  86. package/src/utils/approvals.js +297 -0
  87. package/src/utils/background.js +223 -66
  88. package/src/utils/baileys.js +21 -0
  89. package/src/utils/config.js +141 -10
  90. package/src/utils/errors.js +148 -0
  91. package/src/utils/inquirer-wrapper.js +1 -2
  92. package/src/utils/memory.js +200 -0
  93. package/src/utils/path-utils.js +13 -13
  94. package/src/utils/plugin-registry.js +238 -0
  95. package/src/utils/secrets.js +177 -0
  96. package/src/utils/skills.js +10 -23
@@ -16,9 +16,17 @@ async function memoryCmd(args) {
16
16
  if (action === 'show') return showMemory(params[0]);
17
17
  if (action === 'clear') return clearMemoryCmd(params[0]);
18
18
  if (action === 'index') return indexMemory();
19
+ if (action === 'export') return exportMemoryCmd(params[0], params[1]);
20
+ if (action === 'import') return importMemoryCmd(params[0], params[1]);
21
+ if (action === 'semantic') return semanticSearchCmd(params.join(' '));
22
+ // Wiki pages
23
+ if (action === 'wiki') return wikiCmd(params[0], params.slice(1));
24
+ if (action === 'wiki-create') return wikiCreateCmd(params[0], params.slice(1).join(' '));
25
+ if (action === 'wiki-list') return wikiListCmd();
26
+ if (action === 'wiki-search') return wikiSearchCmd(params.join(' '));
19
27
 
20
28
  console.log(chalk.red(`\n ❌ Bilinmeyen komut: ${action}\n`));
21
- console.log(chalk.gray(' Kullanım: natureco memory [status|list|search|show|clear|index]\n'));
29
+ console.log(chalk.gray(' Kullanım: natureco memory [status|list|search|show|clear|index|export|import|semantic|wiki|wiki-create|wiki-list|wiki-search]\n'));
22
30
  process.exit(1);
23
31
  }
24
32
 
@@ -202,4 +210,129 @@ function indexMemory() {
202
210
  console.log(chalk.green(`\n ✓ ${indexed} hafıza dosyası yeniden indexlendi\n`));
203
211
  }
204
212
 
213
+ // ── Export Memory ──────────────────────────────────────────────────────────────
214
+ function exportMemoryCmd(botId, outputFile) {
215
+ const id = botId || 'universal-provider';
216
+ const mem = exportMemory(id);
217
+ const filePath = outputFile || path.join(process.cwd(), `memory-${id}.json`);
218
+ fs.writeFileSync(filePath, JSON.stringify(mem, null, 2));
219
+ console.log(chalk.green(`\n ✓ Hafıza dışa aktarıldı: ${filePath}\n`));
220
+ }
221
+
222
+ // ── Import Memory ──────────────────────────────────────────────────────────────
223
+ function importMemoryCmd(botId, sourceFile) {
224
+ if (!sourceFile) {
225
+ console.log(chalk.red('\n ❌ Kaynak dosya gerekli\n'));
226
+ console.log(chalk.gray(' Kullanım: natureco memory import <botId> <dosya.json>\n'));
227
+ return;
228
+ }
229
+ const resolvedPath = path.resolve(sourceFile.replace(/^~/, os.homedir()));
230
+ if (!fs.existsSync(resolvedPath)) {
231
+ console.log(chalk.red(`\n ❌ Dosya bulunamadı: ${resolvedPath}\n`));
232
+ return;
233
+ }
234
+ try {
235
+ const data = JSON.parse(fs.readFileSync(resolvedPath, 'utf-8'));
236
+ importMemory(botId || 'universal-provider', data);
237
+ console.log(chalk.green(`\n ✓ Hafıza içe aktarıldı: ${botId || 'universal-provider'}\n`));
238
+ } catch (err) {
239
+ console.log(chalk.red(`\n ❌ Hata: ${err.message}\n`));
240
+ }
241
+ }
242
+
243
+ // ── Semantic Search ────────────────────────────────────────────────────────────
244
+ function semanticSearchCmd(query) {
245
+ if (!query) {
246
+ console.log(chalk.red('\n ❌ Arama sorgusu gerekli\n'));
247
+ return;
248
+ }
249
+ const results = semanticSearchMemory(query, 10);
250
+ console.log(chalk.cyan.bold(`\n Semantic: "${query}" → ${results.length} sonuç\n`));
251
+ if (results.length === 0) {
252
+ console.log(chalk.gray(' Sonuç bulunamadı.\n'));
253
+ return;
254
+ }
255
+ results.forEach((r, i) => {
256
+ const pct = Math.round(r.score * 100);
257
+ const bar = chalk.green('█'.repeat(Math.floor(pct / 10))) + chalk.gray('░'.repeat(10 - Math.floor(pct / 10)));
258
+ console.log(` ${chalk.white(`${i + 1}.`)} ${bar} ${chalk.white(r.value.slice(0, 70))}`);
259
+ console.log(chalk.gray(` [${r.bot}] alaka: %${pct}`));
260
+ });
261
+ console.log('');
262
+ }
263
+
264
+ // ── Wiki Commands ──────────────────────────────────────────────────────────────
265
+ function wikiCmd(action, params) {
266
+ if (!action || action === 'list') return wikiListCmd();
267
+ if (action === 'show') {
268
+ const slug = params?.[0];
269
+ if (!slug) { console.log(chalk.red('\n ❌ Sayfa adı gerekli\n')); return; }
270
+ const page = getWikiPage(slug);
271
+ if (!page) { console.log(chalk.yellow(`\n ⚠ Sayfa bulunamadı: ${slug}\n`)); return; }
272
+ console.log(chalk.cyan.bold(`\n Wiki: ${page.slug}\n`));
273
+ console.log(chalk.white(page.content));
274
+ console.log(chalk.gray(`\n Son güncelleme: ${page.updatedAt}\n`));
275
+ return;
276
+ }
277
+ if (action === 'create' || action === 'edit') {
278
+ const slug = params?.[0];
279
+ const content = params?.slice(1).join(' ');
280
+ if (!slug || !content) {
281
+ console.log(chalk.red('\n ❌ Kullanım: natureco memory wiki create <slug> <içerik>\n'));
282
+ return;
283
+ }
284
+ saveWikiPage(slug, content);
285
+ console.log(chalk.green(`\n ✓ Wiki sayfası kaydedildi: ${slug}\n`));
286
+ return;
287
+ }
288
+ if (action === 'search') {
289
+ const query = params?.join(' ');
290
+ if (!query) { console.log(chalk.red('\n ❌ Arama sorgusu gerekli\n')); return; }
291
+ const results = searchWikiPages(query);
292
+ console.log(chalk.cyan.bold(`\n Wiki: "${query}" → ${results.length} sonuç\n`));
293
+ if (results.length === 0) { console.log(chalk.gray(' Sonuç bulunamadı.\n')); return; }
294
+ results.forEach(p => {
295
+ console.log(` ${chalk.white(p.slug)} ${chalk.gray('—')} ${chalk.gray((p.content || '').slice(0, 60))}`);
296
+ });
297
+ console.log('');
298
+ return;
299
+ }
300
+ console.log(chalk.red(`\n ❌ Bilinmeyen wiki aksiyonu: ${action}\n`));
301
+ }
302
+
303
+ function wikiCreateCmd(slug, content) {
304
+ if (!slug || !content) {
305
+ console.log(chalk.red('\n ❌ Kullanım: natureco memory wiki-create <slug> <içerik>\n'));
306
+ return;
307
+ }
308
+ saveWikiPage(slug, content);
309
+ console.log(chalk.green(`\n ✓ Wiki sayfası oluşturuldu: ${slug}\n`));
310
+ }
311
+
312
+ function wikiListCmd() {
313
+ const pages = listWikiPages();
314
+ console.log(chalk.cyan.bold(`\n Wiki Sayfaları (${pages.length})\n`));
315
+ if (pages.length === 0) {
316
+ console.log(chalk.gray(' Henüz sayfa yok.\n'));
317
+ console.log(chalk.gray(' Oluşturmak: ') + chalk.cyan('natureco memory wiki create <slug> <içerik>\n'));
318
+ return;
319
+ }
320
+ pages.forEach(p => {
321
+ const preview = (p.content || '').slice(0, 60).replace(/\n/g, ' ');
322
+ console.log(` ${chalk.white(p.slug)} ${chalk.gray('—')} ${chalk.gray(preview)}`);
323
+ console.log(chalk.gray(` ${p.updatedAt}\n`));
324
+ });
325
+ }
326
+
327
+ function wikiSearchCmd(query) {
328
+ if (!query) { console.log(chalk.red('\n ❌ Arama sorgusu gerekli\n')); return; }
329
+ const results = searchWikiPages(query);
330
+ console.log(chalk.cyan.bold(`\n Wiki Ara: "${query}" → ${results.length} sonuç\n`));
331
+ if (results.length === 0) { console.log(chalk.gray(' Sonuç bulunamadı.\n')); return; }
332
+ results.forEach(p => {
333
+ console.log(` ${chalk.white(p.slug)}`);
334
+ console.log(chalk.gray(` ${(p.content || '').slice(0, 80)}\n`));
335
+ });
336
+ }
337
+
205
338
  module.exports = memoryCmd;
@@ -3,6 +3,7 @@ const fs = require('fs');
3
3
  const path = require('path');
4
4
  const os = require('os');
5
5
  const { getConfig } = require('../utils/config');
6
+ const { ApiError } = require('../utils/errors');
6
7
 
7
8
  const PID_FILE = path.join(os.homedir(), '.natureco', 'gateway.pid');
8
9
  const GATEWAY_HTTP_URL = 'http://127.0.0.1:3847/send';
@@ -32,8 +33,8 @@ async function message(args) {
32
33
  process.exit(1);
33
34
  }
34
35
 
35
- if (!['whatsapp', 'telegram'].includes(channel)) {
36
- console.log(chalk.red('\n❌ Geçersiz kanal. Sadece "whatsapp" veya "telegram" kullanılabilir\n'));
36
+ if (!['whatsapp', 'telegram', 'signal', 'irc', 'sms', 'mattermost'].includes(channel)) {
37
+ console.log(chalk.red('\n❌ Geçersiz kanal. Kullanılabilir: whatsapp, telegram, signal, irc, sms, mattermost\n'));
37
38
  process.exit(1);
38
39
  }
39
40
 
@@ -68,12 +69,37 @@ async function message(args) {
68
69
  process.exit(1);
69
70
  }
70
71
 
72
+ if (channel === 'signal' && !config.signalBotId) {
73
+ console.log(chalk.red('\n❌ Signal bağlı değil\n'));
74
+ console.log(chalk.yellow('Önce Signal\'ı bağlayın:'), chalk.cyan('natureco signal connect\n'));
75
+ process.exit(1);
76
+ }
77
+
78
+ if (channel === 'irc' && !config.ircBotId) {
79
+ console.log(chalk.red('\n❌ IRC bağlı değil\n'));
80
+ console.log(chalk.yellow('Önce IRC\'yi bağlayın:'), chalk.cyan('natureco irc connect\n'));
81
+ process.exit(1);
82
+ }
83
+
84
+ if (channel === 'sms' && !config.smsBotId) {
85
+ console.log(chalk.red('\n❌ SMS bağlı değil\n'));
86
+ console.log(chalk.yellow('Önce SMS\'i bağlayın:'), chalk.cyan('natureco sms connect\n'));
87
+ process.exit(1);
88
+ }
89
+
90
+ if (channel === 'mattermost' && (!config.mattermostBotId || !config.mattermostToken)) {
91
+ console.log(chalk.red('\n❌ Mattermost bağlı değil\n'));
92
+ console.log(chalk.yellow('Önce Mattermost\'u bağlayın:'), chalk.cyan('natureco mattermost connect\n'));
93
+ process.exit(1);
94
+ }
95
+
71
96
  // Send message via HTTP endpoint
72
97
  await sendMessageViaHttp(channel, target, messageText);
73
98
  }
74
99
 
75
100
  async function sendMessageViaHttp(channel, target, messageText) {
76
- console.log(chalk.yellow(`\n⏳ ${channel === 'whatsapp' ? 'WhatsApp' : 'Telegram'} mesajı gönderiliyor...\n`));
101
+ const channelNames = { whatsapp: 'WhatsApp', telegram: 'Telegram', signal: 'Signal', irc: 'IRC', sms: 'SMS', mattermost: 'Mattermost' };
102
+ console.log(chalk.yellow(`\n⏳ ${channelNames[channel] || channel} mesajı gönderiliyor...\n`));
77
103
 
78
104
  try {
79
105
  const response = await fetch(GATEWAY_HTTP_URL, {
@@ -85,7 +111,7 @@ async function sendMessageViaHttp(channel, target, messageText) {
85
111
  const data = await response.json();
86
112
 
87
113
  if (!response.ok) {
88
- throw new Error(data.error || `HTTP ${response.status}`);
114
+ throw new ApiError(data.error || `HTTP ${response.status}`, response.status);
89
115
  }
90
116
 
91
117
  console.log(chalk.green('✅ Mesaj gönderildi!\n'));
@@ -35,9 +35,17 @@ function addUniqueFact(facts, newFact) {
35
35
  async function migrate(options) {
36
36
  const from = options.from || 'openclaw';
37
37
 
38
+ if (from === 'claude-code' || from === 'claude') {
39
+ return migrateClaudeCode();
40
+ }
41
+ if (from === 'hermes') {
42
+ return migrateHermes();
43
+ }
38
44
  if (from !== 'openclaw') {
39
- console.log(chalk.red('\n❌ Sadece OpenClaw migration destekleniyor.\n'));
40
- console.log(chalk.gray('Kullanım: natureco migrate --from openclaw\n'));
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.gray(' natureco migrate --from claude-code'));
48
+ console.log(chalk.gray(' natureco migrate --from hermes\n'));
41
49
  return;
42
50
  }
43
51
 
@@ -623,4 +631,207 @@ function copyDirRecursive(src, dest) {
623
631
  }
624
632
  }
625
633
 
634
+ // ── Claude Code Migration ──────────────────────────────────────────────────────
635
+ async function migrateClaudeCode() {
636
+ console.log(chalk.yellow('\n⏳ Claude Code → NatureCo migration başlıyor...\n'));
637
+
638
+ const claudeDir = path.join(os.homedir(), '.claude');
639
+ const claudeSettings = path.join(claudeDir, 'settings.json');
640
+ const claudeProjects = path.join(os.homedir(), '.claude', 'projects');
641
+
642
+ if (!fs.existsSync(claudeSettings)) {
643
+ console.log(chalk.yellow('⚠ Claude Code settings bulunamadı: ~/.claude/settings.json\n'));
644
+ } else {
645
+ try {
646
+ const settings = JSON.parse(fs.readFileSync(claudeSettings, 'utf-8'));
647
+ console.log(chalk.gray(' Claude Code ayarları bulundu.\n'));
648
+
649
+ // Migrate allowed tools
650
+ if (settings.allowList?.length > 0) {
651
+ const config = getConfig();
652
+ if (!config.policies) config.policies = {};
653
+ config.policies.claudeAllowedTools = settings.allowList;
654
+ setConfigValue('policies', config.policies);
655
+ console.log(chalk.green(` ✅ ${settings.allowList.length} izinli araç migrate edildi`));
656
+ }
657
+
658
+ // Migrate permissions
659
+ if (settings.permissions) {
660
+ const config = getConfig();
661
+ config.claudePermissions = settings.permissions;
662
+ setConfigValue('claudePermissions', settings.permissions);
663
+ console.log(chalk.green(' ✅ Claude izinleri migrate edildi'));
664
+ }
665
+ } catch (err) {
666
+ console.log(chalk.red(` ❌ Claude settings okuma hatası: ${err.message}`));
667
+ }
668
+ }
669
+
670
+ // Migrate Claude projects
671
+ if (fs.existsSync(claudeProjects)) {
672
+ try {
673
+ const projects = fs.readdirSync(claudeProjects).filter(f => {
674
+ const p = path.join(claudeProjects, f);
675
+ return fs.statSync(p).isDirectory() && !f.startsWith('.');
676
+ });
677
+
678
+ if (projects.length > 0) {
679
+ console.log(chalk.gray(`\n Claude projeleri bulundu: ${projects.length}\n`));
680
+ const projectsDir = path.join(os.homedir(), '.natureco', 'claude-projects');
681
+ fs.mkdirSync(projectsDir, { recursive: true });
682
+
683
+ for (const project of projects) {
684
+ const src = path.join(claudeProjects, project);
685
+ const dst = path.join(projectsDir, project);
686
+ if (!fs.existsSync(dst)) {
687
+ fs.cpSync(src, dst, { recursive: true });
688
+ console.log(chalk.green(` ✅ Proje kopyalandı: ${project}`));
689
+ } else {
690
+ console.log(chalk.yellow(` ⚠ Proje zaten var, atlandı: ${project}`));
691
+ }
692
+ }
693
+ }
694
+ } catch (err) {
695
+ console.log(chalk.yellow(` ⚠ Proje migrasyonu atlandı: ${err.message}`));
696
+ }
697
+ }
698
+
699
+ // Migrate MEMORY.md if exists
700
+ const memoryFile = path.join(claudeDir, '..', 'workspace', 'MEMORY.md');
701
+ if (fs.existsSync(memoryFile)) {
702
+ try {
703
+ const content = fs.readFileSync(memoryFile, 'utf-8');
704
+ const memory = {
705
+ name: '',
706
+ nickname: '',
707
+ botName: '',
708
+ facts: [{ value: 'Migrated from Claude Code', score: 5, updatedAt: new Date().toISOString() }],
709
+ preferences: []
710
+ };
711
+
712
+ const lines = content.split('\n');
713
+ for (const line of lines) {
714
+ if (line.toLowerCase().includes('name:')) {
715
+ memory.name = line.split(':')[1]?.trim() || '';
716
+ }
717
+ if (line.toLowerCase().includes('preference:') || line.toLowerCase().includes('favorite:')) {
718
+ memory.preferences.push({ value: line.split(':')[1]?.trim() || '', score: 5, updatedAt: new Date().toISOString() });
719
+ }
720
+ }
721
+
722
+ const memoryDir = path.join(os.homedir(), '.natureco', 'memory');
723
+ fs.mkdirSync(memoryDir, { recursive: true });
724
+ fs.writeFileSync(path.join(memoryDir, 'universal-provider.json'), JSON.stringify(memory, null, 2));
725
+ console.log(chalk.green(' ✅ Claude MEMORY.md migrate edildi'));
726
+ } catch (err) {
727
+ console.log(chalk.yellow(` ⚠ Memory migrasyonu atlandı: ${err.message}`));
728
+ }
729
+ }
730
+
731
+ console.log(chalk.green('\n✅ Claude Code migration tamamlandı!\n'));
732
+ }
733
+
734
+ // ── Hermes Migration ──────────────────────────────────────────────────────────
735
+ async function migrateHermes() {
736
+ console.log(chalk.yellow('\n⏳ Hermes → NatureCo migration başlıyor...\n'));
737
+
738
+ const hermesDir = path.join(os.homedir(), '.hermes');
739
+ const hermesConfig = path.join(hermesDir, 'config.json');
740
+ const hermesSessions = path.join(hermesDir, 'sessions');
741
+
742
+ if (!fs.existsSync(hermesDir)) {
743
+ console.log(chalk.yellow('⚠ Hermes dizini bulunamadı: ~/.hermes\n'));
744
+ return;
745
+ }
746
+
747
+ let migrated = { config: false, sessions: 0, memory: false };
748
+
749
+ // Migrate config
750
+ if (fs.existsSync(hermesConfig)) {
751
+ try {
752
+ const config = JSON.parse(fs.readFileSync(hermesConfig, 'utf-8'));
753
+
754
+ const ncConfig = getConfig();
755
+ if (config.provider) ncConfig.providerUrl = config.provider;
756
+ if (config.model) ncConfig.providerModel = config.model;
757
+ if (config.apiKey) ncConfig.providerApiKey = config.apiKey;
758
+ if (config.systemPrompt) ncConfig.systemPrompt = config.systemPrompt;
759
+ if (config.temperature !== undefined) ncConfig.temperature = config.temperature;
760
+
761
+ setConfigValue('providerUrl', ncConfig.providerUrl);
762
+ setConfigValue('providerModel', ncConfig.providerModel);
763
+ if (config.apiKey) setConfigValue('providerApiKey', ncConfig.providerApiKey);
764
+ if (config.systemPrompt) setConfigValue('systemPrompt', ncConfig.systemPrompt);
765
+ if (config.temperature !== undefined) setConfigValue('temperature', ncConfig.temperature);
766
+
767
+ migrated.config = true;
768
+ console.log(chalk.green(' ✅ Hermes config migrate edildi'));
769
+ } catch (err) {
770
+ console.log(chalk.red(` ❌ Config okuma hatası: ${err.message}`));
771
+ }
772
+ }
773
+
774
+ // Migrate sessions
775
+ if (fs.existsSync(hermesSessions)) {
776
+ try {
777
+ const sessions = fs.readdirSync(hermesSessions).filter(f => f.endsWith('.json'));
778
+ const ncSessionsDir = path.join(os.homedir(), '.natureco', 'sessions');
779
+ fs.mkdirSync(ncSessionsDir, { recursive: true });
780
+
781
+ for (const session of sessions) {
782
+ const src = path.join(hermesSessions, session);
783
+ const dst = path.join(ncSessionsDir, `hermes-${session}`);
784
+ if (!fs.existsSync(dst)) {
785
+ fs.copyFileSync(src, dst);
786
+ migrated.sessions++;
787
+ }
788
+ }
789
+
790
+ if (migrated.sessions > 0) {
791
+ console.log(chalk.green(` ✅ ${migrated.sessions} Hermes oturumu migrate edildi`));
792
+ }
793
+ } catch (err) {
794
+ console.log(chalk.yellow(` ⚠ Session migrasyonu atlandı: ${err.message}`));
795
+ }
796
+ }
797
+
798
+ // Migrate memory
799
+ const hermesMemory = path.join(hermesDir, 'memory.json');
800
+ if (fs.existsSync(hermesMemory)) {
801
+ try {
802
+ const memData = JSON.parse(fs.readFileSync(hermesMemory, 'utf-8'));
803
+ const ncMemoryDir = path.join(os.homedir(), '.natureco', 'memory');
804
+ fs.mkdirSync(ncMemoryDir, { recursive: true });
805
+
806
+ const ncMem = {
807
+ name: memData.userName || '',
808
+ nickname: '',
809
+ botName: 'Hermes',
810
+ facts: [],
811
+ preferences: []
812
+ };
813
+
814
+ if (memData.userInfo) {
815
+ ncMem.facts.push({ value: memData.userInfo, score: 6, updatedAt: new Date().toISOString() });
816
+ }
817
+ if (memData.context) {
818
+ ncMem.facts.push({ value: memData.context, score: 5, updatedAt: new Date().toISOString() });
819
+ }
820
+
821
+ fs.writeFileSync(path.join(ncMemoryDir, 'hermes-migrated.json'), JSON.stringify(ncMem, null, 2));
822
+ migrated.memory = true;
823
+ console.log(chalk.green(' ✅ Hermes hafızası migrate edildi'));
824
+ } catch (err) {
825
+ console.log(chalk.yellow(` ⚠ Memory migrasyonu atlandı: ${err.message}`));
826
+ }
827
+ }
828
+
829
+ if (!migrated.config && migrated.sessions === 0 && !migrated.memory) {
830
+ console.log(chalk.yellow(' ⚠ Hiçbir veri migrate edilemedi.\n'));
831
+ return;
832
+ }
833
+
834
+ console.log(chalk.green('\n✅ Hermes migration tamamlandı!\n'));
835
+ }
836
+
626
837
  module.exports = migrate;