Skip to main content

A lightweight, zero-dependency AI terminal assistant

Project description

🤖 Smart CLI AI

Lightweight, Zero-Dependency AI Terminal Assistant

Convert Natural Language to Shell Commands · Diagnose Terminal Errors · Auto-Generate Git Commits

Python Version License: MIT Dependencies PRs Welcome


🔥 Key Features

  • ⚡ Zero Third-Party Dependencies — Built entirely with Python standard library (argparse, json, urllib). Instant startup, nothing to install.
  • 💡 Natural Language to Shellsmart-cli do "find large files" generates the exact command you need.
  • 🔍 Intelligent Error Diagnosis — Paste any terminal error into smart-cli fix and get root-cause analysis with step-by-step solutions.
  • 📝 Auto Git Commit Messagessmart-cli commit reads your staged diff and generates Conventional Commit messages.
  • 🌐 Multi-Provider Support — DeepSeek, OpenAI, Qwen, Moonshot (Kimi), SiliconFlow, Ollama, or any OpenAI-compatible endpoint.
  • 🛡️ Human-Readable Diagnostics — No raw HTTP status codes. Every error comes with a Chinese explanation and actionable fix.
  • 🔑 Key Masking — API keys are never printed in full; only first 4 and last 4 characters are shown.

🚀 Quick Start

Installation

pip install smart-cli-ai

Configuration (30 seconds)

smart-cli config

An interactive wizard will guide you through:

  1. Pick a provider (DeepSeek / OpenAI / Qwen / Moonshot / SiliconFlow / Ollama / Custom)
  2. Paste your API key (masked input, not echoed to terminal)
  3. Connectivity test runs automatically — config is only saved on success

Or skip the wizard:

smart-cli config --preset deepseek --key sk-your-api-key

Use It

# Convert natural language to shell command
smart-cli do "list all docker containers running and their port mappings"

# Diagnose a terminal error
smart-cli fix "npm ERR! code ERESOLVE unable to resolve dependency tree"

# Generate a commit message from staged changes
git add .
smart-cli commit

📖 Command Reference

Command Description
smart-cli config Launch interactive setup wizard
smart-cli config --preset <NAME> --key <KEY> Quick setup with a provider preset
smart-cli info View current configuration (API key masked)
smart-cli check Test API connectivity and latency
smart-cli reset Delete local configuration
smart-cli do "<query>" Convert natural language to shell command
smart-cli fix "<error>" Diagnose terminal errors with AI
smart-cli commit Generate Conventional Commit from staged git diff

🌐 Supported Providers

Provider Preset Key Default Model
DeepSeek deepseek deepseek-chat
OpenAI openai gpt-4o-mini
SiliconFlow siliconflow deepseek-ai/DeepSeek-V3
Qwen (通义千问) qwen qwen-plus
Moonshot (月之暗面/Kimi) moonshot moonshot-v1-8k
Ollama (Local) ollama qwen2.5
Custom (your own endpoint)

⚙️ Configuration

Configuration is stored at ~/.smart_cli_config.json with UTF-8 encoding.

Priority chain (highest to lowest):

  1. Values in ~/.smart_cli_config.json
  2. Environment variables: DEEPSEEK_API_KEY / OPENAI_API_KEY, OPENAI_BASE_URL, OPENAI_MODEL

If no configuration is found, the tool will prompt you to run smart-cli config.


🛡️ Error Diagnostics

Instead of raw HTTP codes, Smart CLI AI provides actionable messages:

Scenario What You See
Invalid API Key "401 — API Key 无效或服务商不匹配" + fix instructions
Rate Limited "429 — 请检查账户余额与计费状态"
Network Down "网络连接失败 — 请检查代理设置"
Corrupt Config "JSON 格式损坏 — 运行 smart-cli reset"

📦 Requirements

  • Python 3.8 or higher
  • No third-party packages required
  • Works on Linux, macOS, and Windows

🤝 Contributing

Pull requests are welcome! For major changes, please open an issue first.


📄 License

MIT © jiu99203

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

smart_cli_ai-0.2.0.tar.gz (14.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

smart_cli_ai-0.2.0-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

Details for the file smart_cli_ai-0.2.0.tar.gz.

File metadata

  • Download URL: smart_cli_ai-0.2.0.tar.gz
  • Upload date:
  • Size: 14.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.6

File hashes

Hashes for smart_cli_ai-0.2.0.tar.gz
Algorithm Hash digest
SHA256 11e89c65187727b34088246d2f3eb100b9b1d519ea0698a234e5af0f53d76acc
MD5 50a3657da9e41a49021d0d71aa17082a
BLAKE2b-256 4da11bf7c862b5ea311c93467b05f7ff0239a420aa1d4212252816ef44c512a8

See more details on using hashes here.

File details

Details for the file smart_cli_ai-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: smart_cli_ai-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 13.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.6

File hashes

Hashes for smart_cli_ai-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0344eeada122ebf93ee71029318e436c2fccefdecf18bf7e0e4b5c18ac2d839d
MD5 0c448d465a939a9eb2baeeb179fb463e
BLAKE2b-256 f5a2600368ff2c05eb3091d86763806aa58630e9679b0c5a62b270765fd133d6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page