Kelsidavis-WoWee/tools/editor/cli_orphan_jsons.hpp
Kelsi f43b444056 feat(editor): add --orphan-jsons to find sidecars without binaries
Walks a directory recursively and flags every .wXXX.json sidecar
whose matching binary .wXXX is missing. Useful after deleting or
moving binary catalogs — the orphan JSON sidecars accumulate as
noise and may shadow re-imports if --bulk-import-json runs over
the tree (since import would re-create the binary from possibly
stale JSON).

Reports total sidecars / paired / orphan counts, lists orphan
paths with their expected binary, and suggests recovery
(re-import to recreate from JSON, or delete the orphan
sidecars). Returns exit 1 if any orphans found, so it composes
into shell pipelines and CI checks.

Companion to --bulk-export-json + --bulk-import-json: those two
go between binary <-> JSON; this one keeps the binary side
in sync. Suggested workflow:
    --bulk-export-json mydir   # generate sidecars
    git rm something.wsrg       # delete a binary
    --orphan-jsons mydir        # detects something.wsrg.json
                                 # is now orphaned

Reuses the same case-insensitive extension matcher as
--audit-tree and --magic-fix. CLI flag count 1017 -> 1018.

This is the 16th cross-format utility:
  --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
  --diff-tree / --orphan-jsons
2026-05-09 23:07:09 -07:00

11 lines
198 B
C++

#pragma once
namespace wowee {
namespace editor {
namespace cli {
bool handleOrphanJsons(int& i, int argc, char** argv, int& outRc);
} // namespace cli
} // namespace editor
} // namespace wowee