Skip to content

Dynamo2k1/CortexCLI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

26 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

CortexCLI - AI-Powered Linux Shell πŸš€

License: MIT GitHub Stars

A modern, production-ready Linux shell with integrated AI capabilities supporting multiple AI backends (OpenAI, Google Gemini, Anthropic Claude, DeepSeek, Ollama), automatic natural language detection, multilingual input (English, Urdu, Arabic, Hindi, and more), and comprehensive safety features.

Demo GIF

Features ✨

Core Features

  • πŸ€– Multi-Backend AI Support - OpenAI, Google Gemini, Anthropic Claude, DeepSeek, and local Ollama
  • 🧠 Automatic Language Detection - Routes natural language to AI, commands to shell
  • 🌐 Multilingual Support - Urdu, Arabic, Hindi, Spanish, French, Chinese, and more
  • πŸ”— Full Shell Features - Pipes (|), redirection (>), command chaining (;)
  • πŸ“œ Command History - history, !!, !<num>
  • 🏠 Path Expansion - Tilde (~) and variable expansion

Safety & Security

  • πŸ›‘οΈ Risk Analysis - Automatic risk evaluation before command execution
  • ⚠️ Safety Confirmation - User confirmation for risky commands
  • 🚫 Blocked Patterns - Prevents catastrophic commands (rm -rf /, fork bombs)
  • πŸ“¦ Sandbox Mode - Preview commands without execution
  • πŸ“ Audit Logging - Complete history of AI interactions

Shell Integration

  • Zsh Plugin - Native zsh integration with keybindings
  • Bash Plugin - Bash integration with command_not_found handler
  • Fish Plugin - Fish shell integration with completions
  • PowerShell Module - Windows PowerShell support

Installation βš™οΈ

Dependencies

# Ubuntu/Debian
sudo apt install build-essential libcurl4-openssl-dev libjansson-dev libreadline-dev

# Fedora
sudo dnf install gcc libcurl-devel jansson-devel readline-devel

# macOS
brew install curl jansson readline

Compilation

git clone https://github.com/Dynamo2k1/CortexCLI.git
cd CortexCLI
make

Shell Integration (Optional)

# Zsh
echo 'source /path/to/CortexCLI/shell_integrations/cortexcli.zsh' >> ~/.zshrc

# Bash  
echo 'source /path/to/CortexCLI/shell_integrations/cortexcli.bash' >> ~/.bashrc

# Fish
echo 'source /path/to/CortexCLI/shell_integrations/cortexcli.fish' >> ~/.config/fish/config.fish

# PowerShell
Add-Content $PROFILE '. /path/to/CortexCLI/shell_integrations/cortexcli.ps1'

Configuration πŸ”§

AI Backend API Keys

Set one or more of the following environment variables:

# Google Gemini (Default)
export GEMINI_API_KEY="your-gemini-key"

# OpenAI
export OPENAI_API_KEY="your-openai-key"

# Anthropic Claude
export ANTHROPIC_API_KEY="your-anthropic-key"

# DeepSeek
export DEEPSEEK_API_KEY="your-deepseek-key"

# Ollama (Local LLMs)
export OLLAMA_HOST="http://localhost:11434"

Optional Settings

# Enable sandbox mode by default
export CORTEX_SANDBOX=1

# Set preferred language
export CORTEX_LANG=urdu

# Custom audit log path
export CORTEX_AUDIT_LOG=/var/log/cortexcli.log

# Disable audit logging
export CORTEX_AUDIT_DISABLED=1

# Set risk threshold (low/medium/high/critical)
export CORTEX_RISK_THRESHOLD=high

Usage πŸ–₯️

Starting CortexCLI

./dynamo

Natural Language Queries

# Explicit AI prefix
➀ 'create a Python script to parse JSON files

# Alternative prefix
➀ ai:show files larger than 10MB

# Auto-detected natural language
➀ how do I find all log files?

