// Planu — Out-of-scope suggester (SPEC-612)
import { createRequire } from 'module';
const require = createRequire(import.meta.url);
function loadRegistry() {
    return require('../../config/out-of-scope-suggestions.json');
}
/**
 * Suggest out-of-scope items based on a spec description.
 * Matches against a registry of topic keywords and returns relevant suggestions
 * plus a generic fallback list.
 */
export function suggestOutOfScope(description) {
    const registry = loadRegistry();
    const lower = description.toLowerCase();
    const topicSuggestions = [];
    for (const [topic, entry] of Object.entries(registry.topics)) {
        const matched = entry.keywords.some((kw) => lower.includes(kw));
        if (matched) {
            topicSuggestions.push({ topic, suggestions: entry.suggestions });
        }
    }
    const genericSuggestions = registry.generic;
    const topicFlat = topicSuggestions.flatMap((ts) => ts.suggestions);
    const allSuggestions = [...topicFlat, ...genericSuggestions];
    return { topicSuggestions, genericSuggestions, allSuggestions };
}
//# sourceMappingURL=suggester.js.map