natureco-cli 4.6.2 → 4.6.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "natureco-cli",
3
- "version": "4.6.2",
3
+ "version": "4.6.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"
@@ -1,40 +1,76 @@
1
1
  const chalk = require('chalk');
2
- const { getApiKey } = require('../utils/config');
2
+ const tui = require('../utils/tui');
3
+ const { getApiKey, getConfig } = require('../utils/config');
3
4
  const { getBots } = require('../utils/api');
4
5
 
5
6
  async function bots() {
6
- const { getConfig } = require('../utils/config');
7
7
  const config = getConfig();
8
8
  const apiKey = getApiKey() || config.providerApiKey || '';
9
9
 
10
- console.log(chalk.gray('\n Botlar yükleniyor...\n'));
10
+ console.log('\n' + tui.styled(' Botlar yükleniyor...', { color: tui.PALETTE.muted }));
11
11
 
12
12
  try {
13
- const botList = await getBots(apiKey);
13
+ // v4.6+: Eğer local provider varsa (api.minimax.io, api.groq.com),
14
+ // NatureCo backend yerine direkt provider config'den bot listele
15
+ let botList;
16
+ if (config.providerUrl && !config.providerUrl.includes('natureco.me') && config.bots) {
17
+ // Local provider — config'deki bot'ları kullan
18
+ const botsObj = config.bots || {};
19
+ const localBots = Object.values(botsObj).map(b => ({
20
+ id: b.id,
21
+ name: b.name,
22
+ ai_provider: b.provider || 'local',
23
+ model: b.model,
24
+ }));
25
+ if (config.botName) {
26
+ const defaultBot = {
27
+ id: 'default', name: config.botName,
28
+ ai_provider: config.providerUrl.includes('minimax') ? 'minimax' : 'openai-compatible',
29
+ model: config.providerModel,
30
+ };
31
+ if (!localBots.find(b => b.id === 'default')) localBots.unshift(defaultBot);
32
+ }
33
+ botList = { bots: localBots };
34
+ } else {
35
+ // Eski: NatureCo backend
36
+ botList = await getBots(apiKey);
37
+ }
14
38
 
15
39
  if (!botList || !botList.bots || botList.bots.length === 0) {
16
- console.log(chalk.gray(' Bot bulunamadı.'));
17
- console.log(chalk.gray(' Oluşturmak için: ') + chalk.cyan('developers.natureco.me\n'));
40
+ console.log('\n' + tui.C.muted(' Bot bulunamadı.'));
41
+ console.log(' ' + tui.C.muted('Oluşturmak için: ') + tui.C.brand('natureco setup') + ' ' + tui.C.muted('veya config\'e bot ekleyin.'));
42
+ console.log('');
18
43
  return;
19
44
  }
20
45
 
21
- console.log(chalk.gray(' ' + '─'.repeat(48)));
22
- console.log(chalk.cyan.bold('\n Botlarım\n'));
46
+ const rows = botList.bots.map((bot, i) => ({
47
+ idx: String(i + 1),
48
+ name: bot.name || '(isimsiz)',
49
+ id: bot.id,
50
+ provider: bot.ai_provider || bot.provider || '—',
51
+ model: bot.model || '—',
52
+ active: config.botName === bot.name,
53
+ }));
23
54
 
24
- botList.bots.forEach((bot, index) => {
25
- const active = config.botName === bot.name ? chalk.green(' aktif') : '';
26
- console.log(chalk.white(` ${index + 1}. ${bot.name}`) + active);
27
- console.log(chalk.gray(` ID : ${bot.id}`));
28
- console.log(chalk.gray(` Provider: ${bot.ai_provider || 'groq'}`));
29
- if (bot.model) console.log(chalk.gray(` Model : ${bot.model}`));
30
- console.log('');
31
- });
55
+ console.log('\n' + tui.styled(' 🤖 Bot Listesi (' + rows.length + ')', { color: tui.PALETTE.primary, bold: true }));
56
+ console.log(tui.styled(' ' + '─'.repeat(56), { color: tui.PALETTE.border }));
57
+ console.log('\n' + tui.table(rows, [
58
+ { key: 'idx', label: '#', minWidth: 4 },
59
+ {
60
+ key: 'name', label: 'İsim', minWidth: 18,
61
+ render: r => r.active
62
+ ? tui.styled(r.name + ' ●', { color: tui.PALETTE.success, bold: true })
63
+ : tui.C.text(r.name)
64
+ },
65
+ { key: 'id', label: 'ID', minWidth: 18, render: r => tui.C.muted(r.id) },
66
+ { key: 'provider', label: 'Provider', minWidth: 10, render: r => tui.C.text(r.provider) },
67
+ { key: 'model', label: 'Model', minWidth: 20, render: r => tui.C.muted(r.model) },
68
+ ], { borderStyle: 'round', zebra: true }));
32
69
 
33
- console.log(chalk.gray(' ' + ''.repeat(48)));
34
- console.log(chalk.gray(` Toplam: ${botList.bots.length} bot`));
35
- console.log(chalk.gray(' Chat başlatmak için: ') + chalk.cyan('natureco chat\n'));
70
+ console.log('\n ' + tui.C.muted('Chat başlatmak için: ') + tui.C.brand('natureco chat') + ' ' + tui.C.muted('veya ') + tui.C.brand('natureco repl'));
71
+ console.log('');
36
72
  } catch (err) {
37
- console.log(chalk.red(`\n ❌ Hata: ${err.message}\n`));
73
+ console.log('\n' + tui.C.red(' ❌ Hata: ' + err.message) + '\n');
38
74
  process.exit(1);
39
75
  }
40
76
  }
