AI-powered CLI that reads test failures, finds the bug, generates a fix, and optionally commits it.
Your tests are red. You have a stack trace. You know the fix is probably one line. Let the AI find it.
git-heal --auto-run- Understands test runners - Auto-detects pytest, Jest, go test, cargo test. Parses their specific output formats to extract the exact error, file, and line.
- Builds smart context - Reads the failing file, traces imports to find related files, and sends only the relevant code to the LLM. No wasted tokens.
- Multiple LLM backends - OpenAI, Anthropic, or local Ollama. Use GPT-4o for speed, Claude for complex refactors, or Llama locally for free.
pip install git-heal
# Set your API key
export OPENAI_API_KEY=sk-...
# Auto-detect test runner, run tests, fix failures
git-heal --auto-run
# Paste an error directly
git-heal -e "TypeError: unsupported operand type(s) for +: 'int' and 'str'"
# Read error from file
git-heal -f test_output.log
# Use Claude instead of GPT
git-heal --auto-run -b anthropic
# Use local Ollama (free, no API key)
git-heal --auto-run -b ollama -m llama3.1
# Preview fix without applying
git-heal --auto-run --dry-run- Auto-detection: Detects pytest, Jest, go test, cargo test from project files
- Error parsing: Extracts error type, message, file, line number, and stack trace
- Import tracing: Follows import/require statements to include related source files
- Unified diff output: Generated fixes are standard unified diffs
- Interactive apply: Review the diff, apply it, run tests to verify, then commit
- Auto-commit mode:
--auto-commitfor CI/CD pipelines - Pipe-friendly:
pytest 2>&1 | git-healworks
Error Input (auto-run / paste / file / stdin)
|
v
Error Parser (pytest / jest / go / rust / generic)
|
v
Context Builder (source file + imports + stack trace)
|
v
LLM Fix Generator (OpenAI / Anthropic / Ollama)
|
v
Diff Applier (patch / git apply / manual)
|
v
Test Verifier (re-runs test suite)
|
v
Git Committer (optional)
| Runner | Detection | Error Parsing |
|---|---|---|
| pytest | pytest.ini, conftest.py, pyproject.toml |
Traceback, assertion errors, error type |
| Jest | jest.config.js, package.json |
Stack trace, expect/received |
| go test | go.mod |
File:line:message format |
| cargo test | Cargo.toml |
Compiler errors, test panics |
- Fork the repository
- Create a feature branch (
git checkout -b feature/new-parser) - Install dev dependencies:
pip install -e ".[dev]" - Add tests in
tests/ - Submit a pull request
MIT - see LICENSE for details.