natureco-cli 2.23.29 → 2.23.31

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 (111) hide show
  1. package/README.md +94 -11
  2. package/bin/natureco.js +495 -94
  3. package/package.json +1 -1
  4. package/src/commands/acp.js +39 -0
  5. package/src/commands/admin-rpc.js +302 -0
  6. package/src/commands/agent.js +280 -0
  7. package/src/commands/agents.js +114 -30
  8. package/src/commands/approvals.js +214 -0
  9. package/src/commands/backup.js +124 -0
  10. package/src/commands/bonjour.js +167 -0
  11. package/src/commands/browser.js +815 -0
  12. package/src/commands/capability.js +237 -0
  13. package/src/commands/channels.js +422 -267
  14. package/src/commands/chat.js +5 -8
  15. package/src/commands/clawbot.js +19 -0
  16. package/src/commands/clickclack.js +130 -0
  17. package/src/commands/code.js +3 -2
  18. package/src/commands/commitments.js +148 -0
  19. package/src/commands/completion.js +84 -0
  20. package/src/commands/config.js +219 -30
  21. package/src/commands/configure.js +110 -0
  22. package/src/commands/crestodian.js +92 -0
  23. package/src/commands/cron.js +239 -19
  24. package/src/commands/daemon.js +90 -0
  25. package/src/commands/dashboard.js +47 -374
  26. package/src/commands/device-pair.js +248 -0
  27. package/src/commands/devices.js +137 -0
  28. package/src/commands/directory.js +179 -0
  29. package/src/commands/dns.js +196 -0
  30. package/src/commands/docs.js +136 -0
  31. package/src/commands/doctor.js +143 -492
  32. package/src/commands/exec-policy.js +80 -0
  33. package/src/commands/gateway-server.js +1155 -24
  34. package/src/commands/gateway.js +492 -249
  35. package/src/commands/health.js +148 -0
  36. package/src/commands/help.js +24 -25
  37. package/src/commands/hooks.js +141 -87
  38. package/src/commands/imessage.js +128 -14
  39. package/src/commands/infer.js +1474 -0
  40. package/src/commands/irc.js +64 -15
  41. package/src/commands/logs.js +122 -99
  42. package/src/commands/mattermost.js +114 -12
  43. package/src/commands/mcp.js +121 -309
  44. package/src/commands/memory-cmd.js +134 -1
  45. package/src/commands/memory.js +128 -0
  46. package/src/commands/message.js +720 -134
  47. package/src/commands/migrate.js +213 -2
  48. package/src/commands/models.js +39 -1
  49. package/src/commands/node.js +98 -0
  50. package/src/commands/nodes.js +362 -0
  51. package/src/commands/oc-path.js +200 -0
  52. package/src/commands/onboard.js +129 -0
  53. package/src/commands/open-prose.js +67 -0
  54. package/src/commands/pairing.js +108 -107
  55. package/src/commands/path.js +206 -0
  56. package/src/commands/plugins.js +35 -1
  57. package/src/commands/policy.js +176 -0
  58. package/src/commands/proxy.js +306 -0
  59. package/src/commands/qr.js +70 -0
  60. package/src/commands/reset.js +101 -94
  61. package/src/commands/sandbox.js +125 -0
  62. package/src/commands/secrets.js +201 -0
  63. package/src/commands/sessions.js +110 -51
  64. package/src/commands/setup.js +102 -543
  65. package/src/commands/signal.js +447 -18
  66. package/src/commands/skills.js +67 -1
  67. package/src/commands/sms.js +123 -19
  68. package/src/commands/status.js +101 -127
  69. package/src/commands/system.js +53 -0
  70. package/src/commands/tasks.js +208 -100
  71. package/src/commands/terminal.js +139 -0
  72. package/src/commands/thread-ownership.js +157 -0
  73. package/src/commands/transcripts.js +95 -0
  74. package/src/commands/tui.js +41 -0
  75. package/src/commands/uninstall.js +73 -92
  76. package/src/commands/update.js +146 -91
  77. package/src/commands/voice.js +82 -0
  78. package/src/commands/vydra.js +98 -0
  79. package/src/commands/webhooks.js +58 -66
  80. package/src/commands/wiki.js +783 -0
  81. package/src/commands/workboard.js +207 -0
  82. package/src/tools/audio_understanding.js +154 -0
  83. package/src/tools/browser.js +112 -0
  84. package/src/tools/canvas.js +104 -0
  85. package/src/tools/document_extract.js +84 -0
  86. package/src/tools/duckduckgo.js +54 -0
  87. package/src/tools/exa_search.js +66 -0
  88. package/src/tools/firecrawl.js +104 -0
  89. package/src/tools/image_generation.js +99 -0
  90. package/src/tools/llm_task.js +118 -0
  91. package/src/tools/media_understanding.js +128 -0
  92. package/src/tools/music_generation.js +113 -0
  93. package/src/tools/parallel_search.js +77 -0
  94. package/src/tools/phone_control.js +80 -0
  95. package/src/tools/phone_control_enhanced.js +184 -0
  96. package/src/tools/searxng.js +61 -0
  97. package/src/tools/speech_to_text.js +135 -0
  98. package/src/tools/text_to_speech.js +105 -0
  99. package/src/tools/thread_ownership.js +88 -0
  100. package/src/tools/video_generation.js +72 -0
  101. package/src/tools/web_readability.js +104 -0
  102. package/src/utils/agents-md.js +85 -0
  103. package/src/utils/api.js +39 -40
  104. package/src/utils/format.js +144 -0
  105. package/src/utils/headless.js +2 -1
  106. package/src/utils/memory.js +200 -0
  107. package/src/utils/parallel-tools.js +106 -0
  108. package/src/utils/sub-agent.js +148 -0
  109. package/src/utils/token-budget.js +304 -0
  110. package/src/utils/tool-runner.js +7 -5
  111. package/src/utils/web-fetch.js +107 -0
