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,401 @@
1
+ # Grok CLI Interactive Mode Guide
2
+
3
+ This document explains how to use the Grok CLI interactive mode, including all available commands and features.
4
+
5
+ ## Overview
6
+
7
+ Interactive mode provides a conversational interface to Grok AI with built-in commands for session management, local shell execution, and more.
8
+
9
+ ## Starting Interactive Mode
10
+
11
+ ```bash
12
+ # Start with default settings
13
+ grok
14
+
15
+ # Or explicitly
16
+ grok interactive
17
+
18
+ # With custom model
19
+ grok --model grok-code-fast-1
20
+
21
+ # Hide banner
22
+ grok --hide-banner
23
+ ```
24
+
25
+ ## Interactive Commands
26
+
27
+ All commands in interactive mode start with a special character:
28
+ - `/` - Built-in commands (help, quit, settings, etc.)
29
+ - `!` - Local shell commands (execute on your computer)
30
+ - Regular text - Send to Grok AI
31
+
32
+ ### Built-in Commands (/)
33
+
34
+ #### Session Management
35
+
36
+ - `/quit`, `/exit`, `/q` - Exit interactive mode
37
+ - `/reset` - Reset conversation history and start fresh
38
+ - `/save [name]` - Save current session to disk
39
+ - `/load [name]` - Load a previously saved session
40
+ - `/list` - List all saved sessions
41
+
42
+ #### Display & UI
43
+
44
+ - `/clear`, `/cls` - Clear screen and show logo
45
+ - `/help`, `/h` - Show help message with all commands
46
+ - `/status` - Show current session status and statistics
47
+ - `/history` - Display conversation history
48
+ - `/version` - Show version information
49
+
50
+ #### Configuration
51
+
52
+ - `/model [name]` - Show current model or change it
53
+ ```
54
+ /model # Show current model
55
+ /model grok-code-fast-1 # Switch to code model
56
+ /model grok-3 # Switch to grok-3
57
+ ```
58
+
59
+ - `/system [prompt]` - Show or set system prompt
60
+ ```
61
+ /system # Show current prompt
62
+ /system You are a helpful assistant # Set new prompt
63
+ ```
64
+
65
+ - `/settings` - Open settings menu
66
+ - `/config` - Show current configuration
67
+ - `/tools` - List available coding tools
68
+
69
+ ### Shell Commands (!)
70
+
71
+ Execute commands locally on your computer without sending them to the AI. Perfect for checking files, running builds, or viewing system information.
72
+
73
+ #### Syntax
74
+
75
+ ```
76
+ !<command>
77
+ ```
78
+
79
+ The `!` prefix tells Grok CLI to execute the command on your local system instead of sending it to the AI.
80
+
81
+ #### Examples
82
+
83
+ **Windows:**
84
+ ```
85
+ !dir # List files in current directory
86
+ !dir /b # List files (bare format)
87
+ !cd # Show current directory
88
+ !type README.md # Display file contents
89
+ !echo Hello World # Print message
90
+ !git status # Check git status
91
+ !cargo build # Build Rust project
92
+ !npm test # Run npm tests
93
+ !systeminfo # Show system information
94
+ !tasklist # List running processes
95
+ ```
96
+
97
+ **Linux/macOS:**
98
+ ```
99
+ !ls # List files
100
+ !ls -la # List files with details
101
+ !pwd # Print working directory
102
+ !cat README.md # Display file contents
103
+ !echo "Hello World" # Print message
104
+ !git status # Check git status
105
+ !cargo build # Build Rust project
106
+ !npm test # Run npm tests
107
+ !uname -a # Show system information
108
+ !ps aux # List running processes
109
+ !df -h # Show disk usage
110
+ !top -n 1 # Show processes (one iteration)
111
+ ```
112
+
113
+ #### How It Works
114
+
115
+ 1. **Local Execution** - Commands run on your computer, not in the cloud
116
+ 2. **Output Display** - stdout and stderr are shown immediately
117
+ 3. **Exit Codes** - Non-zero exit codes are highlighted
118
+ 4. **No AI Processing** - Commands never sent to Grok API
119
+ 5. **Full Shell Access** - Use any command available in your shell
120
+
121
+ #### Benefits
122
+
123
+ - **Quick File Checks** - `!cat config.json` to see a file
124
+ - **Build Status** - `!cargo build` or `!npm run build`
125
+ - **Git Operations** - `!git status`, `!git diff`
126
+ - **System Info** - Check disk space, memory, processes
127
+ - **Testing** - Run tests without leaving chat
128
+ - **Debugging** - Execute diagnostic commands inline
129
+
130
+ #### Security Notes
131
+
132
+ ⚠️ **Important Security Considerations:**
133
+
134
+ 1. **Full Shell Access** - Shell commands have the same permissions as your user account
135
+ 2. **No Sandboxing** - Commands execute directly in your shell
136
+ 3. **Be Careful** - Dangerous commands (rm, del, format) will execute if you type them
137
+ 4. **Review Before Enter** - Always double-check commands before pressing Enter
138
+ 5. **No Confirmation** - Commands execute immediately without prompts
139
+
140
+ **Safe practices:**
141
+ - Use `!ls` or `!dir` to explore before acting
142
+ - Test destructive commands in a safe directory first
143
+ - Use version control (git) to protect against mistakes
144
+ - Keep backups of important files
145
+
146
+ #### Common Use Cases
147
+
148
+ **Workflow Integration:**
149
+ ```
150
+ User: !git status
151
+ Output: On branch main, nothing to commit
152
+
153
+ User: Can you review my changes in src/main.rs?
154
+ Grok: [Reviews the file]
155
+
156
+ User: !cargo test
157
+ Output: All tests passed
158
+
159
+ User: Great! !git add . && git commit -m "feat: add new feature"
160
+ ```
161
+
162
+ **File Exploration:**
163
+ ```
164
+ User: !ls src/
165
+ Output: main.rs lib.rs config.rs
166
+
167
+ User: !cat src/config.rs
168
+ Output: [file contents]
169
+
170
+ User: Can you help me refactor this config module?
171
+ Grok: [Provides suggestions]
172
+ ```
173
+
174
+ **Build and Deploy:**
175
+ ```
176
+ User: !cargo build --release
177
+ Output: Compiling project...
178
+
179
+ User: !./target/release/app --version
180
+ Output: app 1.0.0
181
+
182
+ User: The build worked! !git push
183
+ ```
184
+
185
+ #### Troubleshooting
186
+
187
+ **Command not found:**
188
+ - Ensure the command is in your PATH
189
+ - Use full path: `!/usr/local/bin/mycommand`
190
+ - On Windows, use proper extensions: `!node.exe` not just `!node`
191
+
192
+ **No output:**
193
+ - Some commands may be silent on success
194
+ - Check exit code (shown if non-zero)
195
+ - Try adding verbose flags: `!cargo build -v`
196
+
197
+ **Special characters:**
198
+ - Quote arguments with spaces: `!echo "hello world"`
199
+ - Escape special characters if needed
200
+ - Use your shell's syntax rules
201
+
202
+ **Long-running commands:**
203
+ - Commands block until completion
204
+ - Use Ctrl+C to interrupt Grok CLI (not the command)
205
+ - For background tasks, use your shell's background operator (`&` on Unix)
206
+
207
+ ## Session Information
208
+
209
+ Interactive mode displays session information in the prompt:
210
+
211
+ ```
212
+ Grok (grok-code-fast-1) [project-name | 2 context files]
213
+ ```
214
+
215
+ This shows:
216
+ - Current model: `grok-code-fast-1`
217
+ - Current directory: `project-name`
218
+ - Context files loaded: `2 context files`
219
+
220
+ ## Context Loading
221
+
222
+ Grok CLI automatically loads project context from these files:
223
+ - `.gemini.md`
224
+ - `.grok/context.md`
225
+ - `.zed/rules`
226
+ - `.claude.md`
227
+
228
+ Context is shown in the session info and used in all conversations.
229
+
230
+ ## Keyboard Shortcuts
231
+
232
+ - **Ctrl+C** - Cancel current input (in interactive mode)
233
+ - **Ctrl+D** - Exit interactive mode (Unix-like systems)
234
+ - **Tab** - Autocomplete commands (if supported by your terminal)
235
+ - **Up/Down Arrows** - Navigate command history (if supported)
236
+
237
+ ## Tips & Best Practices
238
+
239
+ ### Efficient Workflows
240
+
241
+ 1. **Use Shell Commands for Quick Checks**
242
+ ```
243
+ !cat error.log
244
+ What does this error mean?
245
+ ```
246
+
247
+ 2. **Combine with AI Analysis**
248
+ ```
249
+ !npm test
250
+ These tests are failing, can you help?
251
+ ```
252
+
253
+ 3. **Iterate Quickly**
254
+ ```
255
+ Suggest a fix for this function
256
+ [AI responds]
257
+ !nano src/main.rs
258
+ [Make changes]
259
+ !cargo test
260
+ ```
261
+
262
+ ### Session Management
263
+
264
+ - **Save Important Sessions**: `/save project-name-feature`
265
+ - **Reset When Switching Topics**: `/reset` clears history
266
+ - **Load Previous Work**: `/load` to continue where you left off
267
+
268
+ ### Model Selection
269
+
270
+ - **grok-3** - General purpose, balanced
271
+ - **grok-code-fast-1** - Optimized for coding (faster, focused)
272
+ - **grok-2-latest** - Latest stable release
273
+ - **grok-vision-beta** - For image analysis (when available)
274
+
275
+ Change models mid-session: `/model grok-code-fast-1`
276
+
277
+ ### Context Management
278
+
279
+ - Keep context files updated
280
+ - Use `.grok/context.md` for project-specific instructions
281
+ - Check loaded context with `/status`
282
+
283
+ ## Examples
284
+
285
+ ### Code Review Session
286
+
287
+ ```
288
+ Grok (grok-code-fast-1) [my-project] !git status
289
+ Executing: git status
290
+ On branch feature/new-api
291
+ Changes not staged for commit:
292
+ modified: src/api.rs
293
+
294
+ Grok (grok-code-fast-1) [my-project] !git diff src/api.rs
295
+ [Shows diff]
296
+
297
+ Grok (grok-code-fast-1) [my-project] Can you review these API changes?
298
+ [Grok provides detailed review]
299
+
300
+ Grok (grok-code-fast-1) [my-project] !cargo clippy
301
+ [Shows clippy warnings]
302
+
303
+ Grok (grok-code-fast-1) [my-project] How do I fix these warnings?
304
+ [Grok explains fixes]
305
+ ```
306
+
307
+ ### Debugging Session
308
+
309
+ ```
310
+ Grok (grok-3) [webapp] !npm run dev
311
+ [Server starts with error]
312
+
313
+ Grok (grok-3) [webapp] The server won't start, see the error above
314
+ [Grok analyzes error]
315
+
316
+ Grok (grok-3) [webapp] !cat package.json
317
+ [Shows dependencies]
318
+
319
+ Grok (grok-3) [webapp] Should I update these packages?
320
+ [Grok recommends updates]
321
+
322
+ Grok (grok-3) [webapp] !npm update
323
+ [Updates packages]
324
+
325
+ Grok (grok-3) [webapp] !npm run dev
326
+ [Server starts successfully]
327
+ ```
328
+
329
+ ### System Administration
330
+
331
+ ```
332
+ Grok (grok-3) [~] !df -h
333
+ Filesystem Size Used Avail Use% Mounted on
334
+ /dev/sda1 100G 85G 10G 90% /
335
+
336
+ Grok (grok-3) [~] My disk is almost full, what's using space?
337
+ [Grok suggests commands to check]
338
+
339
+ Grok (grok-3) [~] !du -sh ~/Downloads/* | sort -h | tail
340
+ [Shows largest directories]
341
+
342
+ Grok (grok-3) [~] Can I safely delete these old backups?
343
+ [Grok helps identify safe-to-delete files]
344
+ ```
345
+
346
+ ## Configuration
347
+
348
+ Interactive mode respects all configuration from `.env` files:
349
+
350
+ ```bash
351
+ # In .grok/.env or ~/.grok/.env
352
+ GROK_MODEL=grok-code-fast-1
353
+ GROK_TEMPERATURE=0.7
354
+ GROK_COLORS=true
355
+ GROK_UNICODE=true
356
+ ```
357
+
358
+ See [CONFIGURATION.md](CONFIGURATION.md) for full details.
359
+
360
+ ## Exit Codes
361
+
362
+ - `0` - Normal exit
363
+ - `1` - Error occurred
364
+ - `130` - Interrupted by Ctrl+C
365
+
366
+ ## Troubleshooting
367
+
368
+ ### Interactive Mode Won't Start
369
+
370
+ - Check API key: `echo $GROK_API_KEY`
371
+ - Verify connectivity: `grok test-network`
372
+ - Check config: `grok config show`
373
+
374
+ ### Commands Not Working
375
+
376
+ - Ensure you're using the correct prefix (/ or !)
377
+ - Check spelling: `/help` shows all commands
378
+ - Try `/version` to verify Grok CLI is working
379
+
380
+ ### Shell Commands Failing
381
+
382
+ - Verify command exists: `which command` (Unix) or `where command` (Windows)
383
+ - Check permissions
384
+ - Try running the command in your regular terminal first
385
+ - Use full paths if needed
386
+
387
+ ### Output Issues
388
+
389
+ - Enable colors: Set `GROK_COLORS=true` in `.env`
390
+ - Disable Unicode: Set `GROK_UNICODE=false` if characters display incorrectly
391
+ - Increase terminal width for better formatting
392
+
393
+ ## See Also
394
+
395
+ - [Configuration Guide](CONFIGURATION.md) - Full configuration options
396
+ - [README](../README.md) - Getting started
397
+ - [API Documentation](API.md) - API details
398
+
399
+ ## Feedback
400
+
401
+ If you have suggestions for improving interactive mode or encounter issues, please open an issue on GitHub.