Wix Headless Replatform
WixOfficialPublished by Wix
- Skill
- Workflow
- Software development
- MIT
- Low risk
- Has scripts
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
The wix-headless-replatform skill acts as a central supervisor for migrating or cloning a public website's home page into a Wix Headless environment. It enforces a structured, multi-stage process that includes browser-based extraction, build planning, implementation, and visual verification. The skill ensures visual fidelity, SEO preservation, and structural integrity by utilizing a frozen manifest approach, where every stage produces durable artifacts that inform the next. It supports both standalone cloning and integrated migration modes, with specific protocols for handling gaps and ensuring the final output is a functional Wix CLI project.
What it does
- Clones or migrates a public website home page to a Wix Headless frontend.
- Manages the end-to-end workflow through distinct stages: context, evidence, implementation, and verification.
- Uses browser-backed extraction to capture visual and structural data.
- Enforces strict visual fidelity and SEO preservation standards.
- Supports one-click automation for migration handoffs.
- Generates a final report and terminal receipt for migration completion.
When to use it
- When you need to clone a public website home page into a new Wix Headless project.
- When performing a migration of an existing site to a Wix Headless architecture.
- When you require a structured, verifiable process for rebuilding a frontend with high visual fidelity.
- When working within a migration handoff that provides specific project and data-binding intent.
Advantages
- Ensures consistent results through a rigid, stage-based supervisor protocol.
- Maintains high visual and functional fidelity to the source website.
- Provides a clear path for recovery and gap resolution during the build process.
- Automates the transition from extraction to a runnable Wix CLI scaffold.
Usage examples
- “Clone the home page of a website into a new Wix Headless project.”
- The agent initiates the standalone clone workflow, resolving the source URL and proceeding through the context and evidence stages to create a new Wix CLI project.
- “Migrate this website using the provided handoff file.”
- The agent enters migration mode, reads the handoff configuration, and continues the build process within the existing migration-owned project structure.
Install
Download the skill as a ZIP:
https://mp-staging.autogineer.com/agent-skills/wix/wix-headless-replatform-p46x/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip wix-headless-replatform.zip -d .agents/skills
Documentation by Wix
wix-headless-replatform
Role
Drive a close-enough, visually polished Wix Headless frontend from a source website.
The implemented scope is one resolved home page and the default output is
projects/<project-name>, derived from the hostname. Use Wix CLI Headless, Astro,
TypeScript, and Tailwind; use React only for complex interactive islands.
Reject additional-page and explicit-URL scope with an actionable explanation until a later
approved workflow defines page resolution and shared evidence across routes.
This entry skill is the supervisor. It decides the next workflow stage and loads only the resource for that stage. Do not preload every resource or reference: stage-specific rules are deliberately demand-loaded.
Two modes exist:
Standalone clone: source URL to a new, real Wix CLI Headless project.
Migration phase:
--handoff <migration-project>/website/handoff.jsoncontinues on the migration-owned destination. Never omit--handofffor an integrated migration: the standalone command creates a second site.
Non-negotiable invariants
Treat the requested public branded homepage as authorized; apply the boundaries in
references/safety.mdwithout asking a separate routine authorization question.Browser-backed extraction is mandatory. Do not substitute HTML-only extraction.
Resolve the home page before capture. Build only from a validated frozen extraction manifest; raw observations are never builder inputs.
A standalone output must be a successful Wix CLI scaffold with valid Wix identity and runnable
devandbuildscripts. Never hand-create a Wix-shaped substitute.In migration mode, reuse the handoff's site/project and route/data-binding intent; do not create or retarget a second destination.
Preserve source structure, first-viewport evidence, chrome hierarchy, source assets, fonts, core interactions, SEO, internal URL behavior, and branded fallback behavior.
A build is not completion. Completion requires the accepted post-build visual-review and gap-loop evidence described by
rp-qa-gap-loop, plus optional facelift acceptance only when the user explicitly selected facelift mode.
Supervisor protocol
On every new or resumed run:
Resolve the source URL, output directory, and mode. In migration mode read
website/handoff.jsonanddocs/site-clone/frontend-automation-state.jsonfirst.Select the first incomplete stage from the table below and read only that resource's
SKILL.mdplus the references it explicitly needs.Execute that stage until it writes its required durable artifact, or records a specific genuine blocker with evidence and an exact unblock action.
Re-select the stage after every boundary. Do not say that a required next step “needs to happen” and end the run; load its resource and perform it.
| Stage | Load only when | Resource | Durable outcome |
|---|---|---|---|
| Context | mode, scope, project, or browser environment is unresolved | resources/rp-project-context/SKILL.md | valid context, approval record, runnable project/plan state, or blocker |
| Evidence | frozen home-page extraction is absent or stale | resources/rp-source-evidence/SKILL.md | validated extraction/latest.json and frozen manifest, or global blocker |
| Implementation | frozen build plan exists and home UI is incomplete | resources/rp-ui-implementation/SKILL.md | manifest-hash-aware runnable home implementation |
| Verify and improve | build, QA, comparison, review, fix, report, release, or receipt is incomplete | resources/rp-qa-gap-loop/SKILL.md | accepted result, done_with_gaps, or global blocker |
| Optional facelift | normal clone accepted and automation state says facelift is requested | resources/rp-facelift/SKILL.md | accepted facelift review, or blocker |
When frontendPhase.allowedNow is plan, complete only the plan-eligible context and
evidence work and leave a resumable plan-state record. When it is build, continue through
implementation and verification against the migration-owned project.
One-click continuation
A migration handoff declaring automationMode: "one_click" authorizes routine scope and
frontend checkpoints. Record those approvals in
docs/site-clone/frontend-automation-state.json; do not pause to ask whether to proceed
with a required stage, screenshot review, or authorized gap-fix pass.
An explicit facelift request may be carried from 1-click intake, but it remains gated until
normal clone acceptance; 1-click never implies facelift by itself.
In a one-click build run, keep selecting and executing stages until one of these durable outcomes exists:
website/completion.jsonis valid and the latest visual review is complete with no open critical/high identity finding; orfive visual gap cycles have been completed and
website/completion.jsonrecords the truthful terminal statusdone_with_gapswith the final reviewed evidence; ora genuine blocker is recorded with owner, evidence, attempted recovery, and exact next authority/action needed.
An owned local extraction gap is not a genuine blocker. Continue unrelated work, use no more
than two distinct targeted recovery attempts, then build the affected dependency closure
provisionally and surface post-assembly choices in final-report.json and .md.
Before classifying a shell, browser, or network failure as a blocker, use the
repo-local Wix/Yarn toolchain PATH ordering and follow the recovery order in
resources/rp-project-context/SKILL.md: aligned-shell retry, then the
required browser/network escalation and retry, then blocker only if it still
fails or approval is pending. After every gap iteration, immediately return to
the stage table; never treat a first build, a reported plan, or backend import
as frontend completion.
In migration mode the build must also leave the final route manifest that old-link
preservation consumes (output-contract.md, "Migration terminal receipt"). A built site is
not proof that old URLs work; redirect application and public verification stay pending
until the cutover step runs them.
Commands
Run node scripts/site-clone.mjs <source-url> for standalone mode, or
node scripts/site-clone.mjs <source-url> --handoff <path> for migration mode. The active
resource gives the exact commands and inputs for its stage.
References
Resources load their own references. The shared contracts are kept under references/:
safety.md, workflow.md, extraction-schema.md, output-contract.md,
qa-checklist.md, and the interaction/layout/control/normalization/gap contracts.
Files
- .publish-manifest.json228 B
- ATTRIBUTION.mdAdded by AutoGineer833 B
- LICENSELicence file added by AutoGineer1.0 KiB
- SKILL.md6.7 KiB
- VERSION6 B
- agents/openai.yaml259 B
- references/control-and-visual-fidelity-contract.md2.1 KiB
- references/extraction-schema.md8.6 KiB
- references/interaction-runtime-contract.md5.5 KiB
- references/layout-blueprint-contract.md2.1 KiB
- references/output-contract.md5.0 KiB
- references/post-build-gap-contract.md5.5 KiB
- references/qa-checklist.md4.7 KiB
- references/safety.md1.0 KiB
- references/ui-normalization-contract.md2.8 KiB
- references/workflow.md8.5 KiB
- registry/README.md958 B
- registry/approvals/button/shadcn-default-ac60ef5.json980 B
- registry/items/button/shadcn-default-ac60ef5/button.tsxScript1.9 KiB
- registry/items/button/shadcn-default-ac60ef5/capabilities.json2.7 KiB
- registry/items/button/shadcn-default-ac60ef5/contract.md2.1 KiB
- registry/licenses/shadcn-ui-ac60ef5-MIT.txt1.0 KiB
- registry/registry.json1.4 KiB
- schemas/build-plan.schema.json628 B
- schemas/candidate.schema.json949 B
- schemas/common.schema.json1.2 KiB
- schemas/decision-patch.schema.json621 B
- schemas/decision-request.schema.json825 B
- schemas/extraction-gap.schema.json1.6 KiB
- schemas/extraction-manifest.schema.json1.6 KiB
- schemas/final-report.schema.json744 B
- schemas/foundation.schema.json950 B
- schemas/metadata.schema.json801 B
- schemas/observation-packet.schema.json661 B
- schemas/page-capture.schema.json1015 B
- schemas/page-resolution.schema.json1.4 KiB
- schemas/shared-chrome.schema.json940 B
- schemas/unit.schema.json1.8 KiB
- scripts/assemble-extraction.mjsScript36.1 KiB
- scripts/benchmark-extraction.mjsScript9.1 KiB
- scripts/browser-extraction-preflight.mjsScript1.2 KiB
- scripts/build-extracted-homepage.mjsScript17.1 KiB
- scripts/clear-wix-starter.mjsScript2.3 KiB
- scripts/create-wix-project.mjsScript17.7 KiB
- scripts/discover-urls.mjsScript4.4 KiB
- scripts/extract-assets.mjsScript4.6 KiB
- scripts/extract-design-system.mjsScript23.9 KiB
- scripts/extract-interactions.mjsScript83.5 KiB
- scripts/extract-page.mjsScript118.0 KiB
- scripts/extract-seo.mjsScript848 B
- scripts/extract-tokens.mjsScript2.6 KiB
- scripts/finalize-extraction-report.mjsScript6.4 KiB
- scripts/finalize-gap-review.mjsScript12.2 KiB
- scripts/finalize-gap-review.test.mjsScript5.3 KiB
- scripts/finalize-migration-website.mjsScript6.2 KiB
- scripts/generate-control-state-contract.mjsScript9.6 KiB
- scripts/generate-design-md.mjsScript11.7 KiB
- scripts/generate-extraction-validators.mjsScript5.4 KiB
- scripts/generate-invoice-download-backend.mjsScript16.5 KiB
- scripts/generate-layout-blueprint.mjsScript8.7 KiB
- scripts/generate-repeater-cms.mjsScript4.9 KiB
- scripts/generate-route-plan.mjsScript4.6 KiB
- scripts/generate-scene-contract.mjsScript16.2 KiB
- scripts/generate-ui-normalization.mjsScript13.3 KiB
- scripts/generate-visual-assets.mjsScript6.3 KiB
- scripts/lib/browser-tooling.mjsScript19.9 KiB
- scripts/lib/common.mjsScript9.0 KiB
- scripts/lib/component-capabilities.mjsScript7.9 KiB
- scripts/lib/component-registry.mjsScript15.7 KiB
- scripts/lib/content-boundary.mjsScript2.8 KiB
- scripts/lib/extraction-contract.mjsScript19.1 KiB
- scripts/lib/extraction-detectors.mjsScript11.4 KiB
- scripts/lib/extraction-validators.generated.mjsScript25.2 KiB
- scripts/lib/font-contract.mjsScript10.0 KiB
- scripts/lib/frontend-automation-state.mjsScript6.6 KiB
- scripts/lib/gap-analysis.mjsScript26.1 KiB
- scripts/lib/html-extract.mjsScript5.7 KiB
- scripts/lib/interaction-bootstrap.mjsScript296 B
- scripts/lib/interaction-runtime.mjsScript8.1 KiB
- scripts/lib/interaction-timeline.mjsScript13.9 KiB
- scripts/lib/layout-blueprint/classifiers.mjsScript7.8 KiB
- scripts/lib/layout-blueprint/geometry.mjsScript1.8 KiB
- scripts/lib/layout-blueprint/vocabulary.mjsScript872 B
- scripts/lib/playwright-request-guard.cjsScript2.4 KiB
- scripts/lib/ui-normalization.css1.5 KiB
- scripts/lib/url-safety.mjsScript6.8 KiB
- scripts/optimize-svg.mjsScript895 B
- scripts/post-build-gap.mjsScript16.5 KiB
- scripts/provision-repeater-cms.mjs2.8 KiB
- scripts/record-gap-decision.mjs2.3 KiB
- scripts/replay-extraction.mjs5.3 KiB
- scripts/resolve-home-page.mjs4.0 KiB
- scripts/site-clone.mjs35.8 KiB
- scripts/validate-font-contract.mjs1.3 KiB
- scripts/verify-interactions.mjs32.1 KiB
- scripts/visual-qa.mjs20.6 KiB
scripts/lib/extraction-contract.mjs
import { createHash } from "node:crypto";
import path from "node:path";
import { readFile } from "node:fs/promises";
import { ensureDir, writeJson } from "./common.mjs";
import { validateGeneratedArtifact } from "./extraction-validators.generated.mjs";
export const EXTRACTION_SCHEMA_VERSION = "0083.1";
export const MAX_GAP_RECOVERY_ATTEMPTS = 2;
export const EXTRACTION_BUDGETS = Object.freeze({
maxRawEvidenceBytes: 250 * 1024 * 1024,
maxFrozenSpecBytes: 10 * 1024 * 1024,
maxAgentDecisions: 30,
maxAgentInputTokens: 50_000,
maxExtractionMs: 10 * 60 * 1000,
});
const ARTIFACT_KINDS = new Set([
"page-resolution",
"observation-packet",
"page-capture",
"foundation",
"metadata",
"shared-chrome",
"unit",
"extraction-gap",
"extraction-manifest",
"build-plan",
"final-report",
"decision-request",
"decision-patch",
]);
const NON_SEMANTIC_KEYS = new Set([
"createdAt",
"updatedAt",
"startedAt",
"completedAt",
"generatedAt",
"capturedAt",
"timestamp",
"logs",
"log",
]);
const ALLOWED_FIELDS = Object.freeze({
"page-resolution": new Set(["schemaVersion", "kind", "id", "pageKey", "destinationRoute", "status", "source", "evidence", "gapRefs", "dependencyHashes", "hash", "extensions"]),
"page-capture": new Set(["schemaVersion", "kind", "id", "pageKey", "status", "sourceFingerprint", "viewportSet", "sectionOrder", "ignoredSurfaces", "normalizationActions", "observationRefs", "gapRefs", "dependencyHashes", "hash", "extensions"]),
foundation: new Set(["schemaVersion", "kind", "id", "pageKey", "status", "tokens", "fonts", "primitives", "globalCssIntent", "evidenceRefs", "acceptance", "gapRefs", "dependencyHashes", "hash", "extensions"]),
metadata: new Set(["schemaVersion", "kind", "id", "pageKey", "status", "document", "evidenceRefs", "acceptance", "gapRefs", "dependencyHashes", "hash", "extensions"]),
"shared-chrome": new Set(["schemaVersion", "kind", "id", "pageKey", "status", "header", "footer", "controls", "visualAssets", "behavior", "evidenceRefs", "acceptance", "gapRefs", "dependencyHashes", "hash", "extensions"]),
unit: new Set(["schemaVersion", "kind", "id", "unitKind", "pageKey", "parentUnitId", "order", "status", "classification", "scope", "content", "assets", "layers", "layout", "styleables", "behavior", "children", "reconstruction", "acceptance", "diagnostics", "provenance", "gapRefs", "dependencyHashes", "hash", "extensions"]),
"extraction-gap": new Set(["schemaVersion", "kind", "id", "ownerUnitId", "scope", "status", "missingFields", "reason", "evidenceRefs", "confidence", "dependencyClosure", "affectedAcceptance", "attempts", "remainingAttempts", "assumptions", "omissions", "unblockAction", "userDecision", "extensions"]),
"extraction-manifest": new Set(["schemaVersion", "kind", "captureId", "pageKey", "pageResolution", "pageCapture", "observationRefs", "specs", "gaps", "budgets", "status", "manifestHash", "extensions"]),
"build-plan": new Set(["schemaVersion", "kind", "pageKey", "route", "manifestHash", "status", "units", "extensions"]),
"final-report": new Set(["schemaVersion", "kind", "captureId", "manifestHash", "status", "summary", "gaps", "qa", "extensions"]),
"decision-request": new Set(["schemaVersion", "kind", "id", "decisionType", "allowedChoices", "evidenceRefs", "detectorVersions", "responseSchema", "cacheKey", "extensions"]),
"decision-patch": new Set(["schemaVersion", "kind", "requestId", "choice", "confidence", "reasonCodes", "extensions"]),
});
// `path` is diagnostic only: a rejected value is useless to debug without knowing which
// key held it, and this guard sits under a deeply nested extraction tree.
export function canonicalizeJson(value, path = "$") {
if (value === null || typeof value === "boolean" || typeof value === "string") {
return JSON.stringify(value);
}
if (typeof value === "number") {
if (!Number.isFinite(value)) throw new TypeError(`Canonical JSON cannot contain non-finite numbers at ${path}`);
return JSON.stringify(value);
}
if (Array.isArray(value)) {
return `[${value.map((item, index) => canonicalizeJson(item, `${path}[${index}]`)).join(",")}]`;
}
if (value && typeof value === "object") {
return `{${Object.keys(value).sort().map((key) => `${JSON.stringify(key)}:${canonicalizeJson(value[key], `${path}.${key}`)}`).join(",")}}`;
}
throw new TypeError(`Canonical JSON cannot contain ${typeof value} at ${path}`);
}
export function sha256(value) {
const input = typeof value === "string" || Buffer.isBuffer(value) ? value : canonicalizeJson(value);
return createHash("sha256").update(input).digest("hex");
}
export function semanticContent(value, key = "") {
if (Array.isArray(value)) return value.map((item) => semanticContent(item));
if (!value || typeof value !== "object") {
if (typeof value === "string" && (key === "absolutePath" || key.endsWith("AbsolutePath")) && path.isAbsolute(value)) {
return path.basename(value);
}
return value;
}
const result = {};
for (const childKey of Object.keys(value).sort()) {
if (NON_SEMANTIC_KEYS.has(childKey)) continue;
if (childKey === "hash" || childKey === "manifestHash" || childKey === "cacheKey") continue;
result[childKey] = semanticContent(value[childKey], childKey);
}
return result;
}
export function semanticHash(artifact, dependencyHashes = []) {
return sha256({
artifact: semanticContent(artifact),
dependencyHashes: [...dependencyHashes].sort(),
});
}
export function createDecisionRequest({ id, decisionType, allowedChoices, evidenceRefs = [], detectorVersions = {}, responseSchema = {} }) {
if (!id || !decisionType || !allowedChoices?.length) throw new Error("A decision request requires id, decisionType, and allowedChoices");
const request = {
schemaVersion: EXTRACTION_SCHEMA_VERSION,
kind: "decision-request",
id,
decisionType,
allowedChoices,
evidenceRefs,
detectorVersions,
responseSchema,
cacheKey: "",
};
request.cacheKey = semanticHash(request);
assertValidArtifact(request, "decision-request");
return request;
}
export function applyDecisionPatch(request, patch) {
assertValidArtifact(request, "decision-request");
assertValidArtifact(patch, "decision-patch");
if (patch.requestId !== request.id) throw new Error(`Decision patch ${patch.requestId} does not match ${request.id}`);
if (!request.allowedChoices.some((choice) => canonicalizeJson(choice) === canonicalizeJson(patch.choice))) {
throw new Error("Decision patch choice is outside the allowed typed choices");
}
return { requestId: request.id, cacheKey: request.cacheKey, choice: patch.choice, confidence: patch.confidence, reasonCodes: patch.reasonCodes };
}
export function createGap({
id,
ownerUnitId,
scope = "local",
missingFields = [],
reason,
evidenceRefs = [],
confidence = "low",
dependencyClosure = [],
affectedAcceptance = [],
assumptions = [],
omissions = [],
unblockAction = null,
}) {
if (!id || !ownerUnitId || !reason) throw new Error("A gap requires id, ownerUnitId, and reason");
if (!new Set(["local", "global"]).has(scope)) throw new Error(`Invalid gap scope: ${scope}`);
return {
schemaVersion: EXTRACTION_SCHEMA_VERSION,
kind: "extraction-gap",
id,
ownerUnitId,
scope,
status: scope === "global" ? "global-blocker" : "recoverable",
missingFields,
reason,
evidenceRefs,
confidence,
dependencyClosure: [...new Set([ownerUnitId, ...dependencyClosure])],
affectedAcceptance,
attempts: [],
remainingAttempts: scope === "global" ? 0 : MAX_GAP_RECOVERY_ATTEMPTS,
assumptions,
omissions,
unblockAction,
userDecision: null,
};
}
export function recordGapAttempt(gap, { tactic, evidenceRefs = [], outcome = "failed", producedNewEvidence = false, note = "" }) {
if (gap.scope === "global") return gap;
if (["provisional", "resolved", "needs-user-decision"].includes(gap.status) || gap.remainingAttempts === 0) return gap;
if (!tactic) throw new Error("A gap recovery attempt requires a tactic");
const previousSameTactic = gap.attempts.some((attempt) => attempt.tactic === tactic && !attempt.producedNewEvidence);
if (previousSameTactic && !producedNewEvidence) return gap;
const countsAgainstBudget = outcome !== "resolved";
const attempts = [...gap.attempts, { tactic, evidenceRefs, outcome, producedNewEvidence, countsAgainstBudget, note }];
const consumed = attempts.filter((attempt) => attempt.countsAgainstBudget && attempt.outcome !== "resolved").length;
const resolved = outcome === "resolved";
const remainingAttempts = Math.max(0, MAX_GAP_RECOVERY_ATTEMPTS - consumed);
return {
...gap,
attempts,
remainingAttempts,
status: resolved ? "resolved" : remainingAttempts === 0 ? "provisional" : "recoverable",
};
}
export function validateArtifact(artifact, expectedKind = artifact?.kind) {
const errors = [];
if (!artifact || typeof artifact !== "object" || Array.isArray(artifact)) errors.push("artifact must be an object");
if (!ARTIFACT_KINDS.has(expectedKind)) errors.push(`unsupported artifact kind: ${expectedKind}`);
if (artifact?.kind !== expectedKind) errors.push(`kind must be ${expectedKind}`);
if (artifact?.schemaVersion !== EXTRACTION_SCHEMA_VERSION) errors.push(`schemaVersion must be ${EXTRACTION_SCHEMA_VERSION}`);
if (ARTIFACT_KINDS.has(expectedKind)) {
const schemaInput = ["page-resolution", "page-capture", "foundation", "metadata", "shared-chrome", "unit"].includes(expectedKind) && !artifact?.hash
? { ...artifact, hash: "0".repeat(64) }
: artifact;
const generated = validateGeneratedArtifact(schemaInput, expectedKind);
errors.push(...generated.errors.map((error) => `schema ${error}`));
}
const allowed = ALLOWED_FIELDS[expectedKind];
if (allowed && artifact && typeof artifact === "object") {
for (const key of Object.keys(artifact)) if (!allowed.has(key)) errors.push(`unknown field: ${key}`);
}
if (expectedKind === "page-resolution") {
if (artifact.pageKey !== "home") errors.push("pageKey must be home");
if (!artifact.source?.requestedUrl || !artifact.source?.resolvedUrl) errors.push("requestedUrl and resolvedUrl are required");
if (artifact.destinationRoute !== "/") errors.push("destinationRoute must be /");
}
if (["foundation", "metadata", "shared-chrome", "unit"].includes(expectedKind)) {
if (!artifact.id) errors.push("id is required");
if (!["accepted", "provisional"].includes(artifact.status)) errors.push("status must be accepted or provisional");
if (!Array.isArray(artifact.gapRefs)) errors.push("gapRefs must be an array");
if (artifact.status === "provisional" && artifact.gapRefs?.length === 0) errors.push("provisional artifacts require gapRefs");
}
if (expectedKind === "extraction-gap") {
if (!artifact.id || !artifact.ownerUnitId || !artifact.reason) errors.push("gap id, ownerUnitId, and reason are required");
if (!["local", "global"].includes(artifact.scope)) errors.push("gap scope must be local or global");
if (!Array.isArray(artifact.attempts)) errors.push("gap attempts must be an array");
}
if (expectedKind === "extraction-manifest") {
if (!artifact.captureId || !Array.isArray(artifact.specs) || !Array.isArray(artifact.gaps)) errors.push("manifest captureId, specs, and gaps are required");
if (artifact.gaps?.some((gap) => gap.scope === "global" && gap.status !== "resolved")) errors.push("manifest cannot freeze with an unresolved global blocker");
}
if (expectedKind === "decision-request") {
if (!artifact.id || !artifact.decisionType || !artifact.allowedChoices?.length || !artifact.cacheKey) errors.push("decision request is incomplete");
}
if (expectedKind === "decision-patch") {
if (!artifact.requestId || !artifact.reasonCodes?.length || !["high", "medium", "low"].includes(artifact.confidence)) errors.push("decision patch is incomplete");
}
return { ok: errors.length === 0, errors };
}
export function assertValidArtifact(artifact, expectedKind = artifact?.kind) {
const result = validateArtifact(artifact, expectedKind);
if (!result.ok) throw new Error(`${expectedKind} validation failed: ${result.errors.join("; ")}`);
return artifact;
}
export function freezeSpec(spec, { dependencyHashes = [], gapIds = spec.gapRefs || [] } = {}) {
assertValidArtifact(spec, spec.kind);
const frozen = {
...spec,
gapRefs: [...new Set(gapIds)].sort(),
dependencyHashes: [...dependencyHashes].sort(),
};
frozen.hash = semanticHash(frozen, frozen.dependencyHashes);
return Object.freeze(frozen);
}
export function createExtractionManifest({ captureId, pageResolution, pageCapture, specs, gaps = [], observationRefs = [], budgets = {} }) {
const unresolvedGlobal = gaps.filter((gap) => gap.scope === "global" && gap.status !== "resolved");
if (unresolvedGlobal.length) {
const error = new Error(`Cannot freeze extraction manifest: ${unresolvedGlobal.map((gap) => gap.id).join(", ")}`);
error.code = "EXTRACTION_GLOBAL_BLOCKER";
error.gaps = unresolvedGlobal;
throw error;
}
const specEntries = [...specs]
.map((spec) => ({ id: spec.id, kind: spec.kind, status: spec.status, hash: spec.hash, gapRefs: spec.gapRefs || [] }))
.sort((a, b) => a.id.localeCompare(b.id));
const manifest = {
schemaVersion: EXTRACTION_SCHEMA_VERSION,
kind: "extraction-manifest",
captureId,
pageKey: "home",
pageResolution: { id: pageResolution.id, hash: pageResolution.hash },
pageCapture: { id: pageCapture.id, hash: pageCapture.hash },
observationRefs: [...observationRefs].sort((a, b) => a.ref.localeCompare(b.ref)),
specs: specEntries,
gaps: gaps.map((gap) => ({ id: gap.id, ownerUnitId: gap.ownerUnitId, scope: gap.scope, status: gap.status })).sort((a, b) => a.id.localeCompare(b.id)),
budgets: { ...EXTRACTION_BUDGETS, ...budgets },
status: pageCapture.status === "provisional" || specEntries.some((spec) => spec.status === "provisional") ? "done_with_gaps" : "accepted",
};
manifest.manifestHash = semanticHash(manifest, specEntries.map((entry) => entry.hash));
assertValidArtifact(manifest, "extraction-manifest");
return Object.freeze(manifest);
}
export async function verifyFrozenManifest(extractionDir) {
const manifest = JSON.parse(await readFile(path.join(extractionDir, "extraction-manifest.json"), "utf8"));
assertValidArtifact(manifest, "extraction-manifest");
const failures = [];
const pageResolution = JSON.parse(await readFile(path.join(extractionDir, "page-resolution.spec.json"), "utf8"));
const pageCapture = JSON.parse(await readFile(path.join(extractionDir, "page-capture.spec.json"), "utf8"));
const gapArtifact = JSON.parse(await readFile(path.join(extractionDir, "extraction-gaps.json"), "utf8"));
const gaps = gapArtifact.gaps || [];
const gapIds = new Set();
for (const gap of gaps) {
try { assertValidArtifact(gap, "extraction-gap"); }
catch (error) { failures.push(`${gap.id || "unknown gap"}: ${error.message}`); }
if (gapIds.has(gap.id)) failures.push(`duplicate gap id: ${gap.id}`);
gapIds.add(gap.id);
}
const manifestGapProjection = gaps
.map((gap) => ({ id: gap.id, ownerUnitId: gap.ownerUnitId, scope: gap.scope, status: gap.status }))
.sort((a, b) => a.id.localeCompare(b.id));
if (canonicalizeJson(manifestGapProjection) !== canonicalizeJson(manifest.gaps)) failures.push("manifest gap projection does not match extraction-gaps.json");
const resolutionHash = semanticHash(pageResolution, pageResolution.dependencyHashes || []);
const captureHash = semanticHash(pageCapture, pageCapture.dependencyHashes || []);
if (resolutionHash !== manifest.pageResolution.hash) failures.push(`page resolution: expected ${manifest.pageResolution.hash}, got ${resolutionHash}`);
if (captureHash !== manifest.pageCapture.hash) failures.push(`page capture: expected ${manifest.pageCapture.hash}, got ${captureHash}`);
for (const entry of manifest.observationRefs) {
const absolute = path.resolve(extractionDir, entry.ref);
const extractionRoot = `${path.resolve(extractionDir)}${path.sep}`;
if (!absolute.startsWith(extractionRoot)) {
failures.push(`observation ${entry.ref}: path escapes extraction directory`);
continue;
}
try {
const observation = JSON.parse(await readFile(absolute, "utf8"));
const actual = semanticHash(observation);
if (actual !== entry.hash) failures.push(`observation ${entry.ref}: expected ${entry.hash}, got ${actual}`);
} catch (error) {
failures.push(`observation ${entry.ref}: ${error.code === "ENOENT" ? "file missing" : error.message}`);
}
}
const knownHashes = new Set([resolutionHash, captureHash, ...manifest.specs.map((entry) => entry.hash)]);
for (const gapRef of [...(pageResolution.gapRefs || []), ...(pageCapture.gapRefs || [])]) {
if (!gapIds.has(gapRef)) failures.push(`page artifact: unknown gap ref ${gapRef}`);
}
for (const entry of manifest.specs) {
const file = await findSpecFile(extractionDir, entry.id);
if (!file) {
failures.push(`${entry.id}: file missing`);
continue;
}
const spec = JSON.parse(await readFile(file, "utf8"));
const actual = semanticHash(spec, spec.dependencyHashes || []);
if (actual !== entry.hash) failures.push(`${entry.id}: expected ${entry.hash}, got ${actual}`);
if (canonicalizeJson([...(spec.gapRefs || [])].sort()) !== canonicalizeJson([...(entry.gapRefs || [])].sort())) failures.push(`${entry.id}: manifest gap refs do not match spec`);
for (const gapRef of spec.gapRefs || []) if (!gapIds.has(gapRef)) failures.push(`${entry.id}: unknown gap ref ${gapRef}`);
if (spec.status === "provisional" && !(spec.gapRefs || []).length) failures.push(`${entry.id}: provisional spec is not gap-backed`);
for (const dependencyHash of spec.dependencyHashes || []) {
if (!knownHashes.has(dependencyHash)) failures.push(`${entry.id}: unknown dependency hash ${dependencyHash}`);
}
}
const manifestHash = semanticHash(manifest, manifest.specs.map((entry) => entry.hash));
if (manifestHash !== manifest.manifestHash) failures.push(`manifest: expected ${manifest.manifestHash}, got ${manifestHash}`);
return { ok: failures.length === 0, failures, manifest };
}
async function findSpecFile(extractionDir, id) {
const indexPath = path.join(extractionDir, "spec-index.json");
try {
const index = JSON.parse(await readFile(indexPath, "utf8"));
return index[id] ? path.join(extractionDir, index[id]) : null;
} catch {
return null;
}
}
export async function writeFrozenExtraction({ extractionDir, pageResolution, pageCapture, specs, gaps, manifest, specPaths }) {
await ensureDir(extractionDir);
await writeJson(path.join(extractionDir, "page-resolution.spec.json"), pageResolution);
await writeJson(path.join(extractionDir, "page-capture.spec.json"), pageCapture);
for (const gap of gaps) assertValidArtifact(gap, "extraction-gap");
await writeJson(path.join(extractionDir, "extraction-gaps.json"), {
schemaVersion: EXTRACTION_SCHEMA_VERSION,
gaps,
});
const index = {};
for (const { spec, relativePath } of specPaths) {
await writeJson(path.join(extractionDir, relativePath), spec);
index[spec.id] = relativePath;
}
await writeJson(path.join(extractionDir, "spec-index.json"), index);
await writeJson(path.join(extractionDir, "extraction-manifest.json"), manifest);
}
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-headless-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.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download wix-headless-replatform.zip