feat(catalog-sync): add import, reconcile, sprite-id and offer steps
CI / check (push) Successful in 37s
CI / tests-unit (push) Successful in 2m3s
CI / tests-ui (push) Successful in 2m52s
CI / tests-integration (push) Successful in 2m54s
CI / preflight (push) Skipped
CI / tests-imaging-browsers (push) Failing after 3m23s
CI / deploy (push) Successful in 3m3s
CI / tests-quality (push) Successful in 6m8s

The CLI could audit and repair what already existed, but adding furniture
present at a source was still only possible from the admin UI item by item. The
repo already ships every piece of that pipeline, so wire them together as
further steps of the same run:

- `--import-new` imports furniture the compared source has and this hotel lacks.
  It reuses `getClonableClassnames` for the diff and `cloneSingleFurni` per item,
  which downloads the icon and the bundle (sources serve `.nitro`, stored as
  `.hab`), appends the furnidata entry with `deferFurniData` and creates the
  catalog page plus the offer itself. Deferred entries are written in one
  `appendFurniEntriesBulk` call, so 26000 items cost one JSON write, not one per
  item. `--only`, `--limit` and `--concurrency` narrow/tune it, failures are
  isolated per item and never abort the run.
- `--reconcile`, `--fix-sprite-ids` and `--rebuild-offers` run the existing
  `reconcileFurniDataWithItemsBase`, `verifyAndFixSpriteIds` and
  `rebuildCatalogOfferIds` passes — the post-import consistency work.
- `--align-ids` and `--rename-bundles` delegate to the existing standalone
  scripts; both only report until `--apply` is given, matching their own
  contracts.
- The menu grows options 6-8 plus a dry run, each with its own confirmation.

`--everything` turns on every repair + import step but deliberately leaves the
destructive ones off. A live dry run against Wibbo listed 26593 items on the
source that this hotel does not have, and Habbo (COM) reported 2871.
This commit is contained in:
openhands committed 2026-10-15 20:12:13 +02:00
1 parent a4bcd40e7b
commit f56b345598
4 files changed
+563 -15

No files matched your search

+38 -3
View File
@@ -99,9 +99,15 @@ What should be done? (comparing with: $SOURCE_LABEL)
1) Audit only — nothing is written
2) Repair furniture icons + nitro bundles
3) 2 + FurnitureData.json + catalog structure
4) 3 + generate the catalog SQL (saved, not applied)
5) 4 + APPLY the catalog SQL to the catalog
q) Cancel
4) 3 + generate the catalog SQL (saved, not applied)
5) 4 + APPLY the catalog SQL to the catalog
6) 5 + import the furniture the source has and this hotel lacks
(downloads icon + bundle, adds FurnitureData.json, creates the catalog
page and the offer for every new item)
7) 6 + reconcile FurnitureData.json / sprite ids / offer ids
8) 7 + align items_base ids and rename legacy .nitro bundles (heaviest)
d) Dry run — only report what 6 would import
q) Cancel
EOF
read -r -p "Action [1]: " ACTION_CHOICE
@@ -132,6 +138,35 @@ case "$ACTION_CHOICE" in
ACTION_FLAGS=(--all --sql --apply-sql)
CONFIRM="This writes to the catalog. Continue? [y/N]: "
;;
6)
ACTIONS=(audit "everything + catalog SQL + import new furniture")
ACTION_FLAGS=(--all --sql --apply-sql --import-new)
CONFIRM="This writes to the catalog AND imports every missing item. Continue? [y/N]: "
;;
7)
ACTIONS=(audit "everything + import + reconcile")
ACTION_FLAGS=(
--all --sql --apply-sql --import-new --reconcile --fix-sprite-ids
--rebuild-offers
)
CONFIRM="This writes to the catalog AND imports every missing item. Continue? [y/N]: "
;;
8)
ACTIONS=(audit "everything + import + reconcile + id alignment + rename")
ACTION_FLAGS=(
--all --sql --apply-sql --import-new --reconcile --fix-sprite-ids
--rebuild-offers --align-ids --rename-bundles --apply
)
read -r -p " This rewrites items_base ids and renames bundle files. Type RUN to confirm: " REPLY
if [ "$REPLY" != "RUN" ]; then
echo "Cancelled."
exit 0
fi
;;
d | D)
ACTIONS=(audit "report only — nothing is imported")
ACTION_FLAGS=(--import-new --dry-run)
;;
q | Q)
echo "Cancelled."
exit 0