@chenmk/superflow 0.1.1 → 0.1.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/INSTALL.en.md +32 -5
- package/INSTALL.md +58 -17
- package/README.md +121 -7
- package/README.zh-CN.md +92 -11
- package/assets/brand/superflow-banner.svg +80 -0
- package/assets/context-templates/business-rules.md +45 -78
- package/assets/context-templates/decisions.md +63 -149
- package/assets/context-templates/external-systems.md +64 -161
- package/assets/context-templates/incidents.md +40 -78
- package/assets/context-templates-en/business-rules.md +72 -0
- package/assets/context-templates-en/decisions.md +72 -0
- package/assets/context-templates-en/external-systems.md +78 -0
- package/assets/context-templates-en/incidents.md +52 -0
- package/assets/manifest.json +6 -4
- package/assets/scripts/claude-auto-backup-hook.sh +11 -6
- package/assets/scripts/codex-auto-backup-hook.sh +11 -6
- package/assets/skills/superflow-design/SKILL.md +16 -8
- package/assets/skills/superflow-docs/SKILL.md +17 -8
- package/assets/skills/superflow-pipeline/references/api-design-template.md +99 -63
- package/assets/skills/superflow-pipeline/references/batch-prompt-template.md +62 -14
- package/assets/skills/superflow-pipeline/references/implementation-prompt-template.md +114 -67
- package/assets/skills/superflow-pipeline/references/quality-gate.md +104 -102
- package/assets/skills/superflow-pipeline/references/superpower-technical-design-template.md +45 -19
- package/assets/skills/superflow-pipeline/scripts/superflow-guard.sh +35 -0
- package/assets/skills-en/api-doc-changelog/SKILL.md +64 -151
- package/assets/skills-en/superflow-clarify/SKILL.md +4 -4
- package/assets/skills-en/superflow-clarify/agents/openai.yaml +1 -1
- package/assets/skills-en/superflow-design/agents/openai.yaml +1 -1
- package/assets/skills-en/superflow-docs/SKILL.md +27 -27
- package/assets/skills-en/superflow-docs/agents/openai.yaml +1 -1
- package/assets/skills-en/superflow-implement/SKILL.md +113 -457
- package/assets/skills-en/superflow-implement/agents/openai.yaml +1 -1
- package/assets/skills-en/superflow-pipeline/SKILL.md +167 -840
- package/assets/skills-en/superflow-pipeline/agents/openai.yaml +1 -1
- package/assets/skills-en/superflow-pipeline/references/api-design-template.md +17 -426
- package/assets/skills-en/superflow-pipeline/references/architecture-design-template.md +15 -114
- package/assets/skills-en/superflow-pipeline/references/batch-prompt-template.md +36 -524
- package/assets/skills-en/superflow-pipeline/references/batch-split-guide.md +19 -133
- package/assets/skills-en/superflow-pipeline/references/document-templates.md +50 -123
- package/assets/skills-en/superflow-pipeline/references/feature-gated-workflow.md +12 -119
- package/assets/skills-en/superflow-pipeline/references/implementation-prompt-template.md +22 -1044
- package/assets/skills-en/superflow-pipeline/references/mock-strategy-guide.md +11 -81
- package/assets/skills-en/superflow-pipeline/references/openspec-format.md +17 -51
- package/assets/skills-en/superflow-pipeline/references/orchestration.md +17 -632
- package/assets/skills-en/superflow-pipeline/references/p0-baseline-template.md +10 -169
- package/assets/skills-en/superflow-pipeline/references/prompt-usage-template.md +29 -128
- package/assets/skills-en/superflow-pipeline/references/quality-gate.md +36 -299
- package/assets/skills-en/superflow-pipeline/references/quality-standards.md +12 -186
- package/assets/skills-en/superflow-pipeline/references/reviewer-checklist.md +12 -154
- package/assets/skills-en/superflow-pipeline/references/sql-risk-review-checklist.md +19 -316
- package/assets/skills-en/superflow-pipeline/references/test-execution-template.md +22 -220
- package/assets/skills-en/superflow-pipeline/references/test-guide.md +12 -26
- package/assets/skills-en/superflow-pipeline/references/traceability-matrix.md +5 -103
- package/assets/skills-en/superflow-pipeline/references/validation-integrity.md +12 -130
- package/assets/skills-en/superflow-pipeline/scripts/superflow-guard.sh +23 -23
- package/assets/skills-en/superflow-pipeline/scripts/superflow-state.sh +1 -1
- package/assets/skills-en/superflow-pipeline/scripts/superflow-status.sh +15 -15
- package/assets/skills-en/superflow-table-impact-analysis/SKILL.md +3 -3
- package/dist/cli/index.js +61 -54
- package/dist/cli/index.js.map +1 -1
- package/dist/commands/design.js +25 -3
- package/dist/commands/design.js.map +1 -1
- package/dist/commands/doctor.js +31 -12
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/init.js +75 -27
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/scan.js +8 -4
- package/dist/commands/scan.js.map +1 -1
- package/dist/commands/uninstall.js +3 -3
- package/dist/commands/uninstall.js.map +1 -1
- package/dist/commands/update.js +8 -3
- package/dist/commands/update.js.map +1 -1
- package/dist/core/cli-help.js +98 -0
- package/dist/core/cli-help.js.map +1 -0
- package/dist/core/context.js +40 -17
- package/dist/core/context.js.map +1 -1
- package/dist/core/detect.js +58 -5
- package/dist/core/detect.js.map +1 -1
- package/dist/core/i18n.js +10 -8
- package/dist/core/i18n.js.map +1 -1
- package/dist/core/manifest.js +3 -0
- package/dist/core/manifest.js.map +1 -1
- package/dist/core/scripts.js +8 -0
- package/dist/core/scripts.js.map +1 -1
- package/dist/core/skills.js +6 -0
- package/dist/core/skills.js.map +1 -1
- package/dist/core/state.js +12 -1
- package/dist/core/state.js.map +1 -1
- package/package.json +4 -3
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
<svg width="1600" height="420" viewBox="0 0 1600 420" fill="none" xmlns="http://www.w3.org/2000/svg" role="img" aria-labelledby="title desc">
|
|
2
|
+
<title id="title">SuperBridge Flow banner</title>
|
|
3
|
+
<desc id="desc">A dark technical banner for SuperBridge Flow, connecting OpenSpec and Superpowers through a bridge-shaped workflow.</desc>
|
|
4
|
+
<defs>
|
|
5
|
+
<radialGradient id="blueGlow" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(328 205) rotate(18) scale(502 230)">
|
|
6
|
+
<stop stop-color="#67e8f9"/>
|
|
7
|
+
<stop offset="0.34" stop-color="#2563eb" stop-opacity="0.86"/>
|
|
8
|
+
<stop offset="1" stop-color="#020617" stop-opacity="0"/>
|
|
9
|
+
</radialGradient>
|
|
10
|
+
<radialGradient id="greenGlow" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(1110 218) rotate(160) scale(430 210)">
|
|
11
|
+
<stop stop-color="#22c55e" stop-opacity="0.9"/>
|
|
12
|
+
<stop offset="0.42" stop-color="#0891b2" stop-opacity="0.64"/>
|
|
13
|
+
<stop offset="1" stop-color="#020617" stop-opacity="0"/>
|
|
14
|
+
</radialGradient>
|
|
15
|
+
<linearGradient id="flow" x1="174" y1="256" x2="1360" y2="126" gradientUnits="userSpaceOnUse">
|
|
16
|
+
<stop stop-color="#60a5fa"/>
|
|
17
|
+
<stop offset="0.46" stop-color="#a78bfa"/>
|
|
18
|
+
<stop offset="1" stop-color="#34d399"/>
|
|
19
|
+
</linearGradient>
|
|
20
|
+
<filter id="softGlow" x="-40%" y="-40%" width="180%" height="180%" color-interpolation-filters="sRGB">
|
|
21
|
+
<feGaussianBlur stdDeviation="10" result="blur"/>
|
|
22
|
+
<feColorMatrix in="blur" type="matrix" values="0 0 0 0 0.28 0 0 0 0 0.65 0 0 0 0 1 0 0 0 0.9 0"/>
|
|
23
|
+
<feBlend in="SourceGraphic" mode="screen"/>
|
|
24
|
+
</filter>
|
|
25
|
+
<pattern id="dotGrid" width="22" height="22" patternUnits="userSpaceOnUse">
|
|
26
|
+
<circle cx="2" cy="2" r="1.4" fill="#38bdf8" opacity="0.28"/>
|
|
27
|
+
</pattern>
|
|
28
|
+
</defs>
|
|
29
|
+
|
|
30
|
+
<rect width="1600" height="420" rx="18" fill="#020617"/>
|
|
31
|
+
<rect width="1600" height="420" rx="18" fill="url(#blueGlow)"/>
|
|
32
|
+
<rect width="1600" height="420" rx="18" fill="url(#greenGlow)"/>
|
|
33
|
+
<rect x="0" y="0" width="1600" height="420" fill="url(#dotGrid)" opacity="0.72"/>
|
|
34
|
+
|
|
35
|
+
<path d="M94 310C250 136 405 106 568 214C734 324 884 319 1039 181C1159 74 1298 56 1488 112" stroke="url(#flow)" stroke-width="8" stroke-linecap="round" filter="url(#softGlow)"/>
|
|
36
|
+
<path d="M122 338C298 210 438 205 584 282C743 365 936 308 1054 214C1184 111 1318 103 1476 154" stroke="#e0f2fe" stroke-width="2" stroke-linecap="round" opacity="0.78"/>
|
|
37
|
+
<path d="M126 282C298 68 513 80 664 196C808 307 966 273 1092 146C1214 23 1374 32 1502 72" stroke="#93c5fd" stroke-width="2" stroke-linecap="round" opacity="0.42"/>
|
|
38
|
+
|
|
39
|
+
<g opacity="0.86">
|
|
40
|
+
<path d="M280 304H1320" stroke="#64748b" stroke-width="2"/>
|
|
41
|
+
<path d="M360 304C430 218 500 178 570 178C650 178 710 304 790 304C875 304 935 178 1025 178C1100 178 1168 222 1240 304" stroke="#cbd5e1" stroke-width="5" stroke-linecap="round"/>
|
|
42
|
+
<path d="M422 304V252M528 304V207M635 304V207M742 304V252M858 304V252M965 304V207M1072 304V207M1178 304V252" stroke="#cbd5e1" stroke-width="5" stroke-linecap="round"/>
|
|
43
|
+
</g>
|
|
44
|
+
|
|
45
|
+
<g>
|
|
46
|
+
<rect x="94" y="84" width="230" height="52" rx="8" fill="#0f172a" stroke="#38bdf8" stroke-opacity="0.45"/>
|
|
47
|
+
<text x="118" y="118" fill="#bae6fd" font-family="ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace" font-size="24" letter-spacing="2">OpenSpec / SDD</text>
|
|
48
|
+
<rect x="94" y="148" width="230" height="40" rx="8" fill="#020617" stroke="#334155"/>
|
|
49
|
+
<text x="118" y="174" fill="#94a3b8" font-family="ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace" font-size="18">WHAT + contracts</text>
|
|
50
|
+
</g>
|
|
51
|
+
|
|
52
|
+
<g>
|
|
53
|
+
<rect x="1276" y="238" width="230" height="52" rx="8" fill="#052e2b" stroke="#34d399" stroke-opacity="0.52"/>
|
|
54
|
+
<text x="1300" y="272" fill="#bbf7d0" font-family="ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace" font-size="24" letter-spacing="2">Superpowers</text>
|
|
55
|
+
<rect x="1276" y="302" width="230" height="40" rx="8" fill="#020617" stroke="#334155"/>
|
|
56
|
+
<text x="1300" y="328" fill="#94a3b8" font-family="ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace" font-size="18">HOW + verification</text>
|
|
57
|
+
</g>
|
|
58
|
+
|
|
59
|
+
<g>
|
|
60
|
+
<text x="522" y="132" fill="#f8fafc" font-family="ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace" font-size="72" font-weight="800" letter-spacing="6">SUPERFLOW</text>
|
|
61
|
+
<text x="528" y="179" fill="#cbd5e1" font-family="ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace" font-size="28" letter-spacing="5">SUPERBRIDGE FLOW</text>
|
|
62
|
+
<text x="531" y="224" fill="#60a5fa" font-family="ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace" font-size="24" letter-spacing="3">FROM REQUIREMENT TO VERIFIED DELIVERY</text>
|
|
63
|
+
</g>
|
|
64
|
+
|
|
65
|
+
<g fill="#e2e8f0" font-family="ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace" font-size="17" opacity="0.9">
|
|
66
|
+
<text x="506" y="355">docs</text>
|
|
67
|
+
<text x="638" y="355">design</text>
|
|
68
|
+
<text x="800" y="355">implement</text>
|
|
69
|
+
<text x="990" y="355">verify</text>
|
|
70
|
+
<text x="1136" y="355">archive</text>
|
|
71
|
+
</g>
|
|
72
|
+
|
|
73
|
+
<g fill="#38bdf8" filter="url(#softGlow)">
|
|
74
|
+
<circle cx="486" cy="304" r="7"/>
|
|
75
|
+
<circle cx="624" cy="304" r="7"/>
|
|
76
|
+
<circle cx="782" cy="304" r="7"/>
|
|
77
|
+
<circle cx="960" cy="304" r="7"/>
|
|
78
|
+
<circle cx="1118" cy="304" r="7"/>
|
|
79
|
+
</g>
|
|
80
|
+
</svg>
|
|
@@ -1,98 +1,65 @@
|
|
|
1
1
|
# 业务规则
|
|
2
2
|
|
|
3
|
-
>
|
|
4
|
-
>
|
|
5
|
-
>
|
|
3
|
+
> **用途**:沉淀当前项目的长期业务规则、边界条件、状态流转和验收口径。
|
|
4
|
+
> **维护方**:产品负责人 / 业务负责人 / 开发负责人
|
|
5
|
+
> **更新方式**:`superflow init` 生成初始模板后,由项目团队按真实业务补充。
|
|
6
6
|
|
|
7
|
-
## 1.
|
|
7
|
+
## 1. 核心业务对象
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
| 对象 | 业务含义 | 唯一性规则 | 生命周期状态 | 关键约束 |
|
|
10
|
+
|------|----------|------------|--------------|----------|
|
|
11
|
+
| `<业务对象 A>` | `<说明>` | `<唯一键/去重规则>` | `<状态流>` | `<边界条件>` |
|
|
12
|
+
| `<业务对象 B>` | `<说明>` | `<唯一键/去重规则>` | `<状态流>` | `<边界条件>` |
|
|
10
13
|
|
|
11
|
-
|
|
12
|
-
- 历史事故:CDPT-165 套餐运营商筛选不匹配(修复 commit 见 [incidents.md](./incidents.md))
|
|
13
|
-
- **适用站点**:套餐可绑定多个站点,已开通记录的适用站点应随套餐变更同步更新
|
|
14
|
-
- 历史事故:CDPT-192 修改适用站点后记录未同步
|
|
15
|
-
- **同名限制**:同一站点不允许创建相同名称的优惠套餐
|
|
16
|
-
- 历史事故:CDPT-171
|
|
17
|
-
- **有效时段**:允许跨天(如 22:00-06:00)
|
|
18
|
-
- 历史事故:CDPT-158
|
|
19
|
-
- **同车牌规则**:同车牌不同套餐、不同有效时间段允许同时开通
|
|
20
|
-
- 历史事故:CDPT-175
|
|
14
|
+
## 2. 状态流转规则
|
|
21
15
|
|
|
22
|
-
|
|
16
|
+
| 状态 | 进入条件 | 允许操作 | 禁止操作 | 退出条件 |
|
|
17
|
+
|------|----------|----------|----------|----------|
|
|
18
|
+
| `<状态 A>` | `<触发条件>` | `<操作>` | `<操作>` | `<条件>` |
|
|
19
|
+
| `<状态 B>` | `<触发条件>` | `<操作>` | `<操作>` | `<条件>` |
|
|
23
20
|
|
|
24
|
-
|
|
25
|
-
- 历史事故:CDPT-186
|
|
26
|
-
- **三方对账**:发布前必须对齐 ① 源码/Mapper 读写字段 ② 开发库结构 ③ 测试库现状 + 版本总 SQL 执行后结构
|
|
27
|
-
- 测试库已有字段不得重复 ADD
|
|
28
|
-
- 类型/注释不一致时生成 MODIFY 或写明不采纳理由
|
|
29
|
-
- **SQL 收口对账表**:每个 DB 相关 P/CR 任务必须输出
|
|
21
|
+
维护要求:
|
|
30
22
|
|
|
31
|
-
|
|
23
|
+
- 修改状态字段、枚举值、派生字段时,必须反查所有读取、写入、查询条件、
|
|
24
|
+
导出、定时任务、回调和跨仓同步位置。
|
|
25
|
+
- 状态派生规则必须写清楚真实来源,禁止凭字段名猜测。
|
|
26
|
+
- 兼容旧状态或 fallback 逻辑必须写明 owner、移除条件和观测方式。
|
|
32
27
|
|
|
33
|
-
|
|
28
|
+
## 3. 关键业务规则
|
|
34
29
|
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
| 编号 | 规则 | 适用场景 | 反例/边界 | 验收方式 |
|
|
31
|
+
|------|------|----------|-----------|----------|
|
|
32
|
+
| BR-001 | `<规则描述>` | `<页面/API/任务>` | `<容易遗漏的情况>` | `<测试/联调/人工验收>` |
|
|
33
|
+
| BR-002 | `<规则描述>` | `<页面/API/任务>` | `<容易遗漏的情况>` | `<测试/联调/人工验收>` |
|
|
37
34
|
|
|
38
|
-
##
|
|
35
|
+
## 4. 数据与权限边界
|
|
39
36
|
|
|
40
|
-
|
|
37
|
+
| 维度 | 规则 | 核验入口 |
|
|
38
|
+
|------|------|----------|
|
|
39
|
+
| 租户 / 组织 / 项目 | `<隔离规则>` | `<源码/配置/数据表>` |
|
|
40
|
+
| 用户角色 | `<权限规则>` | `<菜单/接口/鉴权点>` |
|
|
41
|
+
| 数据可见性 | `<查询范围>` | `<Mapper/API/页面>` |
|
|
42
|
+
| 数据修改权 | `<写入限制>` | `<Service/事务/审计>` |
|
|
41
43
|
|
|
42
|
-
|
|
43
|
-
- 历史事故:CDPT-185
|
|
44
|
-
- **错误提示**:遇错误/异常数据必须明确指出"哪一行、哪个字段异常",整批不插入
|
|
45
|
-
- 历史事故:CDPT-180
|
|
46
|
-
- **必填标记**:模板中必填字段必须标【必填】
|
|
47
|
-
- 历史事故:CDPT-178
|
|
48
|
-
- **当天 1 天有效期**:批量开通当天 + 1 天有效期时,记录显示已过期(页面显示生效中)
|
|
49
|
-
- 历史事故:CDPT-179 — 需验证时区与日期边界
|
|
50
|
-
- **空模板检测**:导入空 Excel 模板应报错,不应提示成功
|
|
51
|
-
- 历史事故:CDPT-181
|
|
44
|
+
## 5. 批量、导入导出和异常规则
|
|
52
45
|
|
|
53
|
-
|
|
46
|
+
- 批量操作必须定义部分成功/全部失败策略。
|
|
47
|
+
- 导入模板必须定义必填、格式、枚举、重复数据和空文件行为。
|
|
48
|
+
- 导出字段必须和页面/接口字段语义一致;如不一致,需记录原因。
|
|
49
|
+
- 错误提示必须能定位到对象、行号、字段或可操作的修复建议。
|
|
54
50
|
|
|
55
|
-
|
|
56
|
-
- 历史事故:CDPT-198
|
|
57
|
-
- **车位枪文件类型错误**:提示需优化
|
|
58
|
-
- 历史事故:CDPT-181
|
|
51
|
+
## 6. 真实验收要求
|
|
59
52
|
|
|
60
|
-
|
|
53
|
+
涉及外部系统、数据库、异步任务、消息队列、支付、文件、权限或状态流的
|
|
54
|
+
需求,不能只用 mock 单元测试作为完成证据。`test-report.md` 至少应记录:
|
|
61
55
|
|
|
62
|
-
-
|
|
63
|
-
|
|
64
|
-
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
## 4. 数据权限 / 字段约束
|
|
68
|
-
|
|
69
|
-
- **最近操作人**:开通套餐记录中"最近操作人"取值错误(admin 后台开通时显示为前端用户)
|
|
70
|
-
- 历史事故:CDPT-164
|
|
71
|
-
- **导出 Excel**:
|
|
72
|
-
- 套餐开通记录导出,剩余充电额度为不限额时导出内容错误(CDPT-188)
|
|
73
|
-
- 套餐开通记录导出,**不合并**不连续的有效期(CDPT-177)
|
|
74
|
-
- 创建套餐页面,导出 Excel 中的使用站点列展示错误(CDPT-166)
|
|
75
|
-
- 批量开通记录导出,手机号 / 车牌应支持模糊查询(CDPT-173)
|
|
76
|
-
- **页面不显示但后端必填**:标记为 backend default 或 backend-derived(SDD 硬规则)
|
|
77
|
-
- **过设计字段**:UI 不展示但后端要写,标 backend default;UI 展示但后端不需要,标 over-designed
|
|
78
|
-
|
|
79
|
-
## 5. 状态流转
|
|
80
|
-
|
|
81
|
-
- **开票 / 退款 / 续费 状态**:套餐开通 → 生效中 → 退款 / 续费 / 过期,状态字段派生后消费仓查询条件必须同步迁移
|
|
82
|
-
- 不允许继续按旧字段过滤
|
|
83
|
-
- **有效期 / 充电额度**:派生字段(从持久化状态 / JSON 快照计算),消费仓同步改用派生表达式
|
|
84
|
-
|
|
85
|
-
## 6. 上游系统交互(占位 — 详见 [external-systems.md](./external-systems.md))
|
|
86
|
-
|
|
87
|
-
- **BEM(停车月票权益)**:退款 / 续费双向同步
|
|
88
|
-
- **Lark / 飞书**:需求来源、文档协作
|
|
89
|
-
- **B 站?财务对账**:定期对账
|
|
90
|
-
|
|
91
|
-
---
|
|
56
|
+
- 真实入口:页面、API、消息、定时任务或外部回调。
|
|
57
|
+
- 真实参数:请求体、消息体、文件样本或测试账号。
|
|
58
|
+
- 真实结果:响应、数据库记录、日志、下游回调或页面状态。
|
|
59
|
+
- 断言:期望值与实际值的对比。
|
|
92
60
|
|
|
93
61
|
## 7. 维护提示
|
|
94
62
|
|
|
95
|
-
-
|
|
96
|
-
-
|
|
97
|
-
-
|
|
98
|
-
- 自动化补充:可以用 `superflow scan` 让 LLM 重扫项目,对比本文件并提示遗漏
|
|
63
|
+
- 本文件只记录项目自己的业务事实,不写通用流程口号。
|
|
64
|
+
- 新增事故、返工或联调问题后,把可复用规则补回这里。
|
|
65
|
+
- 不确定的规则标为 `待确认`,并写清需要谁确认、确认入口是什么。
|
|
@@ -1,153 +1,67 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 架构与工程决策
|
|
2
2
|
|
|
3
|
-
>
|
|
4
|
-
>
|
|
5
|
-
>
|
|
3
|
+
> **用途**:沉淀当前项目的长期架构选择、工程约定和取舍原因。
|
|
4
|
+
> **维护方**:架构负责人 / 技术负责人 / 模块 owner
|
|
5
|
+
> **推荐格式**:ADR(Architecture Decision Record)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## ADR-001: <决策标题>
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
### ADR-001: worktree 启动端口 = base port + P/CR 编号
|
|
14
|
-
|
|
15
|
-
- **状态**:已确立
|
|
16
|
-
- **背景**:多 worktree 并行开发时,端口冲突会导致调试互相干扰
|
|
17
|
-
- **决策**:每个 worktree 启动端口 = `base server.port + P/CR 编号`
|
|
18
|
-
- 例:P50 任务 base 9250 → 启动端口 9300
|
|
19
|
-
- 冲突时 fallback 找下一个可用端口
|
|
20
|
-
- **原因**:
|
|
21
|
-
- 可预测(看 P 编号就知道端口)
|
|
22
|
-
- 不需要中心化端口分配
|
|
23
|
-
- CI / 健康检查 URL 可以静态配置
|
|
9
|
+
- **状态**:拟定 / 已采纳 / 已废弃 / 被替代
|
|
10
|
+
- **日期**:YYYY-MM-DD
|
|
11
|
+
- **背景**:为什么需要这个决策,原问题是什么。
|
|
12
|
+
- **决策**:最终选择的方案。
|
|
24
13
|
- **替代方案**:
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
-
|
|
62
|
-
-
|
|
63
|
-
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
-
|
|
79
|
-
- **understand-anything 必须先扫**:SDD 任何澄清 / 实现前,check `.understand-anything/` 等产物,不存在则先跑索引
|
|
80
|
-
- **既有代码 / 数据关系核实顺序**:understand-anything graph → source/Mapper/XML 锚点 → 只读数据库检查(源码不足时)
|
|
81
|
-
- **关系仍不清楚**:停下来问用户,标 `Blocked`,禁止凭字段名猜测设计
|
|
82
|
-
- **process one feature at a time**:按产品文档顺序,逐个 feature 串行
|
|
83
|
-
- **未确认前不生成 spec/design/tasks/tests/prompt**
|
|
84
|
-
- **不做"single-agent only" implementation prompt**:必须含 Worker + 独立 Tester + Reviewer + Leader
|
|
85
|
-
- **后果**:
|
|
86
|
-
- 实现 prompt 必含"superpower 团队 prefix" + "understand-anything 平台级影响分析" + "既有代码 / 数据关系核实" + "worktree 启动端口" 4 段
|
|
87
|
-
- 缺任意一段 → 标 Blocked
|
|
88
|
-
|
|
89
|
-
### ADR-006: 实现完成判定(不是 BUILD SUCCESS)
|
|
90
|
-
|
|
91
|
-
- **状态**:已确立
|
|
92
|
-
- **决策**:批量完成必须验证:
|
|
93
|
-
- prompt 交叉链接(prompt/implementation.md 引用 → tasks.md 引用 → traceability-matrix.md 引用 → tests/test-report.md 验证项)
|
|
94
|
-
- Markdown handoff 链接:所有引用的 `.md` 文件是相对路径可点击链接
|
|
95
|
-
- understand-anything 影响证据(test-report.md 含 受影响模块/接口/表 + 回归验证)
|
|
96
|
-
- 既有代码 / 数据关系证据(按核实顺序留痕)
|
|
97
|
-
- 编译/构建输出
|
|
98
|
-
- **测试**真的跑过(BUILD SUCCESS ≠ 测试通过)
|
|
99
|
-
- 引用 SDK / 同源项目版本号升级(1.0.8-SNAPSHOT → 1.0.9-SNAPSHOT)
|
|
100
|
-
- 三层门禁:`.sdd-enforced` / `.db-verified` hook 标记 + `superflow-verify-integration.sh` + `superflow-delivery-check.sh`
|
|
101
|
-
- 数据库相关任务:版本总 SQL 已更新 + SQL 收口对账表
|
|
102
|
-
- L3/L4 测试:curl + 真实请求参数(来源标注)+ 响应 + 断言 + DB 证据 + 日志
|
|
103
|
-
- Bug 修复:Red-Green 证据(修复前失败的 curl/test,修复后同样路径通过)
|
|
104
|
-
- **后果**:
|
|
105
|
-
- 单元测试只能作为辅助证据
|
|
106
|
-
- placeholder / mock-only / skipped / 缺测试数据 — 不算通过
|
|
107
|
-
- "问要不要启动 app" — 不算有效闭环
|
|
108
|
-
- 必须跑或请求 `openspec validate <change-id> --strict`
|
|
109
|
-
|
|
110
|
-
### ADR-007: 平行 worktree 不许动顶层聚合文档
|
|
111
|
-
|
|
112
|
-
- **状态**:已确立
|
|
113
|
-
- **决策**:
|
|
114
|
-
- Worker prompt 只更新自己 `embedded-changes/pXX-*` 内的 `tasks.md` / `test-report.md` / `sdd-quality-gate.md` 等 P-local 文档
|
|
115
|
-
- **禁止**编辑顶层聚合文档(root `tasks.md` / `test-report.md` / `traceability-matrix.md` / `sdd-quality-gate.md` / `tests.md`)
|
|
116
|
-
- 聚合文档更新由 Leader closeout worktree 单独 commit(创建 `.sdd-aggregate-closeout` 标记)
|
|
117
|
-
- **原因**:避免平行 worktree 合并冲突
|
|
118
|
-
- **后果**:
|
|
119
|
-
- `superflow-delivery-check.sh` 会 block 顶层文档改动,worker 必须移除
|
|
120
|
-
- 顶层文档改动只有 Leader worktree 能做
|
|
121
|
-
|
|
122
|
-
## 3. 业务架构决策
|
|
123
|
-
|
|
124
|
-
### ADR-008: 套餐适用站点的真源是 site 关系表
|
|
125
|
-
|
|
126
|
-
- **状态**:已确立(CDPT-165 修复后)
|
|
127
|
-
- **背景**:原版按 `t_package.operator_id` 直接过滤,未走 site 关系表,导致运营商边界漏掉
|
|
128
|
-
- **决策**:套餐分页/导出按运营商查询时,**改为按站点关系表过滤**(关联到 `t_site` / `t_site_operator` 等关系表)
|
|
129
|
-
- **原因**:
|
|
130
|
-
- 套餐适用站点是中间关系,不是直属于运营商
|
|
131
|
-
- 直查 `t_package.operator_id` 会漏掉"该运营商的站点绑定了别运营商套餐"的情况
|
|
132
|
-
- **后果**:
|
|
133
|
-
- 涉及运营商边界的查询必须 join 站点关系表
|
|
134
|
-
- 套餐分页 / 导出接口需要走同一过滤逻辑
|
|
135
|
-
- **相关**:CDPT-165 修复 commit
|
|
136
|
-
|
|
137
|
-
### ADR-009: 状态字段派生化(从持久化到 JSON/计算)
|
|
138
|
-
|
|
139
|
-
- **状态**:演进中
|
|
140
|
-
- **背景**:单字段(如 `plot_id`)切换到 JSON / 多站点快照字段
|
|
141
|
-
- **决策**:
|
|
142
|
-
- 状态 / 时段 / 额度 等"派生属性"改为计算字段或 JSON 快照,不再单字段持久化
|
|
143
|
-
- 消费仓查询条件必须同步迁移(不能继续按旧字段过滤)
|
|
144
|
-
- **后果**:
|
|
145
|
-
- 跨仓对账时派生字段要明确标注
|
|
146
|
-
- 派生 vs 持久化边界由需求阶段决定
|
|
147
|
-
|
|
148
|
-
## 4. 维护提示
|
|
149
|
-
|
|
150
|
-
- 本文件是**初始版**,由 superflow init Step 5 + 人工补全
|
|
151
|
-
- 后期可让 LLM 通过 git log + commit message 挖掘团队决策("重构因为..."、"refactor: 改用 X")
|
|
152
|
-
- 重要架构变更(影响 ≥ 2 个模块)必须追加 ADR,不允许只在 commit message 里说
|
|
153
|
-
- 决策**可被推翻**,但推翻时必须在本文件追加新 ADR 并说明旧 ADR 为何不再适用
|
|
14
|
+
- 方案 A:优点、缺点。
|
|
15
|
+
- 方案 B:优点、缺点。
|
|
16
|
+
- **影响范围**:涉及的仓库、模块、表、接口、任务或部署方式。
|
|
17
|
+
- **后果**:带来的收益、成本、风险和后续约束。
|
|
18
|
+
- **验证方式**:如何确认决策被正确执行。
|
|
19
|
+
|
|
20
|
+
## 1. 项目结构约定
|
|
21
|
+
|
|
22
|
+
| 主题 | 当前约定 | 真源位置 | 备注 |
|
|
23
|
+
|------|----------|----------|------|
|
|
24
|
+
| 模块边界 | `<说明>` | `<目录/文档/配置>` | `<备注>` |
|
|
25
|
+
| 分层方式 | `<说明>` | `<目录/代码入口>` | `<备注>` |
|
|
26
|
+
| 命名规范 | `<说明>` | `<README/代码示例>` | `<备注>` |
|
|
27
|
+
| 配置管理 | `<说明>` | `<application/env/secret>` | `<备注>` |
|
|
28
|
+
|
|
29
|
+
## 2. 数据库与持久化约定
|
|
30
|
+
|
|
31
|
+
| 主题 | 当前约定 | 强制门禁 |
|
|
32
|
+
|------|----------|----------|
|
|
33
|
+
| 表结构真源 | `<SQL 文件/迁移工具/线上结构>` | 修改前先核实真源 |
|
|
34
|
+
| 版本 SQL / migration | `<规则>` | 代码依赖字段必须进入发布物 |
|
|
35
|
+
| 共享表消费方 | `<仓库/模块清单>` | 修改字段必须反查所有消费方 |
|
|
36
|
+
| 软删除 / 多租户 | `<规则>` | Mapper/XML 查询必须显式对齐 |
|
|
37
|
+
|
|
38
|
+
## 3. API 与集成约定
|
|
39
|
+
|
|
40
|
+
| 主题 | 当前约定 | 验证方式 |
|
|
41
|
+
|------|----------|----------|
|
|
42
|
+
| API 风格 | `<REST/RPC/GraphQL/消息>` | `<契约测试/联调>` |
|
|
43
|
+
| 鉴权方式 | `<说明>` | `<测试账号/权限矩阵>` |
|
|
44
|
+
| 错误码 | `<说明>` | `<接口文档/测试>` |
|
|
45
|
+
| 外部系统调用 | `<说明>` | `<真实环境/沙箱/模拟器>` |
|
|
46
|
+
|
|
47
|
+
## 4. 测试与交付约定
|
|
48
|
+
|
|
49
|
+
- 单元测试验证局部逻辑,不等价于真实链路通过。
|
|
50
|
+
- 涉及外部入口的任务必须留下真实入口证据。
|
|
51
|
+
- 涉及数据库的任务必须留下表结构、数据写入或查询证据。
|
|
52
|
+
- 涉及异步链路的任务必须留下消息、日志、状态推进或重试证据。
|
|
53
|
+
- 声明完成前必须执行 Superflow guard 和项目自己的验证命令。
|
|
54
|
+
|
|
55
|
+
## 5. Superflow 使用约定
|
|
56
|
+
|
|
57
|
+
- OpenSpec/SDD 负责 WHAT 和合同。
|
|
58
|
+
- Superpowers 负责源码级 HOW、TDD 顺序、review 和验证纪律。
|
|
59
|
+
- `.sdd/state.yaml` 和 `.sdd/handoff/` 是防止上下文漂移的状态真源。
|
|
60
|
+
- Worker 并行开发时,必须明确各自只修改的文档和代码范围。
|
|
61
|
+
- 如果文档、代码或测试报告发生变化,必须刷新 handoff hash。
|
|
62
|
+
|
|
63
|
+
## 6. 废弃决策
|
|
64
|
+
|
|
65
|
+
| 原决策 | 废弃原因 | 替代决策 | 日期 |
|
|
66
|
+
|--------|----------|----------|------|
|
|
67
|
+
| `<ADR 编号>` | `<原因>` | `<ADR 编号>` | `YYYY-MM-DD` |
|