natureco-cli 4.6.8 → 4.7.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/gateway.js +28 -15
- package/src/commands/nodes.js +21 -13
- package/src/commands/setup.js +40 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "natureco-cli",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.7.0",
|
|
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"
|
package/src/commands/gateway.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
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');
|
|
5
6
|
const os = require('os');
|
|
6
|
-
const
|
|
7
|
+
const { spawn } = require('child_process');
|
|
7
8
|
const { getConfig, CONFIG_FILE } = require('../utils/config');
|
|
8
9
|
const { getSkills } = require('../utils/skills');
|
|
9
10
|
const { getMcpServers } = require('../utils/mcp');
|
|
@@ -25,26 +26,38 @@ async function gateway(action, ...args) {
|
|
|
25
26
|
F.info('Usage: natureco gateway call <method> [params...]');
|
|
26
27
|
return;
|
|
27
28
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
console.log('\n' + tui.styled(' 🌐 Gateway RPC Call', { color: tui.PALETTE.primary, bold: true }));
|
|
30
|
+
const cardW = 50;
|
|
31
|
+
console.log(tui.styled(' ╭' + '─'.repeat(cardW) + '╮', { color: tui.PALETTE.border }));
|
|
32
|
+
console.log(tui.styled(' │ ', { color: tui.PALETTE.border }) + tui.C.muted('Method ') + tui.styled(method.padEnd(40), { color: tui.PALETTE.text, bold: true }) + tui.styled(' │', { color: tui.PALETTE.border }));
|
|
33
|
+
console.log(tui.styled(' │ ', { color: tui.PALETTE.border }) + tui.C.muted('Parameters ') + tui.styled((params.length ? params.join(', ') : '(none)').padEnd(40).slice(0, 40), { color: tui.PALETTE.text }) + tui.styled(' │', { color: tui.PALETTE.border }));
|
|
34
|
+
console.log(tui.styled(' │ ', { color: tui.PALETTE.border }) + tui.C.muted('Status ') + tui.styled('MOCK — no real gateway running'.padEnd(40), { color: tui.PALETTE.warning, bold: true }) + tui.styled(' │', { color: tui.PALETTE.border }));
|
|
35
|
+
console.log(tui.styled(' ╰' + '─'.repeat(cardW) + '╯', { color: tui.PALETTE.border }));
|
|
36
|
+
console.log('\n ' + tui.C.muted('Response: ') + tui.styled('{ ok: true, result: "mock response" }', { color: tui.PALETTE.success }));
|
|
37
|
+
console.log('');
|
|
32
38
|
return;
|
|
33
39
|
}
|
|
34
40
|
|
|
35
41
|
if (action === 'usage-cost') {
|
|
36
42
|
const config = getConfig();
|
|
37
43
|
const provider = config?.providerUrl?.replace('https://', '').split('/')[0] || 'unknown';
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
console.log('\n' + tui.styled(' 💰 Gateway Usage Cost', { color: tui.PALETTE.primary, bold: true }));
|
|
45
|
+
console.log(tui.styled(' ' + '─'.repeat(56), { color: tui.PALETTE.border }));
|
|
46
|
+
|
|
47
|
+
const rows = [
|
|
48
|
+
{ metric: 'Provider', value: provider },
|
|
49
|
+
{ metric: 'Model', value: config?.providerModel || 'default' },
|
|
50
|
+
{ metric: 'API Key', value: config?.apiKey ? config.apiKey.slice(0, 8) + '...' : 'N/A' },
|
|
51
|
+
{ metric: 'Tokens In', value: '~0 (mock)' },
|
|
52
|
+
{ metric: 'Tokens Out', value: '~0 (mock)' },
|
|
53
|
+
{ metric: 'Estimated', value: '$0.00 (mock)' },
|
|
54
|
+
];
|
|
55
|
+
console.log('\n' + tui.table(rows, [
|
|
56
|
+
{ key: 'metric', label: 'Metrik', minWidth: 16, render: r => tui.C.text(r.metric) },
|
|
57
|
+
{ key: 'value', label: 'Değer', minWidth: 30, render: r => tui.C.muted(r.value) },
|
|
58
|
+
], { borderStyle: 'round', zebra: true }));
|
|
59
|
+
console.log('\n ' + tui.C.muted('No real gateway running — costs will be tracked once started.'));
|
|
60
|
+
console.log('');
|
|
48
61
|
return;
|
|
49
62
|
}
|
|
50
63
|
|
package/src/commands/nodes.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
const chalk = require('chalk');
|
|
2
|
+
const tui = require('../utils/tui');
|
|
2
3
|
const F = require('../utils/format');
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
const os = require('os');
|
|
6
7
|
function nodes(args) {
|
|
7
8
|
const [action, ...params] = args || [];
|
|
8
9
|
|
|
@@ -164,21 +165,28 @@ function listNodes() {
|
|
|
164
165
|
const config = getConfig();
|
|
165
166
|
const nodes = config.pairedNodes || [];
|
|
166
167
|
|
|
167
|
-
|
|
168
|
+
console.log('\n' + tui.styled(' 🌐 Nodes', { color: tui.PALETTE.primary, bold: true }));
|
|
169
|
+
console.log(tui.styled(' ' + '─'.repeat(56), { color: tui.PALETTE.border }));
|
|
168
170
|
|
|
169
171
|
if (nodes.length === 0) {
|
|
170
|
-
|
|
172
|
+
console.log('\n ' + tui.C.muted('No paired nodes.'));
|
|
173
|
+
console.log('');
|
|
171
174
|
return;
|
|
172
175
|
}
|
|
173
176
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
177
|
+
const rows = nodes.map(n => ({
|
|
178
|
+
id: n.id, name: n.name || n.id, status: 'online (mock)', lastSeen: n.pairedAt || '-',
|
|
179
|
+
}));
|
|
180
|
+
console.log('\n' + tui.table(rows, [
|
|
181
|
+
{ key: 'id', label: 'ID', minWidth: 14, render: r => tui.C.muted(r.id) },
|
|
182
|
+
{ key: 'name', label: 'İsim', minWidth: 14, render: r => tui.styled(r.name, { color: tui.PALETTE.primary, bold: true }) },
|
|
183
|
+
{
|
|
184
|
+
key: 'status', label: 'Durum', minWidth: 12,
|
|
185
|
+
render: r => tui.styled(' ✓ Online ', { bg: tui.PALETTE.success, color: '#000', bold: true })
|
|
186
|
+
},
|
|
187
|
+
{ key: 'lastSeen', label: 'Son Görülme', minWidth: 18, render: r => tui.C.muted(r.lastSeen) },
|
|
188
|
+
], { borderStyle: 'round', zebra: true }));
|
|
189
|
+
console.log('');
|
|
182
190
|
}
|
|
183
191
|
|
|
184
192
|
function pairNode(url) {
|
package/src/commands/setup.js
CHANGED
|
@@ -127,7 +127,44 @@ async function cmdWizard() {
|
|
|
127
127
|
cfg.providerApiKey = apiKey;
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
// Step 3:
|
|
130
|
+
// Step 3: Bot & User identity
|
|
131
|
+
console.log('');
|
|
132
|
+
console.log(chalk.white(' Step 3: Bot & Kullanıcı'));
|
|
133
|
+
console.log(chalk.gray(' ─────────────────────────────────────────────'));
|
|
134
|
+
const userName = await rlQuestion(` Sizin adınız (${cfg.userName || 'gencay'}): `);
|
|
135
|
+
if (userName) cfg.userName = userName;
|
|
136
|
+
const botName = await rlQuestion(` Bot adı (${cfg.botName || 'İchigo'}): `);
|
|
137
|
+
if (botName) cfg.botName = botName;
|
|
138
|
+
|
|
139
|
+
// Step 4: Kanal Entegrasyonları (isteğe bağlı, isteyen atlayabilir)
|
|
140
|
+
console.log('');
|
|
141
|
+
console.log(chalk.white(' Step 4: Kanal Entegrasyonları (opsiyonel)'));
|
|
142
|
+
console.log(chalk.gray(' ─────────────────────────────────────────────'));
|
|
143
|
+
console.log(chalk.gray(' Telegram, WhatsApp, Discord, Slack bağlamak ister misiniz?'));
|
|
144
|
+
console.log(chalk.gray(' Atlamak için hepsini boş bırakın, sonra: natureco <kanal> connect\n'));
|
|
145
|
+
|
|
146
|
+
const integrations = [
|
|
147
|
+
{ key: 'telegramToken', name: 'Telegram', hint: 'BotFather\'dan al (@BotFather → /newbot → token)' },
|
|
148
|
+
{ key: 'whatsappPhone', name: 'WhatsApp', hint: 'Telefon numaranızı girin (örn: +905422842631)' },
|
|
149
|
+
{ key: 'discordToken', name: 'Discord', hint: 'Discord bot token (Discord Developer Portal)' },
|
|
150
|
+
{ key: 'slackToken', name: 'Slack', hint: 'Slack bot token (api.slack.com/apps)' },
|
|
151
|
+
];
|
|
152
|
+
|
|
153
|
+
for (const integ of integrations) {
|
|
154
|
+
const current = cfg[integ.key] || '';
|
|
155
|
+
if (current) {
|
|
156
|
+
console.log(chalk.gray(` ${integ.name}: zaten ayarlı, boş bırakırsanız korunur`));
|
|
157
|
+
} else {
|
|
158
|
+
console.log(chalk.gray(` ${integ.hint}`));
|
|
159
|
+
}
|
|
160
|
+
const val = await rlQuestion(` ${integ.name} ${current ? '(mevcut - boş bırakın)' : '(boş = atla)'}: `);
|
|
161
|
+
if (val) {
|
|
162
|
+
cfg[integ.key] = val;
|
|
163
|
+
console.log(chalk.green(` ✓ ${integ.name} ayarlandı`));
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// Save
|
|
131
168
|
cfg.providerUrl = providerUrl;
|
|
132
169
|
cfg.providerModel = providerModel;
|
|
133
170
|
cfg.setupCompleted = true;
|
|
@@ -145,7 +182,8 @@ async function cmdWizard() {
|
|
|
145
182
|
console.log('');
|
|
146
183
|
console.log(chalk.white(' Next steps:'));
|
|
147
184
|
console.log(chalk.cyan(' natureco chat Start chatting'));
|
|
148
|
-
console.log(chalk.cyan(' natureco
|
|
185
|
+
console.log(chalk.cyan(' natureco repl İnteraktif REPL (persistent memory)'));
|
|
186
|
+
console.log(chalk.cyan(' natureco telegram connect Telegram bot bağla (henüz yapılmadıysa)'));
|
|
149
187
|
console.log(chalk.cyan(' natureco help View all commands'));
|
|
150
188
|
console.log('');
|
|
151
189
|
}
|