feat(editor): add --catalog-pluck cross-format entry lookup

New utility extracts a single entry by id from any
registered catalog format without dumping the whole file.
Useful when a catalog has hundreds of entries and you
only want to inspect one — e.g. "show me WBOS encounter
102" or "what's in WHRT bind 204".

Auto-detects format from the file's 4-byte magic, looks
up the registered --info-* flag in the format table,
spawns that handler as a subprocess with --json, then
filters the entries[] array to just the matching id. The
primary-key field is auto-discovered: prefers the first
*Id field that ISN'T a known foreign-key reference (mapId,
areaId, spellId, npcId, factionId, etc. — 25 known
external-ref names filtered out). Falls back to first
remaining *Id, then first numeric field.

Without the foreign-key filter, alphabetical key
iteration in nlohmann::json picks the wrong field — for
WHRT entries with both areaId and bindId, naive code
would identify by areaId and miss obvious lookups.
Caught during smoke-test and fixed before commit.

Output formats: terminal table (default) or --json.
Accepts file path with or without the .wXXX extension.
CLI flag count 1111 -> 1112.
This commit is contained in:
Kelsi 2026-05-10 00:37:53 -07:00
parent 8c0cab27be
commit 16454c57c4
6 changed files with 363 additions and 0 deletions

View file

@ -143,6 +143,7 @@
#include "cli_group_compositions_catalog.hpp"
#include "cli_hearth_binds_catalog.hpp"
#include "cli_server_broadcasts_catalog.hpp"
#include "cli_catalog_pluck.hpp"
#include "cli_quest_objective.hpp"
#include "cli_quest_reward.hpp"
#include "cli_clone.hpp"
@ -327,6 +328,7 @@ constexpr DispatchFn kDispatchTable[] = {
handleGroupCompositionsCatalog,
handleHearthBindsCatalog,
handleServerBroadcastsCatalog,
handleCatalogPluck,
handleQuestObjective,
handleQuestReward,
handleClone,