Skip to content

Add figma transformer package scaffold#43

Draft
chubes4 wants to merge 23 commits into
trunkfrom
feature/figma-transformer
Draft

Add figma transformer package scaffold#43
chubes4 wants to merge 23 commits into
trunkfrom
feature/figma-transformer

Conversation

@chubes4

@chubes4 chubes4 commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add a WordPress-native figma-transformer package alongside php-transformer.
  • Establish the pipeline boundary for .fig/scenegraph input to normalized PHP IR to static HTML/CSS/assets.
  • Add real fig-kiwi schema/message decoding, required zstd support, archive/image intake, normalized scenegraph rendering, external parity report contracts, docs, CLI, plugin helpers, and contract coverage.

Current scope

  • .fig archive intake supports direct archives and wrapper ZIPs, embedded image metadata, zlib schema chunks, zstd message chunks, binary payload metadata, and decoded Kiwi Message payloads.
  • The parser decodes embedded Kiwi schemas and NODE_CHANGES messages into scenegraph payloads consumable by the renderer.
  • ext-zstd is now a Composer requirement for normal direct .fig imports. The library still exposes explicit callable/filter adapters, and the CLI supports --zstd-command=/path/to/zstd for local operator checks.
  • Scenegraph rendering normalizes boxes, auto-layout, fill/hug/fixed sizing, constraints, clipping, transforms, text metadata, paints, strokes, image references, supported vector SVG paths, unsupported vector placeholders, components/instances, source reports, and diagnostics.
  • Emitters stay source-derived: no hardcoded font/theme defaults; CSS is generated from Figma/IR fields plus a minimal reset.
  • Parity reporting accepts external artifact metadata for source/generated screenshots, diff artifacts, viewport/frame metadata, mismatch metrics, and pass/fail/not-run states.
  • Docs include a local fixture workflow that keeps real .fig files and generated evidence out of git.

Real fixture proof

  • Operator-only fixture used locally: /Users/chubes/Downloads/Fisiostetic.fig (not committed).
  • CLI proof with --zstd-command=/opt/homebrew/bin/zstd: success_with_warnings, 272 nodes, 24 output files, first file index.html.
  • Decoded chunks: schema chunk zlib with 605 definitions, message chunk zstd decoded to NODE_CHANGES.

Remaining gaps

  • Hosts need ext-zstd for normal direct .fig imports. If WPCOM/WP Cloud does not provide it, this package should not be enabled there until support is available or an approved adapter is registered.
  • Visual parity scoring still needs a browser-backed external runner to attach screenshots/diffs.
  • Some advanced Figma features still emit diagnostics/placeholders: unsupported effects, unresolved component references, and vector data without supported path geometry.

Verification

  • php figma-transformer/tests/contract/run.php
  • composer validate --working-dir=figma-transformer --strict
  • git diff --check
  • php figma-transformer/bin/figma-transformer /Users/chubes/Downloads/Fisiostetic.fig --zstd-command=/opt/homebrew/bin/zstd summarized locally; fixture/artifacts not committed.

AI assistance

  • AI assistance: Yes
  • Tool(s): openai/gpt-5.5 via OpenCode
  • Used for: Drafting and integrating the PHP package foundation, fig-kiwi decoder, zstd requirement/adapter support, normalized scenegraph IR, static artifact emitter, rendering foundations, parity contract, docs, and contract tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant