refactor(skill-lint): export only functions, keep policy state private

Per review: the policy collections (REQUIRED_SECTIONS, SECTION_EXEMPT_SKILLS,
SKILL_REF_PATTERNS, regexes) were exported by reference, so a consumer could
mutate shared state and change lint results process-wide. Export only the
linting functions; keep the policy collections private. No behavior change
(validator output byte-identical).
This commit is contained in:
Joan Leon
2026-07-10 20:05:41 +02:00
parent 94eb14c74b
commit 495b5a830f
+4 -6
View File
@@ -217,13 +217,11 @@ function lintSkill(dirName, skillsDir, knownSkills) {
return lintSkillContent(dirName, content, knownSkills);
}
// Export only the linting functions. The policy collections (REQUIRED_SECTIONS,
// SECTION_EXEMPT_SKILLS, SKILL_REF_PATTERNS, and the regexes) stay private so a
// test or future consumer cannot mutate shared state and change lint results for
// the rest of the process. Exercise the rules through these functions.
module.exports = {
MAX_DESCRIPTION_LENGTH,
KEBAB_CASE,
DESCRIPTION_TRIGGER,
REQUIRED_SECTIONS,
SECTION_EXEMPT_SKILLS,
SKILL_REF_PATTERNS,
parseFrontmatter,
extractSkillReferences,
lintSkillContent,