cwhy  by plasma-umass

CLI tool explains compiler errors and suggests fixes

created 2 years ago
296 stars

Top 90.6% on sourcepulse

GitHubView on GitHub
Project Summary

This project provides AI-powered explanations and suggested fixes for compiler errors across numerous programming languages, including C, C++, C#, Go, Java, LaTeX, PHP, Python, Ruby, Rust, Swift, and TypeScript. It targets developers seeking to understand and resolve complex compilation issues more efficiently.

How It Works

CWhy acts as a wrapper around compilers. When a compilation error occurs, it captures the error message and context, then sends this information to a specified Large Language Model (LLM) via an OpenAI-compatible API. The LLM analyzes the error and generates a human-readable explanation and a code snippet with a suggested fix. This approach leverages the advanced natural language understanding and code generation capabilities of LLMs to demystify compiler errors.

Quick Start & Requirements

  • Install via pip: python3 -m pip install cwhy
  • Requires an OpenAI API key set as the OPENAI_API_KEY environment variable.
  • Supports alternative LLMs via OPENAI_BASE_URL (e.g., Ollama) or LiteLLM Proxy.
  • Usage involves prefixing compiler commands with cwhy -- or using --wrapper for build tool integration.
  • Official documentation: https://github.com/plasma-umass/cwhy

Highlighted Details

  • Supports a wide array of languages: C, C++, C#, Go, Java, LaTeX, PHP, Python, Ruby, Rust, Swift, TypeScript.
  • Offers flexibility in LLM choice, including OpenAI models (GPT-3.5, GPT-4) and local models via Ollama.
  • Provides a --wrapper mode for seamless integration with build systems like Make and CMake.
  • Includes a CWHY_DISABLE environment variable to bypass CWhy during configuration steps.

Maintenance & Community

The project is led by Emery Berger, Nicolas van Kempen, and Bryce Adelstein Lelbach. Further community engagement details are not explicitly provided in the README.

Licensing & Compatibility

The project is licensed under the MIT License, permitting commercial use and integration with closed-source projects.

Limitations & Caveats

CWhy's effectiveness is dependent on the quality of the LLM used and the clarity of the compiler error message. It requires an active internet connection and an OpenAI account with sufficient credits for API calls. Disabling CWhy during configuration steps is recommended to avoid unnecessary costs and processing.

Health Check
Last commit

3 weeks ago

Responsiveness

1 day

Pull Requests (30d)
0
Issues (30d)
0
Star History
9 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.