Skip to main content

一个将自然语言需求转换为命令行命令的AI工具

Project description

AI-Bash: 智能命令行工具

一个基于大模型的命令行工具,可以将自然语言需求转换为对应平台的命令行命令。

功能介绍

  • 接收用户的自然语言描述
  • 调用大模型API将需求转换为命令行命令
  • 自动识别用户的操作系统和命令行环境
  • 根据当前平台生成最适合的命令
  • 支持自定义API密钥、主机地址和模型名称
  • 生成命令并在用户确认后执行
  • 分析命令执行结果,提取有用信息

快速开始

安装:

uv tool install ai_bash
# 更新
uv tool upgrade ai-bash

# 支持三个命令: ai ai-bash ai_bash

使用:

# 基本用法(生成命令并等待用户回车后执行)
ai 查一下当前目录的文件路径

# 只生成命令不执行
ai 列出所有进程 --no-exec

# 只输出纯文本命令,便于手动复制
ai 查找大文件 --copy

# 自动将命令复制到剪贴板,可直接粘贴使用
ai 查找大文件 --clipboard

# 执行命令后交互式分析结果
ai 获取最新10条git提交 --qa

# 查看帮助信息
ai --help

配置

初始化并查看配置:

# 显示配置文件路径,如果不存在则创建
ai --init

# 强制创建新配置文件(覆盖已有配置)
ai --init --force

配置文件位于用户主目录下的.cmd_ai文件:

# 必需的API密钥
OPENAI_API_KEY=你的OpenAI API密钥

交互式命令分析功能

使用--qa -q 选项来启用交互式命令分析功能:

# 执行git命令并进入交互式分析模式
ai 获取最近10次git提交日志 --qa

执行命令后,工具会:

  1. 显示命令执行结果
  2. 询问您是否需要AI分析结果
  3. 如果需要,您可以输入具体的分析需求,例如:
    • "总结最近的工作内容"
    • "分析提交频率"
    • "找出所有关于bug修复的提交"
  4. AI会根据您的需求分析命令输出
  5. 分析完成后,还可以继续提出其他分析需求

文档与贡献

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

ai_bash-0.1.2.tar.gz (52.1 kB view details)

Uploaded Source

Built Distribution

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

ai_bash-0.1.2-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file ai_bash-0.1.2.tar.gz.

File metadata

  • Download URL: ai_bash-0.1.2.tar.gz
  • Upload date:
  • Size: 52.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for ai_bash-0.1.2.tar.gz
Algorithm Hash digest
SHA256 1ea41ef270419238ad702522139bb6aeae7b0144e0342e5d750146fc2f6f66cc
MD5 3593b78a7f8bb51812ff6784bfad5dc3
BLAKE2b-256 3a0ae1e6536673bc38146a77ebc0b9fd42f446374e77854beacbd82a8e8a6104

See more details on using hashes here.

Provenance

The following attestation bundles were made for ai_bash-0.1.2.tar.gz:

Publisher: python-publish.yml on weiwei2012holy/cmd_ai

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ai_bash-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: ai_bash-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 11.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for ai_bash-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4e51427e8f404db1cbd8155eae631e08bc07d40a668467924389d8bbd1fd0ebe
MD5 e99b5540ac4a41c5a44cd9d9458f7558
BLAKE2b-256 f8e24a11ab2960eb4711145e511ac098bef5ac5c1754b00a3521b13c1b028c8c

See more details on using hashes here.

Provenance

The following attestation bundles were made for ai_bash-0.1.2-py3-none-any.whl:

Publisher: python-publish.yml on weiwei2012holy/cmd_ai

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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