From af307795b2c623a18c32a1d12afeb6d39cd4bac0 Mon Sep 17 00:00:00 2001 From: xiaoxing0135 <706015750@qq.com> Date: Wed, 3 Jun 2026 02:07:20 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20add=20missing=20deploy=20artifacts=20to?= =?UTF-8?q?=20install.py=20=E2=80=94=20CLAUDE.md,=20AGENTS.md,=20quality?= =?UTF-8?q?=5Fgates.yaml,=20templates/?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit install.py copy_top_level_docs was missing CLAUDE.md and AGENTS.md. copy_config was missing quality_gates.yaml and templates/. quality_gate_engine.py DEFAULT_CONFIG path was broken (utils/config/ — nonexistent). Fixed with fallback: deployed root first, then source config/. Updated docs (05-install-deploy.md tree, 部署说明.md upgrade lists). --- docs/charter/05-install-deploy.md | 5 ++++- ...\250\347\275\262\350\257\264\346\230\216.md" | 4 ++-- install.py | 17 +++++++++++++++-- utils/quality/quality_gate_engine.py | 8 +++++--- 4 files changed, 26 insertions(+), 8 deletions(-) diff --git a/docs/charter/05-install-deploy.md b/docs/charter/05-install-deploy.md index 85946cf..e487fde 100644 --- a/docs/charter/05-install-deploy.md +++ b/docs/charter/05-install-deploy.md @@ -248,6 +248,8 @@ your-test-project/ ├── .claude/{agents,skills}/ ← 16 agent + 32 skill(业务) + 3 元 skill ├── .github/workflows/test.yml ├── Jenkinsfile +├── CLAUDE.md ← AI Agent 行为指令(Claude Code 必读) +├── AGENTS.md ← Agent 目录(16 专家) ├── utils/ ← 79 个 .py + __init__ ├── src/ ← 被测系统源码(cov 指向) ├── workspace/ @@ -265,7 +267,8 @@ your-test-project/ │ ├── skill-evolution/ ← darwin-skill results.tsv + 成果卡片 │ ├── 截图/ 报告/ ├── conftest.py / pytest.ini / requirements.txt -├── .mcp.json / .env +├── .mcp.json / .env / quality_gates.yaml +├── templates/ ← tagent init 模板 ``` --- diff --git "a/docs/getting-started/\351\203\250\347\275\262\350\257\264\346\230\216.md" "b/docs/getting-started/\351\203\250\347\275\262\350\257\264\346\230\216.md" index 0f9b181..1617cfe 100644 --- "a/docs/getting-started/\351\203\250\347\275\262\350\257\264\346\230\216.md" +++ "b/docs/getting-started/\351\203\250\347\275\262\350\257\264\346\230\216.md" @@ -565,8 +565,8 @@ git pull TEMPLATE_DIR=$(pwd) ./docs/getting-started/deploy.sh /path/to/your-test-project ``` -> 升级会**覆盖** `.claude/agents/`、`.claude/skills/`、`utils/`、`conftest.py`、`pytest.ini`、`requirements.txt`、`.mcp.json`、`.github/workflows/test.yml`、`Jenkinsfile`。 -> **不会覆盖**:`.env`、`workspace/`、`src/`。 +> 升级会**覆盖** `.claude/agents/`、`.claude/skills/`、`utils/`、`conftest.py`、`pytest.ini`、`requirements.txt`、`.mcp.json`、`.github/workflows/test.yml`、`Jenkinsfile`、`CLAUDE.md`、`AGENTS.md`、`templates/`。 +> **不会覆盖**:`.env`、`workspace/`、`src/`、`quality_gates.yaml`。 ### 回滚 diff --git a/install.py b/install.py index 6721582..c39866d 100644 --- a/install.py +++ b/install.py @@ -69,6 +69,7 @@ def _parse_args(): PRESERVE_FILES = [ ".env", + "quality_gates.yaml", os.path.join("workspace", "测试数据", "test_data.json"), os.path.join("workspace", "测试报告", "baselines", "perf_baseline.json"), "workspace/regression_modules.yaml", @@ -341,12 +342,23 @@ def copy_config(template_dir, project_root): """拷贝配置文件。""" print("→ 拷贝配置文件...") config_dir = os.path.join(template_dir, "config") - files = ["conftest.py", "pytest.ini", ".mcp.json", "requirements.txt", "check_version.py"] + files = [ + "conftest.py", "pytest.ini", ".mcp.json", "requirements.txt", + "check_version.py", "quality_gates.yaml", + ] for f in files: src = os.path.join(config_dir, f) if os.path.isfile(src): shutil.copy2(src, project_root) + # 拷贝项目模板(STARTUP.md.tpl / .env.tpl / .tagent.yml.tpl / matrix.yaml 等) + tmpl_src = os.path.join(config_dir, "templates") + tmpl_dst = os.path.join(project_root, "templates") + if os.path.isdir(tmpl_src): + if os.path.exists(tmpl_dst): + shutil.rmtree(tmpl_dst) + shutil.copytree(tmpl_src, tmpl_dst) + # .env — 仅在不存在时创建 env_dst = os.path.join(project_root, ".env") if not os.path.isfile(env_dst): @@ -422,7 +434,8 @@ def copy_top_level_docs(template_dir, project_root): docs = [ "LICENSE", "NOTICE.md", "SECURITY.md", "CONTRIBUTING.md", "CODE_OF_CONDUCT.md", "ROADMAP.md", "README.md", "README.zh-CN.md", - "CHANGELOG.md", "VERSION", "FULL_GUIDE.md", "tagent.yml.example", + "CHANGELOG.md", "VERSION", "FULL_GUIDE.md", "AGENTS.md", "CLAUDE.md", + "tagent.yml.example", ] for f in docs: src = os.path.join(template_dir, f) diff --git a/utils/quality/quality_gate_engine.py b/utils/quality/quality_gate_engine.py index 4b95ce6..812131f 100644 --- a/utils/quality/quality_gate_engine.py +++ b/utils/quality/quality_gate_engine.py @@ -4,7 +4,7 @@ Replaces hardcoded GATES dict in ci_quality_gate.py with YAML-configurable thresholds. Users edit the YAML, not the code. -默认配置文件: config/quality_gates.yaml +默认查找: ./quality_gates.yaml (部署) → ./config/quality_gates.yaml (源码) 可通过 QUALITY_GATE_CONFIG 环境变量覆盖路径。 """ @@ -26,7 +26,9 @@ logger = logging.getLogger(__name__) -DEFAULT_CONFIG = Path(__file__).resolve().parent.parent / "config" / "quality_gates.yaml" +_cfg_deployed = Path(__file__).resolve().parent.parent.parent / "quality_gates.yaml" +_cfg_source = Path(__file__).resolve().parent.parent.parent / "config" / "quality_gates.yaml" +DEFAULT_CONFIG = _cfg_deployed if _cfg_deployed.exists() else _cfg_source def _load_yaml_config(path: str | Path) -> dict[str, Any]: @@ -236,7 +238,7 @@ def main() -> None: logging.basicConfig(level=logging.INFO) parser = argparse.ArgumentParser(description="Quality Gate Engine (YAML-driven)") - parser.add_argument("--config", help="YAML 配置文件路径 (默认: config/quality_gates.yaml)") + parser.add_argument("--config", help="YAML 配置文件路径 (默认: 项目根 quality_gates.yaml)") parser.add_argument("--smoke-xml", help="冒烟 junit xml 路径") parser.add_argument("--regression-xml", help="回归 junit xml 路径") parser.add_argument("--coverage-xml", help="coverage.xml 路径")