feat(editor): add --bulk-export-json + --bulk-import-json paired utilities

Two new cross-format utilities for git-friendly catalog editing:

  --bulk-export-json <dir>  recursively walks the tree, peeks
                            each file's magic, and dispatches the
                            per-format --export-X-json flag for
                            every .w* it finds. Writes one .json
                            sidecar per binary.

  --bulk-import-json <dir>  inverse direction — recursively walks
                            *.wXXX.json sidecars and dispatches
                            the per-format --import-X-json flag
                            to write back the byte-identical
                            binary.

Both report total / processed / failed / skipped counts and exit
1 on any failure. Asset-style formats with no per-format JSON
exporter are counted in the "skipped" bucket.

Use case — git-friendly diffs of binary catalogs:
    --bulk-export-json mydir              # convert binaries to JSON
    git add mydir/*.json && git commit    # version control as text
    git diff                              # see exact catalog changes
    --bulk-import-json mydir              # restore binaries

Verified end-to-end: 5 different format presets (WSRG, WCDF,
WMAT, WTLE, WCTR) round-trip byte-identical through export -> JSON
-> import. Reuses the same shellQuote / WEXITSTATUS scaffolding
as --bulk-validate. CLI flag count 972 -> 974.

This brings the cross-format utility count to 14:
  --list-formats / --info-magic / --summary-dir / --rename-by-magic
  --bulk-rename-by-magic / --touch-tree / --tree-summary-md
  --catalog-grep / --diff-headers / --audit-tree / --magic-fix
  --bulk-validate / --bulk-export-json / --bulk-import-json
This commit is contained in:
Kelsi 2026-05-09 22:35:12 -07:00
parent 4426f26f79
commit 736ec3a1c0
6 changed files with 305 additions and 0 deletions

View file

@ -1371,6 +1371,10 @@ void printUsage(const char* argv0) {
std::printf(" Auto-rename files whose extension doesn't match their magic to the canonical extension. Default is dry-run; pass --apply to commit. Skips collisions where the target already exists. Natural follow-up to --audit-tree\n");
std::printf(" --bulk-validate <dir> [--json]\n");
std::printf(" Recursively run each format's --validate-X validator across every recognized .w* file. Reports per-file pass/fail counts; lists failure paths. Asset formats with no validator are skipped. Exit 1 if any failure\n");
std::printf(" --bulk-export-json <dir> [--json]\n");
std::printf(" Recursively export every recognized .w* file to its JSON sidecar via the per-format --export-X-json flag. Useful for git-friendly diffs of binary catalogs. Exit 1 if any failure\n");
std::printf(" --bulk-import-json <dir> [--json]\n");
std::printf(" Recursively import every .wXXX.json sidecar back to its binary .w* form via the per-format --import-X-json flag. Inverse of --bulk-export-json. Exit 1 if any failure\n");
std::printf(" --gen-animations <wani-base> [name]\n");
std::printf(" Emit .wani starter: 5 essential animations (Stand / Walk / Run / Death / AttackUnarmed) with fallback chains\n");
std::printf(" --gen-animations-combat <wani-base> [name]\n");