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.
Files changed (61) hide show
  1. super_dev/__init__.py +11 -0
  2. super_dev/analyzer/__init__.py +34 -0
  3. super_dev/analyzer/analyzer.py +440 -0
  4. super_dev/analyzer/detectors.py +511 -0
  5. super_dev/analyzer/models.py +285 -0
  6. super_dev/cli.py +3257 -0
  7. super_dev/config/__init__.py +11 -0
  8. super_dev/config/frontend.py +557 -0
  9. super_dev/config/manager.py +281 -0
  10. super_dev/creators/__init__.py +26 -0
  11. super_dev/creators/creator.py +134 -0
  12. super_dev/creators/document_generator.py +2473 -0
  13. super_dev/creators/frontend_builder.py +371 -0
  14. super_dev/creators/implementation_builder.py +789 -0
  15. super_dev/creators/prompt_generator.py +289 -0
  16. super_dev/creators/requirement_parser.py +354 -0
  17. super_dev/creators/spec_builder.py +195 -0
  18. super_dev/deployers/__init__.py +20 -0
  19. super_dev/deployers/cicd.py +1269 -0
  20. super_dev/deployers/delivery.py +229 -0
  21. super_dev/deployers/migration.py +1032 -0
  22. super_dev/design/__init__.py +74 -0
  23. super_dev/design/aesthetics.py +530 -0
  24. super_dev/design/charts.py +396 -0
  25. super_dev/design/codegen.py +379 -0
  26. super_dev/design/engine.py +528 -0
  27. super_dev/design/generator.py +395 -0
  28. super_dev/design/landing.py +422 -0
  29. super_dev/design/tech_stack.py +524 -0
  30. super_dev/design/tokens.py +269 -0
  31. super_dev/design/ux_guide.py +391 -0
  32. super_dev/exceptions.py +119 -0
  33. super_dev/experts/__init__.py +19 -0
  34. super_dev/experts/service.py +161 -0
  35. super_dev/integrations/__init__.py +7 -0
  36. super_dev/integrations/manager.py +264 -0
  37. super_dev/orchestrator/__init__.py +12 -0
  38. super_dev/orchestrator/engine.py +958 -0
  39. super_dev/orchestrator/experts.py +423 -0
  40. super_dev/orchestrator/knowledge.py +352 -0
  41. super_dev/orchestrator/quality.py +356 -0
  42. super_dev/reviewers/__init__.py +17 -0
  43. super_dev/reviewers/code_review.py +471 -0
  44. super_dev/reviewers/quality_gate.py +964 -0
  45. super_dev/reviewers/redteam.py +881 -0
  46. super_dev/skills/__init__.py +7 -0
  47. super_dev/skills/manager.py +307 -0
  48. super_dev/specs/__init__.py +44 -0
  49. super_dev/specs/generator.py +264 -0
  50. super_dev/specs/manager.py +428 -0
  51. super_dev/specs/models.py +348 -0
  52. super_dev/specs/validator.py +415 -0
  53. super_dev/utils/__init__.py +11 -0
  54. super_dev/utils/logger.py +133 -0
  55. super_dev/web/api.py +1402 -0
  56. super_dev-2.0.0.dist-info/METADATA +252 -0
  57. super_dev-2.0.0.dist-info/RECORD +61 -0
  58. super_dev-2.0.0.dist-info/WHEEL +5 -0
  59. super_dev-2.0.0.dist-info/entry_points.txt +2 -0
  60. super_dev-2.0.0.dist-info/licenses/LICENSE +21 -0
  61. super_dev-2.0.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,285 @@
1
+ """
2
+ Super Dev 分析器数据模型
3
+ """
4
+
5
+ from dataclasses import dataclass, field
6
+ from enum import Enum
7
+ from pathlib import Path
8
+ from typing import Literal
9
+
10
+
11
+ class ProjectCategory(Enum):
12
+ """项目分类"""
13
+
14
+ FRONTEND = "frontend"
15
+ BACKEND = "backend"
16
+ FULLSTACK = "fullstack"
17
+ MOBILE = "mobile"
18
+ DESKTOP = "desktop"
19
+ SERVERLESS = "serverless"
20
+ UNKNOWN = "unknown"
21
+
22
+
23
+ class FrameworkType(Enum):
24
+ """框架类型"""
25
+
26
+ # 前端框架
27
+ REACT = "react"
28
+ VUE = "vue"
29
+ ANGULAR = "angular"
30
+ SVELTE = "svelte"
31
+ NEXTJS = "nextjs"
32
+ NUXT = "nuxt"
33
+ REMIX = "remix"
34
+
35
+ # 后端框架
36
+ EXPRESS = "express"
37
+ FASTAPI = "fastapi"
38
+ DJANGO = "django"
39
+ FLASK = "flask"
40
+ SPRING = "spring"
41
+ RAILS = "rails"
42
+ GIN = "gin"
43
+ ECHO = "echo"
44
+
45
+ # 移动框架
46
+ REACT_NATIVE = "react_native"
47
+ FLUTTER = "flutter"
48
+ IONIC = "ionic"
49
+
50
+ # 桌面框架
51
+ ELECTRON = "electron"
52
+ TAURI = "tauri"
53
+
54
+ UNKNOWN = "unknown"
55
+
56
+
57
+ @dataclass
58
+ class Dependency:
59
+ """依赖信息"""
60
+
61
+ name: str
62
+ version: str = ""
63
+ type: Literal["prod", "dev", "peer"] = "prod"
64
+ description: str = ""
65
+ homepage: str = ""
66
+ licenses: str = ""
67
+
68
+ def __str__(self) -> str:
69
+ if self.version:
70
+ return f"{self.name}@{self.version}"
71
+ return self.name
72
+
73
+
74
+ @dataclass
75
+ class TechStack:
76
+ """技术栈信息"""
77
+
78
+ category: ProjectCategory
79
+ language: str
80
+ framework: FrameworkType | str
81
+ ui_library: str = ""
82
+ state_management: str = ""
83
+ build_tool: str = ""
84
+ testing_framework: str = ""
85
+ dependencies: list[Dependency] = field(default_factory=list)
86
+
87
+ def to_dict(self) -> dict:
88
+ """转换为字典"""
89
+ # 处理 framework 可能是字符串或枚举
90
+ framework_value = (
91
+ self.framework.value
92
+ if isinstance(self.framework, FrameworkType)
93
+ else self.framework
94
+ )
95
+
96
+ return {
97
+ "category": self.category.value,
98
+ "language": self.language,
99
+ "framework": framework_value,
100
+ "ui_library": self.ui_library,
101
+ "state_management": self.state_management,
102
+ "build_tool": self.build_tool,
103
+ "testing_framework": self.testing_framework,
104
+ "dependencies": [str(d) for d in self.dependencies],
105
+ }
106
+
107
+
108
+ class PatternType(Enum):
109
+ """设计模式类型"""
110
+
111
+ # 创建型模式
112
+ SINGLETON = "singleton"
113
+ FACTORY = "factory"
114
+ BUILDER = "builder"
115
+ PROTOTYPE = "prototype"
116
+
117
+ # 结构型模式
118
+ ADAPTER = "adapter"
119
+ DECORATOR = "decorator"
120
+ FACADE = "facade"
121
+ PROXY = "proxy"
122
+ COMPOSITE = "composite"
123
+ BRIDGE = "bridge"
124
+ FLYWEIGHT = "flyweight"
125
+
126
+ # 行为型模式
127
+ STRATEGY = "strategy"
128
+ OBSERVER = "observer"
129
+ COMMAND = "command"
130
+ TEMPLATE_METHOD = "template_method"
131
+ CHAIN_OF_RESPONSIBILITY = "chain_of_responsibility"
132
+ ITERATOR = "iterator"
133
+ MEDIATOR = "mediator"
134
+ MEMENTO = "memento"
135
+ STATE = "state"
136
+ VISITOR = "visitor"
137
+
138
+
139
+ class ArchitecturePattern(Enum):
140
+ """架构模式"""
141
+
142
+ LAYERED = "layered" # 分层架构
143
+ MVC = "mvc" # MVC
144
+ MVP = "mvp" # MVP
145
+ MVVM = "mvvm" # MVVM
146
+ CLEAN_ARCHITECTURE = "clean_architecture" # 整洁架构
147
+ HEXAGONAL = "hexagonal" # 六边形架构
148
+ MICROSERVICES = "microservices" # 微服务
149
+ SERVERLESS = "serverless" # 无服务器
150
+ EVENT_DRIVEN = "event_driven" # 事件驱动
151
+ PLUGIN = "plugin" # 插件架构
152
+
153
+
154
+ @dataclass
155
+ class DesignPattern:
156
+ """设计模式信息"""
157
+
158
+ name: PatternType
159
+ location: Path # 使用该模式的文件路径
160
+ description: str = ""
161
+ confidence: float = 1.0 # 识别置信度 0-1
162
+
163
+ def to_dict(self) -> dict:
164
+ """转换为字典"""
165
+ return {
166
+ "name": self.name.value,
167
+ "location": str(self.location),
168
+ "description": self.description,
169
+ "confidence": self.confidence,
170
+ }
171
+
172
+
173
+ @dataclass
174
+ class ArchitectureReport:
175
+ """架构分析报告"""
176
+
177
+ project_path: Path
178
+ category: ProjectCategory
179
+ tech_stack: TechStack
180
+ architecture_pattern: ArchitecturePattern | None = None
181
+ design_patterns: list[DesignPattern] = field(default_factory=list)
182
+ directory_structure: dict = field(default_factory=dict)
183
+ file_count: int = 0
184
+ total_lines: int = 0
185
+ languages_used: dict[str, int] = field(default_factory=dict) # 语言 -> 行数
186
+
187
+ def to_dict(self) -> dict:
188
+ """转换为字典"""
189
+ return {
190
+ "project_path": str(self.project_path),
191
+ "category": self.category.value,
192
+ "tech_stack": self.tech_stack.to_dict(),
193
+ "architecture_pattern": (
194
+ self.architecture_pattern.value if self.architecture_pattern else None
195
+ ),
196
+ "design_patterns": [p.to_dict() for p in self.design_patterns],
197
+ "directory_structure": self.directory_structure,
198
+ "file_count": self.file_count,
199
+ "total_lines": self.total_lines,
200
+ "languages_used": self.languages_used,
201
+ }
202
+
203
+ def to_markdown(self) -> str:
204
+ """生成 Markdown 报告"""
205
+ # 处理 framework 可能是字符串或枚举
206
+ framework_value = (
207
+ self.tech_stack.framework.value
208
+ if isinstance(self.tech_stack.framework, FrameworkType)
209
+ else self.tech_stack.framework
210
+ )
211
+
212
+ lines = [
213
+ "# 项目架构分析报告",
214
+ "",
215
+ f"**项目路径**: `{self.project_path}`",
216
+ f"**项目类型**: {self.category.value}",
217
+ "",
218
+ "## 技术栈",
219
+ "",
220
+ f"- **编程语言**: {self.tech_stack.language}",
221
+ f"- **框架**: {framework_value}",
222
+ ]
223
+
224
+ if self.tech_stack.ui_library:
225
+ lines.append(f"- **UI 库**: {self.tech_stack.ui_library}")
226
+ if self.tech_stack.state_management:
227
+ lines.append(f"- **状态管理**: {self.tech_stack.state_management}")
228
+ if self.tech_stack.build_tool:
229
+ lines.append(f"- **构建工具**: {self.tech_stack.build_tool}")
230
+ if self.tech_stack.testing_framework:
231
+ lines.append(f"- **测试框架**: {self.tech_stack.testing_framework}")
232
+
233
+ if self.architecture_pattern:
234
+ lines.extend([
235
+ "",
236
+ "## 架构模式",
237
+ "",
238
+ f"识别到: **{self.architecture_pattern.value}**",
239
+ ])
240
+
241
+ if self.design_patterns:
242
+ lines.extend([
243
+ "",
244
+ "## 设计模式",
245
+ "",
246
+ ])
247
+ for pattern in self.design_patterns:
248
+ lines.append(f"- **{pattern.name.value}**: `{pattern.location}`")
249
+ if pattern.description:
250
+ lines.append(f" - {pattern.description}")
251
+
252
+ lines.extend([
253
+ "",
254
+ "## 项目统计",
255
+ "",
256
+ f"- **文件数量**: {self.file_count}",
257
+ f"- **代码行数**: {self.total_lines:,}",
258
+ ])
259
+
260
+ if self.languages_used:
261
+ lines.append("- **语言分布**:")
262
+ for lang, count in sorted(
263
+ self.languages_used.items(), key=lambda x: x[1], reverse=True
264
+ ):
265
+ percentage = (count / self.total_lines * 100) if self.total_lines else 0
266
+ lines.append(f" - {lang}: {count:,} 行 ({percentage:.1f}%)")
267
+
268
+ if self.tech_stack.dependencies:
269
+ lines.extend([
270
+ "",
271
+ f"## 主要依赖 ({len(self.tech_stack.dependencies)})",
272
+ "",
273
+ ])
274
+ for dep in self.tech_stack.dependencies[:20]: # 只显示前20个
275
+ lines.append(f"- {dep}")
276
+
277
+ if len(self.tech_stack.dependencies) > 20:
278
+ lines.append(f"- ... 还有 {len(self.tech_stack.dependencies) - 20} 个依赖")
279
+
280
+ lines.append("")
281
+ return "\n".join(lines)
282
+
283
+
284
+ # 项目类型别名(向后兼容)
285
+ ProjectType = ProjectCategory