Skip to content
/ wut Public
forked from shobrook/wut

An terminal assistant for the hopelessly confused

License

Notifications You must be signed in to change notification settings

nirabo/wut

 
 

Repository files navigation

wut

CLI that explains the output of your last command.

Just type wut and an LLM will help you understand whatever's in your terminal. You'll be surprised how useful this can be. It can help you:

  • Understand stack traces
  • Decipher error codes
  • Fix incorrect commands
  • Summarize logs

Demo

Installation

> pipx install wut-cli

Configuration

wut can be configured using either environment variables or a .env file in your project directory. Create a .env file based on the provided .env.example:

cp .env.example .env

Then edit the .env file to configure your preferred LLM provider:

OpenAI (Default)

OPENAI_API_KEY=your_openai_api_key_here
OPENAI_MODEL=gpt-4  # Optional, defaults to gpt-4
OPENAI_BASE_URL=  # Optional, for custom endpoints

Anthropic

ANTHROPIC_API_KEY=your_anthropic_api_key_here

Ollama (Local)

OLLAMA_MODEL=your_ollama_model_name  # e.g., llama2
OLLAMA_HOST=http://localhost:11434  # Optional, defaults to http://localhost:11434

Additional Settings

DEBUG=true  # Enable verbose output

You must configure at least one LLM provider. If multiple providers are configured, wut will use them in the following order of preference: OpenAI > Anthropic > Ollama.

Usage

wut must be used inside a tmux or screen session to capture the last command's output. To use it, just type wut after running a command:

> git create-pr
git: 'create-pr' is not a git command.
> wut

You'll quickly get a brief explanation of the issue:

This error occurs because Git doesn't have a built-in `create-pr` command.
To create a pull request, you typically need to:

1. Push your branch to the remote repository
2. Use the GitHub web interface

If you have a specific question about your last command, you can include a query:

> brew install pip
...
> wut "how do i add this to my PATH variable?"

Development

Setup

  1. Clone the repository:
git clone https://github.com/shobrook/wut.git
cd wut
  1. Create a virtual environment and install dependencies:
make install-dev
  1. Activate the virtual environment:
source .venv/bin/activate  # On Windows: .venv\Scripts\activate

Development Commands

  • Format code:
make format
  • Run linters:
make lint
  • Run tests:
make test
  • Run all checks:
make check
  • Generate documentation:
make docs

Adding Dependencies

  1. Add new packages to requirements.txt or requirements-dev.txt
  2. Update your virtual environment:
make install-dev

Building and Publishing

  1. Build the package:
make publish-test  # For TestPyPI
make publish      # For PyPI

Cleaning Up

Remove build artifacts and virtual environment:

make clean

Roadmap

  1. If possible, drop the requirement of being inside a tmux or screen session.
  2. Add a --fix option to automatically execute a command suggested by wut.
  3. Add wut to Homebrew.
  4. Make some unit tests.

About

An terminal assistant for the hopelessly confused

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 92.5%
  • Makefile 7.5%