AI-powered terminal command suggestions and assistance tool
Project description
Nage - AI Assisted Terminal Tool
Nage is a powerful Python-based AI assistant that helps you remember and discover terminal commands. Simply describe what you want to do, and Nage will suggest the right commands with explanations!
๐ฌ Demo
$ nage "find large files in current directory"
โญโโโโโ Command Suggestions: find large files in current directory โโโโโโฎ
โ Recommended commands to execute: โ
โ โ
โ 1. find . -type f -size +100M -exec ls -lh {} \; | sort -k5 -hr โ
โ โ
โ Explanation: Find files larger than 100MB and sort by size โ
โ โ
โ Execute these commands? (y/n/s for selective) โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
Features
- ๐ค AI-powered terminal command suggestions
- โ๏ธ Easy configuration management with preset API endpoints
- ๐จ Beautiful terminal output with rich formatting
- ๐ Secure API key storage
- ๐ Multi-language support with extensible architecture (English/Chinese)
- ๐ง Customizable AI models and providers
- ๐ฆ Simple installation with
uvpackage manager - ๐ Interactive command execution with confirmation
Installation
This project is managed by uv. To install and set up:
# Install dependencies
uv sync
# Install the package in development mode
uv pip install -e .
# Or install directly from the repository
pip install git+https://github.com/0x3st/nage.git
Quick Start
-
Install the package:
uv sync && uv pip install -e .
-
Configure API (choose one):
# Using DeepSeek (recommended) nage --set-api=deepseek nage --set-key="your-deepseek-api-key" # Using OpenAI nage --set-api=openai nage --set-key="your-openai-api-key"
-
Start using:
nage "how to find large files"
Configuration
Before using Nage, you need to configure your AI API endpoint and key:
1. Set API Endpoint
You can use a full URL or a preset alias:
# Using DeepSeek API (recommended)
nage --set-api="https://api.deepseek.com/chat/completions"
# Using DeepSeek v1 API (OpenAI compatible)
nage --set-api="https://api.deepseek.com/v1/chat/completions"
# Using OpenAI API
nage --set-api="https://api.openai.com/v1/chat/completions"
# Using preset aliases
nage --set-api=deepseek # Same as https://api.deepseek.com/chat/completions
nage --set-api=openai # Same as https://api.openai.com/v1/chat/completions
2. Set API Key
nage --set-key="your-api-key-here"
3. Set Language (Optional)
# Set to English (default)
nage --set-lang=en
# Set to Chinese
nage --set-lang=zh
# Language switching affects all UI text and AI prompts
4. Set AI Model (Optional)
# Set custom model
nage --set-model="gpt-4"
nage --set-model="deepseek-chat"
nage --set-model="claude-3-haiku-20240307"
5. View Configuration
nage --set
Your configuration is stored securely in ~/.nage/config.json.
Usage
Basic Commands
-
Configure API endpoint:
nage --set-api="api endpoint" # Or use preset aliases nage --set-api=deepseek
-
Configure API key:
nage --set-key="your-api-key"
-
Set language:
nage --set-lang=en # English (default) nage --set-lang=zh # Chinese
-
Set AI model:
nage --set-model="model-name"
-
Ask AI for help:
nage "your question or prompt"
-
Interactive command execution:
- Type
yto execute all suggested commands - Type
sfor selective execution (choose which commands to run) - Type
nto cancel execution
- Type
Examples
# Get help with finding large files
nage "how to find large files in current directory"
# Learn about git best practices
nage "git commit best practices"
# Compress files with tar
nage "how to compress a folder with tar"
# System monitoring
nage "show CPU and memory usage"
# Configuration examples
nage --set-lang=zh
nage --set-model=gpt-4
nage --set-api=openai
Additional Commands
-
Show help:
nage
-
Show version:
nage --version
Language Support
Nage features a flexible language management system:
Supported Languages
- English (en) - Default
- Chinese (zh) - ไธญๆๆฏๆ
Language Features
- Dynamic switching: Change language anytime with
--set-lang - Complete localization: All UI text, error messages, and prompts
- Extensible architecture: Easy to add new languages
Adding New Languages
Developers can easily add new languages by extending the language manager:
from nage.lang import lang
# Add French support
lang.add_language("fr", {
"help": "Aide",
"error": "Erreur",
"configuration_required": "Configuration requise",
# ... more translations
})
Development
To run the project in development mode:
# Install in development mode
uv pip install -e .
# Run the CLI
python -m nage
# Run with uv
uv run python -m nage
Project Structure
nage/
โโโ __init__.py
โโโ __main__.py # Entry point
โโโ main.py # CLI interface
โโโ config.py # Configuration management
โโโ ai_client.py # AI API client
โโโ lang.py # Language management system
Language Management Architecture
The project uses a centralized language management system (lang.py) that:
- Provides a clean API for text retrieval:
lang.get("key") - Supports dynamic language switching:
lang.set_language("zh") - Enables easy extension:
lang.add_language("code", translations) - Maintains type safety with proper annotations
API Compatibility
Nage supports multiple AI API providers:
Supported APIs:
- DeepSeek API:
https://api.deepseek.com/chat/completions - OpenAI API:
https://api.openai.com/v1/chat/completions - Moonshot API:
https://api.moonshot.cn/v1/chat/completions - Zhipu API:
https://open.bigmodel.cn/api/paas/v4/chat/completions
Preset Aliases:
nage --set-api=deepseek # DeepSeek API
nage --set-api=openai # OpenAI API
nage --set-api=moonshot # Moonshot API
nage --set-api=zhipu # Zhipu API
API Key Requirements:
- DeepSeek: Get your API key from DeepSeek Platform
- OpenAI: Get your API key from OpenAI Platform
- Other providers: Check their respective documentation
Common Issues:
- 404 Error: Make sure to use the complete endpoint URL (e.g.,
/chat/completions) - 401 Error: Check your API key configuration with
nage --set - Rate Limit: Some APIs have usage limits, try again later
- Language Issues: Switch language with
nage --set-lang=enornage --set-lang=zh
Contributing
We welcome contributions! Here's how you can help:
- Add new languages: Extend the language support by adding translations
- Improve AI prompts: Enhance the system prompts for better command suggestions
- Add new API providers: Support additional AI API endpoints
- Bug fixes and improvements: General code improvements and bug fixes
Adding a New Language
- Edit
nage/lang.py - Add your language to the
translationsdictionary - Update
get_supported_languages()method - Test with
nage --set-lang=your_language_code
Roadmap
- Support for more AI providers (Anthropic, Cohere, etc.)
- Plugin system for custom commands
- Command history and favorites
- Shell integration (bash/zsh completions)
- More language support (Spanish, French, Japanese, etc.)
- Configuration validation and migration tools
License
This project is open source and available under the MIT License.
Project details
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 nage-1.0.1.tar.gz.
File metadata
- Download URL: nage-1.0.1.tar.gz
- Upload date:
- Size: 43.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ffabb284f310d07e62b7431b5f3c889becb0030648b0c790735653b1a62fbc87
|
|
| MD5 |
6a90036d25b3766200018497392b27c8
|
|
| BLAKE2b-256 |
baa8c5ab5592a26b0792b17e6afc4387c40fbafea90e0f9163af85459247f32c
|
File details
Details for the file nage-1.0.1-py3-none-any.whl.
File metadata
- Download URL: nage-1.0.1-py3-none-any.whl
- Upload date:
- Size: 17.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
388f033c1605bed359e68a52e6bc95d680d1bb1a51dcd7482d2c3fdfb725a854
|
|
| MD5 |
80fc5624b07ece834776ebea5d896594
|
|
| BLAKE2b-256 |
af29ea76a39822afe8d7bf597c2cc5be68203a5158bbcd5b9797fab81f0c8d70
|