@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.
@@ -1,83 +1,74 @@
1
- # React+TailwindProject Stack Conversion Rules
2
-
3
- ## Mode Selection (Do This First)
4
-
5
- Classify each section before writing any code. Literal mode if ANY of:
6
- - 15+ asset URLs in the section
7
- - Fractional coordinates (`left-[117.13px]`)
8
- - `mix-blend-*` on any layer
9
- - `rotate-[Ndeg]` or `-scale-y-100`
10
- - `mask-image` usage
11
- - `blur-[Npx]` filter
12
- - BG cropped from 2560px+ source
13
-
14
- Normal mode only when ALL of:
15
- - Flex/grid layout, no absolute coordinates (or integer-only)
16
- - Fewer than 10 asset URLs
17
- - No blend/rotate/mask/blur
18
-
19
- ## Normal Mode Rules
20
-
21
- - Extract CSS values from Tailwind classes — never estimate
22
- - Apply `scaleFactor` to all `px` values; never to colors, opacity, z-index, line-height (unitless)
23
- - Put layout properties in `layout/_section.scss`, visual/text properties in `components/_section.scss`
24
- - No `<style>` block in the component file
25
- - No inline `style=""` attribute in the template
26
-
27
- ## Literal Mode Rules
28
-
29
- - Preserve the full HTML nesting structure 1:1
30
- - Keep all absolute coordinates, fractional px values (rounded after scaling)
31
- - Keep all `mix-blend-mode`, `rotate`, `mask-image`, `blur` values unchanged
32
- - Put all styles in `<style scoped>` inside the component
33
- - Do not create external SCSS files for literal sections
34
-
35
- ## Tailwind Class Gotchas
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
+ # TreeCode 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
- ## Class Naming (Literal Mode)
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
- Source priority: `data-name` attribute `data-node-id`
80
- - `data-name="BG"` `.bg`
81
- - `data-name="Light"``.light`
82
- - No `data-name` `.node-{nodeId}` (replace `:` with `-`)
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
- Use this template when generating a section component from Figma reference code.
3
+ tree.json 노드를 기반으로 컴포넌트를 생성할 템플릿을 따른다.
4
4
 
5
5
  ---
6
6
 
7
- ## Normal Mode (External SCSS)
7
+ ## Vue / Nuxt (External SCSS)
8
8
 
9
9
  ```vue
10
- <!-- components/{{FEATURE_KEY}}/{{ComponentName}}.vue -->
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 Layer (if section has background image) -->
14
- <div class="{{sectionName}}Bg">
15
- <img src="/images/{{FEATURE_KEY}}/{{bg-file}}.webp" alt="" aria-hidden="true" />
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
- <!-- Content Layer -->
19
- <div class="{{sectionName}}Content">
20
- <!-- Title image (if present) -->
21
- <div class="{{sectionName}}Title">
22
- <img src="/images/{{FEATURE_KEY}}/{{title-file}}.webp" alt="{{TITLE_ALT_TEXT}}" />
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: number
62
- label: string
64
+ id: string
65
+ name: string
63
66
  image: string
64
67
  }
65
68
 
66
- const items: {{ItemType}}[] = [
67
- { id: 1, label: '{{MOCK_LABEL_1}}', image: '/images/{{FEATURE_KEY}}/{{mock-img-1}}.webp' },
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
- ## Literal Mode (Scoped CSS)
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
- <script setup lang="ts">
105
- /**
106
- * {{SECTION_DISPLAY_NAME}}
107
- * [기능 정의] {{FEATURE_REQUIREMENT_1}}
108
- * [인터랙션] {{INTERACTION_1}}
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: {{SECTION_HEIGHT_SCALED}}px; /* {{SECTION_HEIGHT_ORIGINAL}} × {{SCALE_FACTOR}} */
122
- overflow: hidden;
89
+ height: {{HEIGHT_SCALED}}px; // tree: {{HEIGHT}} × {{SCALE_FACTOR}}
90
+ overflow: hidden; // tree: overflow:hidden
123
91
  }
124
92
 
125
- .bg {
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
- .bg img {
131
- width: 100%;
132
- height: 100%;
133
- object-fit: cover;
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
- .titleArea {
137
- position: absolute;
138
- top: {{TITLE_TOP_SCALED}}px; /* {{TITLE_TOP_ORIGINAL}} × {{SCALE_FACTOR}} */
139
- left: 50%;
140
- transform: translateX(-50%);
141
- width: {{TITLE_WIDTH_SCALED}}px;
142
- height: {{TITLE_HEIGHT_SCALED}}px;
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
- /* {{RESPONSIVE_BREAKPOINT}} */
146
- @media (min-width: {{BP_PC}}px) {
147
- .{{sectionName}} {
148
- height: {{SECTION_HEIGHT_PC_SCALED}}px;
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로 재료 확보 — 스크린샷, 이미지, CSS, 트리, 텍스트
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
- node "[FIGMA_SCRIPT]" screenshot {fileKey} {nodeId} --out=/tmp/{feature}/full-screenshot.png
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
- ## 2. 이미지 에셋시각 재료
21
+ ## 1. 노드 트리 + CSS 코드 생성의 원천
30
22
 
31
23
  ```
32
- 트리에서 imageRef 수집 Figma API로 다운로드:
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
- ⚠️ 주의: 트리는 HTML 구조로 변환하지 않는다.
63
- 용도는 오직:
64
- - 정확한 CSS 수치 참조 (색상, 크기, 간격)
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
- ## 4. 재료함 정리 (material-inventory)
87
+ ## 2. 이미지 에셋
88
+
89
+ ### 2-1. Fill 이미지 다운로드
106
90
 
107
91
  ```
108
- 추출 완료 재료를 카테고리별로 정리:
92
+ 트리에서 imageRef 수집 Figma API로 다운로드:
109
93
 
110
- 이미지 목록:
111
- 파일명 | 크기 | 용도 추정
112
- hero-bg.png | 720×1280 | 배경 (큰 사이즈, BG 레이어)
113
- title.png | 620×174 | 타이틀 이미지
114
- btn-share.png | 48×48 | 아이콘 (작은 사이즈)
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
- 색상 팔레트 (tree.json에서 고유값 추출):
117
- #0a1628, #00264a, #ffffff, #dadce3, #003879, #419bd3, ...
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
- type → 재료 종류:
146
- TEXT텍스트 콘텐츠 제공
147
- RECTANGLE/VECTOR + imageRef 다운로드 대상 이미지
148
- INSTANCE 반복 사용 가능성 (컴포넌트 후보)
149
-
150
- ⚠️ 정보로 HTML을 생성하지 않는다. 스크린샷을 보고 판단한다.
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
  ```