diff --git a/init.lua b/init.lua index 4c80372..13914a4 100644 --- a/init.lua +++ b/init.lua @@ -98,4 +98,35 @@ function M.generate_topology_block(manifest, engine_calls) return table.concat(lines, "\n") end +-- Validates README structure against MUST-sections for the given tier. +-- Tier "core" enforces: H1, Abstract, Badges-Table, Topology-Block, API, References. +-- Tier "community" enforces nothing (returns empty result). +-- Returns: { missing_sections = [...], section_order_ok = bool } +function M.validate_readme_structure(markdown_string, tier) + if tier ~= "core" then + return { missing_sections = {}, section_order_ok = true } + end + + local missing = {} + local checks = { + { name = "H1", pattern = "^#%s+%S" }, + { name = "Badges-Table", pattern = "\n|%s*Field%s*|" }, + { name = "Topology-Block", pattern = "