Skip to content

Commit 7af1c91

Browse files
rubenmarcusclaude
andauthored
feat: improve Figma visual fidelity — crop scale, sharp, fix command regen (#254)
* feat: add visual validation, notable component detection, and improved Figma context - Add visual comparison validation (pixelmatch + LLM vision) that runs on final iterations when Figma screenshots are present, with automatic 2-iteration extension to fix visual issues - Add --no-visual-check CLI flag to disable visual validation - Add dev-server module for launching/capturing implementation screenshots - Detect notable sub-components in Figma sections (scroll indicators, social sidebars, nav elements) with position hints and scroll behavior - Improve context-builder Figma instructions: z-index stacking clarity, STRETCH→cover guidance, scroll indicator patterns, completeness checklist, absolute positioning precision - Enhance plan-generator with inner shadow CSS output, deeper node traversal (depth 8), and text-descendant inclusion at deep levels - Add vision call tracking to CostTracker Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat: add ralph-starter figma interactive wizard command New `ralph-starter figma` command with 4-step interactive wizard: 1. Figma design URL (validated) 2. Task description 3. Tech stack (auto-detect from package.json + list + custom) 4. Model selection (smart per-agent: Opus recommended for Claude) Delegates to runCommand with pre-configured Figma options. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: remove duplicate showWelcome() call from figma command showWelcome() is already called by runCommand(), so calling it in figmaCommand() resulted in the welcome banner showing twice. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat: improve Figma visual fidelity — crop scale, sharp, fix command regen - Fix composite crop scale: compute actual scale from image metadata instead of hardcoding 2x (Figma API caps at 4096px) - Make sharp mandatory with auto-install (ensureSharp helper in src/utils/sharp.ts), replace hacky new Function imports - Scale-aware pixelDiff: resize impl screenshots to match Figma dimensions before pixel comparison - Fix background-size for cropped composites: use 100% auto instead of cover when clipCropTop > 0 - Fix decorative text z-index: opacity < 0.3 gets z-index 1 (behind content text) instead of z-index 10 - Fix content overlap calculation: use main content section Y position (not hero text) for negative margin guidance - Save .ralph/figma-source.json during run for later spec regeneration - Fix command regenerates both spec and IMPLEMENTATION_PLAN.md from cached Figma API data, skips "nothing to fix" when spec updated - Add parentBackgroundColor and compositeClipCropTops to spec options - Add HTML entity sanitization for Figma text content Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent b56b7be commit 7af1c91

File tree

17 files changed

+2942
-257
lines changed

17 files changed

+2942
-257
lines changed

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,19 +77,20 @@
7777
"inquirer": "^13.2.2",
7878
"ora": "^9.1.0",
7979
"pdf-parse": "^2.4.5",
80+
"pixelmatch": "^7.1.0",
81+
"pngjs": "^7.0.0",
82+
"sharp": "^0.33.0",
8083
"simple-git": "^3.27.0",
8184
"yaml": "^2.7.0",
8285
"zod": "^4.3.6"
8386
},
84-
"optionalDependencies": {
85-
"sharp": "^0.34.5"
86-
},
8787
"devDependencies": {
8888
"@biomejs/biome": "^2.3.13",
8989
"@commitlint/cli": "^20.3.1",
9090
"@commitlint/config-conventional": "^20.3.1",
9191
"@types/inquirer": "^9.0.7",
9292
"@types/node": "^25.1.0",
93+
"@types/pngjs": "^6.0.5",
9394
"@vitest/coverage-v8": "^4.0.18",
9495
"commitizen": "^4.3.1",
9596
"cz-conventional-changelog": "^3.3.0",

0 commit comments

Comments
 (0)