Skip to main content

AI-powered command correction assistant for thefuck

Project description

TheFuck AI Rule

TheFuck AI Rule 是一个基于 AI 的命令修正插件,为 thefuck 工具提供智能命令修复功能。

功能特点

  • 使用 AI 模型分析命令错误并提供修复建议
  • 支持多种 AI 模型和 API 服务
  • 自动环境检测和配置
  • 简单易用的安装和设置流程

安装

pip install thefuck-ai-rule

或者使用 pipx 安装 (推荐):

pipx install thefuck
pipx install thefuck-ai-rule

或者直接从 GitHub 安装:

pip install git+https://github.com/huchiyv/thefuckAiRule.git

自动安装和配置

安装后,运行以下命令完成初始化配置:

thefuck-ai-install

此命令将:

  1. 检查是否安装了 thefuck
  2. 自动识别您的操作系统
  3. 将规则文件复制到适当的位置
  4. 帮助您配置必要的 API 密钥和设置

手动配置

您可以手动设置以下环境变量:

使用方法

安装和配置完成后,正常使用 thefuck 命令即可。当您输入错误命令后:

正确设置 PowerShell 别名 (Windows 用户必读)

如果您在 PowerShell 中使用 thefuck,请确保正确设置别名,这对于命令正确执行至关重要:

iex "$(thefuck --alias)"

如果您希望永久设置别名,可以将上面的命令添加到您的 PowerShell 配置文件中:

# 查找您的 PowerShell 配置文件路径
echo $profile
# 编辑配置文件,添加以下行:
# iex "$(thefuck --alias)"

使用示例

$ cd /nonexistent-directory
bash: cd: /nonexistent-directory: No such file or directory

$ fuck
✨✨✨ AI 提示 ✨✨✨
>>> 这是 AI 生成的修复命令 <<<
✨✨✨✨✨✨✨✨✨✨

mkdir -p /nonexistent-directory && cd /nonexistent-directory

$ mkdir -p /nonexistent-directory && cd /nonexistent-directory

许可证

此项目采用 MIT 许可证 - 详见 LICENSE 文件。

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

thefuck_ai_rule-0.1.4.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

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

thefuck_ai_rule-0.1.4-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file thefuck_ai_rule-0.1.4.tar.gz.

File metadata

  • Download URL: thefuck_ai_rule-0.1.4.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for thefuck_ai_rule-0.1.4.tar.gz
Algorithm Hash digest
SHA256 6a12cf3c9da4e6b806aba24e2ad78c1495a424bdd3ebf65e2774d54276292198
MD5 2058d385037084b43d13845f66261886
BLAKE2b-256 f7b79d4a39abfd04800885839f63917320528d4f69f5f1d7b9ae1d1a47933267

See more details on using hashes here.

File details

Details for the file thefuck_ai_rule-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for thefuck_ai_rule-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 7a5b471934d1f476fd6d9c01d04929897707c69f2fd826cb849ea9f01691a6dc
MD5 04e8e3283f687ea29ec94153edd6ba8c
BLAKE2b-256 58a20add92f733165f4ea68f89a15459fafed5f894c3e0cd26544909b1664811

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