natureco-cli 2.19.0 → 2.19.2
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/README.md +232 -358
- package/bin/natureco.js +49 -0
- package/package.json +1 -1
- package/src/commands/memory-cmd.js +28 -13
- package/src/commands/sessions.js +126 -62
- package/src/commands/status.js +86 -43
package/README.md
CHANGED
|
@@ -3,445 +3,319 @@
|
|
|
3
3
|
[](https://www.npmjs.com/package/natureco-cli)
|
|
4
4
|
[](https://opensource.org/licenses/MIT)
|
|
5
5
|
[]()
|
|
6
|
+
[]()
|
|
6
7
|
|
|
7
|
-
Terminal-native AI agent CLI —
|
|
8
|
+
Terminal-native AI agent CLI — sohbet et, kod yaz, workflow'ları otomatikleştir, Telegram/Discord/Slack/WhatsApp'ı bağla.
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
- **💾 Memory System** — Persistent conversation memory per session
|
|
18
|
-
- **📊 System Health** — Built-in doctor command with auto-fix
|
|
10
|
+
```
|
|
11
|
+
███╗ ██╗ █████╗ ████████╗██╗ ██╗██████╗ ███████╗ ██████╗ ██████╗
|
|
12
|
+
████╗ ██║██╔══██╗╚══██╔══╝██║ ██║██╔══██╗██╔════╝██╔════╝ ██╔═══██╗
|
|
13
|
+
██╔██╗ ██║███████║ ██║ ██║ ██║██████╔╝█████╗ ██║ ██║ ██║
|
|
14
|
+
██║╚██╗██║██╔══██║ ██║ ██║ ██║██╔══██╗██╔══╝ ██║ ██║ ██║
|
|
15
|
+
██║ ╚████║██║ ██║ ██║ ╚██████╔╝██║ ██║███████╗╚██████╗ ╚██████╔╝
|
|
16
|
+
╚═╝ ╚═══╝╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝ ╚═════╝ ╚═════╝
|
|
17
|
+
```
|
|
19
18
|
|
|
20
|
-
|
|
19
|
+
---
|
|
21
20
|
|
|
22
|
-
|
|
23
|
-
# Install globally
|
|
24
|
-
npm install -g natureco-cli
|
|
21
|
+
## ✨ Özellikler
|
|
25
22
|
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
- **⚡ Code Agent** — Dosyaları oku, değiştir, komut çalıştır. Streaming output, tool spinner, onay mekanizması
|
|
24
|
+
- **🤖 Universal LLM** — Groq, OpenAI, Anthropic, Together, DeepSeek, OpenRouter, Ollama, LM Studio
|
|
25
|
+
- **🛠️ Local Tool Execution** — bash, read_file, write_file, list_dir, web_search, http_request
|
|
26
|
+
- **🎨 Chalk TUI** — ASCII logo, ortalanmış header, native readline input — çift karakter sorunu yok
|
|
27
|
+
- **🔌 Entegrasyonlar** — Telegram, Discord, Slack, WhatsApp (Baileys)
|
|
28
|
+
- **🧠 Hafıza Sistemi** — Bot başına kalıcı hafıza, otomatik bilgi çıkarımı
|
|
29
|
+
- **📡 MCP Desteği** — Model Context Protocol sunucuları
|
|
30
|
+
- **🌐 Web Dashboard** — localhost:3848 glassmorphism UI
|
|
31
|
+
- **⏰ Cron Jobs** — Zamanlanmış AI görevleri
|
|
32
|
+
- **🔒 Güvenlik** — Tehlikeli komut engelleme, base64 tool result encoding
|
|
28
33
|
|
|
29
|
-
|
|
30
|
-
natureco chat # terminal agent hazır
|
|
31
|
-
```
|
|
34
|
+
---
|
|
32
35
|
|
|
33
|
-
##
|
|
34
|
-
|
|
35
|
-
### Core Commands
|
|
36
|
-
|
|
37
|
-
| Command | Description |
|
|
38
|
-
|---------|-------------|
|
|
39
|
-
| `natureco` | Opens gateway screen — system status, active bot, skill count |
|
|
40
|
-
| `natureco setup` | Setup wizard — API key, bot selection, AI provider, model, integrations |
|
|
41
|
-
| `natureco login` | Login with API key |
|
|
42
|
-
| `natureco logout` | Logout and clear config |
|
|
43
|
-
| `natureco help` | List all commands with examples |
|
|
44
|
-
| `natureco doctor` | System health check — Node, API, bot, skills, integrations |
|
|
45
|
-
| `natureco doctor --fix` | Auto-fix detected issues |
|
|
46
|
-
| `natureco update` | Check for new version |
|
|
47
|
-
|
|
48
|
-
### Chat
|
|
49
|
-
|
|
50
|
-
| Command | Description |
|
|
51
|
-
|---------|-------------|
|
|
52
|
-
| `natureco chat` | Chat with default bot (interactive selection if none) |
|
|
53
|
-
| `natureco chat Bot Name` | Chat with specific bot (spaces supported) |
|
|
54
|
-
| `natureco chat Nature Bot V3` | Multi-word bot names auto-joined |
|
|
55
|
-
| `natureco chat --resume` | Resume latest session |
|
|
56
|
-
| `natureco ask "question"` | One-time question |
|
|
57
|
-
| `natureco run script.md` | Send markdown file as prompt |
|
|
58
|
-
| `natureco bots` | List all bots |
|
|
59
|
-
|
|
60
|
-
**In-Chat Commands:**
|
|
61
|
-
|
|
62
|
-
| Command | Description |
|
|
63
|
-
|---------|-------------|
|
|
64
|
-
| `/clear` | Clear screen |
|
|
65
|
-
| `/bot` | Show bot list or switch bot |
|
|
66
|
-
| `/bot Bot Name` | Switch to specific bot |
|
|
67
|
-
| `/skills` | Show active skills |
|
|
68
|
-
| `/memory` | Show memory status |
|
|
69
|
-
| `/memory clear` | Clear memory |
|
|
70
|
-
| `/commands` | List custom commands |
|
|
71
|
-
| `/ultrareview` | Deep review last code block |
|
|
72
|
-
| `/help` | Show chat help |
|
|
73
|
-
| `exit` / `quit` | Exit chat |
|
|
74
|
-
| `Ctrl+B` | Move task to background |
|
|
75
|
-
|
|
76
|
-
### Skill System
|
|
77
|
-
|
|
78
|
-
| Command | Description |
|
|
79
|
-
|---------|-------------|
|
|
80
|
-
| `natureco skills` | List installed skills |
|
|
81
|
-
| `natureco skills install slug` | Install skill from NatureHub |
|
|
82
|
-
| `natureco skills install clawhub:slug` | Install skill from ClawHub |
|
|
83
|
-
| `natureco skills browse` | Browse popular skills, interactive selection |
|
|
84
|
-
| `natureco skills search "query"` | Search skills |
|
|
85
|
-
| `natureco skills remove slug` | Remove skill |
|
|
86
|
-
| `natureco skills create name` | Create new skill template |
|
|
87
|
-
|
|
88
|
-
### Integrations
|
|
89
|
-
|
|
90
|
-
| Command | Description |
|
|
91
|
-
|---------|-------------|
|
|
92
|
-
| `natureco telegram connect` | Connect Telegram bot (token + user ID) |
|
|
93
|
-
| `natureco discord connect` | Connect Discord bot |
|
|
94
|
-
| `natureco slack connect` | Connect to Slack workspace |
|
|
95
|
-
| `natureco whatsapp connect` | Connect WhatsApp with QR code (Baileys) |
|
|
96
|
-
| `natureco whatsapp status` | WhatsApp connection status and allow list |
|
|
97
|
-
| `natureco whatsapp allow <number>` | Add number to allow list |
|
|
98
|
-
| `natureco whatsapp disconnect` | Disconnect WhatsApp |
|
|
99
|
-
|
|
100
|
-
### MCP Servers
|
|
101
|
-
|
|
102
|
-
| Command | Description |
|
|
103
|
-
|---------|-------------|
|
|
104
|
-
| `natureco mcp list` | List connected MCP servers |
|
|
105
|
-
| `natureco mcp add` | Add MCP server (filesystem, github, postgres...) |
|
|
106
|
-
| `natureco mcp templates` | List ready-made MCP templates |
|
|
107
|
-
| `natureco mcp enable <name>` | Enable MCP server |
|
|
108
|
-
| `natureco mcp disable <name>` | Disable MCP server |
|
|
109
|
-
|
|
110
|
-
### Automation
|
|
111
|
-
|
|
112
|
-
| Command | Description |
|
|
113
|
-
|---------|-------------|
|
|
114
|
-
| `natureco ultrareview file.js` | Code review — security, performance, quality scores |
|
|
115
|
-
| `natureco git review` | Review staged changes |
|
|
116
|
-
| `natureco git commit` | Generate commit message with AI |
|
|
117
|
-
| `natureco cron add` | Create scheduled task |
|
|
118
|
-
| `natureco cron list` | List cron jobs |
|
|
119
|
-
| `natureco cron start` | Start cron daemon |
|
|
120
|
-
| `natureco hooks create type` | Create hook (pre-message, post-message...) |
|
|
121
|
-
| `natureco commands create name` | Create custom /command |
|
|
122
|
-
| `natureco migrate --from openclaw` | Migrate from OpenClaw (memory, crons, skills, scripts) |
|
|
123
|
-
|
|
124
|
-
### Gateway & Dashboard
|
|
125
|
-
|
|
126
|
-
| Command | Description |
|
|
127
|
-
|---------|-------------|
|
|
128
|
-
| `natureco gateway start` | Start gateway in background (WhatsApp auto-start) |
|
|
129
|
-
| `natureco gateway stop` | Stop gateway |
|
|
130
|
-
| `natureco gateway status` | Gateway status (last 10 logs) |
|
|
131
|
-
| `natureco gateway logs` | Show all logs (~/.natureco/gateway.log) |
|
|
132
|
-
| `natureco dashboard` | Open web UI (localhost:3848) |
|
|
133
|
-
| `natureco dashboard stop` | Stop dashboard |
|
|
134
|
-
| `natureco dashboard status` | Check dashboard status |
|
|
135
|
-
|
|
136
|
-
### Configuration
|
|
137
|
-
|
|
138
|
-
| Command | Description |
|
|
139
|
-
|---------|-------------|
|
|
140
|
-
| `natureco config list` | Show all settings |
|
|
141
|
-
| `natureco config get key` | Get specific setting |
|
|
142
|
-
| `natureco config set key val` | Change setting |
|
|
143
|
-
| `natureco init` | Create project folder (.natureco/) |
|
|
144
|
-
|
|
145
|
-
## 🔌 Integrations
|
|
146
|
-
|
|
147
|
-
### Telegram
|
|
148
|
-
|
|
149
|
-
Connect your Telegram bot, receive and respond to messages. Authentication with bot token and user ID.
|
|
36
|
+
## 🚀 Hızlı Başlangıç
|
|
150
37
|
|
|
151
38
|
```bash
|
|
152
|
-
|
|
153
|
-
|
|
39
|
+
# Global kurulum
|
|
40
|
+
npm install -g natureco-cli
|
|
154
41
|
|
|
155
|
-
|
|
42
|
+
# İlk kurulum sihirbazı
|
|
43
|
+
natureco setup
|
|
156
44
|
|
|
157
|
-
|
|
45
|
+
# Sohbet başlat
|
|
46
|
+
natureco chat
|
|
158
47
|
|
|
159
|
-
|
|
160
|
-
natureco
|
|
48
|
+
# Code agent
|
|
49
|
+
natureco code
|
|
161
50
|
```
|
|
162
51
|
|
|
163
|
-
|
|
52
|
+
---
|
|
164
53
|
|
|
165
|
-
|
|
54
|
+
## 📋 Komutlar
|
|
55
|
+
|
|
56
|
+
### 🤖 AI & Chat
|
|
57
|
+
|
|
58
|
+
| Komut | Açıklama |
|
|
59
|
+
|-------|----------|
|
|
60
|
+
| `natureco chat` | AI sohbet başlat (varsayılan bot) |
|
|
61
|
+
| `natureco chat "Bot Adı"` | Belirli bot ile sohbet |
|
|
62
|
+
| `natureco chat --resume` | Son oturumu devam ettir |
|
|
63
|
+
| `natureco code` | Code agent — dosya oku, yaz, komut çalıştır |
|
|
64
|
+
| `natureco code src/app.js` | Belirli dosyaya odaklanarak code agent başlat |
|
|
65
|
+
| `natureco ask "soru"` | Tek seferlik soru |
|
|
66
|
+
| `natureco run script.md` | Markdown script çalıştır |
|
|
67
|
+
| `natureco bots` | Bot listesi |
|
|
68
|
+
|
|
69
|
+
**Chat içi komutlar:**
|
|
70
|
+
|
|
71
|
+
| Komut | Açıklama |
|
|
72
|
+
|-------|----------|
|
|
73
|
+
| `/clear` | Ekranı temizle |
|
|
74
|
+
| `/bot` | Bot listesi / bot değiştir |
|
|
75
|
+
| `/skills` | Aktif skill'ler |
|
|
76
|
+
| `/memory` | Hafıza durumu |
|
|
77
|
+
| `/memory clear` | Hafızayı temizle |
|
|
78
|
+
| `/commands` | Özel komutlar |
|
|
79
|
+
| `/help` | Yardım |
|
|
80
|
+
| `exit` / `quit` | Çıkış |
|
|
81
|
+
|
|
82
|
+
**Code agent komutları:**
|
|
83
|
+
|
|
84
|
+
| Komut | Açıklama |
|
|
85
|
+
|-------|----------|
|
|
86
|
+
| `/clear` | Ekranı temizle |
|
|
87
|
+
| `/summary` | Session özetini göster |
|
|
88
|
+
| `/done` | Bitir ve özet göster |
|
|
89
|
+
| `/help` | Yardım |
|
|
90
|
+
|
|
91
|
+
### ⚙️ Kurulum & Ayarlar
|
|
92
|
+
|
|
93
|
+
| Komut | Açıklama |
|
|
94
|
+
|-------|----------|
|
|
95
|
+
| `natureco setup` | İlk kurulum sihirbazı |
|
|
96
|
+
| `natureco login` | API key ile giriş |
|
|
97
|
+
| `natureco logout` | Çıkış |
|
|
98
|
+
| `natureco config list` | Tüm ayarları göster |
|
|
99
|
+
| `natureco config set key val` | Ayar değiştir |
|
|
100
|
+
| `natureco config get key` | Ayar oku |
|
|
101
|
+
| `natureco doctor` | Sistem sağlık kontrolü |
|
|
102
|
+
| `natureco doctor --fix` | Sorunları otomatik düzelt |
|
|
103
|
+
| `natureco update` | Güncelleme kontrol |
|
|
104
|
+
|
|
105
|
+
### 🔌 Entegrasyonlar
|
|
106
|
+
|
|
107
|
+
| Komut | Açıklama |
|
|
108
|
+
|-------|----------|
|
|
109
|
+
| `natureco telegram connect` | Telegram bot bağla |
|
|
110
|
+
| `natureco discord connect` | Discord bot bağla |
|
|
111
|
+
| `natureco slack connect` | Slack workspace bağla |
|
|
112
|
+
| `natureco whatsapp connect` | WhatsApp QR ile bağla |
|
|
113
|
+
| `natureco whatsapp status` | Bağlantı durumu |
|
|
114
|
+
| `natureco whatsapp allow <numara>` | İzin listesine ekle |
|
|
115
|
+
| `natureco gateway start` | Gateway'i arka planda başlat |
|
|
116
|
+
| `natureco gateway stop` | Gateway'i durdur |
|
|
117
|
+
| `natureco gateway status` | Gateway durumu |
|
|
118
|
+
|
|
119
|
+
### 🛠️ Geliştirici Araçları
|
|
120
|
+
|
|
121
|
+
| Komut | Açıklama |
|
|
122
|
+
|-------|----------|
|
|
123
|
+
| `natureco git review` | Staged değişiklikleri incele |
|
|
124
|
+
| `natureco git commit` | AI ile commit mesajı oluştur |
|
|
125
|
+
| `natureco skills list` | Skill listesi |
|
|
126
|
+
| `natureco skills install slug` | Skill kur |
|
|
127
|
+
| `natureco skills remove slug` | Skill kaldır |
|
|
128
|
+
| `natureco mcp list` | MCP sunucuları |
|
|
129
|
+
| `natureco mcp add` | MCP sunucu ekle |
|
|
130
|
+
| `natureco hooks create type` | Hook oluştur |
|
|
131
|
+
| `natureco commands create name` | Özel komut oluştur |
|
|
132
|
+
| `natureco cron add` | Zamanlanmış görev ekle |
|
|
133
|
+
| `natureco ultrareview file.js` | Detaylı kod inceleme |
|
|
134
|
+
| `natureco migrate --from openclaw` | OpenClaw'dan taşı |
|
|
135
|
+
|
|
136
|
+
### 📊 Yönetim
|
|
137
|
+
|
|
138
|
+
| Komut | Açıklama |
|
|
139
|
+
|-------|----------|
|
|
140
|
+
| `natureco dashboard` | Web UI aç (localhost:3848) |
|
|
141
|
+
| `natureco memory status` | Hafıza durumu |
|
|
142
|
+
| `natureco logs` | Gateway logları |
|
|
143
|
+
| `natureco status` | Sistem durumu |
|
|
144
|
+
| `natureco agents list` | Agent listesi |
|
|
145
|
+
| `natureco plugins list` | Plugin listesi |
|
|
146
|
+
| `natureco security audit` | Güvenlik denetimi |
|
|
147
|
+
| `natureco reset` | Sıfırlama |
|
|
148
|
+
| `natureco sessions list` | Oturum listesi |
|
|
166
149
|
|
|
167
|
-
|
|
168
|
-
natureco slack connect
|
|
169
|
-
```
|
|
150
|
+
---
|
|
170
151
|
|
|
171
|
-
|
|
152
|
+
## ⚡ Code Agent
|
|
172
153
|
|
|
173
|
-
|
|
154
|
+
`natureco code` — dosyaları oku, değiştir, komut çalıştır. Claude Code alternatifi.
|
|
174
155
|
|
|
175
156
|
```bash
|
|
176
|
-
#
|
|
177
|
-
natureco
|
|
157
|
+
# Genel code agent
|
|
158
|
+
natureco code
|
|
178
159
|
|
|
179
|
-
#
|
|
180
|
-
natureco
|
|
160
|
+
# Belirli dosyaya odaklan
|
|
161
|
+
natureco code src/pages/Login.tsx
|
|
162
|
+
natureco code backend/api/routes.js
|
|
163
|
+
```
|
|
181
164
|
|
|
182
|
-
|
|
183
|
-
|
|
165
|
+
**Özellikler:**
|
|
166
|
+
- **Streaming output** — yanıt gelirken ekrana yazılır
|
|
167
|
+
- **Tool spinner** — her tool çalışırken animasyon gösterir
|
|
168
|
+
- **Onay mekanizması** — `write_file` ve tehlikeli bash komutlarında onay ister
|
|
169
|
+
- **Proje context** — başlangıçta dizini otomatik tarar
|
|
170
|
+
- **Session özeti** — kaç dosya değiştirildi, kaç komut çalıştı
|
|
171
|
+
- **Max 20 iteration** — karmaşık görevler için uzun tool loop
|
|
184
172
|
|
|
185
|
-
# Check status
|
|
186
|
-
natureco whatsapp status
|
|
187
173
|
```
|
|
174
|
+
⚡ NatureCo Code · İchigo · v2.19.0
|
|
175
|
+
────────────────────────────────────────────────────────────────────────────────
|
|
188
176
|
|
|
189
|
-
|
|
190
|
-
- QR code connection in terminal
|
|
191
|
-
- Session persistence (~/.natureco/whatsapp-sessions/)
|
|
192
|
-
- Allow list control (last 10 digits comparison)
|
|
193
|
-
- Gateway auto-start
|
|
194
|
-
- OpenClaw-style logging
|
|
195
|
-
- Auto-reconnect (515, 408 error codes)
|
|
196
|
-
- Multiple message format support (text, caption, buttons, list...)
|
|
177
|
+
You Login sayfasındaki form validasyonunu düzelt
|
|
197
178
|
|
|
198
|
-
|
|
179
|
+
İchigo Önce mevcut kodu okuyayım...
|
|
199
180
|
|
|
200
|
-
|
|
181
|
+
✓ read_file — {"path":"src/pages/Login.tsx"}
|
|
201
182
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
183
|
+
Sorunu buldum. email regex yanlış. Düzeltiyorum...
|
|
184
|
+
|
|
185
|
+
⚠️ write_file: {"path":"src/pages/Login.tsx"}
|
|
186
|
+
Devam edilsin mi? (Y/n)
|
|
205
187
|
|
|
206
|
-
|
|
207
|
-
tail -f ~/.natureco/gateway.log
|
|
188
|
+
✓ write_file — {"path":"src/pages/Login.tsx"}
|
|
208
189
|
|
|
209
|
-
|
|
210
|
-
natureco gateway status
|
|
190
|
+
Düzeltme tamamlandı. email validasyonu artık RFC 5322 uyumlu.
|
|
211
191
|
|
|
212
|
-
|
|
213
|
-
|
|
192
|
+
─── Agent Session Özeti ───
|
|
193
|
+
✓ 1 dosya değiştirildi
|
|
194
|
+
✓ 0 komut çalıştırıldı
|
|
195
|
+
✓ 2 tool çağrısı yapıldı
|
|
196
|
+
◉ 1 mesaj
|
|
214
197
|
```
|
|
215
198
|
|
|
216
|
-
|
|
217
|
-
- Detached process (runs even if terminal closed)
|
|
218
|
-
- WhatsApp auto-start (if saved in config)
|
|
219
|
-
- OpenClaw-style log format: `[timestamp] [module] message`
|
|
220
|
-
- Health check every 60 seconds
|
|
221
|
-
- Auto-restart on connection loss (10s delay)
|
|
222
|
-
- Platform-aware stop (SIGTERM → SIGKILL / taskkill)
|
|
223
|
-
- All logs in ~/.natureco/gateway.log
|
|
199
|
+
---
|
|
224
200
|
|
|
225
|
-
## 🎨
|
|
201
|
+
## 🎨 Terminal UI
|
|
226
202
|
|
|
227
|
-
|
|
203
|
+
Chalk tabanlı saf terminal arayüzü — blessed yok, çift karakter sorunu yok.
|
|
228
204
|
|
|
229
|
-
```bash
|
|
230
|
-
natureco dashboard
|
|
231
205
|
```
|
|
206
|
+
███╗ ██╗ █████╗ ████████╗██╗ ██╗██████╗ ███████╗ ██████╗ ██████╗
|
|
207
|
+
...
|
|
208
|
+
╚═╝ ╚═══╝╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝ ╚═════╝ ╚═════╝
|
|
232
209
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
-
|
|
236
|
-
|
|
237
|
-
- Right chat area: Bot avatar, model info, version badge
|
|
238
|
-
- Typing indicator (three dots animation)
|
|
239
|
-
- Turkish character support
|
|
240
|
-
- Responsive design
|
|
210
|
+
(\\_/) Hoş geldin, Gencay · İchigo hazır · v2.19.1
|
|
211
|
+
────────────────────────────────────────────────────────────────────────────────
|
|
212
|
+
llama-3.3 · /help için yardım · Ctrl+C çıkış
|
|
213
|
+
────────────────────────────────────────────────────────────────────────────────
|
|
241
214
|
|
|
242
|
-
|
|
215
|
+
You merhaba
|
|
216
|
+
İchigo Merhaba! Nasıl yardımcı olabilirim?
|
|
217
|
+
```
|
|
243
218
|
|
|
244
|
-
|
|
219
|
+
**Günlük tip sistemi** — her gün farklı bir Nature.co özelliği gösterilir. Yeni versiyon varsa changelog gösterilir.
|
|
245
220
|
|
|
246
|
-
|
|
247
|
-
- **Bot Name:** Bot's name (from memory or agents/ folder)
|
|
248
|
-
- **User Name:** User's name
|
|
249
|
-
- **Nickname:** User's nickname
|
|
250
|
-
- **Facts:** Information about user (max 15, sorted by score)
|
|
251
|
-
- **Preferences:** User preferences
|
|
252
|
-
- **Auto-Extract:** Automatic information extraction from messages
|
|
253
|
-
- **Score System:** Each fact has a score, old facts decay
|
|
221
|
+
---
|
|
254
222
|
|
|
255
|
-
|
|
256
|
-
# Show memory
|
|
257
|
-
natureco chat
|
|
258
|
-
/memory
|
|
223
|
+
## 🔧 Yapılandırma
|
|
259
224
|
|
|
260
|
-
|
|
261
|
-
/memory clear
|
|
262
|
-
```
|
|
225
|
+
Config dosyası: `~/.natureco/config.json`
|
|
263
226
|
|
|
264
|
-
**Memory Format:**
|
|
265
227
|
```json
|
|
266
228
|
{
|
|
267
|
-
"
|
|
229
|
+
"providerUrl": "https://api.groq.com/openai/v1",
|
|
230
|
+
"providerApiKey": "gsk_xxx",
|
|
231
|
+
"providerModel": "llama-3.3-70b-versatile",
|
|
268
232
|
"botName": "İchigo",
|
|
269
|
-
"
|
|
270
|
-
"
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
],
|
|
274
|
-
"preferences": [],
|
|
275
|
-
"lastSeen": "2025-01-12T10:30:00.000Z"
|
|
233
|
+
"userName": "Gencay",
|
|
234
|
+
"debug": false,
|
|
235
|
+
"mcpEnabled": true,
|
|
236
|
+
"mcpServers": {}
|
|
276
237
|
}
|
|
277
238
|
```
|
|
278
239
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
Minimal and clean terminal interface. Rabbit ASCII art, progress bar animation, colored output.
|
|
282
|
-
|
|
283
|
-
**UI Features:**
|
|
284
|
-
- **Startup Animation:** Rabbit ASCII art + progress bar (Memory, Skills, Gateway)
|
|
285
|
-
- **Header:** Full terminal width separator, bot name, model, timezone
|
|
286
|
-
- **Message Format:** `You message` (gray) → `İchigo response` (cyan)
|
|
287
|
-
- **Loading:** `●○○ ○●○ ○○●` animation (300ms)
|
|
288
|
-
- **Colors:** Error (red), success (green), bot name (cyan), user (gray)
|
|
289
|
-
- **No Emoji:** Clean, minimal design
|
|
290
|
-
|
|
291
|
-
```
|
|
292
|
-
(\\_/)
|
|
293
|
-
(•ᴥ•)
|
|
294
|
-
/>🌿
|
|
295
|
-
|
|
296
|
-
────────────────────────────────────────
|
|
297
|
-
NatureCo · İchigo · llama-3.1 · UTC+3
|
|
298
|
-
────────────────────────────────────────
|
|
299
|
-
Session · /clear /bot /skills /memory /help · Ctrl+C to exit
|
|
300
|
-
────────────────────────────────────────
|
|
301
|
-
Memory: Gencay · 67 facts Skills: 28 Crons: 21 active
|
|
302
|
-
────────────────────────────────────────
|
|
303
|
-
|
|
304
|
-
You hello
|
|
305
|
-
İchigo Hello! How can I help you?
|
|
306
|
-
```
|
|
240
|
+
**Desteklenen provider'lar:**
|
|
307
241
|
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
242
|
+
| Provider | URL |
|
|
243
|
+
|----------|-----|
|
|
244
|
+
| Groq | `https://api.groq.com/openai/v1` |
|
|
245
|
+
| OpenAI | `https://api.openai.com/v1` |
|
|
246
|
+
| Anthropic | `https://api.anthropic.com` |
|
|
247
|
+
| Together AI | `https://api.together.xyz/v1` |
|
|
248
|
+
| Fireworks | `https://api.fireworks.ai/inference/v1` |
|
|
249
|
+
| DeepSeek | `https://api.deepseek.com/v1` |
|
|
250
|
+
| OpenRouter | `https://openrouter.ai/api/v1` |
|
|
251
|
+
| Ollama (local) | `http://localhost:11434/v1` |
|
|
252
|
+
| LM Studio (local) | `http://localhost:1234/v1` |
|
|
311
253
|
|
|
312
254
|
```bash
|
|
313
|
-
#
|
|
314
|
-
natureco
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
natureco migrate --from openclaw --openclaw-dir /path/to/.openclaw
|
|
255
|
+
# Provider değiştir
|
|
256
|
+
natureco config set providerUrl https://api.openai.com/v1
|
|
257
|
+
natureco config set providerApiKey sk-xxx
|
|
258
|
+
natureco config set providerModel gpt-4o
|
|
318
259
|
```
|
|
319
260
|
|
|
320
|
-
|
|
321
|
-
- **Memory:** USER.md → universal-provider.json (name, nickname, timezone, notes)
|
|
322
|
-
- **Memory Files:** MEMORY.md and memory/*.md → facts (max 15, deduplicated)
|
|
323
|
-
- **Bot Name:** From agents/ folder name or cron job names
|
|
324
|
-
- **Cron Jobs:** jobs.json → crons.json (path normalization, duplicate check)
|
|
325
|
-
- **Telegram:** allowFrom → config
|
|
326
|
-
- **WhatsApp:** Session → whatsapp-sessions (number normalization)
|
|
327
|
-
- **Scripts:** workspace/scripts → .natureco/workspace/scripts (path fixes, package.json)
|
|
328
|
-
- **Skills:** workspace/skills → .natureco/skills
|
|
329
|
-
- **.env:** Workspace .env file copied
|
|
330
|
-
|
|
331
|
-
**Migration Features:**
|
|
332
|
-
- Path normalization (Windows → Unix)
|
|
333
|
-
- Duplicate detection (crons, facts)
|
|
334
|
-
- WhatsApp number normalization (JID → clean phone)
|
|
335
|
-
- Bot name extraction (agents/, cron jobs, MEMORY.md)
|
|
336
|
-
- Facts filtering (skip tables, commands, emojis)
|
|
261
|
+
---
|
|
337
262
|
|
|
338
|
-
##
|
|
263
|
+
## 🧠 Hafıza Sistemi
|
|
339
264
|
|
|
340
|
-
|
|
265
|
+
Bot başına kalıcı hafıza. Kullanıcı adı, bot adı, tercihler, otomatik bilgi çıkarımı.
|
|
341
266
|
|
|
342
267
|
```bash
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
**Dashboard Özellikleri:**
|
|
347
|
-
- Modern glassmorphism UI
|
|
348
|
-
- Animated gradient background (natureco.me/landing ile aynı)
|
|
349
|
-
- Sol sidebar: Aktif bot, diğer botlar, kanallar, skill'ler, hafıza, sessions, sistem, cron jobs
|
|
350
|
-
- Sağ chat alanı: Bot avatar, model bilgisi, version badge
|
|
351
|
-
- Typing indicator (üç nokta animasyonu)
|
|
352
|
-
- Türkçe karakter desteği
|
|
353
|
-
- Responsive tasarım
|
|
354
|
-
|
|
355
|
-
## 🤖 Custom AI Providers
|
|
356
|
-
|
|
357
|
-
NatureCo dışında kendi AI provider'ınızı kullanın. Setup sırasında veya config ile ayarlayın.
|
|
358
|
-
|
|
359
|
-
**Desteklenen Provider'lar:**
|
|
360
|
-
- **OpenAI:** GPT-5.5, GPT-5.4, GPT-5, GPT-4.1, GPT-4o, o3, o4 Mini
|
|
361
|
-
- **Anthropic:** Claude Opus 4.7/4.6/4.5, Sonnet 4.6/4.5, Haiku 4.5/3.5
|
|
362
|
-
- **Groq:** Llama 3.3 70B, Llama 3.1 8B/70B, Mixtral 8x7B, Gemma 2 9B
|
|
363
|
-
- **Gemini:** 2.5 Pro/Flash, 2.0 Flash, 1.5 Pro/Flash
|
|
268
|
+
# Hafızayı göster
|
|
269
|
+
/memory
|
|
364
270
|
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
271
|
+
# Hafızayı temizle
|
|
272
|
+
/memory clear
|
|
273
|
+
```
|
|
368
274
|
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
275
|
+
```json
|
|
276
|
+
{
|
|
277
|
+
"name": "Gencay",
|
|
278
|
+
"botName": "İchigo",
|
|
279
|
+
"facts": [
|
|
280
|
+
{ "value": "Timezone: UTC+3", "score": 6 },
|
|
281
|
+
{ "value": "Developer", "score": 5 }
|
|
282
|
+
]
|
|
283
|
+
}
|
|
372
284
|
```
|
|
373
285
|
|
|
374
|
-
|
|
286
|
+
---
|
|
287
|
+
|
|
288
|
+
## 📁 Dosya Yapısı
|
|
375
289
|
|
|
376
290
|
```
|
|
377
291
|
~/.natureco/
|
|
378
292
|
├── config.json # Ana yapılandırma
|
|
379
293
|
├── gateway.pid # Gateway process ID
|
|
380
294
|
├── gateway.log # Gateway logları
|
|
381
|
-
├──
|
|
295
|
+
├── lastVersion # Son görülen versiyon
|
|
382
296
|
├── skills/ # Yüklü skill'ler
|
|
383
297
|
├── memory/ # Bot hafızaları
|
|
384
298
|
├── history/ # Chat geçmişi
|
|
385
299
|
├── sessions/ # Chat oturumları
|
|
386
|
-
├──
|
|
387
|
-
|
|
388
|
-
└── cron.json # Cron görevleri
|
|
389
|
-
```
|
|
390
|
-
|
|
391
|
-
## 🔧 Configuration
|
|
392
|
-
|
|
393
|
-
Config dosyası: `~/.natureco/config.json`
|
|
394
|
-
|
|
395
|
-
**v2.x Örnek Config (Universal Provider):**
|
|
396
|
-
```json
|
|
397
|
-
{
|
|
398
|
-
"providerUrl": "https://api.groq.com/openai/v1",
|
|
399
|
-
"providerApiKey": "gsk_xxx",
|
|
400
|
-
"providerModel": "llama-3.3-70b-versatile",
|
|
401
|
-
"debug": false,
|
|
402
|
-
"skills": { "enabled": true, "list": [] },
|
|
403
|
-
"mcpServers": {}
|
|
404
|
-
}
|
|
300
|
+
├── conversations/ # Konuşma geçmişi (disk)
|
|
301
|
+
└── whatsapp-sessions/ # WhatsApp session'ları
|
|
405
302
|
```
|
|
406
303
|
|
|
407
|
-
|
|
408
|
-
- Groq: `https://api.groq.com/openai/v1`
|
|
409
|
-
- OpenAI: `https://api.openai.com/v1`
|
|
410
|
-
- Anthropic: `https://api.anthropic.com`
|
|
411
|
-
- Together AI: `https://api.together.xyz/v1`
|
|
412
|
-
- Fireworks AI: `https://api.fireworks.ai/inference/v1`
|
|
413
|
-
- DeepSeek: `https://api.deepseek.com/v1`
|
|
414
|
-
- OpenRouter: `https://openrouter.ai/api/v1`
|
|
415
|
-
- Ollama (local): `http://localhost:11434/v1`
|
|
416
|
-
- LM Studio (local): `http://localhost:1234/v1`
|
|
417
|
-
|
|
418
|
-
**Config Komutları:**
|
|
419
|
-
```bash
|
|
420
|
-
# Provider değiştir
|
|
421
|
-
natureco config set providerUrl https://api.openai.com/v1
|
|
422
|
-
natureco config set providerApiKey sk-xxx
|
|
423
|
-
natureco config set providerModel gpt-4o
|
|
424
|
-
|
|
425
|
-
# Debug mode
|
|
426
|
-
natureco config set debug true
|
|
427
|
-
|
|
428
|
-
# Tüm ayarları göster
|
|
429
|
-
natureco config list
|
|
430
|
-
```
|
|
304
|
+
---
|
|
431
305
|
|
|
432
|
-
## 📚
|
|
306
|
+
## 📚 Kaynaklar
|
|
433
307
|
|
|
434
|
-
- **
|
|
308
|
+
- **Web:** [natureco.me](https://natureco.me)
|
|
435
309
|
- **CLI Docs:** [natureco.me/cli](https://natureco.me/cli)
|
|
436
|
-
- **npm
|
|
437
|
-
- **API
|
|
438
|
-
- **GitHub:** [github.com/natureco/cli](https://github.com/natureco/cli)
|
|
310
|
+
- **npm:** [npmjs.com/package/natureco-cli](https://www.npmjs.com/package/natureco-cli)
|
|
311
|
+
- **API:** [natureco.me/developer](https://natureco.me/developer)
|
|
439
312
|
|
|
440
|
-
|
|
313
|
+
---
|
|
314
|
+
|
|
315
|
+
## 📝 Lisans
|
|
441
316
|
|
|
442
317
|
MIT © NatureCo
|
|
443
318
|
|
|
444
319
|
---
|
|
445
320
|
|
|
446
|
-
**Version:** 2.
|
|
447
|
-
|
|
321
|
+
**Version:** 2.19.1 | **Node.js:** >=16.0.0 | **Platform:** macOS, Windows, Linux
|
package/bin/natureco.js
CHANGED
|
@@ -21,6 +21,55 @@ program
|
|
|
21
21
|
.description('NatureCo AI Bot Terminal Interface')
|
|
22
22
|
.version(packageJson.version);
|
|
23
23
|
|
|
24
|
+
program.addHelpText('after', `
|
|
25
|
+
${chalk.yellow('🤖 AI & Chat')}
|
|
26
|
+
${chalk.cyan('chat')} AI sohbet başlat
|
|
27
|
+
${chalk.cyan('code')} Code agent — dosya oku, yaz, komut çalıştır
|
|
28
|
+
${chalk.cyan('ask')} Tek soru sor
|
|
29
|
+
${chalk.cyan('run')} Markdown script çalıştır
|
|
30
|
+
${chalk.cyan('bots')} Bot listesi
|
|
31
|
+
|
|
32
|
+
${chalk.yellow('⚙️ Kurulum & Ayarlar')}
|
|
33
|
+
${chalk.cyan('setup')} İlk kurulum sihirbazı
|
|
34
|
+
${chalk.cyan('login')} API key ile giriş
|
|
35
|
+
${chalk.cyan('logout')} Çıkış
|
|
36
|
+
${chalk.cyan('config')} Ayarları yönet
|
|
37
|
+
${chalk.cyan('doctor')} Sistem sağlık kontrolü
|
|
38
|
+
${chalk.cyan('update')} Güncelleme kontrol
|
|
39
|
+
|
|
40
|
+
${chalk.yellow('🔌 Entegrasyonlar')}
|
|
41
|
+
${chalk.cyan('telegram')} Telegram bağlantısı
|
|
42
|
+
${chalk.cyan('whatsapp')} WhatsApp bağlantısı
|
|
43
|
+
${chalk.cyan('discord')} Discord bağlantısı
|
|
44
|
+
${chalk.cyan('slack')} Slack bağlantısı
|
|
45
|
+
${chalk.cyan('gateway')} WebSocket gateway
|
|
46
|
+
|
|
47
|
+
${chalk.yellow('🛠️ Geliştirici Araçları')}
|
|
48
|
+
${chalk.cyan('git')} Git entegrasyonu
|
|
49
|
+
${chalk.cyan('skills')} Skill yönetimi
|
|
50
|
+
${chalk.cyan('mcp')} MCP sunucuları
|
|
51
|
+
${chalk.cyan('hooks')} Hook yönetimi
|
|
52
|
+
${chalk.cyan('cron')} Zamanlanmış görevler
|
|
53
|
+
${chalk.cyan('sessions')} Oturum yönetimi
|
|
54
|
+
${chalk.cyan('ultrareview')} Detaylı kod inceleme
|
|
55
|
+
|
|
56
|
+
${chalk.yellow('📊 Yönetim')}
|
|
57
|
+
${chalk.cyan('dashboard')} Web kontrol paneli
|
|
58
|
+
${chalk.cyan('memory')} Hafıza yönetimi
|
|
59
|
+
${chalk.cyan('logs')} Gateway logları
|
|
60
|
+
${chalk.cyan('status')} Sistem durumu
|
|
61
|
+
${chalk.cyan('agents')} Agent yönetimi
|
|
62
|
+
${chalk.cyan('plugins')} Plugin yönetimi
|
|
63
|
+
${chalk.cyan('security')} Güvenlik denetimi
|
|
64
|
+
${chalk.cyan('reset')} Sıfırlama
|
|
65
|
+
|
|
66
|
+
${chalk.yellow('Örnekler:')}
|
|
67
|
+
${chalk.gray('$ natureco setup')} İlk kurulum
|
|
68
|
+
${chalk.gray('$ natureco chat')} Sohbet başlat
|
|
69
|
+
${chalk.gray('$ natureco code')} Code agent
|
|
70
|
+
${chalk.gray('$ natureco doctor')} Sistem kontrolü
|
|
71
|
+
`);
|
|
72
|
+
|
|
24
73
|
program
|
|
25
74
|
.command('login')
|
|
26
75
|
.description('Login with your NatureCo API key')
|
package/package.json
CHANGED
|
@@ -24,46 +24,61 @@ async function memoryCmd(args) {
|
|
|
24
24
|
|
|
25
25
|
function statusMemory() {
|
|
26
26
|
const config = getConfig();
|
|
27
|
+
const w = process.stdout.columns || 120;
|
|
28
|
+
const line = chalk.gray('─'.repeat(w));
|
|
27
29
|
|
|
28
30
|
console.log('');
|
|
29
|
-
console.log(
|
|
30
|
-
console.log(chalk.cyan
|
|
31
|
+
console.log(line);
|
|
32
|
+
console.log(chalk.bold.cyan(' Hafıza Durumu'));
|
|
33
|
+
console.log(line);
|
|
31
34
|
|
|
32
35
|
if (!fs.existsSync(MEMORY_DIR)) {
|
|
33
|
-
console.log(chalk.gray(' Hafıza dizini bulunamadı.\n'));
|
|
36
|
+
console.log(chalk.gray('\n Hafıza dizini bulunamadı.\n'));
|
|
37
|
+
console.log(line);
|
|
34
38
|
return;
|
|
35
39
|
}
|
|
36
40
|
|
|
37
41
|
const files = fs.readdirSync(MEMORY_DIR).filter(f => f.endsWith('.json'));
|
|
38
42
|
|
|
39
43
|
if (files.length === 0) {
|
|
40
|
-
console.log(chalk.gray(' Kayıtlı hafıza yok.\n'));
|
|
44
|
+
console.log(chalk.gray('\n Kayıtlı hafıza yok.\n'));
|
|
45
|
+
console.log(line);
|
|
41
46
|
return;
|
|
42
47
|
}
|
|
43
48
|
|
|
44
49
|
let totalFacts = 0;
|
|
50
|
+
const activeBotName = config.botName || '';
|
|
51
|
+
|
|
52
|
+
console.log('');
|
|
45
53
|
files.forEach(file => {
|
|
46
54
|
const botId = file.replace('.json', '');
|
|
47
55
|
try {
|
|
48
56
|
const mem = loadMemory(botId);
|
|
49
57
|
const factCount = (mem.facts || []).length;
|
|
58
|
+
const prefCount = (mem.preferences || []).length;
|
|
50
59
|
totalFacts += factCount;
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
console.log(chalk.gray(
|
|
60
|
+
const isActive = activeBotName && (mem.botName === activeBotName);
|
|
61
|
+
const bar = isActive ? chalk.cyan('▌') : chalk.gray('▌');
|
|
62
|
+
|
|
63
|
+
console.log(bar + ' ' + chalk.bold.white(mem.botName || botId) + (isActive ? chalk.cyan(' ← aktif') : ''));
|
|
64
|
+
console.log(bar + ' ' + chalk.gray('Kullanıcı : ') + chalk.white(mem.name || '—'));
|
|
65
|
+
if (mem.nickname) {
|
|
66
|
+
console.log(bar + ' ' + chalk.gray('Lakap : ') + chalk.white(mem.nickname));
|
|
67
|
+
}
|
|
68
|
+
console.log(bar + ' ' + chalk.gray('Bilgi : ') + chalk.white(`${factCount} kayıt`));
|
|
69
|
+
console.log(bar + ' ' + chalk.gray('Tercihler : ') + chalk.white(`${prefCount} kayıt`));
|
|
56
70
|
if (mem.lastSeen) {
|
|
57
71
|
const d = new Date(mem.lastSeen);
|
|
58
|
-
console.log(chalk.gray(
|
|
72
|
+
console.log(bar + ' ' + chalk.gray('Son görüş : ') + chalk.white(d.toLocaleDateString('tr-TR')));
|
|
59
73
|
}
|
|
60
74
|
console.log('');
|
|
61
75
|
} catch {}
|
|
62
76
|
});
|
|
63
77
|
|
|
64
|
-
console.log(
|
|
65
|
-
console.log(chalk.gray(` ${files.length} bot
|
|
66
|
-
console.log(
|
|
78
|
+
console.log(line);
|
|
79
|
+
console.log(chalk.gray(` ${files.length} bot · ${totalFacts} toplam bilgi · natureco memory search <sorgu>`));
|
|
80
|
+
console.log(line);
|
|
81
|
+
console.log('');
|
|
67
82
|
}
|
|
68
83
|
|
|
69
84
|
function listMemory() {
|
package/src/commands/sessions.js
CHANGED
|
@@ -1,119 +1,183 @@
|
|
|
1
1
|
const chalk = require('chalk');
|
|
2
2
|
const { listSessions, loadSession } = require('../utils/sessions');
|
|
3
|
-
const { getApiKey } = require('../utils/config');
|
|
3
|
+
const { getApiKey, getConfig } = require('../utils/config');
|
|
4
4
|
const { getBots } = require('../utils/api');
|
|
5
5
|
|
|
6
6
|
async function sessions(action, ...args) {
|
|
7
|
-
if (!action || action === 'list')
|
|
8
|
-
return listSessionsCommand();
|
|
9
|
-
}
|
|
10
|
-
|
|
7
|
+
if (!action || action === 'list') return listSessionsCommand();
|
|
11
8
|
if (action === 'show') {
|
|
12
9
|
const sessionId = args[0];
|
|
13
10
|
if (!sessionId) {
|
|
14
|
-
console.log(chalk.red('\n❌ Session ID
|
|
15
|
-
console.log(chalk.gray('
|
|
11
|
+
console.log(chalk.red('\n ❌ Session ID gerekli\n'));
|
|
12
|
+
console.log(chalk.gray(' Kullanım: natureco sessions show <id>\n'));
|
|
16
13
|
process.exit(1);
|
|
17
14
|
}
|
|
18
15
|
return showSession(sessionId);
|
|
19
16
|
}
|
|
20
|
-
|
|
21
|
-
console.log(chalk.
|
|
22
|
-
console.log(chalk.gray('Available actions: list, show\n'));
|
|
17
|
+
console.log(chalk.red(`\n ❌ Bilinmeyen komut: ${action}\n`));
|
|
18
|
+
console.log(chalk.gray(' Kullanım: natureco sessions [list|show]\n'));
|
|
23
19
|
process.exit(1);
|
|
24
20
|
}
|
|
25
21
|
|
|
26
22
|
async function listSessionsCommand() {
|
|
27
23
|
const apiKey = getApiKey();
|
|
28
|
-
|
|
24
|
+
const w = process.stdout.columns || 120;
|
|
25
|
+
const line = chalk.gray('─'.repeat(w));
|
|
26
|
+
|
|
29
27
|
if (!apiKey) {
|
|
30
|
-
console.log(chalk.red('\n❌
|
|
28
|
+
console.log(chalk.red('\n ❌ Giriş yapılmamış. natureco login\n'));
|
|
31
29
|
process.exit(1);
|
|
32
30
|
}
|
|
33
|
-
|
|
31
|
+
|
|
34
32
|
let botList;
|
|
35
33
|
try {
|
|
36
34
|
botList = await getBots(apiKey);
|
|
37
35
|
} catch (err) {
|
|
38
|
-
console.log(chalk.red(`\n❌
|
|
36
|
+
console.log(chalk.red(`\n ❌ Hata: ${err.message}\n`));
|
|
39
37
|
process.exit(1);
|
|
40
38
|
}
|
|
41
|
-
|
|
42
|
-
if (!botList
|
|
43
|
-
console.log(chalk.gray('
|
|
39
|
+
|
|
40
|
+
if (!botList?.bots?.length) {
|
|
41
|
+
console.log(chalk.gray('\n Bot bulunamadı.\n'));
|
|
44
42
|
return;
|
|
45
43
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
let foundAny = false;
|
|
50
|
-
|
|
44
|
+
|
|
45
|
+
// Tüm session'ları topla
|
|
46
|
+
const allSessions = [];
|
|
51
47
|
botList.bots.forEach(bot => {
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
console.log(` ${chalk.white(session.id)} - ${chalk.gray(date)} - ${chalk.gray(messageCount + ' messages')}`);
|
|
48
|
+
const list = listSessions(bot.id);
|
|
49
|
+
list.forEach(s => {
|
|
50
|
+
allSessions.push({
|
|
51
|
+
...s,
|
|
52
|
+
botName: bot.name,
|
|
53
|
+
messageCount: (s.messages || []).length,
|
|
54
|
+
lastMessage: s.messages?.slice(-1)[0]?.user || '',
|
|
60
55
|
});
|
|
61
|
-
|
|
62
|
-
}
|
|
56
|
+
});
|
|
63
57
|
});
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
58
|
+
|
|
59
|
+
// 0 mesajlıları filtrele
|
|
60
|
+
const active = allSessions.filter(s => s.messageCount > 0);
|
|
61
|
+
|
|
62
|
+
console.log('');
|
|
63
|
+
console.log(line);
|
|
64
|
+
const title = chalk.bold.cyan(' Oturumlar');
|
|
65
|
+
const count = chalk.gray(`${active.length} aktif `);
|
|
66
|
+
const pad = w - 12 - String(active.length).length - 8;
|
|
67
|
+
console.log(title + ' '.repeat(Math.max(1, pad)) + count);
|
|
68
|
+
console.log(line);
|
|
69
|
+
|
|
70
|
+
if (active.length === 0) {
|
|
71
|
+
console.log(chalk.gray('\n Henüz oturum yok.\n'));
|
|
72
|
+
console.log(line);
|
|
73
|
+
return;
|
|
67
74
|
}
|
|
75
|
+
|
|
76
|
+
// Grupla
|
|
77
|
+
const now = Date.now();
|
|
78
|
+
const todayStr = new Date().toDateString();
|
|
79
|
+
const groups = { 'Bugün': [], 'Bu Hafta': [], 'Daha Önce': [] };
|
|
80
|
+
|
|
81
|
+
active.forEach(s => {
|
|
82
|
+
const d = new Date(s.createdAt);
|
|
83
|
+
if (d.toDateString() === todayStr) groups['Bugün'].push(s);
|
|
84
|
+
else if (now - d < 7 * 24 * 60 * 60 * 1000) groups['Bu Hafta'].push(s);
|
|
85
|
+
else groups['Daha Önce'].push(s);
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
// Kolon genişlikleri
|
|
89
|
+
const dateW = 17;
|
|
90
|
+
const botW = 14;
|
|
91
|
+
const previewW = Math.max(20, w - dateW - botW - 18 - 10);
|
|
92
|
+
|
|
93
|
+
Object.entries(groups).forEach(([label, items]) => {
|
|
94
|
+
if (!items.length) return;
|
|
95
|
+
|
|
96
|
+
console.log('');
|
|
97
|
+
console.log(chalk.yellow(` ${label}`));
|
|
98
|
+
console.log(chalk.gray(' ' +
|
|
99
|
+
'Tarih/Saat'.padEnd(dateW) +
|
|
100
|
+
'Bot'.padEnd(botW) +
|
|
101
|
+
'Son Mesaj'.padEnd(previewW) +
|
|
102
|
+
'Mesaj'.padStart(6) +
|
|
103
|
+
' ID'
|
|
104
|
+
));
|
|
105
|
+
console.log(chalk.gray(' ' + '·'.repeat(w - 4)));
|
|
106
|
+
|
|
107
|
+
items.forEach(s => {
|
|
108
|
+
const d = new Date(s.createdAt);
|
|
109
|
+
const time = d.toLocaleString('tr-TR', {
|
|
110
|
+
day: '2-digit', month: '2-digit',
|
|
111
|
+
hour: '2-digit', minute: '2-digit',
|
|
112
|
+
});
|
|
113
|
+
const bot = (s.botName || '—').slice(0, botW - 2).padEnd(botW);
|
|
114
|
+
const preview = (s.lastMessage || '—').slice(0, previewW - 2).padEnd(previewW);
|
|
115
|
+
const msgs = String(s.messageCount).padStart(5);
|
|
116
|
+
const id = chalk.gray(s.id.slice(-8));
|
|
117
|
+
|
|
118
|
+
console.log(
|
|
119
|
+
chalk.gray(' ' + time.padEnd(dateW)) +
|
|
120
|
+
chalk.cyan(bot) +
|
|
121
|
+
chalk.white(preview) +
|
|
122
|
+
chalk.gray(msgs) +
|
|
123
|
+
' ' + id
|
|
124
|
+
);
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
console.log('');
|
|
129
|
+
console.log(line);
|
|
130
|
+
console.log(chalk.gray(` ${active.length} aktif oturum · natureco sessions show <id>`));
|
|
131
|
+
console.log(line);
|
|
132
|
+
console.log('');
|
|
68
133
|
}
|
|
69
134
|
|
|
70
135
|
async function showSession(sessionId) {
|
|
71
136
|
const apiKey = getApiKey();
|
|
72
|
-
|
|
137
|
+
const w = process.stdout.columns || 120;
|
|
138
|
+
const line = chalk.gray('─'.repeat(w));
|
|
139
|
+
|
|
73
140
|
if (!apiKey) {
|
|
74
|
-
console.log(chalk.red('\n❌
|
|
141
|
+
console.log(chalk.red('\n ❌ Giriş yapılmamış. natureco login\n'));
|
|
75
142
|
process.exit(1);
|
|
76
143
|
}
|
|
77
|
-
|
|
144
|
+
|
|
78
145
|
let botList;
|
|
79
146
|
try {
|
|
80
147
|
botList = await getBots(apiKey);
|
|
81
148
|
} catch (err) {
|
|
82
|
-
console.log(chalk.red(`\n❌
|
|
149
|
+
console.log(chalk.red(`\n ❌ Hata: ${err.message}\n`));
|
|
83
150
|
process.exit(1);
|
|
84
151
|
}
|
|
85
|
-
|
|
86
|
-
if (!botList || !botList.bots || botList.bots.length === 0) {
|
|
87
|
-
console.log(chalk.gray('No bots found.\n'));
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
// Find session across all bots
|
|
152
|
+
|
|
92
153
|
let session = null;
|
|
93
154
|
let botName = null;
|
|
94
|
-
|
|
95
|
-
for (const bot of botList.bots) {
|
|
155
|
+
for (const bot of (botList?.bots || [])) {
|
|
96
156
|
session = loadSession(bot.id, sessionId);
|
|
97
|
-
if (session) {
|
|
98
|
-
botName = bot.name;
|
|
99
|
-
break;
|
|
100
|
-
}
|
|
157
|
+
if (session) { botName = bot.name; break; }
|
|
101
158
|
}
|
|
102
|
-
|
|
159
|
+
|
|
103
160
|
if (!session) {
|
|
104
|
-
console.log(chalk.red(`\n❌
|
|
161
|
+
console.log(chalk.red(`\n ❌ Oturum bulunamadı: ${sessionId}\n`));
|
|
105
162
|
process.exit(1);
|
|
106
163
|
}
|
|
107
|
-
|
|
108
|
-
console.log(
|
|
109
|
-
console.log(
|
|
110
|
-
console.log(chalk.
|
|
111
|
-
console.log(chalk.gray(`
|
|
112
|
-
|
|
164
|
+
|
|
165
|
+
console.log('');
|
|
166
|
+
console.log(line);
|
|
167
|
+
console.log(chalk.bold.cyan(` Oturum: ${session.id.slice(-8)}`));
|
|
168
|
+
console.log(chalk.gray(` Bot: ${botName} · ${new Date(session.createdAt).toLocaleString('tr-TR')} · ${session.messages.length} mesaj`));
|
|
169
|
+
console.log(line);
|
|
170
|
+
console.log('');
|
|
171
|
+
|
|
113
172
|
session.messages.forEach((msg, i) => {
|
|
114
|
-
|
|
115
|
-
console.log(chalk.
|
|
173
|
+
const num = chalk.gray(` ${String(i + 1).padStart(2)}.`);
|
|
174
|
+
console.log(num + ' ' + chalk.white('You ') + msg.user);
|
|
175
|
+
console.log(' ' + chalk.cyan('Bot ') + msg.bot);
|
|
176
|
+
console.log('');
|
|
116
177
|
});
|
|
178
|
+
|
|
179
|
+
console.log(line);
|
|
180
|
+
console.log('');
|
|
117
181
|
}
|
|
118
182
|
|
|
119
183
|
module.exports = sessions;
|
package/src/commands/status.js
CHANGED
|
@@ -8,77 +8,120 @@ const { getSkills } = require('../utils/skills');
|
|
|
8
8
|
async function status() {
|
|
9
9
|
const config = getConfig();
|
|
10
10
|
const version = require('../../package.json').version;
|
|
11
|
+
const w = process.stdout.columns || 120;
|
|
12
|
+
const line = chalk.gray('─'.repeat(w));
|
|
11
13
|
|
|
14
|
+
// ── Header ────────────────────────────────────────────────────────────────
|
|
12
15
|
console.log('');
|
|
13
|
-
console.log(
|
|
14
|
-
|
|
16
|
+
console.log(line);
|
|
17
|
+
const title = chalk.bold.cyan(' NatureCo CLI') + chalk.gray(' — Durum Raporu');
|
|
18
|
+
const ver = chalk.gray(`v${version} `);
|
|
19
|
+
const pad = w - 16 - version.length - 3;
|
|
20
|
+
console.log(title + ' '.repeat(Math.max(1, pad)) + ver);
|
|
21
|
+
console.log(line);
|
|
15
22
|
|
|
16
|
-
// Provider
|
|
23
|
+
// ── Provider & Bot ────────────────────────────────────────────────────────
|
|
17
24
|
const providerHost = config.providerUrl
|
|
18
25
|
? config.providerUrl.replace('https://', '').split('/')[0]
|
|
19
26
|
: null;
|
|
27
|
+
const model = config.providerModel
|
|
28
|
+
? config.providerModel.split('/').pop().split('-').slice(0, 3).join('-')
|
|
29
|
+
: 'bilinmiyor';
|
|
20
30
|
|
|
21
|
-
console.log(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
console.log(chalk.gray(' Provider : ') + chalk.yellow('yapılandırılmamış'));
|
|
27
|
-
}
|
|
28
|
-
if (config.botName) console.log(chalk.gray(' Bot : ') + chalk.cyan(config.botName));
|
|
29
|
-
if (config.userName) console.log(chalk.gray(' Kullanıcı : ') + chalk.white(config.userName));
|
|
31
|
+
console.log('');
|
|
32
|
+
row('Provider ', providerHost ? chalk.white(providerHost) : chalk.yellow('yapılandırılmamış'),
|
|
33
|
+
'Bot ', config.botName ? chalk.cyan(config.botName) : chalk.gray('—'), w);
|
|
34
|
+
row('Model ', chalk.white(model),
|
|
35
|
+
'Kullanıcı', config.userName ? chalk.white(config.userName) : chalk.gray('—'), w);
|
|
30
36
|
|
|
31
|
-
//
|
|
37
|
+
// ── Servisler ─────────────────────────────────────────────────────────────
|
|
32
38
|
const pidFile = path.join(os.homedir(), '.natureco', 'gateway.pid');
|
|
33
|
-
const gatewayRunning = fs.existsSync(pidFile);
|
|
34
|
-
console.log(chalk.gray(' Gateway : ') + (gatewayRunning ? chalk.green('çalışıyor') : chalk.gray('durdurulmuş')));
|
|
35
|
-
|
|
36
|
-
// Dashboard
|
|
37
39
|
const dashPid = path.join(os.homedir(), '.natureco', 'dashboard.pid');
|
|
40
|
+
const gatewayRunning = fs.existsSync(pidFile);
|
|
38
41
|
const dashRunning = fs.existsSync(dashPid);
|
|
39
|
-
console.log(chalk.gray(' Dashboard : ') + (dashRunning ? chalk.green('çalışıyor (localhost:3848)') : chalk.gray('durdurulmuş')));
|
|
40
42
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
if (config.telegramToken) channels.push('Telegram');
|
|
44
|
-
if (config.whatsappConnected) channels.push('WhatsApp');
|
|
45
|
-
if (config.discordToken) channels.push('Discord');
|
|
46
|
-
if (config.slackToken) channels.push('Slack');
|
|
47
|
-
console.log(chalk.gray(' Kanallar : ') + (channels.length > 0 ? chalk.white(channels.join(', ')) : chalk.gray('yok')));
|
|
43
|
+
row('Gateway ', gatewayRunning ? chalk.green('● çalışıyor') : chalk.gray('○ durdurulmuş'),
|
|
44
|
+
'Dashboard', dashRunning ? chalk.green('● localhost:3848') : chalk.gray('○ durdurulmuş'), w);
|
|
48
45
|
|
|
49
|
-
//
|
|
50
|
-
const
|
|
51
|
-
|
|
46
|
+
// ── Entegrasyonlar ────────────────────────────────────────────────────────
|
|
47
|
+
const tg = config.telegramToken ? chalk.green('● bağlı') : chalk.gray('○ —');
|
|
48
|
+
const wa = config.whatsappConnected ? chalk.green('● bağlı') : chalk.gray('○ —');
|
|
49
|
+
const dc = config.discordToken ? chalk.green('● bağlı') : chalk.gray('○ —');
|
|
50
|
+
const sl = config.slackToken ? chalk.green('● bağlı') : chalk.gray('○ —');
|
|
52
51
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
console.log(
|
|
52
|
+
console.log('');
|
|
53
|
+
console.log(chalk.gray(' ' + '─'.repeat(w - 2)));
|
|
54
|
+
console.log(chalk.gray(' Entegrasyonlar'));
|
|
55
|
+
console.log('');
|
|
56
|
+
row('Telegram ', tg, 'Discord ', dc, w);
|
|
57
|
+
row('WhatsApp ', wa, 'Slack ', sl, w);
|
|
57
58
|
|
|
58
|
-
//
|
|
59
|
+
// ── Kaynaklar ─────────────────────────────────────────────────────────────
|
|
60
|
+
const skills = getSkills();
|
|
61
|
+
const memDir = path.join(os.homedir(), '.natureco', 'memory');
|
|
62
|
+
const memFiles = fs.existsSync(memDir)
|
|
63
|
+
? fs.readdirSync(memDir).filter(f => f.endsWith('.json')).length : 0;
|
|
59
64
|
const sessDir = path.join(os.homedir(), '.natureco', 'sessions');
|
|
65
|
+
let sessCount = 0;
|
|
60
66
|
if (fs.existsSync(sessDir)) {
|
|
61
|
-
|
|
62
|
-
if (sessions.length > 0) {
|
|
63
|
-
console.log(chalk.gray(' Sessions : ') + chalk.white(`${sessions.length} kayıtlı`));
|
|
64
|
-
}
|
|
67
|
+
sessCount = fs.readdirSync(sessDir).filter(f => f.endsWith('.json')).length;
|
|
65
68
|
}
|
|
66
69
|
|
|
67
|
-
|
|
70
|
+
console.log('');
|
|
71
|
+
console.log(chalk.gray(' ' + '─'.repeat(w - 2)));
|
|
72
|
+
console.log(chalk.gray(' Kaynaklar'));
|
|
73
|
+
console.log('');
|
|
74
|
+
row('Skills ', chalk.white(`${skills.length} yüklü`),
|
|
75
|
+
'Hafıza ', chalk.white(`${memFiles} bot`), w);
|
|
76
|
+
row('Sessions ', chalk.white(`${sessCount} kayıtlı`),
|
|
77
|
+
'Versiyon ', chalk.white(`v${version}`), w);
|
|
78
|
+
|
|
79
|
+
// ── Son Loglar ────────────────────────────────────────────────────────────
|
|
68
80
|
const logFile = path.join(os.homedir(), '.natureco', 'gateway.log');
|
|
69
81
|
if (fs.existsSync(logFile)) {
|
|
70
82
|
const lines = fs.readFileSync(logFile, 'utf-8').split('\n').filter(l => l.trim());
|
|
71
83
|
const last = lines.slice(-3);
|
|
72
84
|
if (last.length > 0) {
|
|
73
|
-
console.log(
|
|
74
|
-
|
|
85
|
+
console.log('');
|
|
86
|
+
console.log(chalk.gray(' ' + '─'.repeat(w - 2)));
|
|
87
|
+
console.log(chalk.gray(' Son Aktivite'));
|
|
88
|
+
console.log('');
|
|
89
|
+
last.forEach(l => {
|
|
90
|
+
const trimmed = l.slice(0, w - 4);
|
|
91
|
+
console.log(chalk.gray(' ') + chalk.gray(trimmed));
|
|
92
|
+
});
|
|
75
93
|
}
|
|
76
94
|
}
|
|
77
95
|
|
|
96
|
+
// ── Footer ────────────────────────────────────────────────────────────────
|
|
78
97
|
console.log('');
|
|
79
|
-
console.log(
|
|
80
|
-
console.log(
|
|
81
|
-
|
|
98
|
+
console.log(line);
|
|
99
|
+
console.log(
|
|
100
|
+
chalk.gray(' natureco doctor') +
|
|
101
|
+
chalk.gray(' · ') +
|
|
102
|
+
chalk.gray('natureco chat') +
|
|
103
|
+
chalk.gray(' · ') +
|
|
104
|
+
chalk.gray('natureco code') +
|
|
105
|
+
chalk.gray(' · ') +
|
|
106
|
+
chalk.gray('natureco channels status')
|
|
107
|
+
);
|
|
108
|
+
console.log(line);
|
|
109
|
+
console.log('');
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// ── İki kolon satır yardımcısı ─────────────────────────────────────────────
|
|
113
|
+
function row(label1, val1, label2, val2, w) {
|
|
114
|
+
const col = Math.floor(w / 2);
|
|
115
|
+
const left = chalk.gray(' ' + label1) + val1;
|
|
116
|
+
const right = chalk.gray(label2) + val2;
|
|
117
|
+
// ANSI kodlarını sayma — sabit padding kullan
|
|
118
|
+
const leftPlain = (' ' + label1).length + stripAnsi(String(val1)).length;
|
|
119
|
+
const pad = Math.max(1, col - leftPlain);
|
|
120
|
+
console.log(left + ' '.repeat(pad) + right);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function stripAnsi(str) {
|
|
124
|
+
return str.replace(/\x1B\[[0-9;]*m/g, '');
|
|
82
125
|
}
|
|
83
126
|
|
|
84
127
|
module.exports = status;
|