Imported from wix/skills (
skills/wix-replatform/resources/rp-mapper/SKILL.md). Install upstream withnpx skills add wix/skills --skill rp-mapper. Copyright stays with the author.
rp-mapper
Mapping owns semantic decisions, including uncovered relationships and custom fields. Apply
applicable shared rules; when knowledge is absent, investigate source meaning and authoritative
target schemas here. Missing knowledge alone is not a reason to block. Follow
references/knowledge-and-recovery.md for run-local
operation assessments, eligible temporary field deferral, record holds and later repair.
Codegen implements these decisions and returns unanswered mapping questions to this step.
Create a mapping plan from the discovered source schema into Wix entities and Wix data structures.
Purpose
This skill translates source entities and fields into Wix targets. It should define what each source record becomes in Wix, how fields transform, and where custom schemas or extended fields are required.
Required inputs
migrations/<project>/source-schema.jsonmigrations/<project>/source-profile.mdwhen availablemigrations/<project>/orchestration/checkpoints.jsonmigrations/<project>/orchestration/decisions.jsonmigrations/<project>/discovery/source-coverage.json(capabilities discovery could not capture)- any existing Wix target-model constraints supplied by the user
Read only these canonical artifacts by default. Do not ingest the raw discovery dump
(migrations/<project>/data/...) wholesale — it is platform-specific and large. Instead, when an
entity's mapping is ambiguous, follow that entity's rawFile pointer in source-schema.json to open
just that one raw file for verification. Skip entities whose inUse is false (advertised by the
source but holding no records).
Adapter-supplied hints in sourceMeta
A source adapter may pre-fill part of the mapping when it recognizes the source format. Two
sourceMeta keys carry that, and both are optional — a schema without them maps exactly as
before:
sourceMeta.mappingHints[]({ column, wixTarget, matchedAlias }) — an advisory pre-fill, e.g. from a recognized vendor's CSV profile. Seed the correspondingfieldMappings[]entries from it so the user reviews and corrects instead of authoring from scratch, and recorddecisionProvenance: source_platform_rule. It is never authoritative: the source's own field list still governs, and every hint still passes through the mapping review checkpoint.sourceMeta.drift.unmappedColumns[]— real source columns the adapter's profile did not recognize. Each one must be explicitly mapped or explicitly recorded as skipped; leaving them unaddressed is how a stale profile turns into silently dropped data.
In addition to the project artifacts above, consult the relevant bundled adapter resource when the mapping depends on platform behavior that should not be guessed:
- source-side read/entity semantics from
wix-replatform/resources/rp-source-<platform>/SKILL.md - Wix target constraints and domain behavior from
wix-replatform/resources/rp-target-wix/SKILL.md - Wix target entity suitability from
wix-replatform/resources/rp-target-wix/scripts/domain-knowledge.js
Treat those adapter resources as the authoritative home for platform knowledge. Do not copy source/Wix behavioral rules into the mapping plan as if they originated there; cite and apply them there.
Read-back field contract before mapping approval
For the gated Wix targets order, member, contact and product, every field-mapping row
must declare the exact sourcePaths[] it reads, canonical writePath, and readPath or a
specific unverifiableReason. Write array positions as []. A populated false or 0 is
real data. In mapping/entity-decisions/<entity>.json, account for every populated source leaf
and intended target path with fieldDispositions[]: { kind: source | intended, path, status: mapped | notMigrated, mappingRef }. A mapped disposition names the actual mapping-row
ID or index; it cannot claim a path that row does not read or write. For an exact field plan,
keep the canonical fieldDispositions[].mappingRefs[] produced by the authority. Each reference
is decisionId:outputId; put readPath or unverifiableReason in that precise output’s verification metadata.
The authority projects these bindings to verificationMappings[].
When an output is written (appliesWhen). If a decision legitimately writes nothing at an
output for some records, declare that on the output as a predicate, not as prose in lookup
cases or helper arguments. Example: taxable keeps the Wix site default tax group, so
taxGroupId gets {"op":"notEquals","location":"tax_status","value":"taxable"}. Variant
choices (empty on a simple product's default variant) get {"op":"equals","location":"type","value":"variable"}.
Compare-at price, where a 0 sale price means no sale, gets
{"op":"all","of":[{"op":"populated","location":"sale_price"},{"op":"notEquals","location":"sale_price","value":"0"}]}. Tracked
quantity and untracked inStock get equals / notEquals on manage_stock true.
Operators: equals, notEquals (value: string, number or boolean), in (values[]),
populated, notPopulated, and all / any (of[]). Each node has exactly these keys. Each
location must be one of the decision's own canonical source locations (lib/source-location.js
form, selector-qualified when the decision uses selectors). Over an array location equals, in
and populated hold when any value does; strict equality, no coercion. The predicate is
evaluated on the source record. Without appliesWhen the output always applies when its
sources are populated (a builder that omits it is refused). With it, an applicable output must be
written and a non-applicable one must be absent. inventory counts both per output, and
validate reports a builder that disagrees. Changing a predicate changes the plan and its
approval bindings and makes the inventory stale. Where the condition depends on data outside
the record (for example per-variation stock on a variable product), do not approximate it;
model that output separately or leave the record held. A held record is the builder's
{ status: 'held', holds: [{ decisionId, code }] } result: it keeps source coverage, is counted
as held with its reasons, and is outside applicability and canaries; validate judges only the
records eligible to write. inventory writes the held counts per decisionId:code into the
mapping review (Held records: <entity>); present them with the approval request.
The gate derives the write path from targetPath; do not create a second flat mapping
or edit an entity projection independently. Copy the domain contract before final mapping approval.
For deliberately proposed populated omissions in an exact plan, first record the exact
excluded decisions, rationale and affected scope. If an intended target field is also lost,
declare it explicitly in that decision's omittedOutputs[] with writeOperation
and targetPath; it is coverage of a proposed loss, never a writer output. Prepare the final
review before requesting approval:
node scripts/read-back-gate.js contract <projectDir> --entity <entity> --omissions review
This command requires interactive mode and a reopened mapping checkpoint. It projects
notMigrated dispositions and the proposed scope before hashing the approval inputs.
omissionReviewRequested and executionScope.omissionApprovalRequiredEntityRefs identify
conditional scope: neither grants permission to execute. Missing/stale identified approval
holds the mapper route, importer descriptor, direct handlers and read-back gate. Present the
exact source/intended omissions, operations, counts or unknown scope with the current four
references. The shared approval effect captures the authenticated operator, project/site,
interactive-mode context and fieldDispositionDigests in the existing approval and answered
request. Do not edit the plan to release scope after approval; that invalidates its bindings.
The authority API requires its complete explicit omissionReviewEntityRefs selection on every
preparation; it never inherits proposal markers. The per-entity contract CLI constructs this
selection from the current authority, preserving proposals on other entities. Its review form
adds or retains only the selected entity. To withdraw that entity after rejection, run the
plain contract --entity <entity> form. Only its proposal is removed; its excluded fields
remain visible as mapping gaps. A dependent with a retained whole-task prerequisite may also
remain deferred, while a declared per-record reference stays executable and defers only records
that name the unavailable parent. Review the revised mapping again.
One-click mode cannot prepare or authorize these omissions, regardless of recorded provenance. Ordinary unresolved choices and
the affected entity remains deferred; per-record dependents continue through their record-level
readiness gate. No proposal authorizes a particular customer's loss.
Order, before the named mapping approval: (1) draft decisions; (2) contract, which writes
the authority, its projections and mapping/mapping-resolution.json; (3) a pure
project-local module exporting buildWrite(record) from the draft decisions' transforms,
produced by rp-import-codegen's builder-only step (no executor, descriptor, manifest,
Wix client or capability — inventory refuses a builder that references them); (4)
inventory; (5) validate until its only failure is the missing approval
(status: awaiting-approval); (6) the normal named approval; (7) validate again. The live
importer is generated only after approval and reuses that builder unchanged; the inventory
pins the builder's SHA-256, so editing it makes the inventory stale.
The route enforces step (5): while validate fails for any entity with an inventory, it stays in
mapping (read_back_invalid, naming each entity and its errors), and one-click records no mapping approval.
The check is per plan row: <entity> is the gated entity name when one row writes it, else
<entity>.<row> (for example contact.customer, order.order-buyer); pass that key as
--entity. Steps (2)-(5) are optional before approval: at codegen the toolkit itself builds and
validates every resolved gated row's inventory with the scaffold's builder, and codegen stays open
until each passes (an unchecked row never passes). The approval binds only rows checked here.
Use an existing complete extract, or obtain it through the source adapter's read-only extraction
path before the review. These commands run from the installed skill directory. If preparing
a proposed omission, replace the plain contract command below with the review form above;
running the plain form afterwards withdraws only that entity's proposal:
node scripts/read-back-gate.js contract <projectDir> --entity <entity>
node scripts/read-back-gate.js inventory <projectDir> --entity <entity> --extract <extractPath> --builder <builderModule> --source-key id
node scripts/read-back-gate.js draft-stubs <projectDir> --entity <entity> # optional, read-only
node scripts/read-back-gate.js validate <projectDir> --entity <entity>
contract merges the checked-in intended fields, projection and domain digest into the same
entity decision's readBackContract; do not invent or relax that contract. inventory streams
NDJSON or a JSON array once and stores only source IDs, exact locations (selector-qualified
for declared dynamic arrays), counts and per-location membership digests in
execution/read-back-inventory/<entity>.json (schema 2; an older inventory is reported stale,
rerun it). A dotted source key is supported. draft-stubs is read-only. Missing extracts
report not-run, never a pass. Exit 2 requires correction; before approval the only permissible
unresolved validation item is the missing identified approval for an explicitly reviewed
notMigrated path. All other contract, mapping, history and inventory failures must be fixed.
Before any Wix write, request mapping approval with the exact current SHA-256 references from
lib/read-back-contract.js bindings(projectDir, entity) for all four artifacts:
mapping/mapping-plan.json, mapping/entity-decisions/<entity>.json,
mapping/mapping-resolution.json and execution/read-back-inventory/<entity>.json.
mapping/mapping-resolution.json is produced by writeMappingAuthority for every source
(lib/mapping-resolution.js): a deterministic projection of the reviewed decisions and
coverage, retaining any CSV resolver output as its seed. Never author, empty or delete it.
The review shows left-out locations (selector keys spelled out), each location's own record
count and each decision's union count, never source values. Record approval
through the existing mapping user action so both answer entrypoints use the shared identified
approval writer. Populated omissions require a named signed-in human; explicit 1-click mode
cannot approve them automatically. After approval, rerun validation; it must pass before writes
and on every resume. Changes to any pinned artifact require fresh review. A previously attempted
unresolved path or observed loss cannot become an approved omission. Approved omissions produce
a separate merchant-acknowledgement action that must be completed before launch.
For every other target entity, declare verificationKind (contact, product or none;
members and orders use none) and a concrete reason through
lib/read-back-gate.js's declaration; it is outside these four field gates and must never
be described as having passed them.
The plan is pre-filled; map only what is left
For an entity whose source pack has ready-made suggestions
(rp-source-<platform>/wix-map/*.json; WooCommerce today: product, product-category,
product-tag, product-brand, customer, order), the toolkit has already written its field rows.
The route script runs the pre-fill (lib/stage-entry.js) every time it selects this stage, before
you start, and writes the pre-filled entities into mapping/mapping-plan.json (it seeds a new plan
with them). Each entity has the suggestion rows, one source-archive row for every other discovered
leaf, the coverage digests, the projected fieldDispositions and the suggested choices
(decidedBy: "suggestion"). mapping/plan-prefill.json holds the same entities.
The records come from the toolkit's read-only source extract (data/source-extract, every reader,
optional ones included). It starts in the background when discovery capture ends, and this stage
entry waits for it. Do not run the extract yourself. If stagePrepared says it is still running,
wait with the command it names, then route again. A reader it lists as failed is the only one
to look at.
Edit the plan in place; never rewrite those entities. Change or delete a pre-filled row only when the records disprove its rule; then put toolkitGap: {rule, why} on the row (rule that failed, record shape). Nothing blocks without it, but the gap is listed with no reason. Add your
header fields (crosswalk, urlPolicy, readBackContract and the like) and your rows; they are kept.
stagePrepared.errors in the route output names an entity whose rows fail the plan contract
(plan-prefill <entity> not merged: ...): fix that row of yours, then route again.
Your job for those entities is only:
- Operator changes. Write each one as a plan row with the same
idas the suggestion row it changes, usingaffix(withbase),constant,source-field,lookuporinstruction. Record it withchoice: {name, value, default, reason, decidedBy: "operator"}. A dropped field is anexcludedrow with that same operatorchoice; the choice is what makes it a deliberate drop that every check accepts. - The
prefill.reviewlist. These are leftover leaves outside the suggestion's standard archive list: plugin fields, site-specific meta keys. They are archived by default. Map one natively only when a Wix field clearly fits. A value choice you make there recordschoice.decidedBy: "ai". Never mark your own decision as the operator's. - One-click: when the operator said nothing, use the pre-fill unchanged. Every suggested choice is already recorded, and the end report lists them.
Each route keeps every row you wrote (rows without the prefilled marker). Such a row replaces
the suggestion row with the same id, and the archive never claims a leaf it decides. Pre-filled
rows are rebuilt from the suggestions. To refresh by hand, run
node skills/wix-replatform/scripts/orchestration-route.js <project> again.
Never edit a suggestion file during a run. Suggestions grow only through a reviewed PR.
Deterministic first — resolve before you reason
Do not author field mappings by hand when a vendor overlay already knows them. Run the deterministic resolver first and let it do the mechanical join; your judgement is needed only for what it cannot decide.
node scripts/resolve-mapping.js --fileset <migrations-root>/<project>/data/csv-discovery/fileset.json \
--out <migrations-root>/<project>/mapping
It joins three inputs that are all already data — the header set discovery actually observed, the
vendor overlay's columnMap, and rp-target-wix's lib/wix-target-spec.js — and writes
mapping/mapping-resolution.json plus mapping/mapping-residue.json. Exit code 2 means blocked:
a required Wix input is unfilled, or an overlay names a canonical field that does not exist.
The next writeMappingAuthority keeps these resolver keys and adds the authority projection;
re-running the resolver afterwards requires re-running contract.
What it decides, so you don't:
- which column feeds which canonical field, and via which alias (recorded for review)
- which columns nothing claims →
residue.unmappedColumns - which mapped columns have no Wix home, with the declared reason →
residue.unsupportedTargets - which required Wix inputs nothing feeds →
residue.unfilledRequired(a blocker) - which overlay entries reference an absent column →
overlayDrift(the profile is stale) - which entities arrive by derivation rather than by a column →
derivedEntities, includingrequiresFaithfulnessLedgerEntrywhen the source taxonomy is hierarchical
Your job is residue, and only residue. Each entry needs an explicit decision — map it to a
canonical field, or record it as intentionally skipped with a reason. Leaving an entry undecided is
how a stale overlay turns into silently dropped data.
Two rules keep this honest:
- The header row read at discovery time is authoritative, not the overlay. An overlay can only claim columns that actually exist; a column it does not know is surfaced, never dropped.
- When you resolve a residue entry that the overlay should have known, fix the overlay —
rp-source-csv/vendors/<vendor>.jsonplus a header fixture intests/fixtures/csv/headers/. That is a data edit with no skill-logic change, and it means the next run resolves it deterministically instead of asking a model again. A mapping decision made twice is a missing overlay entry.
Do not regenerate the payload builder
rp-target-wix/lib/wix-build.js turns a canonical record into a Wix Stores V3 create body
deterministically, and lib/wix-target-spec.js declares every field, constant and trap it relies
on. This layer is vendor-independent — Shopify, WooCommerce, Magento and BigCommerce all
converge on it — so codegen must vendor and call it, exactly as the reader vendors csv-parse.js.
Do not emit a per-project to-wix.js re-deriving money objects, slug sanitization, choice-by-name
variant references, or the empty physicalProperties trap. Those are settled, tested, and
regression-locked against 220 payloads from two live-verified imports
(tests/mapping/wix-build-oracle-test.js).
The spec also settles the one price decision that recurs on every vendor: see
STORES_V3_TARGET.priceResolution. A (regular, sale) pair is resolved into Wix's
actualPrice/compareAtPrice, not mapped field-for-field — getting it backwards silently
overcharges every discounted product.
Exact field decisions and existing mapping QA
New or explicitly revised plans declare fieldContractVersion: 1. Do not silently upgrade
or approve legacy plans. The source inventory and semantics govern; resolver/hint outputs
seed decisions and retain their provenance, residue, drift diagnostics and canonical concepts.
Expand those seeds into exact decisions before review. Preserve entity selection, retention,
relationships, setup requirements, manual runbooks and writer metadata.
Source fields a source adapter turns into a structural canonical field that a manual-mapping
target hands to the operator (today: bundle contents → product.bundle, carried by
stores/product-bundle) take disposition: "excluded" with policyRef: "carried-to-cutover",
canonicalField and carriedBy. That exclusion is not an omission: it does not hold the record.
Any other exclusion of those fields stays pending. A product bundle maps through the normal
product route; never map its parts onto options, modifiers or variants.
Use lib/mapping-field-contract.js from the product root. writeMappingAuthority(projectDir, plan, options) commits authority first, then deterministically projects entity files,
marked field sections in the existing review documents and mapping/review/mapping-gaps.json.
Re-running the same authority repairs an interrupted projection. No separate field table
is authored. Reopen the existing mapping approval before amendments. Check every returned
telemetryFailures entry through existing telemetry recovery; the durable gaps remain even
when delivery fails. A native or native-plus-cms target with no reviewed rp-target-wix writer is mapped
natively with write operation sendGuardedRawRequest (choosePreservation
returns writer: 'raw-request'). Only a write operation that is neither the entity's
writer nor the raw path is a missing-writer gap (reasonCode: missing-writer). Never plan
sendDirectRest.
Import safety comes from the entity's knowledge file, not from your candidate: a native target
with preferredWrite.importSafe: false is an import-unsafe gap carrying importSafeReason,
whichever writer (reviewed or raw) it would use.
An import-safe native target is never set aside because it has no reviewed writer, no
fieldContracts[], or a blocker pitfall. Read the request shape from the entity's own
evidence docs and map it on the raw path; the first-record canary checks the shape. A
blocker pitfall names what must be true before the write (a relation, a setup step, an
order); satisfy it in the mapping. It sets nothing aside unless it says the target cannot
be written at all.
Guest buyer and guest reviewer contacts (guest-buyer-contact, guest-review-contact) are
toolkit-derived on the contact task, never plan entities: do not add a plan row for them or list
them in requiredSourceEntityRefs. Guest buyers follow the order's guest-buyers choice
(import-as-contacts default, email-only, not-imported); an operator change edits that choice.
Each entity declares requiredSourceEntityRefs (including an explicit empty array), and
discoveryCoverage: { paths, sourceSnapshotDigest, inventoryDigest, uninspectedAreas, evidence }.
Use existing discovery/schema artifacts; no exhaustive scan is added. Paths are exact leaf
locations in the shared grammar of lib/source-location.js: identifier keys joined by .
(a.b), [] for every array element, and any other key quoted as ["<JSON string>"] —
yoast_head_json.schema["@graph"][]["@type"], twitter_misc["זמן קריאה מוערך"], [""].
A literal key ["part.name"] is never the nested part.name. Existing identifier paths keep
their meaning. Never drop or rename an awkward key to fit the grammar. An observed dynamic
leaf has {path, dynamic:true, selector: {keyPath}, observedKeys}; its decisions claim
keys through selectors: [{path, keyPath, keys}], which stands for one selector-qualified
location per key, meta_data[key="_yoast_wpseo_title"].value; such locations may also be
written directly. Each location is its own coverage row with its own count. Descendants of
a selected value (meta_data[key="tm_meta"].value.tmfbuilder.x) are listed exactly too;
there is no subtree claim. read-back-gate.js draft-stubs prints the unclaimed ones from
the inventory as unresolved stubs for you to decide — never paste them as exclusions
without review. Elements whose key is not a string/number stay at the unselected base path
(meta_data[].value) and need their own decision. When an excluded decision spans several
locations with different memberships, give affectedScopes: { <location>: <scope> }
beside its decision-level affectedScope (the union). A measurement that is unknown stays
unknown; it never replaces another decision's known scope for the same location.
Disclose uninspected keys/boundaries instead of claiming full coverage.
The shared helper admits only its existing mandatory credential exclusion, policyRef: mandatory-no-credentials, scoped to recognized credential paths whose discovered leaves
are explicitly retentionClass:credential. Cite the existing source/member credential rule;
record paths and evidence, never values. An arbitrary policy reference, ordinary business
path or unclassified subtree does not authorize omission and remains pending/blocking.
A zero-count exclusion is decided only with a complete measured empty population:
countStatus:known, count:0, sourceIdsComplete:true, sourceIds:[],
sourceIdsDigest:digest([]) from the shared contract, and explicit snapshot/inventory
digests matching this entity's discoveryCoverage. Missing, stale or truncated measurement
is pending even if the mapper declares zero; a reported zero never substitutes for evidence.
Every fieldMappings[] row has stable id, exact sourcePaths, disposition, reason,
evidence, and, when written, exact outputs[], transform and valuePolicy.
Outputs have stable id, actual consumed sourcePaths, targetRef, writeOperation and
targetPath, the field on the Wix entity (name or brand.name). Never choose a request
wrapper; the toolkit owns it. When the writer's preferredWrite.requestFields is listed, the
gate refuses any other field: route it to CMS or exclusion. Custom storage also names its concrete definition, field,
collection, permissions and parent linkage in storage. Bind constants/defaults too.
Transforms are identity, a decided expression, a complete lookup (also the value map),
or a named helper with bound arguments and revision. An operator change is one of
affix (prefix/suffix), constant (value), source-field (sourcePath, one of the
decision's sourcePaths) or instruction (text: plain words codegen implements); all but
constant may keep the suggested transform as base, applied first. Dropping a field is an
excluded disposition, not a transform. Record each one-click or operator choice on its row as
choice: {name, value, default, reason, decidedBy: ai|operator|suggestion}, and a whole-entity choice
(for example a deferred entity's default and reason) in the entity's choices[]; the end report lists them.
When the operator says not to import an entity, record {value: "skip", decidedBy: "operator"} there:
it is left out on purpose (executionScope.skippedEntities), not deferred. Drop links to it from
other entities with the operator's choice and remove it from their requiredSourceEntityRefs.
When the operator imports only some records of an entity ("only customers who bought", "skip expired
coupons"), set the entity's recordRule: {keepWhen, choice}: keepWhen uses the appliesWhen grammar
over the entity's inventoried locations (plus before/after on ISO date-times), and the choice is
the operator's. Prefer a source filter when the source API can filter. Decide precedence/timezone/units/rounding and every
missing/null/empty/zero/invalid/unknown case; no grouped chronology or "see schema" instruction
can delegate meaning to codegen. Relationships state crosswalk inputs, destination, cardinality,
ordering and missing/ambiguous/orphan outcomes in referencePolicy.
Every leaf a native/extended-field decision lists in sourcePaths feeds one of its outputs
(outputs[].sourcePaths, appliesWhen or referencePolicy.input); a leaf you mean to drop moves
to an excluded/unresolved decision so it is a cutover gap (mapping-source-leaf-unfed). A leaf
the target knowledge lists in sourceReferenceLeaves (order customer_id, line product_id /
variation_id) must feed its own output at the dependencyReferenceFields path
(buyerInfo.contactId, lineItems[].catalogReference.catalogItemId /
.options.variantId); listing it beside buyerInfo.email or a custom line is refused
(mapping-reference-leaf-dropped), unless the operator asked to drop the link: an excluded
decision with its choice recorded as decidedBy: operator. A one-click run never drops a link on
its own; it keeps the link and the gate holds a record whose parent cannot land. The builder never writes those ids; the dependency gate does.
Do not write examples or exampleBase. After codegen, the toolkit samples real records from
data/source-extract and checks each prepared request against your decision: the value after
transform, omissions and holds per valuePolicy, appliesWhen, and excluded fields absent. So
make those exact; the check reads nothing else. A rule that writes nothing for some records (no
consent evidence, a status the target cannot hold) is a hold-record with a named code in the
row's valuePolicy (or an appliesWhen): generated code may raise only a code the plan declares.
Only an entity with no extracted records still uses
synthetic {id, input, expected:[{outputId, writeOperation, value|values|omitted|noWrite, findingCodes?}]} examples (merged over an optional exampleBase). Review them independently; generated output cannot author
its own expected value. A changed ID on a matching remap requires explicit prior decision/gap
supersedes refs; output-ID changes require matching output supersession. Keep gap history.
Use selectively loaded target mappingRules via lib/mapping-target-rules.js; all declared
source/schema/semantic predicates must match. Conflicting matches return to mapping. Review
operation field contracts and authoritative wire schemas before deciding suitability. The
same helper enforces native → admitted extended fields → precisely bound CMS candidates.
Extended fields admit only Orders/Products/Contacts, string/TEXT, root entity storage,
_user_fields, migration-internal permissions and supported limits; contacts-v5 is default,
v4 requires explicit choice. Unsupported types/entities/subrecords use compatible CMS.
Existing definitions require type/permission/reference compatibility, never an ID-only skip.
CMS setup uses the existing automated create-cms-collections requirement and executor.
Do not label it manual unless an actual prerequisite lacks a supported automated path.
Source absence creates no value or business record. Runtime never edits shipped target knowledge.
The source archive is per field, not per record. All source data is kept: native field,
else an admitted extended field, else a CMS archive location. Decide every leaf through that
order (choosePreservation); a short scalar on an order, product or contact is an extended field
before it is CMS. Never route a whole record to the archive because one of its leaves is
unclaimed: only the cms-disposition leaves are archived. Keep plumbing and personal fields as
cms like any other unclaimed leaf: do not write excluded decisions for API links, hashes,
modified dates, IP addresses or user agents. The archive module
(resources/rp-target-wix/lib/source-archive.js) applies the shipped retention policy
when it builds the archive, packs many records per CMS item, and skips paths a non-lossy native
decision already writes; the mapping review needs no approval for it. Every archive item counts
against the site's plan-wide CMS item quota, so archive only records the import writes (the
entity's own record selection; an out-of-scope WordPress user or unreferenced library media file
is not archived). Report the expected archive item count from
scripts/source-archive-plan.js --project-dir <dir> (expectedRows) in the mapping review next
to the quota.
Existing mapper QA compares inventory coverage, individual output bindings against schema, precedence/absence/reference semantics, canonical/projection equality, stable IDs, all gaps and preservation-versus-native-behavior claims. Review manual-step coverage as before. For each gap record affected snapshot/inventory digests and measured IDs/count, or explicit null/unknown coverage; a sampled ID list is not the complete affected population.
Map every in-use entity. Each in-use discovered entity is mapped through the order above
(native, admitted extended field, CMS). The only alternative is a typed limitation on its
pending row: {status, detail}, status source-read-failed, missing-writer or
target-limitation, detail saying specifically why it cannot be mapped. That row becomes the
entity's Cutover item. "Not mapped yet", "fields not reviewed" and "undecided" are never reasons.
Interactive mode may ask the operator while mapping; one-click and quick ask nothing and pick
through the order, recording assumptions. Never answer your own mapping review by deferring
pending mappings. A discovered in-use entity (census count above 0) with no plan row needs a row
or a decided census disposition in mapping-gaps.json; in one-click an open pending question
is not one. A mapped row whose every record would still be left out is unmapped too
(outOfScope: true, with the scope's reason): its requiredSourceEntityRefs names a
prerequisite with no row, an operator-skipped one, or one deferred with no reason. Map the
prerequisite, point the link at another mapped entity, drop the link (operator choice only), or
put a typed limitation on the row. Every mapping approval refuses an unmapped in-use entity and the router
returns it here (mapping_incomplete), in every mode; after 2 such passes it is the typed
mapping_incomplete blocker naming the entities.
The toolkit writes the mechanical rows at this stage's entry (stagePrepared step
mapping-defaults, lib/mapping-defaults.js):
- A plugin or custom entity with records, no suggestion and no source reader gets a default
set-aside: a plan entity with
limitation.status: source-read-failed(listed inmapping/plan-defaults.json). - A census entity row with 0 records gets a
no-datagap. - A sub-part whose fields a planned row of its parent maps is added to the parent's
censusIds.
An entity that has a reader is never defaulted, because its Wix target may be import-safe: map it.
Reference-only, duplicate and capability rows are still yours to decide. You may upgrade any
default (add a reader extra and map it); put toolkitGap: {rule, why} on the entity, and the
change is recorded as a toolkit gap.
Resolve defaults and suitable preservation first. In customer mode an undecided mapping
keeps the checkpoint pending; only an explicit human provisional subset can continue.
For a proposed populated omission, prepare the exact entity contract with the existing
read-back-gate.js contract --entity <entity> --omissions review command and present the
affected fields, records/counts, missing behavior and consequences in the normal mapping
review. One authenticated mapping approval may cover all of the exact shown omissions;
the proposal itself authorizes no writes. In one-click only --omissions review is refused;
the plain form clears any leftover proposals, and those entities defer. A cited retention
policy or a general instruction to continue is not consent to new loss. Keep the approved omission in completion and Cutover;
approval permits importing supported data, not claiming missing behavior was migrated.
The authority writer derives unattended mode from the existing recorded user-authored
one-click decision; a caller's mode string cannot authorize it. There, retain selected scope
and defer dependents of a set-aside entity only when their retained writes need a whole-task
prerequisite. Declared per-record references are left executable and their record-level holds
remain visible in the dependency ledger. Never repeatedly redispatch an unchanged choice.
Return codegen semantic defects here for one bounded evidence/rule resolution attempt and
decide them through the same order. Do not turn a set-aside into an exclusion or a passed
import; it stays a Cutover gap after independent work and evidence retention finish. An
all-deferred plan remains typed-blocked because no importer can start, including in explicit
one-click mode; mixed scope still continues resolved independent work, and its per-entity
evidence remains visible for Cutover.
Workflow
- Read the source discovery artifacts.
- Read the pre-filled plan (the route already pre-filled entities with suggestions) and run the
deterministic resolver (above) for CSV sources; read their
prefill.review/ residue. - Identify the target Wix entities for each source entity using the domain knowledge
reader first. Start from
sourceMeta.candidateTargetRefs[]when discovery supplied it; otherwise rundomain-knowledge.js resolve-source; use semantic reasoning only when no candidate exists and recordunverifiedconfidence. A candidate is not verified until the matching record has been read from the bundled target-knowledge index. If that lookup fails, keep the mapping pending withcms-fallback-target-knowledge-unavailable; never reinterpret a lookup failure as "no native target" and never approve an archive-only core commerce row forproduct,contactororder. A native candidate that is suitable for import must remain the selected target even when individual fields also need CMS preservation. - Decide the resolver residue only, then define any remaining transformations and defaults.
- Mark gaps where native Wix entities are insufficient — the resolver's
unsupportedTargetsalready names them with reasons; carry those into the faithfulness ledger rather than restating. - Identify requirements for custom collections, extended fields, references, media handling, and rich content normalization.
Every
extendedFieldswrite needs a matchingkind: "extendedFieldSchema"setup requirement with compact field intents (key,fieldType,maxLength,permissionsPreset: "migration-internal"), never hand-written JSON Schema. Migration-owned fields use_user_fields. Admitted targets: orders, products, and contacts (defaultcontacts-v5; legacycontacts-v4only by explicit choice). Other objects and nested subrecords go to CMS. Provisioning a field does not decide whether a source field may be kept; that is a separate retention decision. CMS archive outputs usebuildCmsArchiveCollectionId(sourceEntity)fromlib/cms-collection-id.js; never invent or concatenate a collection id. - Save the mapping plan, including the reviewed dependency associations below.
- Check the blocked-data requests the stage entry wrote (
stagePreparedstepblocked-data-requests, "Blocked source dependencies" below); do not build them yourself. - Write a concise user-review summary after the plan is complete.
- Pause for a mapping review checkpoint before downstream setup/codegen work begins.
When this stage is run by a top-level host, the host has already selected this resource;
the mapper still reads this complete contract and the required source and rp-target-wix
resources itself. Direct execution changes worker topology only. It does not remove the
verified-target lookup or the Developer/QA pass before a mapping checkpoint is published.
Artifacts to create or update
migrations/<project>/mapping/run.jsonmigrations/<project>/mapping/mapping-plan.jsonmigrations/<project>/mapping/entity-decisions/<entity>.jsonmigrations/<project>/mapping/llm-handoff.jsonmigrations/<project>/mapping/review/mapping-gaps.jsonmigrations/<project>/mapping/review/mapping-plan.mdmigrations/<project>/mapping/review/mapping-summary.mdmigrations/<project>/mapping/review/blocked-data-requests.mdmigrations/<project>/state/blocked-data-requests/<sourceEntityRef-slug>.jsonmigrations/<project>/orchestration/checkpoints.jsonmigrations/<project>/orchestration/approvals.json
Target dependency associations
For every target dependency consumed by an import, emit
dependencyBindings: [{ ref, censusIds: string[] }] in mapping/mapping-plan.json.
Use canonical domain/entity refs and every contributing decision row in the current
discovered census, including excluded rows. Entity decisions retain their explicit
targetRef and censusIds, or the census's implicit entity:<sourceEntity> link (a plugin
row's canonical plugin.<plugin>.<entity> ref resolves to the one census entity that records
it). A row with no census entity of its own, such as mapper-read variations, names its
sub-part explicitly (for example censusIds: ["entity:product/variants"]).
Show these associations in the mapping review. Missing, ambiguous, duplicate or incomplete
associations return to mapping; never infer a target from a plugin name or a comment.
An excluded dependency is not ready merely because its entity was omitted from the plan.
Readiness uses the existing census reconciliation and its current identified human approval.
Every contributing row must be excluded and owner-approved for a whole target ref to be
excluded-approved. Mixed planned/excluded contributions remain mixed. Agent/provisional
acceptance and finalized-run review do not authorize new writes.
When a specific dependent field may be omitted or must defer for an excluded contribution,
put dependencyFieldRules: [{ dependentRef, dependencyRef, path, action: "omit" | "defer" }]
on that contribution's existing census-linked mapping gap. Render the exact rules in the
existing review and bind them to its existing hash-based approval. Entity exclusion alone
never authorizes dropping a field; absent or stale approval defers the affected record.
Dependencies that need no separate producer
A dependency may need no import, setup step or exclusion: the data is absent, the selected
write creates or resolves it itself, or the approved mapping writes none of its references.
Never record those as an exclusion. Propose one entry per dependent operation in
dependencyProofs in mapping/mapping-plan.json:
{ "id": "product-media", "dependentRef": "stores/product", "operation": "createStoresProduct",
"ref": "media/media-file", "reason": "within-write", "explanation": "…", "evidenceRefs": ["…"],
"operationContractDigest": "<sha256>", "guardedPaths": ["…"], "creatingPaths": ["…"] }
operationis the dependent row's one resolved write operation:preferredWrite.writerId, plus only theauxiliaryOperationsits reviewed contract names. A single-create preference beside bulk-create outputs isdependency_operation_mixed; fix the mapping first.- Copy
guardedPaths,creatingPathsandoperationContractDigestfrom the reviewedoperationContractsentry in target knowledge (node scripts/dependency-preflight.js --project-dir <dir> --contract-digest <entityRef> <operation>). No contract entry, or no guarded paths, means the mapper must investigate the semantics and persist an evidence-bound local operation assessment before computing this digest. Never infer absence of references from absence of a shared entry. Only unresolved uncertainty holds the affected work. within-write: the contract haswithinWritefor that ref, the mapping writes its creating inputs (for example media URLs,brand.name) and none of its guarded paths, and maps one of the contract'srecovery.reconciliationKeys(for example productslug). Asynchronous work (product media) is verified later by observation, never assumed complete. Product images: map one row per item field insidemedia.itemsInfo.items[]—url(required), plusaltTextanddisplayNamewhen the source has them — all under onemappeddisposition for the intended item list. Never map the whole item oritems[].id, and label every output with the entity its write operation creates; a different label is refused asdependency_proof_operation_mislabelled.no-data: only for a ref the contract marksconditional, withabsencemeasured as one of:{ kind: "zero-row", censusIds }(every row measuredrecordCount: 0, stateno-data);{ kind: "zero-match", censusId, manifestPath, extractPath, extractSha256, predicate }over the complete populated extract (predicate:{ path, op: equals|in|present|startsWith, value(s) }or{ any: [...] }; a populated product collection with zero gift-card products is zero-match, never an empty collection); or{ kind: "capability-absent", capability, evidencePath, evidenceSha256 }whose evidence statesstatus: "absent"withscopeandobservedAt. A missing or failed discovery response is not absence.not-referenced: only for aconditionalref; no approved target path for that operation equals, contains or sits under a guarded path (writing wholelineItems[]is not proof of no tax group), and the row'sfieldMappingStatusis resolved. The preflight hands such a proof over ready to copy insuggestedProof: ondependency_proof_expectedwhen the ref is pending setup with no planned step (an order or an add-on with no tax group), and on a blockingdependency_unboundwhen nothing can produce the ref (a share image with no media row). A recorded proof wins over a setup step another dependent needs, so mapping and codegen bind it whether or not the plan makes that ref.
Before requesting mapping approval run `node scripts/dependency-preflight.js --project-dir
requiredSourceEntityRefs describes the prerequisites of the retained writes, not every
relationship discovered on the source. When the reviewed mapping omits all uses of a
relationship, remove that source prerequisite from the dependent entity's retained-write
list. Keep its census binding, explicit exclusion, exact omittedOutputs and dependent-field
rule in the same mapping review; never remove the domain dependency from the manifest.
For example, an unavailable tag writer becomes a disclosed tag omission proposal, not a
prerequisite requiring all products to wait for a nonexistent writer. Record the affected
product membership from the complete extract (unknown stays unknown), plus
nativeBehaviorMissing and a Fix/Dismiss action for the missing tag behavior. If the customer
does not accept that exact loss, retain the unresolved decision and its dependent scope.
An empty tag list must be observed in the source; never infer it from missing extraction.
A listed prerequisite absent from the mapped scope holds the dependent entity; its deferral
reason names the ref as possibly stale. Fix the list and re-run contract; never auto-remove it.
Shipping/tax setup prerequisites remain whole-task prerequisites. Map a single source
shipping line's title, cost and available delivery details. More than one line defers the
order with order-multiple-shipping-lines and a blocker gap. Select reference omission or
verified setup references only from the bundled field-level verification conclusions;
unverified shipping/tax fidelity keeps the affected order deferred. Never invent target
IDs, combine source lines without an approved disposition, or backfill existing orders.
Blocked source dependencies
The toolkit builds these requests at the mapping stage entry, on the way in and again on the way
out before the mapping approval (lib/blocked-data-entry.js): the plan's Wix targets x their
authored blockedSourceDependencies x the plugins discovery found, minus a source the plan maps
as its own entity, with askedInteractively: false. The rules below are what it applies; you only
read the result. Still plan structure-bridge entities yourself (below): a source planned as its
own entity drops out of the requests on the next entry.
Read only authored blockedSourceDependencies[] from selected target entity knowledge; never
infer a request from db-only, admin-page-only, or another channel by itself. Use the shared
lib/blocked-data-requests.js builder to aggregate one request per sourceEntityRef, appending
all dependent target entity/field rows. Resolve each source entity's blocked[].fulfillment
through rp-source-wordpress/lib/blocked-data-handlers.js; offer it only when its fixture
self-test passes. structure-bridge-plugin (wix-wp-plugin-v2) has no
manifest or readiness flag to check beyond that -- authorization is live (denylist +
DESCRIBE) at request time, not a build-time gate. This readiness check is the only
thing this stage does with a structure-bridge-plugin fulfillment: unlike csv-upload,
its actual data is never resolved through this file's attemptFulfillment()/snapshot
mechanism (that path is for a small, static, one-shot document) -- rp-import-codegen
generates a normal incremental reader for it instead, reusing the same table/
sampleStructureRequest metadata. See rp-import-codegen's "structure-bridge-plugin
entities" section. That reader authenticates with the same WordPress Application Password
as every other private read — rp-source-wordpress/plugins/README.md's "Resolving a db-only
capability" section.
Plan structure-bridge-plugin entities with lib/structure-bridge-planning.js before building blocked-data requests. Pass the canonical source entities as
sourceEntities as well as profiles to planStructureBridgeEntities({ plugins, sourceEntities, dataDir }). Bound entities do not need a profile. Preserve their canonical reference and
sourceMeta.extractionPlan unchanged; do not reconstruct bindings from legacy sidecars.
For object-shaped source entities retain each object's key/reference while making the array.
planStructureBridgeEntities({ plugins, sourceEntities, dataDir })
turns each such entity that has candidateTargetRefs[] into an entity decision (target,
readiness, read variant, discovery artifacts). An entity without a candidate target is
returned in blockedFieldSources and stays on the blocked-data path above. Pass the selected
target entities through partitionBlockedSourceDependencies(targets, decisions) and give its
targetEntities to the blocked-data builder, so a planned entity is never also requested as
a blocked field. Then writeStructureBridgePlanning(projectDir, decisions) writes
mapping/entity-decisions/<entity>.json and the mapping/mapping-plan.json row. It refuses
after the mapping review is approved. A rerun refreshes only the fields planning owns and
keeps field mappings, transformations, relationships and other edits already on the row. An
EAV read plan that fails its integrity check is a pending reason. A pending decision goes to
the review gate like any other pending row.
Persist the request under state/ as the authority and render
mapping/review/blocked-data-requests.md as a passive review section. This adds no new blocking
prompt. At an interactive mapping pause, set askedInteractively: true only if the request is
actually shown and a human can decline it. In 1-click mode set it to false; an unanswered
request remains missing, never declined, because the run did not pause to ask.
Minimum contents of the mapping plan
Include for each source entity:
- source semantics in this project, especially when the entity name is generic
(
comment,item,entry,record,media,user, etc.). State what the entity actually contains here, based on the discovered data, not just the route name. - target Wix entity or collection
- selected
targetRef,targetDomain,targetEntity,targetClassification,importReliability,preferredWrite, andknowledgeEvidencewhen the decision uses a bundled domain entity record - when
targetClassificationismanual-mapping: the entity'smanualStepsverbatim (prerequisite, actor-tagged steps, mechanism, evidence) instead of field mappings/transformation/validation rules below — there is no transform to author, only a runbook to carry over unchanged - primary key and deduplication strategy
- field mapping table
- transformation rules
- validation rules
- URL preservation policy for public routed entities
- unresolved questions
- setup implications for Wix-side configuration
- media policy when the entity carries media: whether only referenced media is in scope, whether the target accepts external URLs directly, and whether media must exist in Wix before create/update
When a source entity is generic or overloaded, the mapping plan must name the concrete subtypes or usage contexts it observed. Examples:
comment: blog post comments, product reviews, page commentsitem: order line items, catalog items, CMS rowsmedia: blog hero images, product gallery assets, downloadable files
Do not leave a generic entity label unexplained if the discovered data shows multiple real-world meanings.
Variant inventory is part of the catalog plan
For each source variant, plan either explicit stock (inventoryTracked, inventoryQuantity,
inStock canonical fields) or a named inventory gap. Use the source adapter's stock mapper;
stock flags, quantities, and backorders are different policies. Count every intended variant
before filtering gaps or failed product mappings. Carry that denominator into inventory
verification as expectedCount. A product count never stands in for inventory coverage.
Default-location stock is supported; any shared pool, multi-location allocation, preorder,
or fallback availability needs an explicit mapping decision. The target builder has no
implicit in-stock default. A legacy explicit inStock fallback must not override known
variant stock. Inventory verification remains required for deliberately excluded stock:
record the expected destination state and the gap rather than exempting the catalog audit.
Shipping delivery estimate from the merchant
When the merchant states a delivery time for a shipping zone in their own words, record it:
node skills/wix-replatform/scripts/orchestration-state.js decide --project-dir <projectDir> --key shipping-delivery-estimate:<zoneId> --value "<text>" --source user
Record it only from the merchant's own words. Never infer it, and never record it with
deterministic_inference or prior_artifact: the shipping stage ignores those and lists them,
so an inferred value can never become a checkout promise.
Identity and deduplication rules
Be explicit about the difference between a source ID and a Wix target ID.
- Preserve the source ID in the migration artifacts, generated code, local crosswalk state, and any optional CMS mirror collections needed for site-local traceability.
- Do not assume native Wix entity IDs can be client-assigned or preserved. For most Wix APIs, the target ID is server-assigned.
- When a target is a native Wix entity whose ID cannot be controlled by the client,
the mapping plan must define a local crosswalk strategy:
crosswalkAuthority: "local", a per-entitycrosswalkStrategy, and areconciliationStrategyused for dedupe, resume, and relationship resolution. - CMS
ImportCrosswalkis optional. UsecmsMirror: "none" | "download" | "upload" | "download-and-upload"to request it explicitly. It is a copy/seed adapter for existing-site or handoff reference flows, not the required resume authority. - Only say an ID is "preserved" when the destination actually has a client-controlled field that stores the source ID. Otherwise say the source ID is tracked or crosswalked.
When the destination already exists, map against its LIVE schema
WIX_SITE_STRATEGY=existing means the target is not an empty site provisioned to this
mapping's shape — it is a site in use, with its own collections, fields and records. Map
against what is actually there:
- Read the destination's current schema before proposing a target shape. A collection the site already has, with fields the owner added, is the target — not a new collection that happens to fit the source better. Two collections holding the same entity is the failure mode here, and it is one the owner has to untangle by hand.
- A field that exists but does not match is a GAP, not a migration. Record it in the faithfulness ledger and surface it in the mapping summary; do not plan a schema change to a live site, and never plan to drop or retype an existing field.
- Every entity needs a natural key, not just a crosswalk entry. The local crosswalk is empty on the first import into a site that already has data, so dedupe has to fall back to something the site itself carries — SKU, handle, slug, email. State that key per entity in the mapping plan; without it the import cannot tell "already there" from "new" and will duplicate the owner's catalog.
- Ask whether to set
cmsMirror: "download-and-upload"; do not set it unconditionally. CMSImportCrosswalkstays optional even on an existing destination — it requires the user to opt into site-local reference data, because Wix CMS quotas are plan-based and shared across every custom collection on the site, and a mirror the size of a large migration's crosswalk can consume
Truncated - read the full file at https://github.com/wix/skills/blob/HEAD/skills/wix-replatform/resources/rp-mapper/SKILL.md.
