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.
Files changed (100) hide show
  1. package/.env.example +42 -0
  2. package/.github/workflows/ci.yml +30 -0
  3. package/.github/workflows/rust.yml +22 -0
  4. package/.grok/.env.example +85 -0
  5. package/.grok/COMPLETE_FIX_SUMMARY.md +466 -0
  6. package/.grok/ENV_CONFIG_GUIDE.md +173 -0
  7. package/.grok/QUICK_REFERENCE.md +180 -0
  8. package/.grok/README.md +104 -0
  9. package/.grok/TESTING_GUIDE.md +393 -0
  10. package/CHANGELOG.md +465 -0
  11. package/CODE_REVIEW_SUMMARY.md +414 -0
  12. package/COMPLETE_FIX_SUMMARY.md +415 -0
  13. package/CONFIGURATION.md +489 -0
  14. package/CONTEXT_FILES_GUIDE.md +419 -0
  15. package/CONTRIBUTING.md +55 -0
  16. package/CURSOR_POSITION_FIX.md +206 -0
  17. package/Cargo.toml +88 -0
  18. package/ERROR_HANDLING_REPORT.md +361 -0
  19. package/FINAL_FIX_SUMMARY.md +462 -0
  20. package/FIXES.md +37 -0
  21. package/FIXES_SUMMARY.md +87 -0
  22. package/GROK_API_MIGRATION_SUMMARY.md +111 -0
  23. package/LICENSE +22 -0
  24. package/MIGRATION_TO_GROK_API.md +223 -0
  25. package/README.md +504 -0
  26. package/REVIEW_COMPLETE.md +416 -0
  27. package/REVIEW_QUICK_REFERENCE.md +173 -0
  28. package/SECURITY.md +463 -0
  29. package/SECURITY_AUDIT.md +661 -0
  30. package/SETUP.md +287 -0
  31. package/TESTING_TOOLS.md +88 -0
  32. package/TESTING_TOOL_EXECUTION.md +239 -0
  33. package/TOOL_EXECUTION_FIX.md +491 -0
  34. package/VERIFICATION_CHECKLIST.md +419 -0
  35. package/docs/API.md +74 -0
  36. package/docs/CHAT_LOGGING.md +39 -0
  37. package/docs/CURSOR_FIX_DEMO.md +306 -0
  38. package/docs/ERROR_HANDLING_GUIDE.md +547 -0
  39. package/docs/FILE_OPERATIONS.md +449 -0
  40. package/docs/INTERACTIVE.md +401 -0
  41. package/docs/PROJECT_CREATION_GUIDE.md +570 -0
  42. package/docs/QUICKSTART.md +378 -0
  43. package/docs/QUICK_REFERENCE.md +691 -0
  44. package/docs/RELEASE_NOTES_0.1.2.md +240 -0
  45. package/docs/TOOLS.md +459 -0
  46. package/docs/TOOLS_QUICK_REFERENCE.md +210 -0
  47. package/docs/ZED_INTEGRATION.md +371 -0
  48. package/docs/extensions.md +464 -0
  49. package/docs/settings.md +293 -0
  50. package/examples/extensions/logging-hook/README.md +91 -0
  51. package/examples/extensions/logging-hook/extension.json +22 -0
  52. package/package.json +30 -0
  53. package/scripts/test_acp.py +252 -0
  54. package/scripts/test_acp.sh +143 -0
  55. package/scripts/test_acp_simple.sh +72 -0
  56. package/src/acp/mod.rs +741 -0
  57. package/src/acp/protocol.rs +323 -0
  58. package/src/acp/security.rs +298 -0
  59. package/src/acp/tools.rs +697 -0
  60. package/src/bin/banner_demo.rs +216 -0
  61. package/src/bin/docgen.rs +18 -0
  62. package/src/bin/installer.rs +217 -0
  63. package/src/cli/app.rs +310 -0
  64. package/src/cli/commands/acp.rs +721 -0
  65. package/src/cli/commands/chat.rs +485 -0
  66. package/src/cli/commands/code.rs +513 -0
  67. package/src/cli/commands/config.rs +394 -0
  68. package/src/cli/commands/health.rs +442 -0
  69. package/src/cli/commands/history.rs +421 -0
  70. package/src/cli/commands/mod.rs +14 -0
  71. package/src/cli/commands/settings.rs +1384 -0
  72. package/src/cli/mod.rs +166 -0
  73. package/src/config/mod.rs +2212 -0
  74. package/src/display/ascii_art.rs +139 -0
  75. package/src/display/banner.rs +289 -0
  76. package/src/display/components/input.rs +323 -0
  77. package/src/display/components/mod.rs +2 -0
  78. package/src/display/components/settings_list.rs +306 -0
  79. package/src/display/interactive.rs +1255 -0
  80. package/src/display/mod.rs +62 -0
  81. package/src/display/terminal.rs +42 -0
  82. package/src/display/tips.rs +316 -0
  83. package/src/grok_client_ext.rs +177 -0
  84. package/src/hooks/loader.rs +407 -0
  85. package/src/hooks/mod.rs +158 -0
  86. package/src/lib.rs +174 -0
  87. package/src/main.rs +65 -0
  88. package/src/mcp/client.rs +195 -0
  89. package/src/mcp/config.rs +20 -0
  90. package/src/mcp/mod.rs +6 -0
  91. package/src/mcp/protocol.rs +67 -0
  92. package/src/utils/auth.rs +41 -0
  93. package/src/utils/chat_logger.rs +568 -0
  94. package/src/utils/context.rs +390 -0
  95. package/src/utils/mod.rs +16 -0
  96. package/src/utils/network.rs +320 -0
  97. package/src/utils/rate_limiter.rs +166 -0
  98. package/src/utils/session.rs +73 -0
  99. package/src/utils/shell_permissions.rs +389 -0
  100. package/src/utils/telemetry.rs +41 -0
