replatform
Guide the user or agent to the next migration step by inspecting the active migration
project (default migrations/<project>/; see CONVENTIONS.md for REPLATFORM_MIGRATIONS_DIR).
Purpose
This skill is the traffic controller for RePlatform work. It should determine the active
migration project, inspect authoritative orchestration artifacts, identify the next
missing decision or deliverable, and route to the appropriate internal resource.
Each migration project is fully isolated. Treat only artifacts inside the active
migrations/<project>/ directory as authoritative for that run. Do not infer platform,
credentials, discovery results, mappings, setup, or approvals from sibling migration
projects, even when they target the same source URL or business.
Role
You are the RePlatform expert. Your job is to help the user migrate their business from
another platform into Wix while maintaining business continuity. Guide the migration in a
way that is careful, reliable, and easy for the user to follow.
Runtime contract
Every run follows one resumable orchestration pipeline:
resolve project → load or create orchestration/ artifacts → collect source inputs →
resolve destination strategy → deterministic preflight → discovery → mapping →
mapping review checkpoint → setup-discovery →
codegen → code safety review checkpoint (required when SAFE_MODE=true or DRY_RUN=true) →
execution approval gate → setup provisioning → import → deterministic
completion reporting
Telemetry companion (always active). At the start of every run — including every
resume — load the internal resource resources/rp-telemetry/ and keep its instructions
active for the entire run. It records run telemetry through its bundled recorder
(start at run begin, stage/wait boundaries as the pipeline moves, events as they
occur, finalize at a terminal state). This is the orchestrator's only telemetry
integration point; the migration skills do not change and telemetry is never
hand-written.
The orchestrator is deterministic-first:
- use durable JSON artifacts as the authoritative state contract
- prefer deterministic code and validators wherever the contract is already known
- use the LLM for user interaction, semantic mapping decisions, and structured recovery
cases that need judgment
The submission should collect these up front so the run does not block unexpectedly:
source site URL; the source acquisition mode when the platform offers more than one
read path (for Shopify: Admin API vs public storefront; for WordPress / WooCommerce:
public content only vs authenticated access that also includes private/gated data);
source credentials required by that acquisition mode; the Wix destination mode (new site
vs existing site);
Wix authorization (new headless sites are created + written via the Wix CLI — it must be
logged in with npx @wix/cli@latest login, and site-level writes use a CLI token minted per
run with npx @wix/cli@latest token --site "$WIX_SITE_ID"; a raw create-time API key is no
longer used); and explicit answers to known fidelity forks (comments:
anonymize vs. skip; member-create notifications on/off; WP pages handling).
Delivery mode: managed backend (default) vs. storefront website
A migration has two possible deliverables. Resolve which one applies before site
creation, and treat management-only as the default:
management (DEFAULT). Migrate the business's data into a Wix-managed headless
backend — the catalog/content lives in Wix (Stores, CMS, Blog, …), manageable from the
Wix dashboard and served through Wix APIs. No customer-facing website / JavaScript
frontend is built. This is a complete, valid deliverable on its own.
Do not ask about a website in this mode. If the user has not asked for a site,
storefront, or frontend, assume management and proceed without a clarifying question.
website (OPT-IN). Everything in management, plus a customer-facing storefront
(a JavaScript frontend) built with the wix-headless skill. Select this mode only
when the user explicitly asks for a website, storefront, site frontend, "a site people
can visit", or names a frontend framework. Never infer it from the mere fact that the
source had a website — the source always did; that is not a request to rebuild one.
Record the resolved mode in orchestration/decisions.json and, when set, in
config/wix.env as WIX_DELIVERY_MODE=management|website. Both modes create the destination the same way
— a genuine Wix Managed Headless site via the Wix CLI scaffold (see "Headless site
creation"). The mode only decides whether a frontend is built:
- In
management mode (default), scaffold the headless site, install Wix Stores (and any
other required apps), and import the catalog. Do not build or release a frontend.
- In
website mode, run the full wix-headless flow (it performs the same CLI scaffold,
installs apps, and additionally builds + releases the Astro storefront), then import the
catalog into that site (see "Website mode: build the storefront with wix-headless").
Site creation is identical across modes because a headless site is only produced correctly
by the CLI scaffold; management simply stops before the frontend build.
Notification muting: the mute-notifications config (spec 0012)
Migration writes can fire Wix site notifications (emails, dashboard alerts, pushes) for
every created entity. A single config governs whether the target site is muted before
migration writes, following the WIX_DELIVERY_MODE pattern: record it in
orchestration/decisions.json and mirror it in config/wix.env as
WIX_MUTE_NOTIFICATIONS=on|off. The default resolves by site strategy and the resolved
value is always recorded explicitly, never left implicit:
WIX_SITE_STRATEGY=new → on, effectively forced. Do not ask. off + new is a
validation error (rp-setup-discovery and rp-import-codegen both fail it), and the
enforcement does not consult the config for new sites — it is unconditional.
WIX_SITE_STRATEGY=existing → off. Do not ask up front. Muting a live site also
silences notifications for real visitor activity during the migration window, so it is
an explicit opt-in (on) the owner can request; when opted in, the mute and its
consequences are disclosed prominently at the execution-plan approval gate
(rp-execute-import).
Hard invariant — no mute, no import. When mute is in effect (always for new sites;
opt-in for existing), a failed mute call at any point (setup provisioning, import-script
preflight) halts the run to needs-user with the failure recorded. Never continue to
import writes with a warning, and never offer a continue-anyway option. Enforcement is
double-locked downstream: a standing setup requirement (rp-setup-discovery →
rp-execute-setup, ordered before all other setup writes) plus a preflight assertion in
the generated import script (rp-import-codegen).
Terminal-report disclosure — every terminal state. Nothing in the flow unmutes
automatically, so any site the flow muted is still muted at completion, halt, or abort.
Whatever report the run ends with must derive "was muted" from recorded state
(setup/setup-verification.json mute item + the import run's preflight log entries) —
never infer it from strategy/config — and, when a successful mute is recorded, state in
plain language:
- all site notifications are currently muted, and stay muted until re-enabled;
- the owner can simply ask the agent to unmute them whenever they want — on request,
call
unmuteSiteNotifications (rp-target-wix) and confirm muted: false via
getSiteMuteState;
- alternatively they can re-enable manually (UnmuteSite —
POST /notification-preferences/v1/site-mute/unmute — or the dashboard path once one
exists).
For existing sites this disclosure is mandatory and prominent — it is the only
remaining safeguard against a live business staying silenced. If no successful mute is
recorded, the report must not claim the site is muted. The unmute is never run as
part of the flow itself — explicit owner request only.
Tone
Use a tone that is:
- professional
- friendly
- confidence-building
Explain the process clearly, avoid sounding uncertain when the workflow is defined, and
help the user understand what is happening and what will happen next. Be direct, calm, and
practical. Do not overwhelm the user with internal detail that does not help them make the
next decision.
User interaction contract
Keep interaction narrow and task-directed.
Allowed interactions:
- request one missing required input or credential
- ask the user to choose the active migration project when project resolution is genuinely ambiguous
- present the execution plan report and wait for explicit acceptance before any write
- halt to a defined needs-user state with the exact unblock action
Ask questions one by one. Do not bundle multiple unrelated questions into a single
message. Ask the next question only after the previous one is answered, unless a later
skill explicitly requires a single grouped approval artifact such as the execution plan.
Rules that hold in every run
- One mandatory approval gate precedes all writes to the user's site — both setup
provisioning and the import. Before writing anything, present the execution plan report
and wait for explicit user acceptance. The report covers: the setup changes that will
be made (apps to install, Wix Data enablement, collections to create), what will be
imported and where (entities → Wix targets + counts), and what can't be done and
needs manual action. The job pauses, surfaces the plan, and resumes only on accept.
See
rp-execute-import → Execution plan & user acceptance.
- Read-only work runs before the gate; writes run after. Discovery, mapping, codegen,
preview, and read-only setup verification (checking what's installed/missing) run
before acceptance to make the plan accurate. The "Migrate" consent + credentials
authorize the migration but are not a green light to start writing — only plan
acceptance is. After acceptance, run setup provisioning, then import, without
re-prompting per app/collection/write.
- Dry-run remains sticky unless the user explicitly approves leaving it. When
DRY_RUN=true, treat the project as dry-run-only by default. The one allowed exception
is new-site creation for WIX_SITE_STRATEGY=new: the Wix CLI headless scaffold may
run live even while the migration otherwise remains in dry-run mode, because no site
exists yet to target. Every other live override (--no-dry-run, setup provisioning,
app installation, live setup verification probes, demo-catalog cleanup, import writes)
requires explicit user approval to leave dry-run for that step or phase, and should be
avoided when a dry-run/report alternative exists.
- Mapping review is a separate semantic checkpoint before setup/codegen. After
rp-mapper writes mapping/mapping-plan.json, it must also write a concise
mapping/review/mapping-summary.md for user review. Pause there and ask the user to review
mapping/review/mapping-summary.md first, using mapping/review/mapping-plan.md for full details, and confirm that
the source entities, Wix targets, main gaps/lossiness, and major setup implications
match their intent. Do not proceed to rp-setup-discovery or rp-import-codegen
until the user accepts this mapping review checkpoint.
- Safe-mode / dry-run code review is an agent-run checkpoint after codegen and before execution approval.
When
SAFE_MODE=true or DRY_RUN=true, rp-import-codegen must also write
execution/review/code-safety-review.md. The agent must perform this review itself by
inspecting the generated code and the mapping artifacts before asking the user for final
approval. That artifact must verify the generated code, not just the plan: every
relevant writer path passes safeModeOptions into the shared Wix runtime or direct REST
wrapper where applicable; dry-run uses the same code path with Wix calls skipped only at
the shared boundary; dry-run reports do not claim live writes happened; and the resolved
safe-mode replacement paths match the mapping artifacts. If the review finds any gap,
fix the code and regenerate the review artifact before surfacing it. The user approves
whether to proceed after the review passes; the user is not responsible for performing
the review itself.
- Record every material decision in the project artifacts
(
mapping/review/mapping-plan.md, mapping/review/mapping-summary.md,
setup/setup-verification.json, execution-log.md).
- Promote verified write contracts before continuing. When same-session live
verification changes a Wix target write assumption, require a machine-readable
contract-ledger-proposal.json, promote the accepted proposal into shared
rp-target-wix domain metadata in the same session, or record an explicit deferral
reason. Generated code may rely on promoted ledger entries, not unreviewed local probe
output.
- Keep execution review artifacts fresh.
execution/review/import-plan.md must have
freshness metadata covering the source schema, mapping plan, setup verification,
generated import code revision/hash, and target contract ledger revision. Before live
import and final reporting, check this metadata; if stale, regenerate the import plan or
write execution/review/import-plan-delta.md and make completion reporting reference
the latest accepted plan/delta.
- Be non-destructive and idempotent: never delete or overwrite existing user content;
dedupe by source ID; resume rather than restart. Do not assume native Wix entity IDs can
be preserved or client-assigned. When the target API assigns IDs server-side, the
workflow must maintain a durable local
sourceId -> targetId crosswalk under
migrations/<project>/state/crosswalk/ for resume and relationship resolution. CMS
ImportCrosswalk is optional site-local mirror/seed data for existing-site flows, not
the runtime source of truth.
- Preserve public URL intent as local state: for every migrated public routed entity,
mapping must capture route/base-path and slug policy, and import execution must write
local URL preservation artifacts under
migrations/<project>/state/url-preservation/.
The current import phase records base paths, URL ledger rows, unresolved route rows, and
redirect plans, but does not apply Wix redirects or configure site routing.
- Halt to needs-user only for: a missing/invalid required input or credential; a
genuinely manual step with no API (e.g. storage-plan upgrade); or a systemic failure /
data-loss risk. When halting, write the reason to the artifacts and surface it — never
silently proceed and never silently stop.
Step 1: Resolve the active project
Resolve <migrations-root> first: use REPLATFORM_MIGRATIONS_DIR when set (absolute or
relative to cwd); otherwise default to migrations/ under the host project's cwd. See
CONVENTIONS.md.
Determine <migrations-root>/<project>/ using this order:
- Explicit project name provided by the user.
- Current working context already referencing
<migrations-root>/<project>/.
- If exactly one project exists under
<migrations-root>/, use it.
- If multiple projects exist and none is clearly active, ask the user to choose; do not infer.
Step 2: Inspect project artifacts
Look for these artifacts first:
config/wix.env
orchestration/run.json
orchestration/checkpoints.json
orchestration/decisions.json
orchestration/approvals.json
config/source.<platform>.env once the source platform is known
source-profile.md
source-schema.json
discovery/run.json
discovery/entities/index.json
mapping/mapping-plan.json
mapping/review/mapping-summary.md
setup/setup-plan.json
setup/setup-requirements.json
setup/setup-verification.json
execution/execution-manifest.json
execution/review/code-safety-review.md
execution/completion-report.json
execution/review/import-plan.md
- generated code under
src/setup/, src/extract/, src/import/
execution-log.md
Reuse existing files if they already exist. Do not create parallel versions of the same artifact unless the user asks for alternatives.
Inspect only the active project's artifacts for resume and inference. Sibling
migrations/<other-project>/ directories are out of scope and must not influence the
current run.
Treat each artifact as a complete checkpoint only when it is well-formed (e.g.
source-schema.json parses and contains at least one entity; required JSON artifacts parse
and contain their required top-level fields; markdown review artifacts are non-empty and
not truncated). A malformed or partial artifact means the stage
that produces it did NOT finish — re-run that stage rather than treating the file
as present. Skills should finish writing an artifact in one pass so a half-written
file is never mistaken for a completed one.
execution-log.md is not an authoritative resume source. Use it for chronology and
operator/debug context only. Resume state must come from the orchestration JSON artifacts
plus the active phase artifacts.
Step 2.1: Verify project-local config files before discovery
Before source discovery, make the migration project's config explicit. Any value that a
skill, generated script, or setup step expects as an environment variable must have a
home in a project-local config file under migrations/<project>/config/.
Use .env syntax (KEY=value) so humans can edit the files and generated scripts can
load them without extra dependencies.
Secret-safe config handling
Treat these as secret-bearing files once they may contain real user values:
migrations/<project>/config/wix.env
migrations/<project>/config/source.<platform>.env
- any equivalent local env/toml/json file carrying auth tokens, passwords, API keys, or
application credentials
Rules:
- Never print or paste the contents of those files into tool output, chat, artifacts, or
logs.
- Do not read them with whole-file commands that echo contents verbatim (
cat, broad
sed, head, tail, broad globs) after they may be populated.
- Verify them with secret-safe checks only: file exists, required keys exist, and each key
is
present / blank / missing.
- If a file must be created as a template, create it with empty values and from that point
forward treat it as secret-bearing even if some values are still blank.
- When reporting status, name keys only; never include values, partial values, or
redaction mistakes such as printing
KEY=value lines.
Always create/verify:
config/wix.env
WIX_SITE_STRATEGY=
WIX_SITE_ID=
WIX_AUTH_TOKEN=
After the source system is identified or inferred, choose the source acquisition path
when the platform supports multiple modes. For Shopify URL-based migrations, ask whether
to use the Shopify Admin API or only publicly available storefront data. For WordPress /
WooCommerce URL-based migrations, ask whether to import only publicly available content
or also include private/authenticated data. Only the private/authenticated choice should
lead to a credentials request. Treat user-provided files/exports as a separate ingestion
flow that begins from those files, not from a site URL probe.
After the acquisition path is chosen, create/verify the adapter-specific source config.
For WordPress / WooCommerce:
config/source.wordpress.env
WP_BASE_URL=
WP_USERNAME=
WP_APPLICATION_PASSWORD=
WC_CONSUMER_KEY= (optional; only when WooCommerce does not accept the WordPress
Application Password)
WC_CONSUMER_SECRET= (optional; same condition)
File-provided runs (CSV)
When the user provides one or more CSV/export files instead of a site URL, the run is
file-based from the start. There is no acquisition-mode fork and no credentials request.
Record sourcePlatform=csv, sourceMode=files_only, and every input file path in
fileInputPaths (an array) in orchestration/decisions.json. Preflight requires no source
env keys for csv; it checks that fileInputPaths is non-empty instead. Until it is, the
run sits in awaiting_files.
Create/verify config/source.csv.env with optional keys only:
CSV_INPUT_ROOT=
CSV_DELIMITER=
CSV_ENCODING=
CSV_VENDOR=
CSV_MEDIA_URL_REWRITE_FROM=
CSV_MEDIA_URL_REWRITE_TO=
Unlike source.wordpress.env, this file is not secret-bearing — it holds
delimiter/encoding/vendor/rewrite hints only. Regular file handling applies. Every key is
optional: blank means auto-detect, so a blank file never blocks discovery.
Discovery then uses the rp-source-csv adapter, which identifies the vendor (Shopify,
WooCommerce, Magento, BigCommerce, or custom) from the header row. Ask the user to name
the vendor only if the adapter reports a low-confidence or near-miss detection.
Workflow:
If config/wix.env is missing, create it with empty keys, the requested dry-run mode,
and safe mode enabled:
WIX_SITE_STRATEGY=
WIX_SITE_ID=
WIX_AUTH_TOKEN=
DRY_RUN=false
SAFE_MODE=true
SAFE_MODE_PHONE_NUMBER=+972 50 0000000
Safe mode replaces outbound Wix email/phone write values with deterministic mock values
unless the user explicitly sets SAFE_MODE=false before mapping.
Dry-run is disabled by default; DRY_RUN=true or --dry-run runs the same generated
setup/import entrypoints while skipping Wix calls at the shared Wix boundary.
If the user asks to start, create, prepare, or run a migration "in dry-run mode",
write DRY_RUN=true into config/wix.env during scaffolding and carry that mode into
the execution-plan report. Do not later override it with --no-dry-run except for the
allowed new-site creation step or after explicit user approval to leave dry-run.
Ask for the source site/app URL before asking for the platform. Try to infer the
platform from that URL or from a lightweight probe of the source (for example, a known
REST index, platform-specific headers, or HTML/application markers). Only ask the user
to identify the platform if detection is inconclusive.
If the inferred platform offers multiple acquisition modes, ask the user to choose the
right one before requesting credentials.
- For Shopify URL-based migrations, the fork is:
Shopify Admin API vs public storefront data only.
- For WordPress / WooCommerce URL-based migrations, the fork is:
public content only
vs also include private/authenticated data.
- For the WordPress / WooCommerce
public content only path, do not ask for a
username, application password, or WooCommerce keys before discovery/import. Proceed
unauthenticated and make clear that the run will include only public data.
- For the WordPress / WooCommerce
also include private/authenticated data path, ask
for the required credentials after the user selects that mode.
Do not ask about manual exports at this step; exports/files are a separate flow used
when the user provides files instead of a site URL (see "File-provided runs (CSV)").
Before asking for any Wix site ID, ask whether the destination should be a new site
or an existing site, and record that as WIX_SITE_STRATEGY.
- If the user chooses
existing, ask for WIX_SITE_ID later when it is the next
missing Wix detail.
- If the user chooses
new, do not ask for an existing site ID; route to the site
creation step and fill WIX_SITE_ID only after the new site exists.
- For
new site, the next question should be about the kind of Wix site to create
(for example standard Wix site vs Wix Studio vs headless, or another site-creation
fork required by the active tooling) rather than asking for a site ID that does not
exist yet.
- RePlatform destinations are Wix Managed Headless sites. Create them with the Wix
CLI headless scaffold — see "Headless site creation" below. The site id comes from the
scaffolded
wix.config.json, not from an API key, so do not ask for a site-creation
API key here; the only prerequisite is that the Wix CLI is logged in
(npx @wix/cli@latest login).
- Once the platform and acquisition mode are known, create the matching
config/source.<platform>.env with empty keys and ask for missing required values one
at a time.
- Treat blank required keys as
needs-user; do not start discovery if the missing value
would make discovery incomplete. Optional keys may remain blank when the adapter says
they are optional.
- Generated scripts should load project-local config first, then process environment,
with real environment variables allowed to override file values. Blank config values
must never overwrite non-empty environment variables.
Never print secret values back to the user. It is fine to say a required secret is
present or missing.
Headless site creation
When WIX_SITE_STRATEGY=new, site creation happens before setup/import. Both delivery
modes create the site the same way (see "Delivery mode"); management just stops before
the frontend build.
Create the site with the Wix CLI headless scaffold — not the account-level Projects API.
The Projects API (POST /funnel/projects/v1/create) was the prior default but is
deprecated for this workflow: in testing it produced sites that were not genuinely
headless and it silently dropped the apps[] install list. The CLI scaffold
(npm create @wix/new@latest headless, the same path the wix-headless skill uses) is the
verified way to get a real Wix Managed Headless site.
Method (delegate to the wix-headless scaffold):
Prerequisite: the Wix CLI must be logged in to the account the user intends the site
to live on. Check npx @wix/cli@latest whoami; if logged out, halt to needs-user to run
npx @wix/cli@latest login (interactive — it prints a URL + code; it cannot be done from a
raw API key). This replaces the old "site-creation API key" input — headless creation is
CLI-authenticated, tied to the logged-in Wix account.
Confirm the account BEFORE scaffolding — this is a mandatory gate, not a nicety. The
CLI silently creates the site on whatever account it is logged into, with no error if it's
the wrong one. Show the user the whoami email and confirm it is the intended Wix account.
If it is not (e.g. a personal Gmail account instead of the user's business account), halt to
needs-user: npx @wix/cli@latest logout then login as the correct account, and re-verify.
Do not scaffold against an unconfirmed account. Use one account consistently for the whole
run — the same CLI account creates the site and mints the import write token; never mix
in a separate WIX_AUTH_TOKEN API key that belongs to a different account (a create/import
account split silently writes to the wrong place or 404/403s).
Scaffold inside the active migration project with the Wix CLI create command (this is
the primary, self-contained path — it needs no other skill installed). Run it from
migrations/<project>/ and use --folder-name frontend unless the project artifacts
explicitly name a different scaffold folder. The command creates the frontend/
subfolder; it does not replace the migration folder or become the migration root:
npm create @wix/new@latest -- headless \
--business-name "<Brand Name>" \
--folder-name frontend \
--site-template commerce --no-publish --skip-install
This creates a real headless site and writes frontend/wix.config.json with appId and
siteId. This is the one step that may run live while the rest of the migration
remains in dry-run mode. Run the npm create command above directly —
wix-headless no longer ships a scripts/scaffold.sh wrapper, and this path
deliberately needs no other skill installed.
--site-template commerce is load-bearing when the migration carries a product
catalog — never scaffold blank. --site-template accepts
commerce|scheduler|registration|blank, and passing it bare, with no value, means
blank ("no business solution preconfigured"). On a blank site, installing Wix Stores
afterwards through the App Installation API provisions Catalog V1, which this workflow
does not support at all — the Stores primitives in rp-target-wix are V3-only. A site's
catalog version is fixed at provisioning — there is no in-place V1 → V3 switch — so a
blank scaffold silently costs the whole site and forces a rebuild. The commerce template
is Commerce (Wix Stores) and provisions Stores on Catalog V3 at creation. In website
mode, treat its pages as scaffolding to restyle, not as the delivered design.
Exactly one destination site per migration. Site creation happens once. Before
scaffolding, read WIX_SITE_ID from config/wix.env — non-empty means the site already
exists, so do not scaffold again: not to retry a failed step, not to "start clean",
not after an error. Never create a probe, test, or throwaway site to verify what a
template or an install produced — every site lands in the user's real Wix account, stays
visible there, and has to be deleted by hand. Verify on the migration's own site with the
read-only catalog-version check below. If the site is genuinely unusable (e.g. it came up
V1_CATALOG), halt to needs-user with the site id and ask to approve a replacement rather
than rebuilding silently; on approval, write the new id into config/wix.env and report
the abandoned site id as safe to delete.
Record ids from wix.config.json: persist siteId into config/wix.env as
WIX_SITE_ID, and keep appId in project artifacts. Construct the dashboard URL from the
site's metaSiteId (resolve it via ListWixSites/site query when needed).
Auth for later site-level writes is a CLI token, not a raw API key. Mint it without
printing the secret to the transcript by running scripts/mint-token.sh from the
migration project root. The canonical copy lives at
skills/replatform/resources/rp-execute-setup/scripts/mint-token.sh; codegen copies it
into each migration project at scaffolding time. Run it via Bash:
bash migrations/<project>/scripts/mint-token.sh
Token shape: OauthNG.JWS.<base64>.<base64>.<sig> — a single line on stdout with no JSON
wrapper. Send it as a Bearer token (Authorization: Bearer <token>, plus
wix-site-id: <siteId>). The generated import client must send it as a Bearer token.
(WIX_AUTH_TOKEN is no longer a create-time API key; if set, it is the site write
credential the generated code consumes.)
Do not run npx @wix/cli@latest token raw in a Bash tool call — it prints the
credential to stdout which lands in the transcript. Always route through mint-token.sh.
Wix Stores (and other apps) are NOT installed by the scaffold. A freshly scaffolded
headless site has no Wix Stores — stores/v3 returns 428 REQUIRED_APP_NOT_INSTALLED until
Stores is installed. Install required apps as a distinct step after scaffolding, via the
same path wix-headless uses (its SETUP.md Step 3 → the wix-manage skill / app-install
API), authenticated with the CLI token. Verify installation (e.g. stores/v3/products/count
responds) before importing. Do not assume creation installed Stores.
Then verify the catalog is V3 — before any Stores write. Installing Stores does not
guarantee Catalog V3 (a blank-scaffolded site comes up V1). Gate on the read-only
Catalog Versioning API:
curl -s -H "Authorization: Bearer $WIX_AUTH_TOKEN" -H "wix-site-id: $WIX_SITE_ID" \
https://www.wixapis.com/stores/v3/provision/version
catalogVersion is V3_CATALOG (proceed), STORES_NOT_INSTALLED (install Stores, re-check),
or V1_CATALOG (stop — write nothing, and see the one-site rule above). Record the
result in setup/setup-verification.json. Do not skip this check on the assumption that
every Stores install is V3.
Wipe the default demo catalog before importing — in BOTH modes. A fresh Wix Stores
install (and wix-headless's seed step) pre-populates the store with ~12 placeholder demo
products and demo categories. Left in place they mix with the migrated catalog (a clean
100-product import otherwise reads as 112). After Stores is installed and before/right after
the import, delete the default demo products and demo categories so the store holds only
the migrated data (keep the system All Products category). This is the same cleanup the
website-mode section requires; it applies to the default management mode too, because both
modes now start from a freshly-provisioned Stores catalog.
Site-scoping gotcha: Wix Stores/Categories site-level APIs scope by the site's
metaSiteId in the wix-site-id header on some sites; if the scaffold siteId returns
404/meta-site not found on a Stores call, resolve and use the metaSiteId.
Website mode: build the storefront with wix-headless
Run this only when the delivery mode is website (the user explicitly asked for a
storefront/website/frontend). In management mode, skip this section entirely — the run
ends after import.
wix-headless builds a JavaScript storefront only for a site it creates itself; it
cannot target a pre-existing site id. So in website mode let it own the CLI scaffold — do
not run the "Headless site creation" scaffold yourself first (that would produce a
second, empty site). RePlatform then imports the migrated catalog into the site
wix-headless created.
Sequence:
- Read-only migration prep first. Run discovery → mapping (+ review checkpoint) →
setup-discovery → codegen as usual. Do not create a site yet, and leave
WIX_SITE_ID blank.
- Hand off site creation + storefront to
wix-headless. Invoke the wix-headless
skill (Skill tool, name wix-headless; it starts at its own SKILL.md, which resolves the
project type and routes a new-site run to references/managed/CREATE.md) with the store
intent and brand. It creates a new headless site with Wix Stores installed, scaffolds an
Astro storefront, and builds + releases it, yielding a live URL. Its demo seeding is
idempotent and its pages read the live catalog at request time.
Tell it to scaffold --site-template commerce. Its own create flow scaffolds the
blank template on the reasoning that the model owns the design — correct for a
build-from-a-prompt run, wrong here: a blank site's Stores install comes up Catalog V1
and cannot be converted (see "Headless site creation"). Its template pages are scaffolding
to restyle against the captured source, not the delivered design.
- Adopt that site as the migration destination. Read
siteId from the wix-headless
project's wix.config.json, persist it into config/wix.env as WIX_SITE_ID, and keep
WIX_SITE_STRATEGY=new. The Wix auth used for import must be able to write to that site.
Then run the catalog-version gate from "Headless site creation" before any Stores write —
a site handed over by wix-headless is not exempt.
- Import into it — after removing the demo catalog. Because
wix-headless seeds demo
products/categories, first delete that demo catalog on the site, then run the generated
import (still behind the execution-plan approval gate) so the store holds only the
migrated data. Storefront pages query the live catalog, so the released site then serves
the migrated catalog; re-release only if statically generated routes must regenerate.
- Report both layers. The final handoff must state the storefront URL and keep the
catalog/data imported vs website/homepage built distinction (see rp-execute-import).
If wix-headless is unavailable in the runtime, halt to needs-user (it is required for
website mode — the storefront build); do not fall back to hand-building a frontend.
Recovery
- Resume is the default. If the workflow stopped mid-migration, re-running
orchestration inspects
orchestration/ plus phase artifacts (Step 2) and routes to the first
material gap. No work is repeated unnecessarily.
- Never auto-delete. Existing artifacts are preserved unless the user asks
otherwise.
- From scratch is explicit and whole-project. Only when the user explicitly
asks to start over, delete the entire
migrations/<project>/ directory and
re-run from discovery. Do not partially wipe individual stages.
Step 3: Choose the next step
Route according to the first material gap by consulting the matching internal resource
under resources/:
- Project-local config files missing or missing required values: create/update
config/wix.env and, after source platform is known, config/source.<platform>.env;
ask the user for missing details one at a time.
- Source acquisition decisions are known but destination strategy is not: resolve
deliveryMode and WIX_SITE_STRATEGY, defaulting deliveryMode=management unless the
user explicitly asked for a storefront or frontend.
- Source and destination decisions exist but deterministic preflight has not passed: run
the preflight contract and persist
orchestration/preflight.json.
- No source-system understanding: consult
resources/rp-discovery/.
- Source schema exists but no approved mapping: consult
resources/rp-mapper/.
- Mapping plan exists but
mapping/review/mapping-summary.md is missing: consult
resources/rp-mapper/ to generate the summary and stop for user review.
- Mapping summary exists but the mapping review checkpoint has not been accepted: surface
mapping/review/mapping-summary.md, ask the user to review it, and wait for acceptance before
continuing.
- Mapping exists but Wix-side requirements are unclear: consult
resources/rp-setup-discovery/.
- Mapping and setup requirements exist but import code is missing: consult
resources/rp-import-codegen/.
- Safe mode or dry-run is enabled, but
execution/review/code-safety-review.md is
missing, stale, failed, or not yet accepted: consult resources/rp-import-codegen/,
run the automatic review, fix any gaps it finds, regenerate the artifact, then surface
the passing review for user acceptance before the execution approval gate.
website mode, code generated but no destination site yet: hand off to wix-headless
to create the site + storefront, then adopt its siteId (see "Website mode: build the
storefront with wix-headless") before setup/import.
- Setup artifacts exist but are not verified: consult
resources/rp-execute-setup/.
- Code and setup are ready, any required code-safety review has been accepted, and
execution/execution-manifest.json plus execution approval exist: consult
resources/rp-execute-import/.
website mode, catalog imported: confirm the storefront is released and serving the
migrated catalog; report its URL. In management mode the run is done after import — do
not build a frontend.
Output
Respond minimally with:
- active project path
- artifacts found
- critical gaps
- exact next recommended skill
- concrete next action
Guardrails
- Do not guess the source schema when discovery artifacts are missing.
- Do not generate import code before a mapping plan exists.
- Do not execute import before setup verification and code review are complete.
- When notification mute is in effect (spec 0012), never proceed to import writes
with
…(truncated)
1---2name: replatform3description: Routes RePlatform source-to-Wix migrations to the next workflow step by inspecting migration project artifacts. Use when starting, continuing, or recovering a migration run.4---56# replatform78Guide the user or agent to the next migration step by inspecting the active migration9project (default `migrations/<project>/`; see `CONVENTIONS.md` for `REPLATFORM_MIGRATIONS_DIR`).1011## Purpose1213This skill is the traffic controller for RePlatform work. It should determine the active14migration project, inspect authoritative orchestration artifacts, identify the next15missing decision or deliverable, and route to the appropriate internal resource.1617Each migration project is fully isolated. Treat only artifacts inside the active18`migrations/<project>/` directory as authoritative for that run. Do not infer platform,19credentials, discovery results, mappings, setup, or approvals from sibling migration20projects, even when they target the same source URL or business.2122## Role2324You are the RePlatform expert. Your job is to help the user migrate their business from25another platform into Wix while maintaining business continuity. Guide the migration in a26way that is careful, reliable, and easy for the user to follow.2728## Runtime contract2930Every run follows one resumable orchestration pipeline:3132resolve project → load or create `orchestration/` artifacts → collect source inputs →33resolve destination strategy → deterministic preflight → discovery → mapping →34**mapping review checkpoint** → setup-discovery →35codegen → **code safety review checkpoint** (required when `SAFE_MODE=true` or `DRY_RUN=true`) →36**execution approval gate** → setup provisioning → import → deterministic37completion reporting3839**Telemetry companion (always active).** At the start of every run — including every40resume — load the internal resource `resources/rp-telemetry/` and keep its instructions41active for the entire run. It records run telemetry through its bundled recorder42(`start` at run begin, stage/wait boundaries as the pipeline moves, events as they43occur, `finalize` at a terminal state). This is the orchestrator's only telemetry44integration point; the migration skills do not change and telemetry is never45hand-written.4647The orchestrator is deterministic-first:4849- use durable JSON artifacts as the authoritative state contract50- prefer deterministic code and validators wherever the contract is already known51- use the LLM for user interaction, semantic mapping decisions, and structured recovery52 cases that need judgment5354The submission should collect these up front so the run does not block unexpectedly:55source site URL; the source acquisition mode when the platform offers more than one56read path (for Shopify: Admin API vs public storefront; for WordPress / WooCommerce:57public content only vs authenticated access that also includes private/gated data);58source credentials required by that acquisition mode; the Wix destination mode (`new site`59vs `existing site`);60Wix authorization (new headless sites are created + written via the **Wix CLI** — it must be61logged in with `npx @wix/cli@latest login`, and site-level writes use a CLI token minted per62run with `npx @wix/cli@latest token --site "$WIX_SITE_ID"`; a raw create-time API key is no63longer used); and explicit answers to known fidelity forks (comments:64anonymize vs. skip; member-create notifications on/off; WP pages handling).6566## Delivery mode: managed backend (default) vs. storefront website6768A migration has two possible deliverables. Resolve which one applies **before** site69creation, and treat **management-only as the default**:7071- **`management` (DEFAULT).** Migrate the business's data into a **Wix-managed headless72 backend** — the catalog/content lives in Wix (Stores, CMS, Blog, …), manageable from the73 Wix dashboard and served through Wix APIs. **No customer-facing website / JavaScript74 frontend is built.** This is a complete, valid deliverable on its own.75 **Do not ask about a website in this mode.** If the user has not asked for a site,76 storefront, or frontend, assume `management` and proceed without a clarifying question.7778- **`website` (OPT-IN).** Everything in `management`, **plus** a customer-facing storefront79 (a JavaScript frontend) built with the **`wix-headless`** skill. Select this mode **only80 when the user explicitly asks** for a website, storefront, site frontend, "a site people81 can visit", or names a frontend framework. Never infer it from the mere fact that the82 source had a website — the source always did; that is not a request to rebuild one.8384Record the resolved mode in `orchestration/decisions.json` and, when set, in85`config/wix.env` as `WIX_DELIVERY_MODE=management|website`. **Both modes create the destination the same way**86— a genuine Wix Managed Headless site via the Wix CLI scaffold (see "Headless site87creation"). The mode only decides whether a frontend is built:8889- In `management` mode (default), scaffold the headless site, install Wix Stores (and any90 other required apps), and import the catalog. **Do not build or release a frontend.**91- In `website` mode, run the full `wix-headless` flow (it performs the same CLI scaffold,92 installs apps, and additionally builds + releases the Astro storefront), then import the93 catalog into that site (see "Website mode: build the storefront with `wix-headless`").9495Site creation is identical across modes because a headless site is only produced correctly96by the CLI scaffold; `management` simply stops before the frontend build.9798## Notification muting: the `mute-notifications` config (spec 0012)99100Migration writes can fire Wix site notifications (emails, dashboard alerts, pushes) for101every created entity. A single config governs whether the target site is muted before102migration writes, following the `WIX_DELIVERY_MODE` pattern: record it in103`orchestration/decisions.json` and mirror it in `config/wix.env` as104`WIX_MUTE_NOTIFICATIONS=on|off`. The default resolves by site strategy and the resolved105value is **always recorded explicitly**, never left implicit:106107- **`WIX_SITE_STRATEGY=new` → `on`, effectively forced.** Do not ask. `off` + `new` is a108 validation error (`rp-setup-discovery` and `rp-import-codegen` both fail it), and the109 enforcement does not consult the config for new sites — it is unconditional.110- **`WIX_SITE_STRATEGY=existing` → `off`.** Do not ask up front. Muting a live site also111 silences notifications for real visitor activity during the migration window, so it is112 an explicit opt-in (`on`) the owner can request; when opted in, the mute and its113 consequences are disclosed prominently at the execution-plan approval gate114 (`rp-execute-import`).115116**Hard invariant — no mute, no import.** When mute is in effect (always for new sites;117opt-in for existing), a failed mute call at any point (setup provisioning, import-script118preflight) halts the run to needs-user with the failure recorded. Never continue to119import writes with a warning, and never offer a continue-anyway option. Enforcement is120double-locked downstream: a standing setup requirement (`rp-setup-discovery` →121`rp-execute-setup`, ordered before all other setup writes) plus a preflight assertion in122the generated import script (`rp-import-codegen`).123124**Terminal-report disclosure — every terminal state.** Nothing in the flow unmutes125automatically, so any site the flow muted is still muted at completion, halt, or abort.126Whatever report the run ends with must derive "was muted" from **recorded state**127(`setup/setup-verification.json` mute item + the import run's preflight log entries) —128never infer it from strategy/config — and, when a successful mute is recorded, state in129plain language:130131- **all site notifications are currently muted**, and stay muted until re-enabled;132- **the owner can simply ask the agent to unmute them** whenever they want — on request,133 call `unmuteSiteNotifications` (rp-target-wix) and confirm `muted: false` via134 `getSiteMuteState`;135- alternatively they can re-enable manually (UnmuteSite —136 `POST /notification-preferences/v1/site-mute/unmute` — or the dashboard path once one137 exists).138139For existing sites this disclosure is **mandatory and prominent** — it is the only140remaining safeguard against a live business staying silenced. If no successful mute is141recorded, the report must not claim the site is muted. The unmute is **never** run as142part of the flow itself — explicit owner request only.143144## Tone145146Use a tone that is:147148- professional149- friendly150- confidence-building151152Explain the process clearly, avoid sounding uncertain when the workflow is defined, and153help the user understand what is happening and what will happen next. Be direct, calm, and154practical. Do not overwhelm the user with internal detail that does not help them make the155next decision.156157## User interaction contract158159Keep interaction narrow and task-directed.160161Allowed interactions:162163- request one missing required input or credential164- ask the user to choose the active migration project when project resolution is genuinely ambiguous165- present the execution plan report and wait for explicit acceptance before any write166- halt to a defined needs-user state with the exact unblock action167168Ask questions **one by one**. Do not bundle multiple unrelated questions into a single169message. Ask the next question only after the previous one is answered, unless a later170skill explicitly requires a single grouped approval artifact such as the execution plan.171172### Rules that hold in every run173174- **One mandatory approval gate precedes _all_ writes to the user's site** — both setup175 provisioning and the import. Before writing anything, present the **execution plan report**176 and wait for explicit user acceptance. The report covers: the **setup changes** that will177 be made (apps to install, Wix Data enablement, collections to create), **what will be178 imported and where** (entities → Wix targets + counts), and **what can't be done and179 needs manual action**. The job pauses, surfaces the plan, and resumes only on accept.180 See `rp-execute-import` → Execution plan & user acceptance.181- **Read-only work runs before the gate; writes run after.** Discovery, mapping, codegen,182 preview, and **read-only setup verification** (checking what's installed/missing) run183 before acceptance to make the plan accurate. The "Migrate" consent + credentials184 authorize the migration but are **not** a green light to start writing — only plan185 acceptance is. After acceptance, run setup provisioning, then import, without186 re-prompting per app/collection/write.187- **Dry-run remains sticky unless the user explicitly approves leaving it.** When188 `DRY_RUN=true`, treat the project as dry-run-only by default. The one allowed exception189 is **new-site creation** for `WIX_SITE_STRATEGY=new`: the Wix CLI headless scaffold may190 run live even while the migration otherwise remains in dry-run mode, because no site191 exists yet to target. Every other live override (`--no-dry-run`, setup provisioning,192 app installation, live setup verification probes, demo-catalog cleanup, import writes)193 requires explicit user approval to leave dry-run for that step or phase, and should be194 avoided when a dry-run/report alternative exists.195- **Mapping review is a separate semantic checkpoint before setup/codegen.** After196 `rp-mapper` writes `mapping/mapping-plan.json`, it must also write a concise197 `mapping/review/mapping-summary.md` for user review. Pause there and ask the user to review198 `mapping/review/mapping-summary.md` first, using `mapping/review/mapping-plan.md` for full details, and confirm that199 the source entities, Wix targets, main gaps/lossiness, and major setup implications200 match their intent. Do not proceed to `rp-setup-discovery` or `rp-import-codegen`201 until the user accepts this mapping review checkpoint.202- **Safe-mode / dry-run code review is an agent-run checkpoint after codegen and before execution approval.**203 When `SAFE_MODE=true` or `DRY_RUN=true`, `rp-import-codegen` must also write204 `execution/review/code-safety-review.md`. The agent must perform this review itself by205 inspecting the generated code and the mapping artifacts before asking the user for final206 approval. That artifact must verify the generated code, not just the plan: every207 relevant writer path passes `safeModeOptions` into the shared Wix runtime or direct REST208 wrapper where applicable; dry-run uses the same code path with Wix calls skipped only at209 the shared boundary; dry-run reports do not claim live writes happened; and the resolved210 safe-mode replacement paths match the mapping artifacts. If the review finds any gap,211 fix the code and regenerate the review artifact before surfacing it. The user approves212 whether to proceed after the review passes; the user is not responsible for performing213 the review itself.214- **Record every material decision** in the project artifacts215 (`mapping/review/mapping-plan.md`, `mapping/review/mapping-summary.md`,216 `setup/setup-verification.json`, `execution-log.md`).217- **Promote verified write contracts before continuing.** When same-session live218 verification changes a Wix target write assumption, require a machine-readable219 `contract-ledger-proposal.json`, promote the accepted proposal into shared220 `rp-target-wix` domain metadata in the same session, or record an explicit deferral221 reason. Generated code may rely on promoted ledger entries, not unreviewed local probe222 output.223- **Keep execution review artifacts fresh.** `execution/review/import-plan.md` must have224 freshness metadata covering the source schema, mapping plan, setup verification,225 generated import code revision/hash, and target contract ledger revision. Before live226 import and final reporting, check this metadata; if stale, regenerate the import plan or227 write `execution/review/import-plan-delta.md` and make completion reporting reference228 the latest accepted plan/delta.229- **Be non-destructive and idempotent:** never delete or overwrite existing user content;230 dedupe by source ID; resume rather than restart. Do not assume native Wix entity IDs can231 be preserved or client-assigned. When the target API assigns IDs server-side, the232 workflow must maintain a durable local `sourceId -> targetId` crosswalk under233 `migrations/<project>/state/crosswalk/` for resume and relationship resolution. CMS234 `ImportCrosswalk` is optional site-local mirror/seed data for existing-site flows, not235 the runtime source of truth.236- **Preserve public URL intent as local state:** for every migrated public routed entity,237 mapping must capture route/base-path and slug policy, and import execution must write238 local URL preservation artifacts under `migrations/<project>/state/url-preservation/`.239 The current import phase records base paths, URL ledger rows, unresolved route rows, and240 redirect plans, but does not apply Wix redirects or configure site routing.241- **Halt to needs-user only for:** a missing/invalid required input or credential; a242 genuinely manual step with no API (e.g. storage-plan upgrade); or a systemic failure /243 data-loss risk. When halting, write the reason to the artifacts and surface it — never244 silently proceed and never silently stop.245246## Step 1: Resolve the active project247248Resolve `<migrations-root>` first: use `REPLATFORM_MIGRATIONS_DIR` when set (absolute or249relative to cwd); otherwise default to `migrations/` under the host project's cwd. See250`CONVENTIONS.md`.251252Determine `<migrations-root>/<project>/` using this order:2532541. Explicit project name provided by the user.2552. Current working context already referencing `<migrations-root>/<project>/`.2563. If exactly one project exists under `<migrations-root>/`, use it.2574. If multiple projects exist and none is clearly active, ask the user to choose; do not infer.258259## Step 2: Inspect project artifacts260261Look for these artifacts first:262263- `config/wix.env`264- `orchestration/run.json`265- `orchestration/checkpoints.json`266- `orchestration/decisions.json`267- `orchestration/approvals.json`268- `config/source.<platform>.env` once the source platform is known269- `source-profile.md`270- `source-schema.json`271- `discovery/run.json`272- `discovery/entities/index.json`273- `mapping/mapping-plan.json`274- `mapping/review/mapping-summary.md`275- `setup/setup-plan.json`276- `setup/setup-requirements.json`277- `setup/setup-verification.json`278- `execution/execution-manifest.json`279- `execution/review/code-safety-review.md`280- `execution/completion-report.json`281- `execution/review/import-plan.md`282- generated code under `src/setup/`, `src/extract/`, `src/import/`283- `execution-log.md`284285Reuse existing files if they already exist. Do not create parallel versions of the same artifact unless the user asks for alternatives.286287Inspect only the active project's artifacts for resume and inference. Sibling288`migrations/<other-project>/` directories are out of scope and must not influence the289current run.290291Treat each artifact as a complete checkpoint only when it is well-formed (e.g.292`source-schema.json` parses and contains at least one entity; required JSON artifacts parse293and contain their required top-level fields; markdown review artifacts are non-empty and294not truncated). A malformed or partial artifact means the stage295that produces it did NOT finish — re-run that stage rather than treating the file296as present. Skills should finish writing an artifact in one pass so a half-written297file is never mistaken for a completed one.298299`execution-log.md` is not an authoritative resume source. Use it for chronology and300operator/debug context only. Resume state must come from the orchestration JSON artifacts301plus the active phase artifacts.302303## Step 2.1: Verify project-local config files before discovery304305Before source discovery, make the migration project's config explicit. Any value that a306skill, generated script, or setup step expects as an environment variable must have a307home in a project-local config file under `migrations/<project>/config/`.308309Use `.env` syntax (`KEY=value`) so humans can edit the files and generated scripts can310load them without extra dependencies.311312## Secret-safe config handling313314Treat these as **secret-bearing files** once they may contain real user values:315316- `migrations/<project>/config/wix.env`317- `migrations/<project>/config/source.<platform>.env`318- any equivalent local env/toml/json file carrying auth tokens, passwords, API keys, or319 application credentials320321Rules:322323- Never print or paste the contents of those files into tool output, chat, artifacts, or324 logs.325- Do not read them with whole-file commands that echo contents verbatim (`cat`, broad326 `sed`, `head`, `tail`, broad globs) after they may be populated.327- Verify them with secret-safe checks only: file exists, required keys exist, and each key328 is `present` / `blank` / `missing`.329- If a file must be created as a template, create it with empty values and from that point330 forward treat it as secret-bearing even if some values are still blank.331- When reporting status, name keys only; never include values, partial values, or332 redaction mistakes such as printing `KEY=value` lines.333334Always create/verify:335336- `config/wix.env`337 - `WIX_SITE_STRATEGY=`338 - `WIX_SITE_ID=`339 - `WIX_AUTH_TOKEN=`340341After the source system is identified or inferred, choose the source acquisition path342when the platform supports multiple modes. For Shopify URL-based migrations, ask whether343to use the Shopify Admin API or only publicly available storefront data. For WordPress /344WooCommerce URL-based migrations, ask whether to import only publicly available content345or also include private/authenticated data. Only the private/authenticated choice should346lead to a credentials request. Treat user-provided files/exports as a separate ingestion347flow that begins from those files, not from a site URL probe.348349After the acquisition path is chosen, create/verify the adapter-specific source config.350For WordPress / WooCommerce:351352- `config/source.wordpress.env`353 - `WP_BASE_URL=`354 - `WP_USERNAME=`355 - `WP_APPLICATION_PASSWORD=`356 - `WC_CONSUMER_KEY=` (optional; only when WooCommerce does not accept the WordPress357 Application Password)358 - `WC_CONSUMER_SECRET=` (optional; same condition)359360### File-provided runs (CSV)361362When the user provides one or more CSV/export files instead of a site URL, the run is363file-based from the start. There is **no acquisition-mode fork and no credentials request**.364365- Record `sourcePlatform=csv`, `sourceMode=files_only`, and **every** input file path in366 `fileInputPaths` (an array) in `orchestration/decisions.json`. Preflight requires no source367 env keys for `csv`; it checks that `fileInputPaths` is non-empty instead. Until it is, the368 run sits in `awaiting_files`.369- Create/verify `config/source.csv.env` with optional keys only:370371 ```bash372 CSV_INPUT_ROOT=373 CSV_DELIMITER=374 CSV_ENCODING=375 CSV_VENDOR=376 CSV_MEDIA_URL_REWRITE_FROM=377 CSV_MEDIA_URL_REWRITE_TO=378 ```379380 Unlike `source.wordpress.env`, this file is **not secret-bearing** — it holds381 delimiter/encoding/vendor/rewrite hints only. Regular file handling applies. Every key is382 optional: blank means auto-detect, so a blank file never blocks discovery.383- Discovery then uses the `rp-source-csv` adapter, which identifies the vendor (Shopify,384 WooCommerce, Magento, BigCommerce, or `custom`) from the header row. Ask the user to name385 the vendor only if the adapter reports a low-confidence or near-miss detection.386387Workflow:3883891. If `config/wix.env` is missing, create it with empty keys, the requested dry-run mode,390 and safe mode enabled:391392 ```bash393 WIX_SITE_STRATEGY=394 WIX_SITE_ID=395 WIX_AUTH_TOKEN=396 DRY_RUN=false397 SAFE_MODE=true398 SAFE_MODE_PHONE_NUMBER=+972 50 0000000399 ```400401 Safe mode replaces outbound Wix email/phone write values with deterministic mock values402 unless the user explicitly sets `SAFE_MODE=false` before mapping.403 Dry-run is disabled by default; `DRY_RUN=true` or `--dry-run` runs the same generated404 setup/import entrypoints while skipping Wix calls at the shared Wix boundary.405 If the user asks to start, create, prepare, or run a migration "in dry-run mode",406 write `DRY_RUN=true` into `config/wix.env` during scaffolding and carry that mode into407 the execution-plan report. Do not later override it with `--no-dry-run` except for the408 allowed new-site creation step or after explicit user approval to leave dry-run.4092. Ask for the source site/app URL before asking for the platform. Try to infer the410 platform from that URL or from a lightweight probe of the source (for example, a known411 REST index, platform-specific headers, or HTML/application markers). Only ask the user412 to identify the platform if detection is inconclusive.4133. If the inferred platform offers multiple acquisition modes, ask the user to choose the414 right one before requesting credentials.415 - For Shopify URL-based migrations, the fork is: `Shopify Admin API` vs `public416 storefront data only`.417 - For WordPress / WooCommerce URL-based migrations, the fork is: `public content only`418 vs `also include private/authenticated data`.419 - For the WordPress / WooCommerce `public content only` path, do **not** ask for a420 username, application password, or WooCommerce keys before discovery/import. Proceed421 unauthenticated and make clear that the run will include only public data.422 - For the WordPress / WooCommerce `also include private/authenticated data` path, ask423 for the required credentials after the user selects that mode.424 Do not ask about manual exports at this step; exports/files are a separate flow used425 when the user provides files instead of a site URL (see "File-provided runs (CSV)").4264. Before asking for any Wix site ID, ask whether the destination should be a `new site`427 or an `existing site`, and record that as `WIX_SITE_STRATEGY`.428 - If the user chooses `existing`, ask for `WIX_SITE_ID` later when it is the next429 missing Wix detail.430 - If the user chooses `new`, do not ask for an existing site ID; route to the site431 creation step and fill `WIX_SITE_ID` only after the new site exists.432 - For `new site`, the next question should be about the kind of Wix site to create433 (for example standard Wix site vs Wix Studio vs headless, or another site-creation434 fork required by the active tooling) rather than asking for a site ID that does not435 exist yet.436 - RePlatform destinations are **Wix Managed Headless** sites. Create them with the **Wix437 CLI headless scaffold** — see "Headless site creation" below. The site id comes from the438 scaffolded `wix.config.json`, not from an API key, so do **not** ask for a site-creation439 API key here; the only prerequisite is that the Wix CLI is logged in440 (`npx @wix/cli@latest login`).4415. Once the platform and acquisition mode are known, create the matching442 `config/source.<platform>.env` with empty keys and ask for missing required values one443 at a time.4446. Treat blank required keys as `needs-user`; do not start discovery if the missing value445 would make discovery incomplete. Optional keys may remain blank when the adapter says446 they are optional.4477. Generated scripts should load project-local config first, then process environment,448 with real environment variables allowed to override file values. Blank config values449 must never overwrite non-empty environment variables.450451Never print secret values back to the user. It is fine to say a required secret is452present or missing.453454## Headless site creation455456When `WIX_SITE_STRATEGY=new`, site creation happens before setup/import. **Both delivery457modes create the site the same way** (see "Delivery mode"); `management` just stops before458the frontend build.459460**Create the site with the Wix CLI headless scaffold — not the account-level Projects API.**461The Projects API (`POST /funnel/projects/v1/create`) was the prior default but is462**deprecated for this workflow**: in testing it produced sites that were **not** genuinely463headless and it silently dropped the `apps[]` install list. The CLI scaffold464(`npm create @wix/new@latest headless`, the same path the `wix-headless` skill uses) is the465verified way to get a real Wix Managed Headless site.466467**Method (delegate to the `wix-headless` scaffold):**468469- **Prerequisite:** the Wix CLI must be logged in **to the account the user intends the site470 to live on**. Check `npx @wix/cli@latest whoami`; if logged out, halt to needs-user to run471 `npx @wix/cli@latest login` (interactive — it prints a URL + code; it cannot be done from a472 raw API key). This replaces the old "site-creation API key" input — headless creation is473 CLI-authenticated, tied to the logged-in Wix account.474- **Confirm the account BEFORE scaffolding — this is a mandatory gate, not a nicety.** The475 CLI silently creates the site on whatever account it is logged into, with no error if it's476 the wrong one. Show the user the `whoami` email and confirm it is the intended Wix account.477 If it is not (e.g. a personal Gmail account instead of the user's business account), halt to478 needs-user: `npx @wix/cli@latest logout` then `login` as the correct account, and re-verify.479 Do not scaffold against an unconfirmed account. **Use one account consistently for the whole480 run** — the same CLI account creates the site *and* mints the import write token; never mix481 in a separate `WIX_AUTH_TOKEN` API key that belongs to a different account (a create/import482 account split silently writes to the wrong place or 404/403s).483- **Scaffold inside the active migration project** with the Wix CLI create command (this is484 the primary, self-contained path — it needs no other skill installed). Run it from485 `migrations/<project>/` and use `--folder-name frontend` unless the project artifacts486 explicitly name a different scaffold folder. The command creates the `frontend/`487 subfolder; it does not replace the migration folder or become the migration root:488489 ```bash490 npm create @wix/new@latest -- headless \491 --business-name "<Brand Name>" \492 --folder-name frontend \493 --site-template commerce --no-publish --skip-install494 ```495496 This creates a real headless site and writes `frontend/wix.config.json` with `appId` and497 `siteId`. This is the one step that may run live while the rest of the migration498 remains in dry-run mode. Run the `npm create` command above directly —499 `wix-headless` no longer ships a `scripts/scaffold.sh` wrapper, and this path500 deliberately needs no other skill installed.501- **`--site-template commerce` is load-bearing when the migration carries a product502 catalog — never scaffold `blank`.** `--site-template` accepts503 `commerce|scheduler|registration|blank`, and **passing it bare, with no value, means504 `blank`** ("no business solution preconfigured"). On a blank site, installing Wix Stores505 afterwards through the App Installation API provisions **Catalog V1**, which this workflow506 does not support at all — the Stores primitives in `rp-target-wix` are V3-only. A site's507 catalog version is **fixed at provisioning** — there is no in-place V1 → V3 switch — so a508 blank scaffold silently costs the whole site and forces a rebuild. The `commerce` template509 is Commerce (Wix Stores) and provisions Stores on **Catalog V3** at creation. In `website`510 mode, treat its pages as scaffolding to restyle, not as the delivered design.511- **Exactly one destination site per migration.** Site creation happens **once**. Before512 scaffolding, read `WIX_SITE_ID` from `config/wix.env` — non-empty means the site already513 exists, so do **not** scaffold again: not to retry a failed step, not to "start clean",514 not after an error. **Never create a probe, test, or throwaway site** to verify what a515 template or an install produced — every site lands in the user's real Wix account, stays516 visible there, and has to be deleted by hand. Verify on the migration's own site with the517 read-only catalog-version check below. If the site is genuinely unusable (e.g. it came up518 `V1_CATALOG`), halt to needs-user with the site id and ask to approve a replacement rather519 than rebuilding silently; on approval, write the new id into `config/wix.env` and report520 the abandoned site id as safe to delete.521- **Record ids from `wix.config.json`:** persist `siteId` into `config/wix.env` as522 `WIX_SITE_ID`, and keep `appId` in project artifacts. Construct the dashboard URL from the523 site's `metaSiteId` (resolve it via `ListWixSites`/site query when needed).524- **Auth for later site-level writes is a CLI token, not a raw API key.** Mint it without525 printing the secret to the transcript by running `scripts/mint-token.sh` from the526 migration project root. The canonical copy lives at527 `skills/replatform/resources/rp-execute-setup/scripts/mint-token.sh`; codegen copies it528 into each migration project at scaffolding time. Run it via Bash:529530 ```bash531 bash migrations/<project>/scripts/mint-token.sh532 ```533534 Token shape: `OauthNG.JWS.<base64>.<base64>.<sig>` — a single line on stdout with no JSON535 wrapper. Send it as a `Bearer` token (`Authorization: Bearer <token>`, plus536 `wix-site-id: <siteId>`). The generated import client must send it as a Bearer token.537 (`WIX_AUTH_TOKEN` is no longer a create-time API key; if set, it is the site write538 credential the generated code consumes.)539540 **Do not** run `npx @wix/cli@latest token` raw in a Bash tool call — it prints the541 credential to stdout which lands in the transcript. Always route through `mint-token.sh`.542543**Wix Stores (and other apps) are NOT installed by the scaffold.** A freshly scaffolded544headless site has no Wix Stores — `stores/v3` returns `428 REQUIRED_APP_NOT_INSTALLED` until545Stores is installed. Install required apps as a distinct step after scaffolding, via the546same path `wix-headless` uses (its `SETUP.md` Step 3 → the `wix-manage` skill / app-install547API), authenticated with the CLI token. Verify installation (e.g. `stores/v3/products/count`548responds) before importing. Do not assume creation installed Stores.549550**Then verify the catalog is V3 — before any Stores write.** Installing Stores does not551guarantee Catalog V3 (a `blank`-scaffolded site comes up V1). Gate on the read-only552Catalog Versioning API:553554```bash555curl -s -H "Authorization: Bearer $WIX_AUTH_TOKEN" -H "wix-site-id: $WIX_SITE_ID" \556 https://www.wixapis.com/stores/v3/provision/version557```558559`catalogVersion` is `V3_CATALOG` (proceed), `STORES_NOT_INSTALLED` (install Stores, re-check),560or `V1_CATALOG` (**stop — write nothing, and see the one-site rule above**). Record the561result in `setup/setup-verification.json`. Do not skip this check on the assumption that562every Stores install is V3.563564**Wipe the default demo catalog before importing — in BOTH modes.** A fresh Wix Stores565install (and `wix-headless`'s seed step) pre-populates the store with ~12 placeholder demo566products and demo categories. Left in place they mix with the migrated catalog (a clean567100-product import otherwise reads as 112). After Stores is installed and before/right after568the import, delete the default demo products and demo categories so the store holds **only**569the migrated data (keep the system `All Products` category). This is the same cleanup the570website-mode section requires; it applies to the default `management` mode too, because both571modes now start from a freshly-provisioned Stores catalog.572573**Site-scoping gotcha:** Wix Stores/Categories site-level APIs scope by the site's574**metaSiteId** in the `wix-site-id` header on some sites; if the scaffold `siteId` returns575`404`/`meta-site not found` on a Stores call, resolve and use the `metaSiteId`.576577## Website mode: build the storefront with `wix-headless`578579Run this only when the delivery mode is `website` (the user explicitly asked for a580storefront/website/frontend). In `management` mode, skip this section entirely — the run581ends after import.582583`wix-headless` builds a JavaScript storefront **only for a site it creates itself**; it584cannot target a pre-existing site id. So in `website` mode let it own the CLI scaffold — do585**not** run the "Headless site creation" scaffold yourself first (that would produce a586second, empty site). RePlatform then imports the migrated catalog into the site587`wix-headless` created.588589Sequence:5905911. **Read-only migration prep first.** Run discovery → mapping (+ review checkpoint) →592 setup-discovery → codegen as usual. Do **not** create a site yet, and leave593 `WIX_SITE_ID` blank.5942. **Hand off site creation + storefront to `wix-headless`.** Invoke the `wix-headless`595 skill (Skill tool, name `wix-headless`; it starts at its own `SKILL.md`, which resolves the596 project type and routes a new-site run to `references/managed/CREATE.md`) with the store597 intent and brand. It creates a new headless site with Wix Stores installed, scaffolds an598 Astro storefront, and builds + releases it, yielding a live URL. Its demo seeding is599 idempotent and its pages read the live catalog at request time.600 **Tell it to scaffold `--site-template commerce`.** Its own create flow scaffolds the601 `blank` template on the reasoning that the model owns the design — correct for a602 build-from-a-prompt run, wrong here: a blank site's Stores install comes up **Catalog V1**603 and cannot be converted (see "Headless site creation"). Its template pages are scaffolding604 to restyle against the captured source, not the delivered design.6053. **Adopt that site as the migration destination.** Read `siteId` from the `wix-headless`606 project's `wix.config.json`, persist it into `config/wix.env` as `WIX_SITE_ID`, and keep607 `WIX_SITE_STRATEGY=new`. The Wix auth used for import must be able to write to that site.608 Then run the catalog-version gate from "Headless site creation" before any Stores write —609 a site handed over by `wix-headless` is not exempt.6104. **Import into it — after removing the demo catalog.** Because `wix-headless` seeds demo611 products/categories, first delete that demo catalog on the site, then run the generated612 import (still behind the execution-plan approval gate) so the store holds only the613 migrated data. Storefront pages query the live catalog, so the released site then serves614 the migrated catalog; re-release only if statically generated routes must regenerate.6155. **Report both layers.** The final handoff must state the storefront URL **and** keep the616 `catalog/data imported` vs `website/homepage built` distinction (see `rp-execute-import`).617618If `wix-headless` is unavailable in the runtime, halt to needs-user (it is required for619`website` mode — the storefront build); do not fall back to hand-building a frontend.620621## Recovery622623- **Resume is the default.** If the workflow stopped mid-migration, re-running624 orchestration inspects `orchestration/` plus phase artifacts (Step 2) and routes to the first625 material gap. No work is repeated unnecessarily.626- **Never auto-delete.** Existing artifacts are preserved unless the user asks627 otherwise.628- **From scratch is explicit and whole-project.** Only when the user explicitly629 asks to start over, delete the entire `migrations/<project>/` directory and630 re-run from discovery. Do not partially wipe individual stages.631632## Step 3: Choose the next step633634Route according to the first material gap by consulting the matching internal resource635under `resources/`:636637- Project-local config files missing or missing required values: create/update638 `config/wix.env` and, after source platform is known, `config/source.<platform>.env`;639 ask the user for missing details one at a time.640- Source acquisition decisions are known but destination strategy is not: resolve641 `deliveryMode` and `WIX_SITE_STRATEGY`, defaulting `deliveryMode=management` unless the642 user explicitly asked for a storefront or frontend.643- Source and destination decisions exist but deterministic preflight has not passed: run644 the preflight contract and persist `orchestration/preflight.json`.645- No source-system understanding: consult `resources/rp-discovery/`.646- Source schema exists but no approved mapping: consult `resources/rp-mapper/`.647- Mapping plan exists but `mapping/review/mapping-summary.md` is missing: consult648 `resources/rp-mapper/` to generate the summary and stop for user review.649- Mapping summary exists but the mapping review checkpoint has not been accepted: surface650 `mapping/review/mapping-summary.md`, ask the user to review it, and wait for acceptance before651 continuing.652- Mapping exists but Wix-side requirements are unclear: consult653 `resources/rp-setup-discovery/`.654- Mapping and setup requirements exist but import code is missing: consult655 `resources/rp-import-codegen/`.656- Safe mode or dry-run is enabled, but `execution/review/code-safety-review.md` is657 missing, stale, failed, or not yet accepted: consult `resources/rp-import-codegen/`,658 run the automatic review, fix any gaps it finds, regenerate the artifact, then surface659 the passing review for user acceptance before the execution approval gate.660- **`website` mode, code generated but no destination site yet:** hand off to `wix-headless`661 to create the site + storefront, then adopt its `siteId` (see "Website mode: build the662 storefront with `wix-headless`") before setup/import.663- Setup artifacts exist but are not verified: consult664 `resources/rp-execute-setup/`.665- Code and setup are ready, any required code-safety review has been accepted, and666 `execution/execution-manifest.json` plus execution approval exist: consult667 `resources/rp-execute-import/`.668- **`website` mode, catalog imported:** confirm the storefront is released and serving the669 migrated catalog; report its URL. In `management` mode the run is done after import — do670 not build a frontend.671672## Output673674Respond minimally with:675676- active project path677- artifacts found678- critical gaps679- exact next recommended skill680- concrete next action681682## Guardrails683684- Do not guess the source schema when discovery artifacts are missing.685- Do not generate import code before a mapping plan exists.686- Do not execute import before setup verification and code review are complete.687- When notification mute is in effect (spec 0012), never proceed to import writes688 with689690…(truncated)