@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,426 @@
1
+ # 在内部 GitLab + Jenkins 环境落地 devflow-kit
2
+
3
+ > 本文面向企业内网 —— 代码托管在自建 GitLab,CI 可能是 **GitLab Runner + Jenkins** 混合。
4
+ > 公网版指引见 [README](../README.md),两者可共存:同一份源码、两套分发渠道。
5
+
6
+ ## 1. 分发方式(三选一,推荐 A)
7
+
8
+ ### A) GitLab Package Registry(npm 私有,推荐)
9
+
10
+ 最接近公网 `npm i -g devflow-kit` 的体验,团队成员无痛。
11
+
12
+ **一次性:给 devflow-kit 自己的仓库配发布**
13
+
14
+ ```yaml
15
+ # .gitlab-ci.yml 片段(只给 devflow-kit 仓库本身)
16
+ publish:
17
+ stage: publish
18
+ image: node:20
19
+ only: [tags]
20
+ script:
21
+ - echo "@<your-group>:registry=https://<your-gitlab>/api/v4/projects/${CI_PROJECT_ID}/packages/npm/" > ~/.npmrc
22
+ - echo "//<your-gitlab>/api/v4/projects/${CI_PROJECT_ID}/packages/npm/:_authToken=${CI_JOB_TOKEN}" >> ~/.npmrc
23
+ - npm test
24
+ - npm publish
25
+ ```
26
+
27
+ `package.json` 里改 `name` 为带 scope 的(否则 npm publish 默认走公网):
28
+
29
+ ```json
30
+ {
31
+ "name": "@<your-group>/devflow-kit",
32
+ ...
33
+ "publishConfig": {
34
+ "registry": "https://<your-gitlab>/api/v4/projects/<project-id>/packages/npm/"
35
+ }
36
+ }
37
+ ```
38
+
39
+ **团队成员使用**:
40
+
41
+ ```bash
42
+ # 配一次
43
+ echo "@<your-group>:registry=https://<your-gitlab>/api/v4/packages/npm/" >> ~/.npmrc
44
+ # 若 GitLab 要求鉴权,加上 Personal Access Token(read_api):
45
+ echo "//<your-gitlab>/api/v4/packages/npm/:_authToken=${GITLAB_TOKEN}" >> ~/.npmrc
46
+
47
+ # 装
48
+ npm i -g @<your-group>/devflow-kit
49
+ df --version
50
+ ```
51
+
52
+ > 双分发:公网 package 名 `devflow-kit`,内网 `@<your-group>/devflow-kit`,源码同一份,靠 CI 里写不同 `name` 或维护两个 `package.json.<env>` 切换。
53
+
54
+ ### B) git+ssh 直装(零基建,适合早期)
55
+
56
+ ```bash
57
+ npm i -g git+ssh://git@<your-gitlab>:<group>/devflow-kit.git#v0.1.0
58
+ df --version
59
+ ```
60
+
61
+ 优点:不用建 registry;缺点:每个 dev 机器要有 gitlab ssh key。
62
+
63
+ 升级就是 `npm i -g .......git#v0.2.0`,用 tag 锁版本。
64
+
65
+ ### C) tarball + 内网对象存储(最朴素)
66
+
67
+ CI 在 release 时跑 `npm pack` 生成 `devflow-kit-0.1.0.tgz`,丢到内网 MinIO / OSS / GitLab Generic Packages:
68
+
69
+ ```bash
70
+ npm i -g https://<internal-artifacts>/devflow-kit/0.1.0/devflow-kit-0.1.0.tgz
71
+ ```
72
+
73
+ 适合完全没有 npm registry 的环境。
74
+
75
+ ---
76
+
77
+ ## 2. Provider 配置(GitLab + Jenkins 混栈)
78
+
79
+ 公司现状假设:**GitLab 托代码 + JIRA/Wiki 在另一套(或 GitLab 自带 Wiki) + Jenkins 跑构建发布 + 可能有内部 KB(WeKnora / Confluence)**。
80
+
81
+ 推荐把内网适配全部集中到 `devflow/providers.json`(项目级,不含明文 token):
82
+
83
+ ```json
84
+ {
85
+ "intake.wiki": {
86
+ "type": "intake",
87
+ "driver": "qs-bridge",
88
+ "config": {
89
+ "binPath": "/usr/local/bin/qs-bridge",
90
+ "tool": "wiki",
91
+ "timeoutMs": 30000
92
+ }
93
+ },
94
+ "issue.jira": {
95
+ "type": "issue",
96
+ "driver": "qs-bridge",
97
+ "config": { "tool": "jira", "project": "YOUR-PROJ" }
98
+ },
99
+ "ci.jenkins": {
100
+ "type": "ci",
101
+ "driver": "qs-bridge",
102
+ "config": {
103
+ "tool": "jenkins",
104
+ "jenkinsBase": "https://<your-jenkins-host>",
105
+ "defaultJob": "deploy/<your-service>"
106
+ }
107
+ },
108
+ "vcs.gitlab": {
109
+ "type": "vcs",
110
+ "driver": "gitlab",
111
+ "config": {
112
+ "baseUrl": "https://<your-gitlab>",
113
+ "projectId": "<group>/<project>",
114
+ "tokenEnv": "GITLAB_TOKEN"
115
+ }
116
+ },
117
+ "kb.weknora": {
118
+ "type": "kb",
119
+ "driver": "weknora",
120
+ "config": {
121
+ "endpoint": "https://<your-kb-host>",
122
+ "kb_id": "${env:KB_ID}",
123
+ "tag_id": "${env:KB_TAG_ID}",
124
+ "token": "${env:WEKNORA_API_KEY}",
125
+ "_comment": "Bare config above runs the built-in generic contract. For arb-shape endpoints, fill auth/paths/body/responsePath via `devflow provider add kb.weknora --from <your-local-weknora-arb.json>` — see §2.3."
126
+ }
127
+ },
128
+
129
+ "notify.smtp": {
130
+ "type": "notify",
131
+ "driver": "smtp",
132
+ "config": {
133
+ "host": "smtp.exmail.qq.com",
134
+ "port": 465,
135
+ "user": "${env:SMTP_USER}",
136
+ "pass": "${env:SMTP_PASS}",
137
+ "from": "DevBot <${env:SMTP_USER}>",
138
+ "defaults": {
139
+ "to": "qa-team@<your-corp>.com",
140
+ "cc": "pm@<your-corp>.com"
141
+ }
142
+ }
143
+ }
144
+ }
145
+ ```
146
+
147
+ **真正的凭证全部落到** `~/.devflow/providers.json`(chmod 600,`devflow init` 自动设)或直接读环境变量。仓库里绝不落明文 token —— `devflow doctor --scope=cred` 会检查并拒绝通过。
148
+
149
+ ### 2.1 qs-bridge 首装
150
+
151
+ ```bash
152
+ # qs-bridge 本身是另一份内网工具,先按内部指引装
153
+ npm i -g @<your-group>/qs-bridge # 或 git+ssh
154
+
155
+ # 首次走浏览器登录(会弹窗,所有 wiki/jira/jenkins 共用同一套 cookie)
156
+ qs-bridge auth login
157
+ qs-bridge auth status # 验证
158
+ ```
159
+
160
+ 然后在项目里:
161
+
162
+ ```bash
163
+ devflow provider add intake.wiki --type=intake --driver=qs-bridge \
164
+ --config-binPath=/usr/local/bin/qs-bridge --config-tool=wiki
165
+ devflow provider status intake.wiki # 应显示 ok
166
+ devflow ingest https://<your-wiki-host>/pages/12345 # 立马能跑
167
+ ```
168
+
169
+ ### 2.2 GitLab 作为 VCS provider
170
+
171
+ `devflow deliver --mode=pr` 需要 VCS provider;GitLab 走 REST API:
172
+
173
+ ```bash
174
+ # 生成一个 personal access token,scopes: api, write_repository
175
+ export GITLAB_TOKEN=glpat-xxxxx
176
+
177
+ devflow provider add vcs.gitlab --type=vcs --driver=gitlab \
178
+ --config-baseUrl=https://<your-gitlab> \
179
+ --config-projectId=<group>/<project> \
180
+ --config-tokenEnv=GITLAB_TOKEN
181
+
182
+ devflow deliver --mode=pr --base=main --head=feat/coupon-grant
183
+ # → 内部调 GitLab API,创建 MR
184
+ ```
185
+
186
+ ### 2.3 WeKnora 知识库(引导配置 + 本地参考片段)
187
+
188
+ `kb-weknora` driver 只内置**一套通用最小契约**(Bearer + `/api/v1/kb/{kb_id}/*` 形状),所有字段都可以通过 `providers.json` 覆盖。我们不把内网特定的 endpoint / auth 形状打进包里——**内网具体配置以"本地参考片段"形式在 `.internal/` 维护,不进仓、不进包、不推 npm**。
189
+
190
+ 首次接入步骤:
191
+
192
+ **方式 1:引导式(推荐,新手零成本)**
193
+
194
+ ```bash
195
+ devflow provider add kb.weknora
196
+ # 交互输入:
197
+ # type = kb
198
+ # driver = weknora
199
+ # endpoint = https://<your-kb-host>
200
+ # kb_id = <uuid>
201
+ # token = env:WEKNORA_API_KEY ← 会自动转成 ${env:WEKNORA_API_KEY}
202
+ # tag_id = (可选)
203
+ # idempotent = false|true ← 若目标后端按 title 去重,填 true
204
+ ```
205
+
206
+ 走完只得到一份"默认契约"配置,适配标准 Bearer `/api/v1/kb/{kb_id}/*` 形态的 WeKnora。
207
+
208
+ **方式 2:从本地参考片段导入(对接 arb-knowledge 用)**
209
+
210
+ 在你本机准备一份 `<anywhere>/weknora-arb.local.json`(**不要提交到任何仓库**),把你们内网 arb-knowledge 的 endpoint / auth header / paths / body / responsePath 写齐,然后:
211
+
212
+ ```bash
213
+ devflow provider add kb.weknora --from=./weknora-arb.local.json
214
+ ```
215
+
216
+ `--from` 支持的结构有两种:
217
+ - 顶层就是一个 `config{}` 片段 → 直接当 `kb.weknora.config` 用
218
+ - 顶层含 `kb.weknora: { type, driver, config }` → 整段原样搬入
219
+
220
+ 参考模板(**由了解内网的同事线下告知具体 endpoint 后填充**,不要提交):
221
+
222
+ ```jsonc
223
+ // ~/devflow-templates/weknora-arb.local.json(本地)
224
+ {
225
+ "kb.weknora": {
226
+ "type": "kb",
227
+ "driver": "weknora",
228
+ "config": {
229
+ "endpoint": "https://<your-internal-kb-host>",
230
+ "kb_id": "<your-kb-uuid>",
231
+ "token": "${env:WEKNORA_API_KEY}",
232
+ "tag_id": "",
233
+ "idempotent": true,
234
+ "auth": { "header": "X-API-Key", "scheme": "" },
235
+ "paths": {
236
+ "findByTitle": "/api/v1/knowledge-bases/{kb_id}/knowledge?keyword={title}&page=1&page_size=20",
237
+ "create": { "method": "POST", "path": "/api/v1/knowledge-bases/{kb_id}/knowledge/manual" },
238
+ "update": { "method": "PUT", "path": "/api/v1/knowledge/manual/{id}" },
239
+ "delete": { "method": "DELETE", "path": "/api/v1/knowledge-bases/{kb_id}/knowledge/{id}" },
240
+ "search": { "method": "POST", "path": "/api/v1/knowledge-search" }
241
+ },
242
+ "body": {
243
+ "create": { "title": "{title}", "content": "{content}", "status": "publish", "tag_id": "{tag_id?}" },
244
+ "update": { "title": "{title}", "content": "{content}", "status": "publish" },
245
+ "search": { "query": "{query}", "knowledge_base_id": "{kb_id}", "tag_id": "{tag_id?}", "knowledge_ids": "{ids?}" }
246
+ },
247
+ "responsePath": {
248
+ "createId": "data.id",
249
+ "searchItems": "data",
250
+ "listItems": "data",
251
+ "itemId": "id",
252
+ "itemTitle": "title",
253
+ "itemUrl": "url",
254
+ "itemScore": "score",
255
+ "itemSnippet": "content"
256
+ }
257
+ }
258
+ }
259
+ }
260
+ ```
261
+
262
+ > **安全**:上面的文件只是脚手架,不含任何 token;但因为可能带有内网域名/KB ID,**请一定放到 gitignore 区**(devflow-kit 的仓库根已内置 `.internal/`、`*.local.json`、`*.local.md` 作为 gitignore 白名单,可以放心用这些命名)。
263
+
264
+ dry-run 方式验证(不实际调用):
265
+
266
+ ```bash
267
+ DEVFLOW_KB_DRY_RUN=1 devflow knowledge sync --driver=weknora
268
+ ```
269
+
270
+ ### 2.4 提测邮件(notify-smtp)
271
+
272
+ 原 arb `deploy-submit/send-email.py` 的 Node 零依赖移植,完全对齐:
273
+
274
+ - SMTPS(465)/ STARTTLS(587)/ plain(25)三种连接模式
275
+ - `AUTH PLAIN` / `AUTH LOGIN` 自动协商(Exchange / 企业邮默认 LOGIN)
276
+ - Markdown → HTML(表格 / 列表 / 标题 / 粗体 / 行内代码)
277
+ - 多附件 + RFC 2047 中文 Subject 编码
278
+
279
+ `devflow deliver --notify` 会在 MR 建完之后自动发邮件;`--notify-dry-run` 只组装 MIME 不连接 SMTP。
280
+
281
+ ```bash
282
+ export SMTP_USER=devbot@<your-corp>.com
283
+ export SMTP_PASS=*** # 企业邮 SMTP 授权码
284
+
285
+ devflow deliver --mode=pr --notify \
286
+ --notify-to="qa1@corp.com,qa2@corp.com" \
287
+ --notify-cc="pm@corp.com"
288
+ ```
289
+
290
+ 发送成功会在 `state.json.auditLog` 留一条 `deliver.notify` 事件。
291
+
292
+ ### 2.5 Jenkins 触发(via qs-bridge)
293
+
294
+ ```bash
295
+ devflow test smoke --env=staging
296
+ # 背后等价:qs-bridge jenkins trigger '{"job":"deploy/your-service","params":{"env":"staging"}}'
297
+ ```
298
+
299
+ ---
300
+
301
+ ## 3. 在 **用户项目** 里接 GitLab CI(不是给 devflow-kit 自己)
302
+
303
+ `devflow init --with-ci=gitlab` 生成一份 `.gitlab-ci.devflow.yml` 模板。它负责:
304
+
305
+ 1. **PR validation**:MR 开起来就跑 `devflow doctor --scope=config,change,knowledge` + `devflow status` 评论回 MR
306
+ 2. **Knowledge sync**:主干合入后,若 `devflow/knowledge/**` 有变更,跑 `devflow knowledge sync --since=before --to=sha --driver=weknora` 同步到知识库
307
+ 3. **Archive hook**(可选):打 tag 时触发 `devflow archive` 合并 delta 到 specs(一般本地做完再推,少用)
308
+
309
+ 模板位置:[`src/templates/files/ci/gitlab.yml`](../src/templates/files/ci/gitlab.yml)。
310
+
311
+ ### 3.1 公司惯例适配
312
+
313
+ 不同 BU 的 Runner 标签、基础镜像、before_script 往往不同。建议 `devflow init --with-ci=gitlab` 生成后,保留 3 个可改点:
314
+
315
+ ```yaml
316
+ .devflow-base: &devflow-base
317
+ image: <your-internal-registry>/node:20-devflow # ← BU 内部镜像
318
+ tags: [<your-runner-tag>] # ← BU runner tag
319
+ before_script:
320
+ - npm i -g @<your-group>/devflow-kit # ← 私有 registry
321
+ - df --version
322
+
323
+ devflow:validate:
324
+ <<: *devflow-base
325
+ stage: test
326
+ script:
327
+ - devflow doctor --scope=config,change,knowledge --json > doctor.json
328
+ artifacts:
329
+ reports: { junit: doctor.json }
330
+
331
+ devflow:knowledge-sync:
332
+ <<: *devflow-base
333
+ stage: deploy
334
+ only:
335
+ refs: [main]
336
+ changes: [devflow/knowledge/**/*.md]
337
+ script:
338
+ - devflow knowledge sync --since="${CI_COMMIT_BEFORE_SHA}" --to="${CI_COMMIT_SHA}" --driver=weknora
339
+ variables:
340
+ WEKNORA_API_KEY: $WEKNORA_API_KEY # ← GitLab CI/CD Variable(masked)
341
+ ```
342
+
343
+ ### 3.2 与 Jenkins 共存
344
+
345
+ GitLab CI 负责 **静态校验 + 知识库同步**,Jenkins 负责 **真实构建 / 测试 / 发布**。
346
+ `devflow test smoke` 可从任一侧触发,但一般放在 `devflow deliver` 之后(Deploy → Smoke)。
347
+
348
+ 一条完整双 CI 走向:
349
+
350
+ ```
351
+ 开发本地:
352
+ devflow apply --task=N → devflow review --round × ≤3 → devflow verify finalize → devflow deliver --mode=pr
353
+
354
+ GitLab CI(MR 自动跑):
355
+ devflow:validate ← devflow doctor
356
+ test:unit ← npm test 等
357
+
358
+ 人工 merge → GitLab CI 再跑一次:
359
+ devflow:knowledge-sync ← 只当 knowledge/ 有变
360
+
361
+ 人工在 Jenkins 点 deploy:
362
+ deploy-job ← 常规发布流水
363
+
364
+ 发布后:
365
+ devflow test smoke --env=prod ← 通过 qs-bridge 调 Jenkins smoke-job
366
+ devflow archive ← 本地跑,提最后一个 MR 合入
367
+ ```
368
+
369
+ ---
370
+
371
+ ## 4. 从 arb-workflow-kit 迁移(补充内网视角)
372
+
373
+ 详见 [migration-from-arb.md](./migration-from-arb.md)。内网迁移多一条 **WeKnora / arb-knowledge UUID 继承**:
374
+
375
+ ```bash
376
+ # 在旧 arb 仓库根目录
377
+ devflow knowledge migrate --from=arb-7 --to=improved-9
378
+ # → 只动目录名,.meta.json 里 external.weknora.uuid 保留
379
+ # → 后续 devflow knowledge sync --driver=weknora 走 update(不重复创建 tag)
380
+ ```
381
+
382
+ 团队老 `arb-knowledge` 仓库可以**原地**升级到 devflow 结构,然后各业务仓库把本地 `devflow/knowledge/` 的同步目标指向它,实现"一个团队知识库 + 多项目汇聚"。
383
+
384
+ ---
385
+
386
+ ## 5. 团队推行 checklist
387
+
388
+ **第 1 周:基建**
389
+ - [ ] 决定分发渠道(上面 A/B/C),建一个 `@<your-group>/devflow-kit` 包
390
+ - [ ] `qs-bridge` 装在开发机(若还没)
391
+ - [ ] `~/.devflow/providers.json` 模板下发(不含 token,靠 env 注入)
392
+ - [ ] GitLab CI/CD Variables 里配 `WEKNORA_API_KEY` / `GITLAB_TOKEN`(masked)
393
+
394
+ **第 2 周:1-2 个先锋项目**
395
+ - [ ] 选 1 个 L2 需求做完整走查:`devflow ingest → df plan → devflow apply --task=N 并行 → devflow review --round × 2 → devflow verify → devflow deliver --mode=pr`
396
+ - [ ] 填 `devflow doctor` 出现的所有 warning(项目概览 mode / provider 状态 / git 健康)
397
+ - [ ] 整理踩坑点反馈到 devflow-kit issue
398
+
399
+ **第 3-4 周:面向团队**
400
+ - [ ] 分享会:演示 worktree-swarm 并行 + 3 轮审查 + 知识库自动沉淀
401
+ - [ ] 旧 `~/.config/dev-workflow/` 的迁移(如果有在用 arb)
402
+ - [ ] 统一 `.gitlab-ci.devflow.yml` 模板推到各项目,由各项目酌情合入
403
+
404
+ **日常维护**
405
+ - [ ] `devflow doctor` 进 pre-commit(用 `--scope=change,git` 轻量版)
406
+ - [ ] 每月 `devflow provider audit` 做凭证体检(file permissions / plaintext token 扫描)
407
+ - [ ] 季度 `devflow provider rotate <name>` 轮换 token
408
+
409
+ ---
410
+
411
+ ## 6. FAQ
412
+
413
+ **Q: 我们公司内网 Jenkins 有两套(国内/海外),怎么办?**
414
+ A: 在 `providers.json` 里配两个 ci provider:`ci.jenkins-cn` 与 `ci.jenkins-global`,用不同 `jenkinsBase`。`devflow test smoke --provider=ci.jenkins-global` 显式指定。
415
+
416
+ **Q: GitLab 要求 MR 必须过 approve,我的 `devflow deliver --mode=pr` 怎么判断?**
417
+ A: `devflow deliver` 只创建 MR 不要求合并;approve / merge 保留给 GitLab 原生 UI。合入后本地再跑 `devflow archive`,把 `delta/` 合并进 `devflow/specs/` 再提一个小 MR。
418
+
419
+ **Q: 我们的 wiki 不在 qs-bridge 覆盖范围(比如 GitLab Wiki / 飞书 / 语雀)。**
420
+ A: `intake` provider 可替换成 `github-wiki` / `feishu-doc` / `yuque`(接口位已留,驱动实现可本地按抽象补);或者最简单:**`devflow ingest --file=./my-prd.md`** 直接喂本地 markdown,不要 provider。
421
+
422
+ **Q: 凭证文件 chmod 600 在 Windows 开发机怎么处理?**
423
+ A: Windows 下 `devflow` 会跳过 chmod 检查,但会 warn。建议 Windows 开发机走 WSL2,或把 `providers.json` 彻底走 `${env:VAR}` 引用,不落明文。
424
+
425
+ **Q: devflow-kit 自己的仓库要不要接 GitLab CI?**
426
+ A: 要,最少两段(`test` + `publish-on-tag`);示例见本文 §1.A。
@@ -0,0 +1,231 @@
1
+ # 可选扩展 Skills 说明
2
+
3
+ devflow-kit 的核心流程由阶段 skill 负责:requirement、tech-spec、plan、apply、code-review、verify、deliver、archive 等。本文说明新增的 5 个可选扩展 skill。它们不是新的强制阶段,而是在特定风险出现时增强现有 phase。
4
+
5
+ ## 总览
6
+
7
+ | Skill | 解决什么问题 | 主要接入 phase | 是否默认必用 |
8
+ | --- | --- | --- | --- |
9
+ | `devflow-frontend-quality` | 前端 UI、交互、可访问性、性能和截图证据 | code-review / verify | 前端改动时必用 |
10
+ | `devflow-ci-fix` | CI 失败和 PR/MR comment 修复闭环 | review / apply / verify / deliver | CI 或评论失败时必用 |
11
+ | `devflow-dependency-upgrade` | 依赖升级、漏洞修复、lockfile 变更 | apply / verify | 依赖任务时必用 |
12
+ | `devflow-handoff-resume` | 长任务交接、上下文恢复、多 agent 接力 | 任意 phase | 长任务或恢复时必用 |
13
+ | `devflow-security-hardening` | 安全、隐私、支付、鉴权、回调、敏感信息 | tech-spec / code-review / verify | L3 或安全相关必用 |
14
+
15
+ 这些 skill 吸收的是“能力模型”,不是把外部 SaaS 或某个 marketplace 包直接内置进核心流程:
16
+
17
+ | 吸收来源类型 | 吸收的能力 | 落到 devflow 的位置 | 优点 |
18
+ | --- | --- | --- | --- |
19
+ | 前端质量类 guideline | UI checklist、可访问性、响应式、截图证据 | `frontend-quality`、`reports/test-report.md#joint/#e2e` | 前端改动不再只看编译通过,能留下可复查证据 |
20
+ | CI / PR feedback workflow | 读日志、定位失败、修复、重跑、关闭反馈 | `ci-fix`、review/apply/verify 闭环 | CI 失败不会被当成“再试一次”,会先归因 |
21
+ | dependency updater | 版本风险分级、lockfile、breaking change、回滚 | `dependency-upgrade` | 依赖升级从“改版本号”变成可审计任务 |
22
+ | session handoff | 上下文摘要、下一步命令、风险和验证记录 | `handoff-resume`、`handoff.md` | 长任务或换 agent 时不容易从头来过 |
23
+ | security checklist | OWASP / MITRE 风格的威胁面检查 | `security-hardening`、review/verify security section | 支付、鉴权、隐私类改动有固定安全视角 |
24
+
25
+ CLI 兜底:
26
+
27
+ ```bash
28
+ devflow status risk add frontend_change --reason="UI diff touched"
29
+ devflow status risk add dependency_change --reason="lockfile changed"
30
+ devflow status risk add security_sensitive --reason="auth/callback changed"
31
+ devflow status risk add ci_failure --reason="required check failed"
32
+ ```
33
+
34
+ 这些信号写入 `state.json.riskSignals[]`。`verify finalize` 会按信号追加证据要求,`deliver` 会阻止 open risk signal 直接交付。skill 负责发现和解释风险,CLI 负责把风险变成可审计硬闸。
35
+
36
+ ## 1. frontend-quality
37
+
38
+ 目录:
39
+
40
+ ```text
41
+ skills/frontend-quality/
42
+ ```
43
+
44
+ 触发:
45
+
46
+ - React / Vue / Next / Vite / CSS / 页面组件改动。
47
+ - 表单、弹窗、列表、分页、筛选、上传、支付、签约、登录页面改动。
48
+ - 前端消费者、轮询页、redirect/query/returnUrl/callback 变化。
49
+
50
+ 要实现的功能:
51
+
52
+ - code-review 增加 UI 一致性、响应式、可访问性、性能 checklist。
53
+ - verify 要求浏览器证据:Playwright/Cypress 或人工操作步骤 + 截图。
54
+ - 把证据写到 `reports/test-report.md#joint` 或 `#e2e`。
55
+ - 没有浏览器验证时,必须在 `verify.md` 写明跳过原因。
56
+
57
+ 建议命令和产物:
58
+
59
+ ```bash
60
+ devflow test joint --cmd="npm run test:e2e" --backend-url=<url> --frontend-url=<url>
61
+ devflow test e2e --cmd="npm run test:e2e"
62
+ devflow verify finalize
63
+ ```
64
+
65
+ 产物落点:
66
+
67
+ - `reports/test-report.md#joint`:前后端联调、浏览器步骤、截图、失败详情。
68
+ - `reports/test-report.md#e2e`:端到端入口、用户路径、断言结果。
69
+ - `review.md`:UI / a11y / responsive / performance finding。
70
+
71
+ ## 2. ci-fix / pr-feedback
72
+
73
+ 目录:
74
+
75
+ ```text
76
+ skills/ci-fix/
77
+ ```
78
+
79
+ 触发:
80
+
81
+ - PR/MR 检查失败。
82
+ - Jenkins / GitHub Actions / GitLab CI 失败。
83
+ - reviewer comment 未解决。
84
+ - deliver 前发现 required checks 未通过。
85
+
86
+ 要实现的功能:
87
+
88
+ - 先读 CI 日志和 review comment,再修复。
89
+ - 归因为 `code_error`、`env_error`、`flake`、`baseline`。
90
+ - 把 comment 分类为 MUST / SHOULD / NIT。
91
+ - 修完后重跑最小相关测试或远端 CI。
92
+ - 在 `review -> apply -> verify -> deliver` 之间形成闭环。
93
+
94
+ 建议命令和产物:
95
+
96
+ ```bash
97
+ devflow review --round
98
+ devflow apply
99
+ devflow test unit --cmd="<focused test>"
100
+ devflow verify finalize
101
+ ```
102
+
103
+ 产物落点:
104
+
105
+ - `review.md`:把 reviewer comment 或 CI finding 分成 MUST / SHOULD / NIT。
106
+ - `reports/test-report.md#unit/#integration/#smoke`:修复后的最小验证证据。
107
+ - `state.json`:review 轮次、checkpoint、是否允许进入 verify。
108
+
109
+ ## 3. dependency-upgrade
110
+
111
+ 目录:
112
+
113
+ ```text
114
+ skills/dependency-upgrade/
115
+ ```
116
+
117
+ 触发:
118
+
119
+ - npm / Maven / Go module / Python 依赖升级。
120
+ - lockfile 更新。
121
+ - 安全漏洞修复。
122
+ - 框架版本、构建工具版本变更。
123
+
124
+ 要实现的功能:
125
+
126
+ - 识别 patch / minor / major。
127
+ - 检查 changelog、breaking changes、peer dependency。
128
+ - 同步更新 manifest 和 lockfile。
129
+ - 跑最小必要测试。
130
+ - 输出升级列表、风险和回滚说明。
131
+
132
+ 建议命令和产物:
133
+
134
+ ```bash
135
+ devflow apply
136
+ devflow test unit --cmd="<package focused test>"
137
+ devflow test integration --cmd="<compatibility test>"
138
+ devflow verify finalize
139
+ ```
140
+
141
+ 产物落点:
142
+
143
+ - `design.md`:升级原因、影响面、兼容策略。
144
+ - `plan.md`:manifest / lockfile / 适配代码 / 验证任务拆分。
145
+ - `reports/test-report.md`:升级后的兼容性证据。
146
+ - `deliver` 描述:升级列表、风险、回滚方式。
147
+
148
+ ## 4. handoff / resume
149
+
150
+ 目录:
151
+
152
+ ```text
153
+ skills/handoff-resume/
154
+ ```
155
+
156
+ 触发:
157
+
158
+ - 任务很长。
159
+ - 上下文快满或发生压缩。
160
+ - 用户说"接着上次继续"。
161
+ - 多人或多 agent 接力。
162
+
163
+ 要实现的功能:
164
+
165
+ - 生成或读取 `handoff.md`。
166
+ - 记录当前 phase、checkpoint、已完成、未完成、风险、验证、下一步命令。
167
+ - resume 时优先读 `state.json`、checkpoint、`reports/test-report.md`。
168
+ - 避免下一个 agent 从头扫描或重复做已完成事项。
169
+
170
+ 建议命令和产物:
171
+
172
+ ```bash
173
+ devflow status --slug=<slug>
174
+ devflow checkpoint list --slug=<slug>
175
+ devflow verify finalize
176
+ ```
177
+
178
+ 产物落点:
179
+
180
+ - `handoff.md`:当前 phase、checkpoint、已完成、未完成、风险、验证、下一步命令。
181
+ - `state.json`:事实状态优先于对话记忆。
182
+ - `reports/test-report.md`:恢复时判断哪些验证已经完成。
183
+
184
+ ## 5. security-hardening
185
+
186
+ 目录:
187
+
188
+ ```text
189
+ skills/security-hardening/
190
+ ```
191
+
192
+ 触发:
193
+
194
+ - L3。
195
+ - 支付、隐私、权限、鉴权、回调、文件上传、OSS/SLS、token/cookie/password。
196
+ - 依赖漏洞修复。
197
+
198
+ 要实现的功能:
199
+
200
+ - code-review 增加 security section。
201
+ - verify 增加安全验证说明或 security subsection。
202
+ - 检查敏感信息、权限绕过、注入、SSRF、XSS、回调验签、日志脱敏、依赖漏洞。
203
+ - 风险接受必须有 owner 和 reason。
204
+
205
+ 建议命令和产物:
206
+
207
+ ```bash
208
+ devflow design --with-tests
209
+ devflow review --round
210
+ devflow test integration --cmd="<security related test>"
211
+ devflow verify finalize
212
+ ```
213
+
214
+ 产物落点:
215
+
216
+ - `design.md`:鉴权、权限边界、回调验签、日志脱敏、降级和回滚。
217
+ - `review.md`:security section。
218
+ - `reports/test-report.md#integration/#contract/#self-test`:安全相关验证和人工检查结果。
219
+
220
+ ## 不建议做成默认强制阶段的原因
221
+
222
+ - 这些 skill 是风险增强器,不是每个 change 都需要。
223
+ - 强行默认触发会让 L0/L1 变重,违背懒生成和分级原则。
224
+ - 它们应由 diff、level、用户意图、phase 风险触发。
225
+
226
+ 推荐策略:
227
+
228
+ - L0:默认不用,除非用户明确要求。
229
+ - L1:按 diff 类型触发 frontend/dependency/ci。
230
+ - L2:有前端、调用链、依赖、安全信号时触发。
231
+ - L3:默认考虑 security;跨服务/前端链路考虑 frontend + contract;CI 失败触发 ci-fix。