@@ -0,0 +1,378 @@
1
+ # Grok CLI Quick Start Guide
2
+
3
+ Welcome to Grok CLI! This guide will get you up and running in minutes.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ # Clone the repository
9
+ git clone https://github.com/microtech/grok-cli
10
+ cd grok-cli
11
+
12
+ # Build the project
13
+ cargo build --release
14
+
15
+ # Install (optional)
16
+ cargo install --path .
17
+ ```
18
+
19
+ ## Setup
20
+
21
+ ### 1. Get Your API Key
22
+
23
+ Get your X API key from [https://developer.twitter.com/en/portal/dashboard](https://developer.twitter.com/en/portal/dashboard)
24
+
25
+ ### 2. Configure
26
+
27
+ ```bash
28
+ # Copy the example .env file
29
+ cp .env.example .env
30
+
31
+ # Edit .env and add your API key
32
+ GROK_API_KEY=xai-your-api-key-here
33
+ ```
34
+
35
+ ### 3. Test Connection
36
+
37
+ ```bash
38
+ grok test-network
39
+ ```
40
+
41
+ ## Basic Usage
42
+
43
+ ### Quick Query
44
+
45
+ ```bash
46
+ # Ask a question
47
+ grok query "What is the meaning of life?"
48
+
49
+ # Get code help
50
+ grok query "How do I reverse a string in Rust?"
51
+ ```
52
+
53
+ ### Interactive Mode
54
+
55
+ ```bash
56
+ # Start interactive chat
57
+ grok
58
+
59
+ # Or with specific model
60
+ grok --model grok-code-fast-1
61
+ ```
62
+
63
+ ## Interactive Mode Commands
64
+
65
+ Once in interactive mode, you have three types of commands:
66
+
67
+ ### 1. Chat Messages (Default)
68
+ Just type naturally to talk to Grok:
69
+ ```
70
+ What is Rust?
71
+ How do I handle errors in Rust?
72
+ Explain async/await
73
+ ```
74
+
75
+ ### 2. Built-in Commands (/)
76
+ Commands starting with `/` control the CLI:
77
+
78
+ | Command | Description |
79
+ |---------|-------------|
80
+ | `/help` | Show all commands |
81
+ | `/quit` or `/exit` | Exit interactive mode |
82
+ | `/clear` | Clear screen |
83
+ | `/model grok-code-fast-1` | Change model |
84
+ | `/save session-name` | Save conversation |
85
+ | `/load session-name` | Load saved session |
86
+ | `/status` | Show session info |
87
+ | `/history` | Show conversation history |
88
+
89
+ ### 3. Shell Commands (!)
90
+ Commands starting with `!` run locally on your computer:
91
+
92
+ **Windows:**
93
+ ```
94
+ !dir # List files
95
+ !cd # Show current directory
96
+ !type file.txt # Display file contents
97
+ !git status # Check git status
98
+ !cargo build # Build project
99
+ !echo Hello # Print message
100
+ ```
101
+
102
+ **Linux/macOS:**
103
+ ```
104
+ !ls # List files
105
+ !ls -la # List files with details
106
+ !pwd # Show current directory
107
+ !cat file.txt # Display file contents
108
+ !git status # Check git status
109
+ !cargo build # Build project
110
+ !echo "Hello" # Print message
111
+ ```
112
+
113
+ ## Common Workflows
114
+
115
+ ### Code Review
116
+ ```
117
+ Grok> !git status
118
+ Grok> !git diff src/main.rs
119
+ Grok> Can you review these changes?
120
+ ```
121
+
122
+ ### Development
123
+ ```
124
+ Grok> !cargo test
125
+ Grok> Tests are failing, can you help?
126
+ [AI provides suggestions]
127
+ Grok> !cargo test
128
+ ```
129
+
130
+ ### File Exploration
131
+ ```
132
+ Grok> !ls src/
133
+ Grok> !cat src/config.rs
134
+ Grok> How can I improve this code?
135
+ ```
136
+
137
+ ### System Tasks
138
+ ```
139
+ Grok> !df -h
140
+ Grok> My disk is 90% full, what should I check?
141
+ [AI suggests commands]
142
+ Grok> !du -sh ~/Downloads/* | sort -h | tail
143
+ ```
144
+
145
+ ## Available Models
146
+
147
+ | Model | Best For | Speed |
148
+ |-------|----------|-------|
149
+ | `grok-3` | General purpose, balanced | Medium |
150
+ | `grok-code-fast-1` | Coding tasks | Fast |
151
+ | `grok-2-latest` | Latest stable release | Medium |
152
+ | `grok-vision-beta` | Image analysis | Medium |
153
+
154
+ Change model anytime:
155
+ ```bash
156
+ # In interactive mode
157
+ /model grok-code-fast-1
158
+
159
+ # Or at startup
160
+ grok --model grok-code-fast-1
161
+ ```
162
+
163
+ ## Configuration
164
+
165
+ ### Project-Specific Settings
166
+
167
+ Create `.grok/.env` in your project:
168
+ ```bash
169
+ mkdir -p .grok
170
+ cp .grok/.env.example .grok/.env
171
+ ```
172
+
173
+ Edit `.grok/.env`:
174
+ ```bash
175
+ GROK_MODEL=grok-code-fast-1
176
+ GROK_TEMPERATURE=0.7
177
+ GROK_TIMEOUT=60
178
+ ```
179
+
180
+ ### System-Wide Settings
181
+
182
+ Create `~/.grok/.env` (Linux/macOS) or `%USERPROFILE%\.grok\.env` (Windows):
183
+ ```bash
184
+ mkdir -p ~/.grok
185
+ nano ~/.grok/.env
186
+ ```
187
+
188
+ Add your preferences:
189
+ ```bash
190
+ GROK_API_KEY=xai-your-key
191
+ GROK_MODEL=grok-3
192
+ GROK_COLORS=true
193
+ ```
194
+
195
+ ### Configuration Priority
196
+
197
+ Settings are applied in this order (highest first):
198
+ 1. Environment variables (`export GROK_MODEL=grok-3`)
199
+ 2. CLI arguments (`--model grok-code-fast-1`)
200
+ 3. Project config (`.grok/.env`)
201
+ 4. System config (`~/.grok/.env`)
202
+ 5. Built-in defaults
203
+
204
+ ## Project Context
205
+
206
+ Grok CLI automatically loads project context from these files:
207
+ - `.gemini.md`
208
+ - `.grok/context.md`
209
+ - `.zed/rules`
210
+ - `.claude.md`
211
+
212
+ Create `.grok/context.md` to provide project-specific instructions:
213
+ ```markdown
214
+ # Project Context
215
+
216
+ This is a Rust CLI application for interacting with Grok AI.
217
+
218
+ ## Coding Standards
219
+ - Use `anyhow::Result` for error handling
220
+ - Follow Rust 2025 edition guidelines
221
+ - Write tests for all public APIs
222
+
223
+ ## Project Structure
224
+ - `src/api/` - API client code
225
+ - `src/cli/` - CLI commands
226
+ - `src/display/` - UI and formatting
227
+ ```
228
+
229
+ ## Tips & Tricks
230
+
231
+ ### 1. Quick File Checks
232
+ ```
233
+ !cat error.log
234
+ What does this error mean?
235
+ ```
236
+
237
+ ### 2. Build & Test
238
+ ```
239
+ !cargo build
240
+ [Fix any errors suggested by AI]
241
+ !cargo test
242
+ ```
243
+
244
+ ### 3. Git Workflow
245
+ ```
246
+ !git status
247
+ !git diff
248
+ Can you review my changes?
249
+ !git add .
250
+ !git commit -m "your message"
251
+ ```
252
+
253
+ ### 4. Combine AI with Local Tools
254
+ ```
255
+ !npm test
256
+ These tests are failing: [paste output]
257
+ [Get AI suggestions]
258
+ !npm test
259
+ ```
260
+
261
+ ### 5. Save Important Sessions
262
+ ```
263
+ /save feature-authentication
264
+ [Work on something else]
265
+ /load feature-authentication
266
+ ```
267
+
268
+ ## Common Issues
269
+
270
+ ### API Key Not Found
271
+ ```bash
272
+ # Check if key is set
273
+ echo $GROK_API_KEY
274
+
275
+ # Set it temporarily
276
+ export GROK_API_KEY=xai-your-key
277
+
278
+ # Or add to .env file
279
+ echo "GROK_API_KEY=xai-your-key" >> .env
280
+ ```
281
+
282
+ ### Wrong Model Being Used
283
+ ```bash
284
+ # Check configuration
285
+ grok config show
286
+
287
+ # Override with environment variable
288
+ GROK_MODEL=grok-code-fast-1 grok
289
+ ```
290
+
291
+ ### Shell Commands Not Working
292
+ - Make sure command exists: `which <command>` (Unix) or `where <command>` (Windows)
293
+ - Use full paths if needed: `!/usr/local/bin/mycommand`
294
+ - Check permissions
295
+ - Try the command in your regular terminal first
296
+
297
+ ### Network Timeout
298
+ ```bash
299
+ # Increase timeout in .env
300
+ GROK_TIMEOUT=120
301
+ GROK_MAX_RETRIES=5
302
+ GROK_STARLINK_OPTIMIZATIONS=true
303
+ ```
304
+
305
+ ## Security Notes
306
+
307
+ ### Shell Commands (!)
308
+ ⚠️ **Important:** Shell commands execute with your user permissions!
309
+ - Commands are not sandboxed
310
+ - Dangerous commands (`rm`, `del`) will execute
311
+ - Always review before pressing Enter
312
+ - Use with caution in production environments
313
+
314
+ ### API Keys
315
+ - Never commit `.env` files to git
316
+ - Use `.env.example` for templates
317
+ - Set proper file permissions: `chmod 600 .env`
318
+ - Use secret management in CI/CD
319
+
320
+ ## Next Steps
321
+
322
+ 1. **Read the Full Documentation**
323
+ - [Configuration Guide](CONFIGURATION.md) - Detailed config options
324
+ - [Interactive Mode Guide](docs/INTERACTIVE.md) - All interactive features
325
+ - [API Documentation](docs/API.md) - API details
326
+
327
+ 2. **Try Advanced Features**
328
+ - Session management (`/save`, `/load`)
329
+ - Custom system prompts (`/system`)
330
+ - Project context files
331
+ - Multiple models
332
+
333
+ 3. **Integrate with Your Workflow**
334
+ - Add Grok CLI to your build scripts
335
+ - Create project-specific `.grok/.env` configs
336
+ - Use in CI/CD pipelines
337
+
338
+ ## Getting Help
339
+
340
+ - Show help: `grok --help`
341
+ - Interactive help: `/help` (in interactive mode)
342
+ - Check version: `grok --version`
343
+ - View config: `grok config show`
344
+ - Test connection: `grok test-network`
345
+ - Check status: `/status` (in interactive mode)
346
+
347
+ ## Examples Repository
348
+
349
+ Check the `examples/` directory for:
350
+ - Extension examples
351
+ - Hook system demos
352
+ - MCP server configurations
353
+ - Integration examples
354
+
355
+ ## Contributing
356
+
357
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
358
+
359
+ ## License
360
+
361
+ See [LICENSE](LICENSE) file for details.
362
+
363
+ ---
364
+
365
+ **Ready to start?**
366
+
367
+ ```bash
368
+ # Start chatting with Grok!
369
+ grok
370
+
371
+ # Or ask a quick question
372
+ grok query "How do I use async/await in Rust?"
373
+
374
+ # Try a shell command in interactive mode
375
+ !ls -la
376
+ ```
377
+
378
+ Happy coding! 🚀