aixshell
v0.1.32
Published
AI 增强命令行终端
Maintainers
Readme
aixshell
AI 增强命令行终端
AI-Powered Command Line
aixshell = AI + X + shell — 通过自然语言在终端里干活
Talk naturally, get things done in terminal.
执行命令、操作文件、调试问题、完成项目——不用记复杂命令,自然语言搞定一切。
Run commands, edit files, debug issues, complete projects — no need to memorize complex commands, just speak naturally.
本项目自身就是通过 aixshell 自举开发的。
This project is built self-hosted using aixshell itself.
✨ 核心能力 · Core Features
| 能力 · Ability | 说明 · Description |
|------|-------------|
| 自然语言执行命令Natural Language Commands | 自动翻译自然语言为正确的 shell 命令并执行Plain language → correct shell commands |
| AI 编程助手AI Coding Assistant | 代码生成、重构、调试、项目脚手架Code gen, refactor, debug, scaffolding |
| 批量文件操作Batch File Operations | 智能搜索、读取、编辑多个文件Smart multi-file search, read, edit |
| 多模型支持Multi-Model Support | OpenAI 兼容 + Anthropic Claude 原生,支持推理模型,当前模型不可用时自动回退OpenAI-compatible & Anthropic native, reasoning models, auto-fallback on failure |
| 流式输出Streaming Output | AI 思考和回复实时展示Real-time AI thought & response streaming |
| 故障排查Troubleshooting | 命令失败自动转 AI 分析修复Auto AI analysis on command failure |
| 安全防护Safety Guard | 拦截 rm -rf / 等危险命令,改用 trash 移入回收站Intercepts rm -rf /, uses trash instead |
使用示例 · Usage Examples
# 🟢 普通命令 — 直接执行 · Direct execution
[aixshell](master)$ ls -la
total 42
drwxr-xr-x ...
# 🟠 输入错误的命令 — AI 自动修正 · Auto-correction
[aixshell](master)$ grpe "foo" *.txt
→ AI: 看起来命令输错了,自动修正为 grep "foo" *.txt
→ AI: Looks like a typo, auto-corrected to grep "foo" *.txt
# 🔵 自然语言描述 — AI 理解并执行 · Natural language
[aixshell](master)$ 帮我查看当前目录最大的文件
→ AI 自动执行 du -sh * | sort -rh | head -5
→ AI runs du -sh * | sort -rh | head -5 to find largest files
# ⛔ 危险命令拦截 → 安全删除 · Destructive Guard → Safe Deletion
[aixshell](master)$ 删除旧日志
→ AI 尝试执行 rm -rf logs/,被自动拦截
→ AI attempted rm -rf logs/, auto-blocked
→ AI 改用 trash 移除了日志目录
→ AI switched to trash to remove logs
# 🟣 编程任务 — AI 编程助手 · AI coding assistant
[aixshell](master)$ 这个项目报错了,帮我看看
→ AI 读取错误信息,分析问题,给出修复方案
→ AI reads error, analyzes, and provides fix
# ⚡ 项目脚手架 — AI 一步步引导生成 · Project scaffolding
[aixshell](master)$ 创建一个 Express + React 项目脚手架
→ AI 一步步引导,生成代码、配置文件、安装依赖
→ AI guides step-by-step: code, configs, dependencies🚀 快速开始 · Quick Start
安装 · Install
npm install -g aixshell安装后终端运行:
Run in terminal:
aixshell配置 · Configuration
首次运行自动创建配置文件,内置免费模型可体验,建议添加自己的模型以获得更好效果。
Auto-generated on first run. Built-in free models for quick trial — add your own for better results.
要添加自己的模型,编辑配置文件:
To add your own model, edit the config:
# Linux/macOS
nano ~/.aixshell/config.json
# Windows
notepad %USERPROFILE%\.aixshell\config.json配置格式(支持多个模型,同名 id 覆盖):
Config format (multiple models supported, same id overrides):
{
"models": [
{
"id": "my-model", // 模型标识 Model identifier
"enabled": true,
"apiFormat": "openai", // "openai" | "anthropic"
"url": "https://api.example.com/v1/chat/completions",
"apiKey": "sk-xxx",
"headers": {},
"params": {
"max_tokens": 8192
}
}
]
}注:首次运行自动生成的配置中已有内置免费模型,可直接体验。
Note: Built-in free models are pre-configured, ready for a quick try.
支持的模型 · Supported Models:
| 格式 · Format | 支持的模型 · Models | |------|----------| | OpenAI 格式 · OpenAI format | DeepSeek、SiliconFlow、OpenRouter、Azure OpenAI、Groq、Together AI、Mistral、Gemini、Qwen、Yi、GLM | | Anthropic 格式 · Anthropic format | Claude (Haiku、Sonnet、Opus) |
项目级配置 · Project-Level Config
对特定项目使用独立配置:
Use per-project config:
cd your-project
mkdir -p ./.aixshell
cp ~/.aixshell/config.json ./.aixshell/
# 编辑 ./.aixshell/config.json 定制项目配置优先级:本地 .aixshell/config.json > 全局 ~/.aixshell/config.json > 内置默认
Priority: local .aixshell/config.json > global ~/.aixshell/config.json > built-in defaults
📁 配置目录 · Config Directory
aixshell 自动感知运行环境,选择合适的配置目录:
aixshell auto-detects your working directory and selects the right config location:
| 场景 · Scenario | 配置目录 · Config Dir |
|------|----------|
| Git 项目下 · Inside a Git project | ./.aixshell/ — 对话历史、记忆、提示词 项目本地隔离,首次运行自动创建 .gitignoreChat history, memory, prompts isolated per project; auto creates .gitignore on first run |
| 非 Git 目录 · Outside Git | ~/.aixshell/ — 全局统一存储,所有非 Git 项目共享同一份配置和记忆Global storage, shared config and memory across all non-Git projects |
📌 项目级隔离:在 Git 项目下,每个项目的
.aixshell/互不干扰,对话历史和项目记忆独立存储。敏感信息通过.gitignore自动排除。
📌 Project isolation: Each Git project has its own.aixshell/directory — no cross-project interference. Secrets auto-excluded via.gitignore.
目录结构 · Directory Structure
两个配置目录的详细文件结构如下:
Here's the detailed file layout for both config directories:
~/.aixshell/ # 全局目录 · Global directory (for non-Git projects)
├── config.json # API 配置 · API configuration
├── agent.md # 自定义提示词(可选) · Custom system prompt (optional)
├── memory.md # 全局记忆 · Global memory
└── history.json # 对话历史 · Chat history
your-project/ # Git 项目目录 · Git project directory
├── .git/ # Git 仓库 · Git repository
└── .aixshell/ # 项目级配置 · Project config (auto-created, auto .gitignore)
├── config.json # 项目 API 配置 · Project API config (同 id 覆盖全局 · overrides global)
├── agent.md # 项目提示词(可选) · Project prompt (optional)
├── memory.md # 项目记忆 · Project memory
└── history.json # 项目对话历史 · Project chat history⌨️ 命令与快捷键 · Commands & Shortcuts
命令行选项 · CLI Options
用法: aixshell [选项] [命令]
Usage: aixshell [options] [command]
选项 Options:
-c <命令> 直接执行一条命令(成功直接输出,失败自动转 AI)
Execute a command directly (fallback to AI on failure)
-m <模型ID> 临时切换模型(覆盖默认)
Temporarily switch model (overrides default)
-h, --help 显示帮助信息 Show help
-v, --version 显示版本号 Show version
示例 Examples:
aixshell 进入交互模式 Interactive mode
aixshell -c "ls -la" 直接执行命令 Execute command
aixshell -m deepseek-r1 指定模型进入交互 Launch with model
aixshell -c "git pull" 失败时自动转 AI 处理 Auto AI on failure内置命令(交互模式)· Built-in Commands (Interactive)
| 命令 · Command | 说明 · Description |
|------|----------|
| exit | 退出 · Exit |
| /clear | 清空对话历史 · Clear chat history |
| /model <模型ID> | 切换当前模型(如 /model deepseek-r1)· Switch model at runtime |
| /models | 查看所有可用模型和当前模型 · List available models |
| Esc | 中断 AI 输出 · Interrupt AI output |
切换模型 · Switch Model
命令行启动时:通过 -m 参数指定模型。
At startup: Use the -m flag to specify a model.
运行时切换:在交互模式中输入 /model <模型ID> 动态切换,无需重启。
At runtime: Enter /model <id> to switch dynamically without restart.
使用 /models 查看所有可用模型及当前选中的模型。
Use /models to see all available models and the currently selected one.
默认使用配置中第一个启用的模型,当前模型不可用时自动回退到下一个。
Default is the first enabled model; auto-fallback to next if unavailable.
🔧 高级用法 · Advanced Usage
VS Code 默认终端 · VS Code Default Terminal
将 aixshell 设置为 VS Code 默认终端:
Set aixshell as VS Code default terminal:
- 打开设置
Cmd+,(macOS)/Ctrl+,(Windows/Linux) Open settingsCmd+,(macOS) /Ctrl+,(Windows/Linux) - 搜索
Terminal › Default ProfileSearch forTerminal › Default Profile - 点击
Edit in settings.jsonClickEdit in settings.json - 添加(按系统选择平台): Add (select platform by OS):
{
// macOS
"terminal.integrated.profiles.osx": {
"aixshell": {
"path": "aixshell",
"args": [],
"icon": "terminal"
}
},
"terminal.integrated.defaultProfile.osx": "aixshell",
// Windows → "windows",Linux → "linux"
}重启 VS Code,新建终端自动进入 aixshell。
Restart VS Code, new terminals will open with aixshell.
📄 License
CC BY-NC 4.0 — 仅限非商业用途 · Non-commercial use only.
详见 · See LICENSE.
