natureco-cli 1.0.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/CHANGELOG.md +192 -0
- package/README.md +369 -0
- package/bin/natureco.js +109 -0
- package/package.json +33 -0
- package/skills/code-review/SKILL.md +48 -0
- package/skills/summarize/SKILL.md +46 -0
- package/skills/translate/SKILL.md +47 -0
- package/src/commands/ask.js +50 -0
- package/src/commands/bots.js +41 -0
- package/src/commands/chat.js +226 -0
- package/src/commands/config.js +68 -0
- package/src/commands/gateway.js +84 -0
- package/src/commands/help.js +55 -0
- package/src/commands/init.js +135 -0
- package/src/commands/login.js +45 -0
- package/src/commands/logout.js +13 -0
- package/src/commands/mcp.js +275 -0
- package/src/commands/run.js +69 -0
- package/src/commands/setup.js +222 -0
- package/src/commands/skills.js +161 -0
- package/src/commands/update.js +61 -0
- package/src/utils/agents.js +28 -0
- package/src/utils/api.js +64 -0
- package/src/utils/config.js +81 -0
- package/src/utils/history.js +87 -0
- package/src/utils/mcp.js +188 -0
- package/src/utils/skills.js +285 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: code-review
|
|
3
|
+
description: Kod inceleme ve öneri
|
|
4
|
+
metadata: {"natureco": {"requires": {"bins": []}, "os": ["win32","darwin","linux"]}}
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Code Review Skill
|
|
8
|
+
|
|
9
|
+
Bu skill kod inceleme yapar ve iyileştirme önerileri sunar.
|
|
10
|
+
|
|
11
|
+
## Yetenekler
|
|
12
|
+
|
|
13
|
+
- Kod kalitesi analizi
|
|
14
|
+
- Best practice kontrolleri
|
|
15
|
+
- Güvenlik açığı tespiti
|
|
16
|
+
- Performans önerileri
|
|
17
|
+
- Kod okunabilirliği değerlendirmesi
|
|
18
|
+
|
|
19
|
+
## Kullanım
|
|
20
|
+
|
|
21
|
+
Kod bloğunu paylaşın ve inceleme isteyin:
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
Bu kodu inceler misin?
|
|
25
|
+
[kod bloğu]
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## İnceleme Kriterleri
|
|
29
|
+
|
|
30
|
+
1. **Kod Kalitesi**
|
|
31
|
+
- Değişken isimlendirme
|
|
32
|
+
- Fonksiyon karmaşıklığı
|
|
33
|
+
- Kod tekrarı (DRY prensibi)
|
|
34
|
+
|
|
35
|
+
2. **Güvenlik**
|
|
36
|
+
- Input validation
|
|
37
|
+
- SQL injection riski
|
|
38
|
+
- XSS açıkları
|
|
39
|
+
|
|
40
|
+
3. **Performans**
|
|
41
|
+
- Gereksiz döngüler
|
|
42
|
+
- Bellek kullanımı
|
|
43
|
+
- Veritabanı sorguları
|
|
44
|
+
|
|
45
|
+
4. **Okunabilirlik**
|
|
46
|
+
- Yorum satırları
|
|
47
|
+
- Kod organizasyonu
|
|
48
|
+
- Fonksiyon boyutları
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: summarize
|
|
3
|
+
description: Metin özetleme
|
|
4
|
+
metadata: {"natureco": {"requires": {"bins": []}, "os": ["win32","darwin","linux"]}}
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Summarize Skill
|
|
8
|
+
|
|
9
|
+
Bu skill uzun metinleri özetler ve ana noktaları çıkarır.
|
|
10
|
+
|
|
11
|
+
## Yetenekler
|
|
12
|
+
|
|
13
|
+
- Makale özetleme
|
|
14
|
+
- Dokümantasyon özetleme
|
|
15
|
+
- Meeting notes özetleme
|
|
16
|
+
- Kod dokümantasyonu özetleme
|
|
17
|
+
|
|
18
|
+
## Kullanım
|
|
19
|
+
|
|
20
|
+
Özetlemek istediğiniz metni paylaşın:
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
Bu makaleyi özetler misin?
|
|
24
|
+
[metin]
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Özet Formatları
|
|
28
|
+
|
|
29
|
+
1. **Kısa Özet** (2-3 cümle)
|
|
30
|
+
- Ana fikir
|
|
31
|
+
- Sonuç
|
|
32
|
+
|
|
33
|
+
2. **Detaylı Özet** (1 paragraf)
|
|
34
|
+
- Giriş
|
|
35
|
+
- Ana noktalar
|
|
36
|
+
- Sonuç
|
|
37
|
+
|
|
38
|
+
3. **Madde Madde** (bullet points)
|
|
39
|
+
- Önemli noktalar listesi
|
|
40
|
+
- Eylem öğeleri
|
|
41
|
+
|
|
42
|
+
## Örnekler
|
|
43
|
+
|
|
44
|
+
- "Bu dokümantasyonu özetle"
|
|
45
|
+
- "Meeting notlarından action item'ları çıkar"
|
|
46
|
+
- "Bu kod bloğunun ne yaptığını açıkla"
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: translate
|
|
3
|
+
description: Metin çevirisi
|
|
4
|
+
metadata: {"natureco": {"requires": {"bins": []}, "os": ["win32","darwin","linux"]}}
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Translate Skill
|
|
8
|
+
|
|
9
|
+
Bu skill metinleri farklı diller arasında çevirir.
|
|
10
|
+
|
|
11
|
+
## Desteklenen Diller
|
|
12
|
+
|
|
13
|
+
- Türkçe ↔ İngilizce
|
|
14
|
+
- İngilizce ↔ Almanca
|
|
15
|
+
- İngilizce ↔ Fransızca
|
|
16
|
+
- İngilizce ↔ İspanyolca
|
|
17
|
+
- Ve daha fazlası...
|
|
18
|
+
|
|
19
|
+
## Kullanım
|
|
20
|
+
|
|
21
|
+
Çevirmek istediğiniz metni ve hedef dili belirtin:
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
Bu metni İngilizce'ye çevir:
|
|
25
|
+
[metin]
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Çeviri Tipleri
|
|
29
|
+
|
|
30
|
+
1. **Literal Çeviri**
|
|
31
|
+
- Kelime kelime çeviri
|
|
32
|
+
- Teknik dokümantasyon için
|
|
33
|
+
|
|
34
|
+
2. **Doğal Çeviri**
|
|
35
|
+
- Anlamsal çeviri
|
|
36
|
+
- Günlük konuşma için
|
|
37
|
+
|
|
38
|
+
3. **Teknik Çeviri**
|
|
39
|
+
- Kod yorumları
|
|
40
|
+
- API dokümantasyonu
|
|
41
|
+
- Teknik terimler
|
|
42
|
+
|
|
43
|
+
## Örnekler
|
|
44
|
+
|
|
45
|
+
- "Bu kodu İngilizce'ye çevir"
|
|
46
|
+
- "README dosyasını Türkçe'ye çevir"
|
|
47
|
+
- "Bu hata mesajını Türkçe'ye çevir"
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
const chalk = require('chalk');
|
|
2
|
+
const { getApiKey, getConfig } = require('../utils/config');
|
|
3
|
+
const { getBots, sendMessage } = require('../utils/api');
|
|
4
|
+
const { getSkillPrompts } = require('../utils/skills');
|
|
5
|
+
|
|
6
|
+
async function ask(question) {
|
|
7
|
+
const apiKey = getApiKey();
|
|
8
|
+
|
|
9
|
+
if (!apiKey) {
|
|
10
|
+
console.log(chalk.red('\n❌ Giriş yapılmamış. Önce "natureco login" çalıştırın.\n'));
|
|
11
|
+
process.exit(1);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const config = getConfig();
|
|
15
|
+
const defaultBotId = config.defaultBotId;
|
|
16
|
+
|
|
17
|
+
if (!defaultBotId) {
|
|
18
|
+
console.log(chalk.red('\n❌ Varsayılan bot ayarlanmamış. "natureco config set defaultBotId <bot-id>" ile ayarlayın.\n'));
|
|
19
|
+
process.exit(1);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Skill prompts'ları yükle
|
|
23
|
+
const skillPrompts = getSkillPrompts();
|
|
24
|
+
|
|
25
|
+
// Loading animasyonu
|
|
26
|
+
const frames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
|
|
27
|
+
let i = 0;
|
|
28
|
+
process.stdout.write(chalk.yellow('⏳ '));
|
|
29
|
+
const loadingInterval = setInterval(() => {
|
|
30
|
+
process.stdout.write(`\r${chalk.yellow('⏳')} ${chalk.yellow(frames[i])}`);
|
|
31
|
+
i = (i + 1) % frames.length;
|
|
32
|
+
}, 80);
|
|
33
|
+
|
|
34
|
+
try {
|
|
35
|
+
const response = await sendMessage(apiKey, defaultBotId, question, null, skillPrompts);
|
|
36
|
+
|
|
37
|
+
clearInterval(loadingInterval);
|
|
38
|
+
process.stdout.write('\r');
|
|
39
|
+
|
|
40
|
+
const botReply = response.reply || response.message || 'Yanıt alınamadı';
|
|
41
|
+
console.log(chalk.green(`\n${botReply}\n`));
|
|
42
|
+
} catch (err) {
|
|
43
|
+
clearInterval(loadingInterval);
|
|
44
|
+
process.stdout.write('\r');
|
|
45
|
+
console.log(chalk.red(`\n❌ Hata: ${err.message}\n`));
|
|
46
|
+
process.exit(1);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
module.exports = ask;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const chalk = require('chalk');
|
|
2
|
+
const { getApiKey } = require('../utils/config');
|
|
3
|
+
const { getBots } = require('../utils/api');
|
|
4
|
+
|
|
5
|
+
async function bots() {
|
|
6
|
+
const apiKey = getApiKey();
|
|
7
|
+
|
|
8
|
+
if (!apiKey) {
|
|
9
|
+
console.log(chalk.red('\n❌ Not logged in. Run "natureco login" first.\n'));
|
|
10
|
+
process.exit(1);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
console.log(chalk.yellow('\n⏳ Fetching your bots...\n'));
|
|
14
|
+
|
|
15
|
+
try {
|
|
16
|
+
const botList = await getBots(apiKey);
|
|
17
|
+
|
|
18
|
+
if (!botList || !botList.bots || botList.bots.length === 0) {
|
|
19
|
+
console.log(chalk.gray('No bots found. Create one at https://developers.natureco.me\n'));
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
console.log(chalk.green.bold('╭─ Your Bots ─╮\n'));
|
|
24
|
+
|
|
25
|
+
botList.bots.forEach((bot, index) => {
|
|
26
|
+
console.log(chalk.cyan(`${index + 1}. ${bot.name}`));
|
|
27
|
+
console.log(chalk.gray(` ID: ${bot.id}`));
|
|
28
|
+
console.log(chalk.gray(` Provider: ${bot.ai_provider || 'openai'}`));
|
|
29
|
+
console.log(chalk.gray(` Public: ${bot.is_public ? 'Yes' : 'No'}`));
|
|
30
|
+
console.log('');
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
console.log(chalk.green('╰──────────────╯\n'));
|
|
34
|
+
console.log(chalk.gray(`Total: ${botList.bots.length} bot(s)\n`));
|
|
35
|
+
} catch (err) {
|
|
36
|
+
console.log(chalk.red(`\n❌ Error: ${err.message}\n`));
|
|
37
|
+
process.exit(1);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
module.exports = bots;
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
const inquirer = require('inquirer');
|
|
2
|
+
const chalk = require('chalk');
|
|
3
|
+
const readline = require('readline');
|
|
4
|
+
const { getApiKey } = require('../utils/config');
|
|
5
|
+
const { getBots, sendMessage } = require('../utils/api');
|
|
6
|
+
const { getSkillPrompts, getSkills } = require('../utils/skills');
|
|
7
|
+
const { getAgentsPrompt } = require('../utils/agents');
|
|
8
|
+
const { addToHistory, getCommandHistory, clearHistory } = require('../utils/history');
|
|
9
|
+
|
|
10
|
+
async function chat(botName) {
|
|
11
|
+
const apiKey = getApiKey();
|
|
12
|
+
|
|
13
|
+
if (!apiKey) {
|
|
14
|
+
console.log(chalk.red('\n❌ Not logged in. Run "natureco login" first.\n'));
|
|
15
|
+
process.exit(1);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
console.log(chalk.yellow('\n⏳ Loading bots...\n'));
|
|
19
|
+
|
|
20
|
+
let botList;
|
|
21
|
+
try {
|
|
22
|
+
botList = await getBots(apiKey);
|
|
23
|
+
} catch (err) {
|
|
24
|
+
console.log(chalk.red(`\n❌ Error: ${err.message}\n`));
|
|
25
|
+
process.exit(1);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (!botList || !botList.bots || botList.bots.length === 0) {
|
|
29
|
+
console.log(chalk.gray('No bots found. Create one at https://developers.natureco.me\n'));
|
|
30
|
+
process.exit(1);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Bot adı ile eşleşen botu bul
|
|
34
|
+
let bot = botList.bots.find(b => b.name.toLowerCase() === botName.toLowerCase());
|
|
35
|
+
|
|
36
|
+
if (!bot) {
|
|
37
|
+
console.log(chalk.red(`\n❌ Bot "${botName}" not found.\n`));
|
|
38
|
+
console.log(chalk.gray('Available bots:'));
|
|
39
|
+
botList.bots.forEach(b => console.log(chalk.cyan(` - ${b.name}`)));
|
|
40
|
+
console.log('');
|
|
41
|
+
process.exit(1);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Chat başlat
|
|
45
|
+
console.clear();
|
|
46
|
+
console.log(chalk.green.bold(`╭─ NatureCo Terminal ─╮`));
|
|
47
|
+
console.log(chalk.green(`│ ${bot.name.padEnd(18)} │`));
|
|
48
|
+
console.log(chalk.green(`╰─────────────────────╯\n`));
|
|
49
|
+
console.log(chalk.gray('Chat komutları: /clear /bot /skills /help\n'));
|
|
50
|
+
|
|
51
|
+
// Skill prompts ve AGENTS.md'yi yükle
|
|
52
|
+
const skillPrompts = getSkillPrompts();
|
|
53
|
+
const agentsPrompt = getAgentsPrompt();
|
|
54
|
+
|
|
55
|
+
// Sistem promptunu birleştir
|
|
56
|
+
let systemPrompt = '';
|
|
57
|
+
if (skillPrompts) systemPrompt += skillPrompts;
|
|
58
|
+
if (agentsPrompt) {
|
|
59
|
+
if (systemPrompt) systemPrompt += '\n\n';
|
|
60
|
+
systemPrompt += `## Project Instructions\n${agentsPrompt}`;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
let conversationId = null;
|
|
64
|
+
|
|
65
|
+
// Komut geçmişi
|
|
66
|
+
const commandHistory = getCommandHistory(bot.id);
|
|
67
|
+
let historyIndex = commandHistory.length;
|
|
68
|
+
|
|
69
|
+
// Readline interface for arrow key support
|
|
70
|
+
const rl = readline.createInterface({
|
|
71
|
+
input: process.stdin,
|
|
72
|
+
output: process.stdout,
|
|
73
|
+
prompt: chalk.cyan('siz › '),
|
|
74
|
+
historySize: 100,
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
// Load command history
|
|
78
|
+
commandHistory.forEach(cmd => rl.history.unshift(cmd));
|
|
79
|
+
|
|
80
|
+
async function processMessage(userMessage) {
|
|
81
|
+
userMessage = userMessage.trim();
|
|
82
|
+
|
|
83
|
+
if (!userMessage || userMessage.length === 0) {
|
|
84
|
+
rl.prompt();
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Chat komutları
|
|
89
|
+
if (userMessage.startsWith('/')) {
|
|
90
|
+
const [command, ...args] = userMessage.slice(1).split(' ');
|
|
91
|
+
|
|
92
|
+
switch (command.toLowerCase()) {
|
|
93
|
+
case 'clear':
|
|
94
|
+
console.clear();
|
|
95
|
+
console.log(chalk.green.bold(`╭─ NatureCo Terminal ─╮`));
|
|
96
|
+
console.log(chalk.green(`│ ${bot.name.padEnd(18)} │`));
|
|
97
|
+
console.log(chalk.green(`╰─────────────────────╯\n`));
|
|
98
|
+
console.log(chalk.gray('Chat komutları: /clear /bot /skills /help\n'));
|
|
99
|
+
rl.prompt();
|
|
100
|
+
return;
|
|
101
|
+
|
|
102
|
+
case 'bot':
|
|
103
|
+
if (args.length === 0) {
|
|
104
|
+
console.log(chalk.yellow('\nMevcut bot: ') + chalk.cyan(bot.name));
|
|
105
|
+
console.log(chalk.gray('\nBot değiştirmek için: /bot <bot-adı>'));
|
|
106
|
+
console.log(chalk.gray('Mevcut botlar:'));
|
|
107
|
+
botList.bots.forEach(b => {
|
|
108
|
+
const marker = b.id === bot.id ? chalk.green('✓ ') : ' ';
|
|
109
|
+
console.log(marker + chalk.cyan(b.name));
|
|
110
|
+
});
|
|
111
|
+
console.log('');
|
|
112
|
+
rl.prompt();
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const newBotName = args.join(' ');
|
|
117
|
+
const newBot = botList.bots.find(b => b.name.toLowerCase() === newBotName.toLowerCase());
|
|
118
|
+
|
|
119
|
+
if (!newBot) {
|
|
120
|
+
console.log(chalk.red(`\n❌ Bot "${newBotName}" bulunamadı.\n`));
|
|
121
|
+
rl.prompt();
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
bot = newBot;
|
|
126
|
+
conversationId = null;
|
|
127
|
+
console.log(chalk.green(`\n✅ Bot değiştirildi: ${bot.name}\n`));
|
|
128
|
+
rl.prompt();
|
|
129
|
+
return;
|
|
130
|
+
|
|
131
|
+
case 'skills':
|
|
132
|
+
const skills = getSkills();
|
|
133
|
+
if (skills.length === 0) {
|
|
134
|
+
console.log(chalk.gray('\nYüklü skill yok.\n'));
|
|
135
|
+
} else {
|
|
136
|
+
console.log(chalk.yellow('\nAktif skill\'ler:\n'));
|
|
137
|
+
skills.forEach(skill => {
|
|
138
|
+
console.log(chalk.cyan(` • ${skill.name}`) + chalk.gray(` (${skill.source})`));
|
|
139
|
+
console.log(chalk.gray(` ${skill.description}`));
|
|
140
|
+
});
|
|
141
|
+
console.log('');
|
|
142
|
+
}
|
|
143
|
+
rl.prompt();
|
|
144
|
+
return;
|
|
145
|
+
|
|
146
|
+
case 'help':
|
|
147
|
+
console.log(chalk.yellow('\nChat Komutları:\n'));
|
|
148
|
+
console.log(chalk.cyan(' /clear') + chalk.gray(' - Ekranı temizle'));
|
|
149
|
+
console.log(chalk.cyan(' /bot [ad]') + chalk.gray(' - Bot değiştir veya listele'));
|
|
150
|
+
console.log(chalk.cyan(' /skills') + chalk.gray(' - Aktif skill\'leri göster'));
|
|
151
|
+
console.log(chalk.cyan(' /help') + chalk.gray(' - Bu yardım mesajını göster'));
|
|
152
|
+
console.log(chalk.cyan(' exit, quit') + chalk.gray(' - Chat\'ten çık'));
|
|
153
|
+
console.log(chalk.gray('\nYukarı/aşağı ok tuşları ile komut geçmişinde gezin.\n'));
|
|
154
|
+
rl.prompt();
|
|
155
|
+
return;
|
|
156
|
+
|
|
157
|
+
default:
|
|
158
|
+
console.log(chalk.red(`\n❌ Bilinmeyen komut: /${command}`));
|
|
159
|
+
console.log(chalk.gray('Yardım için: /help\n'));
|
|
160
|
+
rl.prompt();
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// Exit komutu
|
|
166
|
+
if (userMessage.toLowerCase() === 'exit' || userMessage.toLowerCase() === 'quit') {
|
|
167
|
+
console.log(chalk.gray('\n👋 Goodbye!\n'));
|
|
168
|
+
rl.close();
|
|
169
|
+
process.exit(0);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// Loading animasyonu
|
|
173
|
+
const loadingInterval = startLoadingAnimation();
|
|
174
|
+
|
|
175
|
+
try {
|
|
176
|
+
const response = await sendMessage(apiKey, bot.id, userMessage, conversationId, systemPrompt);
|
|
177
|
+
|
|
178
|
+
stopLoadingAnimation(loadingInterval);
|
|
179
|
+
|
|
180
|
+
if (response.conversation_id) {
|
|
181
|
+
conversationId = response.conversation_id;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
const botReply = response.reply || response.message || 'No response';
|
|
185
|
+
console.log(chalk.green(`bot › ${botReply}\n`));
|
|
186
|
+
|
|
187
|
+
// Save to history
|
|
188
|
+
addToHistory(bot.id, userMessage, botReply, conversationId);
|
|
189
|
+
} catch (err) {
|
|
190
|
+
stopLoadingAnimation(loadingInterval);
|
|
191
|
+
console.log(chalk.red(`\n❌ Error: ${err.message}\n`));
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
rl.prompt();
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
rl.on('line', (line) => {
|
|
198
|
+
processMessage(line);
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
rl.on('close', () => {
|
|
202
|
+
console.log(chalk.gray('\n👋 Goodbye!\n'));
|
|
203
|
+
process.exit(0);
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
rl.prompt();
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
function startLoadingAnimation() {
|
|
210
|
+
const frames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
|
|
211
|
+
let i = 0;
|
|
212
|
+
|
|
213
|
+
process.stdout.write(chalk.yellow('bot › '));
|
|
214
|
+
|
|
215
|
+
return setInterval(() => {
|
|
216
|
+
process.stdout.write(`\r${chalk.yellow('bot ›')} ${chalk.yellow(frames[i])}`);
|
|
217
|
+
i = (i + 1) % frames.length;
|
|
218
|
+
}, 80);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
function stopLoadingAnimation(interval) {
|
|
222
|
+
clearInterval(interval);
|
|
223
|
+
process.stdout.write('\r');
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
module.exports = chat;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
const chalk = require('chalk');
|
|
2
|
+
const { getConfig, setConfigValue, getAllConfig } = require('../utils/config');
|
|
3
|
+
|
|
4
|
+
function config(args) {
|
|
5
|
+
const [action, key, ...valueParts] = args;
|
|
6
|
+
|
|
7
|
+
if (!action) {
|
|
8
|
+
console.log(chalk.red('\n❌ Kullanım: natureco config <get|set|list> [key] [value]\n'));
|
|
9
|
+
process.exit(1);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
if (action === 'list') {
|
|
13
|
+
const cfg = getAllConfig();
|
|
14
|
+
console.log(chalk.green.bold('\n╭─ Config ─╮\n'));
|
|
15
|
+
console.log(JSON.stringify(cfg, null, 2));
|
|
16
|
+
console.log('');
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (action === 'get') {
|
|
21
|
+
if (!key) {
|
|
22
|
+
console.log(chalk.red('\n❌ Key belirtilmedi.\n'));
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
const cfg = getConfig();
|
|
26
|
+
const keys = key.split('.');
|
|
27
|
+
let value = cfg;
|
|
28
|
+
for (const k of keys) {
|
|
29
|
+
value = value?.[k];
|
|
30
|
+
}
|
|
31
|
+
if (value === undefined) {
|
|
32
|
+
console.log(chalk.gray(`\n${key}: (tanımlı değil)\n`));
|
|
33
|
+
} else {
|
|
34
|
+
console.log(chalk.cyan(`\n${key}:`), chalk.white(JSON.stringify(value, null, 2)));
|
|
35
|
+
console.log('');
|
|
36
|
+
}
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (action === 'set') {
|
|
41
|
+
if (!key) {
|
|
42
|
+
console.log(chalk.red('\n❌ Key belirtilmedi.\n'));
|
|
43
|
+
process.exit(1);
|
|
44
|
+
}
|
|
45
|
+
if (valueParts.length === 0) {
|
|
46
|
+
console.log(chalk.red('\n❌ Value belirtilmedi.\n'));
|
|
47
|
+
process.exit(1);
|
|
48
|
+
}
|
|
49
|
+
const value = valueParts.join(' ');
|
|
50
|
+
|
|
51
|
+
// JSON parse dene
|
|
52
|
+
let parsedValue = value;
|
|
53
|
+
try {
|
|
54
|
+
parsedValue = JSON.parse(value);
|
|
55
|
+
} catch {
|
|
56
|
+
// String olarak kalsın
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
setConfigValue(key, parsedValue);
|
|
60
|
+
console.log(chalk.green(`\n✅ ${key} = ${JSON.stringify(parsedValue)}\n`));
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
console.log(chalk.red(`\n❌ Geçersiz action: ${action}\n`));
|
|
65
|
+
process.exit(1);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
module.exports = config;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
const chalk = require('chalk');
|
|
2
|
+
const boxen = require('boxen');
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const packageJson = require('../../package.json');
|
|
5
|
+
const { getConfig, CONFIG_FILE } = require('../utils/config');
|
|
6
|
+
const { getSkills } = require('../utils/skills');
|
|
7
|
+
const { getMcpServers } = require('../utils/mcp');
|
|
8
|
+
|
|
9
|
+
async function gateway() {
|
|
10
|
+
// Config kontrolü - yoksa veya apiKey yoksa setup çalıştır
|
|
11
|
+
if (!fs.existsSync(CONFIG_FILE)) {
|
|
12
|
+
const setup = require('./setup');
|
|
13
|
+
await setup();
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const config = getConfig();
|
|
18
|
+
|
|
19
|
+
if (!config || !config.apiKey) {
|
|
20
|
+
const setup = require('./setup');
|
|
21
|
+
await setup();
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Normal gateway ekranı
|
|
26
|
+
const version = packageJson.version;
|
|
27
|
+
|
|
28
|
+
// Ana kutu
|
|
29
|
+
const title = boxen(
|
|
30
|
+
chalk.green.bold(`🌿 NatureCo Terminal v${version}\n\n`) +
|
|
31
|
+
chalk.gray('AI botlarınızla terminal\'den\n') +
|
|
32
|
+
chalk.gray('konuşun, workflow\'ları otomatize\n') +
|
|
33
|
+
chalk.gray('edin.'),
|
|
34
|
+
{
|
|
35
|
+
padding: 1,
|
|
36
|
+
margin: 1,
|
|
37
|
+
borderStyle: 'round',
|
|
38
|
+
borderColor: 'green',
|
|
39
|
+
align: 'center',
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
console.log(title);
|
|
44
|
+
|
|
45
|
+
// Durum bilgileri
|
|
46
|
+
if (config.apiKey) {
|
|
47
|
+
const maskedKey = config.apiKey.substring(0, 7) + '...';
|
|
48
|
+
console.log(chalk.cyan('✦ Giriş yapıldı:'), chalk.white(maskedKey));
|
|
49
|
+
} else {
|
|
50
|
+
console.log(chalk.yellow('✦ Giriş yapılmadı'), chalk.gray('(natureco login)'));
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (config.defaultBot) {
|
|
54
|
+
console.log(chalk.cyan('✦ Aktif bot:'), chalk.white(config.defaultBot));
|
|
55
|
+
} else {
|
|
56
|
+
console.log(chalk.gray('✦ Aktif bot: Yok'));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const skills = getSkills();
|
|
60
|
+
const skillCount = skills.length;
|
|
61
|
+
console.log(chalk.cyan('✦ Skills:'), chalk.white(`${skillCount} yüklü`));
|
|
62
|
+
|
|
63
|
+
const mcpServers = getMcpServers();
|
|
64
|
+
const mcpCount = Object.keys(mcpServers).length;
|
|
65
|
+
const activeMcpCount = Object.values(mcpServers).filter(s => !s.disabled).length;
|
|
66
|
+
console.log(chalk.cyan('✦ MCP:'), chalk.white(`${activeMcpCount}/${mcpCount} aktif`));
|
|
67
|
+
|
|
68
|
+
console.log('');
|
|
69
|
+
|
|
70
|
+
// Komutlar
|
|
71
|
+
console.log(chalk.bold('Komutlar:'));
|
|
72
|
+
console.log(chalk.yellow(' chat <bot> '), chalk.gray('Bot ile konuş'));
|
|
73
|
+
console.log(chalk.yellow(' bots '), chalk.gray('Botlarını listele'));
|
|
74
|
+
console.log(chalk.yellow(' skills '), chalk.gray('Skill\'leri yönet'));
|
|
75
|
+
console.log(chalk.yellow(' mcp '), chalk.gray('MCP sunucularını yönet'));
|
|
76
|
+
console.log(chalk.yellow(' init '), chalk.gray('Projeyi başlat'));
|
|
77
|
+
console.log(chalk.yellow(' ask "soru" '), chalk.gray('Tek seferlik soru'));
|
|
78
|
+
console.log(chalk.yellow(' config '), chalk.gray('Ayarları yönet'));
|
|
79
|
+
console.log('');
|
|
80
|
+
console.log(chalk.gray('Yardım için: '), chalk.cyan('natureco help'));
|
|
81
|
+
console.log('');
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
module.exports = gateway;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
const chalk = require('chalk');
|
|
2
|
+
|
|
3
|
+
function help() {
|
|
4
|
+
console.log(chalk.green.bold('\n╭─ NatureCo CLI ─╮'));
|
|
5
|
+
console.log(chalk.green('│ AI Bot Terminal │'));
|
|
6
|
+
console.log(chalk.green('╰─────────────────╯\n'));
|
|
7
|
+
|
|
8
|
+
console.log(chalk.cyan.bold('Commands:\n'));
|
|
9
|
+
|
|
10
|
+
const commands = [
|
|
11
|
+
{ cmd: 'natureco', desc: 'Show gateway screen (runs setup if needed)' },
|
|
12
|
+
{ cmd: 'natureco setup', desc: 'Run initial setup wizard' },
|
|
13
|
+
{ cmd: 'natureco login', desc: 'Login with your API key' },
|
|
14
|
+
{ cmd: 'natureco logout', desc: 'Logout and remove credentials' },
|
|
15
|
+
{ cmd: 'natureco bots', desc: 'List your AI bots' },
|
|
16
|
+
{ cmd: 'natureco chat <bot-name>', desc: 'Start chat with a bot' },
|
|
17
|
+
{ cmd: 'natureco ask "<question>"', desc: 'Ask a single question' },
|
|
18
|
+
{ cmd: 'natureco run <script.md>', desc: 'Run a markdown script' },
|
|
19
|
+
{ cmd: 'natureco init', desc: 'Initialize project' },
|
|
20
|
+
{ cmd: 'natureco skills [action]', desc: 'Manage skills' },
|
|
21
|
+
{ cmd: 'natureco mcp [action]', desc: 'Manage MCP servers' },
|
|
22
|
+
{ cmd: 'natureco config <action>', desc: 'Manage configuration' },
|
|
23
|
+
{ cmd: 'natureco update', desc: 'Check for updates' },
|
|
24
|
+
{ cmd: 'natureco help', desc: 'Show this help message' },
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
commands.forEach(({ cmd, desc }) => {
|
|
28
|
+
console.log(chalk.yellow(` ${cmd.padEnd(30)}`), chalk.gray(desc));
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
console.log(chalk.cyan.bold('\n\nExamples:\n'));
|
|
32
|
+
console.log(chalk.gray(' $ natureco'));
|
|
33
|
+
console.log(chalk.gray(' $ natureco login'));
|
|
34
|
+
console.log(chalk.gray(' $ natureco init'));
|
|
35
|
+
console.log(chalk.gray(' $ natureco bots'));
|
|
36
|
+
console.log(chalk.gray(' $ natureco ask "bu haftaki görevlerimi listele"'));
|
|
37
|
+
console.log(chalk.gray(' $ natureco run script.md'));
|
|
38
|
+
console.log(chalk.gray(' $ natureco skills'));
|
|
39
|
+
console.log(chalk.gray(' $ natureco skills install code-review'));
|
|
40
|
+
console.log(chalk.gray(' $ natureco mcp list'));
|
|
41
|
+
console.log(chalk.gray(' $ natureco mcp add'));
|
|
42
|
+
console.log(chalk.gray(' $ natureco chat "Nature Bot V3"'));
|
|
43
|
+
console.log(chalk.gray(' $ natureco config list'));
|
|
44
|
+
console.log(chalk.gray(' $ natureco update'));
|
|
45
|
+
console.log(chalk.gray(' $ natureco logout\n'));
|
|
46
|
+
|
|
47
|
+
console.log(chalk.cyan.bold('Chat Commands:\n'));
|
|
48
|
+
console.log(chalk.gray(' Type your message and press Enter'));
|
|
49
|
+
console.log(chalk.gray(' Type "exit" or "quit" to leave chat\n'));
|
|
50
|
+
|
|
51
|
+
console.log(chalk.cyan.bold('Get API Key:\n'));
|
|
52
|
+
console.log(chalk.gray(' Visit: https://developers.natureco.me\n'));
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
module.exports = help;
|