English | δΈζζζ‘£
A powerful command-line assistant that converts natural language into executable commands using AI. Features multiple model management, intelligent switching, and comprehensive safety checks.
GitHub: https://github.com/zhump/ask2-ai-cli
- askx helper function for seamless shell history integration
- One-command installation with automatic shell detection
- Press Enter to execute with streamlined confirmation
- Color-coded command display for better readability
- Automatic cleanup and easy uninstallation
- Configure multiple AI models with different settings (temperature, API endpoints)
- Easy switching between models with simple commands
- Smart model management with visual status indicators
- Automatic upgrade from single-model to multi-model configurations
- Dangerous command detection with double confirmation
- Privilege escalation warnings and suggestions
- Interactive confirmation before command execution
- Command explanations for educational purposes
- Debug mode with detailed timing and prompt visibility
- Command history with execution tracking
- Cross-platform support (macOS, Linux, Windows, WSL)
- Smart environment detection (shells, package managers, project types)
npm install ask2-ai-cli -gask configThis shows your configuration file path. Edit the file to add your API configuration:
{
"models": [
{
"name": "moonshotai/kimi-k2:free",
"apiKey": "your-api-key-here",
"apiUrl": "https://openrouter.ai/api/v1/chat/completions",
"model": "moonshotai/kimi-k2:free",
"temperature": 0.3,
"enabled": true
},
{
"name": "glm-4.5",
"apiKey": "your-api-key-here",
"apiUrl": "https://open.bigmodel.cn/api/paas/v4/chat/completions",
"model": "glm-4.5",
"temperature": 0.3,
"enabled": false
}
]
}Recommend using openrouter's free model API and your internal model API to avoid information leakage and enhance security.
ask testFor the best experience with shell history support, install the askx helper function:
# Install askx function to your shell
ask install
# Reload your shell configuration
source ~/.zshrc # or ~/.bashrc for bash users
# Use askx for commands with history support
askx "list all files"
askx "kill process on port 3000"
askx "find large files over 100MB"askx Benefits:
- β Commands are added to your shell history
- β Use arrow keys to find previously executed commands
- β Streamlined confirmation: just press Enter to execute
- β Color-coded command display for better readability
Example askx workflow:
$ askx "delete files older than 30 days"
Execute this command? (Enter/n): find . -type f -mtime +30 -delete
[Press Enter]
β
Command executed successfully and added to historyUninstall askx:
ask uninstall # Remove askx function
source ~/.zshrc # Reload shell# Traditional interactive mode
ask list all files
ask find large files over 100MB
ask kill process on port 3000
# Model management
ask ls # List all models
ask use qwen3 # Switch models
ask config # View configuration
# Advanced options
ask --debug complex query # Debug mode
ask --explain rm -rf folder # Get explanations
ask --print "your query" # Print command only (used by askx)1. List Available Models
ask lsπ Available Models
ββββββββββββββββββββββββββββββββββββββββββββββββββ
β
GLM-4.5 Main
Model: glm-4.5 | Temperature: 0.3 | API: open.bigmodel.cn
βͺ Creative Mode
Model: glm-4.5 | Temperature: 0.8 | API: open.bigmodel.cn
ββββββββββββββββββββββββββββββββββββββββββββββββββ
π― Current: GLM-4.5 Main
2. Switch Models
ask use qwen3β
Successfully switched to model 'Creative Mode'
π Active model details:
ββββββββββββββββββββββββββββββ
Name: Creative Mode
Model: qwen3
Temperature: 0.3
When Ask generates a command, you can:
- Enter β Execute immediately
- N β Cancel and exit
- C β Generate different solution
- E β Get detailed explanation
$ ask check disk space
Suggested command:
df -h
β οΈ Please review the command carefully before execution!
Choose action:
Enter - Execute command
N - Exit
C - Change answer
E - Explain command
Please choose (Enter/N/C/E): [E]
π Command Explanation
ββββββββββββββββββββββββββββββββββββββββββββββββββ
Command: df -h
Explanation:
β’ df: Display filesystem disk space usage
β’ -h: Human-readable format (KB, MB, GB instead of bytes)
β’ Shows available space, used space, and mount points
β’ Safe read-only operation with no system changes| Command | Description | Example |
|---|---|---|
ask [query] |
Convert natural language to commands | ask install docker |
askx [query] |
Execute with shell history support | askx "list all files" |
ask install |
Install askx helper function | ask install |
ask uninstall |
Remove askx helper function | ask uninstall |
ask ls |
List all model configurations | ask ls |
ask use <name> |
Switch to specific model | ask use "Creative Mode" |
ask config |
Show configuration file path and content | ask config |
ask test |
Test AI connectivity | ask test --debug |
ask log |
View command history | ask log --limit 10 |
Global Options:
--debug, -dβ Enable debug mode with timing info--explain, -eβ Get command explanations--print, -pβ Print command only (used internally by askx)
Log Options:
--clearβ Clear command history--limit <n>β Show last N entries
$ ask "delete all files in current directory"
β οΈ DANGEROUS OPERATION DETECTED!
This command may cause irreversible damage to your system:
rm -rf *
Are you absolutely sure you want to execute this command?
Press Enter to confirm explicitly (anything else will cancel): [Cancel]
β
Operation cancelled for safety.$ ask "install nginx"
Suggested command:
apt install nginx
β οΈ This command may require elevated privileges.
Consider using: sudo apt install nginxOperating Systems: macOS, Linux, Windows, WSL
Package Managers: brew, apt, yum, dnf, pacman, winget, choco
Project Types: Node.js, Python, Java, Go, Rust, Git repositories
Shells: bash, zsh, fish, PowerShell, cmd
MIT
