Skip to content

menguzat/terminai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

28 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ€– Terminai

An AI-enhanced shell wrapper that bridges natural language and command line

Terminai transforms your terminal experience by adding AI-powered command translation on top of your existing shell. Write commands naturally or use plain English - terminai understands both.

🎬 Demo

Terminai Demo

✨ Features

  • πŸ”„ Seamless Shell Integration - Works as a wrapper around your existing shell (zsh/bash)
  • πŸ€– AI Command Translation - Failed commands automatically get translated from natural language
  • πŸ›‘οΈ Safety First - Always asks for confirmation before executing AI-generated commands
  • ⚑ Smart Tab Completion - Complete file paths and commands just like your native shell
  • πŸ” Secure API Management - Safely stores your Gemini API key with proper permissions
  • 🎯 Enhanced Prompt - Clear [AI] indicator shows when AI features are active

πŸš€ Quick Start

Prerequisites

Node.js (version 16.0 or higher) must be installed on your system.

  • Install via package manager (e.g., brew install node on macOS, apt-get install nodejs npm on Ubuntu)
  • Download from nodejs.org

Installation

npm install -g @menguzat/termin-ai

Setup

  1. Get a Gemini API Key from Google AI Studio

  2. Launch Terminai

    terminai
    
  3. Enter your API key when prompted (saved securely to ~/.terminai/config.json)

That's it! You're ready to use AI-enhanced commands.

πŸ’‘ Usage Examples

Regular Commands Work Normally

[AI] user@hostname project % ls -la
[AI] user@hostname project % cd src/
[AI] user@hostname src % pwd

AI-Powered Command Translation

When a command fails, terminai automatically asks AI for help:

Simple Example:

[AI] user@hostname project % what's my wifi ip address
πŸ€– Command failed. Attempting AI translation...
πŸ”„ Asking AI to translate the command...
πŸ’‘ AI suggests: ifconfig en0 | grep inet | grep -v inet6 | awk '{print $2}'
❓ Execute this command? (y/N): y
βœ… Executing AI-suggested command...
192.168.1.34

Complex Media Processing:

[AI] user@hostname project % use ffmpeg to replace the audio of video filename.mp4 with audio from audio.wav
πŸ€– Command failed. Attempting AI translation...
πŸ’‘ AI suggests: ffmpeg -i filename.mp4 -i audio.wav -c:v copy -c:a aac -map 0:v:0 -map 1:a:0 -y output.mp4
❓ Execute this command? (y/N): y

Advanced File Operations:

[AI] user@hostname project % find all javascript files modified in the last 3 days and copy them to a backup folder
πŸ’‘ AI suggests: find . -name "*.js" -mtime -3 -type f -exec cp {} backup/ \;
❓ Execute this command? (y/N): y

System Administration:

[AI] user@hostname project % show me all processes using more than 100MB of memory sorted by usage
πŸ’‘ AI suggests: ps aux | awk '$6 > 100000 {print $0}' | sort -k6 -nr
❓ Execute this command? (y/N): y

Network Troubleshooting:

[AI] user@hostname project % check which process is using port 3000 and kill it
πŸ’‘ AI suggests: lsof -ti:3000 | xargs kill -9
πŸ“ Explanation: Find process ID using port 3000 and forcefully terminate it
❓ Execute this command? (y/N): y

Smart Tab Completion

[AI] user@hostname project % cp tsconfig<TAB>
tsconfig.json

[AI] user@hostname project % cd src/<TAB>
shell.ts  ai-service.ts  config.ts  cli.ts

[AI] user@hostname project % npm run <TAB>
build  start  test

Your support helps keep terminai free and continuously improving! πŸš€

πŸ”§ How It Works

  1. Command Execution: Terminai first tries to execute your input as a regular shell command
  2. AI Translation: If the command fails (non-zero exit code), it sends your input to Google's Gemini AI
  3. Smart Suggestions: The AI interprets your natural language and suggests appropriate shell commands
  4. User Confirmation: You review and approve the suggestion before execution
  5. Safe Execution: The suggested command runs with full output, just like typing it yourself

🧠 Context-Aware Intelligence

Terminai automatically detects your development environment and provides smarter suggestions:

  • Virtual Environments: Detects Python venv/conda/poetry environments and suggests appropriate activation commands
  • Package Managers: Identifies npm/yarn/pnpm and uses the correct package manager for your project
  • Project Types: Recognizes Node.js, Python, Git repos, Docker, and other development environments
  • File Context: References actual files in your directory for more relevant suggestions

Examples:

# In a Python project with inactive virtual environment
[AI] user@hostname myproject % install pandas
πŸ’‘ AI suggests: source venv/bin/activate && pip install pandas

# In a Node.js project with yarn
[AI] user@hostname webapp % add lodash as dependency  
πŸ’‘ AI suggests: yarn add lodash

πŸ›‘οΈ Security & Privacy

  • API Key Storage: Your Gemini API key is stored locally in ~/.terminai/config.json with user-only permissions (600)
  • No Command Logging: Your commands and AI interactions are not stored or transmitted anywhere except to Google's Gemini API
  • User Confirmation: AI suggestions always require explicit approval before execution
  • Sandboxed Execution: Commands run in your current directory with your user permissions

