@elvis1513/auto-coding-skill 1.0.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ Engineering workflow skill for:
|
|
|
5
5
|
- Claude Code
|
|
6
6
|
- Codex CLI
|
|
7
7
|
|
|
8
|
-
This skill targets Go backend + frontend monorepo projects that rely on Jenkins for build and deployment. The
|
|
8
|
+
This skill targets Go backend + frontend monorepo projects that rely on Jenkins for build and deployment. The default `dev` mode is optimized for fast development: light gate, early closure record, commit, push, then move to the next task. Switch to `verify` mode when Jenkins and target-environment evidence must be completed before closure.
|
|
9
9
|
|
|
10
10
|
`docs/ENGINEERING.md` is intentionally Git-tracked. The environment fields kept in that file are mandatory, must be filled with real values, and are committed as part of project maintenance. Unused environment items should be removed instead of being kept as placeholders.
|
|
11
11
|
|
|
@@ -39,9 +39,20 @@ npm install -g git+https://github.com/elvis1513/auto-coding-skill.git
|
|
|
39
39
|
|
|
40
40
|
## Optimized Standard Flow
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
模式由 `docs/ENGINEERING.md` 顶部控制:
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
```yaml
|
|
45
|
+
workflow:
|
|
46
|
+
mode: "dev" # dev | verify
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
`dev` 默认闭环:
|
|
50
|
+
|
|
51
|
+
`需求/任务记录 -> 最小设计 -> 开发 -> 本地轻量校验 -> 写 DEV-CLOSED 闭环 -> commit/push -> 结束`
|
|
52
|
+
|
|
53
|
+
`verify` 完整闭环:
|
|
54
|
+
|
|
55
|
+
`需求/任务记录 -> 最小设计 -> 开发 -> 本地轻量校验 -> commit/push -> Jenkins 构建部署验证 -> 目标环境验证 -> 写 PASS 闭环`
|
|
45
56
|
|
|
46
57
|
具体执行顺序:
|
|
47
58
|
|
|
@@ -58,16 +69,18 @@ npm install -g git+https://github.com/elvis1513/auto-coding-skill.git
|
|
|
58
69
|
- `git diff --check`
|
|
59
70
|
- API 文档检查
|
|
60
71
|
- Jenkins 配置检查
|
|
61
|
-
5.
|
|
62
|
-
-
|
|
72
|
+
5. 提交推送
|
|
73
|
+
- `dev` 模式:轻量校验通过后,先写 `DEV-CLOSED` 闭环,再 commit + push,触发 Jenkins 后结束。
|
|
74
|
+
- `verify` 模式:commit + push 后继续等待 Jenkins 和目标环境验证。
|
|
63
75
|
6. Jenkins 验证
|
|
64
|
-
-
|
|
76
|
+
- 仅 `verify` 模式默认执行。看 Jenkins 构建、镜像、部署结果;失败则基于 Jenkins 日志修复并再次提交。
|
|
65
77
|
7. 目标环境验证
|
|
66
|
-
-
|
|
78
|
+
- 仅 `verify` 模式默认执行。在真实目标环境做健康检查、关键接口、关键页面或业务路径验证。
|
|
67
79
|
8. 回归与证据记录
|
|
68
80
|
- 只有真实执行过 Jenkins / 目标环境验证,或明确要求本地运行验证时,才把 regression matrix 写成 `PASS`。
|
|
69
81
|
9. 闭环记录
|
|
70
|
-
-
|
|
82
|
+
- `dev` 模式记录 `DEV-CLOSED`,表示开发闭环完成但 Jenkins/目标环境未验证。
|
|
83
|
+
- `verify` 模式记录 `PASS` / `FAIL` / `PARTIAL`,必须基于真实验证结果。
|
|
71
84
|
|
|
72
85
|
## Default vs On-demand
|
|
73
86
|
|
|
@@ -112,12 +125,14 @@ This frontmatter is the only manual config source.
|
|
|
112
125
|
It must be committed to Git. Do not add it to `.gitignore`.
|
|
113
126
|
|
|
114
127
|
重点字段:
|
|
128
|
+
- `workflow.mode`
|
|
115
129
|
- `commands.*`
|
|
116
130
|
- `target_env.*`
|
|
117
131
|
- `jenkins.*`
|
|
118
132
|
- `docs.*`
|
|
119
133
|
|
|
120
134
|
默认必填:
|
|
135
|
+
- `workflow.mode`
|
|
121
136
|
- `project.name`
|
|
122
137
|
- `commands.light_gate` 或 `commands.quick_test` 或 `commands.test` 或 `commands.build`
|
|
123
138
|
- `target_env.name`
|
|
@@ -189,7 +204,8 @@ It must be committed to Git. Do not add it to `.gitignore`.
|
|
|
189
204
|
## Default Gate Policy
|
|
190
205
|
- Default local gate is lightweight only.
|
|
191
206
|
- Do not require local Docker Compose or full local regression unless the task explicitly needs local runtime diagnosis.
|
|
192
|
-
-
|
|
207
|
+
- In `dev` mode, push is the finish line after `DEV-CLOSED` is recorded.
|
|
208
|
+
- In `verify` mode, Jenkins success, target environment verification, and closure record are mandatory.
|
|
193
209
|
```
|
|
194
210
|
|
|
195
211
|
## Docs Structure and Recording Rules
|
|
@@ -256,7 +272,7 @@ These categories require stronger verification and usually a DD:
|
|
|
256
272
|
- File upload / download
|
|
257
273
|
- Production configuration
|
|
258
274
|
|
|
259
|
-
For these tasks,
|
|
275
|
+
For these tasks, use `workflow.mode: "verify"` or run an explicit verification pass after the fast `dev` closure.
|
|
260
276
|
|
|
261
277
|
## Commands
|
|
262
278
|
|
|
@@ -265,27 +281,32 @@ Recommended default flow:
|
|
|
265
281
|
```bash
|
|
266
282
|
pip install pyyaml requests
|
|
267
283
|
python3 docs/tools/autopipeline/ap.py doctor
|
|
268
|
-
python3 docs/tools/autopipeline/ap.py
|
|
269
|
-
python3 docs/tools/autopipeline/ap.py commit-push <TASK_ID> --msg "<TASK_ID>: <summary>" --require-light-gate --require-jenkins
|
|
270
|
-
python3 docs/tools/autopipeline/ap.py verify-jenkins-build --git-ref HEAD
|
|
271
|
-
python3 docs/tools/autopipeline/ap.py wait-health --scope target
|
|
272
|
-
python3 docs/tools/autopipeline/ap.py verify-target --backend-path /health --frontend-path /
|
|
273
|
-
python3 docs/tools/autopipeline/ap.py record-closure <TASK_ID> --commit HEAD --jenkins <build-url> --result PASS --verification "health check" --verification "key api" --verification "key page"
|
|
284
|
+
python3 docs/tools/autopipeline/ap.py commit-push <TASK_ID> --msg "<TASK_ID>: <summary>"
|
|
274
285
|
```
|
|
275
286
|
|
|
276
|
-
|
|
287
|
+
Development mode can also be forced per run:
|
|
288
|
+
|
|
289
|
+
```bash
|
|
290
|
+
python3 docs/tools/autopipeline/ap.py commit-push <TASK_ID> --mode dev --msg "<TASK_ID>: <summary>"
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
Verification mode runs the full Jenkins + target-environment loop:
|
|
277
294
|
|
|
278
295
|
```bash
|
|
279
296
|
python3 docs/tools/autopipeline/ap.py commit-push <TASK_ID> \
|
|
297
|
+
--mode verify \
|
|
280
298
|
--msg "<TASK_ID>: <summary>" \
|
|
281
|
-
--
|
|
282
|
-
--
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
299
|
+
--backend-path /health \
|
|
300
|
+
--frontend-path /
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
Manual verification commands remain available:
|
|
304
|
+
|
|
305
|
+
```bash
|
|
306
|
+
python3 docs/tools/autopipeline/ap.py verify-jenkins-build --git-ref HEAD
|
|
307
|
+
python3 docs/tools/autopipeline/ap.py wait-health --scope target
|
|
308
|
+
python3 docs/tools/autopipeline/ap.py verify-target --backend-path /health --frontend-path /
|
|
309
|
+
python3 docs/tools/autopipeline/ap.py record-closure <TASK_ID> --commit HEAD --jenkins <build-url> --result PASS --verification "health check" --verification "key api" --verification "key page"
|
|
289
310
|
```
|
|
290
311
|
|
|
291
312
|
Available on-demand commands:
|
|
@@ -328,7 +349,7 @@ python3 docs/tools/autopipeline/ap.py gen-summary <TASK_ID>
|
|
|
328
349
|
- `verify-target`
|
|
329
350
|
- Performs real target-environment verification beyond health checks when you provide key backend/frontend paths.
|
|
330
351
|
- `commit-push --record-closure`
|
|
331
|
-
-
|
|
352
|
+
- Kept for compatibility; normal `commit-push` now records closure automatically based on `workflow.mode`.
|
|
332
353
|
|
|
333
354
|
## Publish (NPM)
|
|
334
355
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: auto-coding-skill
|
|
3
|
-
description: Use for a
|
|
3
|
+
description: Use for a Claude/Codex engineering workflow with dev and verify modes. Initialize docs, fill docs/ENGINEERING.md once, then execute task->minimal-design->light-gate->DEV-CLOSED->push in dev mode, or full Jenkins->target-env->PASS closure in verify mode.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Auto Coding Skill (Claude + Codex)
|
|
7
7
|
|
|
8
|
-
This skill is for Go backend + frontend monorepo projects that rely on Jenkins to build and deploy after push. It supports both Claude and Codex. The default
|
|
8
|
+
This skill is for Go backend + frontend monorepo projects that rely on Jenkins to build and deploy after push. It supports both Claude and Codex. The default `dev` mode is optimized for fast development: lightweight local gate, early closure record, commit, push, then move to the next task. Use `verify` mode when Jenkins and the real target environment must be completed before closure.
|
|
9
9
|
|
|
10
10
|
`docs/ENGINEERING.md` is intentionally Git-tracked in this workflow. The remaining environment fields in that file are mandatory, must be filled with real values, and are committed as part of the project baseline. Unused environment keys should be removed from the template instead of being left as placeholders.
|
|
11
11
|
|
|
@@ -66,6 +66,7 @@ Fill only:
|
|
|
66
66
|
- `docs/ENGINEERING.md` frontmatter
|
|
67
67
|
|
|
68
68
|
This contains all manual fields:
|
|
69
|
+
- `workflow.mode`
|
|
69
70
|
- `commands.*`
|
|
70
71
|
- `runtime.*` (only for optional local diagnostics)
|
|
71
72
|
- `target_env.*`
|
|
@@ -76,6 +77,7 @@ Do not duplicate config in other md/yaml files.
|
|
|
76
77
|
Do not hide `docs/ENGINEERING.md` in `.gitignore`.
|
|
77
78
|
|
|
78
79
|
Minimum required config for the default flow:
|
|
80
|
+
- `workflow.mode`
|
|
79
81
|
- `project.name`
|
|
80
82
|
- `commands.light_gate` or `commands.quick_test` or `commands.test` or `commands.build`
|
|
81
83
|
- `target_env.name`
|
|
@@ -108,16 +110,28 @@ Minimum required config for the default flow:
|
|
|
108
110
|
|
|
109
111
|
## Execution order
|
|
110
112
|
|
|
113
|
+
Read `workflow.mode` from `docs/ENGINEERING.md` before choosing the path.
|
|
114
|
+
|
|
115
|
+
`dev` mode:
|
|
116
|
+
|
|
111
117
|
1) read `docs/ENGINEERING.md`
|
|
112
118
|
2) read / update `docs/tasks/taskbook.md`
|
|
113
119
|
3) write minimal design notes; create a DD only when the change is cross-module, API, DB, deployment, Jenkins, or key-page-flow related
|
|
114
120
|
4) implement only the necessary changes
|
|
115
121
|
5) run the default local lightweight gate
|
|
116
|
-
6)
|
|
117
|
-
7)
|
|
118
|
-
8)
|
|
119
|
-
|
|
120
|
-
|
|
122
|
+
6) append `docs/tasks/closure-log.md` with `Result: DEV-CLOSED`
|
|
123
|
+
7) commit + push
|
|
124
|
+
8) stop and start the next development task
|
|
125
|
+
|
|
126
|
+
`verify` mode:
|
|
127
|
+
|
|
128
|
+
1) read / update the same authoritative docs
|
|
129
|
+
2) run the default local lightweight gate
|
|
130
|
+
3) commit + push
|
|
131
|
+
4) verify Jenkins build / deployment result
|
|
132
|
+
5) verify the real target environment
|
|
133
|
+
6) append `docs/tasks/closure-log.md` with `Result: PASS / FAIL / PARTIAL`
|
|
134
|
+
7) use summary / deployment record / regression matrix only when the task actually requires them
|
|
121
135
|
|
|
122
136
|
## Commands
|
|
123
137
|
|
|
@@ -125,12 +139,9 @@ Default commands:
|
|
|
125
139
|
|
|
126
140
|
```bash
|
|
127
141
|
python3 docs/tools/autopipeline/ap.py doctor
|
|
128
|
-
python3 docs/tools/autopipeline/ap.py
|
|
129
|
-
python3 docs/tools/autopipeline/ap.py commit-push <TASK_ID> --msg "<TASK_ID>: <summary>"
|
|
130
|
-
python3 docs/tools/autopipeline/ap.py verify-
|
|
131
|
-
python3 docs/tools/autopipeline/ap.py wait-health --scope target
|
|
132
|
-
python3 docs/tools/autopipeline/ap.py verify-target --backend-path /health --frontend-path /
|
|
133
|
-
python3 docs/tools/autopipeline/ap.py record-closure <TASK_ID> --commit HEAD --jenkins <build-url> --result PASS --verification "health check" --verification "key api"
|
|
142
|
+
python3 docs/tools/autopipeline/ap.py commit-push <TASK_ID> --msg "<TASK_ID>: <summary>"
|
|
143
|
+
python3 docs/tools/autopipeline/ap.py commit-push <TASK_ID> --mode dev --msg "<TASK_ID>: <summary>"
|
|
144
|
+
python3 docs/tools/autopipeline/ap.py commit-push <TASK_ID> --mode verify --msg "<TASK_ID>: <summary>" --backend-path /health --frontend-path /
|
|
134
145
|
```
|
|
135
146
|
|
|
136
147
|
On-demand commands:
|
|
@@ -146,12 +157,14 @@ python3 docs/tools/autopipeline/ap.py gen-summary <TASK_ID>
|
|
|
146
157
|
## Quality policy
|
|
147
158
|
|
|
148
159
|
- Default local gate is lightweight and time-bounded: prefer one curated project command via `commands.light_gate`, then run only diff/API/Jenkins checks.
|
|
160
|
+
- `workflow.mode: dev` closes development after light gate, closure record, commit, and push.
|
|
161
|
+
- `workflow.mode: verify` closes only after Jenkins and target-environment verification.
|
|
149
162
|
- `doctor` should be used early to catch missing or invalid config before the first implementation loop.
|
|
150
163
|
- `light-gate` now fails if no usable fast gate command is configured.
|
|
151
164
|
- `doctor`, `light-gate`, and `commit-push` all fail when required environment fields are missing, placeholder-like, or syntactically invalid.
|
|
152
165
|
- Do not require local Docker Compose or full local regression for every small change.
|
|
153
|
-
- Jenkins and target environment verification are
|
|
166
|
+
- Jenkins and target environment verification are mandatory in `verify` mode, not in default `dev` mode.
|
|
154
167
|
- `verify-target` should be used for real target-environment API/page checks when the task touches user-visible or deploy-sensitive behavior.
|
|
155
|
-
- `commit-push
|
|
168
|
+
- `commit-push` records closure automatically according to `workflow.mode`.
|
|
156
169
|
- `regression-matrix.md` can mark `PASS` only after real execution with evidence.
|
|
157
170
|
- High-risk changes must include target environment verification and usually a DD.
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
+
workflow:
|
|
3
|
+
mode: "dev"
|
|
4
|
+
|
|
2
5
|
project:
|
|
3
6
|
name: ""
|
|
4
7
|
repo_root: "."
|
|
@@ -66,8 +69,10 @@ docs:
|
|
|
66
69
|
|
|
67
70
|
# docs/ENGINEERING.md — Lightweight Default Workflow (Source of Truth)
|
|
68
71
|
|
|
69
|
-
|
|
70
|
-
|
|
72
|
+
目标:默认采用高效率开发闭环,并通过 `workflow.mode` 控制流程长度。
|
|
73
|
+
|
|
74
|
+
- `dev`:开发模式,最快闭环。轻量门禁通过后,提前写 `DEV-CLOSED` 闭环,commit + push 触发 Jenkins 后结束。
|
|
75
|
+
- `verify`:验证模式,完整闭环。轻量门禁、commit + push、Jenkins 构建验证、目标环境验证全部完成后,写 `PASS` 闭环。
|
|
71
76
|
|
|
72
77
|
默认原则:
|
|
73
78
|
- 默认不要求本地 Docker Compose 启动。
|
|
@@ -90,6 +95,7 @@ docs:
|
|
|
90
95
|
## 0. 配置填写(必须)
|
|
91
96
|
|
|
92
97
|
先填写 `docs/ENGINEERING.md` frontmatter 中的所有空值。重点包括:
|
|
98
|
+
- `workflow.mode`:`dev` 或 `verify`,默认推荐 `dev`
|
|
93
99
|
- `commands.light_gate`:推荐配置一个项目级快速门禁命令,作为默认本地校验入口
|
|
94
100
|
- `target_env.*`:目标环境前端 / 后端地址、用户名、密码,必须全部填写且真实可用
|
|
95
101
|
- `jenkins.*`:Jenkins UI/API 用户名、密码、Job、分支、镜像、部署环境,必须全部填写且真实可用
|
|
@@ -102,6 +108,7 @@ docs:
|
|
|
102
108
|
- `jenkins.api_user` / `jenkins.api_password`:Jenkins API 用户名 / 密码
|
|
103
109
|
|
|
104
110
|
默认必填:
|
|
111
|
+
- `workflow.mode`
|
|
105
112
|
- `project.name`
|
|
106
113
|
- `commands.light_gate` 或 `commands.quick_test` 或 `commands.test` 或 `commands.build`
|
|
107
114
|
- `target_env.name`
|
|
@@ -181,6 +188,35 @@ docs:
|
|
|
181
188
|
|
|
182
189
|
## 2. 标准流程(默认)
|
|
183
190
|
|
|
191
|
+
### 2.1 开发模式:`workflow.mode: "dev"`
|
|
192
|
+
|
|
193
|
+
用于日常快速开发。默认闭环:
|
|
194
|
+
|
|
195
|
+
需求确认 → 最小设计记录 → 开发实现 → 本地轻量校验 → 写 `DEV-CLOSED` 闭环 → commit + push → 结束
|
|
196
|
+
|
|
197
|
+
规则:
|
|
198
|
+
- 只跑最轻量门禁。
|
|
199
|
+
- push 触发 Jenkins 后不等待、不轮询、不验证目标环境。
|
|
200
|
+
- `closure-log.md` 必须提前写入本次提交。
|
|
201
|
+
- 闭环结果写 `DEV-CLOSED`,不要伪装成完整 `PASS`。
|
|
202
|
+
- Jenkins Build 写 `triggered by push, not verified in dev mode`。
|
|
203
|
+
- Target Env 写 `not verified in dev mode`。
|
|
204
|
+
|
|
205
|
+
### 2.2 验证模式:`workflow.mode: "verify"`
|
|
206
|
+
|
|
207
|
+
用于发布前、验收、高风险变更或需要完整证据的任务。默认闭环:
|
|
208
|
+
|
|
209
|
+
需求确认 → 最小设计 / 必要 DD → 开发实现 → 本地轻量校验 → commit + push → Jenkins 构建验证 → 目标环境验证 → 写 `PASS` 闭环
|
|
210
|
+
|
|
211
|
+
规则:
|
|
212
|
+
- Jenkins 构建必须成功。
|
|
213
|
+
- 目标环境健康检查必须通过。
|
|
214
|
+
- 关键接口 / 页面路径按任务需要补充验证。
|
|
215
|
+
- 只有真实验证完成后,闭环结果才允许写 `PASS`。
|
|
216
|
+
- 回归矩阵只有真实执行并有证据时才允许标 `PASS`。
|
|
217
|
+
|
|
218
|
+
### 2.3 任务步骤
|
|
219
|
+
|
|
184
220
|
1. 需求确认
|
|
185
221
|
明确任务范围、影响服务、是否涉及 API/数据库/部署/Jenkins/前端页面。
|
|
186
222
|
|
|
@@ -198,20 +234,20 @@ docs:
|
|
|
198
234
|
- API 文档检查
|
|
199
235
|
- Jenkins 配置检查
|
|
200
236
|
|
|
201
|
-
5.
|
|
202
|
-
|
|
237
|
+
5. 提交推送
|
|
238
|
+
`dev` 模式先写开发闭环再 commit + push;`verify` 模式 commit + push 后继续验证 Jenkins 和目标环境。
|
|
203
239
|
|
|
204
240
|
6. Jenkins 验证
|
|
205
|
-
|
|
241
|
+
仅 `verify` 模式默认执行。查看 Jenkins 构建、镜像、部署结果;失败则根据 Jenkins 日志修复,再次提交推送。
|
|
206
242
|
|
|
207
243
|
7. 目标环境验证
|
|
208
|
-
|
|
244
|
+
仅 `verify` 模式默认执行。在真实目标环境做健康检查、关键接口、关键页面或业务路径验证。
|
|
209
245
|
|
|
210
246
|
8. 回归与证据记录
|
|
211
247
|
只有真实执行过 Jenkins / 目标环境验证,或显式要求本地运行验证时,才允许把 `regression-matrix.md` 标为 `PASS`。
|
|
212
248
|
|
|
213
249
|
9. 闭环记录
|
|
214
|
-
|
|
250
|
+
每个任务必须留下轻量闭环记录。`dev` 模式用 `DEV-CLOSED`,`verify` 模式用 `PASS` / `FAIL` / `PARTIAL`。
|
|
215
251
|
|
|
216
252
|
10. 配置入库
|
|
217
253
|
`docs/ENGINEERING.md` 中保留下来的环境信息、前端/后端账号、Jenkins 账号与密码必须 100% 填写、正确填写,并提交 Git 作为项目权威配置持续维护。
|
|
@@ -231,7 +267,7 @@ docs:
|
|
|
231
267
|
|
|
232
268
|
高风险变更至少额外要求:
|
|
233
269
|
- 明确 DD
|
|
234
|
-
-
|
|
270
|
+
- 使用 `workflow.mode: "verify"`,或在 `dev` 快速闭环后显式补目标环境真实验证
|
|
235
271
|
- 闭环记录写清楚验证路径和结果
|
|
236
272
|
- 必要时补 summary / deployment record / regression matrix
|
|
237
273
|
|
|
@@ -254,6 +290,8 @@ docs:
|
|
|
254
290
|
|
|
255
291
|
统一使用:
|
|
256
292
|
- `python3 docs/tools/autopipeline/ap.py doctor`
|
|
293
|
+
- `python3 docs/tools/autopipeline/ap.py commit-push <TASK_ID> --msg "<TASK_ID>: <summary>"`
|
|
294
|
+
- `python3 docs/tools/autopipeline/ap.py commit-push <TASK_ID> --mode verify --msg "<TASK_ID>: <summary>" ...`
|
|
257
295
|
- `python3 docs/tools/autopipeline/ap.py light-gate`
|
|
258
296
|
- `python3 docs/tools/autopipeline/ap.py verify-jenkins-build ...`
|
|
259
297
|
- `python3 docs/tools/autopipeline/ap.py wait-health --scope target`
|
|
@@ -263,6 +301,7 @@ docs:
|
|
|
263
301
|
说明:
|
|
264
302
|
- `doctor`:检查默认流程必填项和常见配置错误。
|
|
265
303
|
- `light-gate`:默认轻量门禁,优先执行项目自定义快速门禁命令。
|
|
304
|
+
- `commit-push`:按 `workflow.mode` 自动选择开发闭环或完整验证闭环。
|
|
266
305
|
- `verify-target`:目标环境健康检查 + 按需关键 API / 页面验证。
|
|
267
306
|
- `record-closure`:默认轻量闭环记录。
|
|
268
307
|
- `check-matrix`、`gen-summary`、`runtime-up/down`:保留为按需工具。
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
规则:
|
|
4
4
|
1) 每个任务完成后,至少追加一条闭环记录
|
|
5
|
-
2)
|
|
6
|
-
3) Jenkins
|
|
7
|
-
4)
|
|
5
|
+
2) `dev` 模式记录开发闭环:轻量门禁通过、已提交推送、Jenkins 已由 push 触发但不等待验证
|
|
6
|
+
3) `verify` 模式记录完整闭环:真实提交、Jenkins 构建、目标环境验证结果
|
|
7
|
+
4) Jenkins 失败后再修复的任务,应补充失败原因和修复提交
|
|
8
|
+
5) 这里是默认闭环文档;长 summary 只用于高风险或复盘任务
|
|
8
9
|
|
|
9
10
|
---
|
|
10
11
|
|
|
@@ -14,7 +15,7 @@
|
|
|
14
15
|
- Jenkins Build: <build url>
|
|
15
16
|
- Target Env: <env name / health url / page path>
|
|
16
17
|
- Verification: <health / key api / key page / business path>
|
|
17
|
-
- Result: PASS / FAIL / PARTIAL
|
|
18
|
+
- Result: DEV-CLOSED / PASS / FAIL / PARTIAL
|
|
18
19
|
- Follow-up: <none or todo>
|
|
19
20
|
- Jenkins Failure: <optional>
|
|
20
21
|
- Fix Commit: <optional>
|
|
@@ -317,12 +317,12 @@ def _resolve_jenkins_job_candidates(
|
|
|
317
317
|
) -> List[str]:
|
|
318
318
|
jenkins_cfg = (cfg.get("jenkins") or {})
|
|
319
319
|
effective_branch = str(branch_name or "").strip()
|
|
320
|
-
|
|
320
|
+
effective_root = str(multibranch_root_job or "").strip()
|
|
321
|
+
if not effective_branch and effective_root:
|
|
321
322
|
inferred_branch = _resolve_git_branch_name(repo, git_ref or "HEAD")
|
|
322
323
|
if inferred_branch:
|
|
323
324
|
effective_branch = inferred_branch
|
|
324
325
|
|
|
325
|
-
effective_root = str(multibranch_root_job or "").strip()
|
|
326
326
|
explicit_url = str(job_url or "").strip()
|
|
327
327
|
explicit_name = str(job_name or "").strip()
|
|
328
328
|
configured_url = str(jenkins_cfg.get("job_url") or "").strip()
|
|
@@ -423,6 +423,8 @@ def cmd_gen_summary(args: argparse.Namespace) -> None:
|
|
|
423
423
|
staged = run(["git", "diff", "--cached", "--name-only"], cwd=repo, check=False).stdout.strip()
|
|
424
424
|
unstaged = run(["git", "diff", "--name-only"], cwd=repo, check=False).stdout.strip()
|
|
425
425
|
status = run(["git", "status", "--porcelain=v1"], cwd=repo, check=False).stdout.strip()
|
|
426
|
+
staged_block = "- " + staged.replace("\n", "\n- ") if staged else "- (none)"
|
|
427
|
+
unstaged_block = "- " + unstaged.replace("\n", "\n- ") if unstaged else "- (none)"
|
|
426
428
|
|
|
427
429
|
content = f"""# Task Summary — {task_id} — {title}
|
|
428
430
|
|
|
@@ -442,9 +444,9 @@ def cmd_gen_summary(args: argparse.Namespace) -> None:
|
|
|
442
444
|
## 2. 变更概览
|
|
443
445
|
### Git change snapshot
|
|
444
446
|
- Staged files:
|
|
445
|
-
{
|
|
447
|
+
{staged_block}
|
|
446
448
|
- Unstaged files:
|
|
447
|
-
{
|
|
449
|
+
{unstaged_block}
|
|
448
450
|
- Status:
|
|
449
451
|
```text
|
|
450
452
|
{status}
|
|
@@ -540,6 +542,15 @@ def _load_cfg(repo: Path) -> dict:
|
|
|
540
542
|
return load_yaml(cfg_path)
|
|
541
543
|
|
|
542
544
|
|
|
545
|
+
def _workflow_mode(cfg: dict, args: Optional[argparse.Namespace] = None) -> str:
|
|
546
|
+
explicit = str(getattr(args, "mode", "") or "").strip().lower() if args else ""
|
|
547
|
+
configured = str(((cfg.get("workflow") or {}).get("mode")) or "dev").strip().lower()
|
|
548
|
+
mode = explicit or configured or "dev"
|
|
549
|
+
if mode not in {"dev", "verify"}:
|
|
550
|
+
raise APError("workflow.mode must be 'dev' or 'verify'.")
|
|
551
|
+
return mode
|
|
552
|
+
|
|
553
|
+
|
|
543
554
|
def _text(value: object) -> str:
|
|
544
555
|
return str(value or "").strip()
|
|
545
556
|
|
|
@@ -740,6 +751,7 @@ def cmd_verify_target(args: argparse.Namespace) -> None:
|
|
|
740
751
|
|
|
741
752
|
summary = ", ".join(checks) if checks else "health-only"
|
|
742
753
|
print(f"[verify-target] OK: {summary}")
|
|
754
|
+
return summary
|
|
743
755
|
|
|
744
756
|
|
|
745
757
|
def cmd_verify_jenkins(args: argparse.Namespace) -> None:
|
|
@@ -771,6 +783,7 @@ def cmd_verify_jenkins(args: argparse.Namespace) -> None:
|
|
|
771
783
|
def cmd_doctor(args: argparse.Namespace) -> None:
|
|
772
784
|
repo = Path(args.repo).resolve()
|
|
773
785
|
cfg = _load_cfg(repo)
|
|
786
|
+
workflow_cfg = (cfg.get("workflow") or {})
|
|
774
787
|
project_cfg = (cfg.get("project") or {})
|
|
775
788
|
commands = (cfg.get("commands") or {})
|
|
776
789
|
target_cfg = (cfg.get("target_env") or {})
|
|
@@ -781,6 +794,9 @@ def cmd_doctor(args: argparse.Namespace) -> None:
|
|
|
781
794
|
missing: List[str] = []
|
|
782
795
|
warnings: List[str] = []
|
|
783
796
|
|
|
797
|
+
mode = str(workflow_cfg.get("mode") or "dev").strip().lower()
|
|
798
|
+
if mode not in {"dev", "verify"}:
|
|
799
|
+
missing.append("workflow.mode (must be dev or verify)")
|
|
784
800
|
if not str(project_cfg.get("name") or "").strip():
|
|
785
801
|
missing.append("project.name")
|
|
786
802
|
if not (
|
|
@@ -868,7 +884,9 @@ def cmd_verify_jenkins_build(args: argparse.Namespace) -> None:
|
|
|
868
884
|
max_builds = int(args.max_builds or 20)
|
|
869
885
|
timeout_s = int(args.timeout_sec or 300)
|
|
870
886
|
poll_s = int(args.poll_sec or 5)
|
|
871
|
-
inferred_branch =
|
|
887
|
+
inferred_branch = ""
|
|
888
|
+
if args.multibranch_root_job and not args.branch_name:
|
|
889
|
+
inferred_branch = _resolve_git_branch_name(repo, git_ref)
|
|
872
890
|
branch_hint = str(args.branch_name or inferred_branch or "").strip()
|
|
873
891
|
root_hint = str(
|
|
874
892
|
args.multibranch_root_job
|
|
@@ -910,15 +928,16 @@ def cmd_verify_jenkins_build(args: argparse.Namespace) -> None:
|
|
|
910
928
|
f"#{payload.get('number')} {payload.get('url')}",
|
|
911
929
|
args.allow_no_deploy,
|
|
912
930
|
)
|
|
931
|
+
build_url = str(payload.get("url") or "").strip()
|
|
913
932
|
print(
|
|
914
933
|
"[verify-jenkins-build] OK: "
|
|
915
934
|
f"job={job_label} "
|
|
916
935
|
f"build=#{payload.get('number')} "
|
|
917
936
|
f"result={result} "
|
|
918
937
|
f"description={description} "
|
|
919
|
-
f"url={
|
|
938
|
+
f"url={build_url}"
|
|
920
939
|
)
|
|
921
|
-
return
|
|
940
|
+
return build_url
|
|
922
941
|
|
|
923
942
|
git_short_sha = _resolve_git_short_sha(repo, git_ref)
|
|
924
943
|
matched = None
|
|
@@ -949,6 +968,7 @@ def cmd_verify_jenkins_build(args: argparse.Namespace) -> None:
|
|
|
949
968
|
f"#{matched.get('number')} {matched.get('url')}",
|
|
950
969
|
args.allow_no_deploy,
|
|
951
970
|
)
|
|
971
|
+
build_url = str(matched.get("url") or "").strip()
|
|
952
972
|
print(
|
|
953
973
|
"[verify-jenkins-build] OK: "
|
|
954
974
|
f"commit={git_short_sha} "
|
|
@@ -956,8 +976,9 @@ def cmd_verify_jenkins_build(args: argparse.Namespace) -> None:
|
|
|
956
976
|
f"build=#{matched.get('number')} "
|
|
957
977
|
f"result={result} "
|
|
958
978
|
f"description={description} "
|
|
959
|
-
f"url={
|
|
979
|
+
f"url={build_url}"
|
|
960
980
|
)
|
|
981
|
+
return build_url
|
|
961
982
|
|
|
962
983
|
|
|
963
984
|
def cmd_verify_api_docs(args: argparse.Namespace) -> None:
|
|
@@ -1020,28 +1041,74 @@ def cmd_record_closure(args: argparse.Namespace) -> None:
|
|
|
1020
1041
|
print(f"[record-closure] OK: {closure_log}")
|
|
1021
1042
|
|
|
1022
1043
|
|
|
1044
|
+
def _record_commit_push_closure(
|
|
1045
|
+
repo: Path,
|
|
1046
|
+
args: argparse.Namespace,
|
|
1047
|
+
*,
|
|
1048
|
+
commit: str,
|
|
1049
|
+
jenkins: str,
|
|
1050
|
+
target_env: str,
|
|
1051
|
+
verification: List[str],
|
|
1052
|
+
result: str,
|
|
1053
|
+
follow_up: str,
|
|
1054
|
+
) -> None:
|
|
1055
|
+
cmd_record_closure(
|
|
1056
|
+
argparse.Namespace(
|
|
1057
|
+
repo=str(repo),
|
|
1058
|
+
task_id=args.task_id,
|
|
1059
|
+
title=args.title,
|
|
1060
|
+
commit=commit,
|
|
1061
|
+
jenkins=jenkins,
|
|
1062
|
+
target_env=target_env,
|
|
1063
|
+
verification=verification,
|
|
1064
|
+
result=result,
|
|
1065
|
+
follow_up=follow_up,
|
|
1066
|
+
initial_commit=args.initial_commit,
|
|
1067
|
+
jenkins_failure=args.jenkins_failure,
|
|
1068
|
+
fix_commit=args.fix_commit,
|
|
1069
|
+
)
|
|
1070
|
+
)
|
|
1071
|
+
|
|
1072
|
+
|
|
1023
1073
|
def cmd_commit_push(args: argparse.Namespace) -> None:
|
|
1024
1074
|
repo = Path(args.repo).resolve()
|
|
1025
1075
|
ensure_git_repo(repo)
|
|
1026
1076
|
cmd_doctor(argparse.Namespace(repo=str(repo)))
|
|
1077
|
+
cfg = _load_cfg(repo)
|
|
1078
|
+
mode = _workflow_mode(cfg, args)
|
|
1079
|
+
target_cfg = (cfg.get("target_env") or {})
|
|
1027
1080
|
|
|
1028
1081
|
msg = args.msg
|
|
1029
1082
|
|
|
1030
|
-
if args.record_closure and not args.result:
|
|
1031
|
-
raise APError("When using --record-closure, --result is required.")
|
|
1032
|
-
|
|
1033
1083
|
if args.require_runtime_health:
|
|
1034
1084
|
cmd_wait_health(argparse.Namespace(repo=str(repo), scope="runtime"))
|
|
1035
1085
|
|
|
1036
|
-
if args.require_light_gate:
|
|
1086
|
+
if mode in {"dev", "verify"} or args.require_light_gate:
|
|
1037
1087
|
cmd_light_gate(argparse.Namespace(repo=str(repo)))
|
|
1038
1088
|
|
|
1039
1089
|
if args.require_jenkins:
|
|
1040
1090
|
cmd_verify_jenkins(argparse.Namespace(repo=str(repo)))
|
|
1041
1091
|
|
|
1042
|
-
if args.require_matrix:
|
|
1092
|
+
if args.require_matrix and mode != "verify":
|
|
1043
1093
|
cmd_check_matrix(argparse.Namespace(repo=str(repo)))
|
|
1044
1094
|
|
|
1095
|
+
if mode == "dev":
|
|
1096
|
+
dev_verification = args.verification or [
|
|
1097
|
+
"light-gate only",
|
|
1098
|
+
"Jenkins triggered by push; build not verified in dev mode",
|
|
1099
|
+
"target environment not verified in dev mode",
|
|
1100
|
+
]
|
|
1101
|
+
_record_commit_push_closure(
|
|
1102
|
+
repo,
|
|
1103
|
+
args,
|
|
1104
|
+
commit="generated by this commit-push run",
|
|
1105
|
+
jenkins=args.jenkins_build or "triggered by push, not verified in dev mode",
|
|
1106
|
+
target_env=args.target_env or "not verified in dev mode",
|
|
1107
|
+
verification=dev_verification,
|
|
1108
|
+
result=args.result or "DEV-CLOSED",
|
|
1109
|
+
follow_up=args.follow_up or "Run verify mode when Jenkins and target-environment evidence is required.",
|
|
1110
|
+
)
|
|
1111
|
+
|
|
1045
1112
|
run(["git", "add", "-A"], cwd=repo)
|
|
1046
1113
|
diff = run(["git", "diff", "--cached", "--name-only"], cwd=repo).stdout.strip()
|
|
1047
1114
|
if not diff:
|
|
@@ -1049,24 +1116,65 @@ def cmd_commit_push(args: argparse.Namespace) -> None:
|
|
|
1049
1116
|
|
|
1050
1117
|
run(["git", "commit", "-m", msg], cwd=repo)
|
|
1051
1118
|
run(["git", "push"], cwd=repo)
|
|
1052
|
-
|
|
1053
|
-
|
|
1119
|
+
|
|
1120
|
+
if mode == "verify":
|
|
1121
|
+
jenkins_build = cmd_verify_jenkins_build(
|
|
1122
|
+
argparse.Namespace(
|
|
1123
|
+
repo=str(repo),
|
|
1124
|
+
git_ref="HEAD",
|
|
1125
|
+
job_name=args.job_name,
|
|
1126
|
+
job_url=args.job_url,
|
|
1127
|
+
multibranch_root_job=args.multibranch_root_job,
|
|
1128
|
+
branch_name=args.branch_name,
|
|
1129
|
+
build_number=args.build_number,
|
|
1130
|
+
max_builds=args.max_builds,
|
|
1131
|
+
timeout_sec=args.timeout_sec,
|
|
1132
|
+
poll_sec=args.poll_sec,
|
|
1133
|
+
allow_no_deploy=args.allow_no_deploy,
|
|
1134
|
+
)
|
|
1135
|
+
)
|
|
1136
|
+
target_summary = cmd_verify_target(
|
|
1054
1137
|
argparse.Namespace(
|
|
1055
1138
|
repo=str(repo),
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
target_env=args.target_env,
|
|
1061
|
-
verification=args.verification,
|
|
1062
|
-
result=args.result,
|
|
1063
|
-
follow_up=args.follow_up,
|
|
1064
|
-
initial_commit=args.initial_commit,
|
|
1065
|
-
jenkins_failure=args.jenkins_failure,
|
|
1066
|
-
fix_commit=args.fix_commit,
|
|
1139
|
+
backend_path=args.backend_path,
|
|
1140
|
+
frontend_path=args.frontend_path,
|
|
1141
|
+
backend_basic_auth=args.backend_basic_auth,
|
|
1142
|
+
frontend_basic_auth=args.frontend_basic_auth,
|
|
1067
1143
|
)
|
|
1068
1144
|
)
|
|
1069
|
-
|
|
1145
|
+
if args.require_matrix:
|
|
1146
|
+
cmd_check_matrix(argparse.Namespace(repo=str(repo)))
|
|
1147
|
+
verification = args.verification or [
|
|
1148
|
+
f"Jenkins build verified: {jenkins_build or 'verified by git-ref HEAD'}",
|
|
1149
|
+
f"Target verification: {target_summary}",
|
|
1150
|
+
]
|
|
1151
|
+
_record_commit_push_closure(
|
|
1152
|
+
repo,
|
|
1153
|
+
args,
|
|
1154
|
+
commit="HEAD",
|
|
1155
|
+
jenkins=args.jenkins_build or jenkins_build or "verified by git-ref HEAD",
|
|
1156
|
+
target_env=args.target_env or str(target_cfg.get("name") or "").strip(),
|
|
1157
|
+
verification=verification,
|
|
1158
|
+
result=args.result or "PASS",
|
|
1159
|
+
follow_up=args.follow_up or "none",
|
|
1160
|
+
)
|
|
1161
|
+
run(["git", "add", "-A"], cwd=repo)
|
|
1162
|
+
closure_diff = run(["git", "diff", "--cached", "--name-only"], cwd=repo).stdout.strip()
|
|
1163
|
+
if closure_diff:
|
|
1164
|
+
run(["git", "commit", "-m", f"{args.task_id}: record verification closure [skip ci]"], cwd=repo)
|
|
1165
|
+
run(["git", "push"], cwd=repo)
|
|
1166
|
+
elif args.record_closure and mode != "dev":
|
|
1167
|
+
_record_commit_push_closure(
|
|
1168
|
+
repo,
|
|
1169
|
+
args,
|
|
1170
|
+
commit="HEAD",
|
|
1171
|
+
jenkins=args.jenkins_build or "TODO",
|
|
1172
|
+
target_env=args.target_env or str(target_cfg.get("name") or "").strip(),
|
|
1173
|
+
verification=args.verification or [],
|
|
1174
|
+
result=args.result or "PARTIAL",
|
|
1175
|
+
follow_up=args.follow_up or "none",
|
|
1176
|
+
)
|
|
1177
|
+
print(f"[commit-push] OK - mode={mode}")
|
|
1070
1178
|
|
|
1071
1179
|
|
|
1072
1180
|
def main(argv: Optional[List[str]] = None) -> int:
|
|
@@ -1140,7 +1248,7 @@ def main(argv: Optional[List[str]] = None) -> int:
|
|
|
1140
1248
|
s.add_argument("--jenkins")
|
|
1141
1249
|
s.add_argument("--target-env")
|
|
1142
1250
|
s.add_argument("--verification", action="append")
|
|
1143
|
-
s.add_argument("--result", choices=["PASS", "FAIL", "PARTIAL"], required=True)
|
|
1251
|
+
s.add_argument("--result", choices=["DEV-CLOSED", "PASS", "FAIL", "PARTIAL"], required=True)
|
|
1144
1252
|
s.add_argument("--follow-up")
|
|
1145
1253
|
s.add_argument("--initial-commit")
|
|
1146
1254
|
s.add_argument("--jenkins-failure")
|
|
@@ -1151,15 +1259,29 @@ def main(argv: Optional[List[str]] = None) -> int:
|
|
|
1151
1259
|
s.add_argument("task_id")
|
|
1152
1260
|
s.add_argument("--title")
|
|
1153
1261
|
s.add_argument("--msg", required=True)
|
|
1262
|
+
s.add_argument("--mode", choices=["dev", "verify"])
|
|
1154
1263
|
s.add_argument("--require-light-gate", action="store_true")
|
|
1155
1264
|
s.add_argument("--require-runtime-health", action="store_true")
|
|
1156
1265
|
s.add_argument("--require-jenkins", action="store_true")
|
|
1157
1266
|
s.add_argument("--require-matrix", action="store_true")
|
|
1158
1267
|
s.add_argument("--record-closure", action="store_true")
|
|
1268
|
+
s.add_argument("--job-name")
|
|
1269
|
+
s.add_argument("--job-url")
|
|
1270
|
+
s.add_argument("--multibranch-root-job")
|
|
1271
|
+
s.add_argument("--branch-name")
|
|
1272
|
+
s.add_argument("--build-number", type=int)
|
|
1273
|
+
s.add_argument("--max-builds", type=int, default=20)
|
|
1274
|
+
s.add_argument("--timeout-sec", type=int, default=300)
|
|
1275
|
+
s.add_argument("--poll-sec", type=int, default=5)
|
|
1276
|
+
s.add_argument("--allow-no-deploy", action="store_true")
|
|
1277
|
+
s.add_argument("--backend-path", action="append")
|
|
1278
|
+
s.add_argument("--frontend-path", action="append")
|
|
1279
|
+
s.add_argument("--backend-basic-auth", action="store_true")
|
|
1280
|
+
s.add_argument("--frontend-basic-auth", action="store_true")
|
|
1159
1281
|
s.add_argument("--jenkins-build")
|
|
1160
1282
|
s.add_argument("--target-env")
|
|
1161
1283
|
s.add_argument("--verification", action="append")
|
|
1162
|
-
s.add_argument("--result", choices=["PASS", "FAIL", "PARTIAL"])
|
|
1284
|
+
s.add_argument("--result", choices=["DEV-CLOSED", "PASS", "FAIL", "PARTIAL"])
|
|
1163
1285
|
s.add_argument("--follow-up")
|
|
1164
1286
|
s.add_argument("--initial-commit")
|
|
1165
1287
|
s.add_argument("--jenkins-failure")
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elvis1513/auto-coding-skill",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "CLI installer for auto-coding-skill (Claude Code + Codex CLI) with Go fullstack + Jenkins workflow support.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"LICENSE"
|
|
14
14
|
],
|
|
15
15
|
"scripts": {
|
|
16
|
-
"test": "node -c cli/src/index.js && python3 -m py_compile src/auto-coding-skill/scripts/ap.py src/auto-coding-skill/scripts/core.py src/auto-coding-skill/scripts/http_checks.py cli/assets/skill/scripts/ap.py cli/assets/skill/scripts/core.py cli/assets/skill/scripts/http_checks.py && find src cli -type d -name '__pycache__' -prune -exec rm -rf {} +",
|
|
16
|
+
"test": "node -c cli/src/index.js && python3 -c \"import ast, pathlib; files = ['src/auto-coding-skill/scripts/ap.py', 'src/auto-coding-skill/scripts/core.py', 'src/auto-coding-skill/scripts/http_checks.py', 'cli/assets/skill/scripts/ap.py', 'cli/assets/skill/scripts/core.py', 'cli/assets/skill/scripts/http_checks.py']; [ast.parse(pathlib.Path(rel).read_text(encoding='utf-8'), filename=rel, feature_version=(3, 11)) for rel in files]; print('python311-grammar-ok')\" && python3 -m py_compile src/auto-coding-skill/scripts/ap.py src/auto-coding-skill/scripts/core.py src/auto-coding-skill/scripts/http_checks.py cli/assets/skill/scripts/ap.py cli/assets/skill/scripts/core.py cli/assets/skill/scripts/http_checks.py && find src cli -type d -name '__pycache__' -prune -exec rm -rf {} +",
|
|
17
17
|
"sync-assets": "node cli/src/sync-assets.js",
|
|
18
18
|
"release:check": "npm run sync-assets && npm run test && npm pack --dry-run"
|
|
19
19
|
},
|