Skip to content

Blushyes/ask-ai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🤖 Ask AI

AI-powered Shell Command Generator

Rust License Version

English | 中文

✨ Features

  • 🧠 AI-powered intelligent command generation
  • 🛡️ Built-in dangerous command detection
  • 🎨 Beautiful command-line interface
  • 🔍 Debug mode support
  • 📝 Detailed command execution results
  • 🚀 Dry-run mode support

📦 Installation

Ensure you have the Rust toolchain installed, then run:

cargo install --path .

🔧 Configuration

On first run, the program will guide you through the configuration process. The configuration file will be saved in .askai/config.toml in your home directory.

You can also manually set the configuration via command line:

# Set API base URL
ask set config base_url=https://api.openai.com/v1

# Set API key
ask set config api_key=your_api_key

# Set model name
ask set config model=gpt-3.5-turbo

# Set interface language (en/zh)
ask set config language=en

The configuration file format is as follows:

[api]
base_url = "Your OpenAI API URL"
api_key = "Your OpenAI API Key"
model = "Model name you want to use (e.g., gpt-3.5-turbo)"

language = "Interface language (en/zh)"

🚀 Usage

# Basic usage
ask "list all files in current directory"

# Show command without execution (dry-run mode)
ask --dry-run "check system memory usage"

# Show debug information
ask -D "list all running processes"

# Hide detailed output
ask -v false "ping baidu.com"

📚 Command Line Arguments

Parameter Description Default
<PROMPT> Description of what you want to do Required
-d, --dry-run Show command without execution false
-v, --verbose Show detailed output true
-D, --debug Show debug information false

🛡️ Security Features

To protect system security, the program automatically detects and refuses to execute dangerous commands such as:

  • rm -rf
  • mkfs
  • dd
  • > /dev/
  • chmod -R
  • And other potentially dangerous operations

🤝 Contributing

Issues and Pull Requests are welcome!

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

About

AI-powered shell command generator.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages