natureco-cli 5.20.2 → 5.20.4

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/README.md CHANGED
@@ -343,6 +343,8 @@ natureco logs # Log dosyaları
343
343
 
344
344
  ```bash
345
345
  natureco naturehub post <text> # NatureHub paylaşımı
346
+ natureco naturehub dm <user> <msg> # DM gönder
347
+ natureco naturehub inbox # Gelen kutusu
346
348
  natureco naturehub feed # Akışı gör
347
349
 
348
350
  natureco seo audit natureco.me # SEO analizi (skor)
package/bin/natureco.js CHANGED
@@ -598,7 +598,7 @@ program
598
598
 
599
599
  program
600
600
  .command('naturehub [action] [params...]')
601
- .description('Nature Hub\'a içerik yayınla (post|list|trending|config)')
601
+ .description('Nature Hub\'a içerik yayınla (post|dm|inbox|robot-house|forum|list|info|config)')
602
602
  .action((action, params) => {
603
603
  naturehub(action ? [action, ...(params || [])] : []);
604
604
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "natureco-cli",
3
- "version": "5.20.2",
3
+ "version": "5.20.4",
4
4
  "description": "OpenClaw'dan daha güvenli, daha hızlı, daha ucuz AI agent CLI. Multi-agent, self-evolving skills, audit log, maliyet optimizasyonu ve NatureCo platform-native.",
5
5
  "bin": {
6
6
  "natureco": "bin/natureco.js"
@@ -88,6 +88,7 @@ async function chat(botName, options = {}) {
88
88
  console.log(tui.C.muted(' Chat komutu artık ') + tui.C.brand('repl') + tui.C.muted(' komutunu çağırıyor (Phase 9 TUI engine)'));
89
89
  console.log(tui.C.muted(' Tüm özellikler korundu: memory, sessions, hooks, custom commands'));
90
90
  console.log('');
91
+ if (options.noStream) replArgs.push('--no-stream');
91
92
  return repl(replArgs);
92
93
  }
93
94
 
@@ -99,6 +99,8 @@ function help() {
99
99
  title: 'NatureCo Native',
100
100
  rows: [
101
101
  { name: 'natureco naturehub post "<text>"', desc: 'NatureCo API ile bota mesaj gönder' },
102
+ { name: 'natureco naturehub dm <user> "<msg>"', desc: 'Kullanıcıya DM gönder' },
103
+ { name: 'natureco naturehub inbox [--unread]', desc: 'Gelen kutusunu kontrol et' },
102
104
  { name: 'natureco naturehub list', desc: 'Botlarını listele' },
103
105
  { name: 'natureco naturehub info [bot_id]', desc: 'Bot detayı' },
104
106
  { name: 'natureco medium draft <file.md>', desc: 'Medium makale taslağı' },
@@ -1,14 +1,17 @@
1
1
  /**
2
- * natureco naturehub — NatureCo Bot API iletişimi
2
+ * natureco naturehub — NatureCo platform paylaşımları
3
3
  *
4
- * natureco.me/api/v1/bots endpoint'lerini kullanır.
5
4
  * Kullanım:
6
- * natureco naturehub post <text> Bota mesaj gönder
7
- * natureco naturehub list Botları listele
8
- * natureco naturehub info [bot_id] Bot detayı
9
- * natureco naturehub config Ayarları göster
5
+ * natureco naturehub post <text> Bota mesaj gönder
6
+ * natureco naturehub dm <user> <text> DM gönder
7
+ * natureco naturehub inbox [--unread] Gelen kutusu
8
+ * natureco naturehub robot-house <content> Robot House gönderisi
9
+ * natureco naturehub forum <title> <content> Forum gönderisi
10
+ * natureco naturehub list Botları listele
11
+ * natureco naturehub info [bot_id] Bot detayı
12
+ * natureco naturehub config Ayarları göster
10
13
  *
11
- * API: https://natureco.me/api/v1/bots
14
+ * API: https://api.natureco.me/api/v1
12
15
  */
13
16
 
14
17
  const chalk = require('chalk');
@@ -185,21 +188,185 @@ async function cmdConfig() {
185
188
  console.log('');
186
189
  }
187
190
 
191
+ async function cmdRobotHouse(args) {
192
+ const content = args.join(' ').trim();
193
+ if (!content) {
194
+ console.log(chalk.red('\n Kullanım: natureco naturehub robot-house "<içerik>"\n'));
195
+ return;
196
+ }
197
+
198
+ const token = getApiKey();
199
+ if (!token) {
200
+ console.log(chalk.yellow('\n ⚠️ API key tanımlı değil. Önce `natureco login` ile giriş yapın.\n'));
201
+ return;
202
+ }
203
+
204
+ console.log(chalk.cyan('\n 📤 Robot House\'a gönderiliyor...\n'));
205
+
206
+ try {
207
+ const result = await apiCall('/posts', {
208
+ method: 'POST',
209
+ token,
210
+ body: { content, type: 'text', tags: [], mood: '🌿' },
211
+ });
212
+ console.log(chalk.green(' ✓ Robot House\'a gönderildi!\n'));
213
+ if (result.post?.id) console.log(chalk.gray(` ID: ${result.post.id}\n`));
214
+ audit.log(audit.ACTIONS.INFO, { source: 'naturehub', action: 'robot-house' });
215
+ } catch (e) {
216
+ console.log(chalk.red(` ✗ Hata: ${e.message}\n`));
217
+ }
218
+ }
219
+
220
+ async function cmdDm(args) {
221
+ const text = args.join(' ').trim();
222
+ const spaceIdx = text.indexOf(' ');
223
+ let username, message;
224
+
225
+ if (spaceIdx > 0) {
226
+ username = text.slice(0, spaceIdx).trim();
227
+ message = text.slice(spaceIdx + 1).trim();
228
+ } else if (text) {
229
+ username = text;
230
+ message = '';
231
+ } else {
232
+ username = '';
233
+ message = '';
234
+ }
235
+
236
+ if (!username || !message) {
237
+ console.log(chalk.red('\n Kullanım: natureco naturehub dm <kullanıcı_adı> "<mesaj>"\n'));
238
+ console.log(chalk.gray(' Örnek: natureco naturehub dm ahmet "Merhaba, nasılsın?"\n'));
239
+ return;
240
+ }
241
+
242
+ const token = getApiKey();
243
+ if (!token) {
244
+ console.log(chalk.yellow('\n ⚠️ API key tanımlı değil. Önce `natureco login` ile giriş yapın.\n'));
245
+ return;
246
+ }
247
+
248
+ console.log(chalk.cyan(`\n 📤 DM gönderiliyor: @${username}...\n`));
249
+ console.log(chalk.gray(` "${message.slice(0, 200)}"\n`));
250
+
251
+ try {
252
+ const result = await apiCall('/dm', {
253
+ method: 'POST',
254
+ token,
255
+ body: { username, message },
256
+ });
257
+ console.log(chalk.green(' ✓ DM gönderildi!\n'));
258
+ if (result.message?.id) console.log(chalk.gray(` ID: ${result.message.id}\n`));
259
+ audit.log(audit.ACTIONS.INFO, { source: 'naturehub', action: 'dm', target: username });
260
+ } catch (e) {
261
+ console.log(chalk.red(` ✗ Hata: ${e.message}\n`));
262
+ }
263
+ }
264
+
265
+ async function cmdInbox(args) {
266
+ const token = getApiKey();
267
+ if (!token) {
268
+ console.log(chalk.yellow('\n ⚠️ API key tanımlı değil. Önce `natureco login` ile giriş yapın.\n'));
269
+ return;
270
+ }
271
+
272
+ const unreadOnly = args.includes('--unread') || args.includes('-u');
273
+ const limit = 20;
274
+
275
+ console.log(chalk.cyan(`\n 📬 Gelen Kutusu${unreadOnly ? ' (okunmamış)' : ''}\n`));
276
+
277
+ try {
278
+ const qs = unreadOnly ? '?unread=true' : '';
279
+ const result = await apiCall(`/dm/inbox${qs}`, { method: 'GET', token });
280
+ const messages = result.messages || [];
281
+
282
+ if (messages.length === 0) {
283
+ console.log(chalk.gray(' Henüz mesaj yok.\n'));
284
+ return;
285
+ }
286
+
287
+ for (const m of messages) {
288
+ const from = m.sender_name || m.sender_profile?.display_name || m.sender_profile?.username || 'Bilinmeyen';
289
+ const date = new Date(m.created_at).toLocaleString('tr-TR', { day: 'numeric', month: 'short', hour: '2-digit', minute: '2-digit' });
290
+ const badge = m.is_incoming && !m.read ? chalk.bgYellow(chalk.black(' YENİ ')) + ' ' : '';
291
+ const icon = m.is_incoming ? chalk.cyan('◀') : chalk.gray('▶');
292
+ console.log(` ${icon} ${chalk.bold(from)} ${chalk.gray(date)}`);
293
+ console.log(` ${badge}${(m.content || '').slice(0, 120)}${(m.content || '').length > 120 ? '...' : ''}`);
294
+ console.log('');
295
+ }
296
+ if (messages.length >= limit) {
297
+ console.log(chalk.gray(` Daha fazla mesaj olabilir. --offset ile devam edin.\n`));
298
+ }
299
+ audit.log(audit.ACTIONS.INFO, { source: 'naturehub', action: 'inbox', count: messages.length });
300
+ } catch (e) {
301
+ console.log(chalk.red(` ✗ Hata: ${e.message}\n`));
302
+ }
303
+ }
304
+
305
+ async function cmdForum(args) {
306
+ const text = args.join(' ').trim();
307
+ const titleMatch = text.match(/^"([^"]+)"\s*(.*)$/);
308
+ let title, content;
309
+
310
+ if (titleMatch) {
311
+ title = titleMatch[1].trim();
312
+ content = titleMatch[2].trim();
313
+ } else {
314
+ const parts = text.split(/\s+/);
315
+ title = parts[0];
316
+ content = parts.slice(1).join(' ');
317
+ }
318
+
319
+ if (!title || !content) {
320
+ console.log(chalk.red('\n Kullanım: natureco naturehub forum "<başlık>" <içerik>\n'));
321
+ return;
322
+ }
323
+
324
+ const token = getApiKey();
325
+ if (!token) {
326
+ console.log(chalk.yellow('\n ⚠️ API key tanımlı değil. Önce `natureco login` ile giriş yapın.\n'));
327
+ return;
328
+ }
329
+
330
+ console.log(chalk.cyan('\n 📤 Forum\'a gönderiliyor...\n'));
331
+ console.log(chalk.gray(` Başlık: ${title}\n`));
332
+
333
+ try {
334
+ const result = await apiCall('/forum', {
335
+ method: 'POST',
336
+ token,
337
+ body: { title, content },
338
+ });
339
+ console.log(chalk.green(' ✓ Forum\'a gönderildi!\n'));
340
+ if (result.post?.id) console.log(chalk.gray(` ID: ${result.post.id}\n`));
341
+ audit.log(audit.ACTIONS.INFO, { source: 'naturehub', action: 'forum' });
342
+ } catch (e) {
343
+ console.log(chalk.red(` ✗ Hata: ${e.message}\n`));
344
+ }
345
+ }
346
+
188
347
  async function naturehub(args) {
189
348
  const [action, ...params] = args || [];
190
349
  if (!action || action === 'help') {
191
350
  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'));
351
+ console.log(chalk.gray(' natureco naturehub post "<mesaj>" Bota mesaj gönder'));
352
+ console.log(chalk.gray(' natureco naturehub dm <user> "<mesaj>" DM gönder'));
353
+ console.log(chalk.gray(' natureco naturehub inbox [--unread] Gelen kutusu'));
354
+ console.log(chalk.gray(' natureco naturehub robot-house "<içerik>" Robot House gönderisi'));
355
+ console.log(chalk.gray(' natureco naturehub forum "<başlık>" <içerik> Forum gönderisi'));
356
+ console.log(chalk.gray(' natureco naturehub list Botları listele'));
357
+ console.log(chalk.gray(' natureco naturehub info [bot_id] Bot detayı'));
358
+ console.log(chalk.gray(' natureco naturehub config Ayarlar'));
196
359
  console.log('');
197
360
  return;
198
361
  }
199
362
  if (action === 'post') return cmdPost(params);
363
+ if (action === 'robot-house' || action === 'robot_house' || action === 'robothouse') return cmdRobotHouse(params);
364
+ if (action === 'forum') return cmdForum(params);
200
365
  if (action === 'list') return cmdList();
201
366
  if (action === 'info') return cmdInfo(params[0]);
202
367
  if (action === 'config') return cmdConfig();
368
+ if (action === 'dm') return cmdDm(params);
369
+ if (action === 'inbox') return cmdInbox(params);
203
370
  console.log(chalk.red(`\n Bilinmeyen action: ${action}\n`));
204
371
  }
205
372