Package Exports
- @guardrail-ai/core
- @guardrail-ai/core/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/core) 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/core
Core rule engine, AST parser, file discovery, and types for Guardrail.
Install
npm install @guardrail-ai/coreUsage
import { GuardrailEngine, parseSource } from '@guardrail-ai/core';
const engine = new GuardrailEngine({ severityThreshold: 'warning' });
engine.registerRules(myRules);
const summary = await engine.scan('./src');
console.log(`Found ${summary.totalViolations} issues`);API
GuardrailEngine— Main scanning engine. Register rules, scan files/directories.parseSource(source, filePath)— Babel AST parser with TypeScript/JSX support.discoverFiles(path, config)— Glob-based file discovery with ignore patterns.loadConfig(searchFrom?)— Load.guardrailrc.jsonorguardrail.config.jsvia cosmiconfig.ScanCache— Content-hash based file caching for incremental scans.
Types
interface Rule {
id: string;
name: string;
description: string;
severity: 'critical' | 'high' | 'warning' | 'info';
category: 'security' | 'performance' | 'quality' | 'ai-codegen';
detect(context: RuleContext): Violation[];
}License
MIT