UNPKG

@felixgeelhaar/cclint

Version:

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

35 lines 1.39 kB
import { ContextFile } from '../domain/ContextFile.js'; import { Violation } from '../domain/Violation.js'; import { Location } from '../domain/Location.js'; import { Severity } from '../domain/Severity.js'; export class StructureRule { id = 'structure'; description; requiredSections; constructor(requiredSections = [ 'Project Overview', 'Development Commands', 'Architecture', ]) { this.requiredSections = requiredSections; this.description = `File must contain required sections: ${requiredSections.join(', ')}`; } appliesTo(file) { return file.isClaudeMarkdown(); } lint(file) { const violations = []; for (const requiredSection of this.requiredSections) { if (!file.hasSection(requiredSection)) { violations.push(new Violation(this.id, `Missing recommended section: "${requiredSection}"`, // Advisory by default: a CLAUDE.md that organises its content under // different headings is valid, so a missing recommended section // must not fail the build. Raise to error via // config.rules.structure.severity to enforce a house style. Severity.WARNING, new Location(1, 1))); } } return violations; } } //# sourceMappingURL=StructureRule.js.map