Skip to main content

智能终端工具,基于LLM将自然语言转换为终端命令(create by claude 4 sonnet)

Project description

AutoTerminal - 智能终端工具

AutoTerminal 是一个基于大语言模型的智能终端工具,可以将自然语言转换为终端命令,提高工作效率。

功能特点

  • 🧠 基于LLM的智能命令生成
  • 🔐 安全的命令执行机制(需要用户确认)
  • ⚙️ 灵活的配置管理
  • 🌍 中文支持
  • 🔄 支持多种LLM模型
  • 📚 命令历史记录和上下文感知
  • 📁 当前目录内容上下文感知

安装

方法1:使用uv(开发模式)

确保已安装 uv 工具,然后运行:

uv sync

方法2:使用pip安装到用户目录(推荐给最终用户)

pip install --user .

安装后可以直接使用 at 命令:

at "查看当前目录"

卸载

pip uninstall autoterminal

全局安装(需要管理员权限)

sudo pip install .

配置

首次运行时,程序会引导您完成配置:

  1. API密钥
  2. Base URL
  3. 模型名称

配置信息会保存在 config.json 文件中。

配置选项

  • max_history: 历史命令记录数量(默认:10)

使用方法

方法1:使用uv run

uv run python autoterminal/main.py "查看当前目录下的所有文件"

方法2:安装后使用at命令

uv pip install -e .
at "查看当前目录下的所有文件"

使用历史命令上下文

at --history-count 5 "基于前面的命令,删除所有.txt文件"

程序会生成终端命令并显示提示,用户按回车后程序会直接执行该命令。

示例

$ at "列出当前目录下的所有文件"
$ ls -a
Press Enter to execute...
.  ..  autoterminal  config.json  .git  .gitignore  pyproject.toml  .python-version  README.md  uv.lock

支持的LLM

  • OpenAI GPT系列
  • 兼容OpenAI API的其他模型(如阿里云、腾讯云等)

项目结构

autoterminal/
├── __init__.py             # 包初始化文件
├── main.py                 # 主程序入口
├── config/                 # 配置管理模块
│   ├── __init__.py         # 包初始化文件
│   ├── loader.py           # 配置加载器
│   └── manager.py          # 配置管理器
├── llm/                    # LLM相关模块
│   ├── __init__.py         # 包初始化文件
│   └── client.py           # LLM客户端
├── history/                # 历史命令管理模块
│   ├── __init__.py         # 包初始化文件
│   └── history.py          # 历史命令管理器
├── utils/                  # 工具函数
│   ├── __init__.py         # 包初始化文件
│   └── helpers.py          # 辅助函数
├── pyproject.toml          # 项目配置
├── config.json             # 用户配置文件
├── .gitignore
└── README.md

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

autoterminal-1.0.1.tar.gz (12.5 kB view details)

Uploaded Source

Built Distribution

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

autoterminal-1.0.1-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

Details for the file autoterminal-1.0.1.tar.gz.

File metadata

  • Download URL: autoterminal-1.0.1.tar.gz
  • Upload date:
  • Size: 12.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for autoterminal-1.0.1.tar.gz
Algorithm Hash digest
SHA256 b7f8fdf431fd4ce342f7859900b98b6b94cca697260739bd5948c2000eb161a8
MD5 c261e464c69cd6a919b8e930e90010a3
BLAKE2b-256 f1d54fb44cf97c9cfed0c275eef6049283560dd721373f374ca6652278cfd834

See more details on using hashes here.

File details

Details for the file autoterminal-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: autoterminal-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 15.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for autoterminal-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 83704130d6248d28e429ec34912fb695e50d105742156be6534d4e75782b6ea4
MD5 e562da8b8ea164e0ef9fcdee3cfc0f77
BLAKE2b-256 2aeec3d35bfd4b06bdde63f41cae728a0c3e0f8dfbc1c62ba5cb95ce9948594a

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