Skip to main content

Forge production-ready Angular components from Figma designs with AI-powered MCP integration

Project description

Figma Angular React Vue Python MCP PyPI

๐Ÿ”ฅ FigmaForge

Forge production-ready components from Figma designs

Multi-framework code generation (Angular, React, Vue, Web Components) via CLI & Copilot Chat

Features โ€ข Quick Start โ€ข Usage โ€ข Frameworks โ€ข Docs


โœจ Features

Core Features

Feature Description
๐ŸŽฏ Pixel-Perfect Exact positioning, colors, typography from your designs
๐Ÿค– AI-Driven Generate via VS Code Copilot Chat with natural language
โŒจ๏ธ CLI Support Command-line interface for scripting and CI/CD
๐ŸŽจ Design Tokens Extract colors, fonts, spacing as SCSS variables
๐Ÿ“ฆ Asset Export Automatic SVG/PNG extraction with inline optimization
๐Ÿ”„ Non-Destructive Regenerate without losing custom code

Multi-Framework Support

Framework Output Files Flag
Angular .ts, .html, .scss --framework angular
React .tsx, .module.css --framework react
Vue 3 .vue (SFC) --framework vue
Web Components .js (Custom Elements) --framework webcomponent

Advanced Features

Feature Description
โšก API Caching Local cache with ETag support for faster regeneration
๐ŸŒ Responsive Mode Flexbox layouts instead of absolute positioning
๐ŸŽจ Tailwind CSS Generate Tailwind utility classes instead of SCSS
๐Ÿ‘€ Watch Mode Auto-regenerate components when Figma file changes
๐Ÿ”€ Component Variants Detect Figma variants โ†’ typed @Input() properties
๐ŸŽญ Interaction States Map hover/focus/disabled variants to CSS pseudo-classes
๐Ÿ“ Figma Variables Extract design tokens from Figma Variables API

๐Ÿš€ Quick Start

Option 1: Install from PyPI (Recommended)

pip install figmaforge

Option 2: Clone Repository

git clone https://github.com/bipuldikshit/FigmaForge.git
cd FigmaForge
python -m venv .venv
.venv\Scripts\activate        # Windows
source .venv/bin/activate     # Mac/Linux
pip install -r requirements.txt

Configure Figma Token

# Set environment variable
export FIGMA_TOKEN=your-token-here  # Mac/Linux
$env:FIGMA_TOKEN="your-token-here"  # Windows

๐Ÿ’ก Get your Figma token at figma.com/settings


๐ŸŽฎ Usage

๐Ÿค– AI-Driven (VS Code Copilot Chat)

  1. Open project in VS Code
  2. Reload window (Ctrl+Shift+P โ†’ "Developer: Reload Window")
  3. Open Copilot Chat (Ctrl+Shift+I)
  4. Chat naturally:
๐Ÿ“ "List all components in file ABC123XYZ"

๐Ÿ”ฅ "Generate a React component called hero-section from node 1:23 in file ABC123XYZ"

๐ŸŽฏ "Generate button from node 2:45 in file ABC123XYZ with tailwind styling and responsive layout"

โŒจ๏ธ CLI Commands

# Generate Angular component (default)
python cli.py generate -f FILE_KEY -n "1:23" -m my-button

# Generate React component
python cli.py generate -f FILE_KEY -n "1:23" -m my-button --framework react

# Generate Vue component
python cli.py generate -f FILE_KEY -n "1:23" -m my-button --framework vue

# Generate Web Component
python cli.py generate -f FILE_KEY -n "1:23" -m my-button --framework webcomponent

# With Tailwind CSS
python cli.py generate -f FILE_KEY -n "1:23" -m my-button --style tailwind

# Responsive flexbox layout
python cli.py generate -f FILE_KEY -n "1:23" -m my-button --responsive

# Dry run (preview without writing)
python cli.py generate -f FILE_KEY -n "1:23" -m my-button --dry-run

# Bypass cache
python cli.py generate -f FILE_KEY -n "1:23" -m my-button --no-cache

# Cache management
python cli.py cache          # View cache stats
python cli.py cache --clear  # Clear all cached data

