@elvis1513/auto-coding-skill 1.0.3 → 2.0.1
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 +52 -27
- package/cli/assets/skill/SKILL.md +29 -16
- package/cli/assets/skill/data/templates/ENGINEERING.md +47 -8
- package/cli/assets/skill/data/templates/docs/tasks/closure-log.md +5 -4
- package/cli/assets/skill/scripts/ap.py +142 -24
- package/cli/src/index.js +2 -2
- package/package.json +1 -1
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
|
|
|
@@ -23,6 +23,10 @@ npm install -g git+https://github.com/elvis1513/auto-coding-skill.git
|
|
|
23
23
|
|
|
24
24
|
## Release Notes
|
|
25
25
|
|
|
26
|
+
### v2.0.1
|
|
27
|
+
|
|
28
|
+
- Updated the Codex installer target from `.codex/skills` to `.agents/skills`, matching current Codex global and project skill discovery.
|
|
29
|
+
|
|
26
30
|
### v0.3.1
|
|
27
31
|
|
|
28
32
|
- Added Jenkins crumb / CSRF retry support for API verification requests.
|
|
@@ -39,9 +43,20 @@ npm install -g git+https://github.com/elvis1513/auto-coding-skill.git
|
|
|
39
43
|
|
|
40
44
|
## Optimized Standard Flow
|
|
41
45
|
|
|
42
|
-
|
|
46
|
+
模式由 `docs/ENGINEERING.md` 顶部控制:
|
|
47
|
+
|
|
48
|
+
```yaml
|
|
49
|
+
workflow:
|
|
50
|
+
mode: "dev" # dev | verify
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
`dev` 默认闭环:
|
|
54
|
+
|
|
55
|
+
`需求/任务记录 -> 最小设计 -> 开发 -> 本地轻量校验 -> 写 DEV-CLOSED 闭环 -> commit/push -> 结束`
|
|
43
56
|
|
|
44
|
-
|
|
57
|
+
`verify` 完整闭环:
|
|
58
|
+
|
|
59
|
+
`需求/任务记录 -> 最小设计 -> 开发 -> 本地轻量校验 -> commit/push -> Jenkins 构建部署验证 -> 目标环境验证 -> 写 PASS 闭环`
|
|
45
60
|
|
|
46
61
|
具体执行顺序:
|
|
47
62
|
|
|
@@ -58,16 +73,18 @@ npm install -g git+https://github.com/elvis1513/auto-coding-skill.git
|
|
|
58
73
|
- `git diff --check`
|
|
59
74
|
- API 文档检查
|
|
60
75
|
- Jenkins 配置检查
|
|
61
|
-
5.
|
|
62
|
-
-
|
|
76
|
+
5. 提交推送
|
|
77
|
+
- `dev` 模式:轻量校验通过后,先写 `DEV-CLOSED` 闭环,再 commit + push,触发 Jenkins 后结束。
|
|
78
|
+
- `verify` 模式:commit + push 后继续等待 Jenkins 和目标环境验证。
|
|
63
79
|
6. Jenkins 验证
|
|
64
|
-
-
|
|
80
|
+
- 仅 `verify` 模式默认执行。看 Jenkins 构建、镜像、部署结果;失败则基于 Jenkins 日志修复并再次提交。
|
|
65
81
|
7. 目标环境验证
|
|
66
|
-
-
|
|
82
|
+
- 仅 `verify` 模式默认执行。在真实目标环境做健康检查、关键接口、关键页面或业务路径验证。
|
|
67
83
|
8. 回归与证据记录
|
|
68
84
|
- 只有真实执行过 Jenkins / 目标环境验证,或明确要求本地运行验证时,才把 regression matrix 写成 `PASS`。
|
|
69
85
|
9. 闭环记录
|
|
70
|
-
-
|
|
86
|
+
- `dev` 模式记录 `DEV-CLOSED`,表示开发闭环完成但 Jenkins/目标环境未验证。
|
|
87
|
+
- `verify` 模式记录 `PASS` / `FAIL` / `PARTIAL`,必须基于真实验证结果。
|
|
71
88
|
|
|
72
89
|
## Default vs On-demand
|
|
73
90
|
|
|
@@ -99,7 +116,7 @@ autocoding init --ai all
|
|
|
99
116
|
2. Initialize docs and local scripts:
|
|
100
117
|
|
|
101
118
|
```bash
|
|
102
|
-
python3 .
|
|
119
|
+
python3 .agents/skills/auto-coding-skill/scripts/ap.py --repo . install
|
|
103
120
|
# or
|
|
104
121
|
python3 .claude/skills/auto-coding-skill/scripts/ap.py --repo . install
|
|
105
122
|
```
|
|
@@ -112,12 +129,14 @@ This frontmatter is the only manual config source.
|
|
|
112
129
|
It must be committed to Git. Do not add it to `.gitignore`.
|
|
113
130
|
|
|
114
131
|
重点字段:
|
|
132
|
+
- `workflow.mode`
|
|
115
133
|
- `commands.*`
|
|
116
134
|
- `target_env.*`
|
|
117
135
|
- `jenkins.*`
|
|
118
136
|
- `docs.*`
|
|
119
137
|
|
|
120
138
|
默认必填:
|
|
139
|
+
- `workflow.mode`
|
|
121
140
|
- `project.name`
|
|
122
141
|
- `commands.light_gate` 或 `commands.quick_test` 或 `commands.test` 或 `commands.build`
|
|
123
142
|
- `target_env.name`
|
|
@@ -189,7 +208,8 @@ It must be committed to Git. Do not add it to `.gitignore`.
|
|
|
189
208
|
## Default Gate Policy
|
|
190
209
|
- Default local gate is lightweight only.
|
|
191
210
|
- Do not require local Docker Compose or full local regression unless the task explicitly needs local runtime diagnosis.
|
|
192
|
-
-
|
|
211
|
+
- In `dev` mode, push is the finish line after `DEV-CLOSED` is recorded.
|
|
212
|
+
- In `verify` mode, Jenkins success, target environment verification, and closure record are mandatory.
|
|
193
213
|
```
|
|
194
214
|
|
|
195
215
|
## Docs Structure and Recording Rules
|
|
@@ -256,7 +276,7 @@ These categories require stronger verification and usually a DD:
|
|
|
256
276
|
- File upload / download
|
|
257
277
|
- Production configuration
|
|
258
278
|
|
|
259
|
-
For these tasks,
|
|
279
|
+
For these tasks, use `workflow.mode: "verify"` or run an explicit verification pass after the fast `dev` closure.
|
|
260
280
|
|
|
261
281
|
## Commands
|
|
262
282
|
|
|
@@ -265,27 +285,32 @@ Recommended default flow:
|
|
|
265
285
|
```bash
|
|
266
286
|
pip install pyyaml requests
|
|
267
287
|
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"
|
|
288
|
+
python3 docs/tools/autopipeline/ap.py commit-push <TASK_ID> --msg "<TASK_ID>: <summary>"
|
|
274
289
|
```
|
|
275
290
|
|
|
276
|
-
|
|
291
|
+
Development mode can also be forced per run:
|
|
292
|
+
|
|
293
|
+
```bash
|
|
294
|
+
python3 docs/tools/autopipeline/ap.py commit-push <TASK_ID> --mode dev --msg "<TASK_ID>: <summary>"
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
Verification mode runs the full Jenkins + target-environment loop:
|
|
277
298
|
|
|
278
299
|
```bash
|
|
279
300
|
python3 docs/tools/autopipeline/ap.py commit-push <TASK_ID> \
|
|
301
|
+
--mode verify \
|
|
280
302
|
--msg "<TASK_ID>: <summary>" \
|
|
281
|
-
--
|
|
282
|
-
--
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
303
|
+
--backend-path /health \
|
|
304
|
+
--frontend-path /
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
Manual verification commands remain available:
|
|
308
|
+
|
|
309
|
+
```bash
|
|
310
|
+
python3 docs/tools/autopipeline/ap.py verify-jenkins-build --git-ref HEAD
|
|
311
|
+
python3 docs/tools/autopipeline/ap.py wait-health --scope target
|
|
312
|
+
python3 docs/tools/autopipeline/ap.py verify-target --backend-path /health --frontend-path /
|
|
313
|
+
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
314
|
```
|
|
290
315
|
|
|
291
316
|
Available on-demand commands:
|
|
@@ -328,7 +353,7 @@ python3 docs/tools/autopipeline/ap.py gen-summary <TASK_ID>
|
|
|
328
353
|
- `verify-target`
|
|
329
354
|
- Performs real target-environment verification beyond health checks when you provide key backend/frontend paths.
|
|
330
355
|
- `commit-push --record-closure`
|
|
331
|
-
-
|
|
356
|
+
- Kept for compatibility; normal `commit-push` now records closure automatically based on `workflow.mode`.
|
|
332
357
|
|
|
333
358
|
## Publish (NPM)
|
|
334
359
|
|
|
@@ -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
|
|
|
@@ -49,7 +49,7 @@ autocoding init --ai codex
|
|
|
49
49
|
2) Initialize docs/tooling:
|
|
50
50
|
|
|
51
51
|
```bash
|
|
52
|
-
python3 .
|
|
52
|
+
python3 .agents/skills/auto-coding-skill/scripts/ap.py --repo . install
|
|
53
53
|
# or .claude path
|
|
54
54
|
```
|
|
55
55
|
|
|
@@ -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>
|
|
@@ -542,6 +542,15 @@ def _load_cfg(repo: Path) -> dict:
|
|
|
542
542
|
return load_yaml(cfg_path)
|
|
543
543
|
|
|
544
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
|
+
|
|
545
554
|
def _text(value: object) -> str:
|
|
546
555
|
return str(value or "").strip()
|
|
547
556
|
|
|
@@ -742,6 +751,7 @@ def cmd_verify_target(args: argparse.Namespace) -> None:
|
|
|
742
751
|
|
|
743
752
|
summary = ", ".join(checks) if checks else "health-only"
|
|
744
753
|
print(f"[verify-target] OK: {summary}")
|
|
754
|
+
return summary
|
|
745
755
|
|
|
746
756
|
|
|
747
757
|
def cmd_verify_jenkins(args: argparse.Namespace) -> None:
|
|
@@ -773,6 +783,7 @@ def cmd_verify_jenkins(args: argparse.Namespace) -> None:
|
|
|
773
783
|
def cmd_doctor(args: argparse.Namespace) -> None:
|
|
774
784
|
repo = Path(args.repo).resolve()
|
|
775
785
|
cfg = _load_cfg(repo)
|
|
786
|
+
workflow_cfg = (cfg.get("workflow") or {})
|
|
776
787
|
project_cfg = (cfg.get("project") or {})
|
|
777
788
|
commands = (cfg.get("commands") or {})
|
|
778
789
|
target_cfg = (cfg.get("target_env") or {})
|
|
@@ -783,6 +794,9 @@ def cmd_doctor(args: argparse.Namespace) -> None:
|
|
|
783
794
|
missing: List[str] = []
|
|
784
795
|
warnings: List[str] = []
|
|
785
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)")
|
|
786
800
|
if not str(project_cfg.get("name") or "").strip():
|
|
787
801
|
missing.append("project.name")
|
|
788
802
|
if not (
|
|
@@ -914,15 +928,16 @@ def cmd_verify_jenkins_build(args: argparse.Namespace) -> None:
|
|
|
914
928
|
f"#{payload.get('number')} {payload.get('url')}",
|
|
915
929
|
args.allow_no_deploy,
|
|
916
930
|
)
|
|
931
|
+
build_url = str(payload.get("url") or "").strip()
|
|
917
932
|
print(
|
|
918
933
|
"[verify-jenkins-build] OK: "
|
|
919
934
|
f"job={job_label} "
|
|
920
935
|
f"build=#{payload.get('number')} "
|
|
921
936
|
f"result={result} "
|
|
922
937
|
f"description={description} "
|
|
923
|
-
f"url={
|
|
938
|
+
f"url={build_url}"
|
|
924
939
|
)
|
|
925
|
-
return
|
|
940
|
+
return build_url
|
|
926
941
|
|
|
927
942
|
git_short_sha = _resolve_git_short_sha(repo, git_ref)
|
|
928
943
|
matched = None
|
|
@@ -953,6 +968,7 @@ def cmd_verify_jenkins_build(args: argparse.Namespace) -> None:
|
|
|
953
968
|
f"#{matched.get('number')} {matched.get('url')}",
|
|
954
969
|
args.allow_no_deploy,
|
|
955
970
|
)
|
|
971
|
+
build_url = str(matched.get("url") or "").strip()
|
|
956
972
|
print(
|
|
957
973
|
"[verify-jenkins-build] OK: "
|
|
958
974
|
f"commit={git_short_sha} "
|
|
@@ -960,8 +976,9 @@ def cmd_verify_jenkins_build(args: argparse.Namespace) -> None:
|
|
|
960
976
|
f"build=#{matched.get('number')} "
|
|
961
977
|
f"result={result} "
|
|
962
978
|
f"description={description} "
|
|
963
|
-
f"url={
|
|
979
|
+
f"url={build_url}"
|
|
964
980
|
)
|
|
981
|
+
return build_url
|
|
965
982
|
|
|
966
983
|
|
|
967
984
|
def cmd_verify_api_docs(args: argparse.Namespace) -> None:
|
|
@@ -1024,28 +1041,74 @@ def cmd_record_closure(args: argparse.Namespace) -> None:
|
|
|
1024
1041
|
print(f"[record-closure] OK: {closure_log}")
|
|
1025
1042
|
|
|
1026
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
|
+
|
|
1027
1073
|
def cmd_commit_push(args: argparse.Namespace) -> None:
|
|
1028
1074
|
repo = Path(args.repo).resolve()
|
|
1029
1075
|
ensure_git_repo(repo)
|
|
1030
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 {})
|
|
1031
1080
|
|
|
1032
1081
|
msg = args.msg
|
|
1033
1082
|
|
|
1034
|
-
if args.record_closure and not args.result:
|
|
1035
|
-
raise APError("When using --record-closure, --result is required.")
|
|
1036
|
-
|
|
1037
1083
|
if args.require_runtime_health:
|
|
1038
1084
|
cmd_wait_health(argparse.Namespace(repo=str(repo), scope="runtime"))
|
|
1039
1085
|
|
|
1040
|
-
if args.require_light_gate:
|
|
1086
|
+
if mode in {"dev", "verify"} or args.require_light_gate:
|
|
1041
1087
|
cmd_light_gate(argparse.Namespace(repo=str(repo)))
|
|
1042
1088
|
|
|
1043
1089
|
if args.require_jenkins:
|
|
1044
1090
|
cmd_verify_jenkins(argparse.Namespace(repo=str(repo)))
|
|
1045
1091
|
|
|
1046
|
-
if args.require_matrix:
|
|
1092
|
+
if args.require_matrix and mode != "verify":
|
|
1047
1093
|
cmd_check_matrix(argparse.Namespace(repo=str(repo)))
|
|
1048
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
|
+
|
|
1049
1112
|
run(["git", "add", "-A"], cwd=repo)
|
|
1050
1113
|
diff = run(["git", "diff", "--cached", "--name-only"], cwd=repo).stdout.strip()
|
|
1051
1114
|
if not diff:
|
|
@@ -1053,24 +1116,65 @@ def cmd_commit_push(args: argparse.Namespace) -> None:
|
|
|
1053
1116
|
|
|
1054
1117
|
run(["git", "commit", "-m", msg], cwd=repo)
|
|
1055
1118
|
run(["git", "push"], cwd=repo)
|
|
1056
|
-
|
|
1057
|
-
|
|
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(
|
|
1058
1137
|
argparse.Namespace(
|
|
1059
1138
|
repo=str(repo),
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
target_env=args.target_env,
|
|
1065
|
-
verification=args.verification,
|
|
1066
|
-
result=args.result,
|
|
1067
|
-
follow_up=args.follow_up,
|
|
1068
|
-
initial_commit=args.initial_commit,
|
|
1069
|
-
jenkins_failure=args.jenkins_failure,
|
|
1070
|
-
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,
|
|
1071
1143
|
)
|
|
1072
1144
|
)
|
|
1073
|
-
|
|
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}")
|
|
1074
1178
|
|
|
1075
1179
|
|
|
1076
1180
|
def main(argv: Optional[List[str]] = None) -> int:
|
|
@@ -1144,7 +1248,7 @@ def main(argv: Optional[List[str]] = None) -> int:
|
|
|
1144
1248
|
s.add_argument("--jenkins")
|
|
1145
1249
|
s.add_argument("--target-env")
|
|
1146
1250
|
s.add_argument("--verification", action="append")
|
|
1147
|
-
s.add_argument("--result", choices=["PASS", "FAIL", "PARTIAL"], required=True)
|
|
1251
|
+
s.add_argument("--result", choices=["DEV-CLOSED", "PASS", "FAIL", "PARTIAL"], required=True)
|
|
1148
1252
|
s.add_argument("--follow-up")
|
|
1149
1253
|
s.add_argument("--initial-commit")
|
|
1150
1254
|
s.add_argument("--jenkins-failure")
|
|
@@ -1155,15 +1259,29 @@ def main(argv: Optional[List[str]] = None) -> int:
|
|
|
1155
1259
|
s.add_argument("task_id")
|
|
1156
1260
|
s.add_argument("--title")
|
|
1157
1261
|
s.add_argument("--msg", required=True)
|
|
1262
|
+
s.add_argument("--mode", choices=["dev", "verify"])
|
|
1158
1263
|
s.add_argument("--require-light-gate", action="store_true")
|
|
1159
1264
|
s.add_argument("--require-runtime-health", action="store_true")
|
|
1160
1265
|
s.add_argument("--require-jenkins", action="store_true")
|
|
1161
1266
|
s.add_argument("--require-matrix", action="store_true")
|
|
1162
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")
|
|
1163
1281
|
s.add_argument("--jenkins-build")
|
|
1164
1282
|
s.add_argument("--target-env")
|
|
1165
1283
|
s.add_argument("--verification", action="append")
|
|
1166
|
-
s.add_argument("--result", choices=["PASS", "FAIL", "PARTIAL"])
|
|
1284
|
+
s.add_argument("--result", choices=["DEV-CLOSED", "PASS", "FAIL", "PARTIAL"])
|
|
1167
1285
|
s.add_argument("--follow-up")
|
|
1168
1286
|
s.add_argument("--initial-commit")
|
|
1169
1287
|
s.add_argument("--jenkins-failure")
|
package/cli/src/index.js
CHANGED
|
@@ -55,8 +55,8 @@ function resolveTargetDir(ai, mode, destOverride){
|
|
|
55
55
|
|
|
56
56
|
if (ai === "codex") {
|
|
57
57
|
return mode === "project"
|
|
58
|
-
? path.join(projectRoot(), ".
|
|
59
|
-
: path.join(os.homedir(), ".
|
|
58
|
+
? path.join(projectRoot(), ".agents", "skills", "auto-coding-skill")
|
|
59
|
+
: path.join(os.homedir(), ".agents", "skills", "auto-coding-skill");
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
die(`unknown ai: ${ai}`);
|
package/package.json
CHANGED