10. Layout and registration
- [E] Core in layers, entries as feature folders:
src/core/ economy, settle, battle, flight, components/src/features/<key>/ entry.ts, texts.de.ts, *.server.ts, *.test.tssrc/features/missions/<m>/ rules.ts, texts.de.ts, arrive.server.ts, *.test.tssrc/features/index.gen.ts generated index, not checked insrc/features/index.server.gen.ts generated server index (#116), not checked insrc/server/ http, db/repos, game (commands)src/client/ state, components (generic), views- [E] The core folder is
src/core: #112 renamessrc/sharedtosrc/corein one pull request that changes every import (owner, 2026-11-13). - [E] The index of all features is generated by a script and not
checked in (
.gitignore). The script runs beforestart,test,typecheck,buildand in the Dockerfile, chained explicitly in the scripts ofpackage.json(node scripts/gen-features.ts && …), not aspre*scripts or tool hooks (owner, 2026-11-13, #112). Reason: the server runs without a bundler (node src/server/main.ts), so there is no glob import, and a checked-in generated file still collides between parallel pull requests. - [E] Built with #112: the folders
src/features/andsrc/features/missions/exist (.gitkeep); no entry has moved yet. Since #114 every catalog entry has its folder withentry.ts, since #113 also withtexts.de.ts.scripts/gen-features.tswritessrc/features/index.gen.tswithENTRIES(each<key>/entry.ts), since #113TEXTS(each<key>/texts.de.ts), andMISSIONS(eachmissions/<m>/rules.ts) as lists of[key, module]pairs sorted by key. A list, not an object, because knip counts a module passed on as a whole as used. A folder without its file, or whose name is not a key, stops the script. The*.server.tsparts are not in this index, because the browser uses it too; their registry comes with the first server part (#116). The script writes only when the index changed, through a temporary file and a rename. - [E] Built with #112, where the index is written first: the scripts
start,cli,build,typecheck,test,test:watch,test:coverage,test:mutation,lint:dead,lint:depsandcheck; the two E2E server starts (playwright.config.ts); the Dockerfile throughpnpm build, and the image copiessrc/features; the CI jobs through these scripts (the nightly upgrade test runspnpm test <file>). - [E] Built with #112: Vitest coverage and the Stryker
mutateglobs measuresrc/featuresand leave the generated index out; knip takes the index as an entry; jscpd skips it through.gitignore; Vite needs no setting, it follows the imports. The changelog check countssrc/featuresas game code. - [V] If the generated index turns out to be a burden, the fallback is a hand-kept index, sorted, one line per entry.
- [E] Decided for #116 (owner, 2026-11-14):
gen-featuresalso writessrc/features/index.server.gen.tswithMISSION_SERVERS, not checked in (.gitignore) likeindex.gen.ts; each mission folder needs itsarrive.server.ts; onlysrc/serverimports the server index. The typeMissionis derived from the generated index as a type only, as long asno-circularallows it. - [E] Built with #116: a mission folder needs
rules.ts,texts.de.tsandarrive.server.ts, else the script stops;index.gen.tsaddsMISSION_TEXTSbesideMISSIONS;generateServerwritesindex.server.gen.ts(MISSION_SERVERS, eachmissions/<m>/ arrive.server.ts), which the script writes with the other index; knip takes it as an entry, Vitest coverage and Stryker leave it out, the Dockerfile copies it withsrc/features.Missioninsrc/core/types.tsis(typeof MISSIONS)[number][0]throughimport type: the cycles it closes (types.ts→ index →rules.ts→missions.ts) all run through a type-only import, whichno-circulardoes not count, so the rule passes unchanged. - [V] Built with #285 (Lexicanum): an entry folder and a mission
folder hold a
lexicon.de.ts, what the entry or mission adds to its article (the guards ask for keywords in every one, owner, 2026-11-17).gen-featureslists these files in a third index,src/features/lexicon.gen.ts(LEXICONandMISSION_LEXICON, not checked in), which onlysrc/core/lexicon/imports (rulelexicon-index-in-lexicon), so the parts load with the chunk of the Lexicanum and not with the start bundle (#242). Knip takes it as an entry, Vitest coverage and Stryker leave it out; Stryker leaves thelexicon.de.tsfiles out like the text files (see Lexicanum).