grok-cli-acp 0.1.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/.env.example +42 -0
- package/.github/workflows/ci.yml +30 -0
- package/.github/workflows/rust.yml +22 -0
- package/.grok/.env.example +85 -0
- package/.grok/COMPLETE_FIX_SUMMARY.md +466 -0
- package/.grok/ENV_CONFIG_GUIDE.md +173 -0
- package/.grok/QUICK_REFERENCE.md +180 -0
- package/.grok/README.md +104 -0
- package/.grok/TESTING_GUIDE.md +393 -0
- package/CHANGELOG.md +465 -0
- package/CODE_REVIEW_SUMMARY.md +414 -0
- package/COMPLETE_FIX_SUMMARY.md +415 -0
- package/CONFIGURATION.md +489 -0
- package/CONTEXT_FILES_GUIDE.md +419 -0
- package/CONTRIBUTING.md +55 -0
- package/CURSOR_POSITION_FIX.md +206 -0
- package/Cargo.toml +88 -0
- package/ERROR_HANDLING_REPORT.md +361 -0
- package/FINAL_FIX_SUMMARY.md +462 -0
- package/FIXES.md +37 -0
- package/FIXES_SUMMARY.md +87 -0
- package/GROK_API_MIGRATION_SUMMARY.md +111 -0
- package/LICENSE +22 -0
- package/MIGRATION_TO_GROK_API.md +223 -0
- package/README.md +504 -0
- package/REVIEW_COMPLETE.md +416 -0
- package/REVIEW_QUICK_REFERENCE.md +173 -0
- package/SECURITY.md +463 -0
- package/SECURITY_AUDIT.md +661 -0
- package/SETUP.md +287 -0
- package/TESTING_TOOLS.md +88 -0
- package/TESTING_TOOL_EXECUTION.md +239 -0
- package/TOOL_EXECUTION_FIX.md +491 -0
- package/VERIFICATION_CHECKLIST.md +419 -0
- package/docs/API.md +74 -0
- package/docs/CHAT_LOGGING.md +39 -0
- package/docs/CURSOR_FIX_DEMO.md +306 -0
- package/docs/ERROR_HANDLING_GUIDE.md +547 -0
- package/docs/FILE_OPERATIONS.md +449 -0
- package/docs/INTERACTIVE.md +401 -0
- package/docs/PROJECT_CREATION_GUIDE.md +570 -0
- package/docs/QUICKSTART.md +378 -0
- package/docs/QUICK_REFERENCE.md +691 -0
- package/docs/RELEASE_NOTES_0.1.2.md +240 -0
- package/docs/TOOLS.md +459 -0
- package/docs/TOOLS_QUICK_REFERENCE.md +210 -0
- package/docs/ZED_INTEGRATION.md +371 -0
- package/docs/extensions.md +464 -0
- package/docs/settings.md +293 -0
- package/examples/extensions/logging-hook/README.md +91 -0
- package/examples/extensions/logging-hook/extension.json +22 -0
- package/package.json +30 -0
- package/scripts/test_acp.py +252 -0
- package/scripts/test_acp.sh +143 -0
- package/scripts/test_acp_simple.sh +72 -0
- package/src/acp/mod.rs +741 -0
- package/src/acp/protocol.rs +323 -0
- package/src/acp/security.rs +298 -0
- package/src/acp/tools.rs +697 -0
- package/src/bin/banner_demo.rs +216 -0
- package/src/bin/docgen.rs +18 -0
- package/src/bin/installer.rs +217 -0
- package/src/cli/app.rs +310 -0
- package/src/cli/commands/acp.rs +721 -0
- package/src/cli/commands/chat.rs +485 -0
- package/src/cli/commands/code.rs +513 -0
- package/src/cli/commands/config.rs +394 -0
- package/src/cli/commands/health.rs +442 -0
- package/src/cli/commands/history.rs +421 -0
- package/src/cli/commands/mod.rs +14 -0
- package/src/cli/commands/settings.rs +1384 -0
- package/src/cli/mod.rs +166 -0
- package/src/config/mod.rs +2212 -0
- package/src/display/ascii_art.rs +139 -0
- package/src/display/banner.rs +289 -0
- package/src/display/components/input.rs +323 -0
- package/src/display/components/mod.rs +2 -0
- package/src/display/components/settings_list.rs +306 -0
- package/src/display/interactive.rs +1255 -0
- package/src/display/mod.rs +62 -0
- package/src/display/terminal.rs +42 -0
- package/src/display/tips.rs +316 -0
- package/src/grok_client_ext.rs +177 -0
- package/src/hooks/loader.rs +407 -0
- package/src/hooks/mod.rs +158 -0
- package/src/lib.rs +174 -0
- package/src/main.rs +65 -0
- package/src/mcp/client.rs +195 -0
- package/src/mcp/config.rs +20 -0
- package/src/mcp/mod.rs +6 -0
- package/src/mcp/protocol.rs +67 -0
- package/src/utils/auth.rs +41 -0
- package/src/utils/chat_logger.rs +568 -0
- package/src/utils/context.rs +390 -0
- package/src/utils/mod.rs +16 -0
- package/src/utils/network.rs +320 -0
- package/src/utils/rate_limiter.rs +166 -0
- package/src/utils/session.rs +73 -0
- package/src/utils/shell_permissions.rs +389 -0
- package/src/utils/telemetry.rs +41 -0
package/README.md
ADDED
|
@@ -0,0 +1,504 @@
|
|
|
1
|
+
# Grok CLI - Enhanced AI Assistant with Gemini-like Experience
|
|
2
|
+
|
|
3
|
+
[](https://github.com/microtech/grok-cli)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
[](https://www.rust-lang.org)
|
|
6
|
+
[](https://buymeacoffee.com/micro.tech)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
A powerful command-line interface for interacting with Grok AI via X API, featuring a beautiful interactive experience inspired by Gemini CLI.
|
|
11
|
+
|
|
12
|
+
> **🎉 New in v0.1.2**:
|
|
13
|
+
> - Session Persistence - Save and resume conversations
|
|
14
|
+
> - Hierarchical Configuration - Project-specific settings
|
|
15
|
+
> - Enhanced Context Discovery - Multi-editor support (.zed/rules, .claude.md, etc.)
|
|
16
|
+
> - Extension System - Custom hooks and plugins
|
|
17
|
+
>
|
|
18
|
+
> See [Quick Reference](docs/QUICK_REFERENCE.md) for details.
|
|
19
|
+
>
|
|
20
|
+
> **🔧 Latest Update**:
|
|
21
|
+
> - **Chat Logging**: Automatic conversation logging with search and replay capabilities
|
|
22
|
+
> - Fixed "failed to deserialize response" error in Zed integration. See [FIXES.md](FIXES.md) for details.
|
|
23
|
+
|
|
24
|
+
## 🚀 Features
|
|
25
|
+
|
|
26
|
+
### 🆕 New Features (v0.1.2)
|
|
27
|
+
- **Session Persistence** - Save and resume conversations with `/save`, `/load`, and `/list` commands
|
|
28
|
+
- **Hierarchical Configuration** - Project-local settings override system defaults (`.grok/config.toml`)
|
|
29
|
+
- **Enhanced Context Discovery** - Multi-editor support: `.zed/rules`, `.claude.md`, `.cursor/rules`, and more
|
|
30
|
+
- **Context File Merging** - Automatically merges all available context files with source annotations
|
|
31
|
+
- **Extension System** - Extend functionality with custom hooks and plugins
|
|
32
|
+
- **Project-Aware AI** - Agent automatically understands your project conventions
|
|
33
|
+
|
|
34
|
+
### ✨ Beautiful Interactive Experience
|
|
35
|
+
- **Adaptive ASCII Art Logo** - Stunning terminal graphics that adapt to your screen size
|
|
36
|
+
- **Rich Interactive Mode** - Gemini CLI-inspired interface with context-aware prompts
|
|
37
|
+
- **Smart Banners & Tips** - Helpful startup guidance and contextual information
|
|
38
|
+
- **Colorful Output** - Professional color scheme with gradient effects
|
|
39
|
+
- **Progress Indicators** - Visual feedback for all operations
|
|
40
|
+
|
|
41
|
+
### 💬 Advanced Chat Capabilities
|
|
42
|
+
- **Interactive Sessions** - Persistent conversations with context tracking
|
|
43
|
+
- **Automatic Tool Execution** - Grok can now create files and directories automatically!
|
|
44
|
+
- **Chat Logging** - Automatic conversation logging with full history
|
|
45
|
+
- **Session Search** - Search through all past conversations
|
|
46
|
+
- **History Replay** - Review and analyze previous sessions
|
|
47
|
+
- **System Prompts** - Customize AI behavior for specialized tasks
|
|
48
|
+
- **Temperature Control** - Adjust creativity levels (0.0-2.0)
|
|
49
|
+
- **Token Management** - Real-time context usage monitoring
|
|
50
|
+
|
|
51
|
+
### 💻 Code Intelligence
|
|
52
|
+
- **Code Explanation** - Understand complex codebases instantly
|
|
53
|
+
- **Code Review** - Get detailed feedback with security focus
|
|
54
|
+
- **Code Generation** - Create code from natural language descriptions
|
|
55
|
+
- **Multi-language Support** - Works with any programming language
|
|
56
|
+
|
|
57
|
+
### 🔧 Developer Tools
|
|
58
|
+
- **Health Diagnostics** - Comprehensive system and API monitoring
|
|
59
|
+
- **Configuration Management** - Flexible TOML-based settings
|
|
60
|
+
- **Zed Editor Integration** - Agent Client Protocol (ACP) support
|
|
61
|
+
- **Network Resilience** - Starlink-optimized with retry logic
|
|
62
|
+
|
|
63
|
+
## 🎨 Visual Demo
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
░██████╗░██████╗░░█████╗░██╗░░██╗
|
|
67
|
+
██╔════╝░██╔══██╗██╔══██╗██║░██╔╝
|
|
68
|
+
██║░░██╗░██████╔╝██║░░██║█████═╝░
|
|
69
|
+
██║░░╚██╗██╔══██╗██║░░██║██╔═██╗░
|
|
70
|
+
╚██████╔╝██║░░██║╚█████╔╝██║░╚██╗
|
|
71
|
+
░╚═════╝░╚═╝░░╚═╝░╚════╝░╚═╝░░╚═╝
|
|
72
|
+
|
|
73
|
+
┌─────────────────────────────────────────────────────┐
|
|
74
|
+
│ Welcome to Grok CLI │
|
|
75
|
+
├─────────────────────────────────────────────────────┤
|
|
76
|
+
│ Tips for getting started: │
|
|
77
|
+
│ 1. Ask questions, edit files, or run commands. │
|
|
78
|
+
│ 2. Be specific for the best results. │
|
|
79
|
+
│ 3. /help for more information. │
|
|
80
|
+
│ 4. Try: "Create a new Rust project structure" │
|
|
81
|
+
└─────────────────────────────────────────────────────┘
|
|
82
|
+
|
|
83
|
+
Grok (grok-3) [demo | 100% context left | 0 messages] >
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## 🤖 Automatic File Operations
|
|
87
|
+
|
|
88
|
+
**NEW!** Grok CLI now supports automatic file and directory creation during chat! Simply ask naturally and Grok will execute the operations for you.
|
|
89
|
+
|
|
90
|
+
### Available Tools
|
|
91
|
+
- **write_file** - Create or overwrite files with content
|
|
92
|
+
- **read_file** - Read file contents
|
|
93
|
+
- **replace** - Find and replace text in files
|
|
94
|
+
- **list_directory** - List directory contents
|
|
95
|
+
- **glob_search** - Find files matching patterns
|
|
96
|
+
- **save_memory** - Save facts to long-term memory
|
|
97
|
+
- **run_shell_command** - Execute shell commands (cargo, git, etc.)
|
|
98
|
+
|
|
99
|
+
### Example Usage
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
# Start interactive mode
|
|
103
|
+
grok
|
|
104
|
+
|
|
105
|
+
# Then ask naturally:
|
|
106
|
+
You: Create a new Rust project with main.rs and a README
|
|
107
|
+
You: Write a hello world program to src/main.rs
|
|
108
|
+
You: Create a .gitignore file for Rust projects
|
|
109
|
+
You: List all .rs files in the project
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### How It Works
|
|
113
|
+
|
|
114
|
+
1. You make a request that involves file operations
|
|
115
|
+
2. Grok responds with tool calls
|
|
116
|
+
3. The CLI automatically executes them in your current directory
|
|
117
|
+
4. You see confirmation for each operation:
|
|
118
|
+
```
|
|
119
|
+
Grok is executing operations...
|
|
120
|
+
✓ Successfully wrote to src/main.rs
|
|
121
|
+
✓ Successfully wrote to README.md
|
|
122
|
+
All operations completed!
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Security
|
|
126
|
+
|
|
127
|
+
- All operations are restricted to your current working directory and subdirectories
|
|
128
|
+
- No access to system files or parent directories
|
|
129
|
+
- Tool execution requires explicit requests (not triggered by accident)
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
## 📦 Installation
|
|
134
|
+
|
|
135
|
+
### Prerequisites
|
|
136
|
+
- Rust 1.70+ (install from [rustup.rs](https://rustup.rs/))
|
|
137
|
+
- X/Grok API key from [x.ai](https://x.ai)
|
|
138
|
+
|
|
139
|
+
### Build from Source
|
|
140
|
+
```bash
|
|
141
|
+
git clone https://github.com/microtech/grok-cli
|
|
142
|
+
cd grok-cli
|
|
143
|
+
cargo build --release
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Initialize Configuration
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
# Create default configuration
|
|
150
|
+
grok config init
|
|
151
|
+
|
|
152
|
+
# Set your API key
|
|
153
|
+
grok config set api_key "your-api-key-here"
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Or use environment variable:
|
|
157
|
+
```bash
|
|
158
|
+
# Add to your shell profile (.bashrc, .zshrc, etc.)
|
|
159
|
+
export GROK_API_KEY="your-api-key-here"
|
|
160
|
+
# or
|
|
161
|
+
export X_API_KEY="your-api-key-here"
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## 🎯 Quick Start
|
|
165
|
+
|
|
166
|
+
### Interactive Mode (Default)
|
|
167
|
+
```bash
|
|
168
|
+
# Start beautiful interactive session
|
|
169
|
+
grok
|
|
170
|
+
|
|
171
|
+
# Start without banner
|
|
172
|
+
grok --hide-banner
|
|
173
|
+
|
|
174
|
+
# Save and load sessions (NEW!)
|
|
175
|
+
> /save my-session
|
|
176
|
+
> /load my-session
|
|
177
|
+
> /list
|
|
178
|
+
|
|
179
|
+
# Project-specific config (NEW!)
|
|
180
|
+
mkdir .grok
|
|
181
|
+
echo 'default_temperature = 0.3' > .grok/config.toml
|
|
182
|
+
|
|
183
|
+
# Multi-editor context support (NEW!)
|
|
184
|
+
echo "# Gemini rules" > GEMINI.md
|
|
185
|
+
echo "# Claude rules" > .claude.md
|
|
186
|
+
mkdir .zed && echo "# Zed rules" > .zed/rules
|
|
187
|
+
# Grok merges ALL context files automatically!
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Single Commands
|
|
191
|
+
```bash
|
|
192
|
+
# Ask a question
|
|
193
|
+
grok chat "Explain Rust ownership"
|
|
194
|
+
|
|
195
|
+
# Interactive chat with system prompt
|
|
196
|
+
grok chat --interactive --system "You are a Rust expert"
|
|
197
|
+
|
|
198
|
+
# Code operations
|
|
199
|
+
grok code explain src/main.rs
|
|
200
|
+
grok code review --focus security *.rs
|
|
201
|
+
grok code generate --language rust "HTTP server with error handling"
|
|
202
|
+
|
|
203
|
+
# System diagnostics
|
|
204
|
+
grok health --all
|
|
205
|
+
grok config show
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
## 🎪 Interactive Commands
|
|
209
|
+
|
|
210
|
+
Once in interactive mode, use these special commands:
|
|
211
|
+
|
|
212
|
+
| Command | Description |
|
|
213
|
+
|---------|-------------|
|
|
214
|
+
| `/help` | Show available commands |
|
|
215
|
+
| `/model [name]` | Change AI model (grok-3, grok-2-latest, etc.) |
|
|
216
|
+
| `/system [prompt]` | Set system prompt for specialized behavior |
|
|
217
|
+
| `/history` | View conversation history |
|
|
218
|
+
| `/status` | Show session information |
|
|
219
|
+
| `/clear` | Clear screen and show logo |
|
|
220
|
+
| `/reset` | Clear conversation history |
|
|
221
|
+
| `/quit` | Exit interactive mode |
|
|
222
|
+
|
|
223
|
+
## 📜 Chat History Management
|
|
224
|
+
|
|
225
|
+
View and manage your conversation logs:
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
# List all saved chat sessions
|
|
229
|
+
grok history list
|
|
230
|
+
|
|
231
|
+
# View a specific session
|
|
232
|
+
grok history view <session-id>
|
|
233
|
+
|
|
234
|
+
# Search through all conversations
|
|
235
|
+
grok history search "authentication"
|
|
236
|
+
|
|
237
|
+
# Clear all chat history
|
|
238
|
+
grok history clear --confirm
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
Chat sessions are automatically logged to `~/.grok/logs/chat_sessions/` in both JSON and human-readable text formats. Configure logging behavior with environment variables:
|
|
242
|
+
|
|
243
|
+
```bash
|
|
244
|
+
GROK_CHAT_LOGGING_ENABLED=true # Enable/disable logging
|
|
245
|
+
GROK_CHAT_LOG_DIR=/path/to/logs # Custom log directory
|
|
246
|
+
GROK_CHAT_LOG_MAX_SIZE_MB=10 # Max size before rotation
|
|
247
|
+
GROK_CHAT_LOG_ROTATION_COUNT=5 # Number of logs to keep
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
See [docs/CHAT_LOGGING.md](docs/CHAT_LOGGING.md) for complete documentation.
|
|
251
|
+
|
|
252
|
+
## ⚙️ Configuration
|
|
253
|
+
|
|
254
|
+
Create `~/.config/grok-cli/config.toml`:
|
|
255
|
+
|
|
256
|
+
```toml
|
|
257
|
+
[api]
|
|
258
|
+
default_model = "grok-3"
|
|
259
|
+
default_temperature = 0.7
|
|
260
|
+
timeout_secs = 30
|
|
261
|
+
|
|
262
|
+
[ui]
|
|
263
|
+
hide_banner = false # Show ASCII logo
|
|
264
|
+
hide_tips = false # Show helpful tips
|
|
265
|
+
colors = true # Enable colored output
|
|
266
|
+
unicode = true # Enable emoji and Unicode
|
|
267
|
+
|
|
268
|
+
[ui.interactive]
|
|
269
|
+
prompt_style = "rich" # "simple", "rich", or "minimal"
|
|
270
|
+
show_context_usage = true # Show token/context info
|
|
271
|
+
check_directory = true # Warn about home directory usage
|
|
272
|
+
startup_animation = true # Animate logo display
|
|
273
|
+
|
|
274
|
+
[ui.footer]
|
|
275
|
+
hide_cwd = false # Show current directory
|
|
276
|
+
hide_model_info = false # Show model and context usage
|
|
277
|
+
hide_status = false # Show session status
|
|
278
|
+
|
|
279
|
+
[network]
|
|
280
|
+
starlink_optimizations = true # Enable satellite internet optimizations
|
|
281
|
+
max_retries = 3 # Network retry attempts
|
|
282
|
+
base_retry_delay = 2 # Base delay between retries
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
## 🌐 Starlink Optimization
|
|
286
|
+
|
|
287
|
+
Grok CLI includes specialized optimizations for satellite internet users:
|
|
288
|
+
|
|
289
|
+
- **Smart Retry Logic** - Exponential backoff with jitter
|
|
290
|
+
- **Connection Drop Detection** - Recognizes satellite handoff patterns
|
|
291
|
+
- **Timeout Management** - Adaptive timeouts based on connection quality
|
|
292
|
+
- **Error Recovery** - Graceful handling of intermittent connectivity
|
|
293
|
+
|
|
294
|
+
## 🎭 Zed Editor Integration
|
|
295
|
+
|
|
296
|
+
Grok CLI supports the Agent Client Protocol (ACP) for seamless Zed editor integration.
|
|
297
|
+
|
|
298
|
+
**For complete setup instructions, see [ZED_INTEGRATION.md](docs/ZED_INTEGRATION.md)**
|
|
299
|
+
|
|
300
|
+
### Quick Setup
|
|
301
|
+
|
|
302
|
+
```bash
|
|
303
|
+
# Initialize configuration (required first)
|
|
304
|
+
grok config init --force
|
|
305
|
+
|
|
306
|
+
# Set your API key
|
|
307
|
+
grok config set api_key YOUR_API_KEY
|
|
308
|
+
|
|
309
|
+
# Test capabilities
|
|
310
|
+
grok acp capabilities
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
### Recommended: STDIO Mode
|
|
314
|
+
|
|
315
|
+
Add to your Zed `settings.json`:
|
|
316
|
+
```json
|
|
317
|
+
{
|
|
318
|
+
"language_models": {
|
|
319
|
+
"grok": {
|
|
320
|
+
"version": "1",
|
|
321
|
+
"provider": "agent",
|
|
322
|
+
"default_model": "grok-2-latest",
|
|
323
|
+
"agent": {
|
|
324
|
+
"command": "grok",
|
|
325
|
+
"args": ["acp", "stdio"],
|
|
326
|
+
"env": {
|
|
327
|
+
"GROK_API_KEY": "your-api-key-here"
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
### Alternative: Server Mode
|
|
336
|
+
|
|
337
|
+
```bash
|
|
338
|
+
# Start ACP server
|
|
339
|
+
grok acp server --port 3000
|
|
340
|
+
|
|
341
|
+
# Test connection
|
|
342
|
+
grok acp test --address 127.0.0.1:3000
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
Add to Zed `settings.json`:
|
|
346
|
+
```json
|
|
347
|
+
{
|
|
348
|
+
"language_models": {
|
|
349
|
+
"grok": {
|
|
350
|
+
"version": "1",
|
|
351
|
+
"provider": "agent",
|
|
352
|
+
"agent": {
|
|
353
|
+
"endpoint": "http://127.0.0.1:3000"
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
## 🎨 Customization
|
|
361
|
+
|
|
362
|
+
### Available Models
|
|
363
|
+
- `grok-3` - Latest and most capable model
|
|
364
|
+
- `grok-2-latest` - Previous generation model
|
|
365
|
+
- `grok-code-fast-1` - Optimized for code tasks
|
|
366
|
+
- `grok-vision-1212` - Supports image analysis
|
|
367
|
+
|
|
368
|
+
### Prompt Styles
|
|
369
|
+
- **Rich** - Full context with model, directory, and usage info
|
|
370
|
+
- **Simple** - Clean prompt with basic info
|
|
371
|
+
- **Minimal** - Just a simple arrow prompt
|
|
372
|
+
|
|
373
|
+
### Color Themes
|
|
374
|
+
The CLI uses a professional color scheme:
|
|
375
|
+
- 🔵 **Blue** - Grok branding and headers
|
|
376
|
+
- 🟢 **Green** - Success messages and confirmations
|
|
377
|
+
- 🟡 **Yellow** - Warnings and important notes
|
|
378
|
+
- 🔴 **Red** - Errors and critical issues
|
|
379
|
+
- 🟣 **Magenta** - Interactive prompts and accents
|
|
380
|
+
- 🔄 **Cyan** - Information and tips
|
|
381
|
+
- ⚫ **Dimmed** - Secondary text and details
|
|
382
|
+
|
|
383
|
+
## 📊 Health Monitoring
|
|
384
|
+
|
|
385
|
+
Comprehensive health checks for optimal performance:
|
|
386
|
+
|
|
387
|
+
```bash
|
|
388
|
+
# Check everything
|
|
389
|
+
grok health --all
|
|
390
|
+
|
|
391
|
+
# Specific checks
|
|
392
|
+
grok health --api # API connectivity
|
|
393
|
+
grok health --config # Configuration validation
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
Health metrics include:
|
|
397
|
+
- ✅ API key validation
|
|
398
|
+
- 🌐 Network connectivity
|
|
399
|
+
- ⚡ Response latency
|
|
400
|
+
- 📊 Model availability
|
|
401
|
+
- 🔧 Configuration integrity
|
|
402
|
+
|
|
403
|
+
## 🚨 Troubleshooting
|
|
404
|
+
|
|
405
|
+
### Common Issues
|
|
406
|
+
|
|
407
|
+
**"failed to deserialize response" Error**
|
|
408
|
+
|
|
409
|
+
This error has been fixed in the latest version. If you're still experiencing it:
|
|
410
|
+
```bash
|
|
411
|
+
# Rebuild the project
|
|
412
|
+
cargo clean
|
|
413
|
+
cargo build --release
|
|
414
|
+
|
|
415
|
+
# Reinitialize configuration
|
|
416
|
+
grok config init --force
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
See [FIXES.md](FIXES.md) for complete details about this fix.
|
|
420
|
+
|
|
421
|
+
**API Key Problems**
|
|
422
|
+
```bash
|
|
423
|
+
# Verify key is set
|
|
424
|
+
grok config get api_key
|
|
425
|
+
|
|
426
|
+
# Set if missing
|
|
427
|
+
grok config set api_key YOUR_KEY
|
|
428
|
+
|
|
429
|
+
# Test connectivity
|
|
430
|
+
grok health --api
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
**Network Issues**
|
|
434
|
+
```bash
|
|
435
|
+
# Enable verbose logging
|
|
436
|
+
grok --verbose chat "test"
|
|
437
|
+
|
|
438
|
+
# Check network health
|
|
439
|
+
grok health --all
|
|
440
|
+
|
|
441
|
+
# Enable Starlink optimizations if needed
|
|
442
|
+
grok config set network.starlink_optimizations true
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
**Configuration Problems**
|
|
446
|
+
```bash
|
|
447
|
+
# Validate config
|
|
448
|
+
grok config validate
|
|
449
|
+
|
|
450
|
+
# Reset to defaults
|
|
451
|
+
grok config init --force
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
**Zed Integration Issues**
|
|
455
|
+
|
|
456
|
+
See the comprehensive troubleshooting section in [ZED_INTEGRATION.md](docs/ZED_INTEGRATION.md)
|
|
457
|
+
|
|
458
|
+
### Debug Mode
|
|
459
|
+
```bash
|
|
460
|
+
# Enable debug output
|
|
461
|
+
RUST_LOG=debug grok --verbose chat "test"
|
|
462
|
+
|
|
463
|
+
# For ACP/Zed debugging
|
|
464
|
+
RUST_LOG=debug grok acp stdio
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
## 🤝 Contributing
|
|
468
|
+
|
|
469
|
+
We welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
|
|
470
|
+
|
|
471
|
+
### Development Setup
|
|
472
|
+
```bash
|
|
473
|
+
git clone https://github.com/microtech/grok-cli
|
|
474
|
+
cd grok-cli
|
|
475
|
+
cargo test
|
|
476
|
+
cargo clippy
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
## 📚 Documentation
|
|
480
|
+
|
|
481
|
+
- [ZED_INTEGRATION.md](docs/ZED_INTEGRATION.md) - Complete Zed editor integration guide
|
|
482
|
+
- [FIXES.md](FIXES.md) - Recent bug fixes and solutions
|
|
483
|
+
- [SETUP.md](SETUP.md) - Detailed setup instructions
|
|
484
|
+
- [TESTING_TOOLS.md](TESTING_TOOLS.md) - Testing documentation
|
|
485
|
+
|
|
486
|
+
## 📄 License
|
|
487
|
+
|
|
488
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
489
|
+
|
|
490
|
+
## 🙏 Acknowledgments
|
|
491
|
+
|
|
492
|
+
- Inspired by [Gemini CLI](https://github.com/google-gemini/gemini-cli) for the interactive experience
|
|
493
|
+
- Built with the [Agent Client Protocol](https://github.com/zed-industries/zed/tree/main/crates/agent_client_protocol) for Zed integration
|
|
494
|
+
- Powered by [X.ai Grok API](https://x.ai) for AI capabilities
|
|
495
|
+
|
|
496
|
+
## 📞 Support
|
|
497
|
+
|
|
498
|
+
- 🐛 **Issues**: [GitHub Issues](https://github.com/microtech/grok-cli/issues)
|
|
499
|
+
- 💬 **Discussions**: [GitHub Discussions](https://github.com/microtech/grok-cli/discussions)
|
|
500
|
+
- 📧 **Contact**: john.microtech@gmail.com
|
|
501
|
+
|
|
502
|
+
---
|
|
503
|
+
|
|
504
|
+
**Made with ❤️ for the Rust and AI community**
|