ADDED Requirements
Requirement: The app SHALL load local CommonJS mods through a validated manifest
The mod loader SHALL load local CommonJS source and read its module.exports object containing a required manifest (id, name, and semantic version), one or more levels, and optional vocabulary and palette records. The host SHALL validate the complete export before registering any content and SHALL keep built-in content available when a mod fails validation.
Scenario: A valid mod registers a level
- WHEN a local module exports a valid manifest, level definition, vocabulary, and palette
- THEN the loader registers its level and uses its palette for noun presentation under that mod id
Scenario: A malformed mod is rejected
- WHEN a module has no id, duplicate identifiers, invalid coordinates, or unsupported vocabulary values
- THEN the loader rejects it with a diagnostic and does not partially register its content
Requirement: Mods SHALL use the host engine contract
Mods SHALL define vocabulary, palette, and level data through the exported object. Mods SHALL NOT directly mutate the active rule table, DOM, renderer scheduler, or persisted engine state; the host SHALL pass validated level data to the engine.
Scenario: A mod adds a noun and emoji
- WHEN a manifest declares noun
KEKEand its emoji representation - THEN levels from that mod can place
KEKEobjects and the presentation uses the declared mapping
Scenario: A mod cannot bypass the engine state contract
- WHEN a mod supplies malformed level state or attempts to change state through data outside the documented manifest fields
- THEN the host registers only validated manifest, vocabulary, palette, and level data and keeps engine state under host control
Requirement: Mod loading SHALL be deterministic for the local MVP
The loader SHALL run local mods with the host's documented CommonJS compatibility layer, allow only the host's supported helper import, and avoid URL or package resolution. Module execution and validation errors SHALL be isolated to the affected mod and shown in diagnostics.
Scenario: A mod error does not break built-in play
- WHEN a local module throws while loading or requests an unsupported import
- THEN the app reports the mod error and keeps built-in levels playable