@chenguangyao/devflow-kit 0.1.43

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 (198) hide show
  1. package/CHANGELOG.md +232 -0
  2. package/LICENSE +21 -0
  3. package/README.md +539 -0
  4. package/bin/devflow.js +9 -0
  5. package/docs/RFC-001-devflow-kit.md +617 -0
  6. package/docs/RFC-002-workflow-kernel.md +134 -0
  7. package/docs/enterprise-integration-supplement.md +274 -0
  8. package/docs/internal-gitlab-setup.md +426 -0
  9. package/docs/marketplace-skills.md +231 -0
  10. package/docs/migration-from-arb.md +232 -0
  11. package/docs/tooling-overview.md +774 -0
  12. package/docs/workflow-orchestration.md +695 -0
  13. package/docs/workflow-ui-prototype.html +271 -0
  14. package/package.json +52 -0
  15. package/schemas/config.schema.json +51 -0
  16. package/schemas/delta.schema.json +22 -0
  17. package/schemas/state.schema.json +130 -0
  18. package/schemas/status-surface.schema.json +197 -0
  19. package/schemas/workflow-confirmation-surface.schema.json +70 -0
  20. package/schemas/workflow-picker.schema.json +94 -0
  21. package/scripts/postinstall.js +101 -0
  22. package/scripts/render-workflow-ui-prototype.js +271 -0
  23. package/skills/apply/SKILL.md +313 -0
  24. package/skills/apply/references/discipline-checklist.md +145 -0
  25. package/skills/apply/references/subagent-implementer-prompt.md +113 -0
  26. package/skills/apply/references/subagent-orchestration.md +150 -0
  27. package/skills/apply/references/subagent-reviewer-prompt.md +180 -0
  28. package/skills/apply/references/tdd-loop.md +287 -0
  29. package/skills/apply/references/when-plan-is-wrong.md +279 -0
  30. package/skills/apply/references/worktree-swarm.md +292 -0
  31. package/skills/archive/SKILL.md +229 -0
  32. package/skills/archive/references/conflict-resolution.md +336 -0
  33. package/skills/archive/references/knowledge-deposit.md +381 -0
  34. package/skills/archive/references/spec-merge.md +365 -0
  35. package/skills/brainstorm/SKILL.md +123 -0
  36. package/skills/brainstorm/references/proposal-template.md +244 -0
  37. package/skills/brainstorm/references/question-catalog.md +168 -0
  38. package/skills/brainstorm/references/session-template.md +184 -0
  39. package/skills/ci-fix/SKILL.md +63 -0
  40. package/skills/ci-fix/references/loop.md +25 -0
  41. package/skills/code-review/SKILL.md +279 -0
  42. package/skills/code-review/references/escalation-playbook.md +192 -0
  43. package/skills/code-review/references/language-cheatsheets/go.md +175 -0
  44. package/skills/code-review/references/language-cheatsheets/java-spring-mybatis.md +246 -0
  45. package/skills/code-review/references/language-cheatsheets/python.md +170 -0
  46. package/skills/code-review/references/language-cheatsheets/vue.md +199 -0
  47. package/skills/code-review/references/output-template.md +275 -0
  48. package/skills/code-review/references/review-checklist.md +251 -0
  49. package/skills/complexity-grading/SKILL.md +259 -0
  50. package/skills/deliver/SKILL.md +271 -0
  51. package/skills/deliver/references/delivery-modes.md +299 -0
  52. package/skills/deliver/references/notify.md +359 -0
  53. package/skills/deliver/references/pr-description.md +319 -0
  54. package/skills/dependency-upgrade/SKILL.md +57 -0
  55. package/skills/dependency-upgrade/references/risk-matrix.md +38 -0
  56. package/skills/df-orchestrator/SKILL.md +407 -0
  57. package/skills/df-orchestrator/references/complexity-grading.md +177 -0
  58. package/skills/df-orchestrator/references/escalation-matrix.md +191 -0
  59. package/skills/df-orchestrator/references/routing-rules.md +290 -0
  60. package/skills/df-orchestrator/references/workflow-state-machine.md +208 -0
  61. package/skills/frontend-quality/SKILL.md +61 -0
  62. package/skills/frontend-quality/references/checklist.md +35 -0
  63. package/skills/handoff-resume/SKILL.md +59 -0
  64. package/skills/handoff-resume/references/handoff-template.md +54 -0
  65. package/skills/plan/SKILL.md +166 -0
  66. package/skills/plan/references/task-breakdown.md +207 -0
  67. package/skills/plan/references/task-sequencing.md +143 -0
  68. package/skills/plan/references/task-template.md +248 -0
  69. package/skills/requirement-analysis/SKILL.md +499 -0
  70. package/skills/requirement-analysis/references/acceptance-criteria.md +183 -0
  71. package/skills/requirement-analysis/references/code-recon.md +151 -0
  72. package/skills/requirement-analysis/references/edge-case-catalog.md +164 -0
  73. package/skills/requirement-analysis/references/requirement-template.md +339 -0
  74. package/skills/requirement-analysis/references/scope-negotiation.md +162 -0
  75. package/skills/security-hardening/SKILL.md +60 -0
  76. package/skills/security-hardening/references/checklist.md +42 -0
  77. package/skills/tech-spec/SKILL.md +388 -0
  78. package/skills/tech-spec/references/api-contract-design.md +172 -0
  79. package/skills/tech-spec/references/decision-records.md +110 -0
  80. package/skills/tech-spec/references/design-template.md +301 -0
  81. package/skills/tech-spec/references/rollout-and-rollback.md +203 -0
  82. package/skills/tech-spec/references/spec-delta-conventions.md +250 -0
  83. package/skills/tech-spec/references/transaction-patterns.md +212 -0
  84. package/skills/test-spec/SKILL.md +219 -0
  85. package/skills/test-spec/references/coverage-strategy.md +218 -0
  86. package/skills/test-spec/references/edge-case-to-test.md +143 -0
  87. package/skills/test-spec/references/test-case-template.md +276 -0
  88. package/skills/verify/SKILL.md +232 -0
  89. package/skills/verify/references/nfr-verification.md +292 -0
  90. package/skills/verify/references/report-templates.md +510 -0
  91. package/skills/verify/references/self-test-guide.md +240 -0
  92. package/skills/verify/references/verify-rollback-map.md +247 -0
  93. package/src/cli/commands/_helpers.js +108 -0
  94. package/src/cli/commands/_submit.js +718 -0
  95. package/src/cli/commands/apply.js +198 -0
  96. package/src/cli/commands/archive.js +180 -0
  97. package/src/cli/commands/checkpoint.js +113 -0
  98. package/src/cli/commands/deliver.js +377 -0
  99. package/src/cli/commands/deploy.js +504 -0
  100. package/src/cli/commands/design.js +158 -0
  101. package/src/cli/commands/disable.js +21 -0
  102. package/src/cli/commands/doctor.js +178 -0
  103. package/src/cli/commands/enable.js +21 -0
  104. package/src/cli/commands/flow.js +645 -0
  105. package/src/cli/commands/help.js +93 -0
  106. package/src/cli/commands/ingest.js +602 -0
  107. package/src/cli/commands/init.js +341 -0
  108. package/src/cli/commands/knowledge.js +523 -0
  109. package/src/cli/commands/logs.js +43 -0
  110. package/src/cli/commands/new.js +202 -0
  111. package/src/cli/commands/plan.js +49 -0
  112. package/src/cli/commands/propose.js +27 -0
  113. package/src/cli/commands/provider.js +698 -0
  114. package/src/cli/commands/report.js +143 -0
  115. package/src/cli/commands/requirement.js +227 -0
  116. package/src/cli/commands/review.js +301 -0
  117. package/src/cli/commands/skills.js +457 -0
  118. package/src/cli/commands/status.js +925 -0
  119. package/src/cli/commands/switch.js +27 -0
  120. package/src/cli/commands/sync.js +47 -0
  121. package/src/cli/commands/test.js +366 -0
  122. package/src/cli/commands/uninstall.js +32 -0
  123. package/src/cli/commands/update.js +74 -0
  124. package/src/cli/commands/verify.js +354 -0
  125. package/src/cli/commands/worktree.js +78 -0
  126. package/src/cli/index.js +72 -0
  127. package/src/cli/parse-args.js +102 -0
  128. package/src/core/autodetect.js +271 -0
  129. package/src/core/change.js +208 -0
  130. package/src/core/checkpoint.js +217 -0
  131. package/src/core/config.js +60 -0
  132. package/src/core/delta.js +290 -0
  133. package/src/core/markers.js +59 -0
  134. package/src/core/paths.js +173 -0
  135. package/src/core/plan-tasks.js +36 -0
  136. package/src/core/project-routing.js +285 -0
  137. package/src/core/projects.js +200 -0
  138. package/src/core/state.js +200 -0
  139. package/src/core/workflow-check.js +177 -0
  140. package/src/core/workflow-init.js +34 -0
  141. package/src/core/workflow-picker.js +154 -0
  142. package/src/core/workflow-policy.js +119 -0
  143. package/src/core/workflow-suggest.js +181 -0
  144. package/src/core/workflow-verify.js +88 -0
  145. package/src/core/workflow.js +433 -0
  146. package/src/core/worktree.js +241 -0
  147. package/src/knowledge/categories.js +107 -0
  148. package/src/knowledge/classify.js +125 -0
  149. package/src/knowledge/deposit.js +414 -0
  150. package/src/knowledge/migrate.js +149 -0
  151. package/src/knowledge/mr.js +219 -0
  152. package/src/knowledge/query.js +131 -0
  153. package/src/knowledge/registry.js +151 -0
  154. package/src/knowledge/sync.js +179 -0
  155. package/src/providers/base.js +74 -0
  156. package/src/providers/drivers/api-yapi.js +78 -0
  157. package/src/providers/drivers/ci-jenkins.js +109 -0
  158. package/src/providers/drivers/intake-confluence.js +544 -0
  159. package/src/providers/drivers/kb-git.js +549 -0
  160. package/src/providers/drivers/kb-weknora.js +472 -0
  161. package/src/providers/drivers/notify-smtp.js +515 -0
  162. package/src/providers/drivers/observability-oss.js +43 -0
  163. package/src/providers/drivers/observability-sls.js +50 -0
  164. package/src/providers/lifecycle.js +135 -0
  165. package/src/providers/loader.js +132 -0
  166. package/src/providers/local.js +190 -0
  167. package/src/providers/userconfig.js +283 -0
  168. package/src/reports/aggregate.js +185 -0
  169. package/src/reports/coverage.js +163 -0
  170. package/src/reports/detect.js +143 -0
  171. package/src/reports/parse.js +236 -0
  172. package/src/templates/files/ci/github.yml +38 -0
  173. package/src/templates/files/ci/gitlab.yml +27 -0
  174. package/src/templates/files/design.md +63 -0
  175. package/src/templates/files/ide/devflow-workflow.md +58 -0
  176. package/src/templates/files/ide/project-overview-reference.md +1 -0
  177. package/src/templates/files/ide/project-overview.md +27 -0
  178. package/src/templates/files/knowledge-index.json +17 -0
  179. package/src/templates/files/knowledge.md +28 -0
  180. package/src/templates/files/meta.json +8 -0
  181. package/src/templates/files/plan.md +38 -0
  182. package/src/templates/files/proposal.md +33 -0
  183. package/src/templates/files/reports/contract-test.md +40 -0
  184. package/src/templates/files/reports/e2e-test.md +30 -0
  185. package/src/templates/files/reports/integration-test.md +36 -0
  186. package/src/templates/files/reports/joint-test.md +58 -0
  187. package/src/templates/files/reports/perf.md +24 -0
  188. package/src/templates/files/reports/regression.md +20 -0
  189. package/src/templates/files/reports/remote-test.md +55 -0
  190. package/src/templates/files/reports/self-test.md +43 -0
  191. package/src/templates/files/reports/smoke-test.md +22 -0
  192. package/src/templates/files/reports/unit-test.md +36 -0
  193. package/src/templates/files/requirement.md +51 -0
  194. package/src/templates/files/review.md +38 -0
  195. package/src/templates/files/tests.md +36 -0
  196. package/src/templates/files/verify.md +32 -0
  197. package/src/templates/index.js +21 -0
  198. package/src/utils/log.js +37 -0
