@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.
Files changed (89) hide show
  1. package/INSTALL.en.md +32 -5
  2. package/INSTALL.md +58 -17
  3. package/README.md +121 -7
  4. package/README.zh-CN.md +92 -11
  5. package/assets/brand/superflow-banner.svg +80 -0
  6. package/assets/context-templates/business-rules.md +45 -78
  7. package/assets/context-templates/decisions.md +63 -149
  8. package/assets/context-templates/external-systems.md +64 -161
  9. package/assets/context-templates/incidents.md +40 -78
  10. package/assets/context-templates-en/business-rules.md +72 -0
  11. package/assets/context-templates-en/decisions.md +72 -0
  12. package/assets/context-templates-en/external-systems.md +78 -0
  13. package/assets/context-templates-en/incidents.md +52 -0
  14. package/assets/manifest.json +6 -4
  15. package/assets/scripts/claude-auto-backup-hook.sh +11 -6
  16. package/assets/scripts/codex-auto-backup-hook.sh +11 -6
  17. package/assets/skills/superflow-design/SKILL.md +16 -8
  18. package/assets/skills/superflow-docs/SKILL.md +17 -8
  19. package/assets/skills/superflow-pipeline/references/api-design-template.md +99 -63
  20. package/assets/skills/superflow-pipeline/references/batch-prompt-template.md +62 -14
  21. package/assets/skills/superflow-pipeline/references/implementation-prompt-template.md +114 -67
  22. package/assets/skills/superflow-pipeline/references/quality-gate.md +104 -102
  23. package/assets/skills/superflow-pipeline/references/superpower-technical-design-template.md +45 -19
  24. package/assets/skills/superflow-pipeline/scripts/superflow-guard.sh +35 -0
  25. package/assets/skills-en/api-doc-changelog/SKILL.md +64 -151
  26. package/assets/skills-en/superflow-clarify/SKILL.md +4 -4
  27. package/assets/skills-en/superflow-clarify/agents/openai.yaml +1 -1
  28. package/assets/skills-en/superflow-design/agents/openai.yaml +1 -1
  29. package/assets/skills-en/superflow-docs/SKILL.md +27 -27
  30. package/assets/skills-en/superflow-docs/agents/openai.yaml +1 -1
  31. package/assets/skills-en/superflow-implement/SKILL.md +113 -457
  32. package/assets/skills-en/superflow-implement/agents/openai.yaml +1 -1
  33. package/assets/skills-en/superflow-pipeline/SKILL.md +167 -840
  34. package/assets/skills-en/superflow-pipeline/agents/openai.yaml +1 -1
  35. package/assets/skills-en/superflow-pipeline/references/api-design-template.md +17 -426
  36. package/assets/skills-en/superflow-pipeline/references/architecture-design-template.md +15 -114
  37. package/assets/skills-en/superflow-pipeline/references/batch-prompt-template.md +36 -524
  38. package/assets/skills-en/superflow-pipeline/references/batch-split-guide.md +19 -133
  39. package/assets/skills-en/superflow-pipeline/references/document-templates.md +50 -123
  40. package/assets/skills-en/superflow-pipeline/references/feature-gated-workflow.md +12 -119
  41. package/assets/skills-en/superflow-pipeline/references/implementation-prompt-template.md +22 -1044
  42. package/assets/skills-en/superflow-pipeline/references/mock-strategy-guide.md +11 -81
  43. package/assets/skills-en/superflow-pipeline/references/openspec-format.md +17 -51
  44. package/assets/skills-en/superflow-pipeline/references/orchestration.md +17 -632
  45. package/assets/skills-en/superflow-pipeline/references/p0-baseline-template.md +10 -169
  46. package/assets/skills-en/superflow-pipeline/references/prompt-usage-template.md +29 -128
  47. package/assets/skills-en/superflow-pipeline/references/quality-gate.md +36 -299
  48. package/assets/skills-en/superflow-pipeline/references/quality-standards.md +12 -186
  49. package/assets/skills-en/superflow-pipeline/references/reviewer-checklist.md +12 -154
  50. package/assets/skills-en/superflow-pipeline/references/sql-risk-review-checklist.md +19 -316
  51. package/assets/skills-en/superflow-pipeline/references/test-execution-template.md +22 -220
  52. package/assets/skills-en/superflow-pipeline/references/test-guide.md +12 -26
  53. package/assets/skills-en/superflow-pipeline/references/traceability-matrix.md +5 -103
  54. package/assets/skills-en/superflow-pipeline/references/validation-integrity.md +12 -130
  55. package/assets/skills-en/superflow-pipeline/scripts/superflow-guard.sh +23 -23
  56. package/assets/skills-en/superflow-pipeline/scripts/superflow-state.sh +1 -1
  57. package/assets/skills-en/superflow-pipeline/scripts/superflow-status.sh +15 -15
  58. package/assets/skills-en/superflow-table-impact-analysis/SKILL.md +3 -3
  59. package/dist/cli/index.js +61 -54
  60. package/dist/cli/index.js.map +1 -1
  61. package/dist/commands/design.js +25 -3
  62. package/dist/commands/design.js.map +1 -1
  63. package/dist/commands/doctor.js +31 -12
  64. package/dist/commands/doctor.js.map +1 -1
  65. package/dist/commands/init.js +75 -27
  66. package/dist/commands/init.js.map +1 -1
  67. package/dist/commands/scan.js +8 -4
  68. package/dist/commands/scan.js.map +1 -1
  69. package/dist/commands/uninstall.js +3 -3
  70. package/dist/commands/uninstall.js.map +1 -1
  71. package/dist/commands/update.js +8 -3
  72. package/dist/commands/update.js.map +1 -1
  73. package/dist/core/cli-help.js +98 -0
  74. package/dist/core/cli-help.js.map +1 -0
  75. package/dist/core/context.js +40 -17
  76. package/dist/core/context.js.map +1 -1
  77. package/dist/core/detect.js +58 -5
  78. package/dist/core/detect.js.map +1 -1
  79. package/dist/core/i18n.js +10 -8
  80. package/dist/core/i18n.js.map +1 -1
  81. package/dist/core/manifest.js +3 -0
  82. package/dist/core/manifest.js.map +1 -1
  83. package/dist/core/scripts.js +8 -0
  84. package/dist/core/scripts.js.map +1 -1
  85. package/dist/core/skills.js +6 -0
  86. package/dist/core/skills.js.map +1 -1
  87. package/dist/core/state.js +12 -1
  88. package/dist/core/state.js.map +1 -1
  89. package/package.json +4 -3
