super-dev 2.0.0__py3-none-any.whl
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.
- super_dev/__init__.py +11 -0
- super_dev/analyzer/__init__.py +34 -0
- super_dev/analyzer/analyzer.py +440 -0
- super_dev/analyzer/detectors.py +511 -0
- super_dev/analyzer/models.py +285 -0
- super_dev/cli.py +3257 -0
- super_dev/config/__init__.py +11 -0
- super_dev/config/frontend.py +557 -0
- super_dev/config/manager.py +281 -0
- super_dev/creators/__init__.py +26 -0
- super_dev/creators/creator.py +134 -0
- super_dev/creators/document_generator.py +2473 -0
- super_dev/creators/frontend_builder.py +371 -0
- super_dev/creators/implementation_builder.py +789 -0
- super_dev/creators/prompt_generator.py +289 -0
- super_dev/creators/requirement_parser.py +354 -0
- super_dev/creators/spec_builder.py +195 -0
- super_dev/deployers/__init__.py +20 -0
- super_dev/deployers/cicd.py +1269 -0
- super_dev/deployers/delivery.py +229 -0
- super_dev/deployers/migration.py +1032 -0
- super_dev/design/__init__.py +74 -0
- super_dev/design/aesthetics.py +530 -0
- super_dev/design/charts.py +396 -0
- super_dev/design/codegen.py +379 -0
- super_dev/design/engine.py +528 -0
- super_dev/design/generator.py +395 -0
- super_dev/design/landing.py +422 -0
- super_dev/design/tech_stack.py +524 -0
- super_dev/design/tokens.py +269 -0
- super_dev/design/ux_guide.py +391 -0
- super_dev/exceptions.py +119 -0
- super_dev/experts/__init__.py +19 -0
- super_dev/experts/service.py +161 -0
- super_dev/integrations/__init__.py +7 -0
- super_dev/integrations/manager.py +264 -0
- super_dev/orchestrator/__init__.py +12 -0
- super_dev/orchestrator/engine.py +958 -0
- super_dev/orchestrator/experts.py +423 -0
- super_dev/orchestrator/knowledge.py +352 -0
- super_dev/orchestrator/quality.py +356 -0
- super_dev/reviewers/__init__.py +17 -0
- super_dev/reviewers/code_review.py +471 -0
- super_dev/reviewers/quality_gate.py +964 -0
- super_dev/reviewers/redteam.py +881 -0
- super_dev/skills/__init__.py +7 -0
- super_dev/skills/manager.py +307 -0
- super_dev/specs/__init__.py +44 -0
- super_dev/specs/generator.py +264 -0
- super_dev/specs/manager.py +428 -0
- super_dev/specs/models.py +348 -0
- super_dev/specs/validator.py +415 -0
- super_dev/utils/__init__.py +11 -0
- super_dev/utils/logger.py +133 -0
- super_dev/web/api.py +1402 -0
- super_dev-2.0.0.dist-info/METADATA +252 -0
- super_dev-2.0.0.dist-info/RECORD +61 -0
- super_dev-2.0.0.dist-info/WHEEL +5 -0
- super_dev-2.0.0.dist-info/entry_points.txt +2 -0
- super_dev-2.0.0.dist-info/licenses/LICENSE +21 -0
- super_dev-2.0.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
"""
|
|
2
|
+
开发:Excellent(11964948@qq.com)
|
|
3
|
+
功能:设计系统生成器 - 完整的设计交付
|
|
4
|
+
作用:生成完整的设计系统、组件、文档
|
|
5
|
+
创建时间:2025-12-30
|
|
6
|
+
最后修改:2025-12-30
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
import json
|
|
10
|
+
from dataclasses import dataclass, field
|
|
11
|
+
from pathlib import Path
|
|
12
|
+
from typing import Any
|
|
13
|
+
|
|
14
|
+
from .aesthetics import AestheticDirection, AestheticDirectionType, AestheticEngine
|
|
15
|
+
from .engine import DesignIntelligenceEngine
|
|
16
|
+
from .tokens import TokenGenerator
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
@dataclass
|
|
20
|
+
class DesignSystem:
|
|
21
|
+
"""设计系统配置"""
|
|
22
|
+
name: str
|
|
23
|
+
description: str
|
|
24
|
+
|
|
25
|
+
# 色彩
|
|
26
|
+
colors: dict[str, str] = field(default_factory=dict)
|
|
27
|
+
|
|
28
|
+
# 字体
|
|
29
|
+
typography: dict[str, str] = field(default_factory=dict)
|
|
30
|
+
|
|
31
|
+
# 间距
|
|
32
|
+
spacing: dict[str, str] = field(default_factory=dict)
|
|
33
|
+
|
|
34
|
+
# 阴影
|
|
35
|
+
shadows: dict[str, str] = field(default_factory=dict)
|
|
36
|
+
|
|
37
|
+
# 圆角
|
|
38
|
+
radius: dict[str, str] = field(default_factory=dict)
|
|
39
|
+
|
|
40
|
+
# 动画
|
|
41
|
+
animations: dict[str, str] = field(default_factory=dict)
|
|
42
|
+
|
|
43
|
+
# 组件样式
|
|
44
|
+
components: dict[str, dict] = field(default_factory=dict)
|
|
45
|
+
|
|
46
|
+
# 美学方向
|
|
47
|
+
aesthetic: AestheticDirection | None = None
|
|
48
|
+
|
|
49
|
+
def to_css_variables(self) -> str:
|
|
50
|
+
"""生成 CSS 变量"""
|
|
51
|
+
lines = [":root {"]
|
|
52
|
+
lines.append(" /* Colors */")
|
|
53
|
+
|
|
54
|
+
for name, value in self.colors.items():
|
|
55
|
+
lines.append(f" --color-{name}: {value};")
|
|
56
|
+
|
|
57
|
+
lines.append("")
|
|
58
|
+
lines.append(" /* Typography */")
|
|
59
|
+
|
|
60
|
+
for name, value in self.typography.items():
|
|
61
|
+
lines.append(f" --font-{name}: {value};")
|
|
62
|
+
|
|
63
|
+
lines.append("")
|
|
64
|
+
lines.append(" /* Spacing */")
|
|
65
|
+
|
|
66
|
+
for name, value in self.spacing.items():
|
|
67
|
+
lines.append(f" --space-{name}: {value};")
|
|
68
|
+
|
|
69
|
+
lines.append("")
|
|
70
|
+
lines.append(" /* Shadows */")
|
|
71
|
+
|
|
72
|
+
for name, value in self.shadows.items():
|
|
73
|
+
lines.append(f" --shadow-{name}: {value};")
|
|
74
|
+
|
|
75
|
+
lines.append("")
|
|
76
|
+
lines.append(" /* Border Radius */")
|
|
77
|
+
|
|
78
|
+
for name, value in self.radius.items():
|
|
79
|
+
lines.append(f" --radius-{name}: {value};")
|
|
80
|
+
|
|
81
|
+
lines.append("")
|
|
82
|
+
lines.append(" /* Animations */")
|
|
83
|
+
|
|
84
|
+
for name, value in self.animations.items():
|
|
85
|
+
lines.append(f" --animate-{name}: {value};")
|
|
86
|
+
|
|
87
|
+
lines.append("}")
|
|
88
|
+
|
|
89
|
+
return "\n".join(lines)
|
|
90
|
+
|
|
91
|
+
def to_tailwind_config(self) -> dict[str, Any]:
|
|
92
|
+
"""生成 Tailwind 配置"""
|
|
93
|
+
return {
|
|
94
|
+
"theme": {
|
|
95
|
+
"extend": {
|
|
96
|
+
"colors": self.colors,
|
|
97
|
+
"fontFamily": self.typography,
|
|
98
|
+
"spacing": self.spacing,
|
|
99
|
+
"boxShadow": self.shadows,
|
|
100
|
+
"borderRadius": self.radius,
|
|
101
|
+
"animation": self.animations,
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
class DesignSystemGenerator:
|
|
108
|
+
"""
|
|
109
|
+
设计系统生成器
|
|
110
|
+
|
|
111
|
+
整合所有设计能力:
|
|
112
|
+
1. 智能推荐
|
|
113
|
+
2. 美学生成
|
|
114
|
+
3. Token 生成
|
|
115
|
+
4. 组件样式
|
|
116
|
+
5. 文档生成
|
|
117
|
+
"""
|
|
118
|
+
|
|
119
|
+
def __init__(self):
|
|
120
|
+
"""初始化设计系统生成器"""
|
|
121
|
+
self.engine = DesignIntelligenceEngine()
|
|
122
|
+
self.aesthetic_engine = AestheticEngine()
|
|
123
|
+
self.token_generator = TokenGenerator()
|
|
124
|
+
|
|
125
|
+
def generate(
|
|
126
|
+
self,
|
|
127
|
+
product_type: str,
|
|
128
|
+
industry: str,
|
|
129
|
+
keywords: list[str],
|
|
130
|
+
platform: str = "web",
|
|
131
|
+
aesthetic: str | None = None,
|
|
132
|
+
) -> DesignSystem:
|
|
133
|
+
"""
|
|
134
|
+
生成完整的设计系统
|
|
135
|
+
|
|
136
|
+
Args:
|
|
137
|
+
product_type: 产品类型
|
|
138
|
+
industry: 行业
|
|
139
|
+
keywords: 关键词
|
|
140
|
+
platform: 平台
|
|
141
|
+
aesthetic: 美学方向(可选)
|
|
142
|
+
|
|
143
|
+
Returns:
|
|
144
|
+
完整的设计系统
|
|
145
|
+
"""
|
|
146
|
+
# 获取智能推荐
|
|
147
|
+
recommendation = self.engine.recommend_design_system(
|
|
148
|
+
product_type=product_type,
|
|
149
|
+
industry=industry,
|
|
150
|
+
keywords=keywords,
|
|
151
|
+
platform=platform,
|
|
152
|
+
)
|
|
153
|
+
|
|
154
|
+
# 生成或使用指定的美学方向
|
|
155
|
+
if aesthetic:
|
|
156
|
+
direction = AestheticDirectionType[aesthetic.upper()]
|
|
157
|
+
aesthetic_config = self.aesthetic_engine.generate_direction(direction)
|
|
158
|
+
else:
|
|
159
|
+
aesthetic_config = self.aesthetic_engine.generate_direction()
|
|
160
|
+
|
|
161
|
+
# 创建设计系统
|
|
162
|
+
design_system = DesignSystem(
|
|
163
|
+
name=f"{product_type} {industry} Design System",
|
|
164
|
+
description=f"Complete design system for {product_type} in {industry} industry",
|
|
165
|
+
aesthetic=aesthetic_config,
|
|
166
|
+
)
|
|
167
|
+
|
|
168
|
+
# 配色方案
|
|
169
|
+
color_palette = recommendation.get("color_palette", {})
|
|
170
|
+
design_system.colors = {
|
|
171
|
+
"primary": color_palette.get("primary", "#3B82F6"),
|
|
172
|
+
"secondary": color_palette.get("secondary", "#8B5CF6"),
|
|
173
|
+
"accent": color_palette.get("accent", "#EC4899"),
|
|
174
|
+
"background": color_palette.get("background", "#FFFFFF"),
|
|
175
|
+
"surface": color_palette.get("surface", "#F9FAFB"),
|
|
176
|
+
"text": color_palette.get("text", "#111827"),
|
|
177
|
+
"text-muted": color_palette.get("text_muted", "#6B7280"),
|
|
178
|
+
"border": color_palette.get("border", "#E5E7EB"),
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
# 字体
|
|
182
|
+
typography_config = recommendation.get("typography", {})
|
|
183
|
+
design_system.typography = {
|
|
184
|
+
"heading": typography_config.get("heading_font", "Inter"),
|
|
185
|
+
"body": typography_config.get("body_font", "Inter"),
|
|
186
|
+
"accent": typography_config.get("accent_font", ""),
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
# 间距(8pt 栅格)
|
|
190
|
+
design_system.spacing = {
|
|
191
|
+
"xs": "0.25rem", # 4px
|
|
192
|
+
"sm": "0.5rem", # 8px
|
|
193
|
+
"md": "1rem", # 16px
|
|
194
|
+
"lg": "1.5rem", # 24px
|
|
195
|
+
"xl": "2rem", # 32px
|
|
196
|
+
"2xl": "3rem", # 48px
|
|
197
|
+
"3xl": "4rem", # 64px
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
# 阴影
|
|
201
|
+
design_system.shadows = {
|
|
202
|
+
"sm": "0 1px 2px 0 rgb(0 0 0 / 0.05)",
|
|
203
|
+
"md": "0 4px 6px -1px rgb(0 0 0 / 0.1)",
|
|
204
|
+
"lg": "0 10px 15px -3px rgb(0 0 0 / 0.1)",
|
|
205
|
+
"xl": "0 20px 25px -5px rgb(0 0 0 / 0.1)",
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
# 圆角
|
|
209
|
+
design_system.radius = {
|
|
210
|
+
"sm": "0.25rem",
|
|
211
|
+
"md": "0.5rem",
|
|
212
|
+
"lg": "1rem",
|
|
213
|
+
"xl": "1.5rem",
|
|
214
|
+
"full": "9999px",
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
# 动画
|
|
218
|
+
design_system.animations = {
|
|
219
|
+
"fade-in": "fade-in 0.3s ease-out",
|
|
220
|
+
"slide-up": "slide-up 0.4s ease-out",
|
|
221
|
+
"scale-in": "scale-in 0.2s ease-out",
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
# 组件样式
|
|
225
|
+
design_system.components = self._generate_component_styles(design_system)
|
|
226
|
+
|
|
227
|
+
return design_system
|
|
228
|
+
|
|
229
|
+
def _generate_component_styles(self, design_system: DesignSystem) -> dict[str, dict]:
|
|
230
|
+
"""生成组件样式"""
|
|
231
|
+
return {
|
|
232
|
+
"button": {
|
|
233
|
+
"primary": {
|
|
234
|
+
"background": "var(--color-primary)",
|
|
235
|
+
"color": "var(--color-background)",
|
|
236
|
+
"padding": "var(--space-sm) var(--space-lg)",
|
|
237
|
+
"border-radius": "var(--radius-md)",
|
|
238
|
+
"font-weight": "600",
|
|
239
|
+
"transition": "all 0.2s",
|
|
240
|
+
},
|
|
241
|
+
"secondary": {
|
|
242
|
+
"background": "var(--color-secondary)",
|
|
243
|
+
"color": "var(--color-background)",
|
|
244
|
+
"padding": "var(--space-sm) var(--space-lg)",
|
|
245
|
+
"border-radius": "var(--radius-md)",
|
|
246
|
+
"font-weight": "600",
|
|
247
|
+
},
|
|
248
|
+
},
|
|
249
|
+
"card": {
|
|
250
|
+
"background": "var(--color-surface)",
|
|
251
|
+
"border": "1px solid var(--color-border)",
|
|
252
|
+
"border-radius": "var(--radius-lg)",
|
|
253
|
+
"padding": "var(--space-lg)",
|
|
254
|
+
"shadow": "var(--shadow-md)",
|
|
255
|
+
},
|
|
256
|
+
"input": {
|
|
257
|
+
"background": "var(--color-background)",
|
|
258
|
+
"border": "1px solid var(--color-border)",
|
|
259
|
+
"border-radius": "var(--radius-md)",
|
|
260
|
+
"padding": "var(--space-sm) var(--space-md)",
|
|
261
|
+
"color": "var(--color-text)",
|
|
262
|
+
},
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
def generate_documentation(
|
|
266
|
+
self,
|
|
267
|
+
design_system: DesignSystem,
|
|
268
|
+
output_dir: Path,
|
|
269
|
+
) -> list[Path]:
|
|
270
|
+
"""
|
|
271
|
+
生成设计系统文档
|
|
272
|
+
|
|
273
|
+
Args:
|
|
274
|
+
design_system: 设计系统
|
|
275
|
+
output_dir: 输出目录
|
|
276
|
+
|
|
277
|
+
Returns:
|
|
278
|
+
生成的文件列表
|
|
279
|
+
"""
|
|
280
|
+
output_dir = Path(output_dir)
|
|
281
|
+
output_dir.mkdir(exist_ok=True)
|
|
282
|
+
|
|
283
|
+
generated_files = []
|
|
284
|
+
|
|
285
|
+
# 1. CSS Variables
|
|
286
|
+
css_file = output_dir / "design-tokens.css"
|
|
287
|
+
css_file.write_text(design_system.to_css_variables(), encoding="utf-8")
|
|
288
|
+
generated_files.append(css_file)
|
|
289
|
+
|
|
290
|
+
# 2. Tailwind Config
|
|
291
|
+
tailwind_file = output_dir / "tailwind.config.json"
|
|
292
|
+
tailwind_file.write_text(
|
|
293
|
+
json.dumps(design_system.to_tailwind_config(), indent=2),
|
|
294
|
+
encoding="utf-8"
|
|
295
|
+
)
|
|
296
|
+
generated_files.append(tailwind_file)
|
|
297
|
+
|
|
298
|
+
# 3. Design System Documentation
|
|
299
|
+
docs_file = output_dir / "DESIGN_SYSTEM.md"
|
|
300
|
+
docs_content = self._generate_docs_content(design_system)
|
|
301
|
+
docs_file.write_text(docs_content, encoding="utf-8")
|
|
302
|
+
generated_files.append(docs_file)
|
|
303
|
+
|
|
304
|
+
return generated_files
|
|
305
|
+
|
|
306
|
+
def _generate_docs_content(self, design_system: DesignSystem) -> str:
|
|
307
|
+
"""生成文档内容"""
|
|
308
|
+
lines = [
|
|
309
|
+
f"# {design_system.name}",
|
|
310
|
+
"",
|
|
311
|
+
f"{design_system.description}",
|
|
312
|
+
"",
|
|
313
|
+
"## Design Tokens",
|
|
314
|
+
"",
|
|
315
|
+
"### Colors",
|
|
316
|
+
"",
|
|
317
|
+
"| Token | Value | Usage |",
|
|
318
|
+
"|-------|-------|-------|",
|
|
319
|
+
]
|
|
320
|
+
|
|
321
|
+
for name, value in design_system.colors.items():
|
|
322
|
+
lines.append(f"| `--color-{name}` | `{value}` | {self._get_color_usage(name)} |")
|
|
323
|
+
|
|
324
|
+
lines.extend([
|
|
325
|
+
"",
|
|
326
|
+
"### Typography",
|
|
327
|
+
"",
|
|
328
|
+
"| Token | Value | Usage |",
|
|
329
|
+
"|-------|-------|-------|",
|
|
330
|
+
])
|
|
331
|
+
|
|
332
|
+
for name, value in design_system.typography.items():
|
|
333
|
+
if value:
|
|
334
|
+
lines.append(f"| `--font-{name}` | `{value}` | {name.capitalize()} text |")
|
|
335
|
+
|
|
336
|
+
if design_system.aesthetic:
|
|
337
|
+
lines.extend([
|
|
338
|
+
"",
|
|
339
|
+
"## Aesthetic Direction",
|
|
340
|
+
"",
|
|
341
|
+
f"**Style**: {design_system.aesthetic.name}",
|
|
342
|
+
f"**Description**: {design_system.aesthetic.description}",
|
|
343
|
+
f"**Key Differentiator**: {design_system.aesthetic.differentiation}",
|
|
344
|
+
"",
|
|
345
|
+
"### Typography",
|
|
346
|
+
"",
|
|
347
|
+
f"- **Display**: {design_system.aesthetic.typography.display}",
|
|
348
|
+
f"- **Body**: {design_system.aesthetic.typography.body}",
|
|
349
|
+
])
|
|
350
|
+
|
|
351
|
+
return "\n".join(lines)
|
|
352
|
+
|
|
353
|
+
def _get_color_usage(self, color_name: str) -> str:
|
|
354
|
+
"""获取颜色用途"""
|
|
355
|
+
usages = {
|
|
356
|
+
"primary": "Primary actions, links, highlights",
|
|
357
|
+
"secondary": "Secondary actions, accents",
|
|
358
|
+
"accent": "Emphasis, call-to-actions",
|
|
359
|
+
"background": "Page background",
|
|
360
|
+
"surface": "Card, panel backgrounds",
|
|
361
|
+
"text": "Primary text",
|
|
362
|
+
"text-muted": "Secondary text",
|
|
363
|
+
"border": "Borders, dividers",
|
|
364
|
+
}
|
|
365
|
+
return usages.get(color_name, "General use")
|
|
366
|
+
|
|
367
|
+
def export_to_sketch(
|
|
368
|
+
self,
|
|
369
|
+
design_system: DesignSystem,
|
|
370
|
+
output_path: Path,
|
|
371
|
+
):
|
|
372
|
+
"""
|
|
373
|
+
导出为 Sketch 格式(未来实现)
|
|
374
|
+
|
|
375
|
+
Args:
|
|
376
|
+
design_system: 设计系统
|
|
377
|
+
output_path: 输出路径
|
|
378
|
+
"""
|
|
379
|
+
# TODO: 实现 Sketch 导出
|
|
380
|
+
pass
|
|
381
|
+
|
|
382
|
+
def export_to_figma(
|
|
383
|
+
self,
|
|
384
|
+
design_system: DesignSystem,
|
|
385
|
+
output_path: Path,
|
|
386
|
+
):
|
|
387
|
+
"""
|
|
388
|
+
导出为 Figma 格式(未来实现)
|
|
389
|
+
|
|
390
|
+
Args:
|
|
391
|
+
design_system: 设计系统
|
|
392
|
+
output_path: 输出路径
|
|
393
|
+
"""
|
|
394
|
+
# TODO: 实现 Figma 导出
|
|
395
|
+
pass
|