New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

tf-ai

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tf-ai

AI-powered terminal assistant that explains errors and suggests fixes

latest
Source
npmnpm
Version
0.1.7
Version published
Weekly downloads
9
Maintainers
1
Weekly downloads
 
Created
Source

tf-ai 🤖

The AI-powered cheap copy of thefuck- explains errors, fixes commands, and troubleshoots the terminal.

tf-ai is a CLI tool that uses a LLM to analyze your terminal commands and their output.

Run a command, fail, type fuck, and let AI give you it's insight.

✨ Features

  • 🧠 Context-Aware Analysis: Understanding not just what failed, but where (PowerShell vs Bash, Node.js vs Python project, etc).
  • 📝 Plain English Explanations: Deciphers cryptic error codes and log spew into clear, actionable insights.
  • ⚡ Real-Time Streaming: It's not 2024 anymore. No waiting for the full response.
  • 🛠️ Smart Suggestions: Offers corrected commands that match your specific shell syntax.
  • 🔌 Provider Agnostic: Works with Anthropic (Claude), OpenAI (GPT-4), Google (Gemini), or any Vercel AI SDK compatible provider.

📦 Installation

# Install globally via npm
npm install -g tf-ai

# Or run directly
npx tf-ai --help

⚙️ Configuration

  • Set your API Key (Required)

    export ANTHROPIC_API_KEY="sk-ant-..."
    # OR
    export OPENAI_API_KEY="sk-..."
    
  • Advanced Config (Optional)

    Create ~/.tf-ai/config.json:

    {
      "model": "gpt-5.2",
      "confirmBeforeRun": true,
      "verbose": false
    }
    

🚀 Usage

To use the fuck alias, run the setup command for your shell:

tf-ai --setup

Follow the instructions to add the function to your shell profile:

  • Windows: PowerShell ($PROFILE)
  • Linux/macOS: Bash (.bashrc) or Zsh (.zshrc)

2. The "Fuck" Workflow

# 1. Mess up a command
PS> git pussh origin main
git: 'pussh' is not a git command.

# 2. Summon the AI
PS> fuck

# 3. Get help instantly
🤖 tf-ai
   It looks like you made a typo. 'pussh' is not a valid git command.

💡Suggested command:
   ➜ git push origin main

   [Enter] Run  [e] Edit  [Esc] Cancel

Flags

FlagDescription
fuckAnalyze the last command (default - doesn't re-run it)
fuck -rRe-run the last command to capture its output, then analyze

Tip: Use fuck -r when the error output is important for diagnosis. The default mode is faster and works well for typos and common mistakes.

3. Direct Usage

You can also use it manually to analyze specific errors:

# Analyze a specific failure
tf-ai --command "npm install" --output "EBADENGINE Unsupported engine"

# Just get an explanation without fixes
tf-ai --command "ls -la" --explain

🛠️ Development

git clone https://github.com/yourusername/thefuckai.git
cd thefuckai
pnpm install

# Run locally
pnpm dev -- --command "echo test" --output "error"

📄 License

MIT

Keywords

cli

FAQs

Package last updated on 19 Jan 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts