| Crates.io | cmdai |
| lib.rs | cmdai |
| version | 0.1.0 |
| created_at | 2025-12-15 12:25:22.020432+00 |
| updated_at | 2025-12-15 12:25:22.020432+00 |
| description | Convert natural language to shell commands using local LLMs |
| homepage | |
| repository | https://github.com/wildcard/cmdai |
| max_upload_size | |
| id | 1985914 |
| size | 10,278,171 |
π§ Early Development Stage - Architecture defined, core implementation in progress
cmdai converts natural language descriptions into safe POSIX shell commands using local LLMs. Built with Rust for blazing-fast performance, single-binary distribution, and safety-first design.
$ cmdai "list all PDF files in Downloads folder larger than 10MB"
Generated command:
find ~/Downloads -name "*.pdf" -size +10M -ls
Execute this command? (y/N) y
This project is in active early development. The architecture and module structure are in place, with implementation ongoing.
For complete macOS setup instructions including GPU acceleration, see macOS Setup Guide.
Quick Install:
# Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source "$HOME/.cargo/env"
# Install CMake via Homebrew
brew install cmake
# Clone and build
git clone https://github.com/wildcard/cmdai.git
cd cmdai
cargo build --release
# Run
./target/release/cmdai "list all files"
For GPU Acceleration (Apple Silicon only):
cargo build --release --features embedded-mlxNote: The default build uses a stub implementation that works immediately without Xcode. For production GPU acceleration, Xcode is required.
# Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source "$HOME/.cargo/env"
# Install dependencies (Ubuntu/Debian)
sudo apt-get update
sudo apt-get install cmake build-essential
# Clone and build
git clone https://github.com/wildcard/cmdai.git
cd cmdai
cargo build --release
# Install Rust from https://rustup.rs
# Install CMake from https://cmake.org/download/
# Clone and build
git clone https://github.com/wildcard/cmdai.git
cd cmdai
cargo build --release
# Clone the repository
git clone https://github.com/wildcard/cmdai.git
cd cmdai
# Build the project (uses CPU backend by default)
cargo build --release
# Run the CLI
./target/release/cmdai --version
# Run tests
make test
# Format code
make fmt
# Run linter
make lint
# Build optimized binary
make build-release
# Run with debug logging
RUST_LOG=debug cargo run -- "your command"
cmdai [OPTIONS] <PROMPT>
# Basic command generation
cmdai "list all files in the current directory"
# With specific shell
cmdai --shell zsh "find large files"
# JSON output for scripting
cmdai --output json "show disk usage"
# Adjust safety level
cmdai --safety permissive "clean temporary files"
# Auto-confirm dangerous commands
cmdai --confirm "remove old log files"
# Verbose mode with timing info
cmdai --verbose "search for Python files"
| Option | Description | Status |
|---|---|---|
-s, --shell <SHELL> |
Target shell (bash, zsh, fish, sh, powershell, cmd) | β Implemented |
--safety <LEVEL> |
Safety level (strict, moderate, permissive) | β Implemented |
-o, --output <FORMAT> |
Output format (json, yaml, plain) | β Implemented |
-y, --confirm |
Auto-confirm dangerous commands | β Implemented |
-v, --verbose |
Enable verbose output with timing | β Implemented |
-c, --config <FILE> |
Custom configuration file | β Implemented |
--show-config |
Display current configuration | β Implemented |
--auto |
Execute without confirmation | π Planned |
--allow-dangerous |
Allow potentially dangerous commands | π Planned |
--verbose |
Enable verbose logging | β Available |
# Simple command generation
cmdai "compress all images in current directory"
# With specific backend
cmdai --backend mlx "find large log files"
# Verbose mode for debugging
cmdai --verbose "show disk usage"
cmdai/
βββ src/
β βββ main.rs # CLI entry point
β βββ backends/ # LLM backend implementations
β β βββ mod.rs # Backend trait definition
β β βββ mlx.rs # Apple Silicon MLX backend
β β βββ vllm.rs # vLLM remote backend
β β βββ ollama.rs # Ollama local backend
β βββ safety/ # Command validation
β β βββ mod.rs # Safety validator
β βββ cache/ # Model caching
β βββ config/ # Configuration management
β βββ cli/ # CLI interface
β βββ models/ # Data models
β βββ execution/ # Command execution
βββ tests/ # Contract-based tests
βββ specs/ # Project specifications
#[async_trait]
trait CommandGenerator {
async fn generate_command(&self, request: &CommandRequest)
-> Result<GeneratedCommand, GeneratorError>;
async fn is_available(&self) -> bool;
fn backend_info(&self) -> BackendInfo;
}
# Clone and enter the project
git clone https://github.com/wildcard/cmdai.git
cd cmdai
# Install dependencies and build
cargo build
# Run tests
cargo test
# Check formatting
cargo fmt -- --check
# Run clippy linter
cargo clippy -- -D warnings
cmdai supports multiple inference backends with automatic fallback:
Configure in ~/.config/cmdai/config.toml:
[backend]
primary = "embedded" # or "ollama", "vllm"
enable_fallback = true
[backend.ollama]
base_url = "http://localhost:11434"
model_name = "codellama:7b"
[backend.vllm]
base_url = "http://localhost:8000"
model_name = "codellama/CodeLlama-7b-hf"
api_key = "optional-api-key"
The project uses several configuration files:
Cargo.toml - Rust dependencies and build configuration~/.config/cmdai/config.toml - User configurationclippy.toml - Linter rulesrustfmt.toml - Code formatting rulesdeny.toml - Dependency audit configurationThe project uses contract-based testing:
cmdai includes comprehensive safety validation to prevent dangerous operations:
rm -rf /, rm -rf ~):(){:|:&};:)mkfs, dd if=/dev/zero)sudo su, chmod 777 /)/bin, /usr, /etc)Configure safety levels in ~/.config/cmdai/config.toml:
[safety]
enabled = true
level = "moderate" # strict, moderate, or permissive
require_confirmation = true
custom_patterns = ["additional", "dangerous", "patterns"]
We welcome contributions! This is an early-stage project with many opportunities to contribute.
make check before submittingThis project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0) - see the LICENSE file for details.
/specs directory for detailed specificationsBuilt with Rust | Safety First | Open Source
Note: This is an active development project. Features and APIs are subject to change. See the specs directory for detailed design documentation.