@su-record/vibe 2.8.36 → 2.8.38
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 +20 -8
- package/hooks/scripts/llm-orchestrate.js +4 -6
- package/package.json +2 -2
- package/skills/vibe.figma/SKILL.md +452 -56
- package/skills/vibe.figma/templates/figma-handoff.md +4 -4
- package/skills/vibe.figma.convert/SKILL.md +318 -134
- package/skills/vibe.figma.convert/rubrics/conversion-rules.md +71 -80
- package/skills/vibe.figma.convert/templates/component.md +90 -98
- package/skills/vibe.figma.extract/SKILL.md +136 -79
- package/skills/vibe.figma.extract/rubrics/image-rules.md +1 -1
|
@@ -1,83 +1,74 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
##
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
| Tailwind | Correct CSS | Common Mistake |
|
|
38
|
-
|----------|------------|----------------|
|
|
39
|
-
| `size-full` | `width: 100%; height: 100%` | Only setting `width: 100%` |
|
|
40
|
-
| `inset-0` | `inset: 0` (shorthand) | Expanding to 4 properties |
|
|
41
|
-
| `inset-[-18.13%]` | `inset: -18.13%` | Scaling the % value |
|
|
42
|
-
| `overflow-clip` | `overflow: clip` | Using `overflow: hidden` |
|
|
43
|
-
| `leading-[1.4]` | `line-height: 1.4` | Applying scaleFactor |
|
|
44
|
-
| `max-w-none` | `max-width: none` | Omitting entirely |
|
|
45
|
-
| `object-cover` on `<img>` | `object-fit: cover` + parent `overflow: hidden` | Forgetting parent clip |
|
|
46
|
-
| `pointer-events-none` | `pointer-events: none` | Omitting for decorative layers |
|
|
47
|
-
| `text-white` | `color: #FFFFFF` | Using `color: white` |
|
|
48
|
-
| `font-black` | `font-weight: 900` | Using `font-weight: bold` |
|
|
49
|
-
|
|
50
|
-
## Scale Application
|
|
51
|
-
|
|
52
|
-
Apply `× scaleFactor` to:
|
|
53
|
-
- `px` sizes: font-size, padding, margin, gap, border-radius, width, height, top, left, bottom, right
|
|
54
|
-
- `px` in box-shadow, blur filter, letter-spacing
|
|
55
|
-
|
|
56
|
-
Do NOT scale:
|
|
57
|
-
- Color values
|
|
58
|
-
- Opacity values
|
|
59
|
-
- `%` values
|
|
60
|
-
- Unitless line-height
|
|
61
|
-
- z-index
|
|
62
|
-
- `mix-blend-mode` values
|
|
63
|
-
- `rotate` degree values
|
|
64
|
-
|
|
65
|
-
## Sprite / Overflow Image Pattern
|
|
66
|
-
|
|
67
|
-
When `left` is a large negative %, it is a sprite crop — do NOT scale:
|
|
68
|
-
```css
|
|
69
|
-
/* Correct */
|
|
70
|
-
left: -129.09%;
|
|
71
|
-
width: 229.09%;
|
|
72
|
-
|
|
73
|
-
/* Wrong — do not scale % values */
|
|
74
|
-
left: -86.09%; /* -129.09 × 0.667 — incorrect */
|
|
1
|
+
# Tree → Code Conversion Rules
|
|
2
|
+
|
|
3
|
+
## Core Principle
|
|
4
|
+
|
|
5
|
+
모든 CSS 값은 tree.json에서 직접 매핑한다. 추정하지 않는다.
|
|
6
|
+
|
|
7
|
+
## Node → HTML Mapping (Do This First)
|
|
8
|
+
|
|
9
|
+
각 노드를 순서대로 분류:
|
|
10
|
+
|
|
11
|
+
| 노드 조건 | HTML 매핑 |
|
|
12
|
+
|-----------|----------|
|
|
13
|
+
| FRAME + Auto Layout | `<div>` + flex (direction/gap/padding 직접) |
|
|
14
|
+
| FRAME + no Auto Layout | `<div>` + position:relative (자식 absolute) |
|
|
15
|
+
| TEXT | `<span>` → Claude가 `<h2>/<p>/<button>` 승격 |
|
|
16
|
+
| RECTANGLE/VECTOR + imageRef | `<img src="다운로드된 파일">` |
|
|
17
|
+
| VECTOR/GROUP ≤ 64px | 아이콘 → `<img>` (렌더링 이미지) |
|
|
18
|
+
| INSTANCE 반복 3+ | v-for (Vue) 또는 .map() (React) |
|
|
19
|
+
| 크기 0px | 스킵 |
|
|
20
|
+
| VECTOR 장식선 (w/h ≤ 2px) | 스킵 |
|
|
21
|
+
|
|
22
|
+
## 배경 레이어 판별
|
|
23
|
+
|
|
24
|
+
부모와 동일 크기(±5%) + imageRef + 형제 중 첫 위치:
|
|
25
|
+
→ `position: absolute; inset: 0; z-index: 0; object-fit: cover`
|
|
26
|
+
→ 부모에 `position: relative; overflow: hidden` 추가
|
|
27
|
+
|
|
28
|
+
## CSS 직접 매핑 규칙
|
|
29
|
+
|
|
30
|
+
tree.json의 css 객체를 SCSS에 1:1 매핑한다:
|
|
31
|
+
|
|
32
|
+
### layout/ 파일에 넣는 속성
|
|
33
|
+
```
|
|
34
|
+
display, flex-direction, justify-content, align-items,
|
|
35
|
+
gap, padding, width, height, position, overflow, z-index, inset
|
|
75
36
|
```
|
|
76
37
|
|
|
77
|
-
|
|
38
|
+
### components/ 파일에 넣는 속성
|
|
39
|
+
```
|
|
40
|
+
background-color, color, font-family, font-size, font-weight,
|
|
41
|
+
line-height, letter-spacing, text-align, border, border-radius,
|
|
42
|
+
box-shadow, opacity, mix-blend-mode, filter, backdrop-filter
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Scale Factor 적용
|
|
46
|
+
|
|
47
|
+
**적용 (px 값):**
|
|
48
|
+
font-size, padding, margin, gap, width, height, border-radius,
|
|
49
|
+
border-width, box-shadow px, filter px, letter-spacing
|
|
50
|
+
|
|
51
|
+
**미적용:**
|
|
52
|
+
color, opacity, font-weight, font-family, z-index,
|
|
53
|
+
line-height(단위 없을 때), text-align, mix-blend-mode,
|
|
54
|
+
rotate, % 값
|
|
55
|
+
|
|
56
|
+
## 장식 레이어 최적화
|
|
57
|
+
|
|
58
|
+
BG 그룹 내 장식 요소가 10개 이상:
|
|
59
|
+
→ 배경 이미지 1장 + 핵심 장식 2~3개만 유지
|
|
60
|
+
→ 나머지 생략 (Phase 4 스크린샷 검증에서 확인)
|
|
61
|
+
|
|
62
|
+
## Class Naming
|
|
63
|
+
|
|
64
|
+
BEM 패턴: `.sectionName__childName`
|
|
65
|
+
- 부모: `.heroSection`
|
|
66
|
+
- 자식: `.heroSection__bg`, `.heroSection__title`, `.heroSection__shareBtn`
|
|
67
|
+
- template에서 사용한 모든 클래스가 SCSS에 정의되어야 함
|
|
68
|
+
|
|
69
|
+
## 자가 검증 (코드 작성 후)
|
|
78
70
|
|
|
79
|
-
|
|
80
|
-
-
|
|
81
|
-
-
|
|
82
|
-
-
|
|
83
|
-
- Conflicts: append parent name prefix (`.heroLight`, `.kidLight`)
|
|
71
|
+
- [ ] template 클래스 ↔ SCSS 클래스 1:1 일치
|
|
72
|
+
- [ ] 모든 img src가 static/에 실제 존재
|
|
73
|
+
- [ ] Auto Layout 노드 → SCSS에 flex 속성 존재
|
|
74
|
+
- [ ] tree.json에 없는 CSS 값이 SCSS에 없음
|
|
@@ -1,152 +1,144 @@
|
|
|
1
|
-
# Component Output Template
|
|
1
|
+
# Component Output Template — Tree-Based Generation
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
tree.json 노드를 기반으로 컴포넌트를 생성할 때 이 템플릿을 따른다.
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## Vue / Nuxt (External SCSS)
|
|
8
8
|
|
|
9
9
|
```vue
|
|
10
|
-
<!--
|
|
10
|
+
<!--
|
|
11
|
+
tree.json 구조:
|
|
12
|
+
{{SECTION_NAME}} ({{TYPE}} {{WIDTH}}x{{HEIGHT}})
|
|
13
|
+
├── BG (FRAME — 배경 레이어)
|
|
14
|
+
│ └── imageRef → {{BG_IMAGE}}
|
|
15
|
+
├── {{CHILD_1}} (FRAME — flex-column, gap:{{GAP}}px)
|
|
16
|
+
│ ├── TEXT "{{TEXT_1}}"
|
|
17
|
+
│ └── TEXT "{{TEXT_2}}"
|
|
18
|
+
└── {{CHILD_2}} (FRAME — flex-row, gap:{{GAP_2}}px)
|
|
19
|
+
└── INSTANCE × {{REPEAT_COUNT}} (반복 패턴)
|
|
20
|
+
-->
|
|
11
21
|
<template>
|
|
12
22
|
<section class="{{sectionName}}">
|
|
13
|
-
<!-- BG
|
|
14
|
-
<div class="{{sectionName}}
|
|
15
|
-
<img src="/images/{{FEATURE_KEY}}/{{bg-file}}.
|
|
23
|
+
<!-- BG: 부모와 동일 크기 + imageRef → 배경 레이어 -->
|
|
24
|
+
<div class="{{sectionName}}__bg">
|
|
25
|
+
<img src="/images/{{FEATURE_KEY}}/{{bg-file}}.png" alt="" aria-hidden="true" />
|
|
16
26
|
</div>
|
|
17
27
|
|
|
18
|
-
<!--
|
|
19
|
-
<div class="{{sectionName}}
|
|
20
|
-
<!--
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
</div>
|
|
24
|
-
|
|
25
|
-
<!-- Repeating items (from storyboard mock data) -->
|
|
26
|
-
<ul class="{{sectionName}}List">
|
|
27
|
-
<li
|
|
28
|
-
v-for="item in items"
|
|
29
|
-
:key="item.id"
|
|
30
|
-
class="{{sectionName}}Item"
|
|
31
|
-
>
|
|
32
|
-
<img :src="item.image" :alt="item.label" />
|
|
33
|
-
<p class="{{sectionName}}ItemLabel">{{ item.label }}</p>
|
|
34
|
-
</li>
|
|
35
|
-
</ul>
|
|
36
|
-
|
|
37
|
-
<!-- CTA Button -->
|
|
38
|
-
<button class="{{sectionName}}Btn" @click="handleAction">
|
|
39
|
-
{{BUTTON_LABEL}}
|
|
40
|
-
</button>
|
|
28
|
+
<!-- {{CHILD_1}}: tree flex-column, gap:{{GAP}}px → 직접 매핑 -->
|
|
29
|
+
<div class="{{sectionName}}__{{child1Name}}">
|
|
30
|
+
<!-- TEXT 노드 → Claude가 시맨틱 태그 판단 -->
|
|
31
|
+
<h2 class="{{sectionName}}__title">{{TEXT_1}}</h2>
|
|
32
|
+
<p class="{{sectionName}}__desc">{{TEXT_2}}</p>
|
|
41
33
|
</div>
|
|
34
|
+
|
|
35
|
+
<!-- {{CHILD_2}}: INSTANCE 반복 → v-for -->
|
|
36
|
+
<ul class="{{sectionName}}__list">
|
|
37
|
+
<li
|
|
38
|
+
v-for="item in items"
|
|
39
|
+
:key="item.id"
|
|
40
|
+
class="{{sectionName}}__item"
|
|
41
|
+
>
|
|
42
|
+
<img :src="item.image" :alt="item.name" class="{{sectionName}}__itemImg" />
|
|
43
|
+
<span class="{{sectionName}}__itemLabel">{{ item.name }}</span>
|
|
44
|
+
</li>
|
|
45
|
+
</ul>
|
|
42
46
|
</section>
|
|
43
47
|
</template>
|
|
44
48
|
|
|
45
49
|
<script setup lang="ts">
|
|
46
50
|
/**
|
|
47
51
|
* {{SECTION_DISPLAY_NAME}}
|
|
52
|
+
* tree.json: {{SECTION_NAME}} ({{TYPE}} {{WIDTH}}x{{HEIGHT}})
|
|
48
53
|
*
|
|
49
54
|
* [기능 정의]
|
|
50
55
|
* - {{FEATURE_REQUIREMENT_1}}
|
|
51
|
-
* - {{FEATURE_REQUIREMENT_2}}
|
|
52
56
|
*
|
|
53
57
|
* [인터랙션]
|
|
54
58
|
* ① {{INTERACTION_1}}
|
|
55
|
-
* ② {{INTERACTION_2}}
|
|
56
59
|
*
|
|
57
60
|
* [상태] {{STATE_LIST}}
|
|
58
61
|
*/
|
|
59
62
|
|
|
60
63
|
interface {{ItemType}} {
|
|
61
|
-
id:
|
|
62
|
-
|
|
64
|
+
id: string
|
|
65
|
+
name: string
|
|
63
66
|
image: string
|
|
64
67
|
}
|
|
65
68
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
{ id: 2, label: '{{MOCK_LABEL_2}}', image: '/images/{{FEATURE_KEY}}/{{mock-img-2}}.webp' },
|
|
69
|
-
{ id: 3, label: '{{MOCK_LABEL_3}}', image: '/images/{{FEATURE_KEY}}/{{mock-img-3}}.webp' },
|
|
70
|
-
]
|
|
71
|
-
|
|
72
|
-
const emit = defineEmits<{
|
|
73
|
-
action: []
|
|
69
|
+
defineProps<{
|
|
70
|
+
items: {{ItemType}}[]
|
|
74
71
|
}>()
|
|
75
|
-
|
|
76
|
-
function handleAction(): void {
|
|
77
|
-
// TODO: {{ACTION_DESCRIPTION}}
|
|
78
|
-
emit('action')
|
|
79
|
-
}
|
|
80
72
|
</script>
|
|
81
73
|
<!-- styles: styles/{{FEATURE_KEY}}/layout/_{{section}}.scss + components/_{{section}}.scss -->
|
|
82
74
|
```
|
|
83
75
|
|
|
84
76
|
---
|
|
85
77
|
|
|
86
|
-
##
|
|
87
|
-
|
|
88
|
-
```vue
|
|
89
|
-
<!-- components/{{FEATURE_KEY}}/{{ComponentName}}.vue -->
|
|
90
|
-
<template>
|
|
91
|
-
<section class="{{sectionName}}">
|
|
92
|
-
<!-- 1:1 structure from reference code — preserve all nesting -->
|
|
93
|
-
<div class="bg">
|
|
94
|
-
<img src="/images/{{FEATURE_KEY}}/{{bg-file}}.webp" alt="" aria-hidden="true" />
|
|
95
|
-
</div>
|
|
96
|
-
<div class="titleArea">
|
|
97
|
-
<img src="/images/{{FEATURE_KEY}}/{{title-file}}.webp" alt="{{TITLE_ALT_TEXT}}" />
|
|
98
|
-
</div>
|
|
99
|
-
<!-- Re-insert Phase 1 functional elements at appropriate positions -->
|
|
100
|
-
<button class="ctaBtn" @click="handleAction">{{BUTTON_LABEL}}</button>
|
|
101
|
-
</section>
|
|
102
|
-
</template>
|
|
78
|
+
## SCSS Layout (tree.json 직접 매핑)
|
|
103
79
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
* [상태] {{STATE_LIST}}
|
|
110
|
-
*/
|
|
80
|
+
```scss
|
|
81
|
+
// tree.json 데이터:
|
|
82
|
+
// {{SECTION_NAME}}: { width:{{WIDTH}}, height:{{HEIGHT}}, overflow:hidden }
|
|
83
|
+
// {{CHILD_1}}: { display:flex, flexDirection:column, gap:{{GAP}}px, padding:"{{PADDING}}" }
|
|
84
|
+
// scaleFactor = {{SCALE_FACTOR}}
|
|
111
85
|
|
|
112
|
-
function handleAction(): void {
|
|
113
|
-
// TODO: {{ACTION_DESCRIPTION}}
|
|
114
|
-
}
|
|
115
|
-
</script>
|
|
116
|
-
|
|
117
|
-
<style scoped>
|
|
118
86
|
.{{sectionName}} {
|
|
119
87
|
position: relative;
|
|
120
88
|
width: 100%;
|
|
121
|
-
height: {{
|
|
122
|
-
overflow: hidden;
|
|
89
|
+
height: {{HEIGHT_SCALED}}px; // tree: {{HEIGHT}} × {{SCALE_FACTOR}}
|
|
90
|
+
overflow: hidden; // tree: overflow:hidden
|
|
123
91
|
}
|
|
124
92
|
|
|
125
|
-
.
|
|
93
|
+
.{{sectionName}}__bg {
|
|
126
94
|
position: absolute;
|
|
127
95
|
inset: 0;
|
|
96
|
+
z-index: 0;
|
|
97
|
+
img { width: 100%; height: 100%; object-fit: cover; }
|
|
128
98
|
}
|
|
129
99
|
|
|
130
|
-
.
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
100
|
+
.{{sectionName}}__{{child1Name}} {
|
|
101
|
+
display: flex; // tree: display:flex
|
|
102
|
+
flex-direction: column; // tree: flexDirection:column
|
|
103
|
+
gap: {{GAP_SCALED}}px; // tree: {{GAP}} × {{SCALE_FACTOR}}
|
|
104
|
+
padding: {{PADDING_SCALED}}; // tree: "{{PADDING}}" × {{SCALE_FACTOR}}
|
|
134
105
|
}
|
|
106
|
+
```
|
|
135
107
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## SCSS Components (tree.json 직접 매핑)
|
|
111
|
+
|
|
112
|
+
```scss
|
|
113
|
+
// tree.json 데이터:
|
|
114
|
+
// TEXT "{{TEXT_1}}": { fontSize:{{FONT_SIZE}}px, fontWeight:{{FONT_WEIGHT}}, color:{{COLOR}} }
|
|
144
115
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
}
|
|
116
|
+
.{{sectionName}}__title {
|
|
117
|
+
font-size: {{FONT_SIZE_SCALED}}px; // tree: {{FONT_SIZE}} × {{SCALE_FACTOR}}
|
|
118
|
+
font-weight: {{FONT_WEIGHT}}; // tree: 직접 (scaleFactor 미적용)
|
|
119
|
+
color: {{COLOR}}; // tree: 직접 (scaleFactor 미적용)
|
|
150
120
|
}
|
|
151
|
-
</style>
|
|
152
121
|
```
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## React / Next.js 변환
|
|
126
|
+
|
|
127
|
+
| Vue | React |
|
|
128
|
+
|-----|-------|
|
|
129
|
+
| `class="..."` | `className={styles.xxx}` (CSS Module) |
|
|
130
|
+
| `v-for="i in items" :key="i.id"` | `{items.map(i => <X key={i.id} />)}` |
|
|
131
|
+
| `v-if="condition"` | `{condition && <X />}` |
|
|
132
|
+
| `@click="handler"` | `onClick={handler}` |
|
|
133
|
+
| `<img src="/images/..."` | `<Image src="/images/..."` |
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## 검증 체크리스트
|
|
138
|
+
|
|
139
|
+
- [ ] tree.json에 없는 CSS 값이 SCSS에 없음
|
|
140
|
+
- [ ] template 클래스 ↔ SCSS 클래스 1:1 일치
|
|
141
|
+
- [ ] 모든 img src가 static/에 실제 존재
|
|
142
|
+
- [ ] TEXT 노드의 characters가 template에 그대로 삽입됨
|
|
143
|
+
- [ ] Auto Layout 노드 → SCSS에 flex 속성 존재
|
|
144
|
+
- [ ] 빌드 성공
|
|
@@ -1,49 +1,28 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: vibe.figma.extract
|
|
3
|
-
description: Figma REST API로
|
|
3
|
+
description: Figma REST API로 코드 생성 데이터 확보 — 트리(primary), 이미지, 스크린샷(검증용)
|
|
4
4
|
triggers: []
|
|
5
5
|
tier: standard
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
# vibe.figma.extract —
|
|
8
|
+
# vibe.figma.extract — 코드 생성 데이터 확보
|
|
9
9
|
|
|
10
|
-
Figma REST API(`src/infra/lib/figma/`)를 사용하여
|
|
11
|
-
추출한 데이터는 코드 변환용이 아닌 **재료함(material inventory)**으로 사용된다.
|
|
12
|
-
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
## 1. 스크린샷 — 정답 사진
|
|
10
|
+
Figma REST API(`src/infra/lib/figma/`)를 사용하여 **구조적 코드 생성에 필요한 모든 데이터**를 추출.
|
|
16
11
|
|
|
17
12
|
```
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
섹션별 스크린샷 (1depth 자식 프레임 각각):
|
|
24
|
-
node "[FIGMA_SCRIPT]" screenshot {fileKey} {child.nodeId} --out=/tmp/{feature}/sections/{name}.png
|
|
13
|
+
추출 우선순위:
|
|
14
|
+
1순위: 노드 트리 + CSS (코드 생성의 PRIMARY 소스)
|
|
15
|
+
2순위: 이미지 에셋 (fill 이미지 + 아이템 노드 렌더링)
|
|
16
|
+
3순위: 스크린샷 (Phase 4 시각 검증용 — 코드 생성에 사용하지 않음)
|
|
25
17
|
```
|
|
26
18
|
|
|
27
19
|
---
|
|
28
20
|
|
|
29
|
-
##
|
|
21
|
+
## 1. 노드 트리 + CSS — 코드 생성의 원천
|
|
30
22
|
|
|
31
23
|
```
|
|
32
|
-
|
|
24
|
+
가장 먼저 확보. 이것이 HTML + SCSS 코드의 직접적 소스.
|
|
33
25
|
|
|
34
|
-
Bash:
|
|
35
|
-
node "[FIGMA_SCRIPT]" images {fileKey} {nodeId} --out=/tmp/{feature}/images/ --depth=10
|
|
36
|
-
|
|
37
|
-
반환: { total: N, images: { "imageRef": "/path/to/file.png", ... } }
|
|
38
|
-
|
|
39
|
-
검증: total = refs.size (누락 0), 0byte 파일 없음
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
---
|
|
43
|
-
|
|
44
|
-
## 3. 노드 트리 + CSS — 수치 재료
|
|
45
|
-
|
|
46
|
-
```
|
|
47
26
|
Bash:
|
|
48
27
|
node "[FIGMA_SCRIPT]" tree {fileKey} {nodeId} --depth=10
|
|
49
28
|
|
|
@@ -59,22 +38,35 @@ Bash:
|
|
|
59
38
|
children: [...]
|
|
60
39
|
}
|
|
61
40
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
-
|
|
66
|
-
-
|
|
67
|
-
-
|
|
41
|
+
→ /tmp/{feature}/tree.json 에 저장
|
|
42
|
+
|
|
43
|
+
트리 데이터의 용도 (vibe.figma.convert에서 직접 매핑):
|
|
44
|
+
- Auto Layout → CSS Flexbox (direction, gap, padding, align 1:1)
|
|
45
|
+
- absoluteBoundingBox → width, height (× scaleFactor)
|
|
46
|
+
- fills/strokes/effects → background, border, shadow 등
|
|
47
|
+
- TEXT 노드 → 텍스트 콘텐츠 + 타이포그래피 CSS
|
|
48
|
+
- imageRef → 이미지 에셋 매핑
|
|
49
|
+
- name/type → 시맨틱 태그 판단 힌트 (Claude 사용)
|
|
68
50
|
```
|
|
69
51
|
|
|
70
|
-
### Figma 속성 → CSS
|
|
52
|
+
### Figma 속성 → CSS 직접 매핑표
|
|
71
53
|
|
|
72
|
-
도구가
|
|
54
|
+
트리 추출 도구가 자동 변환하는 속성. **이 값들이 SCSS에 직접 매핑된다:**
|
|
73
55
|
|
|
74
|
-
| Figma 속성 | CSS |
|
|
75
|
-
|
|
56
|
+
| Figma 속성 | CSS | scaleFactor 적용 |
|
|
57
|
+
|-----------|-----|-----------------|
|
|
58
|
+
| `layoutMode=VERTICAL` | `display:flex; flex-direction:column` | ❌ |
|
|
59
|
+
| `layoutMode=HORIZONTAL` | `display:flex; flex-direction:row` | ❌ |
|
|
60
|
+
| `primaryAxisAlignItems` | `justify-content` | ❌ |
|
|
61
|
+
| `counterAxisAlignItems` | `align-items` | ❌ |
|
|
62
|
+
| `itemSpacing` | `gap` | ✅ |
|
|
63
|
+
| `padding*` | `padding` | ✅ |
|
|
64
|
+
| `absoluteBoundingBox.width/height` | `width/height` | ✅ |
|
|
65
|
+
| `layoutPositioning=ABSOLUTE` | `position: absolute` | ❌ |
|
|
66
|
+
| `clipsContent` | `overflow: hidden` | ❌ |
|
|
76
67
|
| `fills[].color` | `background-color` | ❌ |
|
|
77
68
|
| `fills[].type=IMAGE` | `imageRef` (다운로드 대상) | — |
|
|
69
|
+
| `fills[].color` (TEXT) | `color` | ❌ |
|
|
78
70
|
| `strokes[].color` + `strokeWeight` | `border` | ✅ (width만) |
|
|
79
71
|
| `effects[].DROP_SHADOW` | `box-shadow` | ✅ (px만) |
|
|
80
72
|
| `effects[].LAYER_BLUR` | `filter: blur()` | ✅ |
|
|
@@ -88,64 +80,129 @@ Bash:
|
|
|
88
80
|
| `style.lineHeightPx` | `line-height` | ❌ |
|
|
89
81
|
| `style.letterSpacing` | `letter-spacing` | ✅ |
|
|
90
82
|
| `style.textAlignHorizontal` | `text-align` | ❌ |
|
|
91
|
-
| `fills[].color` (TEXT) | `color` | ❌ |
|
|
92
83
|
| `characters` | 텍스트 내용 | — |
|
|
93
|
-
| `absoluteBoundingBox.width/height` | `width/height` | ✅ |
|
|
94
|
-
| `layoutMode=VERTICAL` | `display:flex; flex-direction:column` | ❌ |
|
|
95
|
-
| `layoutMode=HORIZONTAL` | `display:flex; flex-direction:row` | ❌ |
|
|
96
|
-
| `primaryAxisAlignItems` | `justify-content` | ❌ |
|
|
97
|
-
| `counterAxisAlignItems` | `align-items` | ❌ |
|
|
98
|
-
| `itemSpacing` | `gap` | ✅ |
|
|
99
|
-
| `padding*` | `padding` | ✅ |
|
|
100
|
-
| `clipsContent` | `overflow: hidden` | ❌ |
|
|
101
|
-
| `layoutPositioning=ABSOLUTE` | `position: absolute` | ❌ |
|
|
102
84
|
|
|
103
85
|
---
|
|
104
86
|
|
|
105
|
-
##
|
|
87
|
+
## 2. 이미지 에셋
|
|
88
|
+
|
|
89
|
+
### 2-1. Fill 이미지 다운로드
|
|
106
90
|
|
|
107
91
|
```
|
|
108
|
-
|
|
92
|
+
트리에서 imageRef 수집 → Figma API로 다운로드:
|
|
109
93
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
94
|
+
Bash:
|
|
95
|
+
node "[FIGMA_SCRIPT]" images {fileKey} {nodeId} --out=/tmp/{feature}/images/ --depth=10
|
|
96
|
+
|
|
97
|
+
반환: { total: N, images: { "imageRef": "/path/to/file.png", ... } }
|
|
98
|
+
|
|
99
|
+
검증: total = refs.size (누락 0), 0byte 파일 없음
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### 2-2. 아이템/아이콘 노드 렌더링
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
fill 이미지가 없지만 시각적으로 의미 있는 노드를 PNG로 렌더링:
|
|
106
|
+
|
|
107
|
+
대상 식별 (tree.json에서):
|
|
108
|
+
- INSTANCE/COMPONENT 타입 중 크기 50~300px
|
|
109
|
+
- name에 "item", "icon", "reward", "token", "coin", "badge" 포함
|
|
110
|
+
- VECTOR/GROUP 중 크기 ≤ 64px (아이콘 후보)
|
|
111
|
+
|
|
112
|
+
렌더링:
|
|
113
|
+
node "[FIGMA_SCRIPT]" images {fileKey} {nodeId} --render --nodeIds={id1},{id2},... --out=/tmp/{feature}/images/
|
|
114
|
+
|
|
115
|
+
→ 벡터/인스턴스 에셋도 PNG로 확보
|
|
116
|
+
→ Phase 3에서 목 데이터의 image 경로에 연결 가능
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## 3. 스크린샷 — 검증 참조용
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
코드 생성에는 사용하지 않는다. Phase 4 시각 검증에서만 사용.
|
|
125
|
+
|
|
126
|
+
전체 스크린샷:
|
|
127
|
+
node "[FIGMA_SCRIPT]" screenshot {fileKey} {nodeId} --out=/tmp/{feature}/full-screenshot.png
|
|
128
|
+
|
|
129
|
+
섹션별 스크린샷 (1depth 자식 프레임 각각):
|
|
130
|
+
node "[FIGMA_SCRIPT]" screenshot {fileKey} {child.nodeId} --out=/tmp/{feature}/sections/{name}.png
|
|
115
131
|
|
|
116
|
-
|
|
117
|
-
|
|
132
|
+
용도:
|
|
133
|
+
✅ Phase 4에서 렌더링 결과와 pixelmatch 비교
|
|
134
|
+
✅ 시각 diff > 임계값 → 수정 판단 참고
|
|
135
|
+
❌ Phase 3 코드 생성의 입력으로 사용하지 않음
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## 4. 추출 데이터 정리
|
|
141
|
+
|
|
142
|
+
```
|
|
143
|
+
추출 완료 후 /tmp/{feature}/ 구조:
|
|
144
|
+
|
|
145
|
+
/tmp/{feature}/
|
|
146
|
+
├── tree.json ← 코드 생성의 PRIMARY 소스
|
|
147
|
+
├── images/ ← 이미지 에셋 (fill + 노드 렌더링)
|
|
148
|
+
│ ├── {imageRef}.png ← fill 이미지
|
|
149
|
+
│ ├── {nodeId}.png ← 렌더링된 아이템/아이콘
|
|
150
|
+
│ └── ...
|
|
151
|
+
├── full-screenshot.png ← Phase 4 검증용
|
|
152
|
+
└── sections/ ← Phase 4 섹션별 검증용
|
|
153
|
+
├── hero.png
|
|
154
|
+
└── ...
|
|
118
155
|
|
|
119
|
-
|
|
156
|
+
이미지 목록:
|
|
157
|
+
파일명 | 크기 | 용도 (트리 기반 판별)
|
|
158
|
+
{ref}.png | 720×1280 | 배경 (부모와 동일 크기 + z-index 낮음)
|
|
159
|
+
{ref}.png | 620×174 | 콘텐츠 이미지 (독립적 크기)
|
|
160
|
+
{ref}.png | 48×48 | 아이콘 (≤64px)
|
|
161
|
+
{nodeId}.png | 200×200 | 렌더링된 아이템 (INSTANCE)
|
|
162
|
+
|
|
163
|
+
색상 팔레트 (tree.json의 backgroundColor/color 고유값):
|
|
164
|
+
#0a1628, #00264a, #ffffff, ...
|
|
165
|
+
|
|
166
|
+
토큰 매핑 테이블 (project-tokens.json 존재 시):
|
|
167
|
+
| Figma 값 | 기존 토큰 | 상태 |
|
|
168
|
+
|----------|-----------|------|
|
|
169
|
+
| #0a1628 | $color-navy | ✅ 재사용 |
|
|
170
|
+
| #ffd700 | — | 🆕 생성 |
|
|
171
|
+
|
|
172
|
+
폰트 목록 (tree.json의 fontFamily/fontSize/fontWeight):
|
|
120
173
|
Pretendard: 400/500/700, 16px~48px
|
|
121
|
-
Roboto Condensed: 700, 24px~36px
|
|
122
174
|
|
|
123
|
-
텍스트 콘텐츠 (모든 TEXT
|
|
175
|
+
텍스트 콘텐츠 (모든 TEXT 노드의 characters):
|
|
124
176
|
"겨울 이벤트", "12.1 ~ 12.31", "참여 대상 : PC 유저", ...
|
|
125
177
|
|
|
126
|
-
간격 패턴 (빈도
|
|
178
|
+
간격 패턴 (tree.json의 gap/padding 빈도 분석):
|
|
127
179
|
gap: 8px, 16px, 24px, 32px
|
|
128
180
|
padding: 16px, 24px, 32px
|
|
129
181
|
```
|
|
130
182
|
|
|
131
183
|
---
|
|
132
184
|
|
|
133
|
-
## 5. 노드 참조 (
|
|
185
|
+
## 5. 노드 참조 (시맨틱 판단 힌트)
|
|
134
186
|
|
|
135
187
|
```
|
|
136
|
-
트리의 name/type은
|
|
137
|
-
|
|
138
|
-
name 패턴 →
|
|
139
|
-
"BG" → 배경
|
|
140
|
-
"Title", "Txt_*" →
|
|
141
|
-
"Btn_*", "CTA" →
|
|
142
|
-
"Icon_*" → 아이콘
|
|
143
|
-
"Step1", "Item_*" → 반복 요소
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
188
|
+
트리의 name/type은 Claude의 시맨틱 판단에 힌트로 사용:
|
|
189
|
+
|
|
190
|
+
name 패턴 → HTML 태그 힌트:
|
|
191
|
+
"BG" → 배경 레이어 (position:absolute + z-index:0)
|
|
192
|
+
"Title", "Txt_*" → 제목/텍스트 (<h2>, <p>)
|
|
193
|
+
"Btn_*", "CTA" → 버튼 (<button>)
|
|
194
|
+
"Icon_*" → 아이콘 (<img>)
|
|
195
|
+
"Step1", "Item_*" → 반복 요소 (v-for 후보)
|
|
196
|
+
"Period", "Info" → 정보 영역 (<div>)
|
|
197
|
+
|
|
198
|
+
type → 코드 매핑 기준:
|
|
199
|
+
TEXT → <span> (Claude가 h2/p/button으로 승격)
|
|
200
|
+
RECTANGLE/VECTOR + imageRef → <img src="다운로드된 파일">
|
|
201
|
+
FRAME + Auto Layout → <div> + CSS flex
|
|
202
|
+
FRAME + no Auto Layout → <div> + position:relative
|
|
203
|
+
INSTANCE 반복 → 컴포넌트 후보 (v-for)
|
|
204
|
+
GROUP → 논리적 래퍼 (보통 <div>)
|
|
205
|
+
|
|
206
|
+
이 정보는 트리→HTML 매핑의 보조 힌트이다.
|
|
207
|
+
레이아웃과 스타일은 tree.json의 css 객체에서 직접 매핑한다.
|
|
151
208
|
```
|