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

@ -97,6 +97,7 @@
#include "cli_audit_tree.hpp"
#include "cli_magic_fix.hpp"
#include "cli_bulk_validate.hpp"
#include "cli_bulk_json.hpp"
#include "cli_macros_catalog.hpp"
#include "cli_char_features_catalog.hpp"
#include "cli_pvp_catalog.hpp"
@ -257,6 +258,7 @@ constexpr DispatchFn kDispatchTable[] = {
handleAuditTree,
handleMagicFix,
handleBulkValidate,
handleBulkJson,
handleMacrosCatalog,
handleCharFeaturesCatalog,
handlePVPCatalog,