feat(dm2-cli): add repack --target raw-extract #281

Merged
jqueuniet merged 0 commits from refs/pull/281/head into main 2026-07-21 19:05:05 +02:00
jqueuniet commented 2026-07-21 15:54:37 +02:00 (Migrated from codeberg.org)

Closes the final open Phase 5 item on the roadmap.

What

A second repack target — the port-neutral complement to --target skwinspx:

dm2 repack --target raw-extract --out <dir> <source>

It recursively walks a DM2 install tree, recognizes every asset the toolchain can parse — graphics archives (incl. split second chunks), dungeons, FTL modules, Mac resource forks, music streams, routing tables, savegames, and Red Book CD-DA tracks, across all ports and byte orders — and copies each one verbatim into one flat output folder under its original basename (no engine-specific renaming).

  • Recognition is content-signature first, with a filename fallback only for the weak/headerless formats (dungeon.dat, split second chunks, routing tables, CD-DA tracks). The dispatch order mirrors dm2 info, so a dungeon.dat can't be misread as a savegame.
  • Requires a graphics archive and a dungeon in the tree. Missing core containers and case-insensitive output-name collisions abort with zero writes.
  • --dry-run prints the plan; --force overwrites a non-empty output dir. The success summary carries a per-kind breakdown.

The existing skwinspx target is unchanged (its run just drops an unused _target parameter).

Tests

  • Unit (run in CI): 7 recognizer + 7 planner tests.
  • Integration (5 CLI tests): recursive byte-identical gather, Mac resource-fork + dungeon, missing-core error, dry-run writes nothing, non-empty-out guard then --force. These need the git-ignored game-asset fixtures, so they skip in CI and were run locally — all pass.
  • Full workspace suite green (1310 tests, 0 failed).

Docs

ROADMAP Phase 5 row + checkbox flipped to done; both repack targets are documented in --help.

Closes the final open **Phase 5** item on the roadmap. ## What A second `repack` target — the port-neutral complement to `--target skwinspx`: ``` dm2 repack --target raw-extract --out <dir> <source> ``` It recursively walks a DM2 install tree, recognizes every asset the toolchain can parse — graphics archives (incl. split second chunks), dungeons, FTL modules, Mac resource forks, music streams, routing tables, savegames, and Red Book CD-DA tracks, across all ports and byte orders — and copies each one **verbatim** into one flat output folder under its **original basename** (no engine-specific renaming). - Recognition is content-signature first, with a filename fallback only for the weak/headerless formats (dungeon.dat, split second chunks, routing tables, CD-DA tracks). The dispatch order mirrors `dm2 info`, so a `dungeon.dat` can't be misread as a savegame. - Requires a graphics archive **and** a dungeon in the tree. Missing core containers and case-insensitive output-name collisions abort with **zero writes**. - `--dry-run` prints the plan; `--force` overwrites a non-empty output dir. The success summary carries a per-kind breakdown. The existing `skwinspx` target is unchanged (its `run` just drops an unused `_target` parameter). ## Tests - **Unit** (run in CI): 7 recognizer + 7 planner tests. - **Integration** (5 CLI tests): recursive byte-identical gather, Mac resource-fork + dungeon, missing-core error, dry-run writes nothing, non-empty-out guard then `--force`. These need the git-ignored game-asset fixtures, so they **skip in CI** and were run locally — all pass. - Full workspace suite green (1310 tests, 0 failed). ## Docs ROADMAP Phase 5 row + checkbox flipped to done; both `repack` targets are documented in `--help`.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
jqueuniet/dm2-tools!281
No description provided.