RustShell
The intelligent shell that speaks your language. Built with Rust. Powered by AI. Open Source.
RustShell is an AI-powered cross-platform shell utility that lets you write commands in natural language. Instead of memorizing complex syntax for different operating systems, simply describe what you want to do, and RustShell translates it into the appropriate shell commands for your platform.
Features
- AI-Powered Natural Language Processing: Convert plain English descriptions into shell commands with support for multiple LLM providers (Groq, Ollama, OpenAI, Anthropic)
- Cross-Platform Support: Seamless support for Windows, Linux, and macOS with platform-specific optimizations
- Flexible Execution Modes:
approve(confirm before executing),auto(execute immediately), ordry-run(preview only) - Fuzzy Command Completion: Intelligent matching finds what you mean even with typos
- Enhanced Alias System: Create parametric aliases, organize them into groups, and import/export configurations
- Plugin System: Extend RustShell with subprocess-based plugins using the
rustshell-plugin-*naming convention - Script Mode: Write
.rshscript files for automation and batch processing - Command Context Memory: Maintains context from previous commands for smarter suggestions
- Colored Terminal Output: Beautiful, readable output with Dracula-themed color support
- Shell Completions: First-class support for bash, zsh, fish, and powershell
- Opt-in Telemetry: Privacy-respecting, local usage tracking for insights and improvements
Installation
From Crates.io
The easiest way to install RustShell:
Build from Source
Clone the repository and build locally:
This will compile RustShell and add it to your Cargo bin directory (typically ~/.cargo/bin).
Quick Start
Basic Usage
Start with interactive mode (no arguments):
Execute a natural language command:
With different execution modes:
# Approve mode (default) - confirms before execution
# Auto mode - executes immediately
# Dry-run mode - preview without executing
Interactive Mode
Start an interactive session with tab completion and history:
Features:
- Type natural language commands
- Press
Tabfor command suggestions and file completions - Use arrow keys to navigate history
- Press
Ctrl+Cto exit - Command context from previous commands for smarter suggestions
Natural Language Examples
RustShell understands a wide variety of natural language descriptions:
# File operations
# System operations
# Development tasks
LLM Providers
RustShell supports multiple AI providers for natural language processing:
| Provider | Default Model | Environment Variable | Best For |
|---|---|---|---|
| Groq | llama-3.1-70b-versatile | GROQ_API_KEY |
Fast inference, free tier available |
| OpenAI | gpt-3.5-turbo | OPENAI_API_KEY |
High accuracy, many models |
| Anthropic | claude-3-sonnet-20240229 | ANTHROPIC_API_KEY |
Advanced reasoning capabilities |
| Ollama | llama2 | OLLAMA_ENDPOINT |
Local/offline execution, privacy-focused |
Setting Up Your Provider
- Choose a provider and obtain an API key (or run Ollama locally)
- Set the environment variable in your shell profile:
# For Groq (recommended for getting started)
# For OpenAI
# For Anthropic
# For Ollama (local/self-hosted)
- Configure RustShell in
~/.rustshell/config.toml(see Configuration section below)
Configuration
Configuration File
Create or edit ~/.rustshell/config.toml to customize RustShell behavior:
[]
= "groq" # groq, ollama, openai, anthropic
= "llama-3.1-70b-versatile"
= "GROQ_API_KEY" # Environment variable name
= "" # Optional custom endpoint
= 30
= 150
= 0.1
= true
[]
= ["rm", "delete", "format", "sudo"]
= ["rm -rf /", "format c:", "sudo rm"]
= true
= false
[]
= true
= true
= false
= true
= 3 # Number of previous commands to use as context
= "approve"
[]
= true
= true
= false
= true
Environment Variables
RustShell looks for configuration in this order:
.envfile in current directory.envfile in~/.rustshell/.envfile in home directory- System environment variables
Example .env file:
GROQ_API_KEY=gsk_...
RUSTSHELL_MODE=approve
RUSTSHELL_COLORED_OUTPUT=true
Advanced Features
Alias System
Create shortcuts for frequently used commands:
# Create an alias
# Create a parametric alias
# Use the alias
# List all aliases
# Remove an alias
Aliases are stored in ~/.rustshell_aliases and persist across sessions.
Script Mode
Write reusable scripts in .rsh format:
# script.rsh - Automated backup script
# Comments start with #
# Natural language commands
# Set and use variables
Execute the script:
Shell Completions
Install shell completions for faster command entry and better integration:
# Bash
# Zsh
# Fish
# PowerShell
Or generate completions manually:
Plugin Development
Extend RustShell with custom plugins using a simple subprocess-based architecture.
Plugin Naming Convention
Plugins must follow the naming pattern: rustshell-plugin-<name>
Creating a Plugin
- Create an executable program (in any language) named
rustshell-plugin-myfeature - Place it in
~/.rustshell/plugins/or anywhere in your$PATH - The plugin must support the
--rustshell-manifestflag to return its capabilities
Plugin Manifest Format
Your plugin should return JSON when called with --rustshell-manifest:
Response format:
Example Plugin (Bash)
#!/bin/bash
# rustshell-plugin-mytool
if ; then
else
# Handle actual command execution
fi
RustShell automatically discovers plugins and makes their commands available in the natural language processor.
Built-in Commands
RustShell includes cross-platform built-in commands that work consistently across Windows, Linux, and macOS:
| Command | Aliases | Description |
|---|---|---|
make_dir |
mkdir |
Create a directory |
create_file |
touch |
Create an empty file |
copy |
Copy a file | |
move |
Move a file or directory | |
delete_file |
rm |
Delete a file |
delete_dir |
rmdir |
Delete a directory |
change_dir |
cd |
Change current directory |
list |
ls |
List directory contents |
where_am_i |
pwd |
Show current directory |
show |
cat |
Display file contents |
find |
Find files matching a pattern | |
compress |
zip |
Create a zip archive |
alias |
Create or list aliases | |
unalias |
Remove an alias | |
pipe |
Connect commands with pipes | |
plugin |
plugins |
Manage and run plugins |
help |
Show help message | |
showall |
Display all available commands |
These commands are translated to platform-specific implementations automatically.
Safety Features
RustShell includes several safety mechanisms to prevent accidental command execution:
- Confirmation Required: Dangerous commands (rm, delete, format, sudo) require confirmation
- Dry-Run Mode: Preview commands before execution with
--dry-runflag - Pattern Blocking: Configure dangerous command patterns to block
- Destructive Mode Control: Enable/disable destructive operations via config
- Natural Language Validation: AI validates command translations before execution
Performance Optimizations
- LLM Response Caching: Frequently used commands are cached to reduce API calls and latency
- Fuzzy Matching: Fast, intelligent command matching with typo correction
- Cross-Platform Optimization: Platform-specific implementations for best performance
- Async I/O: Non-blocking command execution and API calls using Tokio
Built With
RustShell is built with excellent Rust libraries:
- Clap - Command-line argument parsing
- Crossterm - Terminal manipulation and colors
- Reqwest - HTTP client for LLM API calls
- Tokio - Async runtime for concurrent operations
- Rustyline - Interactive readline library
- Serde - Serialization/deserialization framework
- Fuzzy Matcher - Fuzzy string matching
Contributing
We welcome contributions to RustShell! Please see CONTRIBUTING.md for guidelines on:
- Filing issues and feature requests
- Submitting pull requests
- Development setup
- Code style and testing
Community
- GitHub Issues: Report bugs or request features
- Discussions: Join our community discussions
Troubleshooting
"LLM API key not found"
Make sure your API key is set in the environment. Check your configuration:
"Command translation failed"
Try the --dry-run mode to see what command was generated:
"Command not found"
Enable fallback_to_traditional = true in your config to allow traditional command parsing as a fallback.
Shell completions not working
Ensure you've installed completions correctly:
# Then restart your shell or source your profile
License
RustShell is licensed under the MIT License. See LICENSE for details.
Changelog
See CHANGELOG.md for a detailed history of changes and features.
Author
Created by Efe Baran Durmaz
Made with care for developers who want to code faster, smarter, and more intuitively.