/** * Rule presets — the customer default vs the full `fragments` dogfood preset. * * Both are derived from the tier SSOT (`./tiers.ts`); neither re-lists rules. * * - **customer default** — Tier A on (inert until a contract is authored), * Tier B off, Fragments-internal rules excluded entirely. This is the * vocabulary-first, no-flood default a customer repo gets. * - **`fragments`** — every rule on, for Fragments' own internal scans. * * These produce the rule-config half of a `GovernanceConfig`. The hygiene * *policy facts* (e.g. `style.rawColors.forbid`, spacing scales) are a separate * config axis the customer default simply omits — so a Tier-B rule that gates on * a policy fact (raw-color/spacing/typography) stays inert regardless of its * config flag, and the customer default produces zero findings without a * contract. */ import { FRAGMENTS_INTERNAL_RULE_IDS, RULE_TIER, isContractTierRule, } from "./tiers.js"; export interface PresetRuleState { enabled: boolean; severity?: "error" | "warn" | "info"; } /** * Customer default rule states: Tier A enabled (self-gating on contract facts), * Tier B disabled, Fragments-internal rules omitted entirely. Feed directly to * `compileGlobalGovernanceFacts({ rules })` (with no hygiene `styles` config). */ export function customerDefaultRuleStates(): Record { const states: Record = {}; for (const ruleId of Object.keys(RULE_TIER)) { if (FRAGMENTS_INTERNAL_RULE_IDS.has(ruleId)) continue; states[ruleId] = isContractTierRule(ruleId) ? { enabled: true, severity: "warn" } : { enabled: false }; } return states; } /** * Full `fragments` preset rule states: every rule on. Includes the * Fragments-internal rules (e.g. `tokens/require-dual-fallback`) the customer * default excludes. */ export function fragmentsPresetRuleStates(): Record { const states: Record = {}; for (const ruleId of Object.keys(RULE_TIER)) { states[ruleId] = { enabled: true, severity: "warn" }; } return states; }