@@ -298,6 +298,167 @@ fn main() {
298298
299299---
300300
301+ ## 🖥️ Command Line Interface (CLI)
302+
303+ The RustCoder CLI provides a command-line interface to interact with the API endpoints and manage projects.
304+
305+ ### 📦 Installation
306+
307+ Install the CLI dependencies:
308+
309+ ``` bash
310+ pip install -r requirements.txt
311+ ```
312+
313+ ### 🚀 Basic Usage
314+
315+ Run the CLI with:
316+
317+ ``` bash
318+ python -m cli.main --help
319+ ```
320+
321+ Set the server URL via environment variable or flag:
322+
323+ ``` bash
324+ export RUSTCODER_SERVER=http://localhost:8000
325+ # or
326+ python -m cli.main --server http://localhost:8000
327+ ```
328+
329+ ### 📋 Available Commands
330+
331+ #### 🔍 Project Generation
332+
333+ ** Generate a project (async):**
334+ ``` bash
335+ python -m cli.main generate --description " A command-line calculator in Rust"
336+ ```
337+
338+ ** Generate a project (sync):**
339+ ``` bash
340+ python -m cli.main generate --description " A web API with actix" --sync
341+ ```
342+
343+ ** Generate with requirements file:**
344+ ``` bash
345+ python -m cli.main generate --description " CLI tool" --requirements requirements.txt
346+ ```
347+
348+ #### 📊 Project Management
349+
350+ ** Check project status:**
351+ ``` bash
352+ python -m cli.main status --project < project_id>
353+ ```
354+
355+ ** Watch project until completion:**
356+ ``` bash
357+ python -m cli.main status --project < project_id> --watch
358+ ```
359+
360+ ** Download project as zip:**
361+ ``` bash
362+ python -m cli.main download --project < project_id> --out my_project.zip
363+ ```
364+
365+ ** View project file contents:**
366+ ``` bash
367+ python -m cli.main cat --project < project_id> --file src/main.rs
368+ ```
369+
370+ #### 🛠️ Code Compilation & Fixing
371+
372+ ** Compile Rust code from file:**
373+ ``` bash
374+ python -m cli.main compile --code ./artifacts/multifile.txt
375+ ```
376+
377+ ** Compile Rust code from project ID:**
378+ ``` bash
379+ python -m cli.main compile --project < project_id>
380+ ```
381+
382+ ** Auto-fix compilation errors from file:**
383+ ``` bash
384+ python -m cli.main fix --code ./artifacts/multifile.txt --description " hello world" --max-attempts 5
385+ ```
386+
387+ ** Auto-fix compilation errors from project ID:**
388+ ``` bash
389+ python -m cli.main fix --project < project_id> --description " hello world" --max-attempts 5
390+ ```
391+
392+
393+
394+ #### ℹ️ Utility Commands
395+
396+ ** Show version info:**
397+ ``` bash
398+ python -m cli.main version
399+ ```
400+
401+ ** Show version as JSON:**
402+ ``` bash
403+ python -m cli.main version --json
404+ ```
405+
406+ ** Get shell completions:**
407+ ``` bash
408+ python -m cli.main completions
409+ ```
410+
411+ ### 🔄 Complete Workflow Example
412+
413+ 1 . ** Generate a project:**
414+ ``` bash
415+ python -m cli.main generate --description " A simple HTTP server" --sync
416+ ```
417+
418+ 2 . ** Save the output to a file:**
419+ ``` bash
420+ python -m cli.main generate --description " A simple HTTP server" --sync > project.txt
421+ ```
422+
423+ 3 . ** Compile the project:**
424+ ``` bash
425+ python -m cli.main compile --code project.txt
426+ ```
427+
428+ 4 . ** If compilation fails, auto-fix:**
429+ ``` bash
430+ python -m cli.main fix --code project.txt --description " A simple HTTP server" --max-attempts 3
431+ ```
432+
433+ ### 📁 Input File Format
434+
435+ The CLI expects multi-file input in the format:
436+
437+ ```
438+ [filename: Cargo.toml]
439+ [package]
440+ name = "my_project"
441+ version = "0.1.0"
442+ edition = "2021"
443+
444+ [filename: src/main.rs]
445+ fn main() {
446+ println!("Hello, world!");
447+ }
448+ ```
449+
450+ ### 🌐 Environment Variables
451+
452+ - ` RUSTCODER_SERVER ` : Base URL of the RustCoder API (default: ` http://localhost:8000 ` )
453+
454+ ### 📝 Output Formats
455+
456+ - ** Human-readable** : Default output with colors and formatting
457+ - ** JSON** : Use ` --json ` flag for machine-readable output
458+ - ** File redirection** : Pipe output to files or other commands
459+
460+ ---
461+
301462## 🔧 MCP (Model-Compiler-Processor) tools
302463
303464The MCP server is available via the HTTP SSE transport via the ` http://localhost:3000/sse ` URL. The MCP server can be accessed using the [ cmcp command-line client] ( https://github.com/RussellLuo/cmcp ) . To install the ` cmcp ` tool,
0 commit comments