Skip to main content

Module archive

Module archive 

Source
Expand description

Archive-level checks over raw zip bytes.

Single pass: walks every entry once, enforces safety + caps + the file-type whitelist, yields entries to downstream modules. Returns the config-file bytes separately from the markdown entries because downstream dispatch differs — config goes to validator::config, markdown goes to validator::strict + parse_markdown.

Structs§

ArchiveEntries
MarkdownEntry
One markdown file extracted from the archive. content is the raw UTF-8 body; BOM stripping is deferred to the strict checker so the raw bytes for offset reporting stay truthful.
SchemaFile
One schema-source file extracted from the archive’s .memstead/schema/ tree.

Functions§

extract_entries
Walk the archive, enforce archive-level rules, return entries in sorted path order. Fails with a typed ValidationError on any violation. Performs no I/O; reads from the provided byte slice.
to_package_files
Re-key an archive’s schema tree to the package-relative shape every sealed schema surface speaks (schema.yaml, types/<t>.yaml, schema-format.json) — the form memstead_schema::load_sealed_package reads and the form the local schema source is written in. Files outside the .memstead/schema/ tree cannot appear here (the extractor filters them), so the strip is total in practice; anything unprefixed is passed through unchanged rather than silently dropped.