@@ -1,309 +1,121 @@
1
- const chalk = require('chalk');
2
- const inquirer = require('../utils/inquirer-wrapper');
3
- const {
4
- getMcpServers,
5
- addMcpServer,
6
- removeMcpServer,
7
- testMcpServer,
8
- toggleMcpServer,
9
- getMcpTemplates,
10
- updateMcpServer,
11
- } = require('../utils/mcp');
12
-
13
- async function mcp(args) {
14
- const [action, ...params] = args;
15
-
16
- if (!action || action === 'list') {
17
- return listMcpServers();
18
- }
19
-
20
- switch (action) {
21
- case 'add':
22
- return await addMcpServerInteractive(params);
23
- case 'remove':
24
- return removeMcpServerCommand(params);
25
- case 'test':
26
- return testMcpServerCommand(params);
27
- case 'enable':
28
- return toggleMcpServerCommand(params, true);
29
- case 'disable':
30
- return toggleMcpServerCommand(params, false);
31
- case 'templates':
32
- return listTemplates();
33
- default:
34
- console.log(chalk.red(`\n❌ Bilinmeyen komut: ${action}\n`));
35
- console.log(chalk.gray('Kullanım: natureco mcp <list|add|remove|test|enable|disable|templates>\n'));
36
- process.exit(1);
37
- }
38
- }
39
-
40
- function listMcpServers() {
41
- const servers = getMcpServers();
42
- const serverNames = Object.keys(servers);
43
-
44
- if (serverNames.length === 0) {
45
- console.log(chalk.gray('\nMCP sunucu yok.\n'));
46
- console.log(chalk.yellow('Eklemek için: ') + chalk.cyan('natureco mcp add\n'));
47
- return;
48
- }
49
-
50
- console.log(chalk.green.bold('\n╭─ MCP Sunucular ─╮\n'));
51
-
52
- serverNames.forEach(name => {
53
- const server = servers[name];
54
- const status = server.disabled ? chalk.red('✗ Devre dışı') : chalk.green('✓ Aktif');
55
-
56
- console.log(chalk.cyan(` ${name}`));
57
- console.log(chalk.gray(` Durum: ${status}`));
58
- console.log(chalk.gray(` Komut: ${server.command} ${server.args?.join(' ') || ''}`));
59
-
60
- if (server.env && Object.keys(server.env).length > 0) {
61
- console.log(chalk.gray(` Env: ${Object.keys(server.env).join(', ')}`));
62
- }
63
-
64
- console.log('');
65
- });
66
-
67
- console.log(chalk.gray('Komutlar:'));
68
- console.log(chalk.gray(' natureco mcp add - Yeni sunucu ekle'));
69
- console.log(chalk.gray(' natureco mcp remove - Sunucu kaldır'));
70
- console.log(chalk.gray(' natureco mcp test - Bağlantı test et'));
71
- console.log(chalk.gray(' natureco mcp templates - Hazır şablonları göster\n'));
72
- }
73
-
74
- function listTemplates() {
75
- const templates = getMcpTemplates();
76
-
77
- console.log(chalk.green.bold('\n╭─ MCP Şablonlar ─╮\n'));
78
-
79
- Object.entries(templates).forEach(([key, template]) => {
80
- console.log(chalk.cyan(` ${template.name}`));
81
- console.log(chalk.gray(` ${template.description}`));
82
- console.log(chalk.gray(` Komut: ${template.command} ${template.args.join(' ')}`));
83
-
84
- if (template.env && Object.keys(template.env).length > 0) {
85
- const envVars = Object.entries(template.env)
86
- .map(([k, v]) => `${k}=${v}`)
87
- .join(', ');
88
- console.log(chalk.gray(` Env: ${envVars}`));
89
- }
90
-
91
- console.log('');
92
- });
93
-
94
- console.log(chalk.yellow('Eklemek için: ') + chalk.cyan('natureco mcp add\n'));
95
- }
96
-
97
- async function addMcpServerInteractive(params) {
98
- const templates = getMcpTemplates();
99
- const templateNames = Object.keys(templates);
100
- const { getConfig, saveConfig } = require('../utils/config');
101
-
102
- // Sunucu adı
103
- let serverName;
104
- if (params[0]) {
105
- serverName = params[0];
106
- } else {
107
- const { name } = await inquirer.prompt([
108
- {
109
- type: 'input',
110
- name: 'name',
111
- message: 'Sunucu adı:',
112
- validate: (input) => {
113
- if (!input || input.trim().length === 0) {
114
- return 'Sunucu adı gerekli';
115
- }
116
- const servers = getMcpServers();
117
- if (servers[input]) {
118
- return 'Bu isimde sunucu zaten mevcut';
119
- }
120
- return true;
121
- },
122
- },
123
- ]);
124
- serverName = name;
125
- }
126
-
127
- // Şablon seç
128
- const { useTemplate } = await inquirer.prompt([
129
- {
130
- type: 'confirm',
131
- name: 'useTemplate',
132
- message: 'Hazır şablon kullanmak ister misiniz?',
133
- default: true,
134
- },
135
- ]);
136
-
137
- if (useTemplate) {
138
- const { template } = await inquirer.prompt([
139
- {
140
- type: 'list',
141
- name: 'template',
142
- message: 'Şablon seçin:',
143
- choices: templateNames.map(key => ({
144
- name: `${templates[key].name} - ${templates[key].description}`,
145
- value: key,
146
- })),
147
- },
148
- ]);
149
-
150
- const selectedTemplate = templates[template];
151
-
152
- // Environment variables
153
- const envVars = {};
154
- const config = getConfig();
155
-
156
- if (selectedTemplate.env && Object.keys(selectedTemplate.env).length > 0) {
157
- console.log(chalk.yellow('\nEnvironment variable\'ları ayarlayın:\n'));
158
-
159
- for (const [key, defaultValue] of Object.entries(selectedTemplate.env)) {
160
- // Special handling for GitHub token
161
- if (template === 'github' && key === 'GITHUB_TOKEN') {
162
- const existingToken = config.githubToken;
163
-
164
- const { value } = await inquirer.prompt([
165
- {
166
- type: 'password',
167
- name: 'value',
168
- message: `${key} (ghp_xxx):`,
169
- default: existingToken || '',
170
- validate: (input) => {
171
- if (!input || input.trim().length === 0) {
172
- return 'GitHub token gerekli';
173
- }
174
- if (!input.startsWith('ghp_') && !input.startsWith('github_pat_')) {
175
- return 'Geçersiz GitHub token formatı';
176
- }
177
- return true;
178
- },
179
- },
180
- ]);
181
-
182
- envVars[key] = value;
183
-
184
- // Save to config for future use
185
- config.githubToken = value;
186
- saveConfig(config);
187
- console.log(chalk.gray(' ✓ GitHub token config\'e kaydedildi\n'));
188
-
189
- } else {
190
- const { value } = await inquirer.prompt([
191
- {
192
- type: 'input',
193
- name: 'value',
194
- message: `${key}:`,
195
- default: defaultValue,
196
- },
197
- ]);
198
- envVars[key] = value;
199
- }
200
- }
201
- }
202
-
203
- try {
204
- addMcpServer(serverName, template);
205
-
206
- // Update env vars if provided
207
- if (Object.keys(envVars).length > 0) {
208
- updateMcpServer(serverName, { env: envVars });
209
- }
210
-
211
- console.log(chalk.green(`\n✅ MCP sunucu eklendi: ${serverName}\n`));
212
- console.log(chalk.gray('Test etmek için: ') + chalk.cyan(`natureco mcp test ${serverName}\n`));
213
- } catch (err) {
214
- console.log(chalk.red(`\n❌ Hata: ${err.message}\n`));
215
- process.exit(1);
216
- }
217
- } else {
218
- // Custom config
219
- const { command } = await inquirer.prompt([
220
- {
221
- type: 'input',
222
- name: 'command',
223
- message: 'Komut:',
224
- default: 'npx',
225
- },
226
- ]);
227
-
228
- const { args } = await inquirer.prompt([
229
- {
230
- type: 'input',
231
- name: 'args',
232
- message: 'Argümanlar (boşlukla ayırın):',
233
- },
234
- ]);
235
-
236
- const customConfig = {
237
- command,
238
- args: args.split(' ').filter(a => a.length > 0),
239
- env: {},
240
- };
241
-
242
- try {
243
- addMcpServer(serverName, null, customConfig);
244
- console.log(chalk.green(`\n✅ MCP sunucu eklendi: ${serverName}\n`));
245
- } catch (err) {
246
- console.log(chalk.red(`\n❌ Hata: ${err.message}\n`));
247
- process.exit(1);
248
- }
249
- }
250
- }
251
-
252
- function removeMcpServerCommand(params) {
253
- if (params.length === 0) {
254
- console.log(chalk.red('\n❌ Sunucu adı gerekli\n'));
255
- console.log(chalk.gray('Kullanım: natureco mcp remove <sunucu-adı>\n'));
256
- process.exit(1);
257
- }
258
-
259
- const serverName = params[0];
260
-
261
- try {
262
- removeMcpServer(serverName);
263
- console.log(chalk.green(`\n✅ MCP sunucu kaldırıldı: ${serverName}\n`));
264
- } catch (err) {
265
- console.log(chalk.red(`\n❌ Hata: ${err.message}\n`));
266
- process.exit(1);
267
- }
268
- }
269
-
270
- function testMcpServerCommand(params) {
271
- if (params.length === 0) {
272
- console.log(chalk.red('\n❌ Sunucu adı gerekli\n'));
273
- console.log(chalk.gray('Kullanım: natureco mcp test <sunucu-adı>\n'));
274
- process.exit(1);
275
- }
276
-
277
- const serverName = params[0];
278
-
279
- console.log(chalk.yellow(`\n⏳ Test ediliyor: ${serverName}...\n`));
280
-
281
- try {
282
- testMcpServer(serverName);
283
- console.log(chalk.green(`✅ Bağlantı başarılı: ${serverName}\n`));
284
- } catch (err) {
285
- console.log(chalk.red(`❌ Bağlantı başarısız: ${err.message}\n`));
286
- process.exit(1);
287
- }
288
- }
289
-
290
- function toggleMcpServerCommand(params, enabled) {
291
- if (params.length === 0) {
292
- console.log(chalk.red('\n❌ Sunucu adı gerekli\n'));
293
- console.log(chalk.gray(`Kullanım: natureco mcp ${enabled ? 'enable' : 'disable'} <sunucu-adı>\n`));
294
- process.exit(1);
295
- }
296
-
297
- const serverName = params[0];
298
-
299
- try {
300
- toggleMcpServer(serverName, enabled);
301
- const status = enabled ? 'aktif' : 'devre dışı';
302
- console.log(chalk.green(`\n✅ MCP sunucu ${status}: ${serverName}\n`));
303
- } catch (err) {
304
- console.log(chalk.red(`\n❌ Hata: ${err.message}\n`));
305
- process.exit(1);
306
- }
307
- }
308
-
309
- module.exports = mcp;
1
+ const chalk = require('chalk');
2
+ const fs = require('fs');
3
+ const path = require('path');
4
+ const os = require('os');
5
+
6
+ const MCP_CONFIG = path.join(os.homedir(), '.natureco', 'mcp-servers.json');
7
+
8
+ function loadServers() {
9
+ if (!fs.existsSync(MCP_CONFIG)) return {};
10
+ try { return JSON.parse(fs.readFileSync(MCP_CONFIG, 'utf8')); }
11
+ catch { return {}; }
12
+ }
13
+
14
+ function saveServers(servers) {
15
+ const dir = path.dirname(MCP_CONFIG);
16
+ if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
17
+ fs.writeFileSync(MCP_CONFIG, JSON.stringify(servers, null, 2), 'utf8');
18
+ }
19
+
20
+ function mcp(args) {
21
+ const [action, ...params] = args || [];
22
+
23
+ if (!action || action === 'list') return cmdList();
24
+ if (action === 'serve') return cmdServe();
25
+ if (action === 'show') return cmdShow(params[0]);
26
+ if (action === 'set') return cmdSet(params[0], params.slice(1));
27
+ if (action === 'unset') return cmdUnset(params[0]);
28
+
29
+ console.log(chalk.red(`\n Unknown mcp action: ${action}\n`));
30
+ console.log(chalk.gray(' Usage: natureco mcp <action> [params]'));
31
+ console.log(chalk.gray(' Actions: serve, list, show <name>, set, unset <name>\n'));
32
+ process.exit(1);
33
+ }
34
+
35
+ function cmdServe() {
36
+ console.log(chalk.cyan('\n MCP Server\n'));
37
+ console.log(chalk.gray(' ' + '─'.repeat(48)));
38
+ console.log(` ${chalk.white('Endpoint:')} ${chalk.green('http://127.0.0.1:3848/mcp')}`);
39
+ console.log(` ${chalk.white('Status:')} ${chalk.gray('Would start MCP server here')}`);
40
+ console.log('');
41
+ }
42
+
43
+ function cmdList() {
44
+ const servers = loadServers();
45
+ const names = Object.keys(servers);
46
+
47
+ console.log(chalk.cyan('\n MCP Servers\n'));
48
+ console.log(chalk.gray(' ' + '─'.repeat(48)));
49
+
50
+ if (names.length === 0) {
51
+ console.log(chalk.gray(' No MCP servers configured.\n'));
52
+ console.log(chalk.gray(' Add one: ') + chalk.cyan('natureco mcp set <name> <command> [args...]\n'));
53
+ return;
54
+ }
55
+
56
+ for (const name of names) {
57
+ const s = servers[name];
58
+ const status = s.disabled ? chalk.red('disabled') : chalk.green('enabled');
59
+ console.log(` ${chalk.white(name)} ${chalk.gray(`— ${status}`)}`);
60
+ console.log(chalk.gray(` Command: ${s.command} ${(s.args || []).join(' ')}`));
61
+ }
62
+ console.log('');
63
+ }
64
+
65
+ function cmdShow(name) {
66
+ if (!name) {
67
+ console.log(chalk.red('\n Usage: natureco mcp show <name>\n'));
68
+ process.exit(1);
69
+ }
70
+
71
+ const servers = loadServers();
72
+ const s = servers[name];
73
+ if (!s) {
74
+ console.log(chalk.yellow(`\n MCP server "${name}" not found.\n`));
75
+ return;
76
+ }
77
+
78
+ console.log(chalk.cyan(`\n MCP Server: ${name}\n`));
79
+ console.log(chalk.gray(' ' + '─'.repeat(48)));
80
+ console.log(` ${chalk.white('Command:')} ${chalk.white(s.command)} ${chalk.gray((s.args || []).join(' '))}`);
81
+ console.log(` ${chalk.white('Status:')} ${s.disabled ? chalk.red('disabled') : chalk.green('enabled')}`);
82
+ if (s.env && Object.keys(s.env).length > 0) {
83
+ console.log(` ${chalk.white('Env:')} ${chalk.gray(Object.keys(s.env).join(', '))}`);
84
+ }
85
+ console.log('');
86
+ }
87
+
88
+ function cmdSet(name, rest) {
89
+ if (!name || rest.length === 0) {
90
+ console.log(chalk.red('\n Usage: natureco mcp set <name> <command> [args...]\n'));
91
+ process.exit(1);
92
+ }
93
+
94
+ const servers = loadServers();
95
+ servers[name] = {
96
+ command: rest[0],
97
+ args: rest.slice(1),
98
+ disabled: false,
99
+ };
100
+ saveServers(servers);
101
+ console.log(chalk.green(`\n MCP server "${name}" configured.\n`));
102
+ }
103
+
104
+ function cmdUnset(name) {
105
+ if (!name) {
106
+ console.log(chalk.red('\n Usage: natureco mcp unset <name>\n'));
107
+ process.exit(1);
108
+ }
109
+
110
+ const servers = loadServers();
111
+ if (!servers[name]) {
112
+ console.log(chalk.yellow(`\n MCP server "${name}" not found.\n`));
113
+ return;
114
+ }
115
+
116
+ delete servers[name];
117
+ saveServers(servers);
118
+ console.log(chalk.gray(`\n MCP server "${name}" removed.\n`));
119
+ }
120
+
121
+ module.exports = mcp;
@@ -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;