How ouardaoui/igma-to-next-sync works
Project Type and Purpose
• This is a command-line Python utility (a CLI tool) in the “Figma-to-Next Sync Suite.”
• Purpose: automate analysis of Figma-export diffs and provide an interactive, keyboard-driven review workflow, then apply approved changes to your codebase.
File Structure Analysis
Top-level files:
• review.py → “Review Engine” (CLI entrypoint for quick, detailed, apply, fix, show-decisions, side-by-side, smart-diff)
• sync.py → “Sync Analyzer / Apply Engine” (analyze old vs. new export, apply individual updates)
• clean_imports.py → Optional code-cleanup utility
• script.py → Helper or wrapper script (e.g., to drive workflows)
• workflow.sh → Shell orchestration of sync → review → apply
• requirements.txt → Python dependencies
• README_*.md → Process documentation / linting helpers
• review_decisions.json (generated) → JSON store for approved/rejected/partial decisions
• apply_approved.sh (generated) → Bash script to batch-apply updates
README Insights
• Defines command set (–quick, –review, –apply, –fix-decisions, –show-decisions, –smart-diff, –side-by-side)
• Shows how decisions flow from “analysis” (sync.py) → “review” → “apply”
• Describes JSON decision-store structure and auto-generated apply script
1. CLI Entry Point
• review.py
• sync.py
• clean_imports.py
2. Sync Analyzer Module
• Reads old/new project directories
• Produces diff files/structures in figma-sync/
3. Review Engine Module
• Quick Review
• Detailed Review
• Side-by-Side & Smart Diff
4. Decision Manager (Data Store)
• Reads/Writes review_decisions.json
5. Apply Engine Module
• sync.py --apply-update
• Generates apply_approved.sh
6. File System / Figma Export (External Input)
b. Relationships & Data Flow:
• User invokes CLI → dispatch to appropriate module (review or sync)
• Sync Analyzer reads file system → outputs diff files
• Review Engine loads diffs → interacts via console UI → updates Decision Manager
• User runs “apply” → Apply Engine reads JSON → applies updates via sync.py → backups → generates bash script
• Optionally, Clean Imports or script.py can be inserted pre/post apply
c. Architectural Patterns & Principles:
• Modular monolith: clearly separated modules under one codebase
• Command pattern: each CLI flag is a command object/handler
• Single source of truth for decisions (JSON)
• Separation of concerns: Analysis, Review UI, Decision Storage, Apply
d. Key Technologies & Libraries:
• Python 3.x
• argparse / click (or similar CLI parsing)
• JSON I/O (built-in json)
• ANSI coloring (colorama or curses)
• File system operations (os, pathlib, shutil)