# Watch mode (auto-regenerate on changes)
python cli.py watch -f FILE_KEY -n "1:23" -m my-button --interval 30

# Sync file and extract design tokens
python cli.py sync -f FILE_KEY

# Initialize project directories
python cli.py init

๐Ÿ”ง Frameworks

Angular (Default)

python cli.py generate -f FILE -n NODE -m button

Generates: button.component.ts, button.component.html, button.component.scss

React

python cli.py generate -f FILE -n NODE -m button --framework react

Generates: Button.tsx, Button.module.css

Vue 3

python cli.py generate -f FILE -n NODE -m button --framework vue

Generates: Button.vue (Single File Component with Composition API)

Web Components

python cli.py generate -f FILE -n NODE -m button --framework webcomponent

Generates: Button.js (Custom Element with Shadow DOM)


๐Ÿ” Finding Figma IDs

ID Location Example
File Key URL: figma.com/design/ABC123XYZ/... ABC123XYZ
Node ID Right-click โ†’ "Copy link" โ†’ ?node-id=1-23 1:23

๐Ÿ“‚ Project Structure

FigmaForge/
โ”œโ”€โ”€ cli.py                    # CLI entry point
โ”œโ”€โ”€ mcp_stdio_server.py       # MCP server for Copilot Chat
โ”œโ”€โ”€ .vscode/mcp.json          # VS Code MCP configuration
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ figma/                # Figma API client & normalizer
โ”‚   โ”œโ”€โ”€ generators/           # Angular, React, Vue, WebComponent generators
โ”‚   โ”œโ”€โ”€ extractors/           # Tokens, variants, assets, interaction states
โ”‚   โ””โ”€โ”€ utils/                # CSS utilities, console output
โ”œโ”€โ”€ tests/                    # Unit tests (33+ tests)
โ””โ”€โ”€ docs/                     # Documentation

โš™๏ธ Configuration

Variable Description Default
FIGMA_TOKEN Your Figma personal access token Required
ANGULAR_OUTPUT_PATH Component output directory ./src/app/components
ASSETS_OUTPUT_PATH Asset output directory ./src/assets/figma

๐Ÿ› ๏ธ MCP Tools (Copilot Chat)

Tool Description
generate_component Generate component (any framework)
sync_figma Sync file & extract tokens
list_components List all components in file
preview Get raw design JSON
extract_tokens Export SCSS variables

MCP Parameters

Parameter Values Description
framework angular, react, vue, webcomponent Target framework
styleFormat scss, tailwind Style output format
responsive true/false Use flexbox layouts
dryRun true/false Preview without writing
noCache true/false Bypass API cache

๐Ÿงช Testing

# Run all tests
python -m pytest tests/ -v

# Run with coverage
python -m pytest tests/ --cov=src --cov-report=term-missing

๐Ÿ“š Documentation


๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


๐Ÿ”ฅ FigmaForge โ€” Forging code from designs

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

figmaforge-1.0.2.tar.gz (54.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

figmaforge-1.0.2-py3-none-any.whl (66.1 kB view details)

Uploaded Python 3

File details

Details for the file figmaforge-1.0.2.tar.gz.

File metadata

  • Download URL: figmaforge-1.0.2.tar.gz
  • Upload date:
  • Size: 54.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for figmaforge-1.0.2.tar.gz
Algorithm Hash digest
SHA256 c24a148d15f03e8fde7f5654ace7fbfc9fad9521cccc9363ae2d37e7bb393418
MD5 c0a7590fc75441d3e671d9200102ddf7
BLAKE2b-256 c464ef5194d86f28e80ad472a6af08f9975a9a34b4898e203e4bfe14df3b64f2

See more details on using hashes here.

File details

Details for the file figmaforge-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: figmaforge-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 66.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for figmaforge-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 dc38dd58aa106720e5d24119f22b5196b61df0bc48b4dc08cf712fd837a255c0
MD5 387052da0df88e8c0647d9e3e4d8e424
BLAKE2b-256 974dfb7d63ee7cf60eead7c78e9c14bed4c0be6208540a9a47be387eaeab566e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page