@@ -1,4 +1,5 @@
1
1
  const chalk = require('chalk');
2
+ const tui = require('../utils/tui');
2
3
  const F = require('../utils/format');
3
4
  const fs = require('fs');
4
5
  const path = require('path');
@@ -36,35 +37,52 @@ function cmdRun() {
36
37
  const failed = results.filter(r => r.status === 'fail').length;
37
38
  const warnings = results.filter(r => r.status === 'warn').length;
38
39
 
39
- F.header('Health Check');
40
-
41
- const statusMap = { pass: '✓', fail: '✗', warn: '⚠' };
42
- const rows = results.map(r => [
43
- r.label,
44
- statusMap[r.status] || '?',
45
- r.message,
46
- ]);
47
- F.table(['Check', 'Status', 'Detail'], rows);
48
-
49
- for (const r of results) {
50
- F.dot(r.status === 'pass', r.label);
51
- }
52
-
53
- const summary = `${passed} passed, ${warnings} warnings, ${failed} failed`;
40
+ console.log('\n' + tui.styled(' 🩺 Health Check', { color: tui.PALETTE.primary, bold: true }));
41
+ console.log(tui.styled(' ' + '─'.repeat(56), { color: tui.PALETTE.border }));
42
+
43
+ const rows = results.map(r => ({
44
+ label: r.label,
45
+ status: r.status,
46
+ message: r.message,
47
+ }));
48
+
49
+ console.log('\n' + tui.table(rows, [
50
+ { key: 'label', label: 'Check', minWidth: 18, render: r => tui.C.text(r.label) },
51
+ {
52
+ key: 'status', label: 'Durum', minWidth: 10,
53
+ render: r => r.status === 'pass'
54
+ ? tui.styled(' PASS ', { bg: tui.PALETTE.success, color: '#000', bold: true })
55
+ : r.status === 'fail'
56
+ ? tui.styled(' ✗ FAIL ', { bg: tui.PALETTE.danger, color: '#000', bold: true })
57
+ : tui.styled(' ⚠ WARN ', { bg: tui.PALETTE.warning, color: '#000', bold: true })
58
+ },
59
+ { key: 'message', label: 'Detay', minWidth: 30, render: r => tui.C.muted(r.message) },
60
+ ], { borderStyle: 'round', zebra: true }));
61
+
62
+ const summary = `${passed} geçti, ${warnings} uyarı, ${failed} hata`;
54
63
  if (failed > 0) {
55
- F.error(summary);
64
+ console.log('\n' + tui.styled(' ✗ ' + summary, { color: tui.PALETTE.danger, bold: true }));
56
65
  } else {
57
- F.success(summary);
66
+ console.log('\n' + tui.styled(' ✓ ' + summary, { color: tui.PALETTE.success, bold: true }));
58
67
  }
68
+ console.log('');
59
69
  }
60
70
 
61
71
  function cmdList() {
62
- F.list(Object.entries(CHECKS).map(([key, check]) => ({
63
- label: key,
64
- desc: `${check.label} — ${check.desc}`,
65
- })));
66
- F.info(`Run all: ${F.cmd('natureco health run')}`);
67
- F.info(`Run one: ${F.cmd('natureco health check <name>')}`);
72
+ console.log('\n' + tui.styled(' 🩺 Health Check Listesi', { color: tui.PALETTE.primary, bold: true }));
73
+ console.log(tui.styled(' ' + '─'.repeat(56), { color: tui.PALETTE.border }));
74
+
75
+ const rows = Object.entries(CHECKS).map(([key, check]) => ({
76
+ name: key, label: check.label, desc: check.desc,
77
+ }));
78
+ console.log('\n' + tui.table(rows, [
79
+ { key: 'name', label: 'İsim', minWidth: 12, render: r => tui.styled(r.name, { color: tui.PALETTE.primary, bold: true }) },
80
+ { key: 'label', label: 'Label', minWidth: 14, render: r => tui.C.text(r.label) },
81
+ { key: 'desc', label: 'Açıklama', minWidth: 30, render: r => tui.C.muted(r.desc) },
82
+ ], { borderStyle: 'round', zebra: true }));
83
+ console.log('\n ' + tui.C.muted('Hepsi: ') + tui.C.brand('natureco health run'));
84
+ console.log(' ' + tui.C.muted('Tek: ') + tui.C.brand('natureco health check <name>'));
85
+ console.log('');
68
86
  }
69
87
 
70
88
  function cmdCheck(name) {