feat(api-discovery): add tier=engine for engine-repo lints
The engine repo has neither init.lua nor manifest.lib — it's a C codebase, not a Lua lib. Previously running --lint on it would fail with read errors. Add tier=engine: skips parse_lua_surface, parse_readme_api, and topology generation, runs only validate_readme_structure for structural compliance. Tier accepts a more flexible Badges pattern since engine uses fields like Version/License instead of Lib-ID. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
13
init.lua
13
init.lua
@@ -142,13 +142,17 @@ end
|
|||||||
|
|
||||||
-- Validates README structure against MUST-sections for the given tier.
|
-- Validates README structure against MUST-sections for the given tier.
|
||||||
-- Tier "core" enforces: H1, Abstract, Badges, Topology, Topology-Block, API, References.
|
-- Tier "core" enforces: H1, Abstract, Badges, Topology, Topology-Block, API, References.
|
||||||
|
-- Tier "engine" enforces the same MUST-sections, but the Badges check accepts
|
||||||
|
-- any bold key:value line (engine README has no Lib-ID; instead Version/License).
|
||||||
-- Tier "community" enforces nothing (returns empty result).
|
-- Tier "community" enforces nothing (returns empty result).
|
||||||
-- Returns: { missing_sections = [...], section_order_ok = bool }
|
-- Returns: { missing_sections = [...], section_order_ok = bool }
|
||||||
function M.validate_readme_structure(markdown_string, tier)
|
function M.validate_readme_structure(markdown_string, tier)
|
||||||
if tier ~= "core" then
|
if tier == "community" then
|
||||||
return { missing_sections = {}, section_order_ok = true }
|
return { missing_sections = {}, section_order_ok = true }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Both "core" and "engine" tiers use the same MUST-sections list.
|
||||||
|
-- Difference is handled upstream (engine tier skips parse_lua_surface etc.).
|
||||||
local missing = {}
|
local missing = {}
|
||||||
local checks = {
|
local checks = {
|
||||||
{ name = "H1", pattern = "^#%s+%S" },
|
{ name = "H1", pattern = "^#%s+%S" },
|
||||||
@@ -158,6 +162,13 @@ function M.validate_readme_structure(markdown_string, tier)
|
|||||||
{ name = "API", pattern = "\n##%s+API[%s\n]" },
|
{ name = "API", pattern = "\n##%s+API[%s\n]" },
|
||||||
{ name = "References", pattern = "\n##%s+References[%s\n]" },
|
{ name = "References", pattern = "\n##%s+References[%s\n]" },
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- Engine-tier: relax the Badges check (engine uses "Version", "License" etc.
|
||||||
|
-- instead of a "Lib-ID:" prefix — engine is not a lib).
|
||||||
|
if tier == "engine" then
|
||||||
|
checks[2] = { name = "Badges", pattern = "\n%*%*[%w%-]+:%*%*" }
|
||||||
|
end
|
||||||
|
|
||||||
for _, c in ipairs(checks) do
|
for _, c in ipairs(checks) do
|
||||||
if not string.find(markdown_string, c.pattern) then
|
if not string.find(markdown_string, c.pattern) then
|
||||||
table.insert(missing, c.name)
|
table.insert(missing, c.name)
|
||||||
|
|||||||
Reference in New Issue
Block a user