@chenmk/superflow 0.1.1 → 0.1.2

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 (79) hide show
  1. package/INSTALL.en.md +32 -5
  2. package/INSTALL.md +58 -17
  3. package/README.md +83 -7
  4. package/README.zh-CN.md +80 -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-en/api-doc-changelog/SKILL.md +64 -151
  18. package/assets/skills-en/superflow-clarify/SKILL.md +4 -4
  19. package/assets/skills-en/superflow-clarify/agents/openai.yaml +1 -1
  20. package/assets/skills-en/superflow-design/agents/openai.yaml +1 -1
  21. package/assets/skills-en/superflow-docs/SKILL.md +27 -27
  22. package/assets/skills-en/superflow-docs/agents/openai.yaml +1 -1
  23. package/assets/skills-en/superflow-implement/SKILL.md +113 -457
  24. package/assets/skills-en/superflow-implement/agents/openai.yaml +1 -1
  25. package/assets/skills-en/superflow-pipeline/SKILL.md +167 -840
  26. package/assets/skills-en/superflow-pipeline/agents/openai.yaml +1 -1
  27. package/assets/skills-en/superflow-pipeline/references/api-design-template.md +17 -426
  28. package/assets/skills-en/superflow-pipeline/references/architecture-design-template.md +15 -114
  29. package/assets/skills-en/superflow-pipeline/references/batch-prompt-template.md +36 -524
  30. package/assets/skills-en/superflow-pipeline/references/batch-split-guide.md +19 -133
  31. package/assets/skills-en/superflow-pipeline/references/document-templates.md +50 -123
  32. package/assets/skills-en/superflow-pipeline/references/feature-gated-workflow.md +12 -119
  33. package/assets/skills-en/superflow-pipeline/references/implementation-prompt-template.md +22 -1044
  34. package/assets/skills-en/superflow-pipeline/references/mock-strategy-guide.md +11 -81
  35. package/assets/skills-en/superflow-pipeline/references/openspec-format.md +17 -51
  36. package/assets/skills-en/superflow-pipeline/references/orchestration.md +17 -632
  37. package/assets/skills-en/superflow-pipeline/references/p0-baseline-template.md +10 -169
  38. package/assets/skills-en/superflow-pipeline/references/prompt-usage-template.md +29 -128
  39. package/assets/skills-en/superflow-pipeline/references/quality-gate.md +36 -299
  40. package/assets/skills-en/superflow-pipeline/references/quality-standards.md +12 -186
  41. package/assets/skills-en/superflow-pipeline/references/reviewer-checklist.md +12 -154
  42. package/assets/skills-en/superflow-pipeline/references/sql-risk-review-checklist.md +19 -316
  43. package/assets/skills-en/superflow-pipeline/references/test-execution-template.md +22 -220
  44. package/assets/skills-en/superflow-pipeline/references/test-guide.md +12 -26
  45. package/assets/skills-en/superflow-pipeline/references/traceability-matrix.md +5 -103
  46. package/assets/skills-en/superflow-pipeline/references/validation-integrity.md +12 -130
  47. package/assets/skills-en/superflow-pipeline/scripts/superflow-guard.sh +23 -23
  48. package/assets/skills-en/superflow-pipeline/scripts/superflow-state.sh +1 -1
  49. package/assets/skills-en/superflow-pipeline/scripts/superflow-status.sh +15 -15
  50. package/assets/skills-en/superflow-table-impact-analysis/SKILL.md +3 -3
  51. package/dist/cli/index.js +61 -54
  52. package/dist/cli/index.js.map +1 -1
  53. package/dist/commands/doctor.js +31 -12
  54. package/dist/commands/doctor.js.map +1 -1
  55. package/dist/commands/init.js +75 -27
  56. package/dist/commands/init.js.map +1 -1
  57. package/dist/commands/scan.js +8 -4
  58. package/dist/commands/scan.js.map +1 -1
  59. package/dist/commands/uninstall.js +3 -3
  60. package/dist/commands/uninstall.js.map +1 -1
  61. package/dist/commands/update.js +8 -3
  62. package/dist/commands/update.js.map +1 -1
  63. package/dist/core/cli-help.js +98 -0
  64. package/dist/core/cli-help.js.map +1 -0
  65. package/dist/core/context.js +40 -17
  66. package/dist/core/context.js.map +1 -1
  67. package/dist/core/detect.js +58 -5
  68. package/dist/core/detect.js.map +1 -1
  69. package/dist/core/i18n.js +10 -8
  70. package/dist/core/i18n.js.map +1 -1
  71. package/dist/core/manifest.js +3 -0
  72. package/dist/core/manifest.js.map +1 -1
  73. package/dist/core/scripts.js +8 -0
  74. package/dist/core/scripts.js.map +1 -1
  75. package/dist/core/skills.js +6 -0
  76. package/dist/core/skills.js.map +1 -1
  77. package/dist/core/state.js +12 -1
  78. package/dist/core/state.js.map +1 -1
  79. package/package.json +4 -3