@@ -1,166 +1,69 @@
1
- # 上游系统约定
1
+ # 外部系统与集成约定
2
2
 
3
- > **初始版来源**:sdd-cli 散落的对账/跨仓规则 + openspec/changes/v1.1-add-charging-package-suite 涉及的外部系统引用
4
- > **维护方**:架构 / 集成开发
5
- > **自动化率**:80-95%(MQ topic 常量、API client 调用点静态可挖)
3
+ > **用途**:记录当前项目依赖的外部系统、接口、消息、文件、账号和联调方式。
4
+ > **维护方**:集成负责人 / 模块 owner / 测试负责人
6
5
 
7
- ## 1. 系统拓扑概览
6
+ ## 1. 系统拓扑
8
7
 
8
+ ```text
9
+ <当前系统>
10
+ ├─ HTTP / RPC -> <外部系统 A>
11
+ ├─ MQ / Event -> <外部系统 B>
12
+ ├─ File / Object Storage -> <外部系统 C>
13
+ └─ Webhook / Callback <- <外部系统 D>
9
14
  ```
10
- ┌─────────────────────────────────────────────────────────────────┐
11
- │ evcharge-operator-api (本服务) │
12
- │ Spring Boot 2.x │
13
- │ base port: 9250(worktree 派生端口 = 9250 + P/CR 编号) │
14
- │ 职责:充电套餐核心业务 + 站点 / 设备管理 + 计费对账 │
15
- └─────────────────────────────────────────────────────────────────┘
16
- ↕ (HTTP / MQ / 定时任务 / 回调)
17
- ├── BEM (停车月票权益服务)
18
- ├── 财务对账系统(定期对账)
19
- ├── Lark / 飞书(需求 / 文档 / 通知)
20
- ├── 云效 / 钉钉(CI / 任务协作 / bug tracker)
21
- ├── 车位 / 设备 IoT(扫码 / 充电桩事件)
22
- └── 支付 / 退款通道(第三方)
23
- ```
24
15
 
25
- ## 2. 上游系统清单
26
-
27
- ### 2.1 BEM(停车月票权益服务)
28
-
29
- - **职责**:管理停车月票权益,与充电套餐权益互斥 / 同步
30
- - **集成方式**:HTTP API(同步)+ MQ 事件(异步)
31
- - **关键事件**:
32
- - 充电套餐退款 → BEM 同步退款(CDPT-186 历史事故:同步缺失)
33
- - 充电套餐续费 → BEM 续费月票(CDPT-169 历史事故:续费缺失)
34
- - **数据流向**:
35
- - 出:本服务发退款 / 续费请求到 BEM
36
- - 入:BEM 回调停车权益变化(webhook / MQ)
37
- - **失败处理**:BEM 调用失败必须重试 + 告警,不能静默成功
38
- - **占位**(待人工补):API 路径、MQ topic、SDK 版本号、对账窗口期
39
-
40
- ### 2.2 财务对账系统
41
-
42
- - **职责**:充电订单 / 退款 / 套餐开通 / 续费 的财务对账
43
- - **集成方式**:定时任务拉取对账文件 + T+1 对账
44
- - **关键字段**:
45
- - 订单号、金额、支付渠道、退款单号、套餐 ID、站点 ID、运营商 ID
46
- - **三方对账要求**(见 [decisions §1 ADR-003](./decisions.md#adr-003-sql-总-sql-文件作为版本合同)):
47
- - ① 源码/Mapper 读写字段
48
- - ② 开发库结构
49
- - ③ 测试库现状 + 版本总 SQL 执行后结构
50
- - **占位**(待人工补):对账文件格式、对账时间窗、差异处理流程
51
-
52
- ### 2.3 Lark / 飞书
53
-
54
- - **职责**:
55
- - 需求来源(产品文档 / 截图 / 原型 / 会议纪要)
56
- - 文档协作(API 文档 / 设计文档 / 验收记录)
57
- - 通知(事故告警 / 部署通知 / 周报)
58
- - **集成方式**:
59
- - 文档:人工导入(云文档链接)
60
- - 通知:webhook 推送到飞书群机器人
61
- - 部分自动化:openspec proposal 生成后同步到飞书文档(待定)
62
- - **占位**(待人工补):webhook URL、群机器人 token、文档空间 ID
63
-
64
- ### 2.4 云效 / 钉钉
65
-
66
- - **职责**:
67
- - 任务协作(产品 / 开发 / 测试 / 运维)
68
- - bug tracker(CDPT-XXX 编号)
69
- - CI(自动跑测试 / 构建 / 部署)
70
- - 代码托管(gitee / gitlab)
71
- - **集成方式**:
72
- - 任务 / bug:人工操作(云效网页)
73
- - CI:webhook 触发
74
- - 事故编号命名规范:`CDPT-XXX`
75
- - **占位**(待人工补):gitee 仓库地址、CI 配置位置
76
-
77
- ### 2.5 车位 / 设备 IoT
78
-
79
- - **职责**:扫码充电触发、车位枪状态、充电事件
80
- - **集成方式**:
81
- - 扫码:HTTP API(前端 → 本服务 → IoT 网关)
82
- - 车位枪状态:MQ 事件(IoT → 本服务)
83
- - 充电事件:MQ 事件(IoT → 本服务 → 财务对账)
84
- - **关键事件**:
85
- - 扫码开启充电(CDPT-163 历史事故:开不了)
86
- - 车位枪启用 / 停用(CDPT-199 历史事故:未绑定时按钮可点)
87
- - **占位**(待人工补):MQ topic、IoT 网关 API、事件 schema
88
-
89
- ### 2.6 支付 / 退款通道
90
-
91
- - **职责**:套餐购买支付、退款、续费扣款
92
- - **集成方式**:HTTP API(同步)+ webhook 回调
93
- - **关键流程**:
94
- - 支付成功 → 开通套餐 → 同步 BEM
95
- - 退款发起 → 支付通道退款 → 同步 BEM → 更新本地状态
96
- - **占位**(待人工补):支付渠道(微信 / 支付宝 / 银联)、回调地址
97
-
98
- ## 3. MQ 约定(占位 — 待人工补实际 topic)
99
-
100
- | Topic 模式 | 生产者 | 消费者 | 用途 |
101
- |-----------|--------|--------|------|
102
- | `evcharge.charging.event.v1` | 充电桩 / IoT | 本服务 | 充电事件(开始 / 停止 / 故障) |
103
- | `evcharge.billing.refund.v1` | 本服务 | BEM | 退款事件 |
104
- | `evcharge.billing.renew.v1` | 本服务 | BEM | 续费事件 |
105
- | `evcharge.billing.sync.v1` | BEM | 本服务 | 停车月票权益变化 |
106
- | `evcharge.finance.reconcile.v1` | 财务对账系统 | 本服务 | 对账差异推送 |
107
-
108
- > **占位说明**:上述 topic 是命名规范示例,**实际 topic 需从代码常量 / 配置文件核对**(grep `RocketMQTemplate` / `KafkaTemplate` / `@RocketMQMessageListener` 等)
109
-
110
- ## 4. 共享表 / 跨仓约定
111
-
112
- ### 4.1 跨仓对账清单(占位 — 待人工补)
113
-
114
- | 表 | 真源 | 消费仓 1 | 消费仓 2 | 消费仓 3 |
115
- |----|------|---------|---------|---------|
116
- | `t_package` | 本服务 | BEM(只读) | 财务对账 | 定时任务 |
117
- | `t_package_order` | 本服务 | BEM | 财务对账 | 退款通道 |
118
- | `t_site` | 本服务 | BEM | IoT 网关 | 第三方平台 |
119
- | `t_operator` | 本服务 | BEM | 财务对账 | 第三方平台 |
120
-
121
- > **占位说明**:实际表名 / 字段 / 关系 需从 `src/main/resources/sql/` 和 `application-*.yml` 核对
122
-
123
- ### 4.2 关键表(占位 — 待人工补详细 schema)
124
-
125
- - `t_package` — 套餐主表
126
- - `t_package_order` — 套餐开通 / 续费 / 退款记录
127
- - `t_package_site` — 套餐与站点关系表(**注意:这是 CDPT-165 修复后引入的"中间表",运营商边界过滤必须走这里**)
128
- - `t_site` — 站点表
129
- - `t_operator` — 运营商表
130
- - `t_site_operator` — 站点与运营商关系表
131
-
132
- > **占位说明**:详细字段、索引、外键、默认值需查 `sql/` 目录
133
-
134
- ## 5. API 约定
135
-
136
- ### 5.1 REST 风格
137
-
138
- - URL:`/api/v1/<resource>/<action>`
139
- - 鉴权:JWT / Session(占位,待补)
140
- - 错误码:4xx 业务错误 + 5xx 系统错误(占位,待补错误码表)
141
- - 分页:统一 `{ page, size, total }` 格式(占位)
142
-
143
- ### 5.2 关键 API(占位 — 待人工补路径)
144
-
145
- | API | 方法 | 用途 | 关联事故 |
146
- |-----|------|------|---------|
147
- | 创建套餐 | POST | 运营商创建套餐 | CDPT-165 / CDPT-171 |
148
- | 套餐分页查询 | GET | 按运营商过滤 | CDPT-165 |
149
- | 套餐开通 | POST | 用户购买 / 批量开通 | CDPT-179 / CDPT-180 |
150
- | 套餐续费 | POST | 续费停车月票 | CDPT-169 |
151
- | 套餐退款 | POST | 单笔 / 批量退款 | CDPT-186 |
152
- | 套餐适用站点修改 | PUT | 修改适用站点 | CDPT-192 |
153
- | 扫码充电 | POST | 触发充电 | CDPT-163 |
154
- | 导出 Excel | GET | 各种导出 | CDPT-166 / CDPT-188 / CDPT-177 |
155
-
156
- > **占位说明**:实际 API 路径 / 入参 / 出参 需查 `src/main/java/` 的 Controller
157
-
158
- ## 6. 维护提示
159
-
160
- - 本文件是**初始版**,superflow init Step 5 + 人工补全
161
- - **自动化补充重点**:
162
- - 用 `superflow scan` 让 LLM 扫代码常量 → 自动填 MQ topic、API 路径、表名
163
- - grep `RocketMQTemplate` / `KafkaTemplate` / `@RestController` 拿实际接口
164
- - 读 `application.yml` 拿数据库连接 / Redis / MQ 连接配置
165
- - **不要在事故没复盘前**补充根因 — 留空让负责人填
166
- - 重要变更(升级支付渠道 / 接入新 IoT)必须追加本文件相关章节
16
+ ## 2. 外部系统清单
17
+
18
+ | 系统 | 职责 | 集成方式 | 环境 | owner | 失败处理 |
19
+ |------|------|----------|------|-------|----------|
20
+ | `<系统 A>` | `<职责>` | `<HTTP/MQ/SDK/File>` | `<dev/test/prod>` | `<负责人>` | `<重试/告警/补偿>` |
21
+ | `<系统 B>` | `<职责>` | `<HTTP/MQ/SDK/File>` | `<dev/test/prod>` | `<负责人>` | `<重试/告警/补偿>` |
22
+
23
+ ## 3. API / SDK 约定
24
+
25
+ | 系统 | API/SDK | 调用方 | 鉴权 | 超时/重试 | 真实联调入口 |
26
+ |------|---------|--------|------|-----------|--------------|
27
+ | `<系统 A>` | `<路径/方法/SDK 方法>` | `<模块>` | `<方式>` | `<策略>` | `<curl/控制台/模拟器>` |
28
+
29
+ 维护要求:
30
+
31
+ - 真实 API 路径、参数和响应以源码、官方文档或联调记录为准。
32
+ - 不允许凭历史经验补字段;字段语义不确定时必须回到事实源。
33
+ - 新增、删除或重命名字段时,要反查所有调用方、DTO、Mapper、日志和测试。
34
+
35
+ ## 4. 消息与异步链路
36
+
37
+ | Topic / Queue / Event | 生产者 | 消费者 | Payload 真源 | 幂等键 | 验证方式 |
38
+ |-----------------------|--------|--------|--------------|--------|----------|
39
+ | `<事件名>` | `<系统>` | `<系统>` | `<schema/代码>` | `<字段>` | `<日志/DB/消费记录>` |
40
+
41
+ 异步任务完成证据至少包含:
42
+
43
+ - 生产侧日志或发送记录。
44
+ - 消费侧日志或处理记录。
45
+ - 状态推进、数据库落库或下游回调。
46
+ - 重试、死信或补偿策略说明。
47
+
48
+ ## 5. 文件、对象存储和批处理
49
+
50
+ | 文件/任务 | 来源 | 格式 | 存储位置 | 触发方式 | 验证方式 |
51
+ |-----------|------|------|----------|----------|----------|
52
+ | `<文件/任务>` | `<来源>` | `<CSV/XLSX/JSON>` | `<路径/桶>` | `<手动/定时/API>` | `<样本/日志/结果>` |
53
+
54
+ ## 6. 环境与凭据
55
+
56
+ | 环境 | 地址 | 凭据来源 | 测试账号 | 注意事项 |
57
+ |------|------|----------|----------|----------|
58
+ | dev | `<地址>` | `<env/secret manager>` | `<账号>` | `<说明>` |
59
+ | test | `<地址>` | `<env/secret manager>` | `<账号>` | `<说明>` |
60
+ | prod | `<地址>` | `<env/secret manager>` | `<账号>` | `<说明>` |
61
+
62
+ 不要把真实 secret、token、private key 写入本文件。只记录凭据来源和申请方式。
63
+
64
+ ## 7. 联调与验收要求
65
+
66
+ - 有可用沙箱或测试环境时,不能只提交 mock 结果。
67
+ - 如果真实联调暂不可用,必须写明阻塞原因、owner、恢复条件和临时替代验证。
68
+ - `test-report.md` 必须包含实际请求、实际响应、日志或数据证据。
69
+ - 对外部系统的兼容逻辑必须可观测,不能静默吞错。
@@ -1,89 +1,51 @@
1
- # 历史事故
1
+ # 事故、返工与缺陷复盘
2
2
 
3
- > **初始版来源**:`openspec/changes/v1.1-add-charging-package-suite/bug-archive/yunxiao-2026-06-02-pending-confirmation/`(云效 2026-06-02 待确认批次)+ sdd-cli 引用过的 P 编号
4
- > **维护方**:测试 + 开发
5
- > **自动化率**:20-40%(commit "fix" + 注释 "FIX" 可挖,PR 描述/issue tracker 不可访问——私有仓)
3
+ > **用途**:沉淀项目历史事故、返工、漏测和联调问题,避免同类问题重复发生。
4
+ > **维护方**:测试负责人 / 开发负责人 / 模块 owner
6
5
 
7
- ## 1. v1.1 充电套餐批次(2026-06-02 云效待确认)
6
+ ## 1. 事故索引
8
7
 
9
- 来源目录:`openspec/changes/v1.1-add-charging-package-suite/bug-archive/yunxiao-2026-06-02-pending-confirmation/`
10
- 原始文件:HTML(云效导出) + `raw-bugs.json`(待解析)
8
+ | 编号 | 标题 | 发现时间 | 严重级别 | 状态 | 关联规则 |
9
+ |------|------|----------|----------|------|----------|
10
+ | INC-001 | `<标题>` | `YYYY-MM-DD` | `<P0/P1/P2/P3>` | `<待修复/已修复/已复盘>` | `<business-rules/decisions>` |
11
11
 
12
- ### 1.1 套餐运营商 / 站点相关
12
+ ## 2. 复盘模板
13
13
 
14
- | CDPT | 标题 | 状态 | 关联规则 |
15
- |------|------|------|---------|
16
- | CDPT-165 | 创建套餐的查询条件,运营商与查询结果不匹配,创建的套餐是其他运营商的 | 待修复 | [business-rules §1.1](./business-rules.md#11-套餐业务) |
17
- | CDPT-171 | 应限制同一个站点不能创建相同名称的优惠套餐 | 待修复 | §1.1 |
18
- | CDPT-192 | 修改充电套餐的适用站点后,已开通套餐的记录,适用站点没有更新 | 待修复 | §1.1 |
19
- | CDPT-166 | 创建套餐页面,导出 Excel 中的使用站点列展示错误 | 待修复 | §4 |
20
- | CDPT-158 | 充电套餐的有效时段,应该允许跨天 | 待修复 | §1.1 |
21
- | CDPT-175 | 同车牌不同套餐、不同有效时间段 — 应该允许开通 | 待修复 | §1.1 |
22
-
23
- ### 1.2 退款 / 对账 / 权益同步
24
-
25
- | CDPT | 标题 | 状态 | 关联规则 |
26
- |------|------|------|---------|
27
- | CDPT-186 | 充电套餐退款后,停车月票权益在 BEM 没有同步退款 | 待修复 | [business-rules §1.2](./business-rules.md#12-计费--退款--对账) |
28
- | CDPT-189 | 已退款的优惠套餐订单,扫码开票提示需优化 | 待修复 | §3 |
29
- | CDPT-169 | 续费充电套餐(停车月票),BEM 没有对该月票订单续费 | 待修复 | §6 |
30
- | CDPT-193 | 充电套餐适用多个站点时,无法开票 | 待修复 | §1.1 |
31
-
32
- ### 1.3 批量开通 / 续费 / 退款
33
-
34
- | CDPT | 标题 | 状态 | 关联规则 |
35
- |------|------|------|---------|
36
- | CDPT-185 | 批量开通、续费、退款模板中手机号应支持填写 1 个或 2 个手机号 | 待修复 | [business-rules §2.1](./business-rules.md#21-批量开通--续费--退款) |
37
- | CDPT-180 | 批量开通、续费、退费时,遇到错误/异常数据整批数据都不插入业务系统,明确提示哪一行,哪个字段数据异常 | 待修复 | §2.1 |
38
- | CDPT-181 | 问题 1:批量开通上传文件类型错误时的提示需优化;问题 2:导入空的 Excel 模板也提示成功 | 待修复 | §2.1、§2.2 |
39
- | CDPT-178 | 批量开通、续费、退费模版字段,必填字段应加入【必填】两个字 | 待修复 | §2.1 |
40
- | CDPT-179 | 批量开通充电套餐,选择当天,1 天有效期,开通记录显示已过期。在页面开通显示生效中 | 待修复 | §2.1 |
41
- | CDPT-198 | 批量导入车位枪的文件格式错误,提示需优化 | 待修复 | §2.2 |
42
- | CDPT-199 | 站点没有绑定车位枪时,站点的【启用车位枪】按钮不允许打开 | 待修复 | [business-rules §1.3](./business-rules.md#13-车位--设备) |
43
-
44
- ### 1.4 导出 / 查询 / 字段
45
-
46
- | CDPT | 标题 | 状态 | 关联规则 |
47
- |------|------|------|---------|
48
- | CDPT-188 | 套餐开通记录导出,剩余充电额度为不限额时,导出内容错误 | 待修复 | [business-rules §4](./business-rules.md#4-数据权限--字段约束) |
49
- | CDPT-177 | 开通套餐记录导出的 Excel 中不要合并不连续的有效期 | 待修复 | §4 |
50
- | CDPT-173 | 开通套餐页面的查询条件,【车牌号码】应支持模糊查询 | 待修复 | §4 |
51
- | CDPT-164 | 开通套餐的记录中,最近操作人取值错误(admin 后台开通) | 待修复 | §4 |
52
- | CDPT-163 | 开通充电套餐后,扫码开启充电,没有套餐可用 | 待修复 | §3 |
53
- | CDPT-194 | 停车权益记录,适用车场的名称没展示 | 待修复 | §4 |
54
-
55
- ## 2. 历史 P 编号记录(sdd-cli 引用过)
56
-
57
- 来源:`sdd-cli/assets/skills/superflow-implement/SKILL.md` 等地方提到的 P 编号示例
58
-
59
- | P 编号 | 描述 | 备注 |
60
- |--------|------|------|
61
- | P50 | worktree 启动端口示例(base 9250 → 9300) | 端口计算约定 |
62
- | P64 | prompt 命名示例(p64-export-plot-display.md) | 命名约定 |
63
-
64
- > **注**:完整 P 编号历史应从 git log + openspec/changes/archive/ 反推。本文件仅记录 sdd-cli 显式引用的。
14
+ ```markdown
15
+ ### INC-001: <标题>
16
+
17
+ - **发现时间**:YYYY-MM-DD HH:mm
18
+ - **发现渠道**:线上报警 / QA / 客户反馈 / 联调 / code review
19
+ - **影响范围**:用户、订单、数据、接口、任务或环境范围。
20
+ - **直接原因**:触发故障的直接技术原因。
21
+ - **根因**:为什么流程、设计、测试或代码没有提前发现。
22
+ - **修复 commit / PR**:<链接或 SHA>
23
+ - **验证证据**:测试命令、真实请求、日志、DB 记录或截图。
24
+ - **防复发措施**:
25
+ - 文档规则:补充到哪个 `docs/sdd-context/*.md`
26
+ - 代码防线:新增哪个测试、断言、告警或 guard
27
+ - 流程防线:哪个阶段必须新增检查项
28
+ - **复盘人**:<name>
29
+ ```
65
30
 
66
- ## 3. 事故复盘模板
31
+ ## 3. 常见问题分类
67
32
 
68
- 每条事故建议补充以下信息(自动化扫不到,需人工补):
33
+ | 分类 | 典型表现 | Superflow 阶段加固 |
34
+ |------|----------|-------------------|
35
+ | 需求理解偏差 | 字段语义、状态流、边界条件理解错误 | clarify / docs |
36
+ | 源码影响面遗漏 | 只改一处,没有反查所有引用 | design |
37
+ | 数据库合同遗漏 | 代码依赖字段,但 SQL/migration 未更新 | docs / verify |
38
+ | mock-only 假通过 | 只跑 mock 单测,未跑真实入口 | implement / verify |
39
+ | 异步链路漏验 | MQ、定时任务、回调没有真实证据 | verify |
40
+ | 上下文漂移 | 长会话压缩后忘记原始约束 | handoff / guard |
69
41
 
70
- ```markdown
71
- ### CDPT-XXX: <标题>
42
+ ## 4. 复盘回写要求
72
43
 
