Developer tools dump stack traces, exit codes, and jargon. Figuring out *what to do next* often means searching the same Stack Overflow answers again.
| 1 | """Provider abstraction for future analysis backends.""" |
| 2 | |
| 3 | from __future__ import annotations |
| 4 | |
| 5 | from typing import Protocol, runtime_checkable |
| 6 | |
| 7 | from why_failed.models import ErrorMatch |
| 8 | |
| 9 | |
| 10 | @runtime_checkable |
| 11 | class ErrorProvider(Protocol): |
| 12 | """Analyze error text and optionally return a structured match. |
| 13 | |
| 14 | Version 1 ships only a local rules provider. Future optional |
| 15 | providers (e.g. local LLM) can implement this protocol without |
| 16 | changing the core pipeline. |
| 17 | """ |
| 18 | |
| 19 | def analyze(self, error: str) -> ErrorMatch | None: |
| 20 | """Analyze ``error`` and return a match, or None if unknown.""" |
| 21 | ... |