@su-record/vibe 2.8.3 → 2.8.5
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/commands/vibe.figma.md +114 -39
- package/package.json +1 -1
package/commands/vibe.figma.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
description: Figma design to code — extract + generate in one step
|
|
3
|
-
argument-hint: "figma-url" ["figma-url-2"] [--
|
|
3
|
+
argument-hint: "figma-url" ["figma-url-2"] [--new] [--component Name]
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# /vibe.figma
|
|
@@ -12,7 +12,7 @@ Extract Figma design data and generate production-ready component code, tailored
|
|
|
12
12
|
```
|
|
13
13
|
/vibe.figma "url" # Single design → project integrated (default)
|
|
14
14
|
/vibe.figma "mobile-url" "desktop-url" # Responsive — auto-detect viewport from frame width
|
|
15
|
-
/vibe.figma "url" --
|
|
15
|
+
/vibe.figma "url" --new # New feature — self-contained tokens, no existing design system dependency
|
|
16
16
|
/vibe.figma "url" --component LoginForm # Name the root component
|
|
17
17
|
/vibe.figma --local # Skip extraction, use existing figma-output/
|
|
18
18
|
```
|
|
@@ -22,7 +22,7 @@ Extract Figma design data and generate production-ready component code, tailored
|
|
|
22
22
|
| Flag | Behavior |
|
|
23
23
|
|------|----------|
|
|
24
24
|
| _(default)_ | **Project integration.** Use project's design system, existing tokens, component patterns. Place files in project's component directory. |
|
|
25
|
-
| `--
|
|
25
|
+
| `--new` | **New feature.** Self-contained tokens + components in project structure. No dependency on existing design system. Portable across projects. |
|
|
26
26
|
| _(multi URL)_ | **Responsive mode.** Auto-detected when 2+ URLs provided. Compares designs across viewports and generates responsive code with fluid scaling. |
|
|
27
27
|
|
|
28
28
|
### Responsive Mode
|
|
@@ -76,7 +76,7 @@ https://www.figma.com/design/:fileKey/:fileName?node-id=:nodeId
|
|
|
76
76
|
**Single URL:**
|
|
77
77
|
|
|
78
78
|
```
|
|
79
|
-
1. get_design_context(fileKey, nodeId) → 코드 + 스크린샷 + 메타데이터
|
|
79
|
+
1. get_design_context(fileKey, nodeId) → 코드 + 스크린샷 + 메타데이터 + 에셋 URL
|
|
80
80
|
2. get_metadata(fileKey, nodeId) → 레이어 구조 (XML)
|
|
81
81
|
3. get_screenshot(fileKey, nodeId) → 프레임 이미지
|
|
82
82
|
```
|
|
@@ -88,17 +88,59 @@ https://www.figma.com/design/:fileKey/:fileName?node-id=:nodeId
|
|
|
88
88
|
프레임 width로 mobile/tablet/desktop 자동 감지.
|
|
89
89
|
```
|
|
90
90
|
|
|
91
|
-
### 0-
|
|
91
|
+
### 0-2. Image Asset Extraction (필수)
|
|
92
92
|
|
|
93
|
+
`get_design_context` 응답에 포함된 이미지 에셋 URL을 **반드시 다운로드**하여 프로젝트에 저장해야 함.
|
|
94
|
+
MCP가 반환하는 URL은 **7일 후 만료**되므로 임시 URL을 코드에 직접 넣으면 안 됨.
|
|
95
|
+
|
|
96
|
+
**에셋 URL 감지:**
|
|
97
|
+
|
|
98
|
+
`get_design_context` 응답의 코드에 다음 패턴이 포함됨:
|
|
99
|
+
```
|
|
100
|
+
const image = 'https://www.figma.com/api/mcp/asset/...'
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
**다운로드 및 저장:**
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
1. 응답에서 모든 이미지 URL 추출 (https://www.figma.com/api/mcp/asset/...)
|
|
107
|
+
2. WebFetch로 각 URL 다운로드
|
|
108
|
+
3. 프로젝트의 에셋 디렉토리에 저장:
|
|
109
|
+
- Nuxt: public/images/{feature}/ 또는 assets/images/{feature}/
|
|
110
|
+
- Next.js: public/images/{feature}/
|
|
111
|
+
- React: public/images/{feature}/ 또는 src/assets/{feature}/
|
|
112
|
+
4. 파일명은 레이어 이름 기반 (kebab-case):
|
|
113
|
+
- "Hero Background" → hero-background.webp
|
|
114
|
+
- "Product Photo 1" → product-photo-1.webp
|
|
115
|
+
5. 생성된 코드에서 임시 URL을 로컬 경로로 교체:
|
|
116
|
+
- 'https://www.figma.com/api/mcp/asset/...' → '/images/{feature}/hero-background.webp'
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
**SVG 처리:**
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
- 아이콘/로고 등 벡터 에셋은 SVG로 추출
|
|
123
|
+
- SVG는 인라인 컴포넌트로 변환하거나 파일로 저장
|
|
124
|
+
- 작은 아이콘 (< 1KB) → 인라인 SVG 컴포넌트
|
|
125
|
+
- 큰 SVG → 파일로 저장 후 <img> 또는 import
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
**에셋 미추출 시 경고:**
|
|
129
|
+
|
|
130
|
+
코드 생성 완료 후, MCP 임시 URL이 코드에 남아있으면 경고:
|
|
93
131
|
```
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
132
|
+
⚠️ 임시 Figma URL이 코드에 남아있습니다. 7일 후 만료됩니다:
|
|
133
|
+
- src/components/Hero.vue: line 12 (hero-bg)
|
|
134
|
+
→ WebFetch로 다운로드 후 로컬 경로로 교체하세요.
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### 0-3. Verify Extraction
|
|
138
|
+
|
|
139
|
+
```
|
|
140
|
+
1. 모든 MCP 호출 성공 확인
|
|
141
|
+
2. 이미지 에셋 다운로드 완료 확인
|
|
142
|
+
3. 임시 URL이 코드에 남아있지 않은지 확인
|
|
143
|
+
4. Responsive mode: 최소 2개 뷰포트 확인
|
|
102
144
|
```
|
|
103
145
|
|
|
104
146
|
---
|
|
@@ -305,11 +347,14 @@ Stored in `~/.vibe/config.json` → `figma.breakpoints`. Partial overrides merge
|
|
|
305
347
|
|
|
306
348
|
### 3-4. Resolve Generation Mode
|
|
307
349
|
|
|
350
|
+
**Both modes use the project's existing directory structure.** Never create `figma-output/generated/`.
|
|
351
|
+
|
|
308
352
|
```
|
|
309
|
-
if --
|
|
310
|
-
→
|
|
311
|
-
→ generate self-contained
|
|
312
|
-
→ no
|
|
353
|
+
if --new flag:
|
|
354
|
+
→ detect project's page/component/style directories (same as default)
|
|
355
|
+
→ generate self-contained token file (no MASTER.md dependency)
|
|
356
|
+
→ components are self-contained (own tokens, no external design system imports)
|
|
357
|
+
→ placed in project's standard directories with feature-named subfolder
|
|
313
358
|
|
|
314
359
|
default (no flag):
|
|
315
360
|
→ scan existing component directories, theme files, token definitions
|
|
@@ -329,35 +374,65 @@ default (no flag):
|
|
|
329
374
|
2. **design-context.json tokens** — if `detectedStack.fonts`, `aesthetic.colorMood` exist, align with these
|
|
330
375
|
3. **New figma-tokens** — only for values that have no existing match
|
|
331
376
|
|
|
332
|
-
|
|
377
|
+
**--new mode**: Generate self-contained token file (no MASTER.md dependency), in project's standard directories.
|
|
378
|
+
|
|
379
|
+
#### Output Structure (both modes — project structure 준수)
|
|
380
|
+
|
|
381
|
+
프로젝트의 기존 디렉토리 구조를 감지하여 올바른 위치에 파일 생성.
|
|
333
382
|
|
|
334
|
-
|
|
383
|
+
**Step 1: 디렉토리 감지**
|
|
335
384
|
|
|
336
385
|
```
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
386
|
+
페이지 디렉토리:
|
|
387
|
+
Next.js → pages/ or app/
|
|
388
|
+
Nuxt → pages/
|
|
389
|
+
React → src/pages/ or src/views/
|
|
390
|
+
Vue → src/views/
|
|
391
|
+
|
|
392
|
+
컴포넌트 디렉토리:
|
|
393
|
+
Next.js → components/ or src/components/
|
|
394
|
+
Nuxt → components/
|
|
395
|
+
React → src/components/
|
|
396
|
+
Vue → src/components/
|
|
397
|
+
|
|
398
|
+
스타일 디렉토리:
|
|
399
|
+
SCSS → assets/scss/ or src/scss/ or src/styles/
|
|
400
|
+
CSS → src/styles/ or styles/
|
|
401
|
+
Tailwind → tailwind.config.* (extend)
|
|
348
402
|
```
|
|
349
403
|
|
|
350
|
-
|
|
404
|
+
**Step 2: 피처명 기반 폴더 생성**
|
|
405
|
+
|
|
406
|
+
`--component` 플래그 또는 Figma 파일명에서 피처명 추출 → kebab-case 변환.
|
|
351
407
|
|
|
352
408
|
```
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
409
|
+
예: Figma 파일명 "PUBG 9주년 이벤트" → pubg-anniversary
|
|
410
|
+
|
|
411
|
+
Nuxt 프로젝트:
|
|
412
|
+
pages/pubg-anniversary.vue ← 루트 페이지
|
|
413
|
+
components/pubg-anniversary/
|
|
414
|
+
HeroSection.vue ← 섹션 컴포넌트
|
|
415
|
+
EventSection.vue
|
|
416
|
+
RewardSection.vue
|
|
417
|
+
...
|
|
418
|
+
assets/scss/_pubg-anniversary-tokens.scss ← 피처별 토큰
|
|
419
|
+
|
|
420
|
+
React + Next.js 프로젝트:
|
|
421
|
+
app/pubg-anniversary/page.tsx ← 루트 페이지
|
|
422
|
+
components/pubg-anniversary/
|
|
423
|
+
HeroSection.tsx
|
|
424
|
+
HeroSection.module.css (or .module.scss)
|
|
425
|
+
EventSection.tsx
|
|
426
|
+
...
|
|
427
|
+
styles/pubg-anniversary-tokens.css ← 피처별 토큰
|
|
428
|
+
|
|
429
|
+
Default mode 차이점:
|
|
430
|
+
→ 토큰 파일에서 기존 MASTER.md / 프로젝트 토큰 참조
|
|
431
|
+
→ 새 토큰만 추가
|
|
358
432
|
|
|
359
|
-
|
|
360
|
-
|
|
433
|
+
--new mode 차이점:
|
|
434
|
+
→ 토큰 파일이 자체 완결 (외부 의존 없음)
|
|
435
|
+
→ 다른 프로젝트에 폴더째 복사 가능
|
|
361
436
|
```
|
|
362
437
|
|
|
363
438
|
### 4-2. Token File Format
|
|
@@ -1406,7 +1481,7 @@ After generating code, output a brief correction report:
|
|
|
1406
1481
|
## Correction Notes
|
|
1407
1482
|
|
|
1408
1483
|
### Generation Mode
|
|
1409
|
-
- Mode: default / --
|
|
1484
|
+
- Mode: default / --new / responsive
|
|
1410
1485
|
- Output directory: {path}
|
|
1411
1486
|
- Viewports: {list of viewport labels + widths, if responsive}
|
|
1412
1487
|
|