// engine/feasibility-rules-loader.ts — Config loader for feasibility-validator (SPEC-213)
//
// Provides the 3-layer configurable keyword rules using ConfigLoader.
// Layer 1: src/config/feasibility-rules.json — system defaults
// Layer 2: data/global/feasibility-rules-custom.json — global overrides
// Layer 3: data/projects/{hash}/config/feasibility-rules-overrides.json — project overrides
import { z } from 'zod';
import { ConfigLoader } from './config-loader.js';
// ── Schema ────────────────────────────────────────────────────────────────────
const feasibilityRuleSchema = z.object({
    id: z.string().min(1).describe('Unique identifier for this rule group'),
    category: z
        .enum(['feature', 'performance', 'security', 'cheap', 'offline', 'realtime'])
        .describe('Category of keywords. Valid values: feature, performance, security, cheap, offline, realtime'),
    keywords: z
        .array(z.string().min(1))
        .min(1)
        .describe('List of keyword strings to match in requirements text (case-insensitive)'),
});
const feasibilityRulesSchema = z
    .array(feasibilityRuleSchema)
    .describe('List of keyword rule groups for feasibility validation');
// ── Loader instance ───────────────────────────────────────────────────────────
const loader = new ConfigLoader('feasibility-rules', feasibilityRulesSchema);
/**
 * Load the merged feasibility keyword rules for a given project.
 * Falls back to system defaults when no overrides exist.
 */
export function loadFeasibilityRules(projectHash) {
    return loader.load(projectHash);
}
/**
 * Extract keywords for a specific category from the loaded rules.
 * Returns an empty array if no rule exists for the category.
 */
export function getKeywordsByCategory(rules, category) {
    return rules.find((r) => r.category === category)?.keywords ?? [];
}
//# sourceMappingURL=feasibility-rules-loader.js.map