# Multilingual (Urdu)
➀ اردو Ω…ΫŒΪΊ Python Ψ§Ψ³Ϊ©Ψ±ΩΎΩΉ Ψ¨Ω†Ψ§Ψ€ جو CSV فائل ریڈ Ϊ©Ψ±Ϋ’

# Multilingual (Hindi)
➀ ΰ€ΰ€• Python ΰ€Έΰ₯ΰ€•ΰ₯ΰ€°ΰ€Ώΰ€ͺΰ₯ΰ€Ÿ ΰ€¬ΰ€¨ΰ€Ύΰ€“ ΰ€œΰ₯‹ JSON ΰ€ͺΰ€’ΰ€Όΰ₯‡

Managing AI Backends

# List available backends
➀ ai backend

# Switch backend
➀ ai use openai
➀ ai use claude
➀ ai use ollama

# Change model
➀ ai model gpt-4
➀ ai model claude-3-sonnet-20240229

Safety Features

# Enable sandbox mode (preview only)
➀ sandbox on

# Disable sandbox mode
➀ sandbox off

# View audit log
➀ audit

# Clear audit log
➀ audit clear

Regular Shell Commands

# Standard commands work as expected
➀ ls -la | grep ".txt"
➀ cat file.txt > output.txt
➀ cd ~/Documents

Interactive Examples πŸ’‘

Project Scaffolding

➀ 'create a new React project with Tailwind CSS and TypeScript
πŸ€– Detected: English (confidence: 87%)
COMMAND: npx create-react-app my-app --template typescript
COMMAND: cd my-app && npm install -D tailwindcss postcss autoprefixer
COMMAND: npx tailwindcss init -p
EXPLAIN: Created React project with TypeScript template and installed Tailwind CSS...

Multilingual Support

➀ اردو Ω…ΫŒΪΊ ایک Python Ψ§Ψ³Ϊ©Ψ±ΩΎΩΉ Ψ¨Ω†Ψ§Ψ€ جو CSV فائل ریڈ Ϊ©Ψ±Ϋ’ اور JSON Ω…ΫŒΪΊ ΨͺΨ¨Ψ―ΫŒΩ„ Ϊ©Ψ±Ϋ’
πŸ€– Detected: Urdu (confidence: 95%)
COMMAND: cat > csv_to_json.py << 'EOF'
import csv
import json
...
EOF
EXPLAIN: یہ Ψ§Ψ³Ϊ©Ψ±ΩΎΩΉ CSV فائل کو JSON Ω…ΫŒΪΊ ΨͺΨ¨Ψ―ΫŒΩ„ Ϊ©Ψ±ΨͺΨ§ ہے...

Git Error Recovery

➀ 'fix the last git error and commit with a proper message
πŸ€– Processing natural language query...
COMMAND: git status
COMMAND: git add -A
COMMAND: git commit -m "fix: resolve merge conflicts and update dependencies"
EXPLAIN: Fixed the staging issue and created a descriptive commit message...

Architecture πŸ—οΈ

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                        CortexCLI                            β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  Input Parser β†’ Language Detector β†’ AI Router β†’ Executor    β”‚
β”‚       ↓              ↓                 ↓           ↓        β”‚
β”‚  [Classify]    [Detect Lang]    [Multi-Backend]  [Safe Exec]β”‚
β”‚       ↓              ↓                 ↓           ↓        β”‚
β”‚  Command/NL    EN/UR/AR/HI     Gemini/OpenAI   Risk Check   β”‚
β”‚                                Claude/DeepSeek  Confirm     β”‚
β”‚                                Ollama           Sandbox     β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                      Audit Logger                           β”‚
β”‚              (All AI interactions logged)                   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Demo πŸŽ₯

AI_SHELL.mp4

Contributing 🀝

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License πŸ“„

MIT License - See LICENSE for details

Acknowledgments 🌟

  • Google Gemini API
  • OpenAI API
  • Anthropic Claude API
  • DeepSeek API
  • Ollama Project
  • Readline Library
  • Jansson JSON Parser

Crafted with ❀️ by:

"Where Human Intuition Meets Machine Intelligence"

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors