101 lines
2.4 KiB
Markdown
101 lines
2.4 KiB
Markdown
# 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
|
|
|
|
```bash
|
|
# Clone the repository
|
|
git clone https://github.com/yourusername/edison.git
|
|
cd edison
|
|
|
|
# Install the package
|
|
pip install -e .
|
|
```
|
|
|
|
## Usage
|
|
|
|
```bash
|
|
# 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:
|
|
|
|
```bash
|
|
# 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 `!help` and `!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:
|
|
|
|
```yaml
|
|
model: gpt-3.5-turbo
|
|
temperature: 0
|
|
max_tokens: 500
|
|
safety: true
|
|
```
|
|
|
|
## API Key
|
|
|
|
Edison requires an OpenAI API key to function. You can provide it in one of the following ways:
|
|
|
|
1. Environment variable: `OPENAI_API_KEY="your-api-key"`
|
|
2. `.env` file in the same directory as the script
|
|
3. `.openai.apikey` file in your home directory
|
|
4. In the `edison.yaml` configuration file: `openai_api_key: "your-api-key"`
|
|
|
|
## License
|
|
|
|
MIT
|