🎯 Perfect For

  • Complex Media Processing: FFmpeg operations, image manipulation, video conversion
  • System Administration: Log analysis, process management, disk cleanup
  • Development Workflows: Git operations, build automation, dependency management
  • Data Processing: CSV manipulation, JSON parsing, text processing with awk/sed
  • Network Operations: Port scanning, connectivity testing, firewall configuration
  • File Management: Batch operations, recursive searches, permission changes

πŸ”§ Configuration

Config File Location

~/.terminai/config.json

Reset Configuration

rm ~/.terminai/config.json && terminai

🎨 Examples Gallery

# Media & Content Processing
"convert all png images to webp format with 80% quality"
β†’ for file in *.png; do cwebp -q 80 "$file" -o "${file%.png}.webp"; done

"extract audio from video.mp4 as high quality mp3"
β†’ ffmpeg -i video.mp4 -vn -acodec libmp3lame -q:a 0 audio.mp3

"resize all images in current directory to 800px width maintaining aspect ratio"
β†’ for img in *.jpg *.png; do convert "$img" -resize 800x "${img%.*}_resized.${img##*.}"; done

# Advanced File Operations
"find duplicate files by content and show their paths"
β†’ find . -type f -exec md5sum {} \; | sort | uniq -d -w32

"compress all log files older than 30 days"
β†’ find /var/log -name "*.log" -mtime +30 -exec gzip {} \;

"show directory sizes sorted from largest to smallest"
β†’ du -sh */ | sort -hr

# Development & Git Operations  
"show git commits from last week with file changes"
β†’ git log --since="1 week ago" --stat --oneline

"find all TODO comments in typescript files"
β†’ grep -r "TODO" --include="*.ts" --include="*.tsx" . -n

"run prettier on all modified files in git"
β†’ git diff --name-only --cached | grep -E '\.(ts|js|tsx|jsx)$' | xargs prettier --write

# System Monitoring & Administration
"show top 10 largest files in home directory"
β†’ find ~ -type f -exec ls -la {} \; | sort -k5 -nr | head -10

"monitor network connections every 2 seconds"
β†’ watch -n 2 'netstat -tuln | grep LISTEN'

"check ssl certificate expiration for domain.com"
β†’ echo | openssl s_client -servername domain.com -connect domain.com:443 2>/dev/null | openssl x509 -noout -dates

# Data Processing & Analysis
"convert csv to json preserving headers"
β†’ python3 -c "import csv, json, sys; print(json.dumps([dict(r) for r in csv.DictReader(sys.stdin)]))" < data.csv

"extract all email addresses from text files"
β†’ grep -hoE '[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}' *.txt | sort -u

"count unique IP addresses in apache log"
β†’ awk '{print $1}' access.log | sort | uniq -c | sort -nr

πŸš€ Advanced Usage

Chaining Commands

[AI] user@hostname project % build and test the project
πŸ’‘ AI suggests: npm run build && npm test

Directory Navigation

[AI] user@hostname project % go to parent directory and list files
πŸ’‘ AI suggests: cd .. && ls -la

File Search

[AI] user@hostname project % find large files bigger than 100MB
πŸ’‘ AI suggests: find . -size +100M -type f -exec ls -lh {} \;

πŸ› οΈ Technical Details

  • Built with: TypeScript + Node.js
  • AI Model: Google Gemini 2.5 Flash Preview
  • Shell Integration: Spawns zsh/bash processes for command execution
  • Completion System: Custom tab completion with file and command support
  • Cross-Platform: See Platform Compatibility section below

πŸ–₯️ Platform Compatibility

βœ… Fully Tested & Supported

  • macOS - Extensively tested and working perfectly with zsh/bash

⚑ Should Work (Not Yet Fully Tested)

  • Linux - Should work out-of-the-box on most distributions with bash/zsh
  • Windows - Should work but may have minor compatibility issues
    • May require manual shell configuration in some cases
    • Cross-platform improvements planned (see our GitHub issues)

πŸ”„ Testing Status

We're actively working on comprehensive cross-platform testing. If you encounter issues on Linux or Windows, please report them - we'd love your feedback to improve compatibility!

πŸ“ Development

# Clone the repository
git clone <repo-url>
cd terminai

# Install dependencies
npm install

# Build
npm run build

# Test locally
npm link
terminai

🀝 Contributing

Contributions welcome! Please feel free to submit a Pull Request.

πŸš€ Upcoming Features

We're constantly working to improve terminai! Here's what's coming next:

  • πŸ”„ Regenerate Command - Didn't like the AI suggestion? Get alternative command options with a simple regenerate
  • πŸ›‘οΈ Enhanced Error Handling - Better recovery and suggestions when commands fail or produce errors
  • πŸ’¬ Multi-turn AI Context - AI remembers your conversation for more intelligent follow-up commands and suggestions

Stay tuned for more exciting features! 🎯

πŸ“„ License

MIT License - see LICENSE file for details.


πŸ’– Support the Project

If terminai has made your command line experience better, consider supporting its development:

Cryptocurrency Address QR Code
Bitcoin (BTC) bc1qy6nwnlzfxxr45kav5qnm72fr4s8607e02ace6f BTC QR
Ethereum (ETH) 0x1a6ba4d715553abdadac32817bee35ca1ec3c04a ETH QR
Solana (SOL) 5PMFQwZJAZg8oVFBKwCmuK8r2vv5F2cRcbGJBGuZNUFF SOL QR
Binance Coin (BNB) 0x1a6ba4d715553abdadac32817bee35ca1ec3c04a BNB QR

Happy commanding! πŸš€

Transform your terminal experience with the power of AI

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors