Forge production-ready Angular components from Figma designs with AI-powered MCP integration
Project description
๐ฅ 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)
- Open project in VS Code
- Reload window (
Ctrl+Shift+Pโ "Developer: Reload Window") - Open Copilot Chat (
Ctrl+Shift+I) - 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
- Testing Guide - Complete testing instructions
- MCP Integration - Copilot Chat setup
- Architecture - System design overview
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ฅ FigmaForge โ Forging code from designs
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c24a148d15f03e8fde7f5654ace7fbfc9fad9521cccc9363ae2d37e7bb393418
|
|
| MD5 |
c0a7590fc75441d3e671d9200102ddf7
|
|
| BLAKE2b-256 |
c464ef5194d86f28e80ad472a6af08f9975a9a34b4898e203e4bfe14df3b64f2
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dc38dd58aa106720e5d24119f22b5196b61df0bc48b4dc08cf712fd837a255c0
|
|
| MD5 |
387052da0df88e8c0647d9e3e4d8e424
|
|
| BLAKE2b-256 |
974dfb7d63ee7cf60eead7c78e9c14bed4c0be6208540a9a47be387eaeab566e
|