Package Exports
- llm-code-fixer
- llm-code-fixer/main.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (llm-code-fixer) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
LLM Code Fixer
An AI-powered tool that uses vector stores and LLMs (via OpenAI) to automatically detect and fix bugs in JavaScript codebases. It supports syntax, runtime, and logic errors, with an interactive CLI for providing extra context.
Installation
Install globally for CLI access:
npm install -g llm-code-fixerSet your OpenAI API key:
export OPENAI_API_KEY=your-api-key-here # On Windows: set OPENAI_API_KEY=your-api-key-hereUsage
Run the CLI to fix a buggy file:
fix-code <path-to-buggy-file>- You'll be prompted for error logs and instructions (optional but recommended for better fixes).
- The tool will iteratively fix issues (up to 5 rounds) and output the result.
- Backups of original files are saved in your temp directory (e.g.,
/tmp/llm_fixesor%TEMP%\llm_fixes).
Example
fix-code buggy.jsPaste errors/instructions when prompted, e.g.:
Errors: ReferenceError: x is not defined
Instructions: Add default values for variables.Inline Usage
Import and use in your code:
import { tryq, fixAndTestFile } from 'llm-code-fixer';
// Wrap a function to auto-fix errors
await tryq(myBuggyFunction);Dependencies
Required: OpenAI API key.
Optional: faiss-node for faster vector search (npm install faiss-node).
License
MIT
Development
Install Dependencies Locally (for Testing)
In the llm-code-fixer directory:
npm installTest the CLI Locally
node fix-cli.js <path-to-some-buggy-file>