MCPcopy Create free account
hub / github.com/cortex-js/compute-engine / compileRuleDocs

Function compileRuleDocs

src/compute-engine/rubi/compile.ts:240–256  ·  view source on GitHub ↗
(
  ce: ComputeEngine,
  docs: RubiRuleDoc[]
)

Source from the content-addressed store, hash-verified

238 };
239}
240
241/** Compile an ordered list of corpus rule-docs into match-ready rules,
242 * preserving document/rule order as the dispatch priority. This is the
243 * shippable, fs-free core consumed by both the bundled `loadIntegrationRules`
244 * loader and the Node `compileSection` fs wrapper (`scripts/rubi/compile.ts`). */
245export function compileRuleDocs(
246 ce: ComputeEngine,
247 docs: RubiRuleDoc[]
248): CompileResult {
249 const rules: CompiledRule[] = [];
250 const skipped: CompileResult['skipped'] = [];
251 let priority = 0;
252 for (const doc of docs) {
253 for (const r of doc.rules) {
254 const id = `${doc.file}#${r.index}`;
255 const { rule, reason } = compileRule(ce, r, id, priority++);
256 if (rule) rules.push(rule);
257 else skipped.push({ id, reason: reason! });
258 }
259 }

Callers 4

loadIntegrationRulesFunction · 0.90
mainFunction · 0.90
compileSectionFunction · 0.90

Calls 1

compileRuleFunction · 0.85

Tested by

no test coverage detected