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
super_dev/exceptions.py
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"""
|
|
2
|
+
开发:Excellent(11964948@qq.com)
|
|
3
|
+
功能:自定义异常类
|
|
4
|
+
作用:提供结构化的异常处理体系
|
|
5
|
+
创建时间:2025-01-29
|
|
6
|
+
最后修改:2025-01-29
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from typing import Any
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class SuperDevError(Exception):
|
|
13
|
+
"""Super Dev 基础异常类"""
|
|
14
|
+
|
|
15
|
+
def __init__(
|
|
16
|
+
self, message: str, code: str | None = None, details: dict[str, Any] | None = None
|
|
17
|
+
):
|
|
18
|
+
self.message = message
|
|
19
|
+
self.code = code or self.__class__.__name__
|
|
20
|
+
self.details = details or {}
|
|
21
|
+
super().__init__(self.message)
|
|
22
|
+
|
|
23
|
+
def __str__(self):
|
|
24
|
+
if self.details:
|
|
25
|
+
return f"[{self.code}] {self.message} - {self.details}"
|
|
26
|
+
return f"[{self.code}] {self.message}"
|
|
27
|
+
|
|
28
|
+
def to_dict(self) -> dict[str, Any]:
|
|
29
|
+
"""转换为字典格式"""
|
|
30
|
+
return {"error": self.code, "message": self.message, "details": self.details}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
# === 工作流异常 ===
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class WorkflowError(SuperDevError):
|
|
37
|
+
"""工作流执行异常"""
|
|
38
|
+
|
|
39
|
+
pass
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class PhaseExecutionError(WorkflowError):
|
|
43
|
+
"""阶段执行异常"""
|
|
44
|
+
|
|
45
|
+
def __init__(self, phase: str, message: str, details: dict[str, Any] | None = None):
|
|
46
|
+
super().__init__(message, "PHASE_EXECUTION_ERROR", details)
|
|
47
|
+
self.phase = phase
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class QualityGateError(WorkflowError):
|
|
51
|
+
"""质量门禁检查失败"""
|
|
52
|
+
|
|
53
|
+
def __init__(self, score: float, threshold: float, details: dict[str, Any] | None = None):
|
|
54
|
+
message = f"质量分数 {score:.1f} 低于阈值 {threshold:.1f}"
|
|
55
|
+
super().__init__(message, "QUALITY_GATE_ERROR", details)
|
|
56
|
+
self.score = score
|
|
57
|
+
self.threshold = threshold
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
# === 配置异常 ===
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
class ConfigurationError(SuperDevError):
|
|
64
|
+
"""配置异常"""
|
|
65
|
+
|
|
66
|
+
pass
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
class ValidationError(SuperDevError):
|
|
70
|
+
"""验证异常"""
|
|
71
|
+
|
|
72
|
+
def __init__(self, field: str, message: str, details: dict[str, Any] | None = None):
|
|
73
|
+
super().__init__(message, "VALIDATION_ERROR", details)
|
|
74
|
+
self.field = field
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
# === 外部服务异常 ===
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
class ExternalServiceError(SuperDevError):
|
|
81
|
+
"""外部服务调用异常"""
|
|
82
|
+
|
|
83
|
+
def __init__(
|
|
84
|
+
self,
|
|
85
|
+
service: str,
|
|
86
|
+
message: str,
|
|
87
|
+
status_code: int | None = None,
|
|
88
|
+
details: dict[str, Any] | None = None,
|
|
89
|
+
):
|
|
90
|
+
super().__init__(message, "EXTERNAL_SERVICE_ERROR", details)
|
|
91
|
+
self.service = service
|
|
92
|
+
self.status_code = status_code
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
class OpenAIError(ExternalServiceError):
|
|
96
|
+
"""OpenAI API调用异常"""
|
|
97
|
+
|
|
98
|
+
def __init__(self, message: str, details: dict[str, Any] | None = None):
|
|
99
|
+
super().__init__("openai", message, None, details)
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
# === 文件系统异常 ===
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
class FileSystemError(SuperDevError):
|
|
106
|
+
"""文件系统操作异常"""
|
|
107
|
+
|
|
108
|
+
def __init__(self, path: str, message: str, details: dict[str, Any] | None = None):
|
|
109
|
+
super().__init__(message, "FILESYSTEM_ERROR", details)
|
|
110
|
+
self.path = path
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
# === 输入输出异常 ===
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
class IOError(SuperDevError):
|
|
117
|
+
"""输入输出异常"""
|
|
118
|
+
|
|
119
|
+
pass
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"""专家建议服务导出。"""
|
|
2
|
+
|
|
3
|
+
from .service import (
|
|
4
|
+
has_expert,
|
|
5
|
+
list_expert_advice_history,
|
|
6
|
+
list_experts,
|
|
7
|
+
read_expert_advice,
|
|
8
|
+
render_expert_advice_markdown,
|
|
9
|
+
save_expert_advice,
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
__all__ = [
|
|
13
|
+
"list_experts",
|
|
14
|
+
"has_expert",
|
|
15
|
+
"render_expert_advice_markdown",
|
|
16
|
+
"save_expert_advice",
|
|
17
|
+
"list_expert_advice_history",
|
|
18
|
+
"read_expert_advice",
|
|
19
|
+
]
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"""专家建议服务。"""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from datetime import datetime
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
_EXPERT_META: list[dict[str, str]] = [
|
|
9
|
+
{"id": "PM", "name": "产品经理", "description": "需求分析、PRD编写"},
|
|
10
|
+
{"id": "ARCHITECT", "name": "架构师", "description": "系统设计、技术选型"},
|
|
11
|
+
{"id": "UI", "name": "UI设计师", "description": "视觉设计、设计规范"},
|
|
12
|
+
{"id": "UX", "name": "UX设计师", "description": "交互设计、用户体验"},
|
|
13
|
+
{"id": "SECURITY", "name": "安全专家", "description": "安全审查、漏洞检测"},
|
|
14
|
+
{"id": "CODE", "name": "开发专家", "description": "代码实现、最佳实践"},
|
|
15
|
+
{"id": "DBA", "name": "数据库专家", "description": "数据库设计、优化"},
|
|
16
|
+
{"id": "QA", "name": "测试专家", "description": "质量保证、测试策略"},
|
|
17
|
+
{"id": "DEVOPS", "name": "运维专家", "description": "部署、CI/CD"},
|
|
18
|
+
{"id": "RCA", "name": "故障侦探", "description": "根因分析、复盘改进"},
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
_EXPERT_PLAYBOOKS: dict[str, list[str]] = {
|
|
23
|
+
"PM": [
|
|
24
|
+
"明确目标用户、核心场景与北极星指标。",
|
|
25
|
+
"将需求拆分为 MUST/SHOULD/COULD,并定义验收标准。",
|
|
26
|
+
"补充边界条件与失败场景,避免需求歧义。",
|
|
27
|
+
],
|
|
28
|
+
"ARCHITECT": [
|
|
29
|
+
"先定义系统边界与模块职责,再确定通信契约。",
|
|
30
|
+
"对关键链路做容量估算与扩展策略(缓存/队列/分片)。",
|
|
31
|
+
"沉淀可演进架构决策记录(ADR),降低后续返工风险。",
|
|
32
|
+
],
|
|
33
|
+
"UI": [
|
|
34
|
+
"统一设计 token(颜色、间距、字体)并固化到组件层。",
|
|
35
|
+
"优先实现高频核心页面,保证视觉一致性和可读性。",
|
|
36
|
+
"在桌面与移动端分别验证层级、对比度和可触达性。",
|
|
37
|
+
],
|
|
38
|
+
"UX": [
|
|
39
|
+
"梳理关键任务流并减少不必要步骤。",
|
|
40
|
+
"定义空状态、错误态与加载态,避免流程中断。",
|
|
41
|
+
"通过可观测埋点验证转化漏斗并持续迭代。",
|
|
42
|
+
],
|
|
43
|
+
"SECURITY": [
|
|
44
|
+
"建立威胁模型并优先修复高危攻击面。",
|
|
45
|
+
"对认证、授权、输入校验和密钥管理做最小权限设计。",
|
|
46
|
+
"将 SAST/依赖漏洞扫描纳入 CI 阶段阻断高风险变更。",
|
|
47
|
+
],
|
|
48
|
+
"CODE": [
|
|
49
|
+
"保持单一职责与清晰边界,减少隐式耦合。",
|
|
50
|
+
"核心逻辑补充单元测试和回归测试用例。",
|
|
51
|
+
"对异常处理、日志与可观测性做统一约束。",
|
|
52
|
+
],
|
|
53
|
+
"DBA": [
|
|
54
|
+
"先建模实体关系,再补充索引和约束策略。",
|
|
55
|
+
"对高频查询设计覆盖索引并验证执行计划。",
|
|
56
|
+
"迁移脚本确保可回滚,发布时采用灰度策略。",
|
|
57
|
+
],
|
|
58
|
+
"QA": [
|
|
59
|
+
"按风险优先级制定测试策略(冒烟/回归/性能)。",
|
|
60
|
+
"建立关键路径自动化测试并接入质量门禁。",
|
|
61
|
+
"输出缺陷分级和修复 SLA,形成闭环。",
|
|
62
|
+
],
|
|
63
|
+
"DEVOPS": [
|
|
64
|
+
"统一环境配置与密钥管理,减少环境漂移。",
|
|
65
|
+
"构建 CI/CD 流水线并开启发布审计与回滚策略。",
|
|
66
|
+
"完善监控告警与容量基线,保障上线稳定性。",
|
|
67
|
+
],
|
|
68
|
+
"RCA": [
|
|
69
|
+
"先确认用户影响范围,再聚焦首个异常时间点。",
|
|
70
|
+
"使用时间线 + 5 Whys 还原根因链路。",
|
|
71
|
+
"输出可执行改进项并设置验证指标防止复发。",
|
|
72
|
+
],
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def list_experts() -> list[dict[str, str]]:
|
|
77
|
+
return list(_EXPERT_META)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def has_expert(expert_id: str) -> bool:
|
|
81
|
+
return expert_id in _EXPERT_PLAYBOOKS
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def render_expert_advice_markdown(expert_id: str, prompt: str = "") -> str:
|
|
85
|
+
suggestions = _EXPERT_PLAYBOOKS.get(expert_id, [])
|
|
86
|
+
lines = [
|
|
87
|
+
f"# {expert_id} 专家建议",
|
|
88
|
+
"",
|
|
89
|
+
f"**输入问题**: {prompt or '(未提供,输出通用建议)'}",
|
|
90
|
+
"",
|
|
91
|
+
"## 建议清单",
|
|
92
|
+
"",
|
|
93
|
+
]
|
|
94
|
+
for idx, item in enumerate(suggestions, 1):
|
|
95
|
+
lines.append(f"{idx}. {item}")
|
|
96
|
+
lines.extend(
|
|
97
|
+
[
|
|
98
|
+
"",
|
|
99
|
+
"## 下一步执行",
|
|
100
|
+
"",
|
|
101
|
+
"1. 将建议映射到当前 Spec 或任务清单。",
|
|
102
|
+
"2. 标注优先级并安排负责人。",
|
|
103
|
+
"3. 完成后运行 `super-dev quality --type all` 复核。",
|
|
104
|
+
"",
|
|
105
|
+
]
|
|
106
|
+
)
|
|
107
|
+
return "\n".join(lines)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def save_expert_advice(project_dir: Path, expert_id: str, prompt: str = "") -> tuple[Path, str]:
|
|
111
|
+
project_dir = Path(project_dir).resolve()
|
|
112
|
+
output_dir = project_dir / "output"
|
|
113
|
+
output_dir.mkdir(parents=True, exist_ok=True)
|
|
114
|
+
|
|
115
|
+
content = render_expert_advice_markdown(expert_id=expert_id, prompt=prompt)
|
|
116
|
+
file_path = output_dir / f"expert-{expert_id.lower()}-advice.md"
|
|
117
|
+
file_path.write_text(content, encoding="utf-8")
|
|
118
|
+
return file_path, content
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
def list_expert_advice_history(project_dir: Path, limit: int = 20) -> list[dict[str, str]]:
|
|
122
|
+
project_dir = Path(project_dir).resolve()
|
|
123
|
+
output_dir = project_dir / "output"
|
|
124
|
+
if not output_dir.exists():
|
|
125
|
+
return []
|
|
126
|
+
|
|
127
|
+
items: list[dict[str, str]] = []
|
|
128
|
+
files = sorted(
|
|
129
|
+
output_dir.glob("expert-*-advice.md"),
|
|
130
|
+
key=lambda p: p.stat().st_mtime,
|
|
131
|
+
reverse=True,
|
|
132
|
+
)
|
|
133
|
+
for file_path in files[:limit]:
|
|
134
|
+
name = file_path.name
|
|
135
|
+
expert_id = name.removeprefix("expert-").removesuffix("-advice.md").upper()
|
|
136
|
+
items.append(
|
|
137
|
+
{
|
|
138
|
+
"file_name": name,
|
|
139
|
+
"file_path": str(file_path),
|
|
140
|
+
"expert_id": expert_id,
|
|
141
|
+
"updated_at": datetime.fromtimestamp(file_path.stat().st_mtime).isoformat(),
|
|
142
|
+
}
|
|
143
|
+
)
|
|
144
|
+
return items
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
def read_expert_advice(project_dir: Path, file_name: str) -> tuple[Path, str]:
|
|
148
|
+
project_dir = Path(project_dir).resolve()
|
|
149
|
+
output_dir = project_dir / "output"
|
|
150
|
+
if "/" in file_name or "\\" in file_name:
|
|
151
|
+
raise ValueError("invalid file name")
|
|
152
|
+
if not (file_name.startswith("expert-") and file_name.endswith("-advice.md")):
|
|
153
|
+
raise ValueError("invalid file name")
|
|
154
|
+
|
|
155
|
+
file_path = (output_dir / file_name).resolve()
|
|
156
|
+
if not file_path.exists():
|
|
157
|
+
raise FileNotFoundError(file_name)
|
|
158
|
+
if output_dir.resolve() not in file_path.parents:
|
|
159
|
+
raise ValueError("invalid file path")
|
|
160
|
+
|
|
161
|
+
return file_path, file_path.read_text(encoding="utf-8")
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
"""
|
|
2
|
+
多平台 AI Coding 工具集成管理器
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
|
|
7
|
+
from dataclasses import dataclass
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@dataclass
|
|
12
|
+
class IntegrationTarget:
|
|
13
|
+
name: str
|
|
14
|
+
description: str
|
|
15
|
+
files: list[str]
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class IntegrationManager:
|
|
19
|
+
"""为不同 AI Coding 平台生成集成配置"""
|
|
20
|
+
|
|
21
|
+
TARGETS: dict[str, IntegrationTarget] = {
|
|
22
|
+
"claude-code": IntegrationTarget(
|
|
23
|
+
name="claude-code",
|
|
24
|
+
description="Claude Code CLI 深度集成",
|
|
25
|
+
files=[".claude/CLAUDE.md"],
|
|
26
|
+
),
|
|
27
|
+
"codex-cli": IntegrationTarget(
|
|
28
|
+
name="codex-cli",
|
|
29
|
+
description="Codex CLI 项目上下文注入",
|
|
30
|
+
files=[".codex/AGENTS.md"],
|
|
31
|
+
),
|
|
32
|
+
"opencode": IntegrationTarget(
|
|
33
|
+
name="opencode",
|
|
34
|
+
description="OpenCode CLI 项目规则注入",
|
|
35
|
+
files=[".opencode/AGENTS.md"],
|
|
36
|
+
),
|
|
37
|
+
"cursor": IntegrationTarget(
|
|
38
|
+
name="cursor",
|
|
39
|
+
description="Cursor IDE 规则注入",
|
|
40
|
+
files=[".cursorrules"],
|
|
41
|
+
),
|
|
42
|
+
"qoder": IntegrationTarget(
|
|
43
|
+
name="qoder",
|
|
44
|
+
description="Qoder IDE 规则注入",
|
|
45
|
+
files=[".qoder/rules.md"],
|
|
46
|
+
),
|
|
47
|
+
"trae": IntegrationTarget(
|
|
48
|
+
name="trae",
|
|
49
|
+
description="Trae IDE 规则注入",
|
|
50
|
+
files=[".trae/rules.md"],
|
|
51
|
+
),
|
|
52
|
+
"codebuddy": IntegrationTarget(
|
|
53
|
+
name="codebuddy",
|
|
54
|
+
description="CodeBuddy IDE 规则注入",
|
|
55
|
+
files=[".codebuddy/rules.md"],
|
|
56
|
+
),
|
|
57
|
+
"antigravity": IntegrationTarget(
|
|
58
|
+
name="antigravity",
|
|
59
|
+
description="Antigravity IDE 工作流集成(.agents/workflows/)",
|
|
60
|
+
files=[".agents/workflows/super-dev.md"],
|
|
61
|
+
),
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
def __init__(self, project_dir: Path):
|
|
65
|
+
self.project_dir = Path(project_dir).resolve()
|
|
66
|
+
self.templates_dir = self.project_dir / "templates"
|
|
67
|
+
|
|
68
|
+
def list_targets(self) -> list[IntegrationTarget]:
|
|
69
|
+
return list(self.TARGETS.values())
|
|
70
|
+
|
|
71
|
+
def setup(self, target: str, force: bool = False) -> list[Path]:
|
|
72
|
+
if target not in self.TARGETS:
|
|
73
|
+
raise ValueError(f"Unsupported target: {target}")
|
|
74
|
+
|
|
75
|
+
written_files: list[Path] = []
|
|
76
|
+
integration = self.TARGETS[target]
|
|
77
|
+
for relative in integration.files:
|
|
78
|
+
file_path = self.project_dir / relative
|
|
79
|
+
if file_path.exists() and not force:
|
|
80
|
+
continue
|
|
81
|
+
file_path.parent.mkdir(parents=True, exist_ok=True)
|
|
82
|
+
content = self._build_content(target=target)
|
|
83
|
+
file_path.write_text(content, encoding="utf-8")
|
|
84
|
+
written_files.append(file_path)
|
|
85
|
+
|
|
86
|
+
return written_files
|
|
87
|
+
|
|
88
|
+
def setup_all(self, force: bool = False) -> dict[str, list[Path]]:
|
|
89
|
+
result: dict[str, list[Path]] = {}
|
|
90
|
+
for target in self.TARGETS:
|
|
91
|
+
result[target] = self.setup(target=target, force=force)
|
|
92
|
+
return result
|
|
93
|
+
|
|
94
|
+
def _build_content(self, target: str) -> str:
|
|
95
|
+
if target == "cursor":
|
|
96
|
+
cursor_template = self.templates_dir / ".cursorrules.template"
|
|
97
|
+
if cursor_template.exists():
|
|
98
|
+
body = cursor_template.read_text(encoding="utf-8")
|
|
99
|
+
return (
|
|
100
|
+
f"{body}\n\n"
|
|
101
|
+
"# Super Dev Pipeline Rules\n"
|
|
102
|
+
"- Always read output/*-prd.md, output/*-architecture.md, output/*-uiux.md first.\n"
|
|
103
|
+
"- Execute frontend-first delivery before backend/database tasks.\n"
|
|
104
|
+
"- Meet the active quality gate threshold before release.\n"
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
if target == "antigravity":
|
|
108
|
+
return self._antigravity_workflow_rules()
|
|
109
|
+
|
|
110
|
+
if target in {"qoder", "trae", "codebuddy"}:
|
|
111
|
+
return self._generic_ide_rules(target)
|
|
112
|
+
|
|
113
|
+
if target in {"codex-cli", "opencode"}:
|
|
114
|
+
return self._generic_cli_rules(target)
|
|
115
|
+
|
|
116
|
+
if target == "claude-code":
|
|
117
|
+
return self._claude_rules()
|
|
118
|
+
|
|
119
|
+
return self._generic_cli_rules(target)
|
|
120
|
+
|
|
121
|
+
def _generic_cli_rules(self, target: str) -> str:
|
|
122
|
+
return (
|
|
123
|
+
f"# Super Dev Integration for {target}\n\n"
|
|
124
|
+
"Use Super Dev generated artifacts as source of truth.\n\n"
|
|
125
|
+
"## Required Context\n"
|
|
126
|
+
"- output/*-prd.md\n"
|
|
127
|
+
"- output/*-architecture.md\n"
|
|
128
|
+
"- output/*-uiux.md\n"
|
|
129
|
+
"- output/*-execution-plan.md\n"
|
|
130
|
+
"- .super-dev/changes/*/tasks.md\n\n"
|
|
131
|
+
"## Execution Order\n"
|
|
132
|
+
"1. Implement frontend modules first\n"
|
|
133
|
+
"2. Implement backend APIs and data layer\n"
|
|
134
|
+
"3. Run tests and quality gate\n"
|
|
135
|
+
"4. Prepare CI/CD and release\n"
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
def _generic_ide_rules(self, target: str) -> str:
|
|
139
|
+
return (
|
|
140
|
+
f"# Super Dev IDE Rules ({target})\n\n"
|
|
141
|
+
"## Working Agreement\n"
|
|
142
|
+
"- Read generated documents before coding.\n"
|
|
143
|
+
"- Respect Spec tasks sequence.\n"
|
|
144
|
+
"- Keep architecture and UIUX consistency.\n\n"
|
|
145
|
+
"## Delivery Criteria\n"
|
|
146
|
+
"- Frontend can be demonstrated early.\n"
|
|
147
|
+
"- Backend and migration scripts match specs.\n"
|
|
148
|
+
"- Security/performance checks are resolved.\n"
|
|
149
|
+
"- Quality gate threshold is met for the current scenario.\n"
|
|
150
|
+
)
|
|
151
|
+
|
|
152
|
+
def _claude_rules(self) -> str:
|
|
153
|
+
return (
|
|
154
|
+
"# Super Dev Claude Code Integration\n\n"
|
|
155
|
+
"This project uses a pipeline-driven development model.\n\n"
|
|
156
|
+
"## Before coding\n"
|
|
157
|
+
"1. Read output/*-prd.md\n"
|
|
158
|
+
"2. Read output/*-architecture.md\n"
|
|
159
|
+
"3. Read output/*-uiux.md\n"
|
|
160
|
+
"4. Read output/*-execution-plan.md\n"
|
|
161
|
+
"5. Follow .super-dev/changes/*/tasks.md\n\n"
|
|
162
|
+
"## Output Quality\n"
|
|
163
|
+
"- Keep security/performance constraints from red-team report.\n"
|
|
164
|
+
"- Ensure quality gate threshold is met before merge.\n"
|
|
165
|
+
)
|
|
166
|
+
|
|
167
|
+
def _antigravity_workflow_rules(self) -> str:
|
|
168
|
+
"""
|
|
169
|
+
生成 Antigravity IDE 专属工作流配置。
|
|
170
|
+
文件写入 .agents/workflows/super-dev.md,
|
|
171
|
+
格式遵循 Antigravity Skill YAML frontmatter + markdown 规范。
|
|
172
|
+
"""
|
|
173
|
+
return """\
|
|
174
|
+
---
|
|
175
|
+
description: Super Dev 流水线式 AI Coding 辅助工作流 - 从需求到交付的 12 阶段自动化流程
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
# Super Dev Pipeline Workflow
|
|
179
|
+
|
|
180
|
+
## 角色定义
|
|
181
|
+
|
|
182
|
+
本工作流激活 10 位专家角色自动协作:
|
|
183
|
+
|
|
184
|
+
| 专家 | 职责 |
|
|
185
|
+
|:---|:---|
|
|
186
|
+
| PM | 需求分析、PRD 生成、用户故事 |
|
|
187
|
+
| ARCHITECT | 架构设计、技术选型、API 契约 |
|
|
188
|
+
| UI/UX | 设计系统、交互规范、原型设计 |
|
|
189
|
+
| SECURITY | 红队审查、OWASP 检测、威胁建模 |
|
|
190
|
+
| CODE | 代码实现、最佳实践、代码审查 |
|
|
191
|
+
| DBA | 数据库设计、迁移脚本、索引优化 |
|
|
192
|
+
| QA | 测试策略、质量门禁、覆盖率要求 |
|
|
193
|
+
| DEVOPS | CI/CD 配置、容器化、监控告警 |
|
|
194
|
+
| RCA | 根因分析、故障复盘、风险识别 |
|
|
195
|
+
|
|
196
|
+
## 工作流步骤
|
|
197
|
+
|
|
198
|
+
### 前置:读取必备文档
|
|
199
|
+
|
|
200
|
+
在写任何一行代码前,必须先读取:
|
|
201
|
+
|
|
202
|
+
1. `output/*-prd.md` — 产品需求和验收标准
|
|
203
|
+
2. `output/*-architecture.md` — 技术栈和 API 设计
|
|
204
|
+
3. `output/*-uiux.md` — 设计系统和组件规范
|
|
205
|
+
4. `output/*-execution-plan.md` — 阶段任务路线图
|
|
206
|
+
5. `.super-dev/changes/*/tasks.md` — 具体实现任务清单
|
|
207
|
+
|
|
208
|
+
### 第 0 阶段:需求增强
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
super-dev pipeline "你的需求描述" --platform web --frontend react --backend node
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
- 解析自然语言需求,注入领域知识库
|
|
215
|
+
- 联网检索补充市场和技术背景
|
|
216
|
+
- 输出结构化需求蓝图
|
|
217
|
+
|
|
218
|
+
### 第 1 阶段:专业文档生成
|
|
219
|
+
|
|
220
|
+
自动生成:
|
|
221
|
+
- `output/*-prd.md` — PRD(产品需求文档)
|
|
222
|
+
- `output/*-architecture.md` — 架构设计文档
|
|
223
|
+
- `output/*-uiux.md` — UI/UX 设计文档
|
|
224
|
+
|
|
225
|
+
### 第 2-4 阶段:骨架构建
|
|
226
|
+
|
|
227
|
+
- 前端可演示骨架(前端先行原则)
|
|
228
|
+
- Spec 规范(OpenSpec 风格)
|
|
229
|
+
- 前后端实现骨架 + API 契约
|
|
230
|
+
|
|
231
|
+
### 第 5-6 阶段:质量保障
|
|
232
|
+
|
|
233
|
+
- 红队审查(安全 + 性能 + 架构)
|
|
234
|
+
- 质量门禁(统一标准:80+)
|
|
235
|
+
|
|
236
|
+
### 第 7-8 阶段:交付准备
|
|
237
|
+
|
|
238
|
+
- 代码审查指南
|
|
239
|
+
- AI 提示词生成(直接传给 AI 开始开发)
|
|
240
|
+
|
|
241
|
+
### 第 9-11 阶段:部署与交付
|
|
242
|
+
|
|
243
|
+
- CI/CD 配置(GitHub/GitLab/Jenkins/Azure/Bitbucket)
|
|
244
|
+
- 数据库迁移脚本(Prisma/TypeORM/SQLAlchemy 等 6 种 ORM)
|
|
245
|
+
- 项目交付包(manifest + report + zip)
|
|
246
|
+
|
|
247
|
+
## 执行规则
|
|
248
|
+
|
|
249
|
+
- **前端先行**:先完成可演示前端,再实现后端 API
|
|
250
|
+
- **禁止 emoji 图标**:使用 Lucide/Heroicons/Tabler Icons
|
|
251
|
+
- **参数化查询**:禁止字符串拼接 SQL
|
|
252
|
+
- **任务跟踪**:每完成一项在 tasks.md 标记 `[x]`
|
|
253
|
+
- **质量门禁**:交付前运行 `super-dev quality --type all`
|
|
254
|
+
|
|
255
|
+
## 常用命令
|
|
256
|
+
|
|
257
|
+
```bash
|
|
258
|
+
super-dev pipeline "需求" # 完整 12 阶段流水线
|
|
259
|
+
super-dev create "需求" # 生成文档 + Spec
|
|
260
|
+
super-dev quality --type all # 质量检查
|
|
261
|
+
super-dev expert SECURITY "需求" # 单专家调用
|
|
262
|
+
super-dev skill install super-dev --target antigravity # 安装 Skill
|
|
263
|
+
```
|
|
264
|
+
"""
|