@@ -0,0 +1,292 @@
1
+ # verify / nfr-verification
2
+
3
+ 非功能性需求(性能 / 吞吐 / 可用性 / 资源 / 安全)的验证方法与工具选型。
4
+
5
+ ---
6
+
7
+ ## NFR 的类别
8
+
9
+ | 类别 | 典型指标 | 验证 phase |
10
+ | --- | --- | --- |
11
+ | 延迟 | P50/P95/P99 响应时间 | verify(perf-test) |
12
+ | 吞吐 | QPS / TPS / 每秒消息数 | verify(perf-test) |
13
+ | 并发 | 同时活跃连接 / 用户 | verify(perf-test) |
14
+ | 容量 | 最大存储 / 队列深度 | verify(perf-test + design 估算) |
15
+ | 错误率 | 4xx/5xx 占比,业务错误率 | verify(perf-test + smoke) |
16
+ | 可用性 | SLA(月可用时间 %) | 上线后监控 + runbook(不是 verify 阶段) |
17
+ | 资源 | CPU / 内存 / 带宽 | verify(perf-test + monitoring) |
18
+ | 可扩展性 | 扩容后是否线性 | design 估算 + 上线后验证 |
19
+ | 安全 | 渗透测试、合规 | verify 独立 security-test,or 上线前 pen test |
20
+ | 兼容性 | 老 client / 老版本互通 | verify 独立 regression |
21
+
22
+ ---
23
+
24
+ ## 每类的验证方法
25
+
26
+ ### 延迟(P50/P95/P99)
27
+
28
+ **工具**:
29
+
30
+ - Java: JMH(微基准)、JMeter、Gatling、wrk2
31
+ - Go: `go test -bench`、wrk、hey
32
+ - Node/Python: k6、locust、wrk、hey
33
+ - HTTP 层:wrk / wrk2 / hey(任意语言后端都能压)
34
+
35
+ **场景设计**:
36
+
37
+ - 负载剖面:`ramp up → sustain → ramp down`,每段至少 5 分钟才稳定
38
+ - 基于真实流量分布(不要 100% 单 API 压,用 weighted 场景)
39
+ - 数据:用 prod-like 数据池,不要空库或同一条记录疯狂压
40
+
41
+ **报告字段**:
42
+
43
+ ```yaml
44
+ perf:
45
+ p50_ms: 78
46
+ p95_ms: 150
47
+ p99_ms: 180
48
+ max_ms: 320
49
+ baseline_p99_ms: 200 # 来自 design.md NFR
50
+ ```
51
+
52
+ **判定**:P99 ≤ 基线 + 容差(5-10%)。
53
+
54
+ ---
55
+
56
+ ### 吞吐(QPS / TPS)
57
+
58
+ **工具**:同延迟。
59
+
60
+ **注意**:
61
+
62
+ - 测吞吐要"拉到失败前"(找上限),不要只测"平时够用"
63
+ - 吞吐和延迟是 trade-off:限制 P99 下的最大 QPS 才是合理数字
64
+ - 分"突发吞吐"(1 分钟峰值)和"持续吞吐"(30 分钟平均),NFR 两者都要说
65
+
66
+ **报告字段**:
67
+
68
+ ```yaml
69
+ perf:
70
+ sustained_qps: 5400 # 30 分钟平均
71
+ peak_qps: 7200 # 1 分钟峰值
72
+ error_rate_at_peak: 0.02
73
+ ```
74
+
75
+ ---
76
+
77
+ ### 并发连接
78
+
79
+ **工具**:
80
+
81
+ - WebSocket:`autocannon` / k6 websocket scenario
82
+ - HTTP/gRPC 长连:自研 client
83
+ - 数据库连接池:jmeter thread group / 应用监控
84
+
85
+ **注意**:
86
+
87
+ - 区分"connected" vs "active RPS"
88
+ - 连接数上限受 OS / kernel(ulimit)影响,测试前要调
89
+
90
+ **报告字段**:
91
+
92
+ ```yaml
93
+ perf:
94
+ concurrent_connections: 10000
95
+ connection_setup_p99_ms: 50
96
+ ```
97
+
98
+ ---
99
+
100
+ ### 容量 / 数据量
101
+
102
+ **验证方式**:
103
+
104
+ - 填充到目标量级(如 100M 行)后跑功能 / 性能测试
105
+ - 看查询延迟是否随数据量线性 / 退化
106
+ - 看磁盘占用、索引效率
107
+
108
+ **注意**:
109
+
110
+ - 不能只在空库测,所有大表功能都要在 prod-like 数据量下验
111
+ - 批量操作(迁移、归档)要在目标数据量下 dry-run,记录耗时
112
+
113
+ ---
114
+
115
+ ### 错误率
116
+
117
+ **工具**:压测工具的 error 输出,+ APM 监控。
118
+
119
+ **判定**:
120
+
121
+ - 业务错误率(400/422):< 0.5%(具体看 NFR)
122
+ - 系统错误(5xx、timeout、connection reset):< 0.1%
123
+ - 压测里 5xx 高 → 查连接池 / OS / 下游
124
+
125
+ **报告字段**:
126
+
127
+ ```yaml
128
+ perf:
129
+ error_rate: 0.0003
130
+ error_breakdown:
131
+ timeout: 0.0001
132
+ http_500: 0.0001
133
+ http_503: 0.0001
134
+ ```
135
+
136
+ ---
137
+
138
+ ### 资源(CPU / 内存 / IO)
139
+
140
+ **工具**:
141
+
142
+ - 应用侧:APM(Pyroscope / JFR / pprof / py-spy)
143
+ - 系统侧:`top` / `htop` / `vmstat` / Prometheus + Grafana
144
+ - 容器:Docker stats / k8s metrics-server
145
+
146
+ **场景**:
147
+
148
+ - 压测时开监控,记 CPU / 内存峰值
149
+ - 看是否有内存泄漏(长压后 heap 增长)
150
+ - 看 GC 频率(Java / Go)
151
+
152
+ **报告字段**:
153
+
154
+ ```yaml
155
+ perf:
156
+ cpu_peak_pct: 65
157
+ mem_peak_mb: 1200
158
+ gc_pause_p99_ms: 80
159
+ ```
160
+
161
+ ---
162
+
163
+ ### 可用性(SLA)
164
+
165
+ **不在 verify 阶段**(verify 是短时测试,无法覆盖 99.9% / 99.99% 级别的 SLA)。
166
+
167
+ 做法:
168
+
169
+ - 上线 rollout 时小流量监控(canary)
170
+ - 7 天 / 30 天窗口的 SLI / SLO 监控
171
+ - 在 `design.md` 的 runbook 里定义
172
+
173
+ verify 阶段只检查:"压测里无明显崩溃点 / 连续错误 / 资源泄漏"。
174
+
175
+ ---
176
+
177
+ ### 安全
178
+
179
+ **方式**:
180
+
181
+ - Static:SAST 工具(SonarQube、semgrep、bandit)
182
+ - Dynamic:OWASP ZAP、Burp Suite
183
+ - Dependency:npm audit、snyk、trivy
184
+
185
+ **通常**作为独立 `security-test.md` 或 `compliance-test.md` 报告。
186
+
187
+ L3 大改涉及认证 / 授权 / PII 时强制要求。
188
+
189
+ ---
190
+
191
+ ### 兼容性 / 回归
192
+
193
+ **方式**:
194
+
195
+ - 跑老版本 client 调新 API(或反之),看行为
196
+ - 老数据迁移后功能全跑一遍
197
+ - 回归测试套件(自动化)
198
+
199
+ **报告**:`regression-test.md` 或 `compatibility-test.md`。
200
+
201
+ ---
202
+
203
+ ## 压测环境的要求
204
+
205
+ | 项 | 要求 |
206
+ | --- | --- |
207
+ | 规模 | 至少和 prod 同配(不要用 1 核测 8 核) |
208
+ | 数据 | prod-like 数据量和分布 |
209
+ | 网络 | 和 prod 类似的 latency / 带宽 |
210
+ | 下游依赖 | 真实(integration 环境)或 high-fidelity mock |
211
+ | 压测 client | 独立机器,不要和被测服务同机(会抢资源) |
212
+
213
+ 如果条件不足(如只能在小环境压),结果要加 disclaimer + 估算到 prod 的系数,并在 release 后用 canary 验证。
214
+
215
+ ---
216
+
217
+ ## 基线对比
218
+
219
+ NFR 两种写法:
220
+
221
+ 1. **绝对值**:P99 ≤ 200ms — 简单,易判断
222
+ 2. **相对值**:P99 不回归超过前版本的 10% — 稳定,但要求有基线数据
223
+
224
+ verify 时:
225
+
226
+ - 如果 design.md 给了绝对值 → 直接比
227
+ - 如果给了相对值 → 跑前版本基线 + 本次 → 对比
228
+ - 两者都给 → 优先绝对,相对作为"是否退化"的 sanity check
229
+
230
+ **基线的管理**:
231
+
232
+ - 每次重大版本发布跑一次基线;默认存 `~/.devflow/workspace/changes/<feature-xx>/knowledge/解决方案/perf-baseline-<date>.md`(历史 in-repo 模式可存 `<repo>/devflow/knowledge/解决方案/...`)
233
+ - 后续比较用最新 baseline
234
+
235
+ ---
236
+
237
+ ## 失败场景的处理
238
+
239
+ ### NFR 不达标
240
+
241
+ | 严重度 | 处置 |
242
+ | --- | --- |
243
+ | P99 超 30% | 必回退 tech-spec,重新设计 |
244
+ | P99 超 10-30% | orchestrator 决策:接受 or 回退 |
245
+ | 超 5-10% | 记 concern + 跟进 task |
246
+ | ≤ 5% | 接受,记 note |
247
+
248
+ ### 资源泄漏
249
+
250
+ 任何可检测的泄漏(heap / file handle / goroutine / 数据库连接)都必须回退 apply 修,不讨价还价。
251
+
252
+ ### 间歇性 flaky
253
+
254
+ - 3 次压测都复现 → 是真问题,回退
255
+ - 10 次中 1 次 → 排查但可能接受(若不涉及稳定性 NFR)
256
+ - 和压测 client 本身 flaky 区分(比如 client 占 100% CPU)
257
+
258
+ ---
259
+
260
+ ## 常见坑
261
+
262
+ - **压错端点**:url 配置错了压了健康检查,看到 10 万 QPS 以为很牛
263
+ - **数据太少**:query cache 一直 hit,实际生产 miss 率高
264
+ - **压测单个固定 user_id**:所有 branch / cache 走一个分支,不真实
265
+ - **用 debug build 压**:Java 开了 verbose GC log,Go 开了 race detector → 性能下降 10x
266
+ - **没热身**:JVM / V8 没 JIT warmup 就开始记数据,P99 虚高
267
+ - **同机压测**:OS 调度互相影响,结果不可信
268
+ - **只测一个实例**:集群场景下负载均衡 / 分片效应没测出来
269
+ - **网络配置偷懒**:用 127.0.0.1 压,忽略 DNS / TLS / 网关开销
270
+
271
+ ---
272
+
273
+ ## 最小可行 NFR 验证流程(L2)
274
+
275
+ 当时间紧 / 环境受限:
276
+
277
+ 1. 用 wrk 或 hey 跑 5 分钟,固定并发(如 50)
278
+ 2. 看 P99 + error rate
279
+ 3. 对比 design NFR
280
+ 4. 记 perf-test.md
281
+
282
+ 粗但比没有强。L2 允许这种简化(需标明 "simplified perf test")。L3 不允许。
283
+
284
+ ---
285
+
286
+ ## 与 design.md 的对齐
287
+
288
+ design.md 里的 NFR 是 verify 唯一的真源:
289
+
290
+ - 没写在 design 的 NFR,verify 不测(不是"建议测")
291
+ - design 改过 NFR(revise),verify 按最新
292
+ - verify 发现 design 漏了关键 NFR → 回退 tech-spec 补(不是自己在 verify 里加)