Project

llm_fixer

0.0
The project is in a healthy, maintained state
A tool that uses LLM to automatically fix errors detected by static analysis tools (such as RuboCop).
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

Runtime

 Project Readme

LLM fixer

A tool that automatically fixes static analysis errors.

Installation

Add this line to your Gemfile:

gem 'llm_fixer'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install llm_fixer

Environment Variables

You can customize the behavior using the following environment variables:

  • LLM_API_KEY : LLM API key
  • LLM_API_BASE : Base URL for the LLM API
  • LLM_MODEL : LLM model to use

Usage

Set the environment variables:

ChatGPT

export LLM_API_KEY="your-api-key-here"
export LLM_API_BASE="https://api.openai.com/v1"
export LLM_MODEL="gpt-4o"

Google Gemini

export LLM_API_KEY="your-api-key-here"
export LLM_API_BASE="https://generativelanguage.googleapis.com/v1beta"
export LLM_MODEL="gemini-2.0-pro-exp"

Local(LM Studio)

export LLM_API_KEY="n/a"
export LLM_API_BASE="http://localhost:1234"
export LLM_MODEL="tinyswallow-1.5b-instruct"

Run your static analysis tool command (e.g., RuboCop):

llm_fixer fix your-lint-or-test-command path/to/target

# RuboCop example
llm_fixer fix bundle exec rubocop path/to/target.rb

# With additional prompt to guide the LLM
llm_fixer fix --additional-prompt "Follow the style guide and use double quotes" bundle exec rubocop path/to/target.rb
# or using the short form
llm_fixer fix -a "Follow the style guide and use double quotes" bundle exec rubocop path/to/target.rb

The --additional-prompt (or -a) option allows you to provide additional instructions to the LLM when fixing errors. This can be useful when you want to customize the style or approach used for fixes.