@su-record/vibe 2.9.1 → 2.9.3
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/CLAUDE.md +31 -10
- package/README.ko.md +90 -25
- package/README.md +139 -25
- package/agents/teams/debug-team.md +70 -0
- package/agents/teams/dev-team.md +88 -0
- package/agents/teams/docs-team.md +80 -0
- package/agents/teams/figma/figma-analyst.md +52 -0
- package/agents/teams/figma/figma-architect.md +112 -0
- package/agents/teams/figma/figma-auditor.md +82 -0
- package/agents/teams/figma/figma-builder.md +100 -0
- package/agents/teams/figma-team.md +85 -0
- package/agents/teams/fullstack-team.md +83 -0
- package/agents/teams/lite-team.md +69 -0
- package/agents/teams/migration-team.md +78 -0
- package/agents/teams/refactor-team.md +94 -0
- package/agents/teams/research-team.md +86 -0
- package/agents/teams/review-debate-team.md +125 -0
- package/agents/teams/security-team.md +81 -0
- package/commands/vibe.analyze.md +324 -170
- package/commands/vibe.figma.md +549 -34
- package/commands/vibe.harness.md +177 -0
- package/commands/vibe.review.md +1 -63
- package/commands/vibe.run.md +52 -403
- package/commands/vibe.scaffold.md +195 -0
- package/commands/vibe.spec.md +373 -1003
- package/commands/vibe.trace.md +17 -0
- package/commands/vibe.verify.md +19 -10
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +29 -1
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/update.d.ts.map +1 -1
- package/dist/cli/commands/update.js +4 -2
- package/dist/cli/commands/update.js.map +1 -1
- package/dist/cli/postinstall/constants.d.ts +1 -1
- package/dist/cli/postinstall/constants.d.ts.map +1 -1
- package/dist/cli/postinstall/constants.js +6 -1
- package/dist/cli/postinstall/constants.js.map +1 -1
- package/dist/cli/setup/ProjectSetup.d.ts +12 -1
- package/dist/cli/setup/ProjectSetup.d.ts.map +1 -1
- package/dist/cli/setup/ProjectSetup.js +259 -72
- package/dist/cli/setup/ProjectSetup.js.map +1 -1
- package/dist/cli/setup.d.ts +1 -1
- package/dist/cli/setup.d.ts.map +1 -1
- package/dist/cli/setup.js +1 -1
- package/dist/cli/setup.js.map +1 -1
- package/hooks/scripts/figma-guard.js +220 -0
- package/hooks/scripts/figma-refine.js +315 -0
- package/hooks/scripts/figma-to-scss.js +394 -0
- package/hooks/scripts/figma-validate.js +353 -0
- package/package.json +1 -1
- package/skills/arch-guard/SKILL.md +1 -1
- package/skills/capability-loop/SKILL.md +106 -2
- package/skills/chub-usage/SKILL.md +43 -43
- package/skills/claude-md-guide/SKILL.md +175 -175
- package/skills/design-teach/SKILL.md +33 -33
- package/skills/devlog/SKILL.md +38 -38
- package/skills/event-comms/SKILL.md +23 -13
- package/skills/event-ops/SKILL.md +28 -19
- package/skills/event-planning/SKILL.md +13 -1
- package/skills/priority-todos/SKILL.md +1 -1
- package/skills/vibe.figma/SKILL.md +263 -115
- package/skills/vibe.figma/templates/component-spec.md +168 -0
- package/skills/vibe.figma.convert/SKILL.md +131 -84
- package/skills/vibe.figma.convert/rubrics/conversion-rules.md +12 -0
- package/skills/vibe.figma.extract/SKILL.md +148 -108
- package/skills/vibe.figma.extract/rubrics/image-rules.md +15 -3
- package/skills/vibe.interview/SKILL.md +358 -0
- package/skills/vibe.interview/checklists/api.md +101 -0
- package/skills/vibe.interview/checklists/feature.md +88 -0
- package/skills/vibe.interview/checklists/library.md +95 -0
- package/skills/vibe.interview/checklists/mobile.md +89 -0
- package/skills/vibe.interview/checklists/webapp.md +97 -0
- package/skills/vibe.interview/checklists/website.md +99 -0
- package/skills/vibe.plan/SKILL.md +216 -0
- package/skills/vibe.spec/SKILL.md +1155 -0
- package/{commands/vibe.spec.review.md → skills/vibe.spec.review/SKILL.md} +272 -155
- package/vibe/templates/claudemd-template.md +74 -0
- package/vibe/templates/constitution-template.md +15 -0
- package/vibe/templates/plan-template.md +194 -0
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* figma-to-scss.js — sections.json → SCSS 기계적 생성
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* node figma-to-scss.js <sections.json> --out=<dir> [--section=<name>]
|
|
8
|
+
*
|
|
9
|
+
* 입력: sections.json (Phase 3 정제 결과)
|
|
10
|
+
* 출력: 섹션별 SCSS 파일 (px 그대로, vw 변환 없음)
|
|
11
|
+
*
|
|
12
|
+
* 원칙:
|
|
13
|
+
* ⛔ CSS 값은 sections.json에서 1:1 직접 매핑
|
|
14
|
+
* ⛔ 자체 함수/믹스인 생성 금지
|
|
15
|
+
* ⛔ vw 변환, clamp, aspect-ratio 등 추가 속성 금지
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import fs from 'fs';
|
|
19
|
+
import path from 'path';
|
|
20
|
+
|
|
21
|
+
// ─── Config ─────────────────────────────────────────────────────────
|
|
22
|
+
|
|
23
|
+
const CSS_LAYOUT_PROPS = new Set([
|
|
24
|
+
'display', 'flexDirection', 'justifyContent', 'alignItems', 'flexWrap',
|
|
25
|
+
'gap', 'padding', 'width', 'height', 'minWidth', 'minHeight',
|
|
26
|
+
'maxWidth', 'maxHeight', 'position', 'top', 'right', 'bottom', 'left',
|
|
27
|
+
'overflow', 'zIndex', 'flex', 'flexGrow', 'flexShrink', 'flexBasis',
|
|
28
|
+
'alignSelf', 'boxSizing', 'transform'
|
|
29
|
+
]);
|
|
30
|
+
|
|
31
|
+
const CSS_VISUAL_PROPS = new Set([
|
|
32
|
+
'backgroundColor', 'backgroundImage', 'backgroundSize', 'backgroundPosition',
|
|
33
|
+
'backgroundRepeat', 'backgroundBlendMode', 'color', 'fontFamily', 'fontSize',
|
|
34
|
+
'fontWeight', 'lineHeight', 'letterSpacing', 'textAlign', 'textTransform',
|
|
35
|
+
'textOverflow', 'whiteSpace', 'borderRadius', 'border', 'borderTop',
|
|
36
|
+
'borderRight', 'borderBottom', 'borderLeft', 'borderStyle', 'outline',
|
|
37
|
+
'boxShadow', 'opacity', 'mixBlendMode', 'filter', 'backdropFilter',
|
|
38
|
+
'marginBottom'
|
|
39
|
+
]);
|
|
40
|
+
|
|
41
|
+
// ─── Helpers ────────────────────────────────────────────────────────
|
|
42
|
+
|
|
43
|
+
function camelToKebab(str) {
|
|
44
|
+
return str.replace(/([A-Z])/g, '-$1').toLowerCase();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function nameToClass(name) {
|
|
48
|
+
// 한글/특수문자 제거, 영문+숫자만 유지
|
|
49
|
+
return name
|
|
50
|
+
.replace(/[^a-zA-Z0-9\s_-]/g, '')
|
|
51
|
+
.replace(/[\s_]+/g, '-')
|
|
52
|
+
.replace(/([a-z])([A-Z])/g, '$1-$2')
|
|
53
|
+
.toLowerCase()
|
|
54
|
+
.replace(/-+/g, '-')
|
|
55
|
+
.replace(/^-|-$/g, '')
|
|
56
|
+
|| null; // 영문이 없으면 null
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function nodeToClassName(node, index) {
|
|
60
|
+
const name = node.name || '';
|
|
61
|
+
const type = node.type || '';
|
|
62
|
+
|
|
63
|
+
// 1. Figma name에서 영문 클래스명 추출
|
|
64
|
+
let cls = nameToClass(name);
|
|
65
|
+
|
|
66
|
+
// 2. 영문이 없으면 (한글 TEXT 등) → 타입+인덱스로 대체
|
|
67
|
+
if (!cls) {
|
|
68
|
+
if (type === 'TEXT') cls = `text-${index}`;
|
|
69
|
+
else if (type === 'VECTOR') cls = `vector-${index}`;
|
|
70
|
+
else if (type === 'RECTANGLE') cls = `rect-${index}`;
|
|
71
|
+
else if (type === 'ELLIPSE') cls = `ellipse-${index}`;
|
|
72
|
+
else if (type === 'GROUP') cls = `group-${index}`;
|
|
73
|
+
else cls = `el-${index}`;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return cls;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function isBGFrame(node) {
|
|
80
|
+
const name = (node.name || '').toLowerCase();
|
|
81
|
+
return name === 'bg' || name.endsWith('-bg') || name.startsWith('bg-');
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function indent(level) {
|
|
85
|
+
return ' '.repeat(level);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// ─── CSS Generation ─────────────────────────────────────────────────
|
|
89
|
+
|
|
90
|
+
function cssValue(prop, value) {
|
|
91
|
+
// 값 그대로 출력 — 변환 없음
|
|
92
|
+
return `${camelToKebab(prop)}: ${value};`;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function generateCSSBlock(css, indentLevel) {
|
|
96
|
+
if (!css || Object.keys(css).length === 0) return '';
|
|
97
|
+
const lines = [];
|
|
98
|
+
for (const [prop, value] of Object.entries(css)) {
|
|
99
|
+
if (value === undefined || value === null || value === '') continue;
|
|
100
|
+
// 내부 메타 필드 스킵
|
|
101
|
+
if (prop.startsWith('_')) continue;
|
|
102
|
+
lines.push(`${indent(indentLevel)}${cssValue(prop, value)}`);
|
|
103
|
+
}
|
|
104
|
+
return lines.join('\n');
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// ─── BG 처리 ────────────────────────────────────────────────────────
|
|
108
|
+
|
|
109
|
+
function generateBGStyles(sectionClass, images, indentLevel) {
|
|
110
|
+
if (!images?.bg) return '';
|
|
111
|
+
const lines = [];
|
|
112
|
+
lines.push(`${indent(indentLevel)}background-image: url('${images.bg}');`);
|
|
113
|
+
lines.push(`${indent(indentLevel)}background-size: cover;`);
|
|
114
|
+
lines.push(`${indent(indentLevel)}background-position: center top;`);
|
|
115
|
+
lines.push(`${indent(indentLevel)}background-repeat: no-repeat;`);
|
|
116
|
+
return lines.join('\n');
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// ─── Node → SCSS 재귀 ──────────────────────────────────────────────
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Flat BEM 방식: .section, .section__parent-child 형태
|
|
123
|
+
* 부모 경로를 포함하여 중복 클래스명 방지.
|
|
124
|
+
* SCSS nesting 없이 모든 클래스를 루트 레벨로 출력.
|
|
125
|
+
*/
|
|
126
|
+
function collectNodeBlocks(node, sectionClass, isRoot, childIndex, blocks, parentPath) {
|
|
127
|
+
const css = node.css || {};
|
|
128
|
+
const children = node.children || [];
|
|
129
|
+
|
|
130
|
+
// 클래스명 결정: 부모 경로 포함으로 유니크하게
|
|
131
|
+
const nodeCls = isRoot ? null : nodeToClassName(node, childIndex || 0);
|
|
132
|
+
|
|
133
|
+
// 현재 노드의 경로 (부모-자식 체인)
|
|
134
|
+
let currentPath;
|
|
135
|
+
if (isRoot) {
|
|
136
|
+
currentPath = '';
|
|
137
|
+
} else if (parentPath) {
|
|
138
|
+
currentPath = `${parentPath}-${nodeCls}`;
|
|
139
|
+
} else {
|
|
140
|
+
currentPath = nodeCls;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
const selector = isRoot ? `.${sectionClass}` : `.${sectionClass}__${currentPath}`;
|
|
144
|
+
|
|
145
|
+
// BG 프레임 → 스킵 (이미지로 렌더링됨)
|
|
146
|
+
if (!isRoot && isBGFrame(node)) {
|
|
147
|
+
blocks.push({ selector: null, comment: `// BG frame "${node.name}" → background-image on .${sectionClass}` });
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
const hasCSS = Object.keys(css).length > 0;
|
|
152
|
+
const hasImages = node.images?.bg;
|
|
153
|
+
const hasImageRef = node.imageRef && node.imageScaleMode;
|
|
154
|
+
|
|
155
|
+
if (hasCSS || hasImages || hasImageRef) {
|
|
156
|
+
const block = { selector, lines: [], nodeId: node.nodeId, name: node.name };
|
|
157
|
+
|
|
158
|
+
// BG 이미지
|
|
159
|
+
if (hasImages) {
|
|
160
|
+
block.lines.push(`background-image: url('${node.images.bg}');`);
|
|
161
|
+
block.lines.push(`background-size: cover;`);
|
|
162
|
+
block.lines.push(`background-position: center top;`);
|
|
163
|
+
block.lines.push(`background-repeat: no-repeat;`);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// CSS 속성
|
|
167
|
+
for (const [prop, value] of Object.entries(css)) {
|
|
168
|
+
if (value === undefined || value === null || value === '') continue;
|
|
169
|
+
if (prop.startsWith('_')) continue;
|
|
170
|
+
block.lines.push(`${camelToKebab(prop)}: ${value};`);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// imageRef
|
|
174
|
+
if (hasImageRef && !hasImages) {
|
|
175
|
+
const sizeMap = { 'FILL': 'cover', 'FIT': 'contain', 'CROP': 'cover', 'TILE': 'auto' };
|
|
176
|
+
block.lines.push(`// imageRef: ${node.imageRef}`);
|
|
177
|
+
block.lines.push(`background-size: ${sizeMap[node.imageScaleMode] || 'cover'};`);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
blocks.push(block);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// 자식 재귀 (BG 프레임 제외, 중복 클래스 첫 번째만)
|
|
184
|
+
const seenClasses = new Set();
|
|
185
|
+
let idx = 0;
|
|
186
|
+
for (const child of children) {
|
|
187
|
+
const childCls = nodeToClassName(child, idx);
|
|
188
|
+
if (seenClasses.has(childCls)) { idx++; continue; }
|
|
189
|
+
seenClasses.add(childCls);
|
|
190
|
+
collectNodeBlocks(child, sectionClass, false, idx, blocks, currentPath);
|
|
191
|
+
idx++;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// ─── Section → SCSS 파일 ───────────────────────────────────────────
|
|
196
|
+
|
|
197
|
+
function generateSectionSCSS(section) {
|
|
198
|
+
const sectionClass = nameToClass(section.name);
|
|
199
|
+
const lines = [];
|
|
200
|
+
|
|
201
|
+
// 헤더 코멘트
|
|
202
|
+
lines.push(`// ${section.name} — Auto-generated from sections.json`);
|
|
203
|
+
lines.push(`// ⛔ 이 파일의 CSS 값을 수동 수정하지 마세요.`);
|
|
204
|
+
lines.push('');
|
|
205
|
+
|
|
206
|
+
// Flat BEM 블록 수집
|
|
207
|
+
const blocks = [];
|
|
208
|
+
collectNodeBlocks(section, sectionClass, true, 0, blocks, '');
|
|
209
|
+
|
|
210
|
+
// 블록 → SCSS 텍스트
|
|
211
|
+
for (const block of blocks) {
|
|
212
|
+
if (block.comment) {
|
|
213
|
+
lines.push(block.comment);
|
|
214
|
+
continue;
|
|
215
|
+
}
|
|
216
|
+
if (!block.selector || block.lines.length === 0) continue;
|
|
217
|
+
lines.push(`${block.selector} {`);
|
|
218
|
+
for (const line of block.lines) {
|
|
219
|
+
lines.push(` ${line}`);
|
|
220
|
+
}
|
|
221
|
+
lines.push('}');
|
|
222
|
+
lines.push('');
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
return lines.join('\n') + '\n';
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// ─── _tokens.scss 생성 ─────────────────────────────────────────────
|
|
229
|
+
|
|
230
|
+
function generateTokens(meta, sections) {
|
|
231
|
+
const lines = [];
|
|
232
|
+
lines.push(`// Design Tokens — Auto-generated from sections.json`);
|
|
233
|
+
lines.push(`// Feature: ${meta.feature}`);
|
|
234
|
+
lines.push(`// Design Width: ${meta.designWidth}px`);
|
|
235
|
+
lines.push('');
|
|
236
|
+
lines.push(`$design-width: ${meta.designWidth}px;`);
|
|
237
|
+
if (meta.breakpoint) {
|
|
238
|
+
lines.push(`$bp-desktop: ${meta.breakpoint};`);
|
|
239
|
+
}
|
|
240
|
+
lines.push('');
|
|
241
|
+
|
|
242
|
+
// 색상 토큰 추출 (모든 섹션에서 사용된 색상)
|
|
243
|
+
const colors = new Map();
|
|
244
|
+
const fonts = new Set();
|
|
245
|
+
|
|
246
|
+
function extractTokens(node) {
|
|
247
|
+
const css = node.css || {};
|
|
248
|
+
for (const [prop, value] of Object.entries(css)) {
|
|
249
|
+
if (typeof value !== 'string') continue;
|
|
250
|
+
// 색상 추출
|
|
251
|
+
if (prop === 'backgroundColor' || prop === 'color' || prop === 'border') {
|
|
252
|
+
const hexMatch = value.match(/#[0-9a-fA-F]{3,8}/g);
|
|
253
|
+
if (hexMatch) hexMatch.forEach(c => colors.set(c.toLowerCase(), (colors.get(c.toLowerCase()) || 0) + 1));
|
|
254
|
+
const rgbaMatch = value.match(/rgba?\([^)]+\)/g);
|
|
255
|
+
if (rgbaMatch) rgbaMatch.forEach(c => colors.set(c, (colors.get(c) || 0) + 1));
|
|
256
|
+
}
|
|
257
|
+
// 폰트 추출
|
|
258
|
+
if (prop === 'fontFamily') {
|
|
259
|
+
const font = value.replace(/['"]/g, '').split(',')[0].trim();
|
|
260
|
+
fonts.add(font);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
(node.children || []).forEach(extractTokens);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
sections.forEach(s => extractTokens(s));
|
|
267
|
+
|
|
268
|
+
// 폰트 토큰
|
|
269
|
+
if (fonts.size > 0) {
|
|
270
|
+
lines.push('// Fonts');
|
|
271
|
+
let i = 0;
|
|
272
|
+
for (const font of fonts) {
|
|
273
|
+
const varName = `$font-${nameToClass(font) ?? `family-${i}`}`;
|
|
274
|
+
lines.push(`${varName}: '${font}', sans-serif;`);
|
|
275
|
+
i++;
|
|
276
|
+
}
|
|
277
|
+
lines.push('');
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
// 자주 사용되는 색상만 토큰화 (2회 이상)
|
|
281
|
+
const frequentColors = [...colors.entries()].filter(([, count]) => count >= 2).sort((a, b) => b[1] - a[1]);
|
|
282
|
+
if (frequentColors.length > 0) {
|
|
283
|
+
lines.push('// Colors (used 2+ times)');
|
|
284
|
+
frequentColors.forEach(([color], i) => {
|
|
285
|
+
lines.push(`$color-${i + 1}: ${color};`);
|
|
286
|
+
});
|
|
287
|
+
lines.push('');
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
return lines.join('\n') + '\n';
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
// ─── _base.scss 생성 ────────────────────────────────────────────────
|
|
294
|
+
|
|
295
|
+
function generateBase(meta) {
|
|
296
|
+
return `// Base — Auto-generated
|
|
297
|
+
// ⛔ 이 파일의 CSS 값을 수동 수정하지 마세요.
|
|
298
|
+
|
|
299
|
+
.${nameToClass(meta.feature)} {
|
|
300
|
+
width: ${meta.designWidth}px;
|
|
301
|
+
margin: 0 auto;
|
|
302
|
+
overflow-x: hidden;
|
|
303
|
+
}
|
|
304
|
+
`;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
// ─── index.scss 생성 ────────────────────────────────────────────────
|
|
308
|
+
|
|
309
|
+
function generateIndex(meta, sections) {
|
|
310
|
+
const lines = [];
|
|
311
|
+
lines.push(`// Index — Auto-generated`);
|
|
312
|
+
lines.push(`@use 'tokens';`);
|
|
313
|
+
lines.push(`@use 'base';`);
|
|
314
|
+
lines.push('');
|
|
315
|
+
for (const s of sections) {
|
|
316
|
+
const name = nameToClass(s.name);
|
|
317
|
+
lines.push(`@use '${name}';`);
|
|
318
|
+
}
|
|
319
|
+
return lines.join('\n') + '\n';
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
// ─── Main ───────────────────────────────────────────────────────────
|
|
323
|
+
|
|
324
|
+
function main() {
|
|
325
|
+
const args = process.argv.slice(2);
|
|
326
|
+
if (args.length < 1) {
|
|
327
|
+
console.error('Usage: node figma-to-scss.js <sections.json> --out=<dir> [--section=<name>]');
|
|
328
|
+
process.exit(1);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
const inputFile = args[0];
|
|
332
|
+
let outDir = '';
|
|
333
|
+
let sectionFilter = '';
|
|
334
|
+
|
|
335
|
+
for (const arg of args.slice(1)) {
|
|
336
|
+
if (arg.startsWith('--out=')) outDir = arg.slice(6);
|
|
337
|
+
if (arg.startsWith('--section=')) sectionFilter = arg.slice(10);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
if (!outDir) {
|
|
341
|
+
console.error('--out=<dir> required');
|
|
342
|
+
process.exit(1);
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
// 입력 읽기
|
|
346
|
+
const data = JSON.parse(fs.readFileSync(inputFile, 'utf-8'));
|
|
347
|
+
const meta = data.meta || {};
|
|
348
|
+
let sections = data.sections || [];
|
|
349
|
+
|
|
350
|
+
if (sectionFilter) {
|
|
351
|
+
sections = sections.filter(s => s.name === sectionFilter);
|
|
352
|
+
if (sections.length === 0) {
|
|
353
|
+
console.error(`Section "${sectionFilter}" not found`);
|
|
354
|
+
process.exit(1);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
// 출력 디렉토리 생성
|
|
359
|
+
if (!fs.existsSync(outDir)) {
|
|
360
|
+
fs.mkdirSync(outDir, { recursive: true });
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
const results = { files: [], sections: [] };
|
|
364
|
+
|
|
365
|
+
// _tokens.scss
|
|
366
|
+
const tokensFile = path.join(outDir, '_tokens.scss');
|
|
367
|
+
fs.writeFileSync(tokensFile, generateTokens(meta, sections));
|
|
368
|
+
results.files.push(tokensFile);
|
|
369
|
+
|
|
370
|
+
// _base.scss
|
|
371
|
+
const baseFile = path.join(outDir, '_base.scss');
|
|
372
|
+
fs.writeFileSync(baseFile, generateBase(meta));
|
|
373
|
+
results.files.push(baseFile);
|
|
374
|
+
|
|
375
|
+
// 섹션별 SCSS
|
|
376
|
+
for (const section of sections) {
|
|
377
|
+
const name = nameToClass(section.name);
|
|
378
|
+
const scssFile = path.join(outDir, `_${name}.scss`);
|
|
379
|
+
const scss = generateSectionSCSS(section);
|
|
380
|
+
fs.writeFileSync(scssFile, scss);
|
|
381
|
+
results.files.push(scssFile);
|
|
382
|
+
results.sections.push({ name: section.name, file: scssFile, classes: name });
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
// index.scss
|
|
386
|
+
const indexFile = path.join(outDir, 'index.scss');
|
|
387
|
+
fs.writeFileSync(indexFile, generateIndex(meta, sections));
|
|
388
|
+
results.files.push(indexFile);
|
|
389
|
+
|
|
390
|
+
// 결과 출력
|
|
391
|
+
console.log(JSON.stringify(results, null, 2));
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
main();
|