Metadata-Version: 2.5
Name: explain-error
Version: 0.1.1
Summary: Paste a stack trace or error log, get the root cause and a fix - any language.
Requires-Python: >=3.9
Requires-Dist: anthropic>=0.34
Requires-Dist: pydantic>=2.0
Requires-Dist: rich>=13.0
Requires-Dist: typer>=0.12
Description-Content-Type: text/markdown

# Error Explainer CLI

A pip-installable CLI that turns a stack trace or error log into a plain-English
root cause and a concrete fix. Works on any language's traceback format — it's
just text in, structured answer out.

![explain-error demo](https://raw.githubusercontent.com/HibaIBegum/Explain-Error-CLI/main/explain-error-demo.gif)

## Why it's built this way

**No language-specific parsing.** The raw text goes straight to Claude with a
prompt that just says "here's an error, find the cause" — an LLM is already
better at pattern-matching across languages than a hand-rolled parser would
be, so Go, Rust, or a raw application log work the same way Python does.

**Structured output, validated before it's shown.** The prompt asks for a
fixed JSON shape, and the response is validated with pydantic before
anything gets printed — if it doesn't parse, the CLI says so explicitly
instead of printing something malformed.

**Tail-truncated, not head-truncated, on long input.** Logs can be huge, but
the actual exception is almost always at the bottom. Past ~12,000 characters
the input is trimmed from the front, keeping the part that matters.

## Installing

```bash
pip install -e .
export ANTHROPIC_API_KEY=sk-ant-...
```

## Using it

```bash
explain-error examples/python_traceback.txt   # try it on the bundled example
explain-error app.log                         # or your own file
cat app.log | explain-error                   # or from stdin
explain-error app.log --json                  # machine-readable output
```

## What this doesn't do (on purpose, for v0)

- **No caching.** The same traceback run twice makes two API calls.
- **No source context.** It only sees the log text — it can't go read the
  actual file the error points to.
- **Single-turn only.** One input, one answer, no follow-up questions.
