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
|
@@ -0,0 +1,691 @@
|
|
|
1
|
+
# Quick Reference Guide - New Features
|
|
2
|
+
|
|
3
|
+
## Environment-Based Configuration
|
|
4
|
+
|
|
5
|
+
### Configuration Priority
|
|
6
|
+
|
|
7
|
+
Grok CLI uses a hierarchical `.env` file configuration system:
|
|
8
|
+
|
|
9
|
+
1. **Process environment variables** (highest priority)
|
|
10
|
+
2. **CLI arguments**: `--model`, `--config`, etc.
|
|
11
|
+
3. **Project-local**: `.grok/.env` in project root
|
|
12
|
+
4. **System-level**: `~/.grok/.env` (or `%USERPROFILE%\.grok\.env` on Windows)
|
|
13
|
+
5. **Built-in defaults** (lowest priority)
|
|
14
|
+
|
|
15
|
+
### How It Works
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# Create project-specific config
|
|
19
|
+
cd ~/my-project
|
|
20
|
+
mkdir -p .grok
|
|
21
|
+
cat > .grok/.env << EOF
|
|
22
|
+
GROK_MODEL=grok-code-fast-1
|
|
23
|
+
GROK_TEMPERATURE=0.5
|
|
24
|
+
EOF
|
|
25
|
+
|
|
26
|
+
# Now when you run grok in this directory, it uses project settings
|
|
27
|
+
grok interactive
|
|
28
|
+
# Uses temperature 0.5 from project config!
|
|
29
|
+
|
|
30
|
+
# In other directories, uses system config or defaults
|
|
31
|
+
cd ~/other-project
|
|
32
|
+
grok interactive
|
|
33
|
+
# Uses system config or defaults
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Benefits
|
|
37
|
+
|
|
38
|
+
- **Per-project settings**: Different models, temperatures per project
|
|
39
|
+
- **Simple format**: Standard environment variable syntax
|
|
40
|
+
- **Flexible overrides**: Override system settings without changing global config
|
|
41
|
+
- **Automatic detection**: Walks up directory tree to find project root
|
|
42
|
+
- **Secure**: `.env` files are in `.gitignore` by default
|
|
43
|
+
|
|
44
|
+
### Example: Project-Specific Model
|
|
45
|
+
|
|
46
|
+
```env
|
|
47
|
+
# .grok/.env
|
|
48
|
+
GROK_MODEL=grok-code-fast-1
|
|
49
|
+
GROK_TEMPERATURE=0.3
|
|
50
|
+
|
|
51
|
+
# Starlink optimizations
|
|
52
|
+
GROK_STARLINK_OPTIMIZATIONS=true
|
|
53
|
+
GROK_TIMEOUT=60
|
|
54
|
+
GROK_MAX_RETRIES=5
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Enhanced Context Discovery
|
|
60
|
+
|
|
61
|
+
### Supported Context Files
|
|
62
|
+
|
|
63
|
+
Grok CLI now discovers and loads context from multiple editor-specific files:
|
|
64
|
+
|
|
65
|
+
| Priority | File | Editor/Tool |
|
|
66
|
+
|----------|------|-------------|
|
|
67
|
+
| 1 | `GEMINI.md` | Gemini CLI |
|
|
68
|
+
| 2 | `.gemini.md` | Gemini CLI (hidden) |
|
|
69
|
+
| 3 | `.claude.md` | Claude AI |
|
|
70
|
+
| 4 | `.zed/rules` | Zed Editor |
|
|
71
|
+
| 5 | `.grok/context.md` | Grok CLI |
|
|
72
|
+
| 6 | `.ai/context.md` | Generic AI |
|
|
73
|
+
| 7 | `CONTEXT.md` | Generic |
|
|
74
|
+
| 8 | `.gemini/context.md` | Gemini CLI (alt) |
|
|
75
|
+
| 9 | `.cursor/rules` | Cursor Editor |
|
|
76
|
+
| 10 | `AI_RULES.md` | Generic |
|
|
77
|
+
|
|
78
|
+
### Multi-File Context Merging
|
|
79
|
+
|
|
80
|
+
All available context files are automatically merged:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
# Create multiple context files
|
|
84
|
+
cd ~/my-project
|
|
85
|
+
|
|
86
|
+
# Gemini-specific rules
|
|
87
|
+
cat > GEMINI.md << EOF
|
|
88
|
+
# Gemini Rules
|
|
89
|
+
Use descriptive variable names
|
|
90
|
+
EOF
|
|
91
|
+
|
|
92
|
+
# Zed editor rules
|
|
93
|
+
mkdir -p .zed
|
|
94
|
+
cat > .zed/rules << EOF
|
|
95
|
+
# Zed Rules
|
|
96
|
+
Format code with rustfmt
|
|
97
|
+
EOF
|
|
98
|
+
|
|
99
|
+
# Claude-specific rules
|
|
100
|
+
cat > .claude.md << EOF
|
|
101
|
+
# Claude Rules
|
|
102
|
+
Write comprehensive tests
|
|
103
|
+
EOF
|
|
104
|
+
|
|
105
|
+
# Start grok - all files are merged!
|
|
106
|
+
grok-cli interactive
|
|
107
|
+
# ✓ Loaded and merged 3 context files
|
|
108
|
+
# • GEMINI.md
|
|
109
|
+
# • .claude.md
|
|
110
|
+
# • .zed/rules
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Context Merging Format
|
|
114
|
+
|
|
115
|
+
When multiple files are loaded, they're merged with source annotations:
|
|
116
|
+
|
|
117
|
+
```markdown
|
|
118
|
+
## From: GEMINI.md
|
|
119
|
+
|
|
120
|
+
# Gemini Rules
|
|
121
|
+
Use descriptive variable names
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## From: .zed/rules
|
|
126
|
+
|
|
127
|
+
# Zed Rules
|
|
128
|
+
Format code with rustfmt
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## From: .claude.md
|
|
133
|
+
|
|
134
|
+
# Claude Rules
|
|
135
|
+
Write comprehensive tests
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## Session Persistence
|
|
141
|
+
|
|
142
|
+
### Save Current Session
|
|
143
|
+
```bash
|
|
144
|
+
/save <session_name>
|
|
145
|
+
```
|
|
146
|
+
Example: `/save debugging-auth`
|
|
147
|
+
|
|
148
|
+
### Load Saved Session
|
|
149
|
+
```bash
|
|
150
|
+
/load <session_name>
|
|
151
|
+
```
|
|
152
|
+
Example: `/load debugging-auth`
|
|
153
|
+
|
|
154
|
+
### List All Sessions
|
|
155
|
+
```bash
|
|
156
|
+
/list
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Session Storage Location
|
|
160
|
+
- **Windows**: `C:\Users\<username>\.grok\sessions\`
|
|
161
|
+
- **Linux/macOS**: `~/.grok/sessions/`
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
### Project Context Integration
|
|
166
|
+
|
|
167
|
+
### Supported Files (Priority Order)
|
|
168
|
+
See "Enhanced Context Discovery" section above for complete list of supported files.
|
|
169
|
+
|
|
170
|
+
### How to Use
|
|
171
|
+
1. Create a context file in your project root:
|
|
172
|
+
```bash
|
|
173
|
+
# Example GEMINI.md
|
|
174
|
+
# Project: My Web App
|
|
175
|
+
|
|
176
|
+
## Tech Stack
|
|
177
|
+
- Rust with Axum
|
|
178
|
+
- PostgreSQL database
|
|
179
|
+
- JWT authentication
|
|
180
|
+
|
|
181
|
+
## Conventions
|
|
182
|
+
- Use async/await
|
|
183
|
+
- Error handling with anyhow
|
|
184
|
+
- Tests in separate modules
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
2. Start Grok CLI in the project directory:
|
|
188
|
+
```bash
|
|
189
|
+
cd ~/projects/my-project
|
|
190
|
+
grok-cli interactive
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
3. Context loads automatically and is injected into the system prompt!
|
|
194
|
+
|
|
195
|
+
### Context File Template
|
|
196
|
+
```markdown
|
|
197
|
+
# Project Context
|
|
198
|
+
|
|
199
|
+
## Project Overview
|
|
200
|
+
Brief description of what this project does
|
|
201
|
+
|
|
202
|
+
## Architecture
|
|
203
|
+
High-level architecture and key components
|
|
204
|
+
|
|
205
|
+
## Development Guidelines
|
|
206
|
+
Coding standards, conventions, best practices
|
|
207
|
+
|
|
208
|
+
## Key Technologies
|
|
209
|
+
Main frameworks, libraries, and tools used
|
|
210
|
+
|
|
211
|
+
## Common Tasks
|
|
212
|
+
Frequently performed development tasks
|
|
213
|
+
|
|
214
|
+
## Important Notes
|
|
215
|
+
Gotchas, quirks, or important considerations
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### Cross-Editor Compatibility
|
|
219
|
+
|
|
220
|
+
Use the same context files across multiple AI assistants:
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
# Use .gemini.md for Gemini CLI
|
|
224
|
+
# Use .claude.md for Claude
|
|
225
|
+
# Use .zed/rules for Zed
|
|
226
|
+
# Grok CLI loads them ALL!
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
---
|
|
230
|
+
|
|
231
|
+
## Extension System
|
|
232
|
+
|
|
233
|
+
### Enable Extensions
|
|
234
|
+
```bash
|
|
235
|
+
grok-cli config set experimental.extensions.enabled true
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### Extension Directory
|
|
239
|
+
- **Default**: `~/.grok/extensions/`
|
|
240
|
+
- **Custom**: Set in config file
|
|
241
|
+
|
|
242
|
+
### Create an Extension
|
|
243
|
+
|
|
244
|
+
1. **Create directory structure:**
|
|
245
|
+
```bash
|
|
246
|
+
mkdir -p ~/.grok/extensions/my-extension
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
2. **Create manifest** (`extension.json`):
|
|
250
|
+
```json
|
|
251
|
+
{
|
|
252
|
+
"name": "my-extension",
|
|
253
|
+
"version": "1.0.0",
|
|
254
|
+
"description": "My custom extension",
|
|
255
|
+
"author": "Your Name <email@example.com>",
|
|
256
|
+
"extension_type": "hook",
|
|
257
|
+
"hooks": [
|
|
258
|
+
{
|
|
259
|
+
"name": "my-hook",
|
|
260
|
+
"hook_type": "both",
|
|
261
|
+
"config": {
|
|
262
|
+
"custom_setting": "value"
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
],
|
|
266
|
+
"enabled": true
|
|
267
|
+
}
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
3. **Enable in config** (optional - auto-loads if in directory):
|
|
271
|
+
```toml
|
|
272
|
+
[experimental.extensions]
|
|
273
|
+
enabled = true
|
|
274
|
+
enabled_extensions = ["my-extension"]
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
### Hook Types
|
|
278
|
+
- `"before_tool"` - Executes before tool invocation
|
|
279
|
+
- `"after_tool"` - Executes after tool completion
|
|
280
|
+
- `"both"` - Executes both before and after
|
|
281
|
+
|
|
282
|
+
### Example: Logging Extension
|
|
283
|
+
See `examples/extensions/logging-hook/` for a complete working example.
|
|
284
|
+
|
|
285
|
+
---
|
|
286
|
+
|
|
287
|
+
## Configuration
|
|
288
|
+
|
|
289
|
+
### View Current Config
|
|
290
|
+
```bash
|
|
291
|
+
grok-cli config show
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
### Get Specific Value
|
|
295
|
+
```bash
|
|
296
|
+
grok-cli config get experimental.extensions.enabled
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
### Set Value
|
|
300
|
+
```bash
|
|
301
|
+
grok-cli config set experimental.extensions.enabled true
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
### Config File Location
|
|
305
|
+
|
|
306
|
+
- **System-wide**: `~/.grok/.env` (Linux/macOS) or `%USERPROFILE%\.grok\.env` (Windows)
|
|
307
|
+
- **Project-specific**: `.grok/.env` in your project root
|
|
308
|
+
- **Priority**: Project config overrides system config
|
|
309
|
+
|
|
310
|
+
---
|
|
311
|
+
|
|
312
|
+
## Interactive Mode Commands
|
|
313
|
+
|
|
314
|
+
### Session Management
|
|
315
|
+
| Command | Description |
|
|
316
|
+
|---------|-------------|
|
|
317
|
+
| `/save <name>` | Save current session |
|
|
318
|
+
| `/load <name>` | Load saved session |
|
|
319
|
+
| `/list` | List all saved sessions |
|
|
320
|
+
| `/reset` | Clear conversation history |
|
|
321
|
+
|
|
322
|
+
### General Commands
|
|
323
|
+
| Command | Description |
|
|
324
|
+
|---------|-------------|
|
|
325
|
+
| `/help` | Show help message |
|
|
326
|
+
| `/quit` or `/exit` | Exit interactive mode |
|
|
327
|
+
| `/clear` | Clear screen |
|
|
328
|
+
| `/history` | Show conversation history |
|
|
329
|
+
| `/version` | Show version info |
|
|
330
|
+
|
|
331
|
+
### Context Display
|
|
332
|
+
| Command | Description |
|
|
333
|
+
|---------|-------------|
|
|
334
|
+
| `/context` | Show current context usage |
|
|
335
|
+
| `/tokens` | Show token usage statistics |
|
|
336
|
+
|
|
337
|
+
---
|
|
338
|
+
|
|
339
|
+
## Common Workflows
|
|
340
|
+
|
|
341
|
+
### Workflow 1: Project with Custom Config and Context
|
|
342
|
+
|
|
343
|
+
```bash
|
|
344
|
+
# 1. Create project config
|
|
345
|
+
cd ~/projects/my-app
|
|
346
|
+
mkdir .grok
|
|
347
|
+
|
|
348
|
+
cat > .grok/config.toml << EOF
|
|
349
|
+
default_model = "grok-2-latest"
|
|
350
|
+
default_temperature = 0.3
|
|
351
|
+
EOF
|
|
352
|
+
|
|
353
|
+
# 2. Create context file
|
|
354
|
+
cat > GEMINI.md << EOF
|
|
355
|
+
# My App
|
|
356
|
+
Tech: Rust + Axum
|
|
357
|
+
Use anyhow for errors
|
|
358
|
+
EOF
|
|
359
|
+
|
|
360
|
+
# 3. Start session
|
|
361
|
+
grok-cli interactive
|
|
362
|
+
# Using project-local configuration
|
|
363
|
+
# ✓ Loaded project context from GEMINI.md
|
|
364
|
+
|
|
365
|
+
# 4. Work on project with context-aware agent
|
|
366
|
+
> Help me implement JWT authentication following our conventions
|
|
367
|
+
|
|
368
|
+
# 5. Save session for later
|
|
369
|
+
> /save jwt-implementation
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
### Workflow 2: Resume Previous Work
|
|
373
|
+
|
|
374
|
+
```bash
|
|
375
|
+
# 1. List available sessions
|
|
376
|
+
grok-cli interactive
|
|
377
|
+
> /list
|
|
378
|
+
|
|
379
|
+
# 2. Load previous session
|
|
380
|
+
> /load jwt-implementation
|
|
381
|
+
|
|
382
|
+
# 3. Continue where you left off
|
|
383
|
+
> Let's continue with the middleware implementation
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
### Workflow 3: Multi-Editor Context Support
|
|
387
|
+
|
|
388
|
+
```bash
|
|
389
|
+
# 1. Create context for multiple editors
|
|
390
|
+
cd ~/my-project
|
|
391
|
+
|
|
392
|
+
# For Gemini CLI users
|
|
393
|
+
echo "# Gemini: Use async/await" > GEMINI.md
|
|
394
|
+
|
|
395
|
+
# For Claude users
|
|
396
|
+
echo "# Claude: Prefer functional style" > .claude.md
|
|
397
|
+
|
|
398
|
+
# For Zed users
|
|
399
|
+
mkdir .zed
|
|
400
|
+
echo "# Zed: Format on save" > .zed/rules
|
|
401
|
+
|
|
402
|
+
# 2. Grok merges all contexts!
|
|
403
|
+
grok-cli interactive
|
|
404
|
+
# ✓ Loaded and merged 3 context files
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
### Workflow 4: Team Collaboration with Shared Config
|
|
408
|
+
|
|
409
|
+
```bash
|
|
410
|
+
# 1. Create team config
|
|
411
|
+
cd ~/team-project
|
|
412
|
+
mkdir .grok
|
|
413
|
+
|
|
414
|
+
# Create shared config
|
|
415
|
+
cat > .grok/.env << EOF
|
|
416
|
+
GROK_MODEL=grok-2-latest
|
|
417
|
+
GROK_TEMPERATURE=0.4
|
|
418
|
+
GROK_FOLDER_TRUST_ENABLED=true
|
|
419
|
+
EOF
|
|
420
|
+
|
|
421
|
+
# 2. Add to version control
|
|
422
|
+
git add .grok/
|
|
423
|
+
git commit -m "Add team Grok configuration"
|
|
424
|
+
|
|
425
|
+
# 3. Team members get consistent settings
|
|
426
|
+
git pull
|
|
427
|
+
grok-cli interactive
|
|
428
|
+
# Uses team config automatically!
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
### Workflow 5: Custom Extension for Logging
|
|
432
|
+
|
|
433
|
+
```bash
|
|
434
|
+
# 1. Copy example extension
|
|
435
|
+
cp -r examples/extensions/logging-hook ~/.grok/extensions/
|
|
436
|
+
|
|
437
|
+
# 2. Enable extensions
|
|
438
|
+
grok-cli config set experimental.extensions.enabled true
|
|
439
|
+
|
|
440
|
+
# 3. Start and see logging
|
|
441
|
+
grok-cli interactive
|
|
442
|
+
# Extension logs all tool invocations
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
---
|
|
446
|
+
|
|
447
|
+
## Troubleshooting
|
|
448
|
+
|
|
449
|
+
### Session Won't Save
|
|
450
|
+
- Check disk space
|
|
451
|
+
- Verify `~/.grok/sessions/` directory exists and is writable
|
|
452
|
+
- Check for special characters in session name
|
|
453
|
+
|
|
454
|
+
### Context File Not Loading
|
|
455
|
+
- Ensure file is in project root
|
|
456
|
+
- Check file name matches supported names (see Enhanced Context Discovery section)
|
|
457
|
+
- Verify file size < 5 MB
|
|
458
|
+
- Check for UTF-8 encoding
|
|
459
|
+
- Enable debug logging: `RUST_LOG=debug grok-cli interactive`
|
|
460
|
+
|
|
461
|
+
### Config Not Loading
|
|
462
|
+
|
|
463
|
+
- Verify project has `.grok/.env`
|
|
464
|
+
- Check file exists: `cat .grok/.env` or `type .grok\.env` (Windows)
|
|
465
|
+
- Test config manually: `grok config show`
|
|
466
|
+
- Check directory tree walk: `RUST_LOG=grok_cli::config=debug grok-cli interactive`
|
|
467
|
+
|
|
468
|
+
### Extension Not Loading
|
|
469
|
+
- Verify extensions enabled: `grok-cli config get experimental.extensions.enabled`
|
|
470
|
+
- Check `extension.json` is valid JSON: `jq . extension.json`
|
|
471
|
+
- Verify extension directory: `ls -la ~/.grok/extensions/`
|
|
472
|
+
- Check logs: `RUST_LOG=grok_cli::hooks=debug grok-cli interactive`
|
|
473
|
+
|
|
474
|
+
### View Debug Logs
|
|
475
|
+
```bash
|
|
476
|
+
# All debug info
|
|
477
|
+
RUST_LOG=debug grok-cli interactive
|
|
478
|
+
|
|
479
|
+
# Specific module
|
|
480
|
+
RUST_LOG=grok_cli::hooks=debug grok-cli interactive
|
|
481
|
+
RUST_LOG=grok_cli::utils::context=debug grok-cli interactive
|
|
482
|
+
```
|
|
483
|
+
|
|
484
|
+
---
|
|
485
|
+
|
|
486
|
+
## Best Practices
|
|
487
|
+
|
|
488
|
+
### Configuration Management
|
|
489
|
+
- Use project configs for team-shared settings
|
|
490
|
+
- Commit `.grok/config.toml` to version control
|
|
491
|
+
- Use system config for personal preferences
|
|
492
|
+
- Document config overrides in README
|
|
493
|
+
|
|
494
|
+
### Session Management
|
|
495
|
+
- Use descriptive session names: `feature-auth`, `debug-api`, `refactor-db`
|
|
496
|
+
- Save sessions regularly during long conversations
|
|
497
|
+
- Clean up old sessions periodically
|
|
498
|
+
- Don't store sensitive data in sessions (no encryption yet)
|
|
499
|
+
|
|
500
|
+
### Context Files
|
|
501
|
+
- Keep context files concise (< 1000 lines)
|
|
502
|
+
- Update context when conventions change
|
|
503
|
+
- Include examples in context
|
|
504
|
+
- Document gotchas and pitfalls
|
|
505
|
+
- Version control your context files
|
|
506
|
+
|
|
507
|
+
|
|
508
|
+
### Context Files
|
|
509
|
+
- Create separate files for different AI tools
|
|
510
|
+
- Keep each file focused and concise
|
|
511
|
+
- Use `.zed/rules` for Zed-specific conventions
|
|
512
|
+
- Use `.claude.md` for Claude-specific guidance
|
|
513
|
+
- Let Grok merge them all automatically
|
|
514
|
+
|
|
515
|
+
### Extensions
|
|
516
|
+
- Only install trusted extensions
|
|
517
|
+
- Test extensions in isolated environment first
|
|
518
|
+
- Keep extensions simple and focused
|
|
519
|
+
- Document extension configuration
|
|
520
|
+
- Report extension issues to authors
|
|
521
|
+
|
|
522
|
+
---
|
|
523
|
+
|
|
524
|
+
## Tips & Tricks
|
|
525
|
+
|
|
526
|
+
### Tip 1: Per-Project Configuration
|
|
527
|
+
|
|
528
|
+
```bash
|
|
529
|
+
# Development project - high creativity
|
|
530
|
+
cd ~/dev-project
|
|
531
|
+
mkdir -p .grok && echo 'GROK_TEMPERATURE=1.0' > .grok/.env
|
|
532
|
+
|
|
533
|
+
# Production project - conservative
|
|
534
|
+
cd ~/prod-project
|
|
535
|
+
mkdir -p .grok && echo 'GROK_TEMPERATURE=0.2' > .grok/.env
|
|
536
|
+
```
|
|
537
|
+
|
|
538
|
+
### Tip 2: Multi-Project Context
|
|
539
|
+
Create project-specific context in each directory:
|
|
540
|
+
```bash
|
|
541
|
+
~/project-a/GEMINI.md # Django project guidelines
|
|
542
|
+
~/project-b/GEMINI.md # Rust project guidelines
|
|
543
|
+
```
|
|
544
|
+
|
|
545
|
+
### Tip 3: Session Templates
|
|
546
|
+
Save template sessions for common tasks:
|
|
547
|
+
```bash
|
|
548
|
+
/save template-debugging
|
|
549
|
+
/save template-code-review
|
|
550
|
+
/save template-refactoring
|
|
551
|
+
```
|
|
552
|
+
|
|
553
|
+
### Tip 4: Extension Chains
|
|
554
|
+
Multiple extensions execute in sequence:
|
|
555
|
+
```bash
|
|
556
|
+
~/.grok/extensions/
|
|
557
|
+
├── logger/ # Logs all calls
|
|
558
|
+
├── validator/ # Validates security
|
|
559
|
+
└── profiler/ # Measures performance
|
|
560
|
+
```
|
|
561
|
+
|
|
562
|
+
### Tip 5: Portable Context and Config
|
|
563
|
+
Share context files in Git:
|
|
564
|
+
```bash
|
|
565
|
+
git add GEMINI.md .grok/
|
|
566
|
+
git commit -m "Add AI assistant context and config"
|
|
567
|
+
git push
|
|
568
|
+
# Team members get consistent AI guidance and settings
|
|
569
|
+
```
|
|
570
|
+
|
|
571
|
+
### Tip 6: Editor-Agnostic Rules
|
|
572
|
+
```bash
|
|
573
|
+
# Works with all editors/tools
|
|
574
|
+
cat > AI_RULES.md << EOF
|
|
575
|
+
# Universal AI Rules
|
|
576
|
+
- Follow project coding standards
|
|
577
|
+
- Write tests for all new features
|
|
578
|
+
- Document public APIs
|
|
579
|
+
EOF
|
|
580
|
+
```
|
|
581
|
+
|
|
582
|
+
---
|
|
583
|
+
|
|
584
|
+
## Examples
|
|
585
|
+
|
|
586
|
+
### Example 1: Web Development Context
|
|
587
|
+
```markdown
|
|
588
|
+
# My Web App
|
|
589
|
+
|
|
590
|
+
## Tech Stack
|
|
591
|
+
- Backend: Rust + Axum
|
|
592
|
+
- Database: PostgreSQL
|
|
593
|
+
- Frontend: React + TypeScript
|
|
594
|
+
|
|
595
|
+
## API Conventions
|
|
596
|
+
- RESTful endpoints
|
|
597
|
+
- JWT in Authorization header
|
|
598
|
+
- JSON request/response
|
|
599
|
+
- Error format: `{"error": "message"}`
|
|
600
|
+
|
|
601
|
+
## Testing
|
|
602
|
+
- Unit tests with `#[cfg(test)]`
|
|
603
|
+
- Integration tests in `tests/`
|
|
604
|
+
- Run: `cargo test`
|
|
605
|
+
```
|
|
606
|
+
|
|
607
|
+
### Example 2: Data Science Context
|
|
608
|
+
```markdown
|
|
609
|
+
# ML Pipeline Project
|
|
610
|
+
|
|
611
|
+
## Environment
|
|
612
|
+
- Python 3.11
|
|
613
|
+
- PyTorch 2.0
|
|
614
|
+
- Pandas, NumPy, Scikit-learn
|
|
615
|
+
|
|
616
|
+
## Code Style
|
|
617
|
+
- PEP 8
|
|
618
|
+
- Type hints required
|
|
619
|
+
- Docstrings for all functions
|
|
620
|
+
|
|
621
|
+
## Data Locations
|
|
622
|
+
- Raw: `data/raw/`
|
|
623
|
+
- Processed: `data/processed/`
|
|
624
|
+
- Models: `models/`
|
|
625
|
+
```
|
|
626
|
+
|
|
627
|
+
---
|
|
628
|
+
|
|
629
|
+
## Performance Tips
|
|
630
|
+
|
|
631
|
+
- **Sessions**: Save only when needed, sessions are small (~10 KB)
|
|
632
|
+
- **Context**: Keep under 50 KB for fast loading
|
|
633
|
+
- **Extensions**: Use only needed extensions, disable unused ones
|
|
634
|
+
|
|
635
|
+
---
|
|
636
|
+
|
|
637
|
+
## Security Notes
|
|
638
|
+
|
|
639
|
+
### Session Files
|
|
640
|
+
- Stored locally, not encrypted
|
|
641
|
+
- Contains full conversation history
|
|
642
|
+
- Protect sensitive session files manually
|
|
643
|
+
- Don't commit to public repos
|
|
644
|
+
|
|
645
|
+
### Context Files
|
|
646
|
+
- Public if in version control
|
|
647
|
+
- Don't include secrets or credentials
|
|
648
|
+
- Safe to share with team
|
|
649
|
+
|
|
650
|
+
### Extensions
|
|
651
|
+
- Run with full CLI permissions
|
|
652
|
+
- Only install from trusted sources
|
|
653
|
+
- Review code before installing
|
|
654
|
+
- No sandboxing yet
|
|
655
|
+
|
|
656
|
+
---
|
|
657
|
+
|
|
658
|
+
## Getting Help
|
|
659
|
+
|
|
660
|
+
### Documentation
|
|
661
|
+
- Full docs: `docs/extensions.md`
|
|
662
|
+
- Progress report: `docs/PROGRESS_REPORT.md`
|
|
663
|
+
- Changelog: `CHANGELOG.md`
|
|
664
|
+
|
|
665
|
+
### Commands
|
|
666
|
+
```bash
|
|
667
|
+
grok-cli --help
|
|
668
|
+
grok-cli interactive
|
|
669
|
+
> /help
|
|
670
|
+
```
|
|
671
|
+
|
|
672
|
+
### Support
|
|
673
|
+
- GitHub Issues: https://github.com/microtech/grok-cli/issues
|
|
674
|
+
- Repository: https://github.com/microtech/grok-cli
|
|
675
|
+
|
|
676
|
+
---
|
|
677
|
+
|
|
678
|
+
## Version Information
|
|
679
|
+
|
|
680
|
+
These features available in:
|
|
681
|
+
- **Version**: 0.1.2+
|
|
682
|
+
- **Release Date**: 2025-01-XX
|
|
683
|
+
|
|
684
|
+
Check your version:
|
|
685
|
+
```bash
|
|
686
|
+
grok-cli --version
|
|
687
|
+
```
|
|
688
|
+
|
|
689
|
+
---
|
|
690
|
+
|
|
691
|
+
**Happy coding with Grok CLI! 🚀**
|