Skip to main content

AI-powered terminal assistant — ask anything or diagnose failures with 'hey wtf'

Project description

heywtf

AI-powered terminal assistant for macOS. Ask how to do things in the terminal, or diagnose the last failed command.

heywtf

Platform: macOS with zsh. Linux works for hey queries, but hey wtf shell integration is zsh-only.

Quick start

uv tool install heywtf   # don't have uv? brew install uv
hey config               # pick a backend, set an API key, enable shell integration
hey how to check my ip   # ask away

hey config is a guided wizard — the only setup you need. Default backend is Ollama (local, private, no API key); OpenAI and Gemini are also supported.

What you can do

Ask a question — get the command, instantly:

hey how to count words in a file
hey find all python files modified in the last 24 hours

Diagnose a failure — run hey wtf right after any command fails:

$ chmod 777 /etc/hosts
chmod: changing permissions of '/etc/hosts': Operation not permitted

$ hey wtf

  heywtf • powered by ollama (qwen2.5-coder:0.5b)
  💥 Command failed: chmod 777 /etc/hosts
  ──────────────────────────────────────────────────

  💡 Buddy: Permission denied — use sudo for system files:
  sudo chmod 777 /etc/hosts

The suggested command is auto-copied to your clipboard — just paste and run.

hey wtf needs shell integration (enabled by hey config). Pause/resume capture with buddy-off / buddy-on before an interactive session.

Switch backend for one query:

hey o explain async/await in Python    # OpenAI
hey g difference between TCP and UDP    # Gemini
hey l how to tail a log file            # Ollama (local)

Configuration

hey config                               # re-run the setup wizard
hey config show                          # view current config
hey config set backend openai            # change default backend
hey config set openai_api_key sk-...     # set an API key
hey config set ollama_model qwen3-coder:3b
hey config set copy_to_clipboard false   # disable clipboard auto-copy

API keys can also come from the OPENAI_API_KEY / GOOGLE_API_KEY environment variables.

Using Ollama (the default): install and pull a model first —

brew install ollama && ollama serve
ollama pull qwen2.5-coder:0.5b

How hey wtf works

A zsh preexec hook captures each command and its stderr; a precmd hook saves the command and error when the exit code is non-zero. hey wtf reads that context and asks the AI to diagnose it. Interactive commands (vim, ssh, top, etc.) are skipped.

Development

git clone https://github.com/litlig/heywtf.git && cd heywtf
python3 -m venv .venv && source .venv/bin/activate
pip install -e .
source heywtf/shell/buddy.zsh    # load shell hooks in the current session

License

MIT

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

heywtf-0.2.0.tar.gz (14.8 kB view details)

Uploaded Source

Built Distribution

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

heywtf-0.2.0-py3-none-any.whl (17.0 kB view details)

Uploaded Python 3

File details

Details for the file heywtf-0.2.0.tar.gz.

File metadata

  • Download URL: heywtf-0.2.0.tar.gz
  • Upload date:
  • Size: 14.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.12

File hashes

Hashes for heywtf-0.2.0.tar.gz
Algorithm Hash digest
SHA256 fb1276b49dd6534ef8c456af02474de404647dd42e7c0651cd23bdc69b20dcd8
MD5 d31313432803fa6c29a1dbb5116f75a0
BLAKE2b-256 deb5a5781e24654d51c60c07aed30d235b121059c8813a7fd96f24ea28bbb10e

See more details on using hashes here.

File details

Details for the file heywtf-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: heywtf-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 17.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.12

File hashes

Hashes for heywtf-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a1c72d2c3da82c77d0ddaf4f899d9e5c99d208d982aed3a36ee2f9751e99f0c1
MD5 7442a6f096d99e3646db5a246ed56ad2
BLAKE2b-256 1b0267a9675744fc6bc1a76f03de6ac3acdfa170f227cd1b9106f02a11d2c758

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