Package Exports
- @guardrail-ai/fixer
- @guardrail-ai/fixer/dist/index.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 (@guardrail-ai/fixer) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
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