The cache path and .gitignore were read from the working directory: a
scan of a copy replaced the repository's cache with the copy's entries,
keyed bios/... like the real ones, and the next run rehashed everything.
Both now come from the tree holding bios/, and kept release assets are
restored under it.
dedup ranked copies by path_priority (variant, MAME, Arcade, length) while the scan picked the primary by _takes_primary (variant, emulator tree, walk order). Given sms.rom under bios/Other/zesarux/ and bios/Sega/Master System/, dedup removed the indexed copy and kept the foreign-tree one the resolver sets aside. Both now read collection.scan.primary_rank. The rank reproduces every primary of the current database.json, so the index does not move; dedup's tie-break follows the walk order instead of MAME and path length.
collect_all_aliases opened platforms/ and emulators/ from paths fixed to
the working directory while declarations took them as parameters, so a
build walked every YAML twice. read_declarations now reads both once,
reports unreadable sources, and hands the alias pass and the proven-name
index their entries. generate_db gains --platforms-dir and
--emulators-dir and refuses a missing one.
preserve_large_file_entries mixed the keep-or-drop rule with a download,
a write into bios/ and a SystemExit. The rule is now surviving_entries,
the restore a separate step that receives offline, and read_database
raises DatabaseUnreadable that the build turns into exit 1. generate_db
gains --offline, which pipeline --offline passes to step 1.
generate_db, generate_games_index, download, romset_recipes, validate_pr and list_platforms keep only main and build_parser: the database build goes to collection.run, the games index run to games.run, the pack info and its no-pack message to release.packinfo, the capture and build runs to romrecipes.runs, the file selection to resolve.reviewfiles. Tests reach the moved code through those packages.