@elvis1513/auto-coding-skill 2.0.2 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -23,6 +23,12 @@ npm install -g git+https://github.com/elvis1513/auto-coding-skill.git
|
|
|
23
23
|
|
|
24
24
|
## Release Notes
|
|
25
25
|
|
|
26
|
+
### v2.0.3
|
|
27
|
+
|
|
28
|
+
- Fixed `doctor`, `light-gate`, `verify-target`, and Jenkins API verification to accept secret references via `*_password_env`.
|
|
29
|
+
- Kept direct `*_password` fields compatible for legacy projects while making the default template use environment-variable secret references.
|
|
30
|
+
- Updated docs so `docs/ENGINEERING.md` can stay Git-tracked without requiring committed secrets.
|
|
31
|
+
|
|
26
32
|
### v2.0.2
|
|
27
33
|
|
|
28
34
|
- Added default Codex subagent templates under `.agents/agents`.
|
|
@@ -153,19 +159,19 @@ It must be committed to Git. Do not add it to `.gitignore`.
|
|
|
153
159
|
- `target_env.name`
|
|
154
160
|
- `target_env.frontend_base_url`
|
|
155
161
|
- `target_env.frontend_username`
|
|
156
|
-
- `target_env.frontend_password`
|
|
162
|
+
- `target_env.frontend_password` 或 `target_env.frontend_password_env`
|
|
157
163
|
- `target_env.backend_base_url`
|
|
158
164
|
- `target_env.backend_username`
|
|
159
|
-
- `target_env.backend_password`
|
|
165
|
+
- `target_env.backend_password` 或 `target_env.backend_password_env`
|
|
160
166
|
- `target_env.backend_root_username`
|
|
161
|
-
- `target_env.backend_root_password`
|
|
167
|
+
- `target_env.backend_root_password` 或 `target_env.backend_root_password_env`
|
|
162
168
|
- `target_env.health_base_url`
|
|
163
169
|
- `target_env.health_path`
|
|
164
170
|
- `jenkins.base_url`
|
|
165
171
|
- `jenkins.ui_username`
|
|
166
|
-
- `jenkins.ui_password`
|
|
172
|
+
- `jenkins.ui_password` 或 `jenkins.ui_password_env`
|
|
167
173
|
- `jenkins.api_user`
|
|
168
|
-
- `jenkins.api_password`
|
|
174
|
+
- `jenkins.api_password` 或 `jenkins.api_password_env`
|
|
169
175
|
- `jenkins.trigger_branch`
|
|
170
176
|
- `jenkins.image_repository`
|
|
171
177
|
- `jenkins.image_tag_strategy`
|
|
@@ -240,10 +246,11 @@ It must be committed to Git. Do not add it to `.gitignore`.
|
|
|
240
246
|
- Purpose: single source of project config + workflow rules.
|
|
241
247
|
- How to record:
|
|
242
248
|
- Fill YAML frontmatter once.
|
|
243
|
-
- Keep target env front/backend usernames
|
|
249
|
+
- Keep target env front/backend usernames, Jenkins UI/API usernames, password fields or `*_password_env` references, commands, and docs paths here only.
|
|
244
250
|
- Target environment also includes backend server root username/password.
|
|
245
|
-
- This file is expected to be committed to Git
|
|
251
|
+
- This file is expected to be committed to Git; prefer `*_password_env` for secrets so actual secret values stay in the current shell.
|
|
246
252
|
- Remaining environment keys are all mandatory; blank values, TODO-like placeholders, and incorrect URL/path formats are treated as blocking errors by `doctor`.
|
|
253
|
+
- For secret fields, `doctor` requires either a direct `*_password` value or a `*_password_env` variable name. Commands that actually authenticate require the referenced environment variable to be set at execution time.
|
|
247
254
|
- Do not duplicate config elsewhere.
|
|
248
255
|
|
|
249
256
|
### 2) docs/tasks/taskbook.md
|
|
@@ -7,7 +7,7 @@ description: Use for a Claude/Codex engineering workflow with dev and verify mod
|
|
|
7
7
|
|
|
8
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
|
-
`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.
|
|
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. Secret fields may be represented either as direct `*_password` values for legacy projects or as `*_password_env` names that point to environment variables in the current shell. Unused environment keys should be removed from the template instead of being left as placeholders.
|
|
11
11
|
|
|
12
12
|
At task start, inventory the current client capabilities before choosing a route: installed MCP servers, local skills, plugins/apps/connectors, browser/control tools, and repo scripts. Prefer those capabilities when they provide current, authoritative, or directly inspectable state.
|
|
13
13
|
|
|
@@ -93,19 +93,19 @@ Minimum required config for the default flow:
|
|
|
93
93
|
- `target_env.name`
|
|
94
94
|
- `target_env.frontend_base_url`
|
|
95
95
|
- `target_env.frontend_username`
|
|
96
|
-
- `target_env.frontend_password`
|
|
96
|
+
- `target_env.frontend_password` or `target_env.frontend_password_env`
|
|
97
97
|
- `target_env.backend_base_url`
|
|
98
98
|
- `target_env.backend_username`
|
|
99
|
-
- `target_env.backend_password`
|
|
99
|
+
- `target_env.backend_password` or `target_env.backend_password_env`
|
|
100
100
|
- `target_env.backend_root_username`
|
|
101
|
-
- `target_env.backend_root_password`
|
|
101
|
+
- `target_env.backend_root_password` or `target_env.backend_root_password_env`
|
|
102
102
|
- `target_env.health_base_url`
|
|
103
103
|
- `target_env.health_path`
|
|
104
104
|
- `jenkins.base_url`
|
|
105
105
|
- `jenkins.ui_username`
|
|
106
|
-
- `jenkins.ui_password`
|
|
106
|
+
- `jenkins.ui_password` or `jenkins.ui_password_env`
|
|
107
107
|
- `jenkins.api_user`
|
|
108
|
-
- `jenkins.api_password`
|
|
108
|
+
- `jenkins.api_password` or `jenkins.api_password_env`
|
|
109
109
|
- `jenkins.trigger_branch`
|
|
110
110
|
- `jenkins.image_repository`
|
|
111
111
|
- `jenkins.image_tag_strategy`
|
|
@@ -33,19 +33,19 @@ target_env:
|
|
|
33
33
|
name: ""
|
|
34
34
|
frontend_base_url: ""
|
|
35
35
|
frontend_username: ""
|
|
36
|
-
|
|
36
|
+
frontend_password_env: ""
|
|
37
37
|
backend_base_url: ""
|
|
38
38
|
backend_username: ""
|
|
39
|
-
|
|
39
|
+
backend_password_env: ""
|
|
40
40
|
backend_root_username: ""
|
|
41
|
-
|
|
41
|
+
backend_root_password_env: ""
|
|
42
42
|
health_base_url: ""
|
|
43
43
|
health_path: ""
|
|
44
44
|
|
|
45
45
|
jenkins:
|
|
46
46
|
base_url: ""
|
|
47
47
|
ui_username: ""
|
|
48
|
-
|
|
48
|
+
ui_password_env: ""
|
|
49
49
|
job_url: ""
|
|
50
50
|
trigger_branch: ""
|
|
51
51
|
image_repository: ""
|
|
@@ -53,7 +53,7 @@ jenkins:
|
|
|
53
53
|
deploy_env: ""
|
|
54
54
|
deploy_timeout_sec: 1800
|
|
55
55
|
api_user: ""
|
|
56
|
-
|
|
56
|
+
api_password_env: ""
|
|
57
57
|
|
|
58
58
|
docs:
|
|
59
59
|
taskbook: "docs/tasks/taskbook.md"
|
|
@@ -87,7 +87,7 @@ docs:
|
|
|
87
87
|
- 每次任务闭环后,必须清理临时文件、临时目录、日志、截图、构建缓存等非必要产物;仅明确需要保留的本地诊断目录允许保留。
|
|
88
88
|
- 所有手工填写信息,只维护在本文件 frontmatter 中,其他文档不得重复配置。
|
|
89
89
|
- `docs/ENGINEERING.md` 必须提交到 Git 管理,不允许写入 `.gitignore`。
|
|
90
|
-
-
|
|
90
|
+
- 目标环境和 Jenkins 密码默认通过 `*_password_env` 指向当前 shell 中的环境变量;确需兼容旧项目时才使用明文 `*_password` 字段。
|
|
91
91
|
- 未参与默认流程的环境项不要保留占位;模板中未保留的字段视为已清理,不再额外配置。
|
|
92
92
|
|
|
93
93
|
---
|
|
@@ -97,15 +97,15 @@ docs:
|
|
|
97
97
|
先填写 `docs/ENGINEERING.md` frontmatter 中的所有空值。重点包括:
|
|
98
98
|
- `workflow.mode`:`dev` 或 `verify`,默认推荐 `dev`
|
|
99
99
|
- `commands.light_gate`:推荐配置一个项目级快速门禁命令,作为默认本地校验入口
|
|
100
|
-
- `target_env.*`:目标环境前端 /
|
|
101
|
-
- `jenkins.*`:Jenkins UI/API
|
|
100
|
+
- `target_env.*`:目标环境前端 / 后端地址、用户名、密码引用,必须全部填写且真实可用
|
|
101
|
+
- `jenkins.*`:Jenkins UI/API 用户名、密码引用、Job、分支、镜像、部署环境,必须全部填写且真实可用
|
|
102
102
|
|
|
103
103
|
字段说明:
|
|
104
|
-
- `target_env.backend_username`
|
|
105
|
-
- `target_env.backend_root_username`
|
|
106
|
-
- `target_env.frontend_username`
|
|
107
|
-
- `jenkins.ui_username`
|
|
108
|
-
- `jenkins.api_user`
|
|
104
|
+
- `target_env.backend_username` + `target_env.backend_password_env` 或 `target_env.backend_password`:目标环境后台账号
|
|
105
|
+
- `target_env.backend_root_username` + `target_env.backend_root_password_env` 或 `target_env.backend_root_password`:目标环境后台服务器 root 账号
|
|
106
|
+
- `target_env.frontend_username` + `target_env.frontend_password_env` 或 `target_env.frontend_password`:目标环境前端登录账号
|
|
107
|
+
- `jenkins.ui_username` + `jenkins.ui_password_env` 或 `jenkins.ui_password`:Jenkins 页面登录账号
|
|
108
|
+
- `jenkins.api_user` + `jenkins.api_password_env` 或 `jenkins.api_password`:Jenkins API 用户名 / 密码
|
|
109
109
|
|
|
110
110
|
默认必填:
|
|
111
111
|
- `workflow.mode`
|
|
@@ -114,19 +114,19 @@ docs:
|
|
|
114
114
|
- `target_env.name`
|
|
115
115
|
- `target_env.frontend_base_url`
|
|
116
116
|
- `target_env.frontend_username`
|
|
117
|
-
- `target_env.frontend_password`
|
|
117
|
+
- `target_env.frontend_password` 或 `target_env.frontend_password_env`
|
|
118
118
|
- `target_env.backend_base_url`
|
|
119
119
|
- `target_env.backend_username`
|
|
120
|
-
- `target_env.backend_password`
|
|
120
|
+
- `target_env.backend_password` 或 `target_env.backend_password_env`
|
|
121
121
|
- `target_env.backend_root_username`
|
|
122
|
-
- `target_env.backend_root_password`
|
|
122
|
+
- `target_env.backend_root_password` 或 `target_env.backend_root_password_env`
|
|
123
123
|
- `target_env.health_base_url`
|
|
124
124
|
- `target_env.health_path`
|
|
125
125
|
- `jenkins.base_url`
|
|
126
126
|
- `jenkins.ui_username`
|
|
127
|
-
- `jenkins.ui_password`
|
|
127
|
+
- `jenkins.ui_password` 或 `jenkins.ui_password_env`
|
|
128
128
|
- `jenkins.api_user`
|
|
129
|
-
- `jenkins.api_password`
|
|
129
|
+
- `jenkins.api_password` 或 `jenkins.api_password_env`
|
|
130
130
|
- `jenkins.trigger_branch`
|
|
131
131
|
- `jenkins.image_repository`
|
|
132
132
|
- `jenkins.image_tag_strategy`
|
|
@@ -8,6 +8,7 @@ import argparse
|
|
|
8
8
|
import base64
|
|
9
9
|
import datetime as _dt
|
|
10
10
|
import json
|
|
11
|
+
import os
|
|
11
12
|
import time
|
|
12
13
|
import urllib.parse
|
|
13
14
|
import urllib.error
|
|
@@ -60,23 +61,32 @@ def _run_configured_command(repo: Path, cfg: dict, name: str) -> bool:
|
|
|
60
61
|
|
|
61
62
|
def _jenkins_basic_auth_headers(cfg: dict) -> dict:
|
|
62
63
|
jenkins_cfg = (cfg.get("jenkins") or {})
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
credential_pairs = [
|
|
65
|
+
("api_user", "api_password"),
|
|
66
|
+
("ui_username", "ui_password"),
|
|
66
67
|
]
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
68
|
+
errors: list[str] = []
|
|
69
|
+
|
|
70
|
+
for user_field, secret_field in credential_pairs:
|
|
71
|
+
user = _text(jenkins_cfg.get(user_field))
|
|
72
|
+
if not _is_explicit_fill(user):
|
|
73
|
+
continue
|
|
74
|
+
try:
|
|
75
|
+
secret = _resolve_secret("jenkins", jenkins_cfg, secret_field)
|
|
76
|
+
except APError as exc:
|
|
77
|
+
errors.append(str(exc))
|
|
78
|
+
continue
|
|
79
|
+
raw = f"{user}:{secret}".encode("utf-8")
|
|
80
|
+
auth = base64.b64encode(raw).decode("ascii")
|
|
81
|
+
return {"Authorization": f"Basic {auth}"}
|
|
82
|
+
|
|
83
|
+
detail = "\n- " + "\n- ".join(errors) if errors else ""
|
|
84
|
+
raise APError(
|
|
85
|
+
"Missing Jenkins API credentials. Configure jenkins.api_user with "
|
|
86
|
+
"jenkins.api_password or jenkins.api_password_env, or configure "
|
|
87
|
+
"jenkins.ui_username with jenkins.ui_password or jenkins.ui_password_env."
|
|
88
|
+
+ detail
|
|
89
|
+
)
|
|
80
90
|
|
|
81
91
|
|
|
82
92
|
def _http_error_body(exc: urllib.error.HTTPError) -> str:
|
|
@@ -593,6 +603,41 @@ def _require_explicit_field(missing: List[str], field: str, value: object) -> No
|
|
|
593
603
|
missing.append(f"{field} (must be explicitly filled, not blank/TODO)")
|
|
594
604
|
|
|
595
605
|
|
|
606
|
+
def _has_secret_reference(section_cfg: dict, field: str) -> bool:
|
|
607
|
+
return _is_explicit_fill(section_cfg.get(field)) or _is_explicit_fill(section_cfg.get(f"{field}_env"))
|
|
608
|
+
|
|
609
|
+
|
|
610
|
+
def _require_secret_reference(missing: List[str], section_name: str, section_cfg: dict, field: str) -> None:
|
|
611
|
+
if not _has_secret_reference(section_cfg, field):
|
|
612
|
+
missing.append(
|
|
613
|
+
f"{section_name}.{field} or {section_name}.{field}_env "
|
|
614
|
+
"(must be explicitly filled, not blank/TODO)"
|
|
615
|
+
)
|
|
616
|
+
|
|
617
|
+
|
|
618
|
+
def _resolve_secret(section_name: str, section_cfg: dict, field: str) -> str:
|
|
619
|
+
direct_value = section_cfg.get(field)
|
|
620
|
+
if _is_explicit_fill(direct_value):
|
|
621
|
+
return _text(direct_value)
|
|
622
|
+
|
|
623
|
+
env_field = f"{field}_env"
|
|
624
|
+
env_name = _text(section_cfg.get(env_field))
|
|
625
|
+
if _is_explicit_fill(env_name):
|
|
626
|
+
env_value = os.environ.get(env_name, "")
|
|
627
|
+
if _is_explicit_fill(env_value):
|
|
628
|
+
return _text(env_value)
|
|
629
|
+
raise APError(
|
|
630
|
+
f"Missing secret value for {section_name}.{field}. "
|
|
631
|
+
f"Set environment variable {env_name} declared by {section_name}.{env_field}, "
|
|
632
|
+
f"or fill {section_name}.{field}."
|
|
633
|
+
)
|
|
634
|
+
|
|
635
|
+
raise APError(
|
|
636
|
+
f"Missing {section_name}.{field}. Fill {section_name}.{field} "
|
|
637
|
+
f"or declare {section_name}.{env_field}."
|
|
638
|
+
)
|
|
639
|
+
|
|
640
|
+
|
|
596
641
|
def _run_git_diff_check(repo: Path, cfg: dict) -> None:
|
|
597
642
|
print("[diff-check] git diff --check")
|
|
598
643
|
run(["git", "diff", "--check"], cwd=repo)
|
|
@@ -733,15 +778,15 @@ def cmd_verify_target(args: argparse.Namespace) -> None:
|
|
|
733
778
|
frontend_headers: dict[str, str] = {}
|
|
734
779
|
if args.backend_basic_auth:
|
|
735
780
|
user = str(target_cfg.get("backend_username") or "").strip()
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
781
|
+
if not user:
|
|
782
|
+
raise APError("Missing target_env.backend_username for backend basic auth.")
|
|
783
|
+
password = _resolve_secret("target_env", target_cfg, "backend_password")
|
|
739
784
|
backend_headers = _basic_auth_header(user, password)
|
|
740
785
|
if args.frontend_basic_auth:
|
|
741
786
|
user = str(target_cfg.get("frontend_username") or "").strip()
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
787
|
+
if not user:
|
|
788
|
+
raise APError("Missing target_env.frontend_username for frontend basic auth.")
|
|
789
|
+
password = _resolve_secret("target_env", target_cfg, "frontend_password")
|
|
745
790
|
frontend_headers = _basic_auth_header(user, password)
|
|
746
791
|
|
|
747
792
|
for path in args.backend_path or []:
|
|
@@ -822,25 +867,25 @@ def cmd_doctor(args: argparse.Namespace) -> None:
|
|
|
822
867
|
_require_explicit_field(missing, "target_env.name", target_cfg.get("name"))
|
|
823
868
|
_require_explicit_field(missing, "target_env.frontend_base_url", target_cfg.get("frontend_base_url"))
|
|
824
869
|
_require_explicit_field(missing, "target_env.frontend_username", target_cfg.get("frontend_username"))
|
|
825
|
-
|
|
870
|
+
_require_secret_reference(missing, "target_env", target_cfg, "frontend_password")
|
|
826
871
|
_require_explicit_field(missing, "target_env.backend_base_url", target_cfg.get("backend_base_url"))
|
|
827
872
|
_require_explicit_field(missing, "target_env.backend_username", target_cfg.get("backend_username"))
|
|
828
|
-
|
|
873
|
+
_require_secret_reference(missing, "target_env", target_cfg, "backend_password")
|
|
829
874
|
_require_explicit_field(missing, "target_env.backend_root_username", target_cfg.get("backend_root_username"))
|
|
830
|
-
|
|
875
|
+
_require_secret_reference(missing, "target_env", target_cfg, "backend_root_password")
|
|
831
876
|
_require_explicit_field(missing, "target_env.health_base_url", target_cfg.get("health_base_url"))
|
|
832
877
|
_require_explicit_field(missing, "target_env.health_path", target_cfg.get("health_path"))
|
|
833
878
|
|
|
834
879
|
_require_explicit_field(missing, "jenkins.base_url", jenkins_cfg.get("base_url"))
|
|
835
880
|
_require_explicit_field(missing, "jenkins.ui_username", jenkins_cfg.get("ui_username"))
|
|
836
|
-
|
|
881
|
+
_require_secret_reference(missing, "jenkins", jenkins_cfg, "ui_password")
|
|
837
882
|
_require_explicit_field(missing, "jenkins.job_url", jenkins_cfg.get("job_url"))
|
|
838
883
|
_require_explicit_field(missing, "jenkins.trigger_branch", jenkins_cfg.get("trigger_branch"))
|
|
839
884
|
_require_explicit_field(missing, "jenkins.image_repository", jenkins_cfg.get("image_repository"))
|
|
840
885
|
_require_explicit_field(missing, "jenkins.image_tag_strategy", jenkins_cfg.get("image_tag_strategy"))
|
|
841
886
|
_require_explicit_field(missing, "jenkins.deploy_env", jenkins_cfg.get("deploy_env"))
|
|
842
887
|
_require_explicit_field(missing, "jenkins.api_user", jenkins_cfg.get("api_user"))
|
|
843
|
-
|
|
888
|
+
_require_secret_reference(missing, "jenkins", jenkins_cfg, "api_password")
|
|
844
889
|
|
|
845
890
|
repo_docs = {
|
|
846
891
|
"docs.taskbook": Path(repo, str(docs_cfg.get("taskbook", "docs/tasks/taskbook.md"))),
|
package/package.json
CHANGED