@guardrail-ai/fixer
v0.2.2
Published
AST-based auto-fix engine for Guardrail
Maintainers
Readme
@guardrail-ai/fixer
AST-based auto-fix engine for Guardrail. Applies fixes from rule violations and outputs unified diffs.
Install
npm install @guardrail-ai/fixerUsage
import { FixerEngine } from '@guardrail-ai/fixer';
const fixer = new FixerEngine();
// Dry run — returns diff without writing
const result = await fixer.applyFixes(filePath, violations, false);
console.log(result.diff);
console.log(`${result.applied} fixes applied`);
// Write fixes to disk
await fixer.applyFixes(filePath, violations, true);How it works
- Sorts fixes bottom-to-top to preserve line numbers
- Applies line-based replacements from violation fix suggestions
- Generates unified diffs via the
diffpackage - Optionally writes the fixed file to disk
License
MIT
