Terra Command AI - A natural language shell command tool with AI
Project description
Terra Commands AI (tai)
A powerful natural language shell command tool that uses AI to convert human instructions into appropriate shell commands for your operating system.
Features
- AI-Powered Command Generation: Uses OpenAI's GPT models to generate OS-specific commands
- Interactive Setup: Easy setup process for OpenAI API key with fallback support
- Automatic OS Detection: Adapts commands for Linux, macOS, Windows, and various distributions
- Natural Language Processing: Execute commands using plain English instructions
- Safe Execution: Commands require confirmation before execution
- Dry Run Mode: Test commands without actually executing them
- Robust Fallback Mode: Works seamlessly without AI using predefined command patterns
- Cross-platform: Native support for Linux, macOS, and Windows
Installation
Prerequisites
- Python 3.7+
- OpenAI API key (for AI functionality)
From Source
- Clone the repository:
git clone https://github.com/terra-agi/terra-commands.git
cd terra-commands
- Install using pip:
pip install .
Or for development:
pip install -e .
Configuration
Easy Setup: Terra Command AI provides a simple interactive setup process:
-
Setup AI Features:
tai --setup-aiFollow the prompts to enter your OpenAI API key securely.
-
Configuration Storage: Your API key and settings are stored securely in:
- macOS/Linux:
~/.config/terra-ai/config - Windows:
%USERPROFILE%\\.config\\terra-ai\\config
- macOS/Linux:
Fallback Mode: If you choose not to set up AI or if the OpenAI package is not available, Terra Command AI will automatically fall back to using predefined command patterns. All basic functionality will still work without any additional configuration!
Direct Installation
pip install git+https://github.com/terra-agi/terra-commands.git
Usage
Basic Usage
tai <instruction>
Examples(Without AI)
# List files in current directory
tai list files
tai show directory
tai what files are here
# Navigate directories
tai go home
tai go back
tai go up
# System information
tai who am i
tai system info
tai disk usage
# Git operations
tai git status
tai git log
tai current branch
# Network operations
tai ping google
tai internet connection
Advanced Options
# Dry run mode (shows command without executing)
tai --dry-run list files
# Force execution without confirmation
tai --force system info
# List all available commands and AI status
tai --list
# Show system and AI configuration status
tai --status
# Set up OpenAI API key for AI features
tai --setup-ai
AI-Powered Examples
With AI enabled, you can use much more natural and complex instructions:
tai "find all python files in the current directory and count them"
tai "show me the last 10 lines of system logs"
tai "check if port 80 is open on localhost"
tai "display my public IP address"
tai "find files larger than 100MB in my home directory"
tai "show the current git branch and status"
tai "list all running docker containers"
tai "check disk usage and show only the largest directories"
Available Commands(Without AI)
File Operations
list files,show directory,list directorywhat files are here,see files
Directory Navigation
go home,go to homego back,go up,go to parent
System Information
who am i,current usersystem info,what systemdisk usage,disk spacememory usage,memory info
Process Management
process list,running processescpu info
Git Operations
git status,git log,git branchcurrent branch,git diff
Network Operations
ping google,network statusinternet connection
Safety Features
- Confirmation Required: All commands require user confirmation before execution
- Dry Run Mode: Use
--dry-runto see what command would be executed - Force Mode: Use
--forceto skip confirmation (use with caution)
Development
Adding New Commands
Edit the CommandInterpreter class in terra_cmd.py to add new command patterns:
self.command_patterns = {
'new command': 'shell_command',
# Add more patterns here
}
Testing
# Test without installation
python terra_cmd.py --dry-run list files
# Run tests
python -m pytest tests/ # (if you add tests)
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
License
MIT License - see LICENSE file for details
Future Enhancements
- Integration with more AI language models for better command interpretation
- Support for complex multi-step commands
- Command history and favorites
- Custom command aliases
- Integration with shell completion
- Support for Windows commands
- Plugin system for extending functionality
Changelog
v0.1.0
- Initial release with basic natural language command interpretation
- Support for common file, directory, system, and git operations
- Safe execution with confirmation prompts
- Dry run mode for testing
- Installable via pip
Developed by TerraAGI Team with <3
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 terra_tai-0.1.0.tar.gz.
File metadata
- Download URL: terra_tai-0.1.0.tar.gz
- Upload date:
- Size: 23.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
34cb3bc4e5a790d6d54a1aef89a3e9bd17d90e31e067cdfb53de154005fe0f14
|
|
| MD5 |
18ce956e9099160ee583e9d0ed14fafb
|
|
| BLAKE2b-256 |
09d960d6746c17f1bdfe843116bd5b770ec783c4bba7536c4cc1f1fe4e3a4d2e
|
File details
Details for the file terra_tai-0.1.0-py3-none-any.whl.
File metadata
- Download URL: terra_tai-0.1.0-py3-none-any.whl
- Upload date:
- Size: 24.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
71a1e570d72edc91e1acd781159e7a9fbe6978f6a9914b2814e48c012b79b5af
|
|
| MD5 |
8a43a97ee68340b4e5d95c931e9dbcbc
|
|
| BLAKE2b-256 |
b2cf18d7b77c82e8131ff7af6bf1254b09e233acf06ab010ec205dd34787ea9e
|