natureco-cli 5.53.0 → 5.55.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/account.js +34 -30
- package/src/commands/ask.js +5 -3
- package/src/commands/chat.js +5 -3
- package/src/commands/cost.js +61 -58
- package/src/commands/help.js +230 -226
- package/src/commands/login.js +58 -55
- package/src/commands/memory-cmd.js +70 -68
- package/src/commands/models.js +623 -621
- package/src/commands/repl.js +11 -9
- package/src/commands/run.js +8 -6
- package/src/utils/dangerous.js +19 -14
package/src/commands/help.js
CHANGED
|
@@ -1,226 +1,230 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* natureco help — Modern TUI help screen (v4.6+)
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
const chalk = require('chalk');
|
|
9
|
-
const tui = require('../utils/tui');
|
|
10
|
-
const { getConfig } = require('../utils/config');
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
{ name: 'natureco
|
|
36
|
-
{ name: 'natureco
|
|
37
|
-
{ name: 'natureco
|
|
38
|
-
{ name: 'natureco
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
{ name: 'natureco
|
|
50
|
-
{ name: 'natureco
|
|
51
|
-
{ name: 'natureco
|
|
52
|
-
{ name: 'natureco
|
|
53
|
-
{ name: 'natureco
|
|
54
|
-
{ name: 'natureco
|
|
55
|
-
{ name: 'natureco
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
{ name: 'natureco
|
|
67
|
-
{ name: 'natureco
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
{ name: 'natureco cost
|
|
79
|
-
{ name: 'natureco cost
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
{ name: 'natureco
|
|
91
|
-
{ name: 'natureco
|
|
92
|
-
{ name: 'natureco
|
|
93
|
-
{ name: 'natureco
|
|
94
|
-
{ name: 'natureco
|
|
95
|
-
{ name: 'natureco
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
{ name: 'natureco
|
|
107
|
-
{ name: 'natureco
|
|
108
|
-
{ name: 'natureco
|
|
109
|
-
{ name: 'natureco
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
{ name: 'natureco skills
|
|
121
|
-
{ name: 'natureco
|
|
122
|
-
{ name: 'natureco
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
{ name: 'natureco
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
{ name: 'natureco
|
|
145
|
-
{ name: 'natureco
|
|
146
|
-
{ name: 'natureco
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
{ name: 'natureco
|
|
158
|
-
{ name: 'natureco
|
|
159
|
-
{ name: 'natureco
|
|
160
|
-
{ name: 'natureco
|
|
161
|
-
{ name: 'natureco
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
{ name: '/
|
|
173
|
-
{ name: '/
|
|
174
|
-
{ name: '/
|
|
175
|
-
{ name: '/
|
|
176
|
-
{ name: '/
|
|
177
|
-
{ name: '/
|
|
178
|
-
{ name: '/
|
|
179
|
-
{ name: '/
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
if (config.
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
console.log('');
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
1
|
+
/**
|
|
2
|
+
* natureco help — Modern TUI help screen (v4.6+)
|
|
3
|
+
*
|
|
4
|
+
* Categorized command list; uses the TUI box + table engine.
|
|
5
|
+
* Bilingual (tr|en) via the i18n `L(tr, en)` helper.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const chalk = require('chalk');
|
|
9
|
+
const tui = require('../utils/tui');
|
|
10
|
+
const { getConfig } = require('../utils/config');
|
|
11
|
+
const { getLang } = require('../utils/i18n');
|
|
12
|
+
|
|
13
|
+
const L = (tr, en) => (getLang() === 'en' ? en : tr);
|
|
14
|
+
|
|
15
|
+
function help() {
|
|
16
|
+
const config = getConfig() || {};
|
|
17
|
+
const version = require('../../package.json').version;
|
|
18
|
+
const width = 64;
|
|
19
|
+
|
|
20
|
+
console.log('');
|
|
21
|
+
|
|
22
|
+
// Header — TUI box
|
|
23
|
+
const headerLines = [
|
|
24
|
+
tui.styled(' ╭' + '─'.repeat(width) + '╮', { color: tui.PALETTE.primary }),
|
|
25
|
+
tui.styled(' │', { color: tui.PALETTE.primary }) + ' 🌿 ' + tui.styled('NatureCo CLI', { color: tui.PALETTE.primary, bold: true }) + tui.C.muted(' v' + version) + ' ' + tui.C.muted('Terminal-native AI agent') + tui.styled(' │', { color: tui.PALETTE.primary }),
|
|
26
|
+
tui.styled(' ╰' + '─'.repeat(width) + '╯', { color: tui.PALETTE.primary }),
|
|
27
|
+
];
|
|
28
|
+
console.log(headerLines.join('\n'));
|
|
29
|
+
|
|
30
|
+
const sections = [
|
|
31
|
+
{
|
|
32
|
+
icon: '⚙️ ',
|
|
33
|
+
title: L('Kurulum & Giriş', 'Setup & Sign-in'),
|
|
34
|
+
rows: [
|
|
35
|
+
{ name: 'natureco setup', desc: L('İlk kurulum sihirbazı (provider, bot)', 'First-run wizard (provider, bot)') },
|
|
36
|
+
{ name: 'natureco login', desc: L('API key ile giriş yap', 'Sign in with an API key') },
|
|
37
|
+
{ name: 'natureco account', desc: L('NatureCo hesabı / SSO (login|logout|whoami)', 'NatureCo account / SSO (login|logout|whoami)') },
|
|
38
|
+
{ name: 'natureco lang', desc: L('Arayüz dili (tr | en)', 'Interface language (tr | en)') },
|
|
39
|
+
{ name: 'natureco logout', desc: L('Çıkış yap', 'Sign out') },
|
|
40
|
+
{ name: 'natureco update', desc: L('Yeni versiyon kontrolü', 'Check for a new version') },
|
|
41
|
+
{ name: 'natureco doctor', desc: L('Sistem sağlığı kontrolü (10 check)', 'System health check (10 checks)') },
|
|
42
|
+
{ name: 'natureco status', desc: L('Sistem durumu (TUI kart)', 'System status (TUI card)') },
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
icon: '💬',
|
|
47
|
+
title: 'Chat & Agent',
|
|
48
|
+
rows: [
|
|
49
|
+
{ name: 'natureco chat', desc: L('Sohbet başlat (→ REPL engine)', 'Start a chat (→ REPL engine)') },
|
|
50
|
+
{ name: 'natureco chat <bot>', desc: L('Belirli bot ile sohbet', 'Chat with a specific bot') },
|
|
51
|
+
{ name: 'natureco chat --resume', desc: L('Son oturuma dön', 'Resume the last session') },
|
|
52
|
+
{ name: 'natureco repl', desc: L('İnteraktif REPL (persistent memory)', 'Interactive REPL (persistent memory)') },
|
|
53
|
+
{ name: 'natureco repl --resume <id>', desc: L('Önceki oturumu yükle', 'Load a previous session') },
|
|
54
|
+
{ name: 'natureco ask "<soru>"', desc: L('Tek seferlik soru', 'One-off question') },
|
|
55
|
+
{ name: 'natureco code <file>', desc: L('Code agent (Claude Code alternatifi)', 'Code agent (Claude Code alternative)') },
|
|
56
|
+
{ name: 'natureco run <script.md>', desc: L('Markdown script çalıştır', 'Run a Markdown script') },
|
|
57
|
+
{ name: 'natureco bots', desc: L('Bot listesi', 'List bots') },
|
|
58
|
+
{ name: 'natureco team list', desc: L('Multi-agent tipleri (8 uzman)', 'Multi-agent types (8 specialists)') },
|
|
59
|
+
{ name: 'natureco team spawn <type> <task>', desc: L('Sub-agent çalıştır', 'Run a sub-agent') },
|
|
60
|
+
],
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
icon: '🛡️ ',
|
|
64
|
+
title: L('Güvenlik & Gözlem', 'Security & Observability'),
|
|
65
|
+
rows: [
|
|
66
|
+
{ name: 'natureco audit today', desc: L('Bugünkü loglar', "Today's logs") },
|
|
67
|
+
{ name: 'natureco audit stats', desc: L('24 saat istatistik', '24-hour statistics') },
|
|
68
|
+
{ name: 'natureco audit files', desc: L('Log dosyaları', 'Log files') },
|
|
69
|
+
{ name: 'natureco audit search <q>', desc: L('Log ara', 'Search logs') },
|
|
70
|
+
{ name: 'natureco security audit', desc: L('Güvenlik denetimi', 'Security audit') },
|
|
71
|
+
{ name: 'natureco doctor check <name>', desc: L('Tek sağlık check', 'Single health check') },
|
|
72
|
+
],
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
icon: '💰',
|
|
76
|
+
title: L('Maliyet', 'Cost'),
|
|
77
|
+
rows: [
|
|
78
|
+
{ name: 'natureco cost today', desc: L('Bugünkü maliyet', "Today's cost") },
|
|
79
|
+
{ name: 'natureco cost week', desc: L('Bu hafta', 'This week') },
|
|
80
|
+
{ name: 'natureco cost month', desc: L('Bu ay', 'This month') },
|
|
81
|
+
{ name: 'natureco cost budget', desc: L('Bütçe durumu', 'Budget status') },
|
|
82
|
+
{ name: 'natureco cost prices', desc: L('Model fiyatları (21+ model)', 'Model prices (21+ models)') },
|
|
83
|
+
{ name: 'natureco cost model "<prompt>"', desc: L('Model önerisi (router)', 'Model recommendation (router)') },
|
|
84
|
+
],
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
icon: '🌐',
|
|
88
|
+
title: L('Entegrasyonlar (10 kanal)', 'Integrations (10 channels)'),
|
|
89
|
+
rows: [
|
|
90
|
+
{ name: 'natureco telegram connect', desc: L('Telegram bot bağla', 'Connect a Telegram bot') },
|
|
91
|
+
{ name: 'natureco whatsapp connect', desc: L('WhatsApp QR ile bağla', 'Connect WhatsApp via QR') },
|
|
92
|
+
{ name: 'natureco discord connect', desc: L('Discord bot bağla', 'Connect a Discord bot') },
|
|
93
|
+
{ name: 'natureco slack connect', desc: L('Slack workspace bağla', 'Connect a Slack workspace') },
|
|
94
|
+
{ name: 'natureco signal connect', desc: L('Signal REST API', 'Signal REST API') },
|
|
95
|
+
{ name: 'natureco irc connect', desc: L('IRC sunucusu', 'IRC server') },
|
|
96
|
+
{ name: 'natureco mattermost connect', desc: L('Mattermost bot', 'Mattermost bot') },
|
|
97
|
+
{ name: 'natureco imessage connect', desc: L('iMessage bridge', 'iMessage bridge') },
|
|
98
|
+
{ name: 'natureco sms connect', desc: L('Twilio SMS', 'Twilio SMS') },
|
|
99
|
+
{ name: 'natureco webhooks connect', desc: L('Webhook ekle', 'Add a webhook') },
|
|
100
|
+
],
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
icon: '🌿',
|
|
104
|
+
title: 'NatureCo Native',
|
|
105
|
+
rows: [
|
|
106
|
+
{ name: 'natureco naturehub post "<text>"', desc: L('NatureCo API ile bota mesaj gönder', 'Send a message to a bot via the NatureCo API') },
|
|
107
|
+
{ name: 'natureco naturehub list', desc: L('Botlarını listele', 'List your bots') },
|
|
108
|
+
{ name: 'natureco naturehub info [bot_id]', desc: L('Bot detayı', 'Bot details') },
|
|
109
|
+
{ name: 'natureco medium draft <file.md>', desc: L('Medium makale taslağı', 'Medium article draft') },
|
|
110
|
+
{ name: 'natureco medium publish <file.md>', desc: L("Medium'da yayınla", 'Publish to Medium') },
|
|
111
|
+
{ name: 'natureco seo audit <url>', desc: L('SEO denetimi (skor 0-100)', 'SEO audit (score 0-100)') },
|
|
112
|
+
{ name: 'natureco xp', desc: L('XP/Level durumu', 'XP / level status') },
|
|
113
|
+
{ name: 'natureco xp rewards', desc: L('Ödül listesi', 'Rewards list') },
|
|
114
|
+
],
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
icon: '📊',
|
|
118
|
+
title: 'Skill & MCP',
|
|
119
|
+
rows: [
|
|
120
|
+
{ name: 'natureco skills list', desc: L("Yüklü skill'ler", 'Installed skills') },
|
|
121
|
+
{ name: 'natureco skills suggest', desc: L('Self-evolving öneriler', 'Self-evolving suggestions') },
|
|
122
|
+
{ name: 'natureco skills accept <id>', desc: L('Öneriyi kabul et', 'Accept a suggestion') },
|
|
123
|
+
{ name: 'natureco skills reject <id>', desc: L('Öneriyi reddet', 'Reject a suggestion') },
|
|
124
|
+
{ name: 'natureco skills install <slug>', desc: L("NatureHub'dan yükle", 'Install from NatureHub') },
|
|
125
|
+
{ name: 'natureco mcp list', desc: L('MCP sunucuları', 'MCP servers') },
|
|
126
|
+
{ name: 'natureco mcp add <name>', desc: L('MCP sunucusu ekle', 'Add an MCP server') },
|
|
127
|
+
],
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
icon: '⏰',
|
|
131
|
+
title: L('Otomasyon & Dashboard', 'Automation & Dashboard'),
|
|
132
|
+
rows: [
|
|
133
|
+
{ name: 'natureco cron list', desc: L('Cron görevleri', 'Cron jobs') },
|
|
134
|
+
{ name: 'natureco cron add', desc: L('Cron ekle', 'Add a cron job') },
|
|
135
|
+
{ name: 'natureco hooks create <tip>', desc: L('Hook oluştur', 'Create a hook') },
|
|
136
|
+
{ name: 'natureco dashboard', desc: L('Web dashboard (port 7421)', 'Web dashboard (port 7421)') },
|
|
137
|
+
{ name: 'natureco gateway start', desc: L('Gateway arka plan', 'Gateway (background)') },
|
|
138
|
+
],
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
icon: '⚙️ ',
|
|
142
|
+
title: L('Yapılandırma', 'Configuration'),
|
|
143
|
+
rows: [
|
|
144
|
+
{ name: 'natureco config list', desc: L('Tüm ayarlar', 'All settings') },
|
|
145
|
+
{ name: 'natureco config set <key> <val>', desc: L('Ayar değiştir', 'Change a setting') },
|
|
146
|
+
{ name: 'natureco configure', desc: L('İnteraktif yapılandırma', 'Interactive configuration') },
|
|
147
|
+
{ name: 'natureco sessions list', desc: L('Geçmiş oturumlar', 'Past sessions') },
|
|
148
|
+
{ name: 'natureco sessions show <id>', desc: L('Oturum detayı', 'Session details') },
|
|
149
|
+
{ name: 'natureco memory', desc: L('Memory yönetimi', 'Memory management') },
|
|
150
|
+
{ name: 'natureco init', desc: L('Proje başlat (.natureco/)', 'Initialize a project (.natureco/)') },
|
|
151
|
+
],
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
icon: '🛠️ ',
|
|
155
|
+
title: L('Diğer', 'Other'),
|
|
156
|
+
rows: [
|
|
157
|
+
{ name: 'natureco agents list', desc: L('Agent listesi', 'List agents') },
|
|
158
|
+
{ name: 'natureco models list', desc: L('Model listesi', 'List models') },
|
|
159
|
+
{ name: 'natureco channels', desc: L('Bağlı kanallar', 'Connected channels') },
|
|
160
|
+
{ name: 'natureco logs', desc: L('Gateway logları', 'Gateway logs') },
|
|
161
|
+
{ name: 'natureco tasks list', desc: L('Arka plan görevleri', 'Background tasks') },
|
|
162
|
+
{ name: 'natureco nodes', desc: L('Network nodes', 'Network nodes') },
|
|
163
|
+
{ name: 'natureco security', desc: L('Güvenlik denetimi', 'Security audit') },
|
|
164
|
+
{ name: 'natureco reset', desc: L('Sıfırla', 'Reset') },
|
|
165
|
+
{ name: 'natureco uninstall', desc: L('Kaldır', 'Uninstall') },
|
|
166
|
+
],
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
icon: '💬',
|
|
170
|
+
title: L('REPL İçi Komutlar (chat/repl)', 'In-REPL commands (chat/repl)'),
|
|
171
|
+
rows: [
|
|
172
|
+
{ name: '/help', desc: L('Yardım', 'Help') },
|
|
173
|
+
{ name: '/clear', desc: L('Ekranı temizle', 'Clear the screen') },
|
|
174
|
+
{ name: '/memory', desc: L("Memory'i göster", 'Show memory') },
|
|
175
|
+
{ name: '/forget', desc: L("Memory'i sil", 'Clear memory') },
|
|
176
|
+
{ name: '/sessions', desc: L('Geçmiş oturumlar', 'Past sessions') },
|
|
177
|
+
{ name: '/resume [id|last]', desc: L('Önceki oturuma dön', 'Resume a previous session') },
|
|
178
|
+
{ name: '/system <text>', desc: L('System prompt', 'System prompt') },
|
|
179
|
+
{ name: '/model <name>', desc: L('Model değiştir', 'Switch model') },
|
|
180
|
+
{ name: '/identity [ad]', desc: L('Bot adı değiştir', 'Rename the bot') },
|
|
181
|
+
{ name: '/tokens', desc: L('Token kullanımı', 'Token usage') },
|
|
182
|
+
{ name: '/doctor, /cost, /audit, /team, /xp', desc: L('REPL içinden TUI komutlar', 'TUI commands from inside the REPL') },
|
|
183
|
+
{ name: '/save, /exit, /quit', desc: L('Kaydet / Çıkış', 'Save / Exit') },
|
|
184
|
+
],
|
|
185
|
+
},
|
|
186
|
+
];
|
|
187
|
+
|
|
188
|
+
for (const section of sections) {
|
|
189
|
+
console.log('\n' + tui.styled(` ${section.icon} ${section.title}`, { color: tui.PALETTE.secondary, bold: true }));
|
|
190
|
+
console.log(tui.styled(' ' + '─'.repeat(56), { color: tui.PALETTE.border }));
|
|
191
|
+
console.log('\n' + tui.table(section.rows, [
|
|
192
|
+
{ key: 'name', label: L('Komut', 'Command'), minWidth: 36, render: r => tui.styled(r.name, { color: tui.PALETTE.primary, bold: true }) },
|
|
193
|
+
{ key: 'desc', label: L('Açıklama', 'Description'), minWidth: 35, render: r => tui.C.muted(r.desc) },
|
|
194
|
+
], { borderStyle: 'round', zebra: false }));
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// Current config (if any)
|
|
198
|
+
if (config.providerUrl || config.botName) {
|
|
199
|
+
console.log('\n' + tui.styled(' ⚙️ ' + L('Mevcut Yapılandırma', 'Current Configuration'), { color: tui.PALETTE.accent, bold: true }));
|
|
200
|
+
console.log(tui.styled(' ' + '─'.repeat(56), { color: tui.PALETTE.border }));
|
|
201
|
+
const cardW = 54;
|
|
202
|
+
const cardLines = [
|
|
203
|
+
tui.styled(' ╭' + '─'.repeat(cardW) + '╮', { color: tui.PALETTE.border }),
|
|
204
|
+
];
|
|
205
|
+
if (config.providerUrl) {
|
|
206
|
+
const provider = config.providerUrl.replace('https?:\/\/', '').split('/')[0];
|
|
207
|
+
cardLines.push(tui.styled(' │ ', { color: tui.PALETTE.border }) + tui.C.muted('Provider ') + tui.styled(provider.padEnd(38), { color: tui.PALETTE.text, bold: true }) + tui.styled(' │', { color: tui.PALETTE.border }));
|
|
208
|
+
}
|
|
209
|
+
if (config.providerModel) {
|
|
210
|
+
cardLines.push(tui.styled(' │ ', { color: tui.PALETTE.border }) + tui.C.muted('Model ') + tui.styled((config.providerModel || '—').padEnd(38), { color: tui.PALETTE.primary, bold: true }) + tui.styled(' │', { color: tui.PALETTE.border }));
|
|
211
|
+
}
|
|
212
|
+
if (config.botName) {
|
|
213
|
+
cardLines.push(tui.styled(' │ ', { color: tui.PALETTE.border }) + tui.C.muted('Bot ') + tui.styled((config.botName || '—').padEnd(38), { color: tui.PALETTE.text }) + tui.styled(' │', { color: tui.PALETTE.border }));
|
|
214
|
+
}
|
|
215
|
+
if (config.userName) {
|
|
216
|
+
cardLines.push(tui.styled(' │ ', { color: tui.PALETTE.border }) + tui.C.muted(L('Kullanıcı ', 'User ')) + tui.styled((config.userName || '—').padEnd(38), { color: tui.PALETTE.text }) + tui.styled(' │', { color: tui.PALETTE.border }));
|
|
217
|
+
}
|
|
218
|
+
cardLines.push(tui.styled(' ╰' + '─'.repeat(cardW) + '╯', { color: tui.PALETTE.border }));
|
|
219
|
+
console.log(cardLines.join('\n'));
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// Links
|
|
223
|
+
console.log('\n' + tui.styled(' 🔗 ' + L('Kaynaklar', 'Resources'), { color: tui.PALETTE.secondary, bold: true }));
|
|
224
|
+
console.log(' ' + tui.C.muted(L('Döküman ', 'Docs ')) + tui.C.brand('https://natureco.me/cli'));
|
|
225
|
+
console.log(' ' + tui.C.muted('SDK ') + tui.C.brand('https://natureco.me/developer'));
|
|
226
|
+
console.log(' ' + tui.C.muted('npm ') + tui.C.brand('https://npmjs.com/package/natureco-cli'));
|
|
227
|
+
console.log('');
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
module.exports = help;
|
package/src/commands/login.js
CHANGED
|
@@ -1,55 +1,58 @@
|
|
|
1
|
-
const inquirer = require('../utils/inquirer-wrapper');
|
|
2
|
-
const chalk = require('chalk');
|
|
3
|
-
const { saveApiKey } = require('../utils/config');
|
|
4
|
-
const { validateApiKey } = require('../utils/api');
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
console.
|
|
11
|
-
|
|
12
|
-
console.log(
|
|
13
|
-
console.log('');
|
|
14
|
-
console.log(chalk.green.bold('
|
|
15
|
-
console.log(chalk.
|
|
16
|
-
console.log(
|
|
17
|
-
console.log('');
|
|
18
|
-
console.log(chalk.gray(' API key
|
|
19
|
-
console.log('');
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
console.log(chalk.
|
|
52
|
-
console.log('');
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
1
|
+
const inquirer = require('../utils/inquirer-wrapper');
|
|
2
|
+
const chalk = require('chalk');
|
|
3
|
+
const { saveApiKey } = require('../utils/config');
|
|
4
|
+
const { validateApiKey } = require('../utils/api');
|
|
5
|
+
const { getLang } = require('../utils/i18n');
|
|
6
|
+
|
|
7
|
+
const L = (tr, en) => (getLang() === 'en' ? en : tr);
|
|
8
|
+
|
|
9
|
+
async function login() {
|
|
10
|
+
console.clear();
|
|
11
|
+
|
|
12
|
+
console.log('');
|
|
13
|
+
console.log(chalk.green.bold(' (\\_/)'));
|
|
14
|
+
console.log(chalk.green.bold(' (•ᴥ•)'));
|
|
15
|
+
console.log(chalk.green(' />🌿'));
|
|
16
|
+
console.log('');
|
|
17
|
+
console.log(chalk.green.bold(' ' + L('NatureCo CLI — Giriş', 'NatureCo CLI — Sign in')));
|
|
18
|
+
console.log(chalk.gray(' ' + L("API key'ini gir ve başla.", 'Enter your API key to get started.') + '\n'));
|
|
19
|
+
console.log(chalk.gray(' ' + '─'.repeat(48)));
|
|
20
|
+
console.log('');
|
|
21
|
+
console.log(chalk.gray(' ' + L('API key almak için: ', 'Get an API key at: ')) + chalk.cyan('developers.natureco.me'));
|
|
22
|
+
console.log('');
|
|
23
|
+
|
|
24
|
+
const { apiKey } = await inquirer.prompt([{
|
|
25
|
+
type: 'password',
|
|
26
|
+
name: 'apiKey',
|
|
27
|
+
message: ' API Key:',
|
|
28
|
+
mask: '*',
|
|
29
|
+
validate: (v) => {
|
|
30
|
+
if (!v.trim()) return L('API key boş olamaz', "API key can't be empty");
|
|
31
|
+
return true;
|
|
32
|
+
},
|
|
33
|
+
}]);
|
|
34
|
+
|
|
35
|
+
console.log('');
|
|
36
|
+
console.log(chalk.gray(' ' + L('Doğrulanıyor...', 'Verifying...')));
|
|
37
|
+
|
|
38
|
+
const result = await validateApiKey(apiKey.trim());
|
|
39
|
+
|
|
40
|
+
if (!result.valid) {
|
|
41
|
+
console.log(chalk.red(`\n ❌ ${result.error || L('Geçersiz API key', 'Invalid API key')}\n`));
|
|
42
|
+
process.exit(1);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (result.user?.email) {
|
|
46
|
+
console.log(chalk.gray(` ${L('Hoş geldin,', 'Welcome,')} ${chalk.white(result.user.email)}`));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
saveApiKey(apiKey.trim());
|
|
50
|
+
|
|
51
|
+
console.log(chalk.green('\n ✓ ' + L('Giriş başarılı!', 'Signed in!')));
|
|
52
|
+
console.log(chalk.gray(' Config: ~/.natureco/config.json'));
|
|
53
|
+
console.log('');
|
|
54
|
+
console.log(chalk.gray(' ' + L('Başlamak için: ', 'To get started: ')) + chalk.cyan('natureco chat'));
|
|
55
|
+
console.log('');
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
module.exports = login;
|