@@ -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.
@@ -1,6 +1,6 @@
1
1
  {
2
- "version": "0.1.0",
3
- "agents": ["claude", "codex"],
2
+ "version": "0.1.2",
3
+ "agents": ["claude", "codex", "opencode"],
4
4
  "skills": [
5
5
  "openspec-apply-change",
6
6
  "openspec-archive-change",
@@ -35,7 +35,8 @@
35
35
  ],
36
36
  "agentScripts": {
37
37
  "claude": ["claude-auto-backup-hook.sh"],
38
- "codex": ["codex-auto-backup-hook.sh"]
38
+ "codex": ["codex-auto-backup-hook.sh"],
39
+ "opencode": []
39
40
  },
40
41
  "hooks": [
41
42
  "superflow-enforce-hook.sh",
@@ -48,6 +49,7 @@
48
49
  ],
49
50
  "agentHooks": {
50
51
  "claude": ["claude-auto-backup-hook.sh"],
51
- "codex": ["codex-auto-backup-hook.sh"]
52
+ "codex": ["codex-auto-backup-hook.sh"],
53
+ "opencode": []
52
54
  }
53
55
  }
@@ -1,13 +1,12 @@
1
1
  #!/bin/bash
2
2
  # Claude Code global experience auto backup hook.
3
- # Syncs curated ~/.claude development experience into code-cli-config/claude-code-setup,
4
- # then commits the backup repository. Push requires explicit --push-once.
3
+ # Optionally syncs curated ~/.claude development experience into a user-provided
4
+ # backup repository. Push requires explicit --push-once.
5
5
 
6
6
  set -u
7
7
 
8
8
  CLAUDE_HOME="${CLAUDE_HOME:-$HOME/.claude}"
9
- CONFIG_REPO="${CLAUDE_CONFIG_REPO:-/Users/chenmankun/cmk-project/code-cli-config}"
10
- BACKUP_ROOT="$CONFIG_REPO/claude-code-setup"
9
+ CONFIG_REPO="${CLAUDE_CONFIG_REPO:-}"
11
10
  LOCK_DIR="${TMPDIR:-/tmp}/claude-auto-backup.lock"
12
11
 
13
12
  usage() {
@@ -18,7 +17,7 @@ usage() {
18
17
  环境变量:
19
18
  CLAUDE_AUTO_BACKUP_DISABLE=1 临时关闭自动备份
20
19
  CLAUDE_AUTO_BACKUP_DRY_RUN=1 只同步检查,不提交
21
- CLAUDE_CONFIG_REPO=/path 指定 code-cli-config 仓库路径
20
+ CLAUDE_CONFIG_REPO=/path 指定备份仓库路径;未设置时自动跳过
22
21
  USAGE
23
22
  }
24
23
 
@@ -42,6 +41,12 @@ if [ "${CLAUDE_AUTO_BACKUP_DISABLE:-0}" = "1" ]; then
42
41
  exit 0
43
42
  fi
44
43
 
44
+ if [ -z "$CONFIG_REPO" ]; then
45
+ exit 0
46
+ fi
47
+
48
+ BACKUP_ROOT="$CONFIG_REPO/claude-code-setup"
49
+
45
50
  log() {
46
51
  echo "[Claude 自动备份] $1" >&2
47
52
  }
@@ -266,7 +271,7 @@ if [ "$DRY_RUN" = "1" ]; then
266
271
  exit 0
267
272
  fi
268
273
 
269
- log "提交 code-cli-config"
274
+ log "提交备份仓库"
270
275
 
271
276
  STAGE_PATHS=(
272
277
  "claude-code-setup/CLAUDE.md"
@@ -1,13 +1,12 @@
1
1
  #!/bin/bash
2
2
  # Codex global experience auto backup hook.
3
- # Syncs curated ~/.codex development experience into code-cli-config/codex-setup,
4
- # then commits the backup repository. Push requires explicit --push-once.
3
+ # Optionally syncs curated ~/.codex development experience into a user-provided
4
+ # backup repository. Push requires explicit --push-once.
5
5
 
6
6
  set -u
7
7
 
8
8
  CODEX_HOME="${CODEX_HOME:-$HOME/.codex}"
9
- CONFIG_REPO="${CODEX_CONFIG_REPO:-/Users/chenmankun/cmk-project/code-cli-config}"
10
- BACKUP_ROOT="$CONFIG_REPO/codex-setup"
9
+ CONFIG_REPO="${CODEX_CONFIG_REPO:-}"
11
10
  LOCK_DIR="${TMPDIR:-/tmp}/codex-auto-backup.lock"
12
11
 
13
12
  usage() {
@@ -18,7 +17,7 @@ usage() {
18
17
  环境变量:
19
18
  CODEX_AUTO_BACKUP_DISABLE=1 临时关闭自动备份
20
19
  CODEX_AUTO_BACKUP_DRY_RUN=1 只同步检查,不提交
21
- CODEX_CONFIG_REPO=/path 指定 code-cli-config 仓库路径
20
+ CODEX_CONFIG_REPO=/path 指定备份仓库路径;未设置时自动跳过
22
21
  USAGE
23
22
  }
24
23
 
@@ -42,6 +41,12 @@ if [ "${CODEX_AUTO_BACKUP_DISABLE:-0}" = "1" ]; then
42
41
  exit 0
43
42
  fi
44
43
 
44
+ if [ -z "$CONFIG_REPO" ]; then
45
+ exit 0
46
+ fi
47
+
48
+ BACKUP_ROOT="$CONFIG_REPO/codex-setup"
49
+
45
50
  log() {
46
51
  echo "[Codex 自动备份] $1" >&2
47
52
  }
@@ -298,7 +303,7 @@ if [ "$DRY_RUN" = "1" ]; then
298
303
  exit 0
299
304
  fi
300
305
 
301
- log "提交 code-cli-config"
306
+ log "提交备份仓库"
302
307
 
303
308
  STAGE_PATHS=(
304
309
  "codex-setup/codex配置/config.toml"