Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/figma-studio-runner.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,17 @@ The payload preserves the source needed for a Studio-side transform:
- `scenegraph` includes the normalized current page and selected nodes rather than only generated HTML.
- `assets` carries the normalized exported assets.
- `transform` requests the `static-site-importer/figma` route with a WordPress target, preserved source scenegraph, asset import, selection scope, page ID, and selected node IDs.
- `debug` carries a per-request handoff ID, generated artifact context, diagnostics, and metadata.
- `debug` carries a per-request handoff ID, a bounded summary, diagnostics, and metadata. The generated website artifact remains local to avoid duplicating binary assets in the handoff request.

The debug summary is deterministic from the selected source and generated artifact. It reports the selection scope and page, selected-node count, recursive node count, asset count, and diagnostic, warning, and error counts. When no nodes are selected, node counting falls back to the current page. `generate-artifact.test.mjs` fixes this shape with a selected-node fixture and verifies the route, preservation options, handoff ID, generated artifact, and summary counts.
The debug summary is deterministic from the selected source and generated artifact. It reports the selection scope and page, selected-node count, recursive node count, asset count, and diagnostic, warning, and error counts. When no nodes are selected, node counting falls back to the current page. `generate-artifact.test.mjs` fixes this shape with a selected-node fixture and verifies the route, preservation options, handoff ID, bounded debug payload, and summary counts.

## Handoff And Diagnostics

The UI posts to `http://127.0.0.1:48732/figma-to-wordpress/import` with `Content-Type: application/json`. The Studio button remains disabled until normalized selection data is available and while a request is active.

Each request receives a `figma-...` handoff ID. On success, Studio may return `requestId`, `siteName`, `siteUrl`, and `importSummary`; the UI displays the accepted site and logs those values with the handoff ID, payload schema, selection identity, source summary, and generated artifact file/entrypoint summary.

A non-2xx response or a response without `success: true` is a failed handoff. The visible error uses Studio's response message when available, appends its request ID for correlation, and otherwise includes the HTTP status. Network and response failures are logged with the same handoff ID and source summary, so Studio and Figma logs can be correlated without treating the debug artifact as the primary import contract.
A non-2xx response or a response without `success: true` is a failed handoff. The visible error uses Studio's response message when available, appends its request ID for correlation, and otherwise includes the HTTP status. Network and response failures are logged with the same handoff ID and source summary, while the generated artifact remains available in local plugin diagnostics.

Not implemented yet:

Expand Down
3 changes: 1 addition & 2 deletions plugins/figma-to-wordpress-studio/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,13 @@ The `Open in WordPress Studio` request body is source-first:
}
},
"debug": {
"generatedArtifact": {},
"diagnostics": []
}
},
"siteName": "Marketing site"
}
```

`debug.generatedArtifact` is diagnostic context only. Studio should route from `source`, `scenegraph`, and `transform`, not from a pre-rendered website artifact bundle.
Studio routes from `source`, `scenegraph`, and `transform`. The generated website artifact remains available in the plugin's local diagnostics but is not duplicated in the handoff request.

See [`../../docs/figma-studio-runner.md`](../../docs/figma-studio-runner.md) for the integration notes.
2 changes: 0 additions & 2 deletions plugins/figma-to-wordpress-studio/src/payload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ export interface FigmaSourcePayload {
debug: {
handoffId?: string;
summary: FigmaSourceDebugSummary;
generatedArtifact?: GeneratedArtifact["studioImportPayload"];
diagnostics: GeneratedArtifact["diagnostics"];
metadata?: GeneratedArtifact["metadata"];
};
Expand Down Expand Up @@ -95,7 +94,6 @@ export function toFigmaSourcePayload(
debug: {
handoffId,
summary: sourceDebugSummary(selection, artifact),
generatedArtifact: artifact?.studioImportPayload,
diagnostics: artifact?.diagnostics || [],
metadata: artifact?.metadata,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ test("generates a source-first Figma handoff payload with debug summary", async
assert.equal(source.transform.route, "static-site-importer/figma");
assert.equal(source.transform.options.preserveSourceScenegraph, true);
assert.equal(source.debug.handoffId, "handoff-123");
assert.equal(source.debug.generatedArtifact.schema, "blocks-engine/php-transformer/site-artifact/v1");
assert.equal("generatedArtifact" in source.debug, false);
assert.equal(source.debug.summary.scope, "selected-nodes");
assert.equal(source.debug.summary.selectedNodeCount, 1);
assert.equal(source.debug.summary.nodeCount, 2);
Expand Down
Loading