AI-powered CLI assistant with automatic error recovery and code fixing.
Project description
cmdexy
AI-powered CLI assistant with automatic error recovery and code fixing.
โจ Features
- ๐ค AI-Powered Intent Analysis - Understands what you want to do
- ๐ง Automatic Error Recovery - Detects failures and suggests fixes
- ๐ Code Auto-Fixing - Patches your files automatically
- ๐ป Shell Command Wrapper - Monitor any command with AI assistance
- ๐ OS-Aware - Generates platform-specific commands (macOS, Linux, Windows)
- ๐ Secure Config - API keys stored safely in
~/.cmdexy/
๐ Installation
Prerequisites
- Python 3.10+
- Cohere API Key (free tier available)
Install from source
# Clone the repository
git clone https://github.com/akhilesh2220/cmdexy.git
cd cmdexy
# Create virtual environment
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -e .
# Configure your API key
cmdexy config
๐ Usage
Configure API Key (First Time)
cmdexy config
Interactive Mode
Start an AI-powered shell session:
cmdexy int
Example session:
cmdexy > create a python file that prints hello world
Intent detected: SYSTEM_COMMAND
Generated Command: cat <<EOF > hello.py
print("Hello, World!")
EOF
Execute on HOST? (y/n): y
Run Single Instructions
cmdexy run "list all files in current directory"
cmdexy run "create a flask app with one endpoint"
Shell Wrapper (Error Recovery)
Run any command with AI-powered error monitoring:
cmdexy shell python3 script.py
cmdexy shell ansible-playbook deploy.yml
cmdexy shell npm run build
If the command fails, cmdexy will:
- Analyze the error using AI
- Suggest a fix (code patch or install command)
- Apply the fix automatically (with your permission)
- Retry the command
Check Version
cmdexy --version
๐ฏ Commands
| Command | Description |
|---|---|
cmdexy config |
Configure API key and settings |
cmdexy int |
Start interactive AI session |
cmdexy run "<instruction>" |
Execute a single AI-powered instruction |
cmdexy shell <command> |
Run command with error recovery |
cmdexy --version |
Show version |
cmdexy --help |
Show help |
๐ Error Recovery Flow
โโโโโโโโโโโโโโโโโโโ
โ Run Command โ
โโโโโโโโโโฌโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโ Success
โ Execute โโโโโโโโโโโโโโบ Done
โโโโโโโฌโโโโโโ
โ Failure
โผ
โโโโโโโโโโโโโโโโโโโ
โ Analyze Error? โโโโโ No โโโโบ Exit
โโโโโโโโโโฌโโโโโโโโโ
โ Yes
โผ
โโโโโโโโโโโโโโโโโโโ
โ AI Analysis โ
โโโโโโโโโโฌโโโโโโโโโ
โ
โโโโโโดโโโโโ
โผ โผ
โโโโโโโโโ โโโโโโโโโ
โ Code โ โ Cmd โ
โ Fix โ โ Fix โ
โโโโโฌโโโโ โโโโโฌโโโโ
โ โ
โผ โผ
โโโโโโโโโโโโโโโโโโโ
โ Apply & Retry โ
โโโโโโโโโโโโโโโโโโโ
๐ Project Structure
cmdexy/
โโโ cmdexy/
โ โโโ main.py # CLI entry point
โ โโโ cli/
โ โ โโโ interactive.py # Interactive mode
โ โ โโโ run.py # Single instruction mode
โ โ โโโ wrapper.py # Shell wrapper
โ โโโ core/
โ โโโ ai_engine.py # Cohere AI integration
โ โโโ config.py # Configuration manager
โ โโโ controller.py # Main orchestration logic
โ โโโ execution.py # Command execution
โโโ pyproject.toml
โโโ README.md
โ๏ธ Configuration
Config is stored in ~/.cmdexy/config.json:
{
"api_key": "your-cohere-api-key"
}
You can also use environment variable:
export COHERE_API_KEY="your-key"
๐ค Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
๐ License
MIT License - see LICENSE for details.
๐ Acknowledgments
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cmdexy-1.0.0.tar.gz.
File metadata
- Download URL: cmdexy-1.0.0.tar.gz
- Upload date:
- Size: 11.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ede4521662cbc973808930055b73919d5b954e9fda163722314c21a595fde8e
|
|
| MD5 |
52fd29c678610b08b810dbc7b1f26961
|
|
| BLAKE2b-256 |
7c781db7457ba0fc913d828f9f53edef2e7bd3042a4cf3105f511b481fa1159d
|
File details
Details for the file cmdexy-1.0.0-py3-none-any.whl.
File metadata
- Download URL: cmdexy-1.0.0-py3-none-any.whl
- Upload date:
- Size: 13.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b2bb85f50f76ad20f6e8340f2660b3b1c684da8ca9015deab1f6f1f51bb9293
|
|
| MD5 |
d587d05640d3e9238653bf0c1f888817
|
|
| BLAKE2b-256 |
a5f417a25380284e41fbc20f8fb1f3dbea492d8e8139691610e8e323e5fd29ca
|