feat(launcher): cache manifest.launcher.md per module on init

manifest_loader.load_for(id) reads <install>/modules/<id>/
manifest.launcher.md via engine.module.read_file, runs the JSON
frontmatter through frontmatter.parse, and pre-parses the body via
markdown.parse. Cached on the shared ctx so the detail-panel render
loop does not pay the parse cost per frame. Missing files degrade to
{_missing=true} and the list falls back to the module's name/id.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Calic
2026-06-11 01:58:38 +02:00
parent f2b2a8859b
commit d63dd91bb6
2 changed files with 42 additions and 1 deletions

View File

@@ -5,7 +5,8 @@ local depf = require("lib-management.dep-fetcher")
-- resolves declared lib-deps, so multi-file modules use dofile +
-- engine.module.dir_of.
local MODULE_DIR = engine.module.dir_of("lib-management.launcher")
local fsm = dofile(MODULE_DIR .. "/fsm.lua")
local fsm = dofile(MODULE_DIR .. "/fsm.lua")
local manifest_loader = dofile(MODULE_DIR .. "/manifest_loader.lua")
local function require_panel(name)
return dofile(MODULE_DIR .. "/panels/" .. name .. ".lua")
@@ -199,6 +200,15 @@ function init(ctx)
}
end
-- L.3: load + cache manifest.launcher.md for each module. Missing
-- files degrade gracefully (meta._missing=true) so the list-panel
-- falls back to name/id.
for _, entry in ipairs(ctx_panels.module_entries) do
local meta, blocks = manifest_loader.load_for(entry.id)
ctx_panels.manifest_cache[entry.id] = { meta = meta, blocks = blocks }
entry.summary = meta.summary
end
local wy, hy = engine.render.measure_text(YES_LABEL, FONT_BUTTON)
local wn, hn = engine.render.measure_text(NO_LABEL, FONT_BUTTON)
local qbtn_w = math.max(wy, wn) + 2 * PAD_X