Repository navigation
Description
Plan 2026-08-30, closed 2026-09-12, shipped.
Goal
The scripts in moonlive/ are the standard library of the MoonLive engine, compile-tested on every build, and reached no device: adding one meant copying text from GitHub into the editor. The library is expected to grow to roughly ten times its size, and that is what the design has to survive.
Outcome
The device carries the names of every factory script and the content of none. A build step globs moonlive/** into a catalog header; the picker lists the whole library and marks what is not local; picking a marked script makes the browser fetch it from the repository at the firmware's own tag and post it to the device's file endpoint under /.moonlive. A user's edit forks the script into /moonlive, which resolves first, and deleting the fork reverts offline.
Decisions
- Flash the catalog, fetch the contents. A name costs about 12 bytes and a script about 800, so 270 scripts are 3 KB of flash against 220 KB of content. The stronger half: a device uses a handful, and one layout describes the rig it is wired to. Rejected: embedding every script (a tenth of the app slot, paid twice once copied to the filesystem); a separate LittleFS partition (
esp_https_otawrites the app partition only, and a partition table changes only over a cable); one bundle (all-or-nothing, 220 KB to use three); compressing what ships (the device links no inflater, and one costs about 3 KB of code plus a 32 KB window to save 15 KB). - Names only in the catalog. A one-line description each would cost 19 KB at 270 scripts; descriptions stay in the files.
- The browser fetches, not the device. The mechanism WLED-MM's arti-fx uses. It deletes a platform seam (TLS with a certificate bundle on ESP32, a TLS library or a shelled-out
curlon desktop), removes the internet requirement from the device, so a rig on an isolated network is served by the laptop looking at it, and reuses the hardened upload path.raw.githubusercontent.comsendsaccess-control-allow-origin: *; release assets send no CORS header, a further reason the content comes per file from the repository. - Pinned to the firmware's tag, falling back to
mainfor a development build: a script frommainmay use a builtin the running engine lacks, and that failure is a compile error the user can do nothing about. One direct URL per script: no GitHub API, no rate limit, no JSON. - Two directories, and the split is the point.
/.moonliveis written by the UI and dot-prefixed, so the File Manager hides it as it hides/.config;/moonliveis the user's and resolves first. Editing a factory script forks it, and un-editing is deleting the fork, a local operation at the moment a rig is on site. The cost is two files sharing a name, which the docs explain. - A firmware update changes nothing on purpose. A dropped catalog entry leaves the picker and the downloaded copy keeps working; an upstream change arrives only when the user deletes the local copy; a fork is never touched. A boot-time report of every missing script across the tree and the presets was rejected: parsing up to 64 presets and persisting the previous version, to repeat what the module card already says in red.
- Not done: a GitHub API, a bundle, a compression step, a partition change, a new emoji category in the module picker, a global restore.
Where it lives
| What | Home |
|---|---|
| The catalog step | catalog_scripts.cmake, catalog_scripts.py |
| The resolve order, the fork and the stale marks | MoonLiveScriptFile.h, MoonLiveScript.h |
| The picker and the browser fetch | app.js |
| What the picker shows before a download | MoonLive, a script says what it is |
| The compile sweep over every library script | testing.md |
Steps
- The catalog: a CMake step globbing
moonlive/**into a generated header of names and roles, wired in both build paths. - Resolve
/moonlivefirst, then/.moonlive. - The picker: catalog merged with both directories, a marker on what is not local, the browser fetch and the post to
/api/file, a failure selecting nothing. - Revert to factory: delete the fork, arm-then-confirm.
- Docs: the two directories, the download and the fork rule.
Shipped in
- Closed in 5e3fff7.
Still open
- IRAM, not flash, is the resource to watch: a compiled script lives in an
allocExecblock that competes with WiFi, and a user who discovers the library may run several scripted modules at once. Worth measuring on the 4 MB classic board with several scripted layers active.
Activity