智能终端工具,基于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 .
配置
首次运行时,程序会引导您完成配置:
- API密钥
- Base URL
- 模型名称
配置信息会保存在 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.2.tar.gz
(12.4 kB
view details)
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 autoterminal-1.0.2.tar.gz.
File metadata
- Download URL: autoterminal-1.0.2.tar.gz
- Upload date:
- Size: 12.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
994edb550a34b508039e5954423ff382f03b915e85a978de6541347ba5133b9c
|
|
| MD5 |
7f8165a3eda08889f84491507faf7a40
|
|
| BLAKE2b-256 |
84faf507e05de064150863d03d13a16bf91ffb6f1d226ac52b1a82809f179b1b
|
File details
Details for the file autoterminal-1.0.2-py3-none-any.whl.
File metadata
- Download URL: autoterminal-1.0.2-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
466f4c3825acf8365ce08c7b1b750bf98759a856a32e62190cc242eb25ca9769
|
|
| MD5 |
16889500a6c44051eaa63c30e782fe59
|
|
| BLAKE2b-256 |
ce86fb51492e17bab01eba29800d410cd423aca4539107931cbf79e9c779633f
|