coderio 0.1.0-alpha.9 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -6,6 +6,8 @@ AI-Powered Design-to-Code Tool with High-Fidelity UI Restoration
6
6
 
7
7
  [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE) [![Node Version](https://img.shields.io/badge/node-%3E%3D18.0.0%20%3C23.0.0-brightgreen)](https://nodejs.org/) [![npm version](https://img.shields.io/npm/v/coderio.svg)](https://www.npmjs.com/package/coderio) [![Contributors](https://img.shields.io/github/contributors/MigoXLab/coderio)](https://github.com/MigoXLab/coderio/graphs/contributors)
8
8
 
9
+ đŸ’Ŧ Contact: <a href="https://aicarrier.feishu.cn/docx/KTZCddG2VoarFExTqBEcS55QnRd" target="_blank">WeChat Group</a> | <a href="mailto:coderio&#64;pjlab&#46;org&#46;cn">Email</a>
10
+
9
11
  [English](README.md) | [įŽ€äŊ“中文](README_zh-CN.md)
10
12
 
11
13
  </div>
@@ -28,7 +30,9 @@ AI-Powered Design-to-Code Tool with High-Fidelity UI Restoration
28
30
 
29
31
  ## What is CodeRio?
30
32
 
31
- CodeRio is an intelligent **Figma-to-Code** automation tool that transforms designs into production-ready React code. Unlike traditional converters, CodeRio employs a multi-agent system that validates visual accuracy and iteratively refines misalignments, pursuing high-fidelity UI restoration.
33
+ CodeRio is an intelligent **Figma-to-Code** automation tool that transforms designs into production-ready React code. Unlike traditional converters, CodeRio employs a multi-agent system that validates visual accuracy and iteratively refines misalignments, pursuing high-fidelity UI restoration and **production-ready code structure tailored for developers**.
34
+
35
+ https://github.com/user-attachments/assets/a0bc1b1c-6aaa-4fbb-a2d8-18aeba70759b
32
36
 
33
37
  **Perfect for:**
34
38
 
@@ -38,15 +42,32 @@ CodeRio is an intelligent **Figma-to-Code** automation tool that transforms desi
38
42
 
39
43
  ## ✨ Examples
40
44
 
45
+ ### Case: CLI with --mode full
46
+
47
+ After installing CodeRio, you can execute commands directly in the CLI. CodeRio excels at restoring complex landing page styles, handling intricate layouts, identifying and downloading diverse image resources, and encapsulating component structures. By selecting "FULL" mode, a visual fidelity evaluation report is generated upon completion. This report displays deviations between the design and the webpage using both annotation and overlay modes, providing effective guidance for further development by engineers. This example demonstrates a landing page converted from Figma ([Design Link](https://www.figma.com/design/c0UBII8lURfxZIY8W6tSDR/Top-16-Websites-of-2024---Awwwards--Community-?node-id=1-1482&t=FB3Hohq2nsH7ZFts-4)).
48
+
49
+ https://github.com/user-attachments/assets/bd0c3f18-e98a-4050-bf22-46b198fadac2
50
+
51
+ <a href="https://static.openxlab.org.cn/coderio/report.html" target="_blank">📊 View Interactive Validation Report</a>
52
+
53
+ ### Case: Development with Cursor Skill
54
+
55
+ CodeRio can be seamlessly integrated into Cursor as a Skill. Simply input a prompt like **"Create a React project and restore this design with high fidelity,"** along with your output directory, Figma URL([Design Link](https://www.figma.com/design/c0UBII8lURfxZIY8W6tSDR/Top-16-Websites-of-2024---Awwwards--Community-?node-id=30-8264&t=FB3Hohq2nsH7ZFts-4)), and Token. The Agent will guide you step-by-step through the page generation process. For Landing Pages, it achieves **high-fidelity restoration**, accurately reproducing images and styles. It also automatically encapsulates reusable components (such as cards) and strictly adheres to **frontend development best practices**.
56
+
57
+ https://github.com/user-attachments/assets/a66dc680-f68d-4121-b416-aa6b778bd895
58
+
41
59
  ## 🚀 Quick Start
42
60
 
43
- ### 1. Prerequisites
61
+ ### Option 1: CLI (Recommended 👍đŸģ)
62
+ Best for one-click generation.
63
+
64
+ #### 1. Prerequisites
44
65
 
45
- - Node.js >= 18.0.0 (< 23.0.0)
66
+ - Node.js >= 18.0.0 (< 25.0.0)
46
67
  - [Figma Personal Access Token](https://www.figma.com/developers/api#access-tokens)
47
68
  - LLM API Key ([Anthropic](https://console.anthropic.com/) | [OpenAI](https://platform.openai.com/) | [Google](https://aistudio.google.com/))
48
69
 
49
- ### 2. Installation
70
+ #### 2. Installation
50
71
 
51
72
  ```bash
52
73
  # Install globally (recommended)
@@ -62,9 +83,11 @@ pnpm add -g coderio
62
83
  > pnpm approve-builds
63
84
  > ```
64
85
  >
65
- > This allows native dependencies (better-sqlite3, sharp) to compile properly.
86
+ > This allows native dependencies (better-sqlite3) to compile properly.
87
+ >
88
+ > **Note**: `playwright` and `sharp` are required only for validation features. They will be automatically installed when you first run a command that needs them (like `d2c --mode full`).
66
89
 
67
- ### 3. Configuration
90
+ #### 3. Configuration
68
91
 
69
92
  Create `~/.coderio/config.yaml`:
70
93
 
@@ -72,8 +95,8 @@ Create `~/.coderio/config.yaml`:
72
95
  mkdir -p ~/.coderio
73
96
  cat > ~/.coderio/config.yaml << 'EOF'
74
97
  model:
75
- provider: anthropic # anthropic | openai | google
76
- model: claude-3-5-sonnet-20241022
98
+ provider: openai # anthropic | openai | google
99
+ model: gemini-3-pro-preview
77
100
  baseUrl: https://api.anthropic.com
78
101
  apiKey: your-api-key-here
79
102
 
@@ -85,22 +108,17 @@ debug:
85
108
  EOF
86
109
  ```
87
110
 
88
- ### 4. Usage
111
+ #### 4. Usage
89
112
 
90
113
  ```bash
91
- # Convert Figma design to validated code
114
+ # Convert Figma design to code (default mode: code only)
92
115
  coderio d2c -s 'https://www.figma.com/design/your-file-id/...'
93
- ```
94
-
95
- CodeRio will:
96
116
 
97
- 1. ✅ Fetch Figma design and generate protocol
98
- 2. ✅ Create React + TypeScript + Tailwind CSS code
99
- 3. ✅ Launch dev server and capture screenshots
100
- 4. ✅ Validate visual accuracy and refine misalignments
101
- 5. ✅ Generate interactive validation report
117
+ # Full mode: Generate code + visual validation + auto-refinement
118
+ coderio d2c -s 'https://www.figma.com/design/your-file-id/...' -m full
119
+ ```
102
120
 
103
- ### 5. Run Your Project
121
+ #### 5. Run Your Project
104
122
 
105
123
  ```bash
106
124
  # Navigate to generated project
@@ -115,14 +133,14 @@ pnpm dev
115
133
  # 🎉 Open http://localhost:5173
116
134
  ```
117
135
 
118
- ### 6. View Validation Report
136
+ #### 6. View Validation Report
119
137
 
120
138
  ```bash
121
139
  # Open validation report in browser
122
- open coderio/<design-name_node-id>/validation/index.html
140
+ open coderio/<design-name_node-id>/process/validation/index.html
123
141
  ```
124
142
 
125
- ## 📖 All Commands
143
+ #### 📖 All Commands
126
144
 
127
145
  | Command | Alias | Description |
128
146
  | ----------------- | ----- | --------------------------------------------------- |
@@ -132,20 +150,24 @@ open coderio/<design-name_node-id>/validation/index.html
132
150
  | `validate` | `val` | Run validation on generated code |
133
151
  | `images` | - | Download and process Figma assets |
134
152
 
135
- ### Step-by-Step Workflow
136
-
137
- For more control, run each step individually:
153
+ ### Option 2: Skill (Portable Embedded Workflow)
154
+ Best for control and precision using AI Agents.
138
155
 
156
+ **Prerequisites**:
157
+ Copy the Skill file to your Cursor configuration directory:
139
158
  ```bash
140
- # Step 1: Extract design protocol
141
- coderio d2p -s 'https://www.figma.com/design/.../...'
159
+ mkdir -p ~/.cursor/skills/design-to-code
160
+ cp docs/skills/SKILL.md ~/.cursor/skills/design-to-code/SKILL.md
161
+ ```
142
162
 
143
- # Step 2: Generate code from protocol
144
- coderio p2c -p './coderio/<design-name_node-id>/process/protocol.json'
163
+ **Using in Cursor**:
164
+ 1. Open Cursor Chat (`Cmd` + `L`).
165
+ 2. Type: **"Use design-to-code skill to convert this design: [Your Figma URL]"**
166
+ 3. The Agent will guide you step-by-step through protocol extraction and code generation.
145
167
 
146
- # Step 3: Run validation (coming soon)
147
- # coderio val -p './coderio/<design-name_node-id>/my-app'
148
- ```
168
+ **Using in Claude Code**:
169
+ 1. Start Claude Code.
170
+ 2. Type: **"Read docs/skills/SKILL.md and perform design conversion: [Your Figma URL]"**
149
171
 
150
172
  ## 💎 Key Features
151
173
 
@@ -196,24 +218,14 @@ Built-in interruption recovery system:
196
218
  - **Resume from Anywhere**: Pick up exactly where you left off
197
219
  - **Crash Recovery**: Handles network failures, API timeouts, process interruptions
198
220
 
199
- ## đŸ› ī¸ How It Works
200
-
201
- CodeRio uses a sophisticated multi-agent pipeline:
221
+ ### 4. Production-Ready Code Structure
202
222
 
203
- ```
204
- Figma Design → Protocol → Code → Launch → Validate → Refine → Report
205
- ↓ ↓ ↓ ↓ ↓ ↓ ↓
206
- Fetch API Structure Initial Launch Judge Refiner Visualize
207
- Style Agent Agent Agent Agent
208
- Hierarchy
209
- ```
223
+ Beyond visual fidelity, the generated code is built for long-term maintenance:
210
224
 
211
- 1. **Protocol Generation**: Extracts structure, styles, and assets from Figma
212
- 2. **Code Generation**: Creates React components with Tailwind CSS
213
- 3. **Launch**: Installs dependencies and starts dev server
214
- 4. **Validation**: Captures screenshots and compares with design
215
- 5. **Refinement**: Automatically fixes misalignments
216
- 6. **Reporting**: Generates interactive visual report
225
+ - **Component-Based Architecture**: Automatically decomposes semantic components (Header, Footer, Hero, etc.), avoiding spaghetti code.
226
+ - **Scientific Styling**: Prefers Flexbox/Grid layouts over rigid absolute positioning, ensuring responsiveness across different screen sizes.
227
+ - **Modern Tech Stack**: Defaults to React + TypeScript + Tailwind CSS for type safety and scalability.
228
+ - **Clean File Structure**: Automatically organizes `components/`, `assets/`, `utils/` directories following industry best practices.
217
229
 
218
230
  ## đŸ—ēī¸ Roadmap
219
231