73
- - **发现时间**:YYYY-MM-DD
74
- - **发现渠道**:云效 / QA / 线上报警 / 客户反馈
75
- - **根因**:(一句话说清楚,不要泛泛说"业务逻辑错误")
76
- - **影响范围**:(哪些模块 / 哪些数据 / 多少用户 / 持续多久)
77
- - **修复 commit**:(`git log --grep="CDPT-XXX"` 拿 SHA)
78
- - **修复时间**:YYYY-MM-DD
79
- - **复盘人**:<name>
80
- - **预防措施**:(代码 / 流程 / 测试 哪一层加固)
81
- - **关联规则**:[business-rules.md §X.Y](./business-rules.md)
82
- ```
44
+ 事故复盘完成后,至少回写一处长期规则:
83
45
 
84
- ## 4. 维护提示
46
+ - 业务规则问题:写入 [business-rules.md](./business-rules.md)。
47
+ - 架构或工程约定问题:写入 [decisions.md](./decisions.md)。
48
+ - 外部系统或联调问题:写入 [external-systems.md](./external-systems.md)。
49
+ - 测试策略问题:写入当前 OpenSpec change 的 `tests.md` 和 `test-report.md`。
85
50
 
86
- - **不要直接复制云效 HTML**——内容里含截图/附件链接,存 md 里维护性差
87
- - 建议用 `raw-bugs.json` 解析后写本文件(一次性脚本)
88
- - 后期可让 LLM 帮补全"根因 / 影响范围"等结构化字段
89
- - 修复完成后这条记录可以从"待修复"挪到"已闭环"区
51
+ 只在聊天记录里解释,不算复盘完成。
@@ -0,0 +1,72 @@
1
+ # Business Rules
2
+
3
+ > **Purpose**: Capture long-lived project business rules, edge cases, state
4
+ > transitions, and acceptance criteria.
5
+ > **Owners**: Product owner / business owner / engineering owner
6
+ > **Maintenance**: `superflow init --language en` creates this template. Fill it
7
+ > with project-specific facts before relying on it for delivery decisions.
8
+
9
+ ## 1. Core Business Objects
10
+
11
+ | Object | Meaning | Uniqueness Rule | Lifecycle States | Key Constraints |
12
+ |--------|---------|-----------------|------------------|-----------------|
13
+ | `<Object A>` | `<Meaning>` | `<Unique key>` | `<States>` | `<Constraints>` |
14
+ | `<Object B>` | `<Meaning>` | `<Unique key>` | `<States>` | `<Constraints>` |
15
+
16
+ ## 2. State Transitions
17
+
18
+ | State | Entry Condition | Allowed Actions | Forbidden Actions | Exit Condition |
19
+ |-------|-----------------|-----------------|-------------------|----------------|
20
+ | `<State A>` | `<Condition>` | `<Actions>` | `<Actions>` | `<Condition>` |
21
+ | `<State B>` | `<Condition>` | `<Actions>` | `<Actions>` | `<Condition>` |
22
+
23
+ Rules:
24
+
25
+ - When a state field, enum, derived value, or sync value changes, reverse-scan
26
+ all readers, writers, filters, exports, scheduled jobs, callbacks, and
27
+ cross-repo consumers.
28
+ - Record the real source of truth for derived state. Do not infer semantics
29
+ from field names alone.
30
+ - Compatibility or fallback behavior must name the owner, removal condition,
31
+ and observability plan.
32
+
33
+ ## 3. Critical Business Rules
34
+
35
+ | ID | Rule | Applies To | Edge Case | Acceptance Evidence |
36
+ |----|------|------------|-----------|---------------------|
37
+ | BR-001 | `<Rule>` | `<Page/API/job>` | `<Edge case>` | `<Test/evidence>` |
38
+ | BR-002 | `<Rule>` | `<Page/API/job>` | `<Edge case>` | `<Test/evidence>` |
39
+
40
+ ## 4. Data And Permission Boundaries
41
+
42
+ | Dimension | Rule | Evidence Source |
43
+ |-----------|------|-----------------|
44
+ | Tenant / organization / project | `<Isolation rule>` | `<Source/config/table>` |
45
+ | User roles | `<Permission rule>` | `<Menu/API/auth point>` |
46
+ | Data visibility | `<Query scope>` | `<Mapper/API/page>` |
47
+ | Write permissions | `<Mutation rule>` | `<Service/transaction/audit>` |
48
+
49
+ ## 5. Batch, Import, Export, And Error Rules
50
+
51
+ - Batch operations must define all-or-nothing vs partial-success behavior.
52
+ - Import templates must define required fields, formats, enums, duplicates, and
53
+ empty-file behavior.
54
+ - Export fields must match page/API semantics; document intentional differences.
55
+ - Error messages must identify the object, row, field, or concrete fix.
56
+
57
+ ## 6. Real Acceptance Evidence
58
+
59
+ Requirements involving external systems, databases, async jobs, message queues,
60
+ payments, files, permissions, or state transitions cannot be closed with mock
61
+ unit tests alone. `test-report.md` should record:
62
+
63
+ - Real entry point: page, API, message, scheduled job, or external callback.
64
+ - Real parameters: request body, message payload, file sample, or test account.
65
+ - Real result: response, database record, log, downstream callback, or UI state.
66
+ - Assertion: expected vs actual values.
67
+
68
+ ## 7. Maintenance Notes
69
+
70
+ - Keep project facts here, not generic process slogans.
71
+ - After incidents, rework, or integration misses, add reusable rules here.
72
+ - Mark uncertain rules as `To confirm`, with owner and evidence source.
@@ -0,0 +1,72 @@
1
+ # Architecture And Engineering Decisions
2
+
3
+ > **Purpose**: Capture long-lived architectural choices, engineering conventions,
4
+ > and the reasoning behind trade-offs.
5
+ > **Owners**: Architect / tech lead / module owner
6
+ > **Recommended format**: ADR (Architecture Decision Record)
7
+
8
+ ## ADR-001: <Decision Title>
9
+
10
+ - **Status**: Proposed / Accepted / Deprecated / Replaced
11
+ - **Date**: YYYY-MM-DD
12
+ - **Context**: Why this decision is needed.
13
+ - **Decision**: The selected approach.
14
+ - **Alternatives**:
15
+ - Option A: benefits and costs.
16
+ - Option B: benefits and costs.
17
+ - **Impact**: Repositories, modules, tables, APIs, jobs, or deployment paths.
18
+ - **Consequences**: Benefits, costs, risks, and future constraints.
19
+ - **Verification**: How to prove the decision is implemented correctly.
20
+
21
+ ## 1. Project Structure
22
+
23
+ | Topic | Current Convention | Source Of Truth | Notes |
24
+ |-------|--------------------|-----------------|-------|
25
+ | Module boundaries | `<Description>` | `<Directory/doc/config>` | `<Notes>` |
26
+ | Layering | `<Description>` | `<Entrypoint>` | `<Notes>` |
27
+ | Naming | `<Description>` | `<README/code example>` | `<Notes>` |
28
+ | Configuration | `<Description>` | `<env/config/secret source>` | `<Notes>` |
29
+
30
+ ## 2. Database And Persistence
31
+
32
+ | Topic | Current Convention | Required Gate |
33
+ |-------|--------------------|---------------|
34
+ | Schema source of truth | `<SQL/migration/live schema>` | Verify before edits |
35
+ | Release SQL / migration | `<Rule>` | Required fields must ship |
36
+ | Shared table consumers | `<Repo/module list>` | Reverse-scan all consumers |
37
+ | Soft delete / multi-tenancy | `<Rule>` | Mapper/XML queries must align |
38
+
39
+ ## 3. API And Integration
40
+
41
+ | Topic | Current Convention | Verification |
42
+ |-------|--------------------|--------------|
43
+ | API style | `<REST/RPC/GraphQL/message>` | `<Contract/integration test>` |
44
+ | Authentication | `<Method>` | `<Test account/permission matrix>` |
45
+ | Error codes | `<Rule>` | `<API doc/test>` |
46
+ | External calls | `<Rule>` | `<Sandbox/real env/simulator>` |
47
+
48
+ ## 4. Testing And Delivery
49
+
50
+ - Unit tests prove local logic; they do not prove a real delivery path.
51
+ - External entry points require real request, message, log, or state evidence.
52
+ - Database-backed changes require schema and data evidence.
53
+ - Async flows require message, log, state transition, retry, or compensation
54
+ evidence.
55
+ - Before claiming completion, run the relevant Superflow guard and project
56
+ verification command.
57
+
58
+ ## 5. Superflow Usage Decisions
59
+
60
+ - OpenSpec/SDD owns WHAT and contracts.
61
+ - Superpowers owns source-level HOW, TDD order, review, and verification
62
+ discipline.
63
+ - `.sdd/state.yaml` and `.sdd/handoff/` are the state source of truth for
64
+ preventing context drift.
65
+ - Parallel workers must state which docs and code paths they may edit.
66
+ - Refresh the handoff hash when docs, code, prompts, or test reports change.
67
+
68
+ ## 6. Deprecated Decisions
69
+
70
+ | Old Decision | Why Deprecated | Replacement | Date |
71
+ |--------------|----------------|-------------|------|
72
+ | `<ADR ID>` | `<Reason>` | `<ADR ID>` | `YYYY-MM-DD` |
@@ -0,0 +1,78 @@
1
+ # External Systems And Integration Contracts
2
+
3
+ > **Purpose**: Record external systems, APIs, messages, files, accounts, and
4
+ > integration evidence for this project.
5
+ > **Owners**: Integration owner / module owner / QA owner
6
+
7
+ ## 1. System Topology
8
+
9
+ ```text
10
+ <Current system>
11
+ +- HTTP / RPC -> <External system A>
12
+ +- MQ / Event -> <External system B>
13
+ +- File / Object Storage -> <External system C>
14
+ +- Webhook / Callback <- <External system D>
15
+ ```
16
+
17
+ ## 2. External System Inventory
18
+
19
+ | System | Responsibility | Integration Type | Environment | Owner | Failure Handling |
20
+ |--------|----------------|------------------|-------------|-------|------------------|
21
+ | `<System A>` | `<Responsibility>` | `<HTTP/MQ/SDK/File>` | `<dev/test/prod>` | `<Owner>` | `<Retry/alert/compensation>` |
22
+ | `<System B>` | `<Responsibility>` | `<HTTP/MQ/SDK/File>` | `<dev/test/prod>` | `<Owner>` | `<Retry/alert/compensation>` |
23
+
24
+ ## 3. API / SDK Contracts
25
+
26
+ | System | API/SDK | Caller | Auth | Timeout/Retry | Real Test Entry |
27
+ |--------|---------|--------|------|---------------|-----------------|
28
+ | `<System A>` | `<Path/method/SDK method>` | `<Module>` | `<Method>` | `<Policy>` | `<curl/console/simulator>` |
29
+
30
+ Rules:
31
+
32
+ - Real API paths, parameters, and responses must come from source code,
33
+ official docs, or integration records.
34
+ - Do not invent fields from memory. If semantics are unclear, return to the
35
+ source of truth.
36
+ - When a field is added, removed, or renamed, reverse-scan callers, DTOs,
37
+ mappers, logs, and tests.
38
+
39
+ ## 4. Messages And Async Flows
40
+
41
+ | Topic / Queue / Event | Producer | Consumer | Payload Source | Idempotency Key | Verification |
42
+ |-----------------------|----------|----------|----------------|-----------------|--------------|
43
+ | `<Event>` | `<System>` | `<System>` | `<Schema/code>` | `<Field>` | `<Log/DB/consumer record>` |
44
+
45
+ Async completion evidence should include:
46
+
47
+ - Producer log or send record.
48
+ - Consumer log or handling record.
49
+ - State transition, database write, or downstream callback.
50
+ - Retry, dead-letter, or compensation strategy.
51
+
52
+ ## 5. Files, Object Storage, And Batch Jobs
53
+
54
+ | File / Job | Source | Format | Storage | Trigger | Verification |
55
+ |------------|--------|--------|---------|---------|--------------|
56
+ | `<File/job>` | `<Source>` | `<CSV/XLSX/JSON>` | `<Path/bucket>` | `<Manual/scheduled/API>` | `<Sample/log/result>` |
57
+
58
+ ## 6. Environments And Credentials
59
+
60
+ | Environment | Address | Credential Source | Test Account | Notes |
61
+ |-------------|---------|-------------------|--------------|-------|
62
+ | dev | `<URL>` | `<env/secret manager>` | `<Account>` | `<Notes>` |
63
+ | test | `<URL>` | `<env/secret manager>` | `<Account>` | `<Notes>` |
64
+ | prod | `<URL>` | `<env/secret manager>` | `<Account>` | `<Notes>` |
65
+
66
+ Do not write real secrets, tokens, or private keys here. Record only where they
67
+ come from and how to request access.
68
+
69
+ ## 7. Integration Acceptance
70
+
71
+ - When sandbox or test environments are available, mock-only evidence is not
72
+ enough.
73
+ - If real integration is blocked, record the blocker, owner, recovery condition,
74
+ and temporary substitute verification.
75
+ - `test-report.md` must include actual requests, responses, logs, or data
76
+ evidence.
77
+ - Compatibility logic for external systems must be observable; do not silently
78
+ swallow errors.
@@ -0,0 +1,52 @@
1
+ # Incidents, Rework, And Defect Reviews
2
+
3
+ > **Purpose**: Capture incidents, rework, missed tests, and integration misses
4
+ > so similar issues do not repeat.
5
+ > **Owners**: QA owner / engineering owner / module owner
6
+
7
+ ## 1. Incident Index
8
+
9
+ | ID | Title | Found At | Severity | Status | Related Rule |
10
+ |----|-------|----------|----------|--------|--------------|
11
+ | INC-001 | `<Title>` | `YYYY-MM-DD` | `<P0/P1/P2/P3>` | `<Open/fixed/reviewed>` | `<business-rules/decisions>` |
12
+
13
+ ## 2. Review Template
14
+
15
+ ```markdown
16
+ ### INC-001: <Title>
17
+
18
+ - **Found at**: YYYY-MM-DD HH:mm
19
+ - **Found by**: Production alert / QA / customer feedback / integration / code review
20
+ - **Impact**: Users, orders, data, APIs, jobs, or environments affected.
21
+ - **Immediate cause**: The technical trigger.
22
+ - **Root cause**: Why design, process, tests, or code failed to catch it earlier.
23
+ - **Fix commit / PR**: <link or SHA>
24
+ - **Verification evidence**: Test command, real request, log, DB row, or screenshot.
25
+ - **Prevention**:
26
+ - Documentation rule: which `docs/sdd-context/*.md` file was updated.
27
+ - Code guard: which test, assertion, alert, or guard was added.
28
+ - Process guard: which workflow phase now checks this.
29
+ - **Reviewer**: <name>
30
+ ```
31
+
32
+ ## 3. Common Categories
33
+
34
+ | Category | Typical Symptom | Superflow Phase To Harden |
35
+ |----------|-----------------|---------------------------|
36
+ | Requirement drift | Field semantics, state flow, or edge case misunderstood | clarify / docs |
37
+ | Source impact missed | Only one reference changed, other consumers missed | design |
38
+ | Database contract missed | Code depends on fields that release SQL does not ship | docs / verify |
39
+ | Mock-only false pass | Mock unit tests pass but real entry fails | implement / verify |
40
+ | Async flow unverified | MQ, scheduled job, or callback lacks real evidence | verify |
41
+ | Context drift | Long session compression loses original constraints | handoff / guard |
42
+
43
+ ## 4. Required Backfill
44
+
45
+ After an incident review, update at least one long-lived rule:
46
+
47
+ - Business rule issue: [business-rules.md](./business-rules.md).
48
+ - Architecture or engineering decision issue: [decisions.md](./decisions.md).
49
+ - External integration issue: [external-systems.md](./external-systems.md).
50
+ - Test strategy issue: current OpenSpec change `tests.md` and `test-report.md`.
51
+
52
+ Explaining the issue only in chat does not count as a completed review.