docs: require online Wiki initialization before coding (#20)

This commit is contained in:
QiuSW
2026-08-17 11:24:16 +08:00
parent b1f500128d
commit 89ca159b60
7 changed files with 99 additions and 13 deletions
+29
View File
@@ -53,6 +53,7 @@ CORE_DOCUMENT_REQUIREMENTS = {
"## 环境、配置与凭据",
),
"docs/01-workflow.md": (
"## 新项目 Wiki 初始化门禁",
"## 工单与设计证据双门禁",
"### 先判断是否需要工单",
"### 再判断设计证据",
@@ -103,6 +104,7 @@ CORE_DOCUMENT_REQUIREMENTS = {
"#### 判断案例",
"### 3. 识别子项目与交付单元",
"### 7. 确定交付对象和文档",
"#### 在线创建与回读门禁",
"## 完成标准",
),
"docs/08-existing-project-adoption.md": (
@@ -297,6 +299,9 @@ def check_agent_efficiency_rules(errors: list[str], root: Path = ROOT) -> None:
"高风险修改必须停止",
"用户没有明确验收通过前不得关闭",
"长期核心文档必须先修改 Wiki",
"### 新项目 Wiki 初始化门禁",
"`Home` 不存在时必须先创建 `Home`",
"不得把模板自带的本地 `docs/` 当作新项目 Wiki 已初始化的证据",
"提交只包含当前工单相关文件",
"### 工单与设计证据双门禁",
"新页面、独立用户功能、重大交互或导航变化",
@@ -321,6 +326,29 @@ def check_agent_efficiency_rules(errors: list[str], root: Path = ROOT) -> None:
errors.append(f"AGENTS.md 缺少:{section}")
def check_repository_readme(errors: list[str], root: Path = ROOT) -> None:
"""检查快速开始包含线上 Wiki 初始化顺序和产品编码门禁。"""
path = root / "README.md"
if not path.is_file():
return
content = path.read_text(encoding="utf-8")
required = (
"创建 Gitea 远端仓库并推送当前引导提交,启用工单和 Wiki",
"优先使用已配置的 Gitea MCP",
"`Home` 不存在时先创建并回读 `Home`",
"本地 `docs/` 的存在不能证明线上 Wiki 已初始化",
"python dev_scripts/sync_wiki_docs.py --check",
)
for section in missing_sections(content, required):
errors.append(f"README.md 缺少:{section}")
remote_index = content.find("创建 Gitea 远端仓库")
wiki_index = content.find("`Home` 不存在时先创建")
if remote_index < 0 or wiki_index < 0 or remote_index > wiki_index:
errors.append("README.md 必须先创建 Gitea 远端,再创建 Wiki Home")
def check_claude_code_entry(errors: list[str], root: Path = ROOT) -> None:
"""检查 Claude Code 入口直接复用共同 Agent 规则。"""
@@ -415,6 +443,7 @@ def main() -> int:
check_core_documents(errors)
check_task_template(errors)
check_agent_efficiency_rules(errors)
check_repository_readme(errors)
check_claude_code_entry(errors)
check_archives(errors)