UNPKG

@felixgeelhaar/cclint

Version:

Catch CLAUDE.md drift before Claude misbehaves. Lints CLAUDE.md, skills, subagents, and hooks for Claude Code projects.

52 lines 2.46 kB
import type { Rule } from '../../domain/Rule.js'; import type { CclintConfig } from '../../domain/Config.js'; import { type RuleMetadata } from './ruleMetadata.js'; /** * The single canonical description of a built-in rule. * * @remarks * Before this existed, adding a rule meant editing ~7 unrelated places: * every construction site (CLI `lint`, `watch`, `why`, the MCP server, the * GitHub Action), the `defaultConfig` enabled flags, the per-id metadata * table, and a hardcoded class-name allow-list in the registry. A descriptor * co-locates all of that so a new rule is added in exactly one place and every * entry point stays in lock-step (see {@link createRules}). */ export interface RuleDescriptor { /** Stable rule id, matching `Rule.id` and the metadata key. */ readonly id: string; /** * Whether the rule runs when a config does not mention it at all. * * @remarks * Encodes the historical per-rule default: core rules present in * `defaultConfig` (file-size, structure, format, …) were gated on an * explicit `enabled` flag (default off when the key is absent), whereas the * later opt-out rules ran unless explicitly disabled (default on). */ readonly defaultEnabled: boolean; /** Documentation/tooling metadata for `explain`, `why`, and SARIF output. */ readonly metadata: RuleMetadata; /** Construct the rule, wiring per-rule options out of the resolved config. */ create(config: CclintConfig): Rule; /** * Optional bespoke enabled-resolution for rules that cannot be expressed by * the standard `config.rules[id].enabled ?? defaultEnabled` rule — e.g. a * backward-compatible config alias. */ isEnabled?(config: CclintConfig): boolean; } /** * All built-in rule descriptors, in execution order. * * @remarks * The order here is the order violations are produced by every entry point, so * keep it stable. This array is the one place to touch when adding, removing, * or reconfiguring a built-in rule. */ export declare const RULE_DESCRIPTORS: readonly RuleDescriptor[]; /** Resolve whether a descriptor's rule is enabled under the given config. */ export declare function isRuleEnabled(descriptor: RuleDescriptor, config: CclintConfig): boolean; /** The set of built-in rule ids, derived from the descriptor list. */ export declare function getBuiltinRuleIds(): Set<string>; //# sourceMappingURL=ruleDescriptors.d.ts.map