five-on-it / apps/tools/src/kit-library
apps/tools/src/kit-library
The kit library (npm run kits:export): every piece of the shared kits, the ones the generators place (apps/level-editor/assets/kits/<kit>.glb and <kit>.foi.json, every kit but a level's own, named test-* or main-*), described for the catalogue in packages/catalogue/src/kits.generated.json: its kit and id, kind and collider, its footprint and bounding box measured on its triangles in the game's frame (the glTF read by readKit, turned half a turn: +z the piece's front), its triangle count, tags, anchors (in the game's frame), breakable mass, roads, parts and look, and for a building with a flat roof the free places on it (roof-spots.ts). A piece whose sidecar gives no tags (the props, structures and terrain of most kits) gets tags derived from its kit, its kind and the words of its id (deriveTags), so a search finds it. The output is deterministic (keys sorted, numbers rounded, one piece per line), so an export of unchanged kits changes no byte, and the level gate (checkKitLibrary, in level:check) builds it again in memory and fails when the committed file drifts.