A modern, AI-powered terminal interface built with React and Python Flask. This terminal allows you to execute commands using natural language through Google's Gemini AI.
- 🤖 AI-Powered Commands: Convert natural language to shell commands
- 🧠 Contextual Understanding: AI remembers context from previous commands
- 🖥️ Multi-Tab Support: Multiple terminal sessions with persistent state
- ⌨️ Auto-Complete: Tab completion for commands and file paths
- 🎨 Modern UI: Beautiful terminal interface with custom themes
- 🔍 Smart File Operations: Find, count, and manipulate files using natural language
- 📊 System Monitoring: Easy CPU, memory, and process monitoring
- 🌐 Cross-Platform: Works on Windows, macOS, and Linux
- 🔒 Security: Command validation and whitelist protection
- 📱 Responsive: Works on desktop and mobile devices
- 🔄 Session Tracking: Maintains context across commands
- 🔴 Status Indicator: Real-time backend connection status with AI availability
- 🔄 Real-time Output: Streaming command output via WebSockets
- 🛑 Command Cancellation: Cancel long-running commands with Ctrl+C
- Node.js (v18 or higher)
- Python 3.9 or higher
- Google AI API key (for Gemini 1.5 Flash)
- Clone the repository:
git clone https://github.com/krishnasharma4415/AI-Terminal.git
cd AI-Terminal- Run the setup script:
# On macOS/Linux:
./setup.sh
# On Windows:
# Right-click setup.sh and open with Git Bash- Start the backend server:
# Activate the virtual environment
source venv/bin/activate # On Windows: venv\Scripts\activate
# Start the server
python app.py # Runs on http://localhost:5000- Start the frontend development server:
cd ai-terminal
npm run dev # Runs on http://localhost:5173- Clone the repository:
git clone https://github.com/krishnasharma4415/AI-Terminal.git
cd AI-Terminal- Set up the backend:
# Create and activate virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Create .env file with your Google AI API key
cp env.example .env
# Edit .env with your editor and add your API key- Start the backend server:
python app.py # Runs on http://localhost:5000- Set up the frontend:
cd ai-terminal
# Install dependencies
npm install
# Create development environment file
echo "VITE_API_URL=http://localhost:5000" > .env.development
# Start development server
npm run dev # Runs on http://localhost:5173- Open the terminal interface in your web browser (http://localhost:5173)
- Create a new tab or use the default tab
- Enter commands using natural language or traditional shell syntax
- Press Enter to execute commands
| Natural Language | Equivalent Shell Command |
|---|---|
| "Show all files" | ls -la |
| "What's my CPU usage" | cpu or system-specific command |
| "Find all Python files" | find . -name "*.py" |
| "How much disk space is left" | df -h |
| "Show running processes" | ps aux |
| "Count files in this folder" | `ls -1 |
The AI remembers context, allowing for follow-up commands:
find . -name "*.py"(lists Python files)count them(counts the files from previous command)
- Up/Down Arrow: Navigate command history
- Tab: Autocomplete commands and file paths
- Ctrl+C: Cancel current command
- Ctrl+L: Clear terminal
- Ctrl+R: Search command history
- Ctrl+Shift+P: Open command palette
To build the frontend for production:
cd ai-terminal
npm run buildThis creates a dist directory with optimized files ready for deployment.
For backend production deployment, see DEPLOYMENT.md.
git clone <your-repo-url>
cd AI-Terminal# Install Python dependencies
pip install -r requirements.txt
# Set up environment variables
cp env.example .env
# Edit .env and add your Google AI API keycd ai-terminal
npm installCreate a .env file in the root directory with the following variables:
# Required: Google AI API Key
GOOGLE_API_KEY=your_google_api_key_here
# Optional: Flask configuration
FLASK_ENV=development
FLASK_DEBUG=True- Visit Google AI Studio
- Create a new API key
- Add it to your
.envfile
python app.pyThe backend will run on http://127.0.0.1:5000
cd ai-terminal
npm run devThe frontend will run on http://localhost:5173
ls- List directory contentscd <path>- Change directorypwd- Print working directorymkdir <name>- Create directoryrm <file>- Remove filehelp- Show help information
Type natural language commands like:
- "Show me all Python files"
- "Find files larger than 100MB"
- "List running processes"
- "Check disk usage"
Ctrl+Shift+P- Open command palette↑/↓- Navigate command historyTab- Auto-complete commands/pathsEnter- Execute command
- Command Whitelist: Only allows safe, predefined commands
- Input Validation: Prevents malicious input
- Path Traversal Protection: Blocks dangerous path operations
- Command Length Limits: Prevents buffer overflow attacks
AI-Terminal/
├── app.py # Python Flask backend
├── requirements.txt # Python dependencies
├── env.example # Environment variables template
├── README.md # This file
└── ai-terminal/ # React frontend
├── src/
│ ├── PyTerminal.jsx # Main terminal component
│ ├── main.jsx # React entry point
│ └── index.css # Styles
├── package.json # Node dependencies
└── vite.config.js # Vite configuration
npm run dev- Start development servernpm run build- Build for productionnpm run preview- Preview production buildnpm run lint- Run ESLint
-
"AI features are not configured"
- Make sure you've set the
GOOGLE_API_KEYin your.envfile - Verify the API key is valid
- Make sure you've set the
-
"Connection Error: Is the Python server running?"
- Ensure the Python backend is running on port 5000
- Check that no firewall is blocking the connection
-
Command not found
- The command might not be in the allowed whitelist
- Try using a different phrasing for AI commands
This project is configured for easy deployment:
For detailed deployment instructions, see DEPLOYMENT.md.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License.
- Google Gemini AI for natural language processing
- React and Vite for the frontend framework
- Flask for the Python backend
- Tailwind CSS for styling