natureco-cli 1.0.21 → 1.0.22
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 +130 -322
- package/package.json +2 -1
- package/src/commands/whatsapp.js +79 -21
package/README.md
CHANGED
|
@@ -1,386 +1,194 @@
|
|
|
1
1
|
# NatureCo CLI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/natureco-cli)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
[]()
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
Terminal-native AI agent CLI — chat with your bots, automate workflows, and connect Telegram, Discord, Slack & more. A powerful alternative to Claude Code & OpenClaw.
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
**Mac/Linux:**
|
|
10
|
-
```bash
|
|
11
|
-
curl -fsSL https://natureco.me/install.sh | bash
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
**Windows (PowerShell):**
|
|
15
|
-
```powershell
|
|
16
|
-
iwr -useb https://natureco.me/install.ps1 | iex
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
### Manuel Kurulum
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
npm install -g natureco-cli
|
|
23
|
-
```
|
|
9
|
+
## Features
|
|
24
10
|
|
|
25
|
-
**
|
|
26
|
-
-
|
|
11
|
+
- **Terminal-Native Chat** — Interactive conversations with your AI bots directly from the command line with full context awareness
|
|
12
|
+
- **Multi-Platform Integration** — Connect Telegram, Discord, Slack, and WhatsApp bots with simple commands and QR code authentication
|
|
13
|
+
- **Skill System** — Extend bot capabilities with NatureHub and ClawHub skills (thousands of pre-built skills available)
|
|
14
|
+
- **MCP Support** — Integrate Model Context Protocol servers for filesystem, GitHub, databases, and custom tools
|
|
15
|
+
- **AI-Powered Git** — Automated code review, intelligent commit messages, and PR generation with context-aware analysis
|
|
16
|
+
- **Web Dashboard** — Beautiful glassmorphism UI at localhost:3848 for browser-based chat and bot management
|
|
17
|
+
- **WebSocket Gateway** — Real-time bidirectional communication server for custom integrations and live updates
|
|
18
|
+
- **Automation Tools** — Schedule cron jobs, create hooks, and build custom commands for workflow automation
|
|
19
|
+
- **Code Analysis** — Deep code review with security, performance, and quality scoring via ultrareview command
|
|
20
|
+
- **System Health** — Built-in doctor command checks Node.js, API keys, integrations, and auto-fixes common issues
|
|
27
21
|
|
|
28
22
|
## Quick Start
|
|
29
23
|
|
|
30
24
|
```bash
|
|
31
|
-
#
|
|
32
|
-
natureco
|
|
25
|
+
# Install globally
|
|
26
|
+
npm install -g natureco-cli
|
|
33
27
|
|
|
34
|
-
#
|
|
35
|
-
natureco
|
|
28
|
+
# Login with your API key
|
|
29
|
+
natureco login
|
|
36
30
|
|
|
37
31
|
# Start chatting
|
|
38
|
-
natureco chat
|
|
32
|
+
natureco chat
|
|
39
33
|
```
|
|
40
34
|
|
|
41
|
-
The first time you run `natureco`, it will automatically guide you through the setup process:
|
|
42
|
-
1. Create `~/.natureco/` directory
|
|
43
|
-
2. Enter and validate your API key
|
|
44
|
-
3. Select your default bot
|
|
45
|
-
4. Optionally connect Telegram
|
|
46
|
-
|
|
47
35
|
## Commands
|
|
48
36
|
|
|
49
|
-
###
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
natureco
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
natureco
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
37
|
+
### Temel Komutlar
|
|
38
|
+
|
|
39
|
+
| Komut | Açıklama |
|
|
40
|
+
|-------|----------|
|
|
41
|
+
| `natureco` | Gateway ekranını açar — sistem durumu, aktif bot, skill sayısı |
|
|
42
|
+
| `natureco setup` | Kurulum sihirbazını başlatır — API key, bot seç, Telegram/Discord bağla |
|
|
43
|
+
| `natureco login` | API key ile giriş yapar, config'e kaydeder |
|
|
44
|
+
| `natureco logout` | Çıkış yapar, config'i temizler |
|
|
45
|
+
| `natureco help` | Tüm komutları ve örnekleri listeler |
|
|
46
|
+
| `natureco doctor` | Sistem sağlık kontrolü — Node, API key, bot, skill, entegrasyon durumu |
|
|
47
|
+
| `natureco doctor --fix` | Sorunları otomatik onarır — güncellemeleri yükler, config'i yeniler |
|
|
48
|
+
| `natureco update` | Yeni versiyon var mı kontrol eder |
|
|
60
49
|
|
|
61
|
-
|
|
62
|
-
# Login
|
|
63
|
-
natureco login
|
|
50
|
+
### Sohbet
|
|
64
51
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
52
|
+
| Komut | Açıklama |
|
|
53
|
+
|-------|----------|
|
|
54
|
+
| `natureco chat` | Varsayılan botla interaktif sohbet başlatır |
|
|
55
|
+
| `natureco chat "Bot Adı"` | Belirli bir botla sohbet başlatır |
|
|
56
|
+
| `natureco chat --resume` | En son oturuma devam eder |
|
|
57
|
+
| `natureco ask "soru"` | Tek seferlik soru sorar, cevap alır, çıkar |
|
|
58
|
+
| `natureco run script.md` | Markdown dosyasını bota prompt olarak gönderir |
|
|
59
|
+
| `natureco bots` | Tüm botlarınızı listeler (ID, provider, durum) |
|
|
68
60
|
|
|
69
|
-
|
|
61
|
+
**Chat İçi Komutlar:**
|
|
70
62
|
|
|
71
|
-
|
|
63
|
+
| Komut | Açıklama |
|
|
64
|
+
|-------|----------|
|
|
65
|
+
| `/clear` | Ekranı temizler |
|
|
66
|
+
| `/bot` | Bot listesini gösterir veya bot değiştirir |
|
|
67
|
+
| `/skills` | Aktif skill'leri gösterir |
|
|
68
|
+
| `/memory` | Hafıza durumunu gösterir |
|
|
69
|
+
| `/commands` | Özel komutları listeler |
|
|
70
|
+
| `/help` | Chat yardımını gösterir |
|
|
71
|
+
| `exit` veya `quit` | Sohbetten çıkar |
|
|
72
72
|
|
|
73
|
-
|
|
74
|
-
# List your bots
|
|
75
|
-
natureco bots
|
|
76
|
-
```
|
|
73
|
+
### Skill Sistemi
|
|
77
74
|
|
|
78
|
-
|
|
75
|
+
| Komut | Açıklama |
|
|
76
|
+
|-------|----------|
|
|
77
|
+
| `natureco skills` | Yüklü skill'leri listeler (kaynak, açıklama) |
|
|
78
|
+
| `natureco skills install slug` | NatureHub'dan skill yükler |
|
|
79
|
+
| `natureco skills install clawhub:slug` | ClawHub'dan skill yükler (binlerce skill) |
|
|
80
|
+
| `natureco skills browse` | Popüler skill listesini gösterir, interaktif seçim |
|
|
81
|
+
| `natureco skills search "sorgu"` | Skill arar |
|
|
82
|
+
| `natureco skills remove slug` | Skill'i kaldırır |
|
|
83
|
+
| `natureco skills create ad` | Yeni skill şablonu oluşturur |
|
|
79
84
|
|
|
80
|
-
|
|
81
|
-
# Start interactive chat
|
|
82
|
-
natureco chat "Bot Name"
|
|
83
|
-
```
|
|
85
|
+
### Entegrasyonlar
|
|
84
86
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
- `↑` `↓` - Navigate command history
|
|
87
|
+
| Komut | Açıklama |
|
|
88
|
+
|-------|----------|
|
|
89
|
+
| `natureco telegram connect` | Telegram botunu bağlar (token + kullanıcı ID) |
|
|
90
|
+
| `natureco discord connect` | Discord botunu bağlar |
|
|
91
|
+
| `natureco slack connect` | Slack workspace'ine bağlanır |
|
|
92
|
+
| `natureco whatsapp connect` | WhatsApp'ı QR kod ile bağlar |
|
|
92
93
|
|
|
93
|
-
###
|
|
94
|
+
### MCP Sunucuları
|
|
94
95
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
natureco
|
|
96
|
+
| Komut | Açıklama |
|
|
97
|
+
|-------|----------|
|
|
98
|
+
| `natureco mcp list` | Bağlı MCP sunucularını listeler |
|
|
99
|
+
| `natureco mcp add` | MCP sunucu ekler (filesystem, github, postgres...) |
|
|
100
|
+
| `natureco mcp templates` | Hazır MCP şablonlarını listeler |
|
|
98
101
|
|
|
99
|
-
|
|
100
|
-
echo "Summarize this file" | natureco ask
|
|
101
|
-
```
|
|
102
|
+
### Otomasyon
|
|
102
103
|
|
|
103
|
-
|
|
104
|
+
| Komut | Açıklama |
|
|
105
|
+
|-------|----------|
|
|
106
|
+
| `natureco ultrareview dosya.js` | Kodu derinlemesine inceler — güvenlik, performans, kalite puanlar |
|
|
107
|
+
| `natureco git review` | Staged değişiklikleri bota inceletir |
|
|
108
|
+
| `natureco git commit` | AI ile commit mesajı üretir ve commit atar |
|
|
109
|
+
| `natureco cron add` | Zamanlanmış görev oluşturur (her gün, her X saatte) |
|
|
110
|
+
| `natureco cron list` | Cron görevlerini listeler |
|
|
111
|
+
| `natureco cron start` | Cron daemon'unu başlatır |
|
|
112
|
+
| `natureco cron stop` | Cron daemon'unu durdurur |
|
|
113
|
+
| `natureco hooks create tip` | Hook oluşturur (pre-message, post-message, on-start...) |
|
|
114
|
+
| `natureco commands create ad` | Özel /komut oluşturur (chat'te /ad ile kullan) |
|
|
104
115
|
|
|
105
|
-
|
|
106
|
-
# Run markdown script
|
|
107
|
-
natureco run script.md
|
|
108
|
-
```
|
|
116
|
+
### Arayüz & Sunucular
|
|
109
117
|
|
|
110
|
-
|
|
118
|
+
| Komut | Açıklama |
|
|
119
|
+
|-------|----------|
|
|
120
|
+
| `natureco dashboard` | Web arayüzünü açar (localhost:3848) — tarayıcıda chat |
|
|
121
|
+
| `natureco dashboard stop` | Dashboard'u durdurur |
|
|
122
|
+
| `natureco dashboard status` | Dashboard durumunu kontrol eder |
|
|
123
|
+
| `natureco gateway start` | WebSocket sunucusunu başlatır (ws://localhost:3847) |
|
|
124
|
+
| `natureco gateway stop` | Gateway'i durdurur |
|
|
125
|
+
| `natureco gateway status` | Gateway durumunu kontrol eder |
|
|
126
|
+
| `natureco config list` | Tüm ayarları gösterir |
|
|
127
|
+
| `natureco config set key val` | Ayar değiştirir (örn: defaultBot, theme) |
|
|
128
|
+
| `natureco init` | Mevcut klasörde .natureco/ proje klasörü oluşturur |
|
|
111
129
|
|
|
112
|
-
|
|
113
|
-
# Initialize NatureCo project
|
|
114
|
-
natureco init
|
|
115
|
-
```
|
|
130
|
+
## Integrations
|
|
116
131
|
|
|
117
|
-
|
|
118
|
-
- `.natureco/config.json` - Project configuration
|
|
119
|
-
- `.natureco/AGENTS.md` - Bot instructions
|
|
120
|
-
- `.natureco/skills/` - Project-specific skills
|
|
132
|
+
### Telegram
|
|
121
133
|
|
|
122
|
-
|
|
134
|
+
Connect your Telegram bot to receive and respond to messages directly through NatureCo. Supports both bot token and user ID authentication.
|
|
123
135
|
|
|
124
136
|
```bash
|
|
125
|
-
|
|
126
|
-
natureco skills
|
|
127
|
-
|
|
128
|
-
# Install skill from NatureHub
|
|
129
|
-
natureco skills install code-review
|
|
130
|
-
|
|
131
|
-
# Remove skill
|
|
132
|
-
natureco skills remove code-review
|
|
133
|
-
|
|
134
|
-
# Update all skills
|
|
135
|
-
natureco skills update --all
|
|
136
|
-
|
|
137
|
-
# Create new skill
|
|
138
|
-
natureco skills create my-skill
|
|
137
|
+
natureco telegram connect
|
|
139
138
|
```
|
|
140
139
|
|
|
141
|
-
|
|
142
|
-
1. `.natureco/skills/` - Project skills
|
|
143
|
-
2. `~/.natureco/skills/` - User skills
|
|
144
|
-
3. Built-in skills (code-review, summarize, translate)
|
|
145
|
-
|
|
146
|
-
### Configuration
|
|
147
|
-
|
|
148
|
-
```bash
|
|
149
|
-
# List all config
|
|
150
|
-
natureco config list
|
|
151
|
-
|
|
152
|
-
# Get value
|
|
153
|
-
natureco config get defaultBot
|
|
140
|
+
### Discord
|
|
154
141
|
|
|
155
|
-
|
|
156
|
-
natureco config set defaultBotId <bot-id>
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
### MCP Servers
|
|
142
|
+
Integrate Discord bots with full support for server channels, DMs, and slash commands. Seamless setup with OAuth2 flow.
|
|
160
143
|
|
|
161
144
|
```bash
|
|
162
|
-
|
|
163
|
-
natureco mcp list
|
|
164
|
-
|
|
165
|
-
# Show available templates
|
|
166
|
-
natureco mcp templates
|
|
167
|
-
|
|
168
|
-
# Add MCP server (interactive)
|
|
169
|
-
natureco mcp add
|
|
170
|
-
|
|
171
|
-
# Add with specific name
|
|
172
|
-
natureco mcp add my-server
|
|
173
|
-
|
|
174
|
-
# Remove MCP server
|
|
175
|
-
natureco mcp remove my-server
|
|
176
|
-
|
|
177
|
-
# Test connection
|
|
178
|
-
natureco mcp test my-server
|
|
179
|
-
|
|
180
|
-
# Enable/disable server
|
|
181
|
-
natureco mcp enable my-server
|
|
182
|
-
natureco mcp disable my-server
|
|
145
|
+
natureco discord connect
|
|
183
146
|
```
|
|
184
147
|
|
|
185
|
-
|
|
186
|
-
- `filesystem` - File system operations (read, write, list)
|
|
187
|
-
- `github` - GitHub operations (issues, PRs, commits)
|
|
188
|
-
- `postgres` - PostgreSQL database operations
|
|
189
|
-
- `sqlite` - SQLite database operations
|
|
190
|
-
- `brave-search` - Web search using Brave Search API
|
|
148
|
+
### Slack
|
|
191
149
|
|
|
192
|
-
|
|
150
|
+
Connect to Slack workspaces and enable bot interactions in channels and direct messages. Supports Slack App authentication.
|
|
193
151
|
|
|
194
152
|
```bash
|
|
195
|
-
|
|
196
|
-
natureco update
|
|
153
|
+
natureco slack connect
|
|
197
154
|
```
|
|
198
155
|
|
|
199
|
-
|
|
156
|
+
### WhatsApp
|
|
200
157
|
|
|
201
|
-
|
|
158
|
+
Link WhatsApp accounts using QR code authentication. Send and receive messages through your AI bot with full media support.
|
|
202
159
|
|
|
203
160
|
```bash
|
|
204
|
-
natureco
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
## Features
|
|
208
|
-
|
|
209
|
-
### 🎯 First-Time Setup Wizard
|
|
210
|
-
- Automatic setup on first run
|
|
211
|
-
- Interactive API key validation
|
|
212
|
-
- Bot selection
|
|
213
|
-
- Optional Telegram integration
|
|
214
|
-
- Creates `~/.natureco/` directory structure
|
|
215
|
-
|
|
216
|
-
### 🔐 Secure Authentication
|
|
217
|
-
- API key stored in `~/.natureco/config.json`
|
|
218
|
-
- Supports both `nco_` and `nc_` key formats
|
|
219
|
-
|
|
220
|
-
### 🤖 Interactive Chat
|
|
221
|
-
- Real-time conversation with AI bots
|
|
222
|
-
- Command history with arrow keys
|
|
223
|
-
- In-chat commands (/clear, /bot, /skills, /help)
|
|
224
|
-
- Conversation history saved to `~/.natureco/history/`
|
|
225
|
-
|
|
226
|
-
### 🎯 Skills System
|
|
227
|
-
- Three-tier skill hierarchy (builtin/user/project)
|
|
228
|
-
- Automatic skill prompt injection
|
|
229
|
-
- Requirement gating (bins, env vars, OS platform)
|
|
230
|
-
- Install from NatureHub
|
|
231
|
-
|
|
232
|
-
### 📝 Project Context
|
|
233
|
-
- AGENTS.md for project-specific instructions
|
|
234
|
-
- Automatic prompt injection in chat
|
|
235
|
-
- Per-project configuration
|
|
236
|
-
|
|
237
|
-
### 🔌 MCP Server Support
|
|
238
|
-
- Manage MCP servers from CLI
|
|
239
|
-
- 5 ready-to-use templates (filesystem, github, postgres, sqlite, brave-search)
|
|
240
|
-
- Test connections before use
|
|
241
|
-
- Enable/disable servers
|
|
242
|
-
- Config stored in `~/.natureco/config.json`
|
|
243
|
-
|
|
244
|
-
### 🔄 Auto-Update Notifications
|
|
245
|
-
- Automatic update check every 24 hours
|
|
246
|
-
- Manual update check with `natureco update`
|
|
247
|
-
- Notifies when new version is available
|
|
248
|
-
|
|
249
|
-
### 🎨 Beautiful UI
|
|
250
|
-
- Colorful terminal interface with chalk
|
|
251
|
-
- Loading animations with spinners
|
|
252
|
-
- Boxed gateway screen
|
|
253
|
-
- Monospace formatting
|
|
254
|
-
|
|
255
|
-
### 🌍 Cross-Platform
|
|
256
|
-
- Windows, macOS, Linux support
|
|
257
|
-
- PowerShell and Bash compatible
|
|
258
|
-
- Native Node.js fetch (no dependencies)
|
|
259
|
-
|
|
260
|
-
## File Structure
|
|
261
|
-
|
|
262
|
-
```
|
|
263
|
-
~/.natureco/
|
|
264
|
-
├── config.json # Global config (includes mcpServers)
|
|
265
|
-
├── skills/ # User skills
|
|
266
|
-
└── history/ # Chat history
|
|
267
|
-
└── <bot-id>.json
|
|
268
|
-
|
|
269
|
-
.natureco/ # Project folder
|
|
270
|
-
├── config.json # Project config
|
|
271
|
-
├── AGENTS.md # Bot instructions
|
|
272
|
-
└── skills/ # Project skills
|
|
273
|
-
```
|
|
274
|
-
|
|
275
|
-
## Skill Format
|
|
276
|
-
|
|
277
|
-
Skills are defined in `SKILL.md` files:
|
|
278
|
-
|
|
279
|
-
```markdown
|
|
280
|
-
---
|
|
281
|
-
name: code-review
|
|
282
|
-
description: Code review and suggestions
|
|
283
|
-
metadata: {"natureco": {"requires": {"bins": ["node"]}, "os": ["win32","darwin","linux"]}}
|
|
284
|
-
---
|
|
285
|
-
|
|
286
|
-
# Code Review Skill
|
|
287
|
-
|
|
288
|
-
This skill performs code review...
|
|
161
|
+
natureco whatsapp connect
|
|
289
162
|
```
|
|
290
163
|
|
|
291
|
-
##
|
|
292
|
-
|
|
293
|
-
```json
|
|
294
|
-
{
|
|
295
|
-
"apiKey": "nc_...",
|
|
296
|
-
"defaultBot": "Nature Bot V3",
|
|
297
|
-
"defaultBotId": "uuid",
|
|
298
|
-
"skills": {
|
|
299
|
-
"enabled": true,
|
|
300
|
-
"list": ["code-review", "summarize"]
|
|
301
|
-
},
|
|
302
|
-
"mcpServers": {
|
|
303
|
-
"filesystem": {
|
|
304
|
-
"command": "npx",
|
|
305
|
-
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/dir"],
|
|
306
|
-
"env": {},
|
|
307
|
-
"disabled": false,
|
|
308
|
-
"autoApprove": []
|
|
309
|
-
},
|
|
310
|
-
"github": {
|
|
311
|
-
"command": "npx",
|
|
312
|
-
"args": ["-y", "@modelcontextprotocol/server-github"],
|
|
313
|
-
"env": {
|
|
314
|
-
"GITHUB_TOKEN": "ghp_..."
|
|
315
|
-
},
|
|
316
|
-
"disabled": false,
|
|
317
|
-
"autoApprove": []
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
```
|
|
322
|
-
|
|
323
|
-
## API Endpoints
|
|
324
|
-
|
|
325
|
-
- Base URL: `https://api.natureco.me`
|
|
326
|
-
- Bots: `GET /api/v1/bots`
|
|
327
|
-
- Chat: `POST /api/agent/chat`
|
|
164
|
+
## Dashboard
|
|
328
165
|
|
|
329
|
-
|
|
166
|
+
Launch a beautiful web interface at `localhost:3848` with glassmorphism design and dark mode. Features include:
|
|
330
167
|
|
|
331
|
-
-
|
|
332
|
-
|
|
333
|
-
|
|
168
|
+
- Real-time chat with all your bots
|
|
169
|
+
- Bot switching and configuration
|
|
170
|
+
- Skill and MCP management
|
|
171
|
+
- Live system stats and health monitoring
|
|
172
|
+
- Responsive design for desktop and mobile
|
|
334
173
|
|
|
335
174
|
```bash
|
|
336
|
-
|
|
337
|
-
natureco
|
|
338
|
-
# Follow the interactive setup wizard
|
|
339
|
-
|
|
340
|
-
# Quick question
|
|
341
|
-
natureco ask "List my tasks for this week"
|
|
342
|
-
|
|
343
|
-
# Run a script
|
|
344
|
-
natureco run deploy-checklist.md
|
|
345
|
-
|
|
346
|
-
# Chat with bot switching
|
|
347
|
-
natureco chat "Nature Bot V3"
|
|
348
|
-
# In chat: /bot "Code Assistant"
|
|
349
|
-
|
|
350
|
-
# Install and use skills
|
|
351
|
-
natureco skills install code-review
|
|
352
|
-
natureco chat "Nature Bot V3"
|
|
353
|
-
# Skills are automatically injected
|
|
354
|
-
|
|
355
|
-
# Add MCP server
|
|
356
|
-
natureco mcp add
|
|
357
|
-
# Select template: filesystem
|
|
358
|
-
# MCP server added
|
|
359
|
-
|
|
360
|
-
# Test MCP connection
|
|
361
|
-
natureco mcp test filesystem
|
|
362
|
-
|
|
363
|
-
# List all MCP servers
|
|
364
|
-
natureco mcp list
|
|
175
|
+
natureco dashboard
|
|
365
176
|
```
|
|
366
177
|
|
|
367
|
-
|
|
178
|
+

|
|
368
179
|
|
|
369
|
-
|
|
370
|
-
Run `natureco login` and enter your API key.
|
|
180
|
+
## Support
|
|
371
181
|
|
|
372
|
-
|
|
373
|
-
|
|
182
|
+
- **Documentation:** [natureco.me/docs](https://natureco.me/docs)
|
|
183
|
+
- **CLI Docs:** [natureco.me/cli](https://natureco.me/cli)
|
|
184
|
+
- **npm Package:** [npmjs.com/package/natureco-cli](https://www.npmjs.com/package/natureco-cli)
|
|
185
|
+
- **GitHub Issues:** [github.com/natureco/cli/issues](https://github.com/natureco/cli/issues)
|
|
186
|
+
- **API Reference:** [natureco.me/api](https://natureco.me/api)
|
|
374
187
|
|
|
375
|
-
|
|
376
|
-
Check skill requirements with `natureco skills` - ensure required binaries and env vars are available.
|
|
188
|
+
## License
|
|
377
189
|
|
|
378
|
-
|
|
379
|
-
- Check if `npx` is installed: `npx --version`
|
|
380
|
-
- Verify environment variables are set correctly
|
|
381
|
-
- Test connection: `natureco mcp test <server-name>`
|
|
382
|
-
- Check server logs in terminal output
|
|
190
|
+
MIT © NatureCo
|
|
383
191
|
|
|
384
|
-
|
|
192
|
+
---
|
|
385
193
|
|
|
386
|
-
|
|
194
|
+
**Version:** 1.0.21 | **Node.js:** >=18.0.0 | **Platform:** macOS, Windows, Linux
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "natureco-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.22",
|
|
4
4
|
"description": "NatureCo AI Bot Terminal Interface",
|
|
5
5
|
"main": "bin/natureco.js",
|
|
6
6
|
"bin": {
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"inquirer": "^8.2.7",
|
|
32
32
|
"node-cron": "^2.0.3",
|
|
33
33
|
"ora": "^5.4.1",
|
|
34
|
+
"qrcode-terminal": "^0.12.0",
|
|
34
35
|
"ws": "^8.20.0"
|
|
35
36
|
},
|
|
36
37
|
"engines": {
|
package/src/commands/whatsapp.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const chalk = require('chalk');
|
|
2
2
|
const inquirer = require('inquirer');
|
|
3
|
+
const qrcode = require('qrcode-terminal');
|
|
3
4
|
const { getApiKey, getConfig, saveConfig } = require('../utils/config');
|
|
4
5
|
const { getBots } = require('../utils/api');
|
|
5
6
|
|
|
@@ -64,14 +65,14 @@ async function connectWhatsApp() {
|
|
|
64
65
|
console.log(chalk.yellow('⏳ QR kod alınıyor...\n'));
|
|
65
66
|
|
|
66
67
|
try {
|
|
67
|
-
const response = await fetch('https://api.natureco.me/api/
|
|
68
|
+
const response = await fetch('https://api.natureco.me/api/whatsapp/connect', {
|
|
68
69
|
method: 'POST',
|
|
69
70
|
headers: {
|
|
70
71
|
'Content-Type': 'application/json',
|
|
71
72
|
'Authorization': `Bearer ${apiKey}`,
|
|
72
73
|
},
|
|
73
74
|
body: JSON.stringify({
|
|
74
|
-
|
|
75
|
+
bot_id: botId,
|
|
75
76
|
}),
|
|
76
77
|
});
|
|
77
78
|
|
|
@@ -82,23 +83,28 @@ async function connectWhatsApp() {
|
|
|
82
83
|
|
|
83
84
|
const data = await response.json();
|
|
84
85
|
|
|
85
|
-
if (data.
|
|
86
|
+
if (data.qr) {
|
|
86
87
|
console.log(chalk.green('✅ QR kod hazır!\n'));
|
|
87
|
-
console.log(chalk.cyan('QR Kod:'));
|
|
88
|
-
console.log(data.qr_code);
|
|
89
|
-
console.log('');
|
|
90
88
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
89
|
+
// Display QR code in terminal
|
|
90
|
+
const qrData = Buffer.from(data.qr, 'base64').toString('utf-8');
|
|
91
|
+
qrcode.generate(qrData, { small: true });
|
|
94
92
|
|
|
95
|
-
console.log(
|
|
93
|
+
console.log('');
|
|
94
|
+
console.log(chalk.gray('1. WhatsApp\'ı açın'));
|
|
96
95
|
console.log(chalk.gray('2. Ayarlar > Bağlı Cihazlar > Cihaz Bağla'));
|
|
97
96
|
console.log(chalk.gray('3. Bu QR kodu taratın\n'));
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
97
|
+
|
|
98
|
+
if (data.session_id) {
|
|
99
|
+
console.log(chalk.cyan('Session ID:'), chalk.white(data.session_id));
|
|
100
|
+
|
|
101
|
+
// Save session ID to config
|
|
102
|
+
config.whatsappSessionId = data.session_id;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (data.note) {
|
|
106
|
+
console.log(chalk.yellow('\n⚠️ Note:'), chalk.gray(data.note));
|
|
107
|
+
}
|
|
102
108
|
} else {
|
|
103
109
|
console.log(chalk.green('✅ WhatsApp bağlantısı başlatıldı!\n'));
|
|
104
110
|
console.log(chalk.gray('Bağlantı durumunu kontrol edin: natureco whatsapp status\n'));
|
|
@@ -109,7 +115,7 @@ async function connectWhatsApp() {
|
|
|
109
115
|
config.whatsappBotId = botId;
|
|
110
116
|
saveConfig(config);
|
|
111
117
|
|
|
112
|
-
console.log(chalk.cyan('
|
|
118
|
+
console.log(chalk.cyan('\nBot:'), chalk.white(selectedBot.name));
|
|
113
119
|
console.log(chalk.gray('Bağlantı tamamlandığında botunuz WhatsApp\'ta aktif olacak.\n'));
|
|
114
120
|
} catch (err) {
|
|
115
121
|
console.log(chalk.red(`\n❌ Connection failed: ${err.message}\n`));
|
|
@@ -143,18 +149,22 @@ async function disconnectWhatsApp() {
|
|
|
143
149
|
|
|
144
150
|
const apiKey = getApiKey();
|
|
145
151
|
|
|
146
|
-
if (apiKey && config.
|
|
152
|
+
if (apiKey && config.whatsappSessionId) {
|
|
147
153
|
try {
|
|
148
|
-
await fetch('https://api.natureco.me/api/
|
|
154
|
+
const response = await fetch('https://api.natureco.me/api/whatsapp/disconnect', {
|
|
149
155
|
method: 'POST',
|
|
150
156
|
headers: {
|
|
151
157
|
'Content-Type': 'application/json',
|
|
152
158
|
'Authorization': `Bearer ${apiKey}`,
|
|
153
159
|
},
|
|
154
160
|
body: JSON.stringify({
|
|
155
|
-
|
|
161
|
+
session_id: config.whatsappSessionId,
|
|
156
162
|
}),
|
|
157
163
|
});
|
|
164
|
+
|
|
165
|
+
if (response.ok) {
|
|
166
|
+
console.log(chalk.green('\n✅ WhatsApp session disconnected from server\n'));
|
|
167
|
+
}
|
|
158
168
|
} catch (err) {
|
|
159
169
|
console.log(chalk.yellow(`\n⚠️ API disconnect failed: ${err.message}`));
|
|
160
170
|
}
|
|
@@ -163,13 +173,14 @@ async function disconnectWhatsApp() {
|
|
|
163
173
|
// Remove from config
|
|
164
174
|
delete config.whatsappConnected;
|
|
165
175
|
delete config.whatsappBotId;
|
|
176
|
+
delete config.whatsappSessionId;
|
|
166
177
|
saveConfig(config);
|
|
167
178
|
|
|
168
|
-
console.log(chalk.green('
|
|
179
|
+
console.log(chalk.green('✅ WhatsApp disconnected locally\n'));
|
|
169
180
|
console.log(chalk.gray('Note: You may need to manually remove the device from WhatsApp settings.\n'));
|
|
170
181
|
}
|
|
171
182
|
|
|
172
|
-
function statusWhatsApp() {
|
|
183
|
+
async function statusWhatsApp() {
|
|
173
184
|
const config = getConfig();
|
|
174
185
|
|
|
175
186
|
if (!config.whatsappConnected) {
|
|
@@ -178,12 +189,59 @@ function statusWhatsApp() {
|
|
|
178
189
|
return;
|
|
179
190
|
}
|
|
180
191
|
|
|
181
|
-
|
|
192
|
+
const apiKey = getApiKey();
|
|
193
|
+
|
|
194
|
+
// Try to get status from API if session ID exists
|
|
195
|
+
if (apiKey && config.whatsappSessionId) {
|
|
196
|
+
try {
|
|
197
|
+
console.log(chalk.yellow('\n⏳ Checking connection status...\n'));
|
|
198
|
+
|
|
199
|
+
const response = await fetch(`https://api.natureco.me/api/whatsapp/status/${config.whatsappSessionId}`, {
|
|
200
|
+
method: 'GET',
|
|
201
|
+
headers: {
|
|
202
|
+
'Authorization': `Bearer ${apiKey}`,
|
|
203
|
+
},
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
if (response.ok) {
|
|
207
|
+
const data = await response.json();
|
|
208
|
+
|
|
209
|
+
if (data.status === 'connected') {
|
|
210
|
+
console.log(chalk.green('✅ WhatsApp connected\n'));
|
|
211
|
+
} else if (data.status === 'pending') {
|
|
212
|
+
console.log(chalk.yellow('⏳ WhatsApp connection pending\n'));
|
|
213
|
+
console.log(chalk.gray('Waiting for QR code scan...\n'));
|
|
214
|
+
} else {
|
|
215
|
+
console.log(chalk.red('❌ WhatsApp disconnected\n'));
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
console.log(chalk.cyan('Session ID:'), chalk.white(data.session_id));
|
|
219
|
+
console.log(chalk.cyan('Bot ID:'), chalk.white(data.bot_id));
|
|
220
|
+
console.log(chalk.cyan('Created:'), chalk.white(data.created_at));
|
|
221
|
+
|
|
222
|
+
if (data.connected_at) {
|
|
223
|
+
console.log(chalk.cyan('Connected:'), chalk.white(data.connected_at));
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
console.log('');
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
} catch (err) {
|
|
230
|
+
console.log(chalk.yellow(`⚠️ Could not fetch status: ${err.message}\n`));
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// Fallback to local config
|
|
235
|
+
console.log(chalk.green('\n✅ WhatsApp connected (local)\n'));
|
|
182
236
|
|
|
183
237
|
if (config.whatsappBotId) {
|
|
184
238
|
console.log(chalk.cyan('Bot ID:'), chalk.white(config.whatsappBotId));
|
|
185
239
|
}
|
|
186
240
|
|
|
241
|
+
if (config.whatsappSessionId) {
|
|
242
|
+
console.log(chalk.cyan('Session ID:'), chalk.white(config.whatsappSessionId));
|
|
243
|
+
}
|
|
244
|
+
|
|
187
245
|
console.log(chalk.gray('\nDisconnect with: natureco whatsapp disconnect\n'));
|
|
188
246
|
}
|
|
189
247
|
|