creem catalog promote. Promote pairs each test item with the live item that has the same external_id (its key), writes the live item to match test, and creates a live item for a keyed test item that has no live match yet. Run it again whenever you change something in test; items that already match are unchanged.
Promote covers meters and products. Product groups and discounts come later.
Keys
Promote uses the store’s live API key. Pairing writes the key on both sides, so it also needs the store’s test key. The CLI takes them from:
In a terminal, a missing key is asked for with a masked prompt and used for that command only; it is never saved. The entered key must be that side’s: a test key entered for live (or the other way round), or an empty answer, stops the command with exit code 3. Without a terminal, the command stops with exit code 3 and names the variable.
Preview
Without
--select, promote takes everything. --select takes meters= or products=, each all or a list of test ids.
Promote in a terminal
needs_key: pick one of the live items with the same name, or none. The CLI proposes a key (the live item’s key when it has one, else the test item’s id), asks you to confirm it, and writes it on both sides ascreem catalog linkdoes. With “none”, the key goes on the test item only and promote creates the live item.- Feature keys: when a product’s features can’t be paired on their own, pick the live feature for each, the same way.
possible_rename: a keyed test item has no live match, but live has items with its name, usually because its key was renamed in test. Create a new live item, or re-pair: the test item’s key is written on the live item you pick.live_metadata_not_in_test: promote never clears ametadatakey only live has. The CLI offers to copy those keys into the test product, then promote brings them along.
409 external_id_taken) wrote nothing: it is reported, and the CLI goes on with the next item. When a write may have gone through (it timed out or answered a 5xx, or live was written and test wasn’t), the CLI says which side may have the key, runs the dry run again, and asks about that item again so you can finish the pair. A 401 or 403 stops the command with exit code 3.
Then the CLI asks before the real run. If the dry run refused some items, confirming writes the others and leaves those out; afterwards the CLI names any item the run refused that the preview hadn’t. When every item is unchanged, it says so and skips the real run.
Promote in scripts
--yes runs the dry run, then the real run. It confirms the real run, never a key: needs_key items stay needs_key. A possible_rename stops the command before the real run; pair the item with creem catalog link, or pass --create <test id> to create it anyway.
Before its first write, the real run checks every write. When the check refuses one, nothing is written: the refused items are conflict or failed, and every other write is not_written. Add --force to write the others.
The command follows next_cursor until the run is complete and prints its run_id. Each page waits up to 90 s unless you pass --timeout, because a page can take up to 45 s of work on Creem’s side. If a page after the first fails, the command prints what the run got so far (with --json, run carries it with the failed page’s cursor) and exits 4 (3 for a 401 or 403; a 429 keeps its Retry-After): promote again, and items already written answer unchanged. If the real run’s first page times out or answers a 5xx, there is no run_id yet but the page may have written: run creem catalog promote --dry-run to see what live has now. With --json, stdout carries { "preview": …, "run": … }, each with runId, dryRun, summary, items and, for the real run, validation. The exit code is 4 when an item ends failed, conflict, blocked or needs_key, or not_written for a reason another run fixes: changed_since_check means the item changed between the check and its write, so promote again (items already written then answer unchanged). An archived test item that live doesn’t have (archived_not_in_live) doesn’t count. A dry run uses the same rule.
Pair items by hand
link gives a test item and a live item the same key. Without --key, it proposes one (for an item, the live item’s key, else the test item’s id; for a feature, the test feature’s key, else the live feature’s, else the test feature’s id) and asks; outside a terminal --key is required, and --yes never confirms a key. It first checks the key on both sides, so a key either side already uses (409 external_id_taken) stops it before anything is written. Then it writes live, then test. If the test write fails, the output says “Live written”; run the same link again to finish the pair. Its live write is then unchanged.
Without --live, the key goes on the test item only, and promote creates the live item. A feature key is written through each side’s product, re-sending the product’s other features of that type, because a feature left out of its type’s set is removed.
unlink clears the live item’s key after confirmation. The test item is then no longer paired: the next promote plans a new live item and lists the old one as a candidate. Changing a key renames the pair the same way.