@elvis1513/auto-coding-skill 0.1.4 → 0.2.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 +24 -11
- package/cli/assets/skill/SKILL.md +18 -6
- package/cli/assets/skill/data/templates/ENGINEERING.md +36 -11
- package/cli/assets/skill/data/templates/bridges/CLAUDE.md +1 -0
- package/cli/assets/skill/data/templates/bridges/CODEX.md +1 -0
- package/cli/assets/skill/data/templates/docs/deployment/deploy-records/_TEMPLATE-DEPLOY-RECORD.md +17 -3
- package/cli/assets/skill/data/templates/docs/deployment/deploy-runbook.md +17 -10
- package/cli/assets/skill/data/templates/docs/reviews/_TEMPLATE-REVIEW.md +7 -5
- package/cli/assets/skill/data/templates/docs/tasks/summaries/_TEMPLATE-TASK-SUMMARY.md +6 -4
- package/cli/assets/skill/data/templates/docs/tasks/taskbook.md +4 -3
- package/cli/assets/skill/data/templates/docs/testing/regression-matrix.md +2 -2
- package/cli/assets/skill/scripts/ap.py +147 -6
- package/cli/assets/skill/scripts/core.py +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
# auto-coding-skill
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Engineering workflow skill for:
|
|
4
4
|
|
|
5
5
|
- Claude Code
|
|
6
6
|
- Codex CLI
|
|
7
7
|
|
|
8
|
-
This
|
|
8
|
+
This branch is specialized for Go backend + frontend monorepo projects that build Docker images locally, validate with project `docker compose`, and rely on Jenkins to auto-build and update target environments after push.
|
|
9
|
+
It supports both Claude and Codex. During development, it should prefer already available MCP servers, installed skills, plugins, and app connectors for design, research, documentation, verification, and external system updates.
|
|
9
10
|
It should also prefer multi-agent execution whenever the work can be split into parallel subtasks safely.
|
|
10
11
|
|
|
11
12
|
## Install
|
|
@@ -41,7 +42,7 @@ python3 .claude/skills/auto-coding-skill/scripts/ap.py --repo . install
|
|
|
41
42
|
|
|
42
43
|
- `docs/ENGINEERING.md` frontmatter
|
|
43
44
|
|
|
44
|
-
This frontmatter is the only manual config source (commands + local Docker runtime + docs paths).
|
|
45
|
+
This frontmatter is the only manual config source (commands + local Docker runtime + Jenkins + docs paths).
|
|
45
46
|
|
|
46
47
|
4. Start AI development by constraints:
|
|
47
48
|
|
|
@@ -64,6 +65,12 @@ This frontmatter is the only manual config source (commands + local Docker runti
|
|
|
64
65
|
- Split research, design, implementation, validation, and documentation into parallel subtasks whenever the boundaries are clear.
|
|
65
66
|
- Keep one main agent responsible for integration and final gates.
|
|
66
67
|
|
|
68
|
+
7. Delivery rule during execution:
|
|
69
|
+
|
|
70
|
+
- Local `docker compose` validation must pass before commit.
|
|
71
|
+
- `git push` is expected to trigger Jenkins automatically.
|
|
72
|
+
- Task is not complete until Jenkins succeeds and the target environment health check passes.
|
|
73
|
+
|
|
67
74
|
## AGENTS.md Constraint Example
|
|
68
75
|
|
|
69
76
|
```md
|
|
@@ -81,16 +88,16 @@ This frontmatter is the only manual config source (commands + local Docker runti
|
|
|
81
88
|
### 1) docs/ENGINEERING.md
|
|
82
89
|
- Purpose: single source of project config + engineering gate rules.
|
|
83
90
|
- How to record:
|
|
84
|
-
- Fill YAML frontmatter once (project/commands/runtime/docs fields).
|
|
85
|
-
- Keep all local runtime info here only (compose file/service/container/image/health).
|
|
91
|
+
- Fill YAML frontmatter once (project/commands/runtime/jenkins/docs fields).
|
|
92
|
+
- Keep all local runtime and Jenkins info here only (compose file/service/container/image/health/job/env).
|
|
86
93
|
- Do not duplicate config in other docs.
|
|
87
94
|
|
|
88
95
|
### 2) docs/deployment/
|
|
89
96
|
- Files:
|
|
90
|
-
- `docs/deployment/deploy-runbook.md`: local
|
|
91
|
-
- `docs/deployment/deploy-records/<TASK_ID>-YYYYMMDD.md`:
|
|
97
|
+
- `docs/deployment/deploy-runbook.md`: local Compose validation + Jenkins deployment procedure.
|
|
98
|
+
- `docs/deployment/deploy-records/<TASK_ID>-YYYYMMDD.md`: local validation + Jenkins deployment evidence.
|
|
92
99
|
- How to record:
|
|
93
|
-
-
|
|
100
|
+
- Record both local Compose validation and Jenkins deployment evidence: compose file, service, container, image tag, Jenkins build, deploy env, health checks.
|
|
94
101
|
|
|
95
102
|
### 3) docs/design/
|
|
96
103
|
- Files:
|
|
@@ -114,7 +121,7 @@ This frontmatter is the only manual config source (commands + local Docker runti
|
|
|
114
121
|
- Files:
|
|
115
122
|
- `docs/reviews/<TASK_ID>-<timestamp>.md` (from review template).
|
|
116
123
|
- Purpose:
|
|
117
|
-
- Gate review evidence: static checks,
|
|
124
|
+
- Gate review evidence: static checks, Go + frontend quality, local Compose validation, Jenkins readiness, risks.
|
|
118
125
|
- How to record:
|
|
119
126
|
- Record commands used (lint/typecheck from docs/ENGINEERING.md frontmatter) and conclusion (Pass/Blocked).
|
|
120
127
|
|
|
@@ -130,7 +137,7 @@ This frontmatter is the only manual config source (commands + local Docker runti
|
|
|
130
137
|
- Files:
|
|
131
138
|
- `docs/testing/regression-matrix.md`
|
|
132
139
|
- Purpose:
|
|
133
|
-
- Full regression matrix against the local
|
|
140
|
+
- Full regression matrix against the local Compose environment; must be 0 FAIL.
|
|
134
141
|
- How to record:
|
|
135
142
|
- Add/maintain rows by regression ID (R-xxx), area, steps/command, expected, status, evidence.
|
|
136
143
|
- If any FAIL exists, gate fails.
|
|
@@ -142,12 +149,18 @@ pip install pyyaml requests
|
|
|
142
149
|
python3 scripts/autopipeline/ap.py run build
|
|
143
150
|
python3 scripts/autopipeline/ap.py run test
|
|
144
151
|
python3 scripts/autopipeline/ap.py run lint
|
|
152
|
+
python3 scripts/autopipeline/ap.py run docker_build
|
|
153
|
+
python3 scripts/autopipeline/ap.py runtime-up
|
|
154
|
+
python3 scripts/autopipeline/ap.py wait-health
|
|
145
155
|
python3 scripts/autopipeline/ap.py run smoke
|
|
146
156
|
python3 scripts/autopipeline/ap.py run regression
|
|
157
|
+
python3 scripts/autopipeline/ap.py runtime-down
|
|
158
|
+
python3 scripts/autopipeline/ap.py verify-jenkins
|
|
159
|
+
python3 scripts/autopipeline/ap.py wait-health --scope prod
|
|
147
160
|
python3 scripts/autopipeline/ap.py verify-api-docs
|
|
148
161
|
python3 scripts/autopipeline/ap.py check-matrix
|
|
149
162
|
python3 scripts/autopipeline/ap.py gen-summary T0001-1
|
|
150
|
-
python3 scripts/autopipeline/ap.py commit-push T0001-1 --msg "T0001-1: <summary>" --require-matrix
|
|
163
|
+
python3 scripts/autopipeline/ap.py commit-push T0001-1 --msg "T0001-1: <summary>" --require-runtime-health --require-jenkins --require-matrix
|
|
151
164
|
```
|
|
152
165
|
|
|
153
166
|
## Publish (NPM)
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: auto-coding-skill
|
|
3
|
-
description: Use for strict
|
|
3
|
+
description: Use for strict Go fullstack monorepo engineering workflow in Claude/Codex. Initialize docs, fill docs/ENGINEERING.md frontmatter once, then execute design->implement->local-docker-gates->jenkins-trigger->verify.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Auto Coding Skill (Claude + Codex)
|
|
7
7
|
|
|
8
|
-
This skill
|
|
8
|
+
This branch specializes the skill for Go backend + frontend monorepo projects that build Docker images locally and use Jenkins pipelines to auto-deploy after push. It supports both Claude and Codex. During design, research, implementation, verification, and delivery, prefer already available MCP servers, installed skills, plugins, and app connectors over ad-hoc manual work whenever they can complete the task reliably.
|
|
9
9
|
|
|
10
10
|
Default to multi-agent execution when the client supports it. Break work into independent design, research, implementation, validation, and documentation subtasks so Claude/Codex can run them in parallel whenever that reduces cycle time without weakening control of the main task.
|
|
11
11
|
|
|
@@ -28,6 +28,7 @@ Typical examples:
|
|
|
28
28
|
- Documentation/library lookup: prefer official docs and MCP-backed doc tools.
|
|
29
29
|
- Project management or knowledge base updates: prefer Linear/Notion connectors if available.
|
|
30
30
|
- Browser/runtime verification: prefer Playwright/browser tools if available.
|
|
31
|
+
- Pipeline and deployment verification: prefer Jenkins-capable connectors, browser automation, or project-integrated tools if available.
|
|
31
32
|
|
|
32
33
|
## Collaboration policy
|
|
33
34
|
|
|
@@ -69,6 +70,7 @@ Fill only:
|
|
|
69
70
|
This contains all manual fields:
|
|
70
71
|
- `commands.*`
|
|
71
72
|
- `runtime.*`
|
|
73
|
+
- `jenkins.*`
|
|
72
74
|
- `docs.*`
|
|
73
75
|
|
|
74
76
|
Do not duplicate config in other md/yaml files.
|
|
@@ -79,10 +81,12 @@ Do not duplicate config in other md/yaml files.
|
|
|
79
81
|
2) `docs/tasks/taskbook.md`
|
|
80
82
|
3) `docs/design/**`
|
|
81
83
|
4) implementation
|
|
82
|
-
5)
|
|
83
|
-
6) start and validate local Docker runtime
|
|
84
|
+
5) local build/test/lint gates
|
|
85
|
+
6) start and validate local Docker Compose runtime
|
|
84
86
|
7) update API docs + regression matrix + bug list + summary
|
|
85
|
-
8)
|
|
87
|
+
8) verify Jenkins config / Jenkinsfile readiness
|
|
88
|
+
9) commit/push to trigger Jenkins
|
|
89
|
+
10) verify Jenkins pipeline + target environment health
|
|
86
90
|
|
|
87
91
|
## Commands
|
|
88
92
|
|
|
@@ -90,8 +94,16 @@ Do not duplicate config in other md/yaml files.
|
|
|
90
94
|
python3 scripts/autopipeline/ap.py run build
|
|
91
95
|
python3 scripts/autopipeline/ap.py run test
|
|
92
96
|
python3 scripts/autopipeline/ap.py run lint
|
|
97
|
+
python3 scripts/autopipeline/ap.py run docker_build
|
|
98
|
+
python3 scripts/autopipeline/ap.py runtime-up
|
|
99
|
+
python3 scripts/autopipeline/ap.py wait-health
|
|
100
|
+
python3 scripts/autopipeline/ap.py run smoke
|
|
101
|
+
python3 scripts/autopipeline/ap.py run regression
|
|
102
|
+
python3 scripts/autopipeline/ap.py runtime-down
|
|
103
|
+
python3 scripts/autopipeline/ap.py verify-jenkins
|
|
104
|
+
python3 scripts/autopipeline/ap.py wait-health --scope prod
|
|
93
105
|
python3 scripts/autopipeline/ap.py verify-api-docs
|
|
94
106
|
python3 scripts/autopipeline/ap.py check-matrix
|
|
95
107
|
python3 scripts/autopipeline/ap.py gen-summary T0001-1
|
|
96
|
-
python3 scripts/autopipeline/ap.py commit-push T0001-1 --msg "T0001-1: <summary>" --require-matrix
|
|
108
|
+
python3 scripts/autopipeline/ap.py commit-push T0001-1 --msg "T0001-1: <summary>" --require-runtime-health --require-jenkins --require-matrix
|
|
97
109
|
```
|
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
project:
|
|
3
3
|
name: ""
|
|
4
4
|
repo_root: "."
|
|
5
|
+
stack: "go-fullstack-monorepo"
|
|
6
|
+
backend_dir: ""
|
|
7
|
+
frontend_dir: ""
|
|
8
|
+
go_main: ""
|
|
9
|
+
dockerfile: ""
|
|
10
|
+
jenkinsfile: "Jenkinsfile"
|
|
5
11
|
|
|
6
12
|
commands:
|
|
7
13
|
build: ""
|
|
@@ -9,6 +15,9 @@ commands:
|
|
|
9
15
|
lint: ""
|
|
10
16
|
typecheck: ""
|
|
11
17
|
format: ""
|
|
18
|
+
docker_build: ""
|
|
19
|
+
compose_up: ""
|
|
20
|
+
compose_down: ""
|
|
12
21
|
smoke: ""
|
|
13
22
|
regression: ""
|
|
14
23
|
|
|
@@ -21,7 +30,18 @@ runtime:
|
|
|
21
30
|
health_base_url: ""
|
|
22
31
|
health_path: ""
|
|
23
32
|
env_file: ""
|
|
24
|
-
startup_timeout_sec:
|
|
33
|
+
startup_timeout_sec: 120
|
|
34
|
+
|
|
35
|
+
jenkins:
|
|
36
|
+
job_name: ""
|
|
37
|
+
job_url: ""
|
|
38
|
+
trigger_branch: ""
|
|
39
|
+
image_repository: ""
|
|
40
|
+
image_tag_strategy: ""
|
|
41
|
+
deploy_env: ""
|
|
42
|
+
deploy_timeout_sec: 1800
|
|
43
|
+
prod_health_base_url: ""
|
|
44
|
+
prod_health_path: ""
|
|
25
45
|
|
|
26
46
|
docs:
|
|
27
47
|
taskbook: "docs/tasks/taskbook.md"
|
|
@@ -37,17 +57,18 @@ docs:
|
|
|
37
57
|
# docs/ENGINEERING.md — AutoPipeline Gates (Source of Truth)
|
|
38
58
|
|
|
39
59
|
目标:把一次任务固化为不可跳过的流水线:
|
|
40
|
-
读任务 → 写DD → 实现 →
|
|
41
|
-
本地 Docker 启动验证 →
|
|
42
|
-
记录 Bug 并新增自动化回归 → 任务总结落盘 → commit → push
|
|
60
|
+
读任务 → 写DD → 实现 → 本地构建/测试通过 → 静态分析+Review落盘 → 更新 API Markdown+接口变更清单 →
|
|
61
|
+
本地 Docker Compose 启动验证 → 本地健康检查 → 对本地环境全量回归 + 回归矩阵 0 fail →
|
|
62
|
+
记录 Bug 并新增自动化回归 → 任务总结落盘 → commit → push 触发 Jenkins → Jenkins 构建镜像并更新目标环境 →
|
|
63
|
+
生产健康检查通过
|
|
43
64
|
|
|
44
|
-
|
|
65
|
+
规则:任一步骤失败或缺产物,禁止进入下一步;本地 compose 验证未通过禁止 commit;Jenkins 未成功或生产健康检查未通过,任务不视为完成。
|
|
45
66
|
|
|
46
67
|
---
|
|
47
68
|
|
|
48
69
|
## 0. 配置填写(必须)
|
|
49
70
|
|
|
50
|
-
先填写 `docs/ENGINEERING.md` frontmatter 中的所有空值(例如 Docker
|
|
71
|
+
先填写 `docs/ENGINEERING.md` frontmatter 中的所有空值(例如 Go/前端目录、Docker 文件、Compose 服务、Jenkins Job、健康检查地址、命令)。
|
|
51
72
|
禁止在其他 md/yaml 重复维护这些配置。
|
|
52
73
|
|
|
53
74
|
---
|
|
@@ -81,6 +102,7 @@ docs:
|
|
|
81
102
|
- 能用权威工具直接完成时,不重复手写中间数据。
|
|
82
103
|
- 工具不可用、无权限、结果不可靠时,才回退到本地命令或手工处理。
|
|
83
104
|
- 选择工具时优先“已安装且当前项目可直接使用”的能力,而不是重新造流程。
|
|
105
|
+
- 查看 Jenkins、知识库、设计稿、页面、缺陷系统时,优先使用现成的连接器或 MCP,而不是手工拼接上下文。
|
|
84
106
|
|
|
85
107
|
---
|
|
86
108
|
|
|
@@ -102,14 +124,17 @@ docs:
|
|
|
102
124
|
Gate-1 读任务:只从 taskbook 取范围与验收;缺信息先补 taskbook
|
|
103
125
|
Gate-2 写DD:无DD禁止写代码;DD必须含 时序图/ER图/接口时序(Mermaid)
|
|
104
126
|
Gate-3 实现:严格按DD;接口变更必须同步 API Markdown
|
|
105
|
-
Gate-4 本地CI:必须通过(commands.build / commands.test
|
|
127
|
+
Gate-4 本地CI:必须通过(commands.build / commands.test);Go 后端与前端都必须覆盖
|
|
106
128
|
Gate-5 静态分析+Review:静态分析通过;docs/reviews/ 生成记录
|
|
107
129
|
Gate-6 文档:更新 api.md + 追加 api-change-log.md
|
|
108
|
-
Gate-7
|
|
130
|
+
Gate-7 本地运行:必须用项目 Compose 启动本地 Docker 环境;失败先修复再继续
|
|
109
131
|
Gate-8 健康检查:本地容器启动后必须健康检查通过
|
|
110
|
-
Gate-9 全量回归:按 API Markdown
|
|
111
|
-
Gate-10
|
|
112
|
-
Gate-11
|
|
132
|
+
Gate-9 全量回归:按 API Markdown 对本地 Compose 环境全量回归;回归矩阵全量 PASS(0 fail);发现问题必须写 bug-list 并新增自动化回归用例
|
|
133
|
+
Gate-10 Jenkins 准备:Jenkinsfile、Job 配置、镜像仓库策略必须可用
|
|
134
|
+
Gate-11 任务总结:必须生成 docs/tasks/summaries/<TASK_ID>.md
|
|
135
|
+
Gate-12 提交触发:本地门禁全过后才允许 commit+push
|
|
136
|
+
Gate-13 流水线验证:push 后必须确认 Jenkins 自动构建、镜像发布、目标环境更新成功
|
|
137
|
+
Gate-14 完成:生产健康检查通过并补齐部署记录后,任务才完成
|
|
113
138
|
|
|
114
139
|
---
|
|
115
140
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
Follow docs/ENGINEERING.md strictly. Source of truth: docs/ENGINEERING.md.
|
|
2
2
|
Prefer already available MCP servers, installed skills, plugins, and app connectors during design, research, verification, and documentation workflows.
|
|
3
3
|
Prefer multi-agent mode whenever the task can be split into independent parallel subtasks without weakening integration control.
|
|
4
|
+
For Go monorepo + Jenkins projects, local Docker Compose validation must pass before commit, and push is expected to trigger Jenkins pipeline verification.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
Follow docs/ENGINEERING.md strictly. Source of truth: docs/ENGINEERING.md.
|
|
2
2
|
Prefer already available MCP servers, installed skills, plugins, and app connectors during design, research, verification, and documentation workflows.
|
|
3
3
|
Prefer multi-agent mode whenever the task can be split into independent parallel subtasks without weakening integration control.
|
|
4
|
+
For Go monorepo + Jenkins projects, local Docker Compose validation must pass before commit, and push is expected to trigger Jenkins pipeline verification.
|
package/cli/assets/skill/data/templates/docs/deployment/deploy-records/_TEMPLATE-DEPLOY-RECORD.md
CHANGED
|
@@ -1,14 +1,28 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Deploy Record — <Task ID> — YYYY-MM-DD
|
|
2
2
|
|
|
3
|
+
## 1. Local Compose Validation
|
|
3
4
|
- Docker compose file:
|
|
4
5
|
- Docker service:
|
|
5
6
|
- Container name:
|
|
6
7
|
- Image/tag:
|
|
7
8
|
- Exposed port:
|
|
8
9
|
- Env file:
|
|
10
|
+
- Local health URL:
|
|
9
11
|
|
|
10
|
-
##
|
|
12
|
+
## 2. Jenkins Pipeline
|
|
13
|
+
- Jenkins job name:
|
|
14
|
+
- Jenkins build number:
|
|
15
|
+
- Jenkins build URL:
|
|
16
|
+
- Trigger branch:
|
|
17
|
+
- Trigger commit:
|
|
18
|
+
- Image repository:
|
|
19
|
+
- Published image tag:
|
|
20
|
+
- Deploy environment:
|
|
21
|
+
|
|
22
|
+
## 3. Evidence
|
|
11
23
|
- docker ps / compose ps:
|
|
24
|
+
- local_health_check:
|
|
12
25
|
- smoke_test:
|
|
13
26
|
- api_regression:
|
|
14
|
-
-
|
|
27
|
+
- jenkins_result:
|
|
28
|
+
- production_health_check:
|
|
@@ -1,12 +1,19 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Deployment Runbook(本地 Compose 验证 + Jenkins 自动部署)
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
- runtime
|
|
5
|
-
-
|
|
6
|
-
- runtime.health_base_url / runtime.health_path
|
|
7
|
-
- runtime.env_file / runtime.startup_timeout_sec
|
|
3
|
+
统一读取:`docs/ENGINEERING.md` frontmatter
|
|
4
|
+
- `runtime.*`:本地 Compose 启动与健康检查
|
|
5
|
+
- `jenkins.*`:Jenkins Job、镜像仓库、目标环境、生产健康检查
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
执行顺序:
|
|
8
|
+
1. 本地构建、测试、lint、typecheck 通过
|
|
9
|
+
2. 本地 `docker compose` 启动目标服务
|
|
10
|
+
3. 本地 health / smoke / regression 全部通过
|
|
11
|
+
4. `commit + push`
|
|
12
|
+
5. Jenkins 自动触发,完成镜像构建、镜像推送、目标环境更新
|
|
13
|
+
6. 检查 Jenkins 结果与目标环境健康状态
|
|
14
|
+
|
|
15
|
+
完成条件:
|
|
16
|
+
- 本地 Compose 验证通过
|
|
17
|
+
- Jenkins Pipeline 成功
|
|
18
|
+
- 目标环境健康检查通过
|
|
19
|
+
- `docs/deployment/deploy-records/<TASK_ID>-YYYYMMDD.md` 证据补齐
|
|
@@ -7,8 +7,10 @@
|
|
|
7
7
|
- Resolved/Deferred(deferred 必须给出后续任务):
|
|
8
8
|
|
|
9
9
|
## 2. 代码质量
|
|
10
|
-
## 3.
|
|
11
|
-
## 4.
|
|
12
|
-
## 5.
|
|
13
|
-
## 6.
|
|
14
|
-
## 7.
|
|
10
|
+
## 3. 本地构建与测试质量(Go 后端 + 前端)
|
|
11
|
+
## 4. 本地 Compose 验证(health / smoke / regression)
|
|
12
|
+
## 5. 接口契约(API Markdown + change-log)
|
|
13
|
+
## 6. Jenkins 准备度(Jenkinsfile / job config / image strategy)
|
|
14
|
+
## 7. 安全与性能
|
|
15
|
+
## 8. 风险与回滚
|
|
16
|
+
## 9. 结论(Pass / Blocked)
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
- 目标:
|
|
12
12
|
- 验收结论:PASS / FAIL(FAIL 必须说明原因与后续计划)
|
|
13
13
|
|
|
14
|
-
## 2.
|
|
14
|
+
## 2. 变更概览(代码/配置/本地运行/Jenkins)
|
|
15
15
|
- 关键改动点:
|
|
16
16
|
- 影响模块:
|
|
17
17
|
- 兼容性影响(是否破坏兼容、迁移方案):
|
|
@@ -33,15 +33,17 @@
|
|
|
33
33
|
- 静态分析:`static`
|
|
34
34
|
- Review 文档:`docs/reviews/<TASK_ID>-<timestamp>.md`
|
|
35
35
|
- API 文档:`docs/interfaces/api.md`
|
|
36
|
+
- Jenkins 配置检查:`Jenkinsfile` + `jenkins.*`
|
|
36
37
|
- 回归矩阵:`docs/testing/regression-matrix.md`(全量 PASS,0 fail)
|
|
37
38
|
|
|
38
39
|
## 6. Bug 清单与回归用例
|
|
39
40
|
- 新增/确认的 Bug(写入 `docs/bugs/bug-list.md`):
|
|
40
41
|
- 新增自动化回归用例(引用回归矩阵ID):
|
|
41
42
|
|
|
42
|
-
## 7.
|
|
43
|
-
-
|
|
44
|
-
-
|
|
43
|
+
## 7. 本地运行与 Jenkins 部署记录
|
|
44
|
+
- 本地 Compose 验证:health / smoke / regression 结果
|
|
45
|
+
- Jenkins 部署记录:`docs/deployment/deploy-records/<TASK_ID>-YYYYMMDD.md`
|
|
46
|
+
- Docker compose / image / Jenkins Job 变更(若有):
|
|
45
47
|
|
|
46
48
|
## 8. 风险与回滚
|
|
47
49
|
- 风险:
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
规则:
|
|
4
4
|
1) 所有任务都写在本文件(持续续写,不另起任务文件)
|
|
5
|
-
2) 允许拆子任务:每个子任务也必须走全流程(DD→实现→测试→review→接口文档→本地
|
|
5
|
+
2) 允许拆子任务:每个子任务也必须走全流程(DD→实现→测试→review→接口文档→本地 Compose 验证→回归→总结→commit→push→Jenkins 验证)
|
|
6
6
|
3) 每个任务必须有明确验收与证据(日志/报告/文件路径)
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
## Task T0001 — <Title>
|
|
11
|
-
- 状态:Planned | Designing | Implementing | Testing | Reviewing | Runtime Verifying | Done
|
|
11
|
+
- 状态:Planned | Designing | Implementing | Testing | Reviewing | Runtime Verifying | Pipeline Verifying | Done
|
|
12
12
|
- 范围(In scope):
|
|
13
13
|
- 非目标(Out of scope):
|
|
14
14
|
- 验收标准(必须可执行):
|
|
@@ -24,7 +24,8 @@
|
|
|
24
24
|
- API 文档:`docs/interfaces/api.md`
|
|
25
25
|
- API Change Log:`docs/interfaces/api-change-log.md`
|
|
26
26
|
- 本地CI:粘贴摘要或给出文件路径
|
|
27
|
-
-
|
|
27
|
+
- 本地 Compose 验证:命令输出或 Review 文档摘要
|
|
28
|
+
- Jenkins 部署记录:`docs/deployment/deploy-records/T0001-YYYYMMDD.md`
|
|
28
29
|
- 回归矩阵:`docs/testing/regression-matrix.md`(全量PASS)
|
|
29
30
|
- Bug清单(如有):`docs/bugs/bug-list.md`
|
|
30
31
|
- 任务总结(强制):`docs/tasks/summaries/T0001.md`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
# Regression Matrix
|
|
1
|
+
# Regression Matrix(本地 Compose 环境回归矩阵:必须全量 PASS,0 fail)
|
|
2
2
|
|
|
3
3
|
| ID | Area | Endpoint/Feature | Test Type | Steps / Command | Expected | Status(PASS/FAIL) | Evidence |
|
|
4
4
|
|---|---|---|---|---|---|---|---|
|
|
5
|
-
| R-001 | API | GET /health | smoke | commands.smoke | local 200 OK | PASS | <paste log path> |
|
|
5
|
+
| R-001 | API | GET /health | smoke | commands.smoke | local compose 200 OK | PASS | <paste log path> |
|
|
@@ -6,16 +6,49 @@ from __future__ import annotations
|
|
|
6
6
|
|
|
7
7
|
import argparse
|
|
8
8
|
import datetime as _dt
|
|
9
|
+
import time
|
|
9
10
|
from pathlib import Path
|
|
10
11
|
from typing import Optional, List
|
|
11
12
|
|
|
12
|
-
from core import APError, ensure_git_repo, copy_tree, run, load_yaml, find_config, run_shell
|
|
13
|
+
from core import APError, ensure_git_repo, copy_tree, run, load_yaml, find_config, run_shell, http_get_status
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
def _skill_root() -> Path:
|
|
16
17
|
return Path(__file__).resolve().parent.parent
|
|
17
18
|
|
|
18
19
|
|
|
20
|
+
def _compose_base_args(runtime_cfg: dict) -> List[str]:
|
|
21
|
+
args = ["docker", "compose"]
|
|
22
|
+
compose_file = str(runtime_cfg.get("docker_compose_file") or "").strip()
|
|
23
|
+
env_file = str(runtime_cfg.get("env_file") or "").strip()
|
|
24
|
+
if compose_file:
|
|
25
|
+
args.extend(["-f", compose_file])
|
|
26
|
+
if env_file:
|
|
27
|
+
args.extend(["--env-file", env_file])
|
|
28
|
+
return args
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def _join_url(base: str, path: str) -> str:
|
|
32
|
+
base = str(base or "").strip().rstrip("/")
|
|
33
|
+
path = str(path or "").strip()
|
|
34
|
+
if not base or not path:
|
|
35
|
+
raise APError("Health URL config incomplete. Fill base url and path in docs/ENGINEERING.md.")
|
|
36
|
+
if not path.startswith("/"):
|
|
37
|
+
path = "/" + path
|
|
38
|
+
return base + path
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def _run_configured_command(repo: Path, cfg: dict, name: str) -> bool:
|
|
42
|
+
commands = (cfg.get("commands") or {})
|
|
43
|
+
command = str(commands.get(name) or "").strip()
|
|
44
|
+
if not command:
|
|
45
|
+
return False
|
|
46
|
+
print(f"[run] {name}: {command}")
|
|
47
|
+
run_shell(command, cwd=repo)
|
|
48
|
+
print(f"[run] OK: {name}")
|
|
49
|
+
return True
|
|
50
|
+
|
|
51
|
+
|
|
19
52
|
def cmd_install(args: argparse.Namespace) -> None:
|
|
20
53
|
repo = Path(args.repo).resolve()
|
|
21
54
|
templates = _skill_root() / "data" / "templates"
|
|
@@ -41,7 +74,7 @@ def cmd_install(args: argparse.Namespace) -> None:
|
|
|
41
74
|
gi.write_text(secret_line + "\n", encoding="utf-8")
|
|
42
75
|
|
|
43
76
|
print(f"[install] OK: scaffold installed into {repo}")
|
|
44
|
-
print("[install] Next: edit docs/ENGINEERING.md frontmatter and fill
|
|
77
|
+
print("[install] Next: edit docs/ENGINEERING.md frontmatter and fill project/runtime/jenkins fields")
|
|
45
78
|
|
|
46
79
|
|
|
47
80
|
def _infer_title(taskbook: Path, task_id: str) -> str:
|
|
@@ -92,7 +125,7 @@ def cmd_gen_summary(args: argparse.Namespace) -> None:
|
|
|
92
125
|
- 目标:TODO
|
|
93
126
|
- 验收结论:PASS / FAIL — TODO
|
|
94
127
|
|
|
95
|
-
## 2.
|
|
128
|
+
## 2. 变更概览(代码/配置/本地运行/Jenkins)
|
|
96
129
|
### Git change snapshot
|
|
97
130
|
- Staged files:
|
|
98
131
|
{('- ' + staged.replace('\n','\n- ')) if staged else '- (none)'}
|
|
@@ -111,7 +144,12 @@ def cmd_gen_summary(args: argparse.Namespace) -> None:
|
|
|
111
144
|
- 静态分析:TODO
|
|
112
145
|
- Review 文档:TODO
|
|
113
146
|
- DD 文档:TODO
|
|
147
|
+
- Jenkins 准备:TODO
|
|
114
148
|
- 回归矩阵:`{regression_matrix}`(全量 PASS,0 fail)
|
|
149
|
+
|
|
150
|
+
## 6. 本地运行与 Jenkins 部署记录
|
|
151
|
+
- Local compose:TODO
|
|
152
|
+
- Jenkins build / deploy:TODO
|
|
115
153
|
"""
|
|
116
154
|
|
|
117
155
|
out_file.write_text(content, encoding="utf-8")
|
|
@@ -162,8 +200,7 @@ def _load_cfg(repo: Path) -> dict:
|
|
|
162
200
|
|
|
163
201
|
def cmd_run(args: argparse.Namespace) -> None:
|
|
164
202
|
"""
|
|
165
|
-
Run
|
|
166
|
-
build | test | lint | typecheck | format | smoke | regression
|
|
203
|
+
Run any configured gate command by name.
|
|
167
204
|
Commands are read from docs/ENGINEERING.md frontmatter.
|
|
168
205
|
"""
|
|
169
206
|
repo = Path(args.repo).resolve()
|
|
@@ -182,6 +219,89 @@ def cmd_run(args: argparse.Namespace) -> None:
|
|
|
182
219
|
print(f"[run] OK: {name}")
|
|
183
220
|
|
|
184
221
|
|
|
222
|
+
def cmd_runtime_up(args: argparse.Namespace) -> None:
|
|
223
|
+
repo = Path(args.repo).resolve()
|
|
224
|
+
cfg = _load_cfg(repo)
|
|
225
|
+
runtime_cfg = (cfg.get("runtime") or {})
|
|
226
|
+
if _run_configured_command(repo, cfg, "compose_up"):
|
|
227
|
+
return
|
|
228
|
+
compose_args = _compose_base_args(runtime_cfg) + ["up", "-d"]
|
|
229
|
+
docker_service = str(runtime_cfg.get("docker_service") or "").strip()
|
|
230
|
+
if docker_service:
|
|
231
|
+
compose_args.append(docker_service)
|
|
232
|
+
print(f"[runtime-up] {' '.join(compose_args)}")
|
|
233
|
+
run(compose_args, cwd=repo)
|
|
234
|
+
print("[runtime-up] OK")
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
def cmd_runtime_down(args: argparse.Namespace) -> None:
|
|
238
|
+
repo = Path(args.repo).resolve()
|
|
239
|
+
cfg = _load_cfg(repo)
|
|
240
|
+
runtime_cfg = (cfg.get("runtime") or {})
|
|
241
|
+
if _run_configured_command(repo, cfg, "compose_down"):
|
|
242
|
+
return
|
|
243
|
+
compose_args = _compose_base_args(runtime_cfg) + ["down", "--remove-orphans"]
|
|
244
|
+
print(f"[runtime-down] {' '.join(compose_args)}")
|
|
245
|
+
run(compose_args, cwd=repo)
|
|
246
|
+
print("[runtime-down] OK")
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
def cmd_wait_health(args: argparse.Namespace) -> None:
|
|
250
|
+
repo = Path(args.repo).resolve()
|
|
251
|
+
cfg = _load_cfg(repo)
|
|
252
|
+
scope = args.scope
|
|
253
|
+
if scope == "runtime":
|
|
254
|
+
runtime_cfg = (cfg.get("runtime") or {})
|
|
255
|
+
url = _join_url(str(runtime_cfg.get("health_base_url") or ""), str(runtime_cfg.get("health_path") or ""))
|
|
256
|
+
timeout_s = int(runtime_cfg.get("startup_timeout_sec") or 120)
|
|
257
|
+
else:
|
|
258
|
+
jenkins_cfg = (cfg.get("jenkins") or {})
|
|
259
|
+
url = _join_url(
|
|
260
|
+
str(jenkins_cfg.get("prod_health_base_url") or ""),
|
|
261
|
+
str(jenkins_cfg.get("prod_health_path") or "")
|
|
262
|
+
)
|
|
263
|
+
timeout_s = int(jenkins_cfg.get("deploy_timeout_sec") or 1800)
|
|
264
|
+
|
|
265
|
+
deadline = time.time() + timeout_s
|
|
266
|
+
last_error = "(none)"
|
|
267
|
+
while time.time() < deadline:
|
|
268
|
+
try:
|
|
269
|
+
status = http_get_status(url, timeout_s=5)
|
|
270
|
+
last_error = f"HTTP {status}"
|
|
271
|
+
if 200 <= status < 400:
|
|
272
|
+
print(f"[wait-health] OK: {scope} {url} -> {status}")
|
|
273
|
+
return
|
|
274
|
+
except Exception as exc: # pragma: no cover - depends on runtime env
|
|
275
|
+
last_error = str(exc)
|
|
276
|
+
time.sleep(2)
|
|
277
|
+
raise APError(f"Health check timeout for {scope}: {url}\nLast result: {last_error}")
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
def cmd_verify_jenkins(args: argparse.Namespace) -> None:
|
|
281
|
+
repo = Path(args.repo).resolve()
|
|
282
|
+
cfg = _load_cfg(repo)
|
|
283
|
+
project_cfg = (cfg.get("project") or {})
|
|
284
|
+
jenkins_cfg = (cfg.get("jenkins") or {})
|
|
285
|
+
jenkinsfile = Path(repo, str(project_cfg.get("jenkinsfile") or "Jenkinsfile"))
|
|
286
|
+
if not jenkinsfile.exists():
|
|
287
|
+
raise APError(f"Jenkinsfile not found: {jenkinsfile}")
|
|
288
|
+
|
|
289
|
+
required = [
|
|
290
|
+
("jenkins.job_name", jenkins_cfg.get("job_name")),
|
|
291
|
+
("jenkins.job_url", jenkins_cfg.get("job_url")),
|
|
292
|
+
("jenkins.trigger_branch", jenkins_cfg.get("trigger_branch")),
|
|
293
|
+
("jenkins.image_repository", jenkins_cfg.get("image_repository")),
|
|
294
|
+
("jenkins.image_tag_strategy", jenkins_cfg.get("image_tag_strategy")),
|
|
295
|
+
("jenkins.deploy_env", jenkins_cfg.get("deploy_env")),
|
|
296
|
+
("jenkins.prod_health_base_url", jenkins_cfg.get("prod_health_base_url")),
|
|
297
|
+
("jenkins.prod_health_path", jenkins_cfg.get("prod_health_path")),
|
|
298
|
+
]
|
|
299
|
+
missing = [name for name, value in required if not str(value or "").strip()]
|
|
300
|
+
if missing:
|
|
301
|
+
raise APError("Missing Jenkins config: " + ", ".join(missing))
|
|
302
|
+
print(f"[verify-jenkins] OK: {jenkinsfile}")
|
|
303
|
+
|
|
304
|
+
|
|
185
305
|
def cmd_verify_api_docs(args: argparse.Namespace) -> None:
|
|
186
306
|
"""Ensure API markdown doc and change-log exist."""
|
|
187
307
|
repo = Path(args.repo).resolve()
|
|
@@ -212,6 +332,12 @@ def cmd_commit_push(args: argparse.Namespace) -> None:
|
|
|
212
332
|
f"Generate: python3 scripts/autopipeline/ap.py gen-summary {task_id}"
|
|
213
333
|
)
|
|
214
334
|
|
|
335
|
+
if args.require_runtime_health:
|
|
336
|
+
cmd_wait_health(argparse.Namespace(repo=str(repo), scope="runtime"))
|
|
337
|
+
|
|
338
|
+
if args.require_jenkins:
|
|
339
|
+
cmd_verify_jenkins(argparse.Namespace(repo=str(repo)))
|
|
340
|
+
|
|
215
341
|
if args.require_matrix:
|
|
216
342
|
cmd_check_matrix(argparse.Namespace(repo=str(repo)))
|
|
217
343
|
|
|
@@ -222,7 +348,7 @@ def cmd_commit_push(args: argparse.Namespace) -> None:
|
|
|
222
348
|
|
|
223
349
|
run(["git", "commit", "-m", msg], cwd=repo)
|
|
224
350
|
run(["git", "push"], cwd=repo)
|
|
225
|
-
print("[commit-push] OK")
|
|
351
|
+
print("[commit-push] OK - push completed, Jenkins should auto-trigger")
|
|
226
352
|
|
|
227
353
|
|
|
228
354
|
def main(argv: Optional[List[str]] = None) -> int:
|
|
@@ -246,12 +372,27 @@ def main(argv: Optional[List[str]] = None) -> int:
|
|
|
246
372
|
s.add_argument("name")
|
|
247
373
|
s.set_defaults(func=cmd_run)
|
|
248
374
|
|
|
375
|
+
s = sp.add_parser("runtime-up")
|
|
376
|
+
s.set_defaults(func=cmd_runtime_up)
|
|
377
|
+
|
|
378
|
+
s = sp.add_parser("runtime-down")
|
|
379
|
+
s.set_defaults(func=cmd_runtime_down)
|
|
380
|
+
|
|
381
|
+
s = sp.add_parser("wait-health")
|
|
382
|
+
s.add_argument("--scope", choices=["runtime", "prod"], default="runtime")
|
|
383
|
+
s.set_defaults(func=cmd_wait_health)
|
|
384
|
+
|
|
385
|
+
s = sp.add_parser("verify-jenkins")
|
|
386
|
+
s.set_defaults(func=cmd_verify_jenkins)
|
|
387
|
+
|
|
249
388
|
s = sp.add_parser("verify-api-docs")
|
|
250
389
|
s.set_defaults(func=cmd_verify_api_docs)
|
|
251
390
|
|
|
252
391
|
s = sp.add_parser("commit-push")
|
|
253
392
|
s.add_argument("task_id")
|
|
254
393
|
s.add_argument("--msg", required=True)
|
|
394
|
+
s.add_argument("--require-runtime-health", action="store_true")
|
|
395
|
+
s.add_argument("--require-jenkins", action="store_true")
|
|
255
396
|
s.add_argument("--require-matrix", action="store_true")
|
|
256
397
|
s.set_defaults(func=cmd_commit_push)
|
|
257
398
|
|
|
@@ -104,7 +104,7 @@ def find_config(repo: Path) -> Path:
|
|
|
104
104
|
return c
|
|
105
105
|
raise APError(
|
|
106
106
|
"Project config not found. Create docs/ENGINEERING.md "
|
|
107
|
-
"and put commands + runtime fields in YAML frontmatter."
|
|
107
|
+
"and put commands + runtime + jenkins fields in YAML frontmatter."
|
|
108
108
|
)
|
|
109
109
|
|
|
110
110
|
|