Wix Replatform
WixOfficialPublished by Wix
- Skill
- Workflow
- Automation and integrations
- MIT
- Low risk
- Has scripts
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
wix-replatform acts as a central supervisor for migrating data and content to Wix. It does not perform migration tasks directly but instead inspects migration artifacts to determine the next required stage in the pipeline. By maintaining a deterministic state, it ensures that migrations can be started, resumed, or recovered reliably without duplicating work or creating redundant destination sites. It manages the flow through various phases including discovery, mapping, setup, and import, while enforcing strict validation and approval gates.
What it does
- Routes migration tasks to appropriate sub-modules based on current project state.
- Ensures resumability by tracking migration progress through authoritative artifacts.
- Enforces mandatory approval gates before performing write operations.
- Dispatches specialized subagents for specific tasks to maintain context boundaries.
- Validates artifacts at each stage to prevent proceeding with corrupted or stale data.
- Handles reruns for incremental data updates without re-scaffolding the entire project.
When to use it
- When initiating a new migration from an external source to a Wix site.
- When resuming a migration that was interrupted or stopped.
- When recovering from a failed migration stage by addressing specific errors.
- When performing incremental imports to sync new or modified records after an initial migration.
Advantages
- Prevents data duplication by enforcing idempotent write operations.
- Maintains a clear audit trail through structured telemetry and completion reports.
- Reduces risk by requiring explicit approvals before critical setup or import steps.
- Supports both standard interactive flows and automated 1-click execution modes.
Usage examples
- “Start a new migration for my project in ./migrations/my-store.”
- The agent resolves the project directory, initializes orchestration artifacts, and routes to the project intake module.
- “Resume the migration in ./migrations/my-store.”
- The agent inspects the existing artifacts, determines the last completed stage, and dispatches the next required module.
Install
Download the skill as a ZIP:
https://autogineer.com/agent-skills/wix/wix-replatform-fya3/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip wix-replatform.zip -d .agents/skills
Documentation by Wix
wix-replatform
wix-replatform is the compact supervisor for a resumable source-to-Wix migration. It
selects one internal module for the active stage; it does not carry every stage procedure
in its own context.
Always-active contract
Resolve the active project under
migrations/<project>/(orREPLATFORM_MIGRATIONS_DIR) before inspecting or creating anything. Only that project's artifacts are authoritative.Preserve
EXPECTATIONS.mdat that project root. It is the user's free-form record of how they expected the run to behave; initialization creates it once and never overwrites it.Start/resume
resources/rp-telemetry/at the beginning of every run and finalize it at a terminal state. Never hand-write telemetry events.Use orchestration JSON plus validated stage artifacts as resume authority. Logs and chat history are diagnostic context only.
Preserve user data: write idempotently, dedupe by source identity, resume rather than restart, and never create a second destination site for a migration.
Never print secrets, secret-bearing config contents, tokens, or credentials. Report only key names and present/blank/missing status.
Do not declare a migration complete from prose or a single artifact. The deterministic router and aggregate completion artifact own terminal completion.
Preserve the owner's cutover handoff: unresolved data, applicable manual setup, missing apps and changed plugin behavior. Reconcile discovery, mapping decisions, setup receipts and final outcomes; imported records alone do not establish working functionality. The producing resources own this guidance and durable completion/handoff artifacts. Use a supported cutover publisher when available; report missing publication integration explicitly rather than claiming the application received local artifacts.
CLI-launched runs and human actions
When a migration is started through replatform, the terminal is deliberately
non-interactive: do not use an agent question UI, ask for stdin, or wait for a person in the
current agent turn. The runner owns process lifecycle and emits only observed events; it does
not replace this skill's router or completion receipts.
When a human choice, review, approval, or manual prerequisite is needed, create a durable
request with node skills/wix-replatform/scripts/user-action.js create --project <projectDir> --request-file <request.json>, then end the turn. Put only reviewed artifact paths in the
request. The person can later use replatform requests, replatform show, and
replatform answer; a resumed agent reads the answered request from
orchestration/user-actions/, never from reconstructed chat context.
Cancellation is not completion. If the runner has recorded cancel_requested, canceled, interrupted or an explicit stop (blocked,
transition --status blocked --resume-from '<json>'; routes run_blocked until explicit resume or --status running, never answer --continue), preserve partial/recovery
artifacts and let a later explicit replatform resume route recovery. Never create aggregate migration completion from an aborted execution report.
Pipeline
intake → destination → source inputs → preflight → (standard: discovery → mapping → codegen;
quick: adapter preflight → quick plan) → setup discovery → website handoff
→ safety review/approval → setup → import
→ storefront continuation (website only) → aggregate finalization → Migration reviewDelivery modes are management (backend only), website (frontend only), and
management_and_website (the integrated flow above). Accept user input both as
management_and_website and persist the canonical value.
For deliveryMode=management, aggregate finalization requires valid backend import
accounting. For deliveryMode=management_and_website, it additionally requires a current
website/completion.json with completed screenshot review, no unresolved critical/high
gaps, and release evidence. execution/completion-report.json is backend accounting,
never website-migration completion by itself.
Route before acting
On every new or resumed turn:
Resolve the project and initialize/load its orchestration artifacts.
Run
node skills/wix-replatform/scripts/orchestration-route.js <projectDir>.Dispatch the
nextResourceto a Developer subagent instead of loading and following it yourself. Give it the project directory and the resource to run; it follows that resource's contract exactly as written, unchanged. Read back only its result — never its transcript, tool output, or logs.Every dispatch (Developer or QA) is a fresh subagent, never a resumed one; pass only a handoff file and stay within a context budget — follow
resources/rp-subagent-dispatch/. Never readstate/attempts/write-attempts.ndjsonraw; usescripts/write-log-summary.js.A Developer may fan out to sub-subagents only for harmless read-only work with no shared state, and only if the host supports it; writes stay one at a time, as each resource says.
Dispatch a QA subagent to check the Developer's result against that resource's own stated required outputs (its own "artifacts to create or update" or "## Output" section, and any review/gap documents it defines). QA is read-only — it never writes or calls Wix. If something's missing, dispatch a new Developer for the same resource with QA's findings; otherwise the stage is done.
At the end of each pipeline phase (discovery, mapping, setup discovery, import, and so on — see the pipeline above; a phase spans several resource-level stages), dispatch a QA subagent to review that phase's documents as a whole (for example
mapping/review/mapping-summary.mdandmapping-gaps.json, orexecution/completion-report.json) before routing to the next phase. This catches anything a single per-task check could miss. For the import phase specifically, this review must be entity-by-entity against the accepted mapping plan, not a skim of the top-level status string — seerp-execute-import's "Entity-by-entity QA" section. Any run-fixing dispatch mid-phase (a crash fix, a slowness fix, a resumed pass) does not itself satisfy this; run the phase-level QA again once the fix lands, since fixing one entity's defect certifies nothing about its neighbors. Mapping QA also checks exact source coverage, decided operation/path semantics and canonical projections. Codegen QA reads the Developer's independently expected synthetic request evidence and its freshness; it does not execute examples. Semantic defects return to mapper, implementation defects to codegen. One-click tests defer unresolved scope and finish independent work with a typed incomplete result, without questions or repeated redispatch; customer runs retain their existing checkpoints.Route again after every stage boundary. Stale requests use
resources/rp-user-action-recovery/; unreadable request artifacts block until repaired. Never discard pending requests or decide the next stage from memory.
The router (lib/orchestration-router.js) is the only routing and resume authority. It
recomputes the route from decisions, approvals, preflight, run.json status and the phase
outputs on every call; run.json.currentState is diagnostic only, never a routing input.
A recorded rejection stops the route in every mode, one-click included:
execution_approval_rejectedisblockedbefore any setup or import write, andmapping_approval_rejectedreturns torp-mapperfor a new plan.A gated output that exists but is unusable (
source_schema_invalid,mapping_plan_invalid,setup_plan_invalid,setup_requirements_invalid,execution_manifest_invalid) isblockedwitherrorsand the producer asnextResource. Do not re-run the producer automatically; report the errors to the Import Operator and stop.The import routes (
missing_completion_report,import_interrupted= a stopped run's aborted report,quick_mode_import_required) carryimportProgress.interruptedlistsrecoveryArtifacts: resume it, never a second import.interruptedReport: "missing": first runscripts/interrupted-completion-report.js.
If an artifact is malformed, partial, stale, or fails its validator, treat its producing stage as incomplete and route to the producer. Do not make parallel replacement artifacts.
A user action whose reviewed artifacts changed after it was created is refused with
user_action_stale and stays pending. Create a new request from the current artifacts.
Catching up a finished migration is a rerun, not a new project. When the user asks to pull
in records that arrived or changed since the import — "the source kept selling", "these orders
are missing", "re-run it" — reuse the same project, destination, mapping, generated importer
and crosswalk, and route to rp-execute-import → "Rerunning an import for new and modified
records". Do not scaffold a second project or re-approve an unchanged mapping; a
mapping or scope change does go back through the existing gates. A rerun's revision conflicts
are user decisions even in 1-click mode.
Demand-loaded module map
| Router situation | Dispatch |
|---|---|
| project, delivery mode, source mode, or grouped intake is unresolved | resources/rp-project-intake/ |
| destination is absent, conflicting, or needs creation/adoption | resources/rp-destination/ |
| source URL/files/config/acquisition mode/credentials are required, including source credentials said to exist already on another site | resources/rp-source-inputs/ |
| deterministic preflight is missing, repaired, or blocked on CLI checks | resources/rp-preflight/ |
| quick mode needs platform resolution, endpoint preflight, plan, extraction, or import | selected resources/rp-quick-<platform>/ |
| source schema is missing | resources/rp-discovery/ and its selected source adapter |
| mapping is missing or needs review | resources/rp-mapper/ |
| Wix requirements are missing | resources/rp-setup-discovery/ |
| import code/review is missing or stale | resources/rp-import-codegen/ |
| setup verification is missing | resources/rp-execute-setup/ |
| backend completion report is missing | resources/rp-execute-import/ |
| frontend-only work, or integrated website handoff/build/gap loop/release receipt is incomplete | resources/rp-website-continuation/ |
| aggregate completion is missing | resources/rp-execution-policy/ |
| aggregate completion exists but the local review publication or current recap is missing | resources/rp-migration-review/ |
The resource named by the route is the complete stage contract, dispatched as described in "Route before acting" — the main session itself never loads it directly. Only the dispatched Developer loads source-file, secret, scaffolding, or storefront procedures, and only for the stage that actually needs them; nothing about a stage where they're irrelevant is loaded, by the main session or the Developer.
Interaction policy
Normal mode asks only for a missing required input, a genuinely ambiguous active project, or a mandatory write approval. Ask one question at a time unless a module says otherwise.
When the user says add to expectations: <note> (or an unambiguous natural-language
equivalent), append the note to the active project's EXPECTATIONS.md before continuing.
Use scripts/expectations-ledger.js so the entry retains the supplied statement plus safe
current context (stage/state, relevant project-relative artifacts, and known entity/field
labels). Do not treat this as approval or silently change a mapping. Never record secrets,
tokens, raw customer data, or raw source records; redact them if supplied and say so.
Before writes, preserve the mandatory execution-plan approval gate. Read-only discovery, mapping, setup verification, code generation, and review happen before it.
Quick management import mode
When managementImportMode=quick, select the platform adapter only after the deterministic
source probe identifies a compatible platform. Quick mode is a bounded public-data import:
the adapter's versioned quick-mode.json owns its source routes, entity graph, field matrix,
and exclusions. Do not run agentic discovery, mapping, or project-specific code generation for
the quick backend branch. Still run destination setup, application installation, Catalog-V3 and
notification safety checks, execution approval, shared write runtime, crosswalks, and completion
accounting. If no adapter qualifies, persist the unsupported-mode result and ask the user to
select standard mode; never silently fall back.
Halt only for missing/invalid required input, a manual action with no API, or a systemic failure/data-loss risk. A halt must persist the code, evidence, owner, and exact unblock action; never silently stop.
1-click mode
When explicitly requested by the user, record automationMode=one_click with
source=user and apply the following. A missing mode or a one_click value recorded as
deterministic_inference/prior_artifact is normal interactive mode and must not skip a
checkpoint:
collect all still-missing intake values in one grouped request; then do not pause for routine approvals;
record mapping and execution approvals as
approved,decidedBy=agent; skipping a pause without state is invalid;for CSV/file-only runs, validate and accept the required sample preview as the agent; without explicit user-authored one-click, pause for the normal mapping review, sample preview validation, and execution approval;
default to a new isolated site unless an existing destination is explicitly supplied or already pinned, but never default the new site's type (Headless, Studio or Harmony): ask it in the grouped intake; choose website scope deterministically from discovered route families;
retry PATH/tool-resolution failures under the operator's compatible interactive login shell; request required browser/network sandbox escalation and retry before calling it blocked;
retry the obvious recovery before stopping: aligned shell first for PATH/tool failures, then the required escalation retry for sandboxed browser or network/API failures;
continue through the complete selected deliverable. In
management_and_websitemode that includes frontend build, post-build gap analysis, bounded fix loop, and release receipt; when the user selected facelift at intake, it also includes the separate post-clone facelift review;before yielding, re-route. A 1-click run is only
completedwithcompletion/migration-completion.json, orblockedwith a typed durable blocker.
Use the operator's compatible local Node/Yarn shell when recovering from a PATH or tool resolution failure. Machine-specific shell paths belong only in local, git-excluded agent instructions.
Repo-local interactive shell contract: a PATH/tool-resolution failure on first attempt may
mean the command ran under a plain, non-interactive shell that never sourced the operator's
Node/Yarn profile. Resolve the operator's compatible login shell from the local environment or
git-excluded agent instructions, verify that it is executable, and retry the exact same command
through that shell in interactive login mode so the profile that resolves node/yarn/npx
loads. Do not hardcode a machine-specific shell path in this public skill. Only escalate to a
durable blocker if the compatible-shell retry itself fails.
Guardrails
Never bypass a validator, approval-state update, verified notification mute, or Catalog-V3 gate to make a stage appear finished.
websitemeans frontend only;management_and_websitemeans the integrated backend and frontend migration. Never hand the integrated migration destination to the frontend skill or create a second frontend site in that mode.A Studio or Harmony destination (
targetSiteType) is created and verified byrp-destination's coordinator and is never published, unpublished or handed towix-headless-replatform; its website and publication remain operator handoff items.Do not implement a storefront manually when
wix-headless-replatformis unavailable; persist a blocker with the exact required runtime capability.In management mode, still generate
website/handoff.*after setup discovery so a later storefront can start without repeating backend discovery.
Files
- .publish-manifest.json210 B
- ATTRIBUTION.mdAdded by AutoGineer815 B
- CLI.md9.8 KiB
- LICENSELicence file added by AutoGineer1.0 KiB
- README.md11.9 KiB
- SKILL.md16.4 KiB
- VERSION6 B
- console/account.css633 B
- console/app.css5.2 KiB
- console/app.jsScript22.9 KiB
- console/index.html837 B
- console/json.css639 B
- lib/agent-adapters/index.jsScript2.9 KiB
- lib/app-page-routing.jsScript4.3 KiB
- lib/app-requirements.jsScript1.5 KiB
- lib/artifact-freshness.jsScript12.7 KiB
- lib/blocked-data-requests.jsScript21.4 KiB
- lib/cached-json.jsScript1.3 KiB
- lib/catalog-baseline.jsScript23.3 KiB
- lib/census-reconciliation.jsScript22.8 KiB
- lib/cms-collection-compatibility.jsScript2.0 KiB
- lib/completion-report.jsScript124.6 KiB
- lib/config-env.jsScript6.1 KiB
- lib/confirmed-pictures.jsScript6.9 KiB
- lib/crosswalk-adoption.jsScript6.3 KiB
- lib/dependency-proofs.jsScript46.7 KiB
- lib/dependency-readiness.jsScript112.3 KiB
- lib/dependency-recovery.jsScript1.5 KiB
- lib/dependency-waves.jsScript2.1 KiB
- lib/destination-choice.jsScript9.7 KiB
- lib/destination-handoff.jsScript12.5 KiB
- lib/destination-http.jsScript2.7 KiB
- lib/destination-route.jsScript5.1 KiB
- lib/destination.jsScript57.1 KiB
- lib/discovered-census.jsScript11.0 KiB
- lib/discovered-set-status.jsScript15.2 KiB
- lib/document-url-guard.jsScript12.7 KiB
- lib/editor-type.jsScript748 B
- lib/egress-proxy.jsScript20.8 KiB
- lib/entity-qa-attestation.jsScript19.4 KiB
- lib/entity-verification.jsScript1.3 KiB
- lib/execution-capability.jsScript7.3 KiB
- lib/execution-log.jsScript6.4 KiB
- lib/execution-manifest.jsScript10.2 KiB
- lib/execution-state.jsScript5.9 KiB
- lib/expectations-ledger.jsScript3.4 KiB
- lib/extract-ledger.jsScript21.4 KiB
- lib/field-mapping-examples.jsScript7.3 KiB
- lib/generated-plugin-handoff.jsScript8.7 KiB
- lib/import-interruption.jsScript13.6 KiB
- lib/import-readiness-contract.jsScript4.3 KiB
- lib/import-recovery.jsScript54.0 KiB
- lib/import-task-runner.jsScript18.1 KiB
- lib/imported-redirect-targets.jsScript32.5 KiB
- lib/internal-link-reconciliation.jsScript10.7 KiB
- lib/link-audit.jsScript11.1 KiB
- lib/link-census.jsScript11.0 KiB
- lib/link-plan.jsScript9.4 KiB
- lib/link-verification.jsScript18.7 KiB
- lib/link-waivers.jsScript5.8 KiB
- lib/link-write-journal.jsScript1.8 KiB
- lib/local-state.js66.8 KiB
- lib/mapping-field-contract.js54.1 KiB
- lib/mapping-omission-approval.js7.6 KiB
- lib/mapping-recovery.js22.4 KiB
- lib/mapping-resolution.js6.1 KiB
- lib/mapping-target-rules.js7.4 KiB
- lib/member-completion.js31.6 KiB
- lib/member-crosswalk.js2.9 KiB
- lib/member-outcome-registry.js13.6 KiB
- lib/migration-completion.js18.3 KiB
- lib/migration-review-mapping.js21.4 KiB
- lib/migration-review.js73.7 KiB
- lib/multi-step-attempt.js4.4 KiB
- lib/multilingual-public-report.js14.5 KiB
- lib/multilingual-public.js26.3 KiB
- lib/notification-mute.js9.9 KiB
- lib/operation-assessments.js9.8 KiB
- lib/operator-identity.js1.2 KiB
- lib/orchestration-decisions.js8.7 KiB
- lib/orchestration-preflight.js25.1 KiB
- lib/orchestration-router.js50.8 KiB
- lib/orchestration-state.js30.9 KiB
- lib/order-reference-readiness.js2.8 KiB
- lib/output-applicability.js5.0 KiB
- lib/payments-outcome-registry.js9.8 KiB
- lib/plan-order-outcome-registry.js13.1 KiB
- lib/plugin-cms-fallback.js35.1 KiB
- lib/preservation-approval-stamp.js2.8 KiB
- lib/product-media-deferral.js3.8 KiB
- lib/product-videos.js7.1 KiB
- lib/progress-log.js6.6 KiB
- lib/progress-log.sh4.1 KiB
- lib/raw-request-guard.js18.5 KiB
- lib/read-back-approval.js16.1 KiB
- lib/read-back-comparison.js10.5 KiB
- lib/read-back-contract.js37.4 KiB
- lib/read-back-extract.js4.0 KiB
- lib/read-back-gate.js46.6 KiB
- lib/read-back-reads.js2.9 KiB
- lib/read-back-state.js3.4 KiB
- lib/read-back-summary.js6.5 KiB
- lib/rerun-conflicts.js14.5 KiB
- lib/run-controller.js26.3 KiB
- lib/seo-outcome-registry.js3.2 KiB
- lib/setup-producers.js1.3 KiB
- lib/setup-verification.js11.6 KiB
- lib/site-regional-gate.js3.3 KiB
- lib/site-regional-report.js10.3 KiB
- lib/site-regional.js37.0 KiB
- lib/source-access.js11.2 KiB
- lib/source-coverage.js54.0 KiB
- lib/source-location.js10.6 KiB
- lib/source-redirect-capture.js2.6 KiB
- lib/source-regional.js15.5 KiB
- lib/source-secrets.js8.1 KiB
- lib/structured-link-patch.js3.1 KiB
- lib/subagent-handoff.js8.9 KiB
- lib/target-import-support.js18.4 KiB
- lib/task-state.js6.2 KiB
- lib/toolkit-dependencies.js947 B
- lib/url-preservation-report.js20.4 KiB
- lib/url-preservation-state.js27.0 KiB
- lib/url-redirect-plan.js36.3 KiB
- lib/url-verification.js15.5 KiB
- lib/user-action-effects.js2.9 KiB
- lib/user-actions.js18.4 KiB
- lib/vendor-closure.js5.6 KiB
- lib/website-handoff.js60.6 KiB
- lib/wix-auth.js11.0 KiB
- lib/wix-client-callers.js6.7 KiB
- lib/wix-dashboard-url.js1.0 KiB
- lib/write-log-summary.js9.4 KiB
- lib/write-verification-state.js7.9 KiB
- lib/write-verification.js30.0 KiB
- scripts/artifact-freshness.js2.3 KiB
- scripts/census-reconciliation.js781 B
- scripts/cms-fallback.js3.2 KiB
- scripts/cms-item-quota.js3.9 KiB
- scripts/crosswalk-adopt.js3.0 KiB
- scripts/dependency-preflight.js2.2 KiB
- scripts/discovered-census.js867 B
- scripts/discovered-set-status.js1.1 KiB
- scripts/entity-qa-attestation.js4.8 KiB
- scripts/execution-health-check.js19.9 KiB
- scripts/execution-manifest-validate.js1.7 KiB
- scripts/execution-state-prepare.js3.9 KiB
- scripts/expectations-ledger.js1.5 KiB
- scripts/extract-ledger.js1.9 KiB
- scripts/import-contract-verify.js20.4 KiB
- scripts/import-supervise.js16.1 KiB
- scripts/internal-link-audit.js6.5 KiB
- scripts/interrupted-completion-report.js2.7 KiB
- scripts/item-seo-tags-verify.js8.2 KiB
- scripts/link-waiver.js3.8 KiB
- scripts/migration-completion.js3.8 KiB
- scripts/migration-review.js3.7 KiB
- scripts/orchestration-preflight.js3.5 KiB
- scripts/orchestration-route.js3.7 KiB
- scripts/orchestration-state.js18.9 KiB
- scripts/read-back-gate.js11.3 KiB
- scripts/replatform-console.js12.9 KiB
- scripts/replatform.js35.4 KiB
- scripts/site-regional.js2.4 KiB
- scripts/source-secrets.js2.9 KiB
- scripts/subagent-handoff.js2.5 KiB
- scripts/url-redirects.js13.0 KiB
- scripts/user-action.js2.9 KiB
- scripts/vendor-closure.js1.0 KiB
- scripts/website-handoff-generate.js2.3 KiB
- scripts/wix-dashboard-url.js1.6 KiB
- scripts/wix-destination.js6.4 KiB
- scripts/wix-env.js1.5 KiB
- scripts/wix-headless-scaffold.js34.8 KiB
- scripts/write-log-summary.js2.2 KiB
- vendor/README.md604 B
- vendor/commander/LICENSE1.1 KiB
- vendor/commander/index.js711 B
- vendor/commander/lib/argument.js3.1 KiB
- vendor/commander/lib/command.js85.6 KiB
- vendor/commander/lib/error.js1.1 KiB
- vendor/commander/lib/help.js20.3 KiB
- vendor/commander/lib/option.js10.0 KiB
- vendor/commander/lib/suggestSimilar.js2.7 KiB
- vendor/commander/package.json1.6 KiB
lib/import-recovery.js
'use strict';
const { verificationKind } = require('./entity-verification');
const crypto = require('node:crypto');
const fs = require('node:fs/promises');
const path = require('node:path');
const {
UNRESOLVED_ATTEMPT_STATUSES,
loadAttemptJournal,
loadCrosswalk,
rerunDecision,
attemptJournalPath,
readAttemptJournalSince,
foldAttemptsBySourceKey,
} = require('./local-state.js');
const { updateSupportFor } = require('./rerun-conflicts.js');
const { appendExecutionLog } = require('./execution-log.js');
const { validateGeneratedImporterReviewContract } = require('./migration-review.js');
const RECOVERY_SCHEMA_VERSION = 1;
const RECOVERY_MODES = ['partial', 'missing-only', 'failed-only', 'deferred-only', 'unresolved-only', 'resumed', 'rerun'];
const RECOVERY_STATUSES = ['complete', 'partial', 'failed', 'blocked'];
const DEFERRED_ATTEMPT_STATUSES = new Set(['deferred', 'needs_verification']);
// A missing crosswalk link uses existing source-marker/natural-key checks and
// attempt-journal reconciliation before create. These statuses mean a previous write MIGHT have
// landed without being confirmed into the crosswalk, so creating again risks a duplicate.
const UNCERTAIN_ATTEMPT_STATUSES = new Set(['deferred', 'needs_verification', 'succeeded_unverified', 'started']);
// The three terminal `skipped_*` statuses
// `coverageStatusCounts` deliberately never buckets (it has no branch for any of them) make no
// journal-count claim at all -- there is nothing an importer could even report a disagreeing
// number for. A target type whose journal rows are ENTIRELY one or more of these is therefore not
// "unreported journal activity"; it is a type nothing was ever attempted, deferred, or failed for.
// Before this fix, the reverse journal->summary check (`unmatchedJournalEntities` below) counted
// ALL rows for a target type, including these, so a type whose only rows were e.g.
// `skipped_out_of_scope` was never named by any ordinary or naming-only summary bucket (nothing
// was imported/deferred/failed/attempted/already-present for it) and fell into
// `unmatchedJournalEntities` permanently -- for example a journal whose only row for
// a target type (`ecom/shipping-option`) is a single `skipped_out_of_scope` row. Excluding these statuses from the "claiming" row count used by
// that check -- and from `coverageByType`'s cumulative high-water mark itself,
// so the mark and the check it feeds always measure the same thing -- fixes this without making
// skipped_out_of_scope a journal-count claim anywhere else.
const NON_CLAIMING_ATTEMPT_STATUSES = new Set(['skipped_already_imported', 'skipped_safe_mode_blocked', 'skipped_out_of_scope']);
function executionDir(projectDir) {
return path.join(projectDir, 'execution');
}
function recoveryLogPath(projectDir) {
return path.join(executionDir(projectDir), 'recovery-log.json');
}
function liveImportSummaryPath(projectDir) {
return path.join(executionDir(projectDir), 'live-import-summary.json');
}
async function pathExists(filePath) {
try {
await fs.access(filePath);
return true;
} catch (error) {
if (error && error.code === 'ENOENT') {
return false;
}
throw error;
}
}
async function writeJsonAtomic(filePath, data) {
await fs.mkdir(path.dirname(filePath), { recursive: true });
const tempPath = `${filePath}.${process.pid}.${Date.now()}.tmp`;
await fs.writeFile(tempPath, `${JSON.stringify(data, null, 2)}\n`, 'utf8');
await fs.rename(tempPath, filePath);
}
async function readJsonIfExists(filePath, fallback) {
if (!(await pathExists(filePath))) {
return fallback;
}
return JSON.parse(await fs.readFile(filePath, 'utf8'));
}
function requireString(value, field) {
if (!value || typeof value !== 'string') {
throw new Error(`${field} must be a non-empty string`);
}
return value;
}
function count(value, field) {
if (value === undefined || value === null) {
return 0;
}
if (!Number.isInteger(value) || value < 0) {
throw new Error(`${field} must be a non-negative integer`);
}
return value;
}
function sourceStableKey(sourceSystem, sourceEntityType, sourceId) {
return `${sourceSystem}:${sourceEntityType}:${sourceId}`;
}
function defaultSourceId(record) {
return record && (record.id ?? record.ID ?? record.sourceId);
}
function defaultSourceType(record) {
return record && (record.sourceType ?? record.subtype ?? record.type);
}
function normalizeSelectionFilters(input = {}) {
const filters = {
entity: input.entity || input.sourceEntityType || null,
sourceType: input.sourceType || input.source_type || null,
missingOnly: Boolean(input.missingOnly || input['missing-only']),
failedOnly: Boolean(input.failedOnly || input['failed-only']),
deferredOnly: Boolean(input.deferredOnly || input['deferred-only']),
// Unresolved gets its own selection mode because its next action differs:
// read the target back, never re-send. Re-sending an uncertain write is how a recovery
// pass creates a duplicate on a live store.
unresolvedOnly: Boolean(input.unresolvedOnly || input['unresolved-only']),
};
const exclusive = [filters.missingOnly, filters.failedOnly, filters.deferredOnly, filters.unresolvedOnly].filter(Boolean);
if (exclusive.length > 1) {
throw new Error('--missing-only, --failed-only, --deferred-only, and --unresolved-only are mutually exclusive');
}
return filters;
}
// A rerun buckets the refreshed scope into create / update / unchanged
// / unknown against the crosswalk baseline. It is deliberately NOT expressible as the existing
// filters: `missingOnly` excludes every crosswalk hit (so no changed record is ever seen) and
// `failedOnly` only revisits what was already attempted (so a change nobody attempted is
// missed). A regression check exists because an importer built from those two filters looks
// like a delta and silently is not.
//
// `unknown` is a first-class outcome, never folded into unchanged: see rerunDecision.
function selectRerunRecords(records, options = {}) {
if (!Array.isArray(records)) {
throw new Error('records must be an array');
}
const sourceSystem = options.sourceSystem || 'wordpress';
const sourceEntityType = requireString(
options.entity || options.sourceEntityType,
'rerun selection entity',
);
const getSourceId = options.getSourceId || defaultSourceId;
const crosswalkBySource = options.crosswalkBySource || {};
const attemptsBySource = options.attemptsBySource || foldAttemptsBySource(options.attemptRows || []);
// How to read this entity's version off a refreshed source record. Declared by the adapter,
// never guessed here — an object id or capture time must never be treated as a record version an object id or capture time as a record version.
const sourceVersionField = options.sourceVersionField || null;
const getSourceVersion = options.getSourceVersion
|| ((record) => (sourceVersionField ? record?.[sourceVersionField] : undefined));
const getSourceHash = options.getSourceHash || (() => undefined);
const sourceHashDefinition = options.sourceHashDefinition || null;
// Excluded history and deletions stay out. The accepted scope is enforced HERE
// rather than deferred to a generated importer: `inScope(record)` returns false for anything
// the approved plan excluded, and those records are reported as out-of-scope, never actioned.
// Deletions need no rule beyond this loop: a record absent from the refreshed source is simply
// never iterated, so absence can never become a delete instruction.
const inScope = typeof options.inScope === 'function' ? options.inScope : null;
// Per-entity update capability, so a changed record for an entity with no verified
// revision-protected writer is reported for review instead of being routed to an update.
const entityRef = options.targetEntityRef || null;
const declaredUpdateWriters = options.declaredUpdateWriters || {};
// FAIL CLOSED. An undeclared entity used to default to supported:true, which bypassed BOTH the
// order ban and the verified-writer requirement — an order with no targetEntityRef went
// straight to `update`. Absence of a declaration is not evidence that an update is safe, so
// the missing declaration is itself a review outcome.
const updateSupport = updateSupportFor(entityRef, { declaredUpdateWriters });
const create = [];
const update = [];
const unchanged = [];
const unknown = [];
const excluded = [];
const outOfScope = [];
const needsReconciliation = [];
const reportForReview = [];
for (const record of records) {
const sourceId = getSourceId(record);
if (sourceId === undefined || sourceId === null || sourceId === '') {
excluded.push({ record, reason: 'missing_source_id' });
continue;
}
const stableKey = sourceStableKey(sourceSystem, sourceEntityType, String(sourceId));
if (inScope && !inScope(record)) {
outOfScope.push({ sourceStableKey: stableKey, reason: 'excluded_by_accepted_scope' });
continue;
}
const crosswalkRow = crosswalkBySource[stableKey] || null;
const latestAttempt = attemptsBySource[stableKey] || null;
const decision = rerunDecision({
crosswalkRow,
sourceVersion: getSourceVersion(record),
sourceVersionField,
sourceHash: getSourceHash(record),
sourceHashDefinition,
});
const entry = {
record,
sourceStableKey: stableKey,
existing: crosswalkRow,
latestAttempt,
decision,
};
if (decision.action === 'create') {
// The attempt journal is consulted, not merely carried: an unconfirmed earlier write may
// already exist on the target, so this reconciles before it creates a second one.
if (latestAttempt && UNCERTAIN_ATTEMPT_STATUSES.has(latestAttempt.status)) {
needsReconciliation.push({ ...entry, reason: `uncertain_prior_attempt:${latestAttempt.status}` });
} else {
create.push(entry);
}
} else if (decision.action === 'update') {
if (!updateSupport.supported) {
reportForReview.push({ ...entry, reason: updateSupport.reason, detail: updateSupport.detail || null });
} else if (latestAttempt && UNCERTAIN_ATTEMPT_STATUSES.has(latestAttempt.status)) {
// An uncertain attempt is as dangerous on a LINKED record as on a new one, for a
// different reason: if the previous write actually landed and the process died before
// saving its baseline, the saved revision is already stale. Re-sending it makes the
// importer collide with its OWN earlier write and report it to the user as a merchant
// edit. Reconcile first.
needsReconciliation.push({ ...entry, reason: `uncertain_prior_attempt:${latestAttempt.status}` });
} else {
update.push(entry);
}
} else if (decision.action === 'skip') {
if (verificationKind({ ...options, entity: sourceEntityType }) !== 'none') {
needsReconciliation.push({ ...entry, reason: 'unchanged_source_requires_target_verification' });
} else unchanged.push(entry);
} else {
unknown.push(entry);
}
}
// Unknown counts are not zero. The caller reports these four buckets separately; an
// unresolved record must never be summed into unchanged to make a report look clean.
return {
entity: sourceEntityType,
mode: 'rerun',
create,
update,
unchanged,
unknown,
excluded,
outOfScope,
needsReconciliation,
reportForReview,
updateSupport,
summary: {
entity: sourceEntityType,
recordsRead: records.length,
toCreate: create.length,
toUpdate: update.length,
unchanged: unchanged.length,
unknown: unknown.length,
needsReconciliation: needsReconciliation.length,
reportForReview: reportForReview.length,
outOfScope: outOfScope.length,
excluded: excluded.length,
sourceVersionField: sourceVersionField || null,
},
};
}
async function selectRerunRecordsFromState(projectDir, records, options = {}) {
const crosswalk = await loadCrosswalk(projectDir);
const attempts = await loadAttemptJournal(projectDir);
return selectRerunRecords(records, {
...options,
crosswalkBySource: crosswalk.bySource,
attemptRows: attempts.rows,
});
}
function foldAttemptsBySource(attemptRows = []) {
const bySource = {};
for (const row of attemptRows) {
if (!row || !row.sourceStableKey) {
continue;
}
bySource[row.sourceStableKey] = row;
}
return bySource;
}
function selectImportRecords(records, options = {}) {
if (!Array.isArray(records)) {
throw new Error('records must be an array');
}
const filters = normalizeSelectionFilters(options.filters || options);
const sourceSystem = options.sourceSystem || 'wordpress';
const sourceEntityType = requireString(filters.entity || options.sourceEntityType, 'selection entity');
const getSourceId = options.getSourceId || defaultSourceId;
const getSourceType = options.getSourceType || defaultSourceType;
const crosswalkBySource = options.crosswalkBySource || {};
const attemptsBySource = options.attemptsBySource || foldAttemptsBySource(options.attemptRows || []);
const selected = [];
const alreadyPresent = [];
const excluded = [];
const failed = [];
const deferred = [];
const unresolved = [];
for (const record of records) {
const sourceId = getSourceId(record);
if (sourceId === undefined || sourceId === null || sourceId === '') {
excluded.push({ record, reason: 'missing_source_id' });
continue;
}
const stableKey = sourceStableKey(sourceSystem, sourceEntityType, String(sourceId));
const sourceType = getSourceType(record);
const existing = crosswalkBySource[stableKey] || null;
const latestAttempt = attemptsBySource[stableKey] || null;
if (filters.sourceType && String(sourceType) !== String(filters.sourceType)) {
excluded.push({ sourceStableKey: stableKey, sourceType, reason: 'source_type_filter' });
continue;
}
const identityRequired = verificationKind({ ...options, entity: sourceEntityType, targetEntityType: existing?.targetEntityType }) !== 'none';
if (filters.missingOnly && existing && !identityRequired) {
alreadyPresent.push({ sourceStableKey: stableKey, targetId: existing.targetId, reason: 'crosswalk' });
continue;
}
if (filters.failedOnly && (!latestAttempt || !String(latestAttempt.status).startsWith('failed'))) {
excluded.push({ sourceStableKey: stableKey, reason: 'not_failed' });
continue;
}
if (filters.deferredOnly && (!latestAttempt || !DEFERRED_ATTEMPT_STATUSES.has(latestAttempt.status))) {
excluded.push({ sourceStableKey: stableKey, reason: 'not_deferred' });
continue;
}
if (filters.unresolvedOnly && (!latestAttempt || !UNRESOLVED_ATTEMPT_STATUSES.has(latestAttempt.status))) {
excluded.push({ sourceStableKey: stableKey, reason: 'not_unresolved' });
continue;
}
if (latestAttempt && String(latestAttempt.status).startsWith('failed')) {
failed.push(stableKey);
}
if (latestAttempt && DEFERRED_ATTEMPT_STATUSES.has(latestAttempt.status)) {
deferred.push(stableKey);
}
// Never also counted in `failed`: the two sets are disjoint by construction, and an
// uncertain write summed into a failure count produces a report that reconciles
// arithmetically and is wrong.
if (latestAttempt && UNRESOLVED_ATTEMPT_STATUSES.has(latestAttempt.status)) {
unresolved.push(stableKey);
}
selected.push({ record, sourceStableKey: stableKey, sourceType, existing, latestAttempt });
}
return {
filters,
entity: sourceEntityType,
selected,
alreadyPresent,
excluded,
unresolved,
summary: {
entity: sourceEntityType,
sourceType: filters.sourceType || 'all',
recordsRead: records.length,
recordsSelected: selected.length,
alreadyPresent: alreadyPresent.length,
excluded: excluded.length,
failedCandidates: failed.length,
deferredCandidates: deferred.length,
unresolvedCandidates: unresolved.length,
},
};
}
async function selectImportRecordsFromState(projectDir, records, options = {}) {
const crosswalk = await loadCrosswalk(projectDir);
const attempts = await loadAttemptJournal(projectDir);
return selectImportRecords(records, {
...options,
crosswalkBySource: crosswalk.bySource,
attemptRows: attempts.rows,
});
}
function recoveryIdFor(entry) {
if (entry.recoveryId) {
return entry.recoveryId;
}
const hash = crypto.createHash('sha256')
.update(JSON.stringify({
timestamp: entry.timestamp,
selectionFilters: entry.selectionFilters,
reason: entry.reason,
recordsSelected: entry.recordsSelected,
recordsAttempted: entry.recordsAttempted,
}))
.digest('hex')
.slice(0, 12);
const stamp = String(entry.timestamp || new Date().toISOString()).replace(/[^0-9TZ]/g, '').slice(0, 15);
return `recovery-${stamp}-${hash}`;
}
function normalizeRecoveryEntry(input = {}) {
const mode = input.mode || (input.selectionFilters && (
input.selectionFilters.missingOnly ? 'missing-only' :
input.selectionFilters.failedOnly ? 'failed-only' :
input.selectionFilters.deferredOnly ? 'deferred-only' :
input.selectionFilters.unresolvedOnly ? 'unresolved-only' : 'partial'
));
if (!RECOVERY_MODES.includes(mode)) {
throw new Error(`recovery mode must be one of: ${RECOVERY_MODES.join(', ')}`);
}
const status = input.status || 'partial';
if (!RECOVERY_STATUSES.includes(status)) {
throw new Error(`recovery status must be one of: ${RECOVERY_STATUSES.join(', ')}`);
}
const timestamp = input.timestamp || new Date().toISOString();
if (Number.isNaN(Date.parse(timestamp))) {
throw new Error('recovery timestamp must be an ISO timestamp');
}
// `unresolved` must be stated, not defaulted: an entry that omits it is an
// entry whose author never decided where its uncertain writes went, and `count()` would
// silently read that as zero.
if (input.unresolved === undefined || input.unresolved === null) {
throw new Error('recovery unresolved count must be stated explicitly — uncertain writes are never folded into failed');
}
const entry = {
schemaVersion: RECOVERY_SCHEMA_VERSION,
recoveryId: input.recoveryId || null,
timestamp,
// This entry is built field by field, so anything not named here is
// dropped silently — which is why both of these are added explicitly.
runId: requireString(input.runId, 'recovery runId'),
mode,
selectionFilters: input.selectionFilters || {},
reason: requireString(input.reason || 'operator_requested_recovery', 'recovery reason'),
recordsSelected: count(input.recordsSelected, 'recordsSelected'),
recordsAttempted: count(input.recordsAttempted, 'recordsAttempted'),
imported: count(input.imported, 'imported'),
alreadyPresent: count(input.alreadyPresent, 'alreadyPresent'),
failed: count(input.failed, 'failed'),
deferred: count(input.deferred, 'deferred'),
// Its own count, never summed into `failed`. A recovery record whose failed count silently
// includes uncertain writes reconciles arithmetically and is wrong, which is the worst
// combination available.
unresolved: count(input.unresolved, 'unresolved'),
crosswalkChanges: input.crosswalkChanges || { before: 0, after: 0, added: 0, updated: 0 },
summaryChanges: input.summaryChanges || {},
outcome: requireString(input.outcome || status, 'recovery outcome'),
status,
logs: Array.isArray(input.logs) ? input.logs : [],
// A keep-Wix answer has to survive a reload, or the next rerun re-asks a
// question the user already answered — or worse, silently overwrites what they chose to
// keep. This entry is built field-by-field, so anything not named here is dropped; before
// this, passing a recordConflictDecision() result through lost choice, record identity,
// versions and the binding fingerprint without erroring.
conflictDecisions: normalizeConflictDecisions(input.conflictDecisions),
};
entry.recoveryId = recoveryIdFor(entry);
return entry;
}
// Each decision keeps exactly the fields keepDecisionApplies()/approvalApplies() need to judge
// whether it still applies. A decision missing any of them cannot be matched later, so it is
// rejected at write time rather than silently stored as unusable.
const CONFLICT_DECISION_FIELDS = [
'choice', 'sourceStableKey', 'targetId', 'entity',
'sourceVersion', 'sourceHash', 'reviewedTargetRevision', 'bindingFingerprint',
'decidedBy', 'decidedAt',
];
function normalizeConflictDecisions(input) {
if (input === undefined || input === null) {
return [];
}
if (!Array.isArray(input)) {
throw new Error('conflictDecisions must be an array');
}
return input.map((d, i) => {
if (!d || typeof d !== 'object') {
throw new Error(`conflictDecisions[${i}] must be an object`);
}
for (const required of ['choice', 'sourceStableKey', 'targetId', 'bindingFingerprint']) {
if (!d[required] || typeof d[required] !== 'string') {
throw new Error(`conflictDecisions[${i}].${required} must be a non-empty string — a decision that cannot be matched to a record is not reusable`);
}
}
if (!['override', 'keep'].includes(d.choice)) {
throw new Error(`conflictDecisions[${i}].choice must be override or keep`);
}
const out = {};
for (const f of CONFLICT_DECISION_FIELDS) {
out[f] = d[f] === undefined ? null : d[f];
}
return out;
});
}
// Reads every conflict decision recorded across the whole recovery log, newest last, so a rerun
// can ask "did the user already answer for this record?" without replaying the log itself.
function recoveryEntriesOf(recoveryLog) {
// loadRecoveryLog() returns an ARRAY. Reading `.entries` off it yields
// Array.prototype.entries -- a function, which a for-of then rejects with a bare
// "entries is not iterable". Accept the array (the real shape on disk) and the
// `{ entries: [...] }` wrapper, and treat anything else as empty.
if (Array.isArray(recoveryLog)) {
return recoveryLog;
}
if (recoveryLog && Array.isArray(recoveryLog.entries)) {
return recoveryLog.entries;
}
return [];
}
function loadConflictDecisions(recoveryLog) {
const entries = recoveryEntriesOf(recoveryLog);
const out = [];
for (const entry of entries) {
for (const d of (entry.conflictDecisions || [])) {
out.push({ ...d, recoveryId: entry.recoveryId || null, timestamp: entry.timestamp || null });
}
}
return out;
}
// The newest decision for one record, which is the only one that can still apply.
function latestConflictDecisionFor(recoveryLog, sourceStableKey) {
const all = loadConflictDecisions(recoveryLog).filter((d) => d.sourceStableKey === sourceStableKey);
return all.length ? all[all.length - 1] : null;
}
async function loadRecoveryLog(projectDir) {
const rows = await readJsonIfExists(recoveryLogPath(projectDir), []);
if (!Array.isArray(rows)) {
throw new Error('execution/recovery-log.json must contain a JSON array');
}
return rows.map((row) => normalizeRecoveryEntry(row));
}
async function appendRecoveryLogEntry(projectDir, entry) {
const existing = await loadRecoveryLog(projectDir);
const normalized = normalizeRecoveryEntry(entry);
if (existing.some((row) => row.recoveryId === normalized.recoveryId)) {
throw new Error(`duplicate recoveryId: ${normalized.recoveryId}`);
}
const next = [...existing, normalized];
await writeJsonAtomic(recoveryLogPath(projectDir), next);
return normalized;
}
function diffCounts(before = {}, after = {}) {
before = before || {};
after = after || {};
const keys = new Set([...Object.keys(before || {}), ...Object.keys(after || {})]);
const diff = {};
for (const key of keys) {
if (Number.isInteger(before[key]) || Number.isInteger(after[key])) {
diff[key] = (after[key] || 0) - (before[key] || 0);
}
}
return diff;
}
// ---------------------------------------------------------------------------
// The live import summary checks its held counters against the attempt journal for
// the same run, instead of trusting them on faith. This cache keeps that check cheap and isolated per run.
// ---------------------------------------------------------------------------
const COVERAGE_JOURNAL_REL_PATH = 'state/attempts/write-attempts.ndjson';
const COVERAGE_ORDINARY_BUCKETS = ['imported', 'deferred', 'failed', 'attempted'];
// A flush can legitimately name an entity ONLY through a
// non-coverage-bucket counter -- `alreadyPresentByCrosswalk` records what a re-run pass found
// already linked, with nothing attempted this run and so no journal status to compare it
// against (the `imported + alreadyPresentByCrosswalk + deferred + failed == inScope` identity
// this repo's entityCompleteness accounting already protects). A flush naming only this
// counter for an entity is still reporting on that entity: it must count toward "this flush named
// it" for the reverse-direction match, the same way an ordinary bucket does, or a correct re-run
// pass reporting solely `alreadyPresentByCrosswalk` gets the same false `unmatchedJournalEntities`
// mismatch an ordinary bucket's absence would produce if it were mistaken for silence.
const COVERAGE_NAMING_ONLY_BUCKETS = ['alreadyPresentByCrosswalk'];
// Keyed by the absolute live-journal path, so distinct project directories (or a test's many temp
// dirs) never share state. Each entry's `offset` is the end of the last complete line read; `runs`
// holds one folded Map<sourceStableKey, latestRow> PER RUN ID seen in the journal so far -- not
// only the run currently flushing -- so switching from run A to run B and back never carries A's
// rows into B's map and never misses a row written while the other run was flushing. Memory is
// O(unique records across runs in the journal); work per flush is O(new bytes read).
//
// `reportedEntityCoverage` is a SIBLING per-run accumulator, independent of the folded rows: for
// each resolved target entity type some flush of this run has named a summary key for (ever, not
// only the flush currently running), it keeps the highest CLAIMING journal row count (never the raw row count -- see `NON_CLAIMING_ATTEMPT_STATUSES` above) that was true for
// that entity AT THE TIME it was last named -- not just a boolean "was it ever named". The journal fold
// is deliberately cumulative across the whole run (so a later flush sees everything an earlier one
// did -- that is the point of this cache), but `live-import-summary.json` is fully overwritten on
// every flush and a real multi-entity importer flushes one entity at a time (the only documented
// caller shape, rp-import-codegen/SKILL.md's contacts wrapper). Comparing the CURRENT flush's
// summary keys against the FULL run's cumulative journal entity types would then flag every entity
// reported by an earlier flush of the SAME run as "journal has rows, no summary key names it" the
// moment a later flush reports a different entity -- a false mismatch on every correctly-behaving
// multi-entity run. Tracking what has EVER been named across
// the run's own flushes, instead of only the current one, keeps a truly never-reported entity type
// detectable (it is never added) while an entity named by an earlier flush of this same run is
// correctly recognized as reported, not re-flagged by a later, different flush -- AS LONG AS the
// journal has not grown new rows for that entity since the last time it was named.
//
// A plain per-entity boolean
// is wrong, because "named once" is not the same thing as "accounts for the journal's current
// state". A flush naming an entity ONLY via a naming-only bucket (`alreadyPresentByCrosswalk`)
// while that entity had zero matching journal rows at that moment legitimately agrees -- but if the journal LATER accrues real, ordinary-status rows for that same entity type,
// and no later flush of the run ever names it again (via any bucket), a permanent boolean would
// keep calling that entity "reported" forever, hiding genuinely unreported journal activity from
// the reverse-direction (journal -> summary) check this check exists to provide. Storing the ROW
// COUNT that was true at the moment of naming, instead of a bare boolean, and re-comparing it
// against the journal's CURRENT row count on every subsequent flush, fixes this without reopening
// either case: an entity whose journal rows have not grown past what was already named stays correctly
// exempt (the legitimate "nothing new happened" cases both look like this), while new,
// never-claimed rows past that high-water mark are caught the same way a never-named entity is.
//
// This whole cache, including `reportedEntityCoverage`, is
// process-local (in-memory) and is NOT persisted across a process restart. That is intentional,
// not an oversight: a run id's entire lifetime is confined to one process by a GATE-ENFORCED
// contract, not merely a convention. Every generated importer must self-describe
// `runIdSource: "process-start"` (`assertGeneratedImporterContract` below rejects anything else;
// `rp-import-codegen/SKILL.md`'s "runId is the id the importer mints at process start" and
// `rp-execute-import/SKILL.md`'s recovery-log contract, "the id the importer minted at process
// start, so the entry is attributable to a pass", restate the same rule). So a genuinely resumed
// or recovery pass is a NEW process that mints a NEW run id -- it is correct, not a loss of state,
// for that new run id's `reportedEntityCoverage` to start empty, because no flush has ever happened
// under it. This reasoning does NOT cover a caller outside that gated contract that manually
// reuses an old run id across a process restart (for example an ad hoc recovery script bypassing
// codegen); that usage is unsupported today and would resurface the false-mismatch pattern on
// its first post-restart flush.
const coverageJournalCache = new Map();
function emptyCoverageCacheEntry() {
return { offset: 0, runs: new Map(), latest: new Map(), reportedEntityCoverage: new Map() };
}
// Reuses `foldAttemptsBySourceKey` (local-state.js) on just the newly read rows, grouped by run,
// then merges each run's folded result into that run's cached map -- `Map.set` overwrites, and the
// new rows are strictly later in file order than whatever is already cached, so this reproduces
// exactly what folding the whole run's rows from scratch would produce.
function mergeRowsIntoCoverageCache(entry, rows) {
const byRun = new Map();
for (const row of rows) {
if (!row || !row.runId || !row.sourceStableKey) {
continue;
}
if (!byRun.has(row.runId)) {
byRun.set(row.runId, []);
}
byRun.get(row.runId).push(row);
}
// Project-level latest row per record across every run, in file order: the same fold, without
// the run filter. It answers "where does each record stand now", which no single run can.
for (const [key, row] of foldAttemptsBySourceKey(rows.filter((row) => row && row.runId && row.sourceStableKey))) {
entry.latest.set(key, row);
}
for (const [rowRunId, runRows] of byRun) {
const folded = foldAttemptsBySourceKey(runRows);
let runMap = entry.runs.get(rowRunId);
if (!runMap) {
runMap = new Map();
entry.runs.set(rowRunId, runMap);
}
for (const [key, row] of folded) {
runMap.set(key, row);
}
}
}
// A `needs_verification` row that names a target id records a write that LANDED and was not
// verified: its next action is a read-back, exactly like `succeeded_unverified`, and it was
// attempted. Counting it as `deferred` (never attempted) is how a created product disappeared
// from both `attempted` and `unresolved`. Without a target id it stays a deferral.
// `targetId` is the documented field; a top-level `targetEntityId` (what generated importers
// wrote) names the same landed record and is read the same way.
function attemptTargetId(row) {
const id = row && (row.targetId || row.targetEntityId || (row.failure && row.failure.targetEntityId));
return typeof id === 'string' && id ? id : null;
}
function landedUnverified(row) {
return Boolean(row) && row.status === 'needs_verification' && attemptTargetId(row) !== null;
}
// Count buckets, computed directly from the folded rows' latest status -- never derived by summing
// other held counters. `attempted` is every record a write was sent for: imported, failed, or
// unresolved (sent, outcome not confirmed). `deferred` is never attempted
// (rp-import-codegen/SKILL.md: `deferred` means intentionally not attempted).
function coverageStatusCounts(rows) {
const counts = { imported: 0, deferred: 0, failed: 0, attempted: 0, unexpectedSkipped: 0, unresolved: 0 };
for (const row of rows) {
const status = row.status;
if (status === 'imported') {
counts.imported += 1;
counts.attempted += 1;
} else if (status === 'failed_retryable' || status === 'failed_terminal') {
counts.failed += 1;
counts.attempted += 1;
} else if (UNRESOLVED_ATTEMPT_STATUSES.has(status) || landedUnverified(row)) {
counts.unresolved += 1;
counts.attempted += 1;
} else if (DEFERRED_ATTEMPT_STATUSES.has(status)) {
counts.deferred += 1;
} else if (status === 'skipped_unexpected') {
counts.unexpectedSkipped += 1;
}
}
return counts;
}
// Where each record of one target type stands across ALL runs (latest row per record). Run-level
// buckets above describe what one pass did; this describes project coverage after adoption and
// resume passes. Informational: it is never compared against a held counter. `unresolvedRecords`
// keeps each unresolved record's target identity, so the read-back target is never lost.
function projectLatestCounts(rows) {
const counts = coverageStatusCounts(rows);
const alreadyPresent = rows.filter((row) => row.status === 'skipped_already_imported').length;
const unresolvedRecords = rows
.filter((row) => UNRESOLVED_ATTEMPT_STATUSES.has(row.status) || landedUnverified(row))
.map((row) => ({ sourceStableKey: row.sourceStableKey, status: row.status, runId: row.runId, targetId: attemptTargetId(row) }))
.sort((a, b) => a.sourceStableKey.localeCompare(b.sourceStableKey));
return {
scope: 'project-latest-across-runs',
records: rows.length,
imported: counts.imported,
alreadyPresent,
deferred: counts.deferred,
failed: counts.failed,
unresolved: counts.unresolved,
unexpectedSkipped: counts.unexpectedSkipped,
unresolvedRecords,
};
}
// A held counter is "carried" only when the summary names it explicitly, including an explicit 0
// -- `in` rather than a truthiness check, so a real `0` is never mistaken for absence.
function heldBucketValue(summary, bucket, key) {
const container = summary && summary[bucket];
if (!container || typeof container !== 'object' || !(key in container)) {
return { present: false, value: null };
}
return { present: true, value: container[key] };
}
function truncateMessage(message) {
return typeof message === 'string' && message.length > 300 ? message.slice(0, 300) : message;
}
// Disagreeing `{key, bucket, held, journal}` entries, in entity-then-bucket order -- shared by the
// execution-log detail text below and by completion-report.js's operator-action text.
function coverageDisagreements(coverageCheck) {
const items = [];
for (const [key, row] of Object.entries((coverageCheck && coverageCheck.entities) || {})) {
for (const bucket of [...COVERAGE_ORDINARY_BUCKETS, 'unexpectedSkipped']) {
const counter = row[bucket];
if (counter && counter.compared && counter.agrees === false) {
items.push({ key, bucket, held: counter.held, journal: counter.journal });
}
}
}
return items;
}
function describeCoverageMismatch(coverageCheck) {
const parts = coverageDisagreements(coverageCheck)
.map((item) => `${item.key}.${item.bucket} disagrees (held ${item.held}, journal ${item.journal})`);
for (const key of (coverageCheck && coverageCheck.unmatched) || []) {
parts.push(`${key} not found in the journal for this run`);
}
for (const type of (coverageCheck && coverageCheck.unmatchedJournalEntities) || []) {
parts.push(`journal has ${type} records not named by any summary key`);
}
return parts.join('; ') || 'coverage check mismatch';
}
// Reads (incrementally, via the cache above) the live journal rows for `runId`,
// folds them, and compares them against `summary`'s held counters. Never throws: every case the
// check itself cannot complete resolves to `status: "unchecked"` with a named `reason`.
async function computeCoverageCheck(projectDir, summary, options, runId) {
const checkedAt = new Date().toISOString();
const base = { runId: runId || null, checkedAt, journalPath: COVERAGE_JOURNAL_REL_PATH };
if (!runId) {
return { ...base, status: 'unchecked', reason: 'no_run_id', rowsRead: 0, entities: {}, unmatched: [], unmatchedJournalEntities: [] };
}
const absPath = path.resolve(attemptJournalPath(projectDir));
let entry = coverageJournalCache.get(absPath);
if (!entry) {
entry = emptyCoverageCacheEntry();
coverageJournalCache.set(absPath, entry);
}
let readResult;
try {
readResult = await readAttemptJournalSince(projectDir, entry.offset);
} catch (error) {
if (error && error.code === 'JOURNAL_MISSING') {
return { ...base, status: 'unchecked', reason: 'journal_missing', rowsRead: 0, entities: {}, unmatched: [], unmatchedJournalEntities: [] };
}
if (error && error.code === 'JOURNAL_READ_FAILED') {
return {
...base, status: 'unchecked', reason: 'journal_read_failed', rowsRead: 0, entities: {}, unmatched: [], unmatchedJournalEntities: [],
error: { code: (error.cause && error.cause.code) || null, message: truncateMessage(error.message) },
};
}
if (error && error.code === 'JOURNAL_INVALID') {
// Drop the whole cache entry so the next flush retries with a full read.
coverageJournalCache.delete(absPath);
return {
...base, status: 'unchecked', reason: 'journal_invalid', rowsRead: 0, entities: {}, unmatched: [], unmatchedJournalEntities: [],
error: { line: truncateMessage(error.line), message: truncateMessage(error.message) },
};
}
throw error;
}
if (readResult.truncated) {
entry.runs = new Map();
entry.latest = new Map();
entry.reportedEntityCoverage = new Map();
}
mergeRowsIntoCoverageCache(entry, readResult.rows);
entry.offset = readResult.nextOffset;
const runMap = entry.runs.get(runId) || new Map();
const entityTypesOption = (options && options.entityTypes) || {};
const resolveTargetEntityType = (key) => entityTypesOption[key] || key;
// Buckets that merely NAME an entity (for match purposes) vs. buckets whose VALUE is actually
// compared against the journal. `alreadyPresentByCrosswalk` is in the first set only.
const summaryKeys = new Set();
for (const bucket of [...COVERAGE_ORDINARY_BUCKETS, 'unexpectedSkipped', ...COVERAGE_NAMING_ONLY_BUCKETS]) {
const container = summary && summary[bucket];
if (container && typeof container === 'object') {
for (const key of Object.keys(container)) {
summaryKeys.add(key);
}
}
}
const projectRowsByTargetType = new Map();
for (const row of entry.latest.values()) {
if (!projectRowsByTargetType.has(row.targetEntityType)) projectRowsByTargetType.set(row.targetEntityType, []);
projectRowsByTargetType.get(row.targetEntityType).push(row);
}
const rowsByTargetType = new Map();
for (const row of runMap.values()) {
const type = row.targetEntityType;
if (!rowsByTargetType.has(type)) {
rowsByTargetType.set(type, []);
}
rowsByTargetType.get(type).push(row);
}
const entities = {};
const unmatched = [];
const matchedTargetTypes = new Set();
let anyMismatch = false;
let anyUnresolved = false;
for (const key of summaryKeys) {
const targetType = resolveTargetEntityType(key);
const rows = rowsByTargetType.get(targetType) || [];
// A key named ONLY through a naming-only bucket (e.g. `alreadyPresentByCrosswalk`) makes
// no claim about journal activity for this entity -- zero matching rows is its expected,
// unremarkable state (nothing was attempted this run), not an unmatched claim. A key that
// names at least one ORDINARY bucket (imported/deferred/failed/attempted) is still held to
// the existing rule: claiming activity with zero matching journal rows is unmatched.
const namesOrdinaryBucket = COVERAGE_ORDINARY_BUCKETS.some((bucket) => heldBucketValue(summary, bucket, key).present);
if (rows.length === 0 && namesOrdinaryBucket) {
// A summary key with no matching rows is reported as unmatched, never as agreement.
unmatched.push(key);
anyMismatch = true;
continue;
}
matchedTargetTypes.add(targetType);
const counts = coverageStatusCounts(rows);
if (counts.unresolved > 0) {
anyUnresolved = true;
}
const entityRow = { unresolved: counts.unresolved };
for (const bucket of COVERAGE_ORDINARY_BUCKETS) {
const held = heldBucketValue(summary, bucket, key);
if (!held.present) {
entityRow[bucket] = { held: null, journal: counts[bucket], agrees: null, compared: false };
} else {
const agrees = held.value === counts[bucket];
if (!agrees) {
anyMismatch = true;
}
entityRow[bucket] = { held: held.value, journal: counts[bucket], agrees, compared: true };
}
}
// `unexpectedSkipped` is deliberately the opposite of the four ordinary buckets: a status
// nothing should ever reach must not go invisible merely because the importer never named a
// counter for it, so an absent held value defaults to 0 rather than to "not compared".
const heldSkipped = heldBucketValue(summary, 'unexpectedSkipped', key);
const heldSkippedValue = heldSkipped.present ? heldSkipped.value : 0;
const skippedAgrees = heldSkippedValue === counts.unexpectedSkipped;
if (!skippedAgrees) {
anyMismatch = true;
}
entityRow.unexpectedSkipped = { held: heldSkippedValue, journal: counts.unexpectedSkipped, agrees: skippedAgrees, compared: true };
entityRow.project = projectLatestCounts(projectRowsByTargetType.get(targetType) || []);
entities[key] = entityRow;
}
// Accumulate this flush's matched target types into the run's PERSISTED, cumulative
// coverage map -- not a bare "was it ever named" boolean, but the CLAIMING journal row count that
// was true for that entity AT THE TIME it was named. See the cache comment above
// `coverageJournalCache` for why cumulative tracking across flushes is required at all, and
// for why a boolean is not enough on its own: a naming-only bucket (or any bucket) can
// legitimately name an entity while the journal has zero (or fewer) rows for it, and the journal
// can keep growing afterward without any later flush ever naming that entity again. Storing the
// row count lets the reverse check keep comparing cumulative reported coverage against the
// journal's cumulative state on every flush, instead of permanently exempting an entity the
// moment it is named once.
//
// This mark and the reverse-mismatch check below are two
// halves of one invariant -- "the mark only ever reflects rows that make a journal-count claim" --
// and must be computed from the SAME per-type claiming count, not two separately-filtered ones.
// Updating the mark with each type's FULL row count (claiming + non-claiming) while the check below
// compares it against the claiming-only count let a type matched while it already had non-claiming
// rows (e.g. `skipped_out_of_scope`) set an inflated mark that could then mask a later genuine,
// never-renamed claiming row (e.g. a real `imported` row) for that same type -- the mark never
// dropped, so `covered < claimingRowCount` stayed false even though the claim was real. Computing
// `claimingRowCountByType` once, up front, and using it for BOTH the mark and the check keeps them
// structurally unable to drift apart again.
const claimingRowCountByType = new Map();
for (const [targetType, rowsForType] of rowsByTargetType) {
const claimingRowCount = rowsForType.filter((row) => !NON_CLAIMING_ATTEMPT_STATUSES.has(row.status)).length;
claimingRowCountByType.set(targetType, claimingRowCount);
}
let coverageByType = entry.reportedEntityCoverage.get(runId);
if (!coverageByType) {
coverageByType = new Map();
entry.reportedEntityCoverage.set(runId, coverageByType);
}
for (const targetType of matchedTargetTypes) {
const claimingRowCount = claimingRowCountByType.get(targetType) || 0;
const previouslyCovered = coverageByType.get(targetType) || 0;
coverageByType.set(targetType, Math.max(previouslyCovered, claimingRowCount));
}
// Journal -> summary direction: a targetEntityType with real folded CLAIMING rows but no summary
// key EVER naming it across this run's flushes (directly, or via `entityTypes`) is a counter the
// importer never reported. "Named" is re-checked against the journal's CURRENT cumulative
// claiming row count on every flush, not treated as a one-time permanent exemption -- an entity
// whose claiming row count has grown past what was covered the last time it was named is just as
// unreported, from this run's own summary, as one that was never named at all.
//
// A target type whose ONLY rows are e.g. `skipped_out_of_scope` has zero claiming rows, so
// `covered` (0, since `coverageByType` only ever accumulates claiming counts too) is never less
// than 0 and it is correctly never flagged -- it made no claim, so there is nothing to be missing.
const unmatchedJournalEntities = [];
for (const [targetType, claimingRowCount] of claimingRowCountByType) {
const covered = coverageByType.get(targetType) || 0;
if (covered < claimingRowCount) {
unmatchedJournalEntities.push(targetType);
anyMismatch = true;
}
}
let status;
let reason;
if (anyMismatch) {
status = 'mismatch';
} else if (anyUnresolved) {
status = 'unchecked';
reason = 'has_unresolved';
} else {
status = 'agrees';
}
return {
...base,
status,
...(reason ? { reason } : {}),
rowsRead: readResult.rows.length,
entities,
unmatched,
unmatchedJournalEntities,
};
}
// This is the PER-BATCH FLUSH POINT, not a recovery-only helper. An
// importer that holds its counters until the end loses them to any interruption, and a long
// import redirected to a temp file loses them to the shell. Call it after every batch with the
// run's own held counters -- never with figures re-derived from the append-only ledger, which
// folds dry-run rows, retried batches and recovery re-entries into the live total.
//
// Durable accounting, not liveness: heartbeat output belongs to `lib/progress-log.js`.
//
// When this flush names a run id (its own `options.runId`, else `summary.runId`), the
// write is also checked against that run's attempt-journal rows. The check never replaces a
// held counter and never throws for its own sake -- a wrong or uncheckable count is reported, not
// hidden, and the write still completes normally either way.
async function writeLiveImportSummary(projectDir, summary, options = {}) {
const before = await readJsonIfExists(liveImportSummaryPath(projectDir), null);
const effectiveRunId = options.runId || (summary && summary.runId) || null;
const coverageCheck = await computeCoverageCheck(projectDir, summary, options, effectiveRunId);
const next = {
schemaVersion: 1,
generatedAt: new Date().toISOString(),
...(summary || {}),
coverageCheck,
};
await writeJsonAtomic(liveImportSummaryPath(projectDir), next);
if (options.runId) {
await appendExecutionLog(projectDir, {
runId: options.runId,
phase: options.phase || 'import',
event: 'batch_flush',
detail: options.detail || `accounting flushed after batch ${options.batchNumber === undefined ? '(unnumbered)' : options.batchNumber}`,
artifacts: ['execution/live-import-summary.json'],
});
}
if (effectiveRunId && coverageCheck.status === 'mismatch') {
await appendExecutionLog(projectDir, {
runId: effectiveRunId,
phase: options.phase || 'import',
event: 'coverage_mismatch',
detail: describeCoverageMismatch(coverageCheck),
artifacts: ['execution/live-import-summary.json'],
});
} else if (effectiveRunId && coverageCheck.status === 'unchecked') {
await appendExecutionLog(projectDir, {
runId: effectiveRunId,
phase: options.phase || 'import',
event: 'coverage_unchecked',
detail: `coverage check could not run (reason: ${coverageCheck.reason})`,
artifacts: ['execution/live-import-summary.json'],
});
}
return {
path: 'execution/live-import-summary.json',
beforeExists: Boolean(before),
changes: {
imported: diffCounts(before && before.imported, next.imported),
deferred: diffCounts(before && before.deferred, next.deferred),
failed: diffCounts(before && before.failed, next.failed),
...(options.extraChanges || {}),
},
coverageCheck,
};
}
// ---------------------------------------------------------------------------
// The generated importer declares its modes, and the gate checks them.
//
// Before this, the codegen skill ASKED for selective-recovery flags and nothing anywhere
// verified that a generated importer honoured the instruction. A generated importer once
// shipped that parsed no command-line arguments at all, exposed none of the modes,
// and passed the import gate — a mandatory boundary that existed only as prose.
// ---------------------------------------------------------------------------
const GENERATED_IMPORTER_CONTRACT_VERSION = 1;
const REQUIRED_SELECTION_MODES = [
'entity',
'source-type',
'missing-only',
'failed-only',
'deferred-only',
'unresolved-only',
'rerun',
];
// Project-relative, forward-slashed. These are the paths the shared helpers actually write, so
// a descriptor that names something else describes an importer keeping a private ledger.
const REQUIRED_LEDGER_PATHS = {
attempts: 'state/attempts/write-attempts.ndjson',
sampleAttempts: 'state/sample/attempts/write-attempts.ndjson',
unresolved: 'execution/unresolved-writes.ndjson',
recoveryLog: 'execution/recovery-log.json',
};
// Throws naming EVERY missing mode and EVERY misplaced path at once. One error per run of the
// gate would turn a codegen fix into a guessing game.
function assertGeneratedImporterContract(descriptor, {mappingPlan=null,projectDir=null}={}) {
const problems = [];
if (!descriptor || typeof descriptor !== 'object' || Array.isArray(descriptor)) {
throw new Error('generated importer contract: descriptor must be an object — an entrypoint that ignores --describe fails the gate, it never passes by default');
}
if (descriptor.contractVersion !== GENERATED_IMPORTER_CONTRACT_VERSION) {
problems.push(`contractVersion must be ${GENERATED_IMPORTER_CONTRACT_VERSION}, got ${JSON.stringify(descriptor.contractVersion)}`);
}
if (descriptor.runIdSource !== 'process-start') {
problems.push(`runIdSource must be "process-start", got ${JSON.stringify(descriptor.runIdSource)}`);
}
const modes = Array.isArray(descriptor.selectionModes) ? descriptor.selectionModes : null;
if (!modes) {
problems.push('selectionModes must be an array of mode names');
} else {
for (const mode of REQUIRED_SELECTION_MODES) {
if (!modes.includes(mode)) {
problems.push(`missing selection mode: ${mode}`);
}
}
}
const ledger = descriptor.ledger;
if (!ledger || typeof ledger !== 'object' || Array.isArray(ledger)) {
problems.push('ledger must be an object naming the durable artifact paths');
} else {
for (const [key, expected] of Object.entries(REQUIRED_LEDGER_PATHS)) {
const actual = ledger[key];
if (typeof actual !== 'string' || actual.replace(/\\/g, '/') !== expected) {
problems.push(`ledger.${key} must be "${expected}", got ${JSON.stringify(actual)}`);
}
}
// The vendoring escape hatch survives for the helper IMPLEMENTATIONS; it does not survive
// for the entry contract, and an append-only ledger is part of that contract.
if (ledger.appendOnly !== true) {
problems.push('ledger.appendOnly must be true — a per-record log of what we wrote to a merchant store is only ever appended to');
}
}
problems.push(...validateGeneratedImporterReviewContract(descriptor.migrationReview));
if (mappingPlan?.fieldContractVersion===1) {
const {digest,canonical,assertExecutionScope}=require('./mapping-field-contract.js');
if (!Array.isArray(mappingPlan.executionScope?.resolvedEntityRefs)) problems.push('canonical mapping must contain its resolved execution scope');
if (descriptor.mappingPlanDigest!==digest(mappingPlan)) problems.push('mappingPlanDigest must match the pinned canonical authority');
if (canonical(descriptor.resolvedEntityRefs)!==canonical(mappingPlan.executionScope?.resolvedEntityRefs)) problems.push('resolvedEntityRefs must match the canonical execution scope');
if (descriptor.mappingScopeAssertion!=='assertExecutionScope') problems.push('mappingScopeAssertion must declare the shared direct-handler guard');
for (const ref of mappingPlan.executionScope?.resolvedEntityRefs || []) {
try {assertExecutionScope(mappingPlan,ref,descriptor.mappingPlanDigest,projectDir);} catch(e) {problems.push(e.message);}
}
}
if (problems.length) {
throw new Error(`generated importer contract violated:\n - ${problems.join('\n - ')}`);
}
return descriptor;
}
module.exports = {
RECOVERY_SCHEMA_VERSION,
RECOVERY_MODES,
DEFERRED_ATTEMPT_STATUSES,
UNCERTAIN_ATTEMPT_STATUSES,
attemptTargetId,
landedUnverified,
GENERATED_IMPORTER_CONTRACT_VERSION,
REQUIRED_SELECTION_MODES,
REQUIRED_LEDGER_PATHS,
assertGeneratedImporterContract,
recoveryLogPath,
liveImportSummaryPath,
normalizeSelectionFilters,
foldAttemptsBySource,
sourceStableKey,
selectImportRecords,
selectImportRecordsFromState,
selectRerunRecords,
selectRerunRecordsFromState,
normalizeRecoveryEntry,
normalizeConflictDecisions,
recoveryEntriesOf,
loadConflictDecisions,
latestConflictDecisionFor,
loadRecoveryLog,
appendRecoveryLogEntry,
writeLiveImportSummary,
// Exported so `completion-report.js`'s operator-action text and `website-handoff.js`'s
// rendering can describe the same disagreements the writer computed, without recomputing them.
coverageDisagreements,
describeCoverageMismatch,
COVERAGE_JOURNAL_REL_PATH,
};
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Needs Node.js
Security
What our scanner noticed· Low risk
- Scripts that your agent may run
This skill includes scripts that your agent may run. Read them before you use it.
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Published by
- Wix
- Publisher
- Wix (Official)
- Source
- wix/skills · skills/wix-replatform · commit d168bc2
- Licence
- MIT License (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by Wix or Wix.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download wix-replatform.zip