@elvis1513/auto-coding-skill 0.1.3 → 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 +39 -10
- package/cli/assets/skill/SKILL.md +47 -6
- package/cli/assets/skill/data/templates/ENGINEERING.md +74 -22
- package/cli/assets/skill/data/templates/bridges/CLAUDE.md +3 -0
- package/cli/assets/skill/data/templates/bridges/CODEX.md +3 -0
- package/cli/assets/skill/data/templates/docs/deployment/deploy-records/_TEMPLATE-DEPLOY-RECORD.md +23 -8
- 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 +3 -2
package/README.md
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
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 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.
|
|
10
|
+
It should also prefer multi-agent execution whenever the work can be split into parallel subtasks safely.
|
|
11
|
+
|
|
8
12
|
## Install
|
|
9
13
|
|
|
10
14
|
```bash
|
|
@@ -38,7 +42,7 @@ python3 .claude/skills/auto-coding-skill/scripts/ap.py --repo . install
|
|
|
38
42
|
|
|
39
43
|
- `docs/ENGINEERING.md` frontmatter
|
|
40
44
|
|
|
41
|
-
This frontmatter is the only manual config source (commands +
|
|
45
|
+
This frontmatter is the only manual config source (commands + local Docker runtime + Jenkins + docs paths).
|
|
42
46
|
|
|
43
47
|
4. Start AI development by constraints:
|
|
44
48
|
|
|
@@ -50,6 +54,23 @@ This frontmatter is the only manual config source (commands + deployment + docs
|
|
|
50
54
|
- `docs/bugs/bug-list.md`
|
|
51
55
|
- `docs/tasks/summaries/**`
|
|
52
56
|
|
|
57
|
+
5. Tool selection rule during execution:
|
|
58
|
+
|
|
59
|
+
- Prefer current MCP/skills/plugins/apps first.
|
|
60
|
+
- Fall back to shell/manual work only when those capabilities are unavailable or insufficient.
|
|
61
|
+
|
|
62
|
+
6. Collaboration rule during execution:
|
|
63
|
+
|
|
64
|
+
- Prefer multi-agent mode.
|
|
65
|
+
- Split research, design, implementation, validation, and documentation into parallel subtasks whenever the boundaries are clear.
|
|
66
|
+
- Keep one main agent responsible for integration and final gates.
|
|
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
|
+
|
|
53
74
|
## AGENTS.md Constraint Example
|
|
54
75
|
|
|
55
76
|
```md
|
|
@@ -67,16 +88,16 @@ This frontmatter is the only manual config source (commands + deployment + docs
|
|
|
67
88
|
### 1) docs/ENGINEERING.md
|
|
68
89
|
- Purpose: single source of project config + engineering gate rules.
|
|
69
90
|
- How to record:
|
|
70
|
-
- Fill YAML frontmatter once (project/commands/
|
|
71
|
-
- Keep all
|
|
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).
|
|
72
93
|
- Do not duplicate config in other docs.
|
|
73
94
|
|
|
74
95
|
### 2) docs/deployment/
|
|
75
96
|
- Files:
|
|
76
|
-
- `docs/deployment/deploy-runbook.md`:
|
|
77
|
-
- `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.
|
|
78
99
|
- How to record:
|
|
79
|
-
-
|
|
100
|
+
- Record both local Compose validation and Jenkins deployment evidence: compose file, service, container, image tag, Jenkins build, deploy env, health checks.
|
|
80
101
|
|
|
81
102
|
### 3) docs/design/
|
|
82
103
|
- Files:
|
|
@@ -100,7 +121,7 @@ This frontmatter is the only manual config source (commands + deployment + docs
|
|
|
100
121
|
- Files:
|
|
101
122
|
- `docs/reviews/<TASK_ID>-<timestamp>.md` (from review template).
|
|
102
123
|
- Purpose:
|
|
103
|
-
- Gate review evidence: static checks,
|
|
124
|
+
- Gate review evidence: static checks, Go + frontend quality, local Compose validation, Jenkins readiness, risks.
|
|
104
125
|
- How to record:
|
|
105
126
|
- Record commands used (lint/typecheck from docs/ENGINEERING.md frontmatter) and conclusion (Pass/Blocked).
|
|
106
127
|
|
|
@@ -116,7 +137,7 @@ This frontmatter is the only manual config source (commands + deployment + docs
|
|
|
116
137
|
- Files:
|
|
117
138
|
- `docs/testing/regression-matrix.md`
|
|
118
139
|
- Purpose:
|
|
119
|
-
- Full regression matrix; must be 0 FAIL.
|
|
140
|
+
- Full regression matrix against the local Compose environment; must be 0 FAIL.
|
|
120
141
|
- How to record:
|
|
121
142
|
- Add/maintain rows by regression ID (R-xxx), area, steps/command, expected, status, evidence.
|
|
122
143
|
- If any FAIL exists, gate fails.
|
|
@@ -128,10 +149,18 @@ pip install pyyaml requests
|
|
|
128
149
|
python3 scripts/autopipeline/ap.py run build
|
|
129
150
|
python3 scripts/autopipeline/ap.py run test
|
|
130
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
|
|
155
|
+
python3 scripts/autopipeline/ap.py run smoke
|
|
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
|
|
131
160
|
python3 scripts/autopipeline/ap.py verify-api-docs
|
|
132
161
|
python3 scripts/autopipeline/ap.py check-matrix
|
|
133
162
|
python3 scripts/autopipeline/ap.py gen-summary T0001-1
|
|
134
|
-
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
|
|
135
164
|
```
|
|
136
165
|
|
|
137
166
|
## Publish (NPM)
|
|
@@ -1,15 +1,44 @@
|
|
|
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 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
|
+
|
|
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
|
+
|
|
8
12
|
## Supported clients
|
|
9
13
|
|
|
10
14
|
- Claude Code
|
|
11
15
|
- Codex CLI
|
|
12
16
|
|
|
17
|
+
## Tooling policy
|
|
18
|
+
|
|
19
|
+
Use available platform capabilities first:
|
|
20
|
+
|
|
21
|
+
1) Prefer installed MCP servers for design context, documentation lookup, browser automation, issue/docs systems, and deployment/runtime inspection.
|
|
22
|
+
2) Prefer already installed local skills when the task matches them.
|
|
23
|
+
3) Prefer supported plugins/apps/connectors when they provide authoritative project context or can write back records.
|
|
24
|
+
4) Fall back to manual shell/code workflows only when the above are unavailable, insufficient, or slower than direct execution.
|
|
25
|
+
|
|
26
|
+
Typical examples:
|
|
27
|
+
- Design/UI work: prefer Figma MCP and related design skills.
|
|
28
|
+
- Documentation/library lookup: prefer official docs and MCP-backed doc tools.
|
|
29
|
+
- Project management or knowledge base updates: prefer Linear/Notion connectors if available.
|
|
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.
|
|
32
|
+
|
|
33
|
+
## Collaboration policy
|
|
34
|
+
|
|
35
|
+
Prefer multi-agent mode across the workflow:
|
|
36
|
+
|
|
37
|
+
1) Split independent subtasks early when they can run in parallel.
|
|
38
|
+
2) Keep the main agent on the critical path: task framing, design decisions, integration, and final quality gates.
|
|
39
|
+
3) Use side agents for bounded work such as research, code slices, documentation updates, regression checks, or review passes.
|
|
40
|
+
4) Do not delegate a blocking architectural decision without keeping one agent responsible for final integration and correctness.
|
|
41
|
+
|
|
13
42
|
## Entry
|
|
14
43
|
|
|
15
44
|
1) Install skill files into target repo:
|
|
@@ -40,7 +69,8 @@ Fill only:
|
|
|
40
69
|
|
|
41
70
|
This contains all manual fields:
|
|
42
71
|
- `commands.*`
|
|
43
|
-
- `
|
|
72
|
+
- `runtime.*`
|
|
73
|
+
- `jenkins.*`
|
|
44
74
|
- `docs.*`
|
|
45
75
|
|
|
46
76
|
Do not duplicate config in other md/yaml files.
|
|
@@ -51,9 +81,12 @@ Do not duplicate config in other md/yaml files.
|
|
|
51
81
|
2) `docs/tasks/taskbook.md`
|
|
52
82
|
3) `docs/design/**`
|
|
53
83
|
4) implementation
|
|
54
|
-
5)
|
|
55
|
-
6)
|
|
56
|
-
7)
|
|
84
|
+
5) local build/test/lint gates
|
|
85
|
+
6) start and validate local Docker Compose runtime
|
|
86
|
+
7) update API docs + regression matrix + bug list + summary
|
|
87
|
+
8) verify Jenkins config / Jenkinsfile readiness
|
|
88
|
+
9) commit/push to trigger Jenkins
|
|
89
|
+
10) verify Jenkins pipeline + target environment health
|
|
57
90
|
|
|
58
91
|
## Commands
|
|
59
92
|
|
|
@@ -61,8 +94,16 @@ Do not duplicate config in other md/yaml files.
|
|
|
61
94
|
python3 scripts/autopipeline/ap.py run build
|
|
62
95
|
python3 scripts/autopipeline/ap.py run test
|
|
63
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
|
|
64
105
|
python3 scripts/autopipeline/ap.py verify-api-docs
|
|
65
106
|
python3 scripts/autopipeline/ap.py check-matrix
|
|
66
107
|
python3 scripts/autopipeline/ap.py gen-summary T0001-1
|
|
67
|
-
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
|
|
68
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,22 +15,33 @@ 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
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
systemd_dir: "/usr/lib/systemd/system"
|
|
22
|
-
remote_app_root: ""
|
|
23
|
-
remote_jar_path: ""
|
|
24
|
-
remote_config_dir: ""
|
|
25
|
-
remote_bin_dir: ""
|
|
24
|
+
runtime:
|
|
25
|
+
docker_compose_file: ""
|
|
26
|
+
docker_service: ""
|
|
27
|
+
container_name: ""
|
|
28
|
+
image: ""
|
|
29
|
+
app_port: ""
|
|
26
30
|
health_base_url: ""
|
|
27
31
|
health_path: ""
|
|
32
|
+
env_file: ""
|
|
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: ""
|
|
28
45
|
|
|
29
46
|
docs:
|
|
30
47
|
taskbook: "docs/tasks/taskbook.md"
|
|
@@ -40,17 +57,18 @@ docs:
|
|
|
40
57
|
# docs/ENGINEERING.md — AutoPipeline Gates (Source of Truth)
|
|
41
58
|
|
|
42
59
|
目标:把一次任务固化为不可跳过的流水线:
|
|
43
|
-
读任务 → 写DD → 实现 →
|
|
44
|
-
|
|
45
|
-
记录Bug并新增自动化回归 → 任务总结落盘 → commit → push
|
|
60
|
+
读任务 → 写DD → 实现 → 本地构建/测试通过 → 静态分析+Review落盘 → 更新 API Markdown+接口变更清单 →
|
|
61
|
+
本地 Docker Compose 启动验证 → 本地健康检查 → 对本地环境全量回归 + 回归矩阵 0 fail →
|
|
62
|
+
记录 Bug 并新增自动化回归 → 任务总结落盘 → commit → push 触发 Jenkins → Jenkins 构建镜像并更新目标环境 →
|
|
63
|
+
生产健康检查通过
|
|
46
64
|
|
|
47
|
-
|
|
65
|
+
规则:任一步骤失败或缺产物,禁止进入下一步;本地 compose 验证未通过禁止 commit;Jenkins 未成功或生产健康检查未通过,任务不视为完成。
|
|
48
66
|
|
|
49
67
|
---
|
|
50
68
|
|
|
51
69
|
## 0. 配置填写(必须)
|
|
52
70
|
|
|
53
|
-
先填写 `docs/ENGINEERING.md` frontmatter 中的所有空值(例如
|
|
71
|
+
先填写 `docs/ENGINEERING.md` frontmatter 中的所有空值(例如 Go/前端目录、Docker 文件、Compose 服务、Jenkins Job、健康检查地址、命令)。
|
|
54
72
|
禁止在其他 md/yaml 重复维护这些配置。
|
|
55
73
|
|
|
56
74
|
---
|
|
@@ -70,19 +88,53 @@ docs:
|
|
|
70
88
|
|
|
71
89
|
---
|
|
72
90
|
|
|
91
|
+
## 1.5 工具使用策略(Claude / Codex 专属)
|
|
92
|
+
|
|
93
|
+
优先使用当前环境已安装、已授权、已可访问的工具能力:
|
|
94
|
+
|
|
95
|
+
1) MCP servers
|
|
96
|
+
2) 已安装 skills
|
|
97
|
+
3) plugins / apps / connectors
|
|
98
|
+
4) shell / 手工实现
|
|
99
|
+
|
|
100
|
+
规则:
|
|
101
|
+
- 做设计、查资料、看文档、看页面、查知识库、写回外部系统时,优先调用现有 MCP / skills / plugins / apps。
|
|
102
|
+
- 能用权威工具直接完成时,不重复手写中间数据。
|
|
103
|
+
- 工具不可用、无权限、结果不可靠时,才回退到本地命令或手工处理。
|
|
104
|
+
- 选择工具时优先“已安装且当前项目可直接使用”的能力,而不是重新造流程。
|
|
105
|
+
- 查看 Jenkins、知识库、设计稿、页面、缺陷系统时,优先使用现成的连接器或 MCP,而不是手工拼接上下文。
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## 1.6 多 Agent 协作策略(Claude / Codex 专属)
|
|
110
|
+
|
|
111
|
+
整个流程尽可能使用多 agent 模式并行推进。
|
|
112
|
+
|
|
113
|
+
规则:
|
|
114
|
+
- 任务开始后,优先拆分为可并行的子任务:设计补充、资料检索、实现分块、测试验证、文档回写、review。
|
|
115
|
+
- 主 agent 负责关键路径:任务定义、方案裁决、代码集成、质量门禁、最终交付。
|
|
116
|
+
- 子 agent 负责边界清晰、可独立推进的工作,完成后回收结果给主 agent 集成。
|
|
117
|
+
- 如果某项工作会直接阻塞主路径且难以独立定义,不要机械拆分;由主 agent 保持控制。
|
|
118
|
+
- 能并行就不要串行;能拆独立 write scope 就不要让多个 agent 写同一块内容。
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
73
122
|
## 2. Gate 流水线(强制、不可跳过)
|
|
74
123
|
|
|
75
124
|
Gate-1 读任务:只从 taskbook 取范围与验收;缺信息先补 taskbook
|
|
76
125
|
Gate-2 写DD:无DD禁止写代码;DD必须含 时序图/ER图/接口时序(Mermaid)
|
|
77
126
|
Gate-3 实现:严格按DD;接口变更必须同步 API Markdown
|
|
78
|
-
Gate-4 本地CI:必须通过(commands.build / commands.test
|
|
127
|
+
Gate-4 本地CI:必须通过(commands.build / commands.test);Go 后端与前端都必须覆盖
|
|
79
128
|
Gate-5 静态分析+Review:静态分析通过;docs/reviews/ 生成记录
|
|
80
129
|
Gate-6 文档:更新 api.md + 追加 api-change-log.md
|
|
81
|
-
Gate-7
|
|
82
|
-
Gate-8
|
|
83
|
-
Gate-9 全量回归:按 API Markdown
|
|
84
|
-
Gate-10
|
|
85
|
-
Gate-11
|
|
130
|
+
Gate-7 本地运行:必须用项目 Compose 启动本地 Docker 环境;失败先修复再继续
|
|
131
|
+
Gate-8 健康检查:本地容器启动后必须健康检查通过
|
|
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 完成:生产健康检查通过并补齐部署记录后,任务才完成
|
|
86
138
|
|
|
87
139
|
---
|
|
88
140
|
|
|
@@ -1 +1,4 @@
|
|
|
1
1
|
Follow docs/ENGINEERING.md strictly. Source of truth: docs/ENGINEERING.md.
|
|
2
|
+
Prefer already available MCP servers, installed skills, plugins, and app connectors during design, research, verification, and documentation workflows.
|
|
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 +1,4 @@
|
|
|
1
1
|
Follow docs/ENGINEERING.md strictly. Source of truth: docs/ENGINEERING.md.
|
|
2
|
+
Prefer already available MCP servers, installed skills, plugins, and app connectors during design, research, verification, and documentation workflows.
|
|
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,13 +1,28 @@
|
|
|
1
1
|
# Deploy Record — <Task ID> — YYYY-MM-DD
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
-
|
|
5
|
-
-
|
|
6
|
-
-
|
|
7
|
-
-
|
|
8
|
-
-
|
|
3
|
+
## 1. Local Compose Validation
|
|
4
|
+
- Docker compose file:
|
|
5
|
+
- Docker service:
|
|
6
|
+
- Container name:
|
|
7
|
+
- Image/tag:
|
|
8
|
+
- Exposed port:
|
|
9
|
+
- Env file:
|
|
10
|
+
- Local health URL:
|
|
9
11
|
|
|
10
|
-
##
|
|
11
|
-
-
|
|
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
|
|
23
|
+
- docker ps / compose ps:
|
|
24
|
+
- local_health_check:
|
|
12
25
|
- smoke_test:
|
|
13
26
|
- api_regression:
|
|
27
|
+
- jenkins_result:
|
|
28
|
+
- production_health_check:
|
|
@@ -1,12 +1,19 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Deployment Runbook(本地 Compose 验证 + Jenkins 自动部署)
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
-
|
|
5
|
-
-
|
|
6
|
-
- deployment.remote_app_root / deployment.remote_jar_path / deployment.remote_config_dir / deployment.remote_bin_dir
|
|
7
|
-
- deployment.health_base_url / deployment.health_path
|
|
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 |
|
|
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 | 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 +
|
|
107
|
+
"and put commands + runtime + jenkins fields in YAML frontmatter."
|
|
108
108
|
)
|
|
109
109
|
|
|
110
110
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elvis1513/auto-coding-skill",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "CLI installer for auto-coding-skill (Claude Code + Codex CLI).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -29,7 +29,8 @@
|
|
|
29
29
|
"engineering",
|
|
30
30
|
"workflow",
|
|
31
31
|
"ci",
|
|
32
|
-
"
|
|
32
|
+
"docker",
|
|
33
|
+
"local-testing"
|
|
33
34
|
],
|
|
34
35
|
"repository": {
|
|
35
36
|
"type": "git",
|