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,570 @@
1
+ # Project Creation Quick Start Guide
2
+
3
+ This guide shows you how to use Grok CLI's automatic tool execution to create new projects effortlessly.
4
+
5
+ ## Table of Contents
6
+ - [Quick Start](#quick-start)
7
+ - [Step-by-Step Tutorial](#step-by-step-tutorial)
8
+ - [Project Templates](#project-templates)
9
+ - [Best Practices](#best-practices)
10
+ - [Common Patterns](#common-patterns)
11
+ - [Troubleshooting](#troubleshooting)
12
+
13
+ ## Quick Start
14
+
15
+ ### 1. Create a New Project Directory
16
+ ```bash
17
+ mkdir my-project
18
+ cd my-project
19
+ ```
20
+
21
+ ### 2. Start Grok CLI
22
+ ```bash
23
+ grok
24
+ ```
25
+
26
+ ### 3. Ask Grok to Create Your Project
27
+ ```
28
+ You: Create a new Rust CLI application with:
29
+ - Cargo.toml for a binary called my-app
30
+ - src/main.rs with clap for argument parsing
31
+ - README.md with installation and usage instructions
32
+ - .gitignore for Rust projects
33
+ ```
34
+
35
+ ### 4. Watch the Magic Happen
36
+ ```
37
+ Grok is executing operations...
38
+ ✓ Successfully wrote to Cargo.toml
39
+ ✓ Successfully wrote to src/main.rs
40
+ ✓ Successfully wrote to README.md
41
+ ✓ Successfully wrote to .gitignore
42
+ All operations completed!
43
+ ```
44
+
45
+ That's it! Your project is ready to use.
46
+
47
+ ## Step-by-Step Tutorial
48
+
49
+ ### Example: Creating a REST API Server
50
+
51
+ #### Step 1: Set Up Directory
52
+ ```bash
53
+ mkdir todo-api
54
+ cd todo-api
55
+ ```
56
+
57
+ #### Step 2: Start Interactive Session
58
+ ```bash
59
+ grok
60
+ ```
61
+
62
+ #### Step 3: Create Project Structure
63
+ ```
64
+ You: Create a Rust REST API project structure using Axum with the following:
65
+
66
+ 1. Cargo.toml with dependencies:
67
+ - axum 0.7
68
+ - tokio with full features
69
+ - serde and serde_json
70
+ - tower-http for CORS
71
+ - sqlx with postgres features
72
+
73
+ 2. Directory structure:
74
+ - src/main.rs - Server entry point
75
+ - src/routes/ - API route handlers
76
+ - src/models/ - Data models
77
+ - src/db/ - Database connection
78
+
79
+ 3. .env.example with:
80
+ - DATABASE_URL
81
+ - PORT
82
+ - HOST
83
+
84
+ 4. README.md with API documentation
85
+ ```
86
+
87
+ #### Step 4: Add Route Handlers
88
+ ```
89
+ You: Create src/routes/mod.rs that exports all route modules
90
+
91
+ You: Create src/routes/todos.rs with CRUD endpoints:
92
+ - GET /todos - List all todos
93
+ - POST /todos - Create new todo
94
+ - GET /todos/:id - Get single todo
95
+ - PUT /todos/:id - Update todo
96
+ - DELETE /todos/:id - Delete todo
97
+ ```
98
+
99
+ #### Step 5: Add Data Models
100
+ ```
101
+ You: Create src/models/todo.rs with:
102
+ - Todo struct with id, title, description, completed, created_at
103
+ - Derive Serialize, Deserialize, and sqlx::FromRow
104
+ ```
105
+
106
+ #### Step 6: Set Up Database
107
+ ```
108
+ You: Create src/db/mod.rs with:
109
+ - Database connection pool setup
110
+ - Migration runner function
111
+ - Error handling
112
+ ```
113
+
114
+ #### Step 7: Complete the Application
115
+ ```
116
+ You: Update src/main.rs to:
117
+ - Initialize database connection
118
+ - Set up Axum router with all routes
119
+ - Configure CORS middleware
120
+ - Start server on configured port
121
+ ```
122
+
123
+ #### Step 8: Verify Structure
124
+ ```
125
+ You: List all files we created
126
+ ```
127
+
128
+ Output:
129
+ ```
130
+ ✓ Directory contents of .:
131
+ Cargo.toml
132
+ README.md
133
+ .env.example
134
+ src/
135
+ src/main.rs
136
+ src/routes/
137
+ src/routes/mod.rs
138
+ src/routes/todos.rs
139
+ src/models/
140
+ src/models/todo.rs
141
+ src/db/
142
+ src/db/mod.rs
143
+ ```
144
+
145
+ ## Project Templates
146
+
147
+ ### Rust CLI Application
148
+ ```
149
+ You: Create a Rust CLI application with:
150
+ - Cargo.toml for binary with clap, colored, and anyhow
151
+ - src/main.rs with command-line argument parsing
152
+ - src/cli/ directory for command modules
153
+ - src/utils/ for helper functions
154
+ - tests/ directory with integration tests
155
+ - README.md with usage examples
156
+ - .gitignore for Rust
157
+ Then run cargo init and git init to set it up
158
+ ```
159
+
160
+ ### Web Application (Full Stack)
161
+ ```
162
+ You: Create a full-stack web application with:
163
+
164
+ Backend (Rust + Axum):
165
+ - backend/Cargo.toml with axum, tokio, sqlx
166
+ - backend/src/main.rs - API server
167
+ - backend/src/routes/ - API endpoints
168
+ - backend/src/models/ - Database models
169
+ - backend/src/middleware/ - Auth, CORS, logging
170
+
171
+ Frontend (HTML/CSS/JS):
172
+ - frontend/index.html - Main page
173
+ - frontend/css/styles.css - Styling
174
+ - frontend/js/app.js - API interactions
175
+ - frontend/js/components/ - Reusable components
176
+
177
+ Configuration:
178
+ - .env.example with all required variables
179
+ - docker-compose.yml for PostgreSQL
180
+ - README.md with setup instructions
181
+ ```
182
+
183
+ ### Microservice
184
+ ```
185
+ You: Create a microservice project with:
186
+ - Service code in src/
187
+ - Health check endpoint
188
+ - Metrics endpoint (Prometheus format)
189
+ - Docker configuration
190
+ - Kubernetes manifests in k8s/
191
+ - CI/CD pipeline (.github/workflows/)
192
+ - Comprehensive README
193
+ ```
194
+
195
+ ### Library/Package
196
+ ```
197
+ You: Create a Rust library with:
198
+ - Cargo.toml configured as a library
199
+ - src/lib.rs with module exports
200
+ - src/ directory with core modules
201
+ - examples/ with usage examples
202
+ - tests/ with unit and integration tests
203
+ - benches/ with benchmarks
204
+ - docs/ with architecture documentation
205
+ - README.md with API overview
206
+ - CONTRIBUTING.md
207
+ - LICENSE (MIT)
208
+ ```
209
+
210
+ ### Data Processing Pipeline
211
+ ```
212
+ You: Create a data processing pipeline with:
213
+ - Input data parsers in src/parsers/
214
+ - Transformation logic in src/transforms/
215
+ - Output writers in src/writers/
216
+ - Configuration system in src/config/
217
+ - Error handling and logging
218
+ - Example data files in data/examples/
219
+ - Pipeline documentation
220
+ ```
221
+
222
+ ## Best Practices
223
+
224
+ ### 1. Start with Structure
225
+ Always create the directory structure first:
226
+ ```
227
+ You: Create the following directory structure:
228
+ - src/
229
+ - tests/
230
+ - docs/
231
+ - examples/
232
+ ```
233
+
234
+ ### 2. One Step at a Time
235
+ Don't ask for everything at once. Break it down:
236
+ ```
237
+ ✅ Good:
238
+ You: First, create the Cargo.toml
239
+ You: Now create the main.rs with basic setup
240
+ You: Add the configuration module
241
+
242
+ ❌ Too Much:
243
+ You: Create everything for a complete application
244
+ ```
245
+
246
+ ### 3. Be Specific About Dependencies
247
+ ```
248
+ ✅ Good:
249
+ You: Add dependencies: axum 0.7, tokio 1.35 with full features, serde 1.0
250
+
251
+ ❌ Vague:
252
+ You: Add some web framework dependencies
253
+ ```
254
+
255
+ ### 4. Verify as You Go
256
+ ```
257
+ You: List all files in src/
258
+ You: Show me the contents of main.rs
259
+ You: What's in the Cargo.toml?
260
+ ```
261
+
262
+ ### 5. Use Version Control
263
+ ```bash
264
+ # Initialize git before starting
265
+ git init
266
+
267
+ # Commit after major steps
268
+ You: Create the project structure
269
+ # Verify it looks good
270
+ git add .
271
+ git commit -m "Initial project structure"
272
+ ```
273
+
274
+ ## Common Patterns
275
+
276
+ ### Pattern 1: Iterative Development
277
+ ```
278
+ You: Create a basic main.rs with hello world
279
+ # Review output
280
+ You: Add command-line argument parsing
281
+ # Test it
282
+ You: Add configuration file support
283
+ # Build incrementally
284
+ ```
285
+
286
+ ### Pattern 2: Template + Customize
287
+ ```
288
+ You: Create a standard Rust binary project structure
289
+ You: Now customize it for a web scraper with reqwest and scraper crates
290
+ You: Add concurrent processing with tokio
291
+ ```
292
+
293
+ ### Pattern 3: Copy from Reference
294
+ ```
295
+ You: Create a project structure similar to a typical Rust web API
296
+ You: Follow the axum examples for the router setup
297
+ You: Use the same error handling pattern as the anyhow documentation
298
+ ```
299
+
300
+ ### Pattern 4: Modular Creation
301
+ ```
302
+ You: Create src/database/mod.rs with connection pooling
303
+ You: Create src/database/models.rs with user model
304
+ You: Create src/database/queries.rs with CRUD operations
305
+ You: Now create src/database/migrations.rs
306
+ ```
307
+
308
+ ## Advanced Usage
309
+
310
+ ### Multi-Language Projects
311
+ ```
312
+ You: Create a polyglot project with:
313
+
314
+ Rust backend:
315
+ - backend/Cargo.toml
316
+ - backend/src/main.rs
317
+ - backend/src/api/
318
+
319
+ Python ML service:
320
+ - ml-service/requirements.txt
321
+ - ml-service/main.py
322
+ - ml-service/models/
323
+
324
+ Configuration:
325
+ - docker-compose.yml connecting both services
326
+ - README with setup for both
327
+ ```
328
+
329
+ ### Monorepo Structure
330
+ ```
331
+ You: Create a monorepo with:
332
+
333
+ Workspace Cargo.toml at root
334
+ Packages:
335
+ - packages/core/ - Shared library
336
+ - packages/cli/ - CLI application
337
+ - packages/server/ - Web server
338
+ - packages/client/ - API client
339
+
340
+ Documentation:
341
+ - docs/ARCHITECTURE.md
342
+ - Each package has its own README
343
+ ```
344
+
345
+ ### Generated Code Projects
346
+ ```
347
+ You: Create a code generation project:
348
+ - templates/ directory with template files
349
+ - src/generator/ with code generation logic
350
+ - src/parser/ to parse input specifications
351
+ - examples/output/ showing generated results
352
+ - README explaining the generation process
353
+ ```
354
+
355
+ ## Troubleshooting
356
+
357
+ ### Problem: Files Not Created
358
+ **Symptom**: Grok describes what to do but doesn't create files.
359
+
360
+ **Solution**:
361
+ 1. Check version: `grok --version` (need v0.1.2+)
362
+ 2. Be more explicit: "Create the file..." not "You should create..."
363
+ 3. Make sure you're in interactive mode
364
+
365
+ ### Problem: Wrong Directory
366
+ **Symptom**: Files created in unexpected location.
367
+
368
+ **Solution**:
369
+ 1. Check current directory: `pwd` or `cd`
370
+ 2. Change to correct directory before starting grok
371
+ 3. Use relative paths: `src/main.rs` not `/path/to/src/main.rs`
372
+
373
+ ### Problem: Files Overwritten
374
+ **Symptom**: Existing files were replaced.
375
+
376
+ **Solution**:
377
+ 1. Always use git: `git init` before starting
378
+ 2. Ask Grok to read files first: "Show me main.rs"
379
+ 3. Use specific modifications: "Add function X to main.rs" instead of "Recreate main.rs"
380
+
381
+ ### Problem: Incomplete Structure
382
+ **Symptom**: Some files/directories missing.
383
+
384
+ **Solution**:
385
+ 1. Ask explicitly for each part
386
+ 2. Verify with: "List all files and directories we've created"
387
+ 3. Fill gaps: "We're missing tests/, please create it"
388
+
389
+ ### Problem: Syntax Errors in Generated Code
390
+ **Symptom**: Created files have syntax issues.
391
+
392
+ **Solution**:
393
+ 1. Run cargo check or equivalent: `cargo check`
394
+ 2. Show errors to Grok: "Fix these compiler errors: [paste errors]"
395
+ 3. Ask for specific fixes: "The import path is wrong in main.rs"
396
+
397
+ ## Examples Gallery
398
+
399
+ ### Example 1: Blog Engine
400
+ ```bash
401
+ mkdir blog-engine && cd blog-engine
402
+ grok
403
+ ```
404
+ ```
405
+ You: Create a blog engine with:
406
+ - Post creation and editing
407
+ - Markdown support
408
+ - SQLite database
409
+ - Web interface with templates
410
+ - RSS feed generation
411
+ - Tag system
412
+ - Search functionality
413
+ ```
414
+
415
+ ### Example 2: Discord Bot
416
+ ```bash
417
+ mkdir discord-bot && cd discord-bot
418
+ grok
419
+ ```
420
+ ```
421
+ You: Create a Discord bot with:
422
+ - serenity crate setup
423
+ - Command framework
424
+ - src/commands/ with modular commands
425
+ - Configuration from .env
426
+ - Database for persistent data
427
+ - README with bot setup instructions
428
+ ```
429
+
430
+ ### Example 3: File Converter
431
+ ```bash
432
+ mkdir file-converter && cd file-converter
433
+ grok
434
+ ```
435
+ ```
436
+ You: Create a file format converter CLI that:
437
+ - Supports JSON, YAML, TOML, CSV
438
+ - Uses clap for arguments
439
+ - Parallel processing with rayon
440
+ - Progress bar with indicatif
441
+ - Comprehensive error handling
442
+ - Example files in examples/
443
+ Then initialize it with cargo init --bin and git init
444
+ ```
445
+
446
+ ### Example 4: Monitoring Dashboard
447
+ ```bash
448
+ mkdir monitor-dash && cd monitor-dash
449
+ grok
450
+ ```
451
+ ```
452
+ You: Create a system monitoring dashboard:
453
+ - Backend API collecting system metrics
454
+ - WebSocket for real-time updates
455
+ - Simple HTML/JS frontend
456
+ - Charts using Chart.js
457
+ - Docker deployment
458
+ - Prometheus integration
459
+ ```
460
+
461
+ ## Tips for Success
462
+
463
+ ### 1. Learn from Examples
464
+ ```
465
+ You: Show me a typical Rust project structure for a web API
466
+ You: What files are essential for a CLI application?
467
+ You: What's the standard layout for tests in Rust?
468
+ ```
469
+
470
+ ### 2. Ask for Explanations
471
+ ```
472
+ You: Why did you structure it this way?
473
+ You: Explain the dependencies in Cargo.toml
474
+ You: What does this configuration do?
475
+ ```
476
+
477
+ ### 3. Iterate and Improve
478
+ ```
479
+ You: Create basic version
480
+ You: Add error handling
481
+ You: Add logging
482
+ You: Add configuration
483
+ You: Add tests
484
+ You: Add documentation
485
+ ```
486
+
487
+ ### 4. Use Templates Consistently
488
+ Create your own patterns:
489
+ ```
490
+ You: Remember that I prefer this project structure: [describe]
491
+ # Grok will save to memory
492
+ You: Create a new project following my preferred structure
493
+ ```
494
+
495
+ ### 5. Combine with Git Workflow
496
+ ```bash
497
+ git init
498
+ grok
499
+ # Create initial structure
500
+ git add .
501
+ git commit -m "Initial commit"
502
+
503
+ # Continue development
504
+ # Each major step -> commit
505
+ ```
506
+
507
+ ## Next Steps
508
+
509
+ After creating your project:
510
+
511
+ 1. **Build and Test**
512
+ ```bash
513
+ cargo build
514
+ cargo test
515
+ cargo run
516
+ ```
517
+
518
+ Or ask Grok to do it:
519
+ ```
520
+ You: Run cargo build to compile the project
521
+ You: Execute cargo test to run the tests
522
+ ```
523
+
524
+ 2. **Review Generated Code**
525
+ - Check for TODO comments
526
+ - Verify error handling
527
+ - Review dependencies
528
+
529
+ 3. **Customize**
530
+ ```
531
+ You: Add custom error types to src/error.rs
532
+ You: Implement authentication middleware
533
+ You: Add database migrations
534
+ ```
535
+
536
+ 4. **Document**
537
+ ```
538
+ You: Add doc comments to all public functions
539
+ You: Create ARCHITECTURE.md explaining the design
540
+ You: Add examples to README
541
+ ```
542
+
543
+ 5. **Set Up CI/CD**
544
+ ```
545
+ You: Create GitHub Actions workflow for testing
546
+ You: Add clippy and rustfmt checks
547
+ You: Set up deployment configuration
548
+ You: Run git add . and git commit -m "Initial commit"
549
+ ```
550
+
551
+ ## Resources
552
+
553
+ - [FILE_OPERATIONS.md](FILE_OPERATIONS.md) - Detailed tool documentation
554
+ - [QUICK_REFERENCE.md](QUICK_REFERENCE.md) - Command reference
555
+ - [CHAT_LOGGING.md](CHAT_LOGGING.md) - Session management
556
+ - Main [README.md](../README.md) - Getting started
557
+
558
+ ## Feedback
559
+
560
+ Share your project creation experiences:
561
+ - GitHub Issues: Report problems or request features
562
+ - GitHub Discussions: Share your project templates
563
+ - Pull Requests: Contribute example templates
564
+
565
+ ---
566
+
567
+ **Happy Creating! 🚀**
568
+
569
+ Version: 0.1.2
570
+ Last Updated: 2026-01-13