AI-Powered Terminal Assistant That Understands Your Commands
Project description
Nuha ๐ค
AI-Powered Terminal Assistant That Understands Your Commands
Nuha is an intelligent command-line tool that can read your terminal history, understand command errors, and provide AI-powered explanations and solutions. Built with ZHIPUAI integration and designed for developers who spend significant time in the terminal.
โจ Features
๐ค Multiple AI Provider Support
- Default: ZHIPUAI GLM: Fast and reliable Chinese AI model
- OpenAI GPT: Industry-leading GPT-4 and GPT-3.5 models
- Anthropic Claude: Advanced reasoning with Claude 3.5 Sonnet
- DeepSeek: Cost-effective alternative with strong performance
- Easy switching: Change providers anytime with
nuha setup --provider <name>
๐ Smart Command Analysis
- Auto-explain errors:
nuha explain --autoautomatically analyzes your last failed command - Context-aware: Understands your shell, working directory, and recent command history
- Multi-shell support: Works with bash, zsh, fish, and other popular shells
๐๏ธ Real-time Command Monitoring
- Live session tracking: Monitor commands in your current terminal session
- Intelligent fallback: Automatically uses watch history when available, falls back to terminal history
- Two monitoring modes: Current session monitoring and legacy background process mode
- Shell integration: Seamless integration with bash and zsh using shell hooks
๐ Terminal Session Insights
- Pattern analysis: Identifies common mistakes and usage patterns
- Performance suggestions: Recommends more efficient command alternatives
- Security alerts: Warns about potentially dangerous commands
๐ง Interactive Debugging
- Step-by-step guidance: Provides detailed troubleshooting steps
- Interactive mode: Chat with AI about your terminal issues
- Smart suggestions: Learns from your workflow to provide better recommendations
๐ ๏ธ Easy Setup & Distribution
- Standalone binary: Download and run without installing dependencies
- Cross-platform: Supports Linux, macOS, and Windows
- UV-powered: Modern Python package management with uv
๐ Quick Start
Watch Feature Quick Reference
# Start monitoring (current session)
eval "$(nuha watch --start)"
# Stop monitoring
eval "$(nuha watch --stop)"
# Explain last command (uses watch history if active)
nuha explain --auto
# Show recent commands
nuha watch --show
# Check monitoring status
nuha watch --status
# Background monitoring (legacy)
nuha watch --start --background
nuha watch --stop
Option 1: Download Binary (Recommended)
# Linux/macOS
curl -L https://github.com/u3n-ai/nuha/releases/latest/download/nuha -o nuha
chmod +x nuha
sudo mv nuha /usr/local/bin/
# Windows
# Download nuha.exe from releases page
Option 2: Install with UV (Development)
# Install UV if you haven't already
curl -LsSf https://astral.sh/uv/install.sh | sh
# Clone and install
git clone https://github.com/u3n-ai/nuha.git
cd nuha
uv sync
uv run nuha --help
Option 3: Install with pip
pip install nuha
๐ ๏ธ Setup
-
Get your AI API key from one of these providers:
- ZHIPUAI (default): https://open.bigmodel.cn/
- OpenAI: https://platform.openai.com/api-keys
- Anthropic Claude: https://console.anthropic.com/
- DeepSeek: https://platform.deepseek.com/api_keys
-
Configure Nuha:
# Interactive setup (recommended) nuha setup # Setup specific provider nuha setup --provider openai nuha setup --provider claude nuha setup --provider deepseek
Or set the environment variable:
# For ZHIPUAI (default) export ZHIPUAI_API_KEY="your-api-key-here" # For OpenAI export OPENAI_API_KEY="your-api-key-here" # For Claude export ANTHROPIC_API_KEY="your-api-key-here" # For DeepSeek export DEEPSEEK_API_KEY="your-api-key-here"
-
Test the setup:
nuha explain --auto
๐ก Usage Examples
Explain Command Errors
# Auto-explain the last command that failed
$ git push
fatal: No configured push destination
$ nuha explain --auto
๐ Found last command: git push
๐ค AI Assistant:
**Problem Analysis:** Git doesn't know where to push because no remote repository is configured or the current branch has no upstream set.
**Solution:**
1. Check your remotes: `git remote -v`
2. Add a remote if none exists: `git remote add origin <repository-url>`
3. Set upstream for current branch: `git push -u origin main`
**Prevention:** Always set up your remote repository after `git init` and use `-u` flag on first push.
Analyze Command Patterns
# Analyze your recent terminal activity
$ nuha analyze --session
๐ Command Analysis Results
โโโโโโโโโโโโโโโโโโโณโโโโโโโโ
โ Metric โ Value โ
โกโโโโโโโโโโโโโโโโโโโโโโโโโโฉ
โ Total Commands โ 45 โ
โ Unique Commands โ 23 โ
โ Potential Errorsโ 3 โ
โโโโโโโโโโโโโโโโโโโดโโโโโโโโ
Most Used Commands:
1. git (12 times)
2. ls (8 times)
3. cd (6 times)
Interactive Debugging
$ nuha debug --interactive
๐ง Starting interactive debugging session...
Debug> My docker container keeps crashing
๐ค Let's troubleshoot your Docker container issue...
1. **Check container logs**: `docker logs <container-name>`
2. **Inspect container**: `docker inspect <container-name>`
3. **Check resource usage**: `docker stats`
What specific error are you seeing in the logs?
Debug> exit
๐ Ending debug session.
Search for Error Patterns
# Find all permission-related errors
$ nuha analyze --pattern "permission"
๐ Looking for pattern: permission
โ
Found 3 matching commands:
1. chmod +x script.sh
2. sudo apt install package
3. ls -la /root/
๐ค Pattern Analysis: 'permission'
Most of your permission issues stem from trying to access system directories...
Real-time Command Monitoring (Watch Feature)
The watch feature allows you to monitor commands in real-time and get intelligent explanations. It offers two modes:
Current Session Monitoring (Recommended)
# Start monitoring in your current terminal session
$ eval "$(nuha watch --start)"
โ Nuha watch monitoring started (eval mode)
# Run some commands
$ ls -la
$ git status
$ docker ps
# Get AI explanation of your last command
$ nuha explain --auto
๐ Found last command from watch: docker ps
๐ค AI Assistant:
**Command Analysis:** `docker ps` lists all running Docker containers...
Stop Monitoring
# Stop monitoring when done
$ eval "$(nuha watch --stop)"
โ Nuha watch monitoring stopped
Watch Status and History
# Check if monitoring is active
$ nuha watch --status
๐ข Watch is currently running
โโโโโโโโโโโโณโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Time โ Command โ Exit Code โ
โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ
โ 01:45:23 โ ls -la โ 0 โ
โ 01:45:25 โ git status โ 0 โ
โ 01:45:28 โ docker ps โ 0 โ
โโโโโโโโโโโโดโโโโโโโโโโโโโโโดโโโโโโโโโโโโ
# Show recent commands
$ nuha watch --show
Last 3 Commands
โโโโโณโโโโโโโโโโโณโโโโโโโโโโโโโโโณโโโโโโโโโโโโ
โ # โ Time โ Command โ Exit Code โ
โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ
โ 1 โ 01:45:23 โ ls -la โ 0 โ
โ 2 โ 01:45:25 โ git status โ 0 โ
โ 3 โ 01:45:28 โ docker ps โ 0 โ
โโโโโดโโโโโโโโโโโดโโโโโโโโโโโโโโโดโโโโโโโโโโโโ
Background Process Mode (Legacy)
# Start background monitoring (legacy mode)
$ nuha watch --start --background
๐ Starting command watcher...
โ
Watch started successfully
# The monitoring runs in the background
# Run commands normally
$ python app.py
$ npm test
# Stop background monitoring
$ nuha watch --stop
โ
Watch stopped successfully
Intelligent Command Source Selection
The explain --auto command intelligently chooses the command source:
# When watch monitoring is active - uses watch history
$ eval "$(nuha watch --start)"
โ Nuha watch monitoring started
$ kubectl get pods
$ nuha explain --auto
๐ Found last command from watch: kubectl get pods
# When watch monitoring is NOT active - falls back to terminal history
$ nuha explain --auto
๐ Found last command from history: git commit -m "fix bug"
Development vs Production Usage
Development Environment:
# Start monitoring for development session
$ eval "$(nuha watch --start)"
# Work on your project
$ npm run dev
$ git add .
$ git commit -m "feat: add new feature"
$ docker build -t myapp .
# Get explanations for complex commands
$ nuha explain --auto
๐ Found last command from watch: docker build -t myapp
# Stop when done
$ eval "$(nuha watch --stop)"
Production/Server Environment:
# Use background mode for persistent monitoring
$ nuha watch --start --background
# Commands are captured automatically
$ systemctl status nginx
$ tail -f /var/log/app.log
$ curl -X GET http://localhost:8080/health
# Check captured commands
$ nuha watch --show
# Stop monitoring when needed
$ nuha watch --stop
Real-time Command Following
# Follow commands in real-time (useful for monitoring)
$ nuha watch --show --follow
๐ Following commands in real-time...
Press Ctrl+C to stop
[Shows live updates as commands are executed]
๐ Project Structure
nuha/
โโโ nuha/ # Main package
โ โโโ cli/ # CLI interface
โ โ โโโ main.py # Entry point
โ โ โโโ commands/ # Command implementations
โ โโโ core/ # Core functionality
โ โ โโโ ai_client.py # ZHIPUAI integration
โ โ โโโ terminal_reader.py # Terminal history reading
โ โ โโโ config.py # Configuration management
โ โ โโโ command_parser.py # Command parsing
โ โโโ utils/ # Utilities
โ โโโ formatter.py # Output formatting
โ โโโ history_parser.py # History file parsing
โโโ pyproject.toml # UV project configuration
โโโ setup_binary.py # Binary creation script
โโโ README.md
๐ง Development
Setting up Development Environment
# Clone the repository
git clone https://github.com/u3n-ai/nuha.git
cd nuha
# Install UV (if not already installed)
curl -LsSf https://astral.sh/uv/install.sh | sh
# Create virtual environment and install dependencies
uv sync
# Run in development mode
uv run nuha --help
# Run tests
uv run pytest
# Format code with Ruff
uv run ruff format nuha/
# Lint with Ruff
uv run ruff check nuha/
# Fix auto-fixable issues
uv run ruff check --fix nuha/
# Type check
uv run pyrefly check .
# Or use Make commands
make test
make format
make lint
make type-check
make all # Run all checks
Building Binary
# Build production binary
python setup_binary.py production
# Build development binary (faster)
python setup_binary.py dev
# Create installer
python setup_binary.py installer
The binary will be created in the dist/ directory and can be distributed as a standalone executable.
โ๏ธ Configuration
Nuha stores its configuration in ~/.nuha/config.toml. You can customize:
[ai]
provider = "zhipuai" # AI provider: zhipuai, openai, claude, deepseek
model = "glm-4.5-flash" # AI model to use
temperature = 0.3 # Response creativity (0.0-1.0)
max_tokens = 2000 # Maximum response length
[terminal]
history_limit = 50 # Commands to analyze
auto_analyze = true # Enable automatic analysis
include_context = true # Include shell context
[output]
format = "rich" # Output format (rich/plain/json)
color = true # Enable colored output
verbose = false # Verbose mode
[behavior]
auto_explain_errors = false # Auto-explain all errors
interactive_mode = true # Enable interactive features
save_analysis = true # Save analysis results
Configuration Commands
# Show current configuration (including active provider)
nuha config --show
# Edit configuration file
nuha config --edit
# Reset to defaults
nuha config --reset
# Switch AI provider
nuha setup --provider openai
nuha setup --provider claude
nuha setup --provider deepseek
๐ Privacy & Security
- Local Processing: Terminal history is processed locally
- API Communication: Only command context is sent to ZHIPUAI
- No Data Storage: Nuha doesn't store your commands remotely
- Secure Keys: API keys are stored locally in encrypted format
๐ค Contributing
We welcome contributions! Here's how to get started:
-
Fork the repository
-
Create a feature branch:
git checkout -b feature/amazing-feature -
Make your changes
-
Add tests: Ensure your changes are tested
-
Commit your changes
-
Run quality checks:
# Format code with Ruff make format # or: uv run ruff format . # Lint code with Ruff make lint # or: uv run ruff check . # Fix auto-fixable issues uv run ruff check --fix . # Type check make type-check # or: uv run pyrefly check . # Run tests make test # or: uv run pytest # Run all checks at once make all # Run pre-commit hooks on staged files make pre-commit # Run pre-commit hooks on all files make pre-commit-all
-
Commit your changes:
git commit -m 'Add amazing feature' -
Push to branch:
git push origin feature/amazing-feature -
Open a Pull Request
Pre-commit Hooks
This project uses pre-commit hooks to ensure code quality. The hooks are automatically configured when you clone the repository:
# Install pre-commit hooks (one-time setup)
pre-commit install
# Run hooks manually on staged files
pre-commit run
# Run hooks on all files
pre-commit run --all-files
# Or use Make commands
make pre-commit # Run on staged files
make pre-commit-all # Run on all files
The pre-commit configuration includes:
- Ruff: Linting and formatting (
--fixauto-fixes issues) - Pyrefly: Type checking
- Basic checks: Trailing whitespace, YAML validation, etc.
- pytest: Runs tests before commits
Hooks will run automatically when you git commit, ensuring code quality before changes are committed.
Development Guidelines
- Code Style: Follow PEP 8, use Ruff for formatting and linting
- Type Hints: Add type hints to all functions
- Documentation: Update docstrings and README
- Tests: Add tests for new functionality
- Commit Messages: Use conventional commit format
๐ Troubleshooting
Common Issues
"API key not configured"
# Set your API key
export ZHIPUAI_API_KEY="your-key-here"
# Or run setup
nuha setup
"No recent commands found"
# Check if history is enabled in your shell
echo $HISTSIZE
# For bash: add to ~/.bashrc
export HISTSIZE=1000
# For zsh: add to ~/.zshrc
export SAVEHIST=1000
"Permission denied"
# Make binary executable
chmod +x nuha
# Or install to user directory
mkdir -p ~/.local/bin
cp nuha ~/.local/bin/
export PATH="$HOME/.local/bin:$PATH"
Debug Mode
Enable verbose output for troubleshooting:
nuha --verbose explain --auto
Or check debug information:
nuha debug --trace
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Acknowledgments
- ZHIPUAI for providing the default AI capabilities
- OpenAI for GPT models
- Anthropic for Claude models
- DeepSeek for cost-effective AI access
- Rich for beautiful terminal output
- Typer for excellent CLI framework
- UV for modern Python package management
- Ruff for blazing-fast linting and formatting
- PyInstaller for binary distribution
๐ Support
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: support@nuha.ai
- Documentation: docs.nuha.ai
Made with โค๏ธ by developers, for developers
Nuha - Your AI companion in the terminal
Project details
Release history Release notifications | RSS feed
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 nuha-1.0.0.tar.gz.
File metadata
- Download URL: nuha-1.0.0.tar.gz
- Upload date:
- Size: 1.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ce8578536321c5c3cfb855133e3b1ac7fcccdbf24fba3cd0b4326e06b0c079e8
|
|
| MD5 |
fb682ec3eea60f0d22ccbf1d5893a929
|
|
| BLAKE2b-256 |
6b88e45b8e90ae73efc678b7237690902122f93b71a41c3487a7b2e37682a2ab
|
File details
Details for the file nuha-1.0.0-py3-none-any.whl.
File metadata
- Download URL: nuha-1.0.0-py3-none-any.whl
- Upload date:
- Size: 39.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0569786a589c7dac189e898709e48c0a33b9c5a5b6cb05a14cbfc2e217d74f82
|
|
| MD5 |
d039e6273fcf77ec358437578f87ed91
|
|
| BLAKE2b-256 |
3948d95f80c3fb9561d3bcf675e8984c02674025b1a790715b015b0e9bd7e11f
|