natureco-cli 2.16.2 → 2.16.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 +1 -1
- package/src/commands/dashboard.js +2 -2
- package/src/commands/doctor.js +23 -17
- package/src/commands/gateway.js +38 -71
- package/src/commands/help.js +130 -73
- package/src/commands/login.js +37 -28
package/package.json
CHANGED
|
@@ -211,7 +211,7 @@ body::before{
|
|
|
211
211
|
<div class="header-bot-name" id="header-bot-name">Nature Bot</div>
|
|
212
212
|
<div class="header-bot-model" id="header-bot-model">NatureCo</div>
|
|
213
213
|
</div>
|
|
214
|
-
<div class="version-badge" id="version-badge">v2.16.
|
|
214
|
+
<div class="version-badge" id="version-badge">v2.16.4</div>
|
|
215
215
|
</div>
|
|
216
216
|
<div class="messages" id="messages"></div>
|
|
217
217
|
<div class="input-area">
|
|
@@ -341,7 +341,7 @@ function dashboard(action) {
|
|
|
341
341
|
apiKey: cfg.apiKey,
|
|
342
342
|
defaultBot: cfg.defaultBot,
|
|
343
343
|
defaultBotId: cfg.defaultBotId,
|
|
344
|
-
version: 'v2.16.
|
|
344
|
+
version: 'v2.16.4',
|
|
345
345
|
bots: cfg.bots || [],
|
|
346
346
|
telegramToken: cfg.telegramToken || null,
|
|
347
347
|
whatsappConnected: cfg.whatsappConnected || false,
|
package/src/commands/doctor.js
CHANGED
|
@@ -9,7 +9,17 @@ const { getSkills } = require('../utils/skills');
|
|
|
9
9
|
async function doctor(options) {
|
|
10
10
|
const shouldFix = options && (options.includes('--fix') || options.includes('-f'));
|
|
11
11
|
|
|
12
|
-
console.
|
|
12
|
+
console.clear();
|
|
13
|
+
console.log('');
|
|
14
|
+
console.log(chalk.green.bold(' (\\_/)'));
|
|
15
|
+
console.log(chalk.green.bold(' (•ᴥ•)'));
|
|
16
|
+
console.log(chalk.green(' />🌿'));
|
|
17
|
+
console.log('');
|
|
18
|
+
console.log(chalk.green.bold(' NatureCo CLI — Sistem Kontrolü'));
|
|
19
|
+
if (shouldFix) console.log(chalk.yellow(' --fix modu aktif\n'));
|
|
20
|
+
else console.log(chalk.gray(' Sorunları otomatik düzeltmek için: natureco doctor --fix\n'));
|
|
21
|
+
console.log(chalk.gray(' ' + '─'.repeat(48)));
|
|
22
|
+
console.log('');
|
|
13
23
|
|
|
14
24
|
const results = [];
|
|
15
25
|
let passed = 0;
|
|
@@ -312,46 +322,42 @@ async function doctor(options) {
|
|
|
312
322
|
}
|
|
313
323
|
|
|
314
324
|
// Özet
|
|
315
|
-
console.log(
|
|
325
|
+
console.log('');
|
|
326
|
+
console.log(chalk.gray(' ' + '─'.repeat(48)));
|
|
316
327
|
|
|
317
|
-
// Kritik kontroller için durum
|
|
318
328
|
const criticalPercentage = criticalTotal > 0 ? Math.round((criticalPassed / criticalTotal) * 100) : 100;
|
|
319
329
|
let statusColor = chalk.green;
|
|
320
330
|
let statusText = 'Mükemmel';
|
|
321
331
|
|
|
322
332
|
if (criticalPercentage < 75) {
|
|
323
333
|
statusColor = chalk.red;
|
|
324
|
-
statusText = 'Kritik';
|
|
334
|
+
statusText = 'Kritik sorun var';
|
|
325
335
|
} else if (criticalPercentage < 100) {
|
|
326
336
|
statusColor = chalk.yellow;
|
|
327
|
-
statusText = 'Dikkat';
|
|
337
|
+
statusText = 'Dikkat gerekiyor';
|
|
328
338
|
} else if (passed < total) {
|
|
329
339
|
statusColor = chalk.cyan;
|
|
330
340
|
statusText = 'İyi';
|
|
331
341
|
}
|
|
332
342
|
|
|
333
|
-
console.log(
|
|
334
|
-
console.log(chalk.
|
|
335
|
-
console.log(chalk.gray(
|
|
343
|
+
console.log('');
|
|
344
|
+
console.log(chalk.gray(' Durum : ') + statusColor.bold(statusText));
|
|
345
|
+
console.log(chalk.gray(' Kontrol : ') + chalk.white(`${passed}/${total} geçti`));
|
|
346
|
+
console.log(chalk.gray(' Kritik : ') + chalk.white(`${criticalPassed}/${criticalTotal}`));
|
|
336
347
|
|
|
337
|
-
// Sorunlar
|
|
338
348
|
const errors = results.filter(r => r.status === 'error');
|
|
339
349
|
const warnings = results.filter(r => r.status === 'warning');
|
|
340
350
|
|
|
341
351
|
if (errors.length > 0) {
|
|
342
|
-
console.log(chalk.red(`\n❌ ${errors.length} hata bulundu`));
|
|
352
|
+
console.log(chalk.red(`\n ❌ ${errors.length} hata bulundu`));
|
|
343
353
|
}
|
|
344
|
-
|
|
345
354
|
if (warnings.length > 0) {
|
|
346
|
-
console.log(chalk.yellow(
|
|
355
|
+
console.log(chalk.yellow(` ⚠ ${warnings.length} uyarı bulundu`));
|
|
347
356
|
}
|
|
348
|
-
|
|
349
357
|
if (!shouldFix && (errors.length > 0 || warnings.length > 0)) {
|
|
350
|
-
console.log(chalk.gray('\
|
|
358
|
+
console.log(chalk.gray('\n Otomatik onarım: ') + chalk.cyan('natureco doctor --fix'));
|
|
351
359
|
}
|
|
352
|
-
|
|
353
|
-
console.log(chalk.cyan('────────────────────────────────\n'));
|
|
354
|
-
}
|
|
360
|
+
console.log('');
|
|
355
361
|
|
|
356
362
|
function checkPort(port) {
|
|
357
363
|
return new Promise((resolve) => {
|
package/src/commands/gateway.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
const chalk = require('chalk');
|
|
2
|
-
const boxen = require('boxen');
|
|
3
2
|
const fs = require('fs');
|
|
4
3
|
const path = require('path');
|
|
5
4
|
const os = require('os');
|
|
@@ -49,90 +48,58 @@ async function gateway(action) {
|
|
|
49
48
|
const version = packageJson.version;
|
|
50
49
|
|
|
51
50
|
console.clear();
|
|
52
|
-
|
|
53
|
-
// Ana logo kutusu - tavşan emoji ile
|
|
54
|
-
const title = boxen(
|
|
55
|
-
chalk.green.bold('🐰 NatureCo Terminal\n') +
|
|
56
|
-
chalk.green.bold(` v${version}\n\n`) +
|
|
57
|
-
chalk.gray('AI botlarınızla terminal\'den konuşun\n') +
|
|
58
|
-
chalk.gray('Workflow\'ları otomatize edin\n') +
|
|
59
|
-
chalk.gray('Yetenekler ekleyin, MCP entegre edin'),
|
|
60
|
-
{
|
|
61
|
-
padding: { top: 1, bottom: 1, left: 3, right: 3 },
|
|
62
|
-
margin: { top: 1, bottom: 0, left: 0, right: 0 },
|
|
63
|
-
borderStyle: 'round',
|
|
64
|
-
borderColor: 'green',
|
|
65
|
-
align: 'center',
|
|
66
|
-
}
|
|
67
|
-
);
|
|
68
51
|
|
|
69
|
-
console.log(
|
|
70
|
-
console.log(chalk.
|
|
52
|
+
console.log('');
|
|
53
|
+
console.log(chalk.green.bold(' (\\_/)'));
|
|
54
|
+
console.log(chalk.green.bold(' (•ᴥ•)'));
|
|
55
|
+
console.log(chalk.green(' />🌿'));
|
|
56
|
+
console.log('');
|
|
57
|
+
console.log(chalk.green.bold(' NatureCo CLI ') + chalk.gray(`v${version}`));
|
|
58
|
+
console.log(chalk.gray(' Terminal-native AI agent\n'));
|
|
59
|
+
console.log(chalk.gray(' ' + '─'.repeat(48)));
|
|
71
60
|
console.log('');
|
|
72
61
|
|
|
73
|
-
// Durum bilgileri
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
} else {
|
|
78
|
-
console.log(chalk.yellow('🔑 Giriş yapılmadı'), chalk.gray('(natureco login)'));
|
|
79
|
-
}
|
|
62
|
+
// Durum bilgileri
|
|
63
|
+
const providerHost = config.providerUrl
|
|
64
|
+
? config.providerUrl.replace('https://', '').split('/')[0]
|
|
65
|
+
: null;
|
|
80
66
|
|
|
81
|
-
if (
|
|
82
|
-
console.log(chalk.
|
|
83
|
-
}
|
|
84
|
-
|
|
67
|
+
if (providerHost) {
|
|
68
|
+
console.log(chalk.gray(' Provider : ') + chalk.white(providerHost));
|
|
69
|
+
}
|
|
70
|
+
if (config.providerModel) {
|
|
71
|
+
console.log(chalk.gray(' Model : ') + chalk.white(config.providerModel));
|
|
72
|
+
}
|
|
73
|
+
if (config.botName) {
|
|
74
|
+
console.log(chalk.gray(' Bot : ') + chalk.cyan(config.botName));
|
|
75
|
+
}
|
|
76
|
+
if (config.userName) {
|
|
77
|
+
console.log(chalk.gray(' Kullanıcı: ') + chalk.white(config.userName));
|
|
85
78
|
}
|
|
86
79
|
|
|
87
80
|
const skills = getSkills();
|
|
88
|
-
|
|
89
|
-
console.log(chalk.cyan('✨ Skills:'), chalk.white(`${skillCount} yüklü`));
|
|
81
|
+
console.log(chalk.gray(' Skills : ') + chalk.white(`${skills.length} yüklü`));
|
|
90
82
|
|
|
91
83
|
const mcpServers = getMcpServers();
|
|
92
|
-
const
|
|
93
|
-
const
|
|
94
|
-
|
|
84
|
+
const activeMcp = Object.values(mcpServers).filter(s => !s.disabled).length;
|
|
85
|
+
const totalMcp = Object.keys(mcpServers).length;
|
|
86
|
+
if (totalMcp > 0) {
|
|
87
|
+
console.log(chalk.gray(' MCP : ') + chalk.white(`${activeMcp}/${totalMcp} aktif`));
|
|
88
|
+
}
|
|
95
89
|
|
|
96
90
|
console.log('');
|
|
97
|
-
console.log(chalk.gray('─'.repeat(
|
|
91
|
+
console.log(chalk.gray(' ' + '─'.repeat(48)));
|
|
98
92
|
console.log('');
|
|
99
93
|
|
|
100
|
-
//
|
|
101
|
-
console.log(chalk.
|
|
102
|
-
|
|
103
|
-
console.log(chalk.yellow(' natureco
|
|
104
|
-
console.log(chalk.
|
|
105
|
-
|
|
106
|
-
console.log(chalk.yellow(' natureco bots'));
|
|
107
|
-
console.log(chalk.gray(' Tüm botlarını listele\n'));
|
|
108
|
-
|
|
109
|
-
console.log(chalk.yellow(' natureco ask "soru"'));
|
|
110
|
-
console.log(chalk.gray(' Tek seferlik soru sor\n'));
|
|
111
|
-
|
|
112
|
-
console.log(chalk.yellow(' natureco skills'));
|
|
113
|
-
console.log(chalk.gray(' Skill\'leri yönet (install, remove, list)\n'));
|
|
114
|
-
|
|
115
|
-
console.log(chalk.yellow(' natureco mcp'));
|
|
116
|
-
console.log(chalk.gray(' MCP sunucularını yönet\n'));
|
|
117
|
-
|
|
118
|
-
console.log(chalk.yellow(' natureco init'));
|
|
119
|
-
console.log(chalk.gray(' Mevcut dizinde proje başlat\n'));
|
|
120
|
-
|
|
121
|
-
console.log(chalk.yellow(' natureco config'));
|
|
122
|
-
console.log(chalk.gray(' Ayarları görüntüle ve düzenle\n'));
|
|
123
|
-
|
|
124
|
-
console.log(chalk.yellow(' natureco gateway start'));
|
|
125
|
-
console.log(chalk.gray(' Gateway\'i başlat (WhatsApp dahil)\n'));
|
|
126
|
-
|
|
127
|
-
console.log(chalk.yellow(' natureco help'));
|
|
128
|
-
console.log(chalk.gray(' Tüm komutları ve örnekleri göster\n'));
|
|
129
|
-
|
|
130
|
-
console.log(chalk.gray('─'.repeat(60)));
|
|
94
|
+
// Hızlı komutlar
|
|
95
|
+
console.log(chalk.cyan.bold(' Hızlı Başlat\n'));
|
|
96
|
+
console.log(chalk.yellow(' natureco chat') + chalk.gray(' Bot ile sohbet başlat'));
|
|
97
|
+
console.log(chalk.yellow(' natureco setup') + chalk.gray(' Kurulumu yeniden çalıştır'));
|
|
98
|
+
console.log(chalk.yellow(' natureco gateway start') + chalk.gray(' Gateway\'i arka planda başlat'));
|
|
99
|
+
console.log(chalk.yellow(' natureco help') + chalk.gray(' Tüm komutları göster'));
|
|
131
100
|
console.log('');
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
console.log(chalk.cyan('💬 Hızlı başlat:'), chalk.white('natureco chat'));
|
|
135
|
-
console.log(chalk.cyan('📚 Döküman:'), chalk.white('natureco.me/docs'));
|
|
101
|
+
console.log(chalk.gray(' ' + '─'.repeat(48)));
|
|
102
|
+
console.log(chalk.gray(' Döküman: ') + chalk.cyan('natureco.me/cli'));
|
|
136
103
|
console.log('');
|
|
137
104
|
}
|
|
138
105
|
|
package/src/commands/help.js
CHANGED
|
@@ -1,79 +1,136 @@
|
|
|
1
1
|
const chalk = require('chalk');
|
|
2
|
+
const { getConfig } = require('../utils/config');
|
|
2
3
|
|
|
3
4
|
function help() {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
console.log(chalk.
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
console.log(chalk.
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
console.log(chalk.
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
5
|
+
const config = getConfig() || {};
|
|
6
|
+
const version = require('../../package.json').version;
|
|
7
|
+
|
|
8
|
+
console.clear();
|
|
9
|
+
|
|
10
|
+
// Header
|
|
11
|
+
console.log('');
|
|
12
|
+
console.log(chalk.green.bold(' (\\_/)'));
|
|
13
|
+
console.log(chalk.green.bold(' (•ᴥ•)'));
|
|
14
|
+
console.log(chalk.green(' />🌿'));
|
|
15
|
+
console.log('');
|
|
16
|
+
console.log(chalk.green.bold(` NatureCo CLI `) + chalk.gray(`v${version}`));
|
|
17
|
+
console.log(chalk.gray(' Terminal-native AI agent\n'));
|
|
18
|
+
console.log(chalk.gray(' ' + '─'.repeat(48)));
|
|
19
|
+
|
|
20
|
+
// ── Kurulum & Giriş ──────────────────────────────────────────
|
|
21
|
+
console.log(chalk.cyan.bold('\n Kurulum & Giriş\n'));
|
|
22
|
+
printCmd('natureco setup', 'İlk kurulum sihirbazı (provider, bot, entegrasyon)');
|
|
23
|
+
printCmd('natureco login', 'API key ile giriş yap');
|
|
24
|
+
printCmd('natureco logout', 'Çıkış yap');
|
|
25
|
+
printCmd('natureco update', 'Yeni versiyon kontrolü');
|
|
26
|
+
printCmd('natureco doctor', 'Sistem sağlığı kontrolü');
|
|
27
|
+
|
|
28
|
+
// ── Chat ─────────────────────────────────────────────────────
|
|
29
|
+
console.log(chalk.cyan.bold('\n Chat\n'));
|
|
30
|
+
printCmd('natureco chat', 'Varsayılan bot ile sohbet başlat');
|
|
31
|
+
printCmd('natureco chat <bot>', 'Belirli bot ile sohbet (boşluklu isim desteklenir)');
|
|
32
|
+
printCmd('natureco chat --resume', 'Son oturuma devam et');
|
|
33
|
+
printCmd('natureco ask "<soru>"', 'Tek seferlik soru sor');
|
|
34
|
+
printCmd('natureco run script.md', 'Markdown dosyasını prompt olarak gönder');
|
|
35
|
+
printCmd('natureco bots', 'Bot listesini göster');
|
|
36
|
+
|
|
37
|
+
// ── Entegrasyonlar ───────────────────────────────────────────
|
|
38
|
+
console.log(chalk.cyan.bold('\n Entegrasyonlar\n'));
|
|
39
|
+
printCmd('natureco telegram connect', 'Telegram bot bağla');
|
|
40
|
+
printCmd('natureco whatsapp connect', 'WhatsApp QR kod ile bağla');
|
|
41
|
+
printCmd('natureco discord connect', 'Discord bot bağla');
|
|
42
|
+
printCmd('natureco slack connect', 'Slack workspace bağla');
|
|
43
|
+
|
|
44
|
+
// ── Gateway & Dashboard ──────────────────────────────────────
|
|
45
|
+
console.log(chalk.cyan.bold('\n Gateway & Dashboard\n'));
|
|
46
|
+
printCmd('natureco gateway start', 'Gateway\'i arka planda başlat (WhatsApp dahil)');
|
|
47
|
+
printCmd('natureco gateway stop', 'Gateway\'i durdur');
|
|
48
|
+
printCmd('natureco gateway status', 'Gateway durumu ve son loglar');
|
|
49
|
+
printCmd('natureco dashboard', 'Web arayüzünü aç (localhost:3848)');
|
|
50
|
+
|
|
51
|
+
// ── Skill & MCP ──────────────────────────────────────────────
|
|
52
|
+
console.log(chalk.cyan.bold('\n Skill & MCP\n'));
|
|
53
|
+
printCmd('natureco skills', 'Yüklü skill\'leri listele');
|
|
54
|
+
printCmd('natureco skills install <s>', 'NatureHub\'dan skill yükle');
|
|
55
|
+
printCmd('natureco skills install clawhub:<s>', 'ClawHub\'dan skill yükle');
|
|
56
|
+
printCmd('natureco skills browse', 'Popüler skill\'leri gözat');
|
|
57
|
+
printCmd('natureco mcp list', 'MCP sunucularını listele');
|
|
58
|
+
printCmd('natureco mcp add', 'MCP sunucusu ekle');
|
|
59
|
+
printCmd('natureco mcp templates', 'Hazır MCP şablonları');
|
|
60
|
+
|
|
61
|
+
// ── Otomasyon ────────────────────────────────────────────────
|
|
62
|
+
console.log(chalk.cyan.bold('\n Otomasyon\n'));
|
|
63
|
+
printCmd('natureco cron add', 'Zamanlanmış görev oluştur');
|
|
64
|
+
printCmd('natureco cron list', 'Cron görevlerini listele');
|
|
65
|
+
printCmd('natureco cron start', 'Cron daemon\'unu başlat');
|
|
66
|
+
printCmd('natureco hooks create <tip>', 'Hook oluştur (pre-message, post-message...)');
|
|
67
|
+
printCmd('natureco commands create <ad>','Özel /komut oluştur');
|
|
68
|
+
printCmd('natureco ultrareview <dosya>','Kod inceleme — güvenlik, performans, kalite');
|
|
69
|
+
printCmd('natureco git review', 'Staged değişiklikleri incele');
|
|
70
|
+
printCmd('natureco git commit', 'AI ile commit mesajı üret');
|
|
71
|
+
printCmd('natureco migrate --from openclaw', 'OpenClaw\'dan geçiş');
|
|
72
|
+
|
|
73
|
+
// ── Diğer ────────────────────────────────────────────────────
|
|
74
|
+
console.log(chalk.cyan.bold('\n Diğer\n'));
|
|
75
|
+
printCmd('natureco sessions list', 'Geçmiş oturumları listele');
|
|
76
|
+
printCmd('natureco tasks list', 'Arka plan görevlerini listele');
|
|
77
|
+
printCmd('natureco config list', 'Tüm ayarları göster');
|
|
78
|
+
printCmd('natureco config set <k> <v>', 'Ayar değiştir');
|
|
79
|
+
printCmd('natureco init', 'Proje klasörü oluştur (.natureco/)');
|
|
80
|
+
|
|
81
|
+
// ── Chat içi komutlar ────────────────────────────────────────
|
|
82
|
+
console.log(chalk.cyan.bold('\n Chat İçi Komutlar\n'));
|
|
83
|
+
console.log(chalk.gray(' ' + '─'.repeat(48)));
|
|
84
|
+
printInChat('/clear', 'Ekranı temizle');
|
|
85
|
+
printInChat('/bot [ad]', 'Bot değiştir');
|
|
86
|
+
printInChat('/skills', 'Aktif skill\'leri göster');
|
|
87
|
+
printInChat('/memory', 'Hafıza durumunu göster');
|
|
88
|
+
printInChat('/memory clear', 'Hafızayı temizle');
|
|
89
|
+
printInChat('/commands', 'Özel komutları listele');
|
|
90
|
+
printInChat('/ultrareview', 'Son kod bloğunu detaylı incele');
|
|
91
|
+
printInChat('/help', 'Chat yardımını göster');
|
|
92
|
+
printInChat('Ctrl+B', 'Görevi arka plana al');
|
|
93
|
+
printInChat('exit / quit', 'Sohbetten çık');
|
|
94
|
+
|
|
95
|
+
// ── Mevcut config özeti ──────────────────────────────────────
|
|
96
|
+
if (config.providerUrl || config.botName) {
|
|
97
|
+
console.log(chalk.cyan.bold('\n Mevcut Yapılandırma\n'));
|
|
98
|
+
if (config.providerUrl) {
|
|
99
|
+
const provider = config.providerUrl.replace('https://', '').split('/')[0];
|
|
100
|
+
console.log(chalk.gray(' Provider : ') + chalk.white(provider));
|
|
101
|
+
}
|
|
102
|
+
if (config.providerModel) {
|
|
103
|
+
console.log(chalk.gray(' Model : ') + chalk.white(config.providerModel));
|
|
104
|
+
}
|
|
105
|
+
if (config.botName) {
|
|
106
|
+
console.log(chalk.gray(' Bot : ') + chalk.cyan(config.botName));
|
|
107
|
+
}
|
|
108
|
+
if (config.userName) {
|
|
109
|
+
console.log(chalk.gray(' Kullanıcı: ') + chalk.white(config.userName));
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// ── Footer ───────────────────────────────────────────────────
|
|
114
|
+
console.log('');
|
|
115
|
+
console.log(chalk.gray(' ' + '─'.repeat(48)));
|
|
116
|
+
console.log(chalk.gray(' Döküman : ') + chalk.cyan('natureco.me/cli'));
|
|
117
|
+
console.log(chalk.gray(' API Key : ') + chalk.cyan('developers.natureco.me'));
|
|
118
|
+
console.log(chalk.gray(' npm : ') + chalk.cyan('npmjs.com/package/natureco-cli'));
|
|
119
|
+
console.log('');
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function printCmd(cmd, desc) {
|
|
123
|
+
console.log(
|
|
124
|
+
chalk.yellow(' ' + cmd.padEnd(38)) +
|
|
125
|
+
chalk.gray(desc)
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function printInChat(cmd, desc) {
|
|
130
|
+
console.log(
|
|
131
|
+
chalk.green(' ' + cmd.padEnd(20)) +
|
|
132
|
+
chalk.gray(desc)
|
|
133
|
+
);
|
|
77
134
|
}
|
|
78
135
|
|
|
79
136
|
module.exports = help;
|
package/src/commands/login.js
CHANGED
|
@@ -4,42 +4,51 @@ const { saveApiKey } = require('../utils/config');
|
|
|
4
4
|
const { validateApiKey } = require('../utils/api');
|
|
5
5
|
|
|
6
6
|
async function login() {
|
|
7
|
-
console.
|
|
8
|
-
|
|
9
|
-
console.log(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
7
|
+
console.clear();
|
|
8
|
+
|
|
9
|
+
console.log('');
|
|
10
|
+
console.log(chalk.green.bold(' (\\_/)'));
|
|
11
|
+
console.log(chalk.green.bold(' (•ᴥ•)'));
|
|
12
|
+
console.log(chalk.green(' />🌿'));
|
|
13
|
+
console.log('');
|
|
14
|
+
console.log(chalk.green.bold(' NatureCo CLI — Giriş'));
|
|
15
|
+
console.log(chalk.gray(' API key\'ini gir ve başla.\n'));
|
|
16
|
+
console.log(chalk.gray(' ' + '─'.repeat(48)));
|
|
17
|
+
console.log('');
|
|
18
|
+
console.log(chalk.gray(' API key almak için: ') + chalk.cyan('developers.natureco.me'));
|
|
19
|
+
console.log('');
|
|
20
|
+
|
|
21
|
+
const { apiKey } = await inquirer.prompt([{
|
|
22
|
+
type: 'password',
|
|
23
|
+
name: 'apiKey',
|
|
24
|
+
message: ' API Key:',
|
|
25
|
+
mask: '*',
|
|
26
|
+
validate: (v) => {
|
|
27
|
+
if (!v.trim()) return 'API key boş olamaz';
|
|
28
|
+
if (!v.startsWith('nco_') && !v.startsWith('nc_')) {
|
|
29
|
+
return 'API key "nco_" veya "nc_" ile başlamalı';
|
|
30
|
+
}
|
|
31
|
+
return true;
|
|
26
32
|
},
|
|
27
|
-
]);
|
|
33
|
+
}]);
|
|
28
34
|
|
|
29
|
-
|
|
35
|
+
console.log('');
|
|
36
|
+
console.log(chalk.gray(' Doğrulanıyor...'));
|
|
30
37
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const isValid = await validateApiKey(apiKey);
|
|
38
|
+
const isValid = await validateApiKey(apiKey.trim());
|
|
34
39
|
|
|
35
40
|
if (!isValid) {
|
|
36
|
-
console.log(chalk.red('❌
|
|
41
|
+
console.log(chalk.red('\n ❌ Geçersiz API key. Lütfen kontrol et.\n'));
|
|
37
42
|
process.exit(1);
|
|
38
43
|
}
|
|
39
44
|
|
|
40
|
-
saveApiKey(apiKey);
|
|
41
|
-
|
|
42
|
-
console.log(chalk.
|
|
45
|
+
saveApiKey(apiKey.trim());
|
|
46
|
+
|
|
47
|
+
console.log(chalk.green('\n ✓ Giriş başarılı!'));
|
|
48
|
+
console.log(chalk.gray(' Config: ~/.natureco/config.json'));
|
|
49
|
+
console.log('');
|
|
50
|
+
console.log(chalk.gray(' Başlamak için: ') + chalk.cyan('natureco chat'));
|
|
51
|
+
console.log('');
|
|
43
52
|
}
|
|
44
53
|
|
|
45
54
|
module.exports = login;
|