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 +60 -48
- package/dist/cli.js +200 -141
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +505 -65
- package/dist/index.js +273 -4342
- package/dist/index.js.map +1 -1
- package/dist/tools/report-tool/template/assets/{index-I6pJsBi9.js â index-BXtNLUQ4.js} +16 -16
- package/dist/tools/report-tool/template/index.html +1 -1
- package/package.json +29 -4
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://nodejs.org/) [](https://www.npmjs.com/package/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@pjlab.org.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
|
|
61
|
+
### Option 1: CLI (Recommended đđģ)
|
|
62
|
+
Best for one-click generation.
|
|
63
|
+
|
|
64
|
+
#### 1. Prerequisites
|
|
44
65
|
|
|
45
|
-
- Node.js >= 18.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
|
-
|
|
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
|
|
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
|
-
|
|
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:
|
|
76
|
-
model:
|
|
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
|
-
|
|
111
|
+
#### 4. Usage
|
|
89
112
|
|
|
90
113
|
```bash
|
|
91
|
-
# Convert Figma design to
|
|
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
|
-
|
|
98
|
-
|
|
99
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
###
|
|
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
|
-
|
|
141
|
-
|
|
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
|
-
|
|
144
|
-
|
|
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
|
-
|
|
147
|
-
|
|
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
|
-
|
|
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
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
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
|
|