Skip to content

Repository files navigation

GPT → Figma

Fidelity-first reconstruction pipeline for turning generated slides and flat visual references into editable Figma layouts, then measuring and safely reconciling the result across browser, scene data and Figma.

Current release: v0.7 — Controlled Figma Reverse Patching

The trusted production loop is now bidirectional without creating two competing sources of truth:

reference
  -> multiscale perception
  -> fused pending proposals / raster asset requests
  -> explicit review
  -> editable scene
  -> Workbench QA + Correction Engine
  -> native Figma import
  -> Figma 1x QA evidence
  -> manual Figma edits
  -> typed reverse drift patch
  -> 3-way scene/Figma reconciliation
  -> reviewed safe patch
  -> full QA again

scene.json remains the source of truth. Figma edits return as proposals with baselines, never as an unchecked scene overwrite.

Major capabilities

Perception Engine

  • source-bound provider observation bundles;
  • full-slide + overlapping-detail crop plans;
  • crop-local coordinates projected into global scene space;
  • provider reliability calibration;
  • IoU/text-aware multi-provider fusion;
  • safe text/simple-shape proposals;
  • explicit assetRequest output for photos, generated art, 3D and textures;
  • whole-run provider task orchestration and batch fusion;
  • cross-slide style model;
  • perception benchmark metrics.

Correction Engine

  • diff connected regions;
  • nested/rotated layer attribution;
  • ranked offending layers;
  • bounded geometry/typography/image-fit search;
  • exact-base-hash g2f-patch contract;
  • Apply -> full 1× QA -> hash-safe Undo.

Round-trip + Reverse

  • offline native Figma importer;
  • original image bytes / lossless oversize tiles;
  • current Figma root export at 1× + scene-hash evidence;
  • manual Figma drift export through an isolated Reverse Sync plugin;
  • original pack as the source baseline;
  • 3-way reconciliation against source baseline and current scene;
  • hard structural conflicts for deletion/reparent/duplicate tracked IDs/unsupported mixed Figma state;
  • Figma-only annotations remain preserved and informational;
  • whole-run reverse reconciliation.

Hard rules

  1. Explicit raster art remains an image; never vectorize complex content merely to claim editability.
  2. Image quality is not reduced for transport.
  3. Known text stays native and font substitutions remain auditable.
  4. Vision confidence is not approval.
  5. Pending proposals cannot pass the release pipeline.
  6. Correction and reverse patches are bound to an exact scene hash.
  7. Figma is not allowed to silently overwrite scene changes.
  8. Structural ambiguity becomes a conflict, not an approximation.
  9. Completion requires current Workbench and Figma QA evidence.

Quick start

npm install
npm run check
npm run workbench

Create a run:

g2f run:init --profile default --run deck ./slide-01.png ./slide-02.png

Perception

g2f run:perception-plan .g2f/runs/deck --build-style
g2f run:perception-fuse .g2f/runs/deck

Figma import + QA

g2f pack .g2f/runs/deck/scene/slide-001.json \
  --out .g2f/runs/deck/figma/slide-001.g2f-pack.json

g2f run:verify .g2f/runs/deck --stage figma --require-roundtrip

Reverse manual Figma changes

Keep the stable importer unchanged. After editing the imported frame, run the separate figma-reverse-plugin/, select the root and choose the exact original pack. Export the reverse patch, then:

g2f patch:reconcile \
  scene.json \
  scene--figma-reverse.g2f-patch.json \
  --report reconciliation.json \
  --out-patch rebased.g2f-patch.json

g2f patch:apply scene.json rebased.g2f-patch.json --out scene.next.json

For a whole deck:

g2f run:reverse-reconcile .g2f/runs/deck --require-patches

v0.7 CLI additions

g2f patch:reconcile <scene.json> <figma-reverse-patch.json>
  [--report report.json]
  [--out-patch rebased.g2f-patch.json]

g2f run:reverse-reconcile <run-dir>
  [--in-dir qa/reverse]
  [--out-dir qa/reconcile]
  [--require-patches]

All v0.6 and v0.4 commands are delegated through the wrapper chain.

Versioned contracts

  • scene: schemas/scene.v0.2.schema.json
  • agent proposal: schemas/proposal.v0.1.schema.json
  • round-trip evidence: schemas/roundtrip.v0.1.schema.json
  • perception observations: schemas/perception.v0.1.schema.json
  • perception plan/run: schemas/perception-plan.v0.1.schema.json, schemas/perception-run.v0.1.schema.json
  • visual diagnosis: schemas/diagnosis.v0.1.schema.json
  • safe patch / Figma reverse patch: schemas/patch.v0.1.schema.json
  • 3-way reconciliation: schemas/reconciliation.v0.1.schema.json

Docs

Current boundary

v0.7 intentionally refuses to auto-map arbitrary Figma-only structure, mixed text formatting ranges and unsupported image transforms into scene data. These are explicit conflicts. The next large layer is asset extraction + typography intelligence: high-quality object isolation, focal/crop semantics, installed-font candidate scoring, baseline/text-line diagnostics and source-asset quality gates.

About

Fidelity-first pipeline for reconstructing visual references as editable Figma layouts with measurable QA.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages