docs: 新增部署文档模板与位置约定 (#24)
新增 Deployment-Template 模板页及镜像,固化 nginx 反代 + supervisor 托管的 Python 服务部署做法;明确部署文档在有无常驻服务两种情况下的 落点,并在新项目初始化加入部署页判定。模板文件纳入 REQUIRED_FILES, 部署实例页不进入 CORE_DOCUMENT_REQUIREMENTS 强制检查。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -3,17 +3,20 @@ from __future__ import annotations
|
||||
import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
import unittest.mock
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
sys.path.insert(0, str(ROOT / "dev_scripts"))
|
||||
|
||||
import harness # noqa: E402
|
||||
from harness import ( # noqa: E402
|
||||
CORE_DOCUMENT_REQUIREMENTS,
|
||||
CORE_PAGE_PATHS,
|
||||
REQUIRED_FILES,
|
||||
check_claude_code_entry,
|
||||
check_required_files,
|
||||
check_core_documents,
|
||||
check_agent_efficiency_rules,
|
||||
check_repository_readme,
|
||||
@@ -110,6 +113,25 @@ class CoreDocumentTests(unittest.TestCase):
|
||||
self.assertIn("### 3. 识别子项目与交付单元", required)
|
||||
self.assertIn("#### 需求总览启用条件", required)
|
||||
|
||||
def test_deployment_template_is_required_and_mapped(self) -> None:
|
||||
path = "docs/templates/deployment.md"
|
||||
self.assertIn(path, REQUIRED_FILES)
|
||||
config = load_config()
|
||||
mappings = {mapping.page: mapping.path for mapping in config.mappings}
|
||||
self.assertEqual(mappings.get("Deployment-Template"), path)
|
||||
# 部署页按项目需要创建,不强制每个项目产出实例页。
|
||||
self.assertNotIn(path, CORE_DOCUMENT_REQUIREMENTS)
|
||||
|
||||
def test_missing_deployment_template_is_reported(self) -> None:
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
root = Path(directory)
|
||||
with unittest.mock.patch.object(harness, "ROOT", root):
|
||||
errors: list[str] = []
|
||||
check_required_files(errors)
|
||||
self.assertTrue(
|
||||
any("docs/templates/deployment.md" in error for error in errors)
|
||||
)
|
||||
|
||||
def test_missing_or_wrong_core_mapping_is_reported(self) -> None:
|
||||
errors = core_mapping_errors({"Home": "docs/wrong.md"})
|
||||
self.assertTrue(any("Home -> docs/README.md" in error for error in errors))
|
||||
|
||||
Reference in New Issue
Block a user