e31e58c9c4
- Load OPENAI_API_KEY and OPENAI_BASE_URL from gitignored .env (repo-root, CWD-independent) - Fix command explanation to use the configured model instead of hardcoded gpt-4o-mini - Update default model and fallbacks to gpt-5.6-luna - Document .env-based configuration in READMEs
Edison
Edison is an AI-powered command-line tool that translates natural language queries into shell commands. It leverages OpenAI's GPT models to generate accurate and useful commands based on your descriptions.
Features
- Translate natural language to shell commands
- Support for multiple shells (bash, zsh, powershell)
- Safety checks for potentially dangerous commands
- Command modification and clipboard support
- Configurable via YAML file
- Rich terminal UI with syntax highlighting
- Interactive shell mode with command history
- Command explanations
- Progress indicators and spinners
Installation
# Clone the repository
git clone https://github.com/yourusername/edison.git
cd edison
# Install the package
pip install -e .
Usage
# Basic usage
edison how to list all files in the current directory
# Enable safety mode (confirmation before execution)
edison -s how to find all python files recursively
# Print current configuration
edison -c
# Enable verbose logging
edison -v how to check disk space
# Use rich terminal UI
edison -r how to find large files
# Get command explanations
edison -e how to compress a directory
# Start interactive shell mode
edison -i
Interactive Shell
Edison includes an interactive shell mode that provides a more user-friendly experience:
# Start interactive shell
edison -i
In interactive mode, you can:
- Type natural language queries
- Navigate command history with up/down arrows
- Get auto-suggestions based on previous commands
- Execute, modify, copy, or get explanations for commands
- Use special commands like
!helpand!exit
Rich Terminal UI
The rich terminal UI provides:
- Syntax highlighting for commands
- Colorful output
- Progress indicators during API calls
- Command explanations with detailed breakdowns
- Success/error messages with appropriate styling
Configuration
Edison can be configured via the edison.yaml file. Here's an example configuration:
model: gpt-5.6-luna
temperature: 0
max_tokens: 500
safety: true
API Key
Edison requires an API key to function. The recommended way is a .env file in the repository root (gitignored, so not checked in):
OPENAI_API_KEY="your-api-key"
OPENAI_BASE_URL="https://api.openai.com/v1"
You can also provide it in one of the following ways:
- Environment variable:
OPENAI_API_KEY="your-api-key" .envfile in the repository root.openai.apikeyfile in your home directory- In the
edison.yamlconfiguration file:openai_api_key: "your-api-key"
When using a custom backend or proxy, set OPENAI_BASE_URL (or base_url in edison.yaml) to its endpoint.
License
MIT