JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 28
  • Score
    100M100P100Q57206F
  • License CC BY-NC 4.0

AI 增强命令行终端

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (aixshell) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    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
    说人话,AI 翻译为正确的 shell 命令并执行
    Describe what you want in plain language, AI translates to correct shell commands and executes
    AI 编程助手
    AI Coding Assistant
    代码生成、重构、调试、项目脚手架搭建
    Code gen, refactor, debug, scaffolding
    批量文件操作
    Batch File Operations
    智能搜索、读取、编辑多个文件
    Search, read, edit multiple files intelligently
    多模型支持
    Multi-Model Support
    OpenAI 兼容 + Anthropic Claude 原生,支持推理模型
    OpenAI-compatible & Anthropic native, reasoning models supported
    流式输出
    Streaming Output
    AI 思考过程实时展示
    Real-time streaming of AI thoughts
    故障排查
    Troubleshooting
    命令执行失败自动转 AI 分析修复
    Auto AI analysis and fix on command failure
    危险命令拦截
    Destructive Command Guard
    拦截 AI 生成的 rm, del, rd, format, dd, shred 等永久删除命令
    Intercepts AI-generated destructive commands (rm, del, rd, format, dd, shred, etc.)
    安全删除
    Safe Deletion
    拦截危险命令后引导 AI 使用 trash 工具将文件移入回收站
    Guides AI to use trash tool to move files to trash/recycle bin instead of destructive commands

    使用示意 · 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
    
    # ⛔ 危险命令拦截 — 自动保护 · Auto Protection
    [aixshell](master)$ 帮我清理磁盘空间
    → AI 尝试执行 rm -rf /
    ⛔ 危险操作已拦截: "rm -rf /"
       请使用 trash 工具。
    
    # 🟢 安全删除 — AI 自动使用 trash · Safe Deletion
    [aixshell](master)$ trash temp.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
    
    # 🟣 编程任务 — 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 Backends

    • OpenAI — OpenAI、DeepSeek、SiliconFlow、OpenRouter、Azure 等
    • Anthropic — Claude 系列

    项目级配置 · 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:

    场景 配置目录 · Config Dir
    Git 项目下 ./.aixshell/ — 对话历史、记忆、提示词 项目本地隔离,首次运行自动创建 .gitignore
    Chat history, memory, prompts isolated per project; auto creates .gitignore on first run
    非 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:

    1. 打开设置 Cmd+,(macOS)/ Ctrl+,(Windows/Linux) Open settings Cmd+, (macOS) / Ctrl+, (Windows/Linux)
    2. 搜索 Terminal › Default Profile Search for Terminal › Default Profile
    3. 点击 Edit in settings.json Click Edit in settings.json
    4. 添加(按系统选择平台): 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.