scmJS docs

In the source

For developers. The archive and the scenario are under src/formats/mpq/ and src/formats/chk/, and the file-level policy is in src/editor/:

File Does
src/formats/mpq/scm.ts Opens and writes the archive over mopaq: finds the scenario, accepts a bare .chk, reports how the member was stored, keeps the other members.
src/formats/mpq/stored.ts A member kept as it was stored: the methods its sectors use, the stored form remembered with the bytes it decodes to, and a stored member moved to another place in the archive with the key that place needs.
src/formats/chk/reader.ts Reads the run of sections: every occurrence in order, odd lengths, trailing bytes.
src/formats/chk/sections/registry.ts One entry per known section: how copies combine, its size, and which Save groups it belongs to.
src/formats/chk/scenario.ts The scenario model, reading and writing it, the revisions, and where a new section goes.
src/formats/chk/sections/*.ts The codecs for each kind of section.
src/formats/chk/create.ts File ▸ New, and the sections Check Map requires.
src/formats/text/encoding.ts The text encodings and how one is guessed.
src/editor/save.ts The save plan: what to keep, merging repeats, compression, and the dialog's warnings.
src/editor/mapBuild.ts, src/services/mapBuild.ts Built maps: packing, restoring the source on open, running the steps.
src/editor/sections.ts Section-level reads and writes for the Section Explorer plugin and api.document.sections.
src/editor/validate.ts Check Map.

development.md covers the tests and the conventions for changing any of this.