mirror of
https://github.com/tradecatlabs/vibe-coding-cn.git
synced 2026-08-09 09:07:46 +00:00
docs: add directory governance docs
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
# scripts/ Agent 指南
|
||||
|
||||
本目录维护仓库级自动化脚本,主要用于 Markdown、链接、锚点、metadata 和 AI 引用资产校验。
|
||||
|
||||
## 约束
|
||||
|
||||
- 脚本默认从仓库根目录运行,路径解析必须稳定。
|
||||
- 新增检查脚本时,同步更新 `scripts/README.md`、`Makefile`、CI 和根目录 `AGENTS.md` 的命令清单。
|
||||
- 检查失败输出应包含文件路径、行号或可定位的错误信息。
|
||||
- 跳过目录必须明确,至少跳过 `.git`、`.history`、`node_modules` 和外部源码快照。
|
||||
|
||||
## 验证
|
||||
|
||||
```bash
|
||||
make test
|
||||
```
|
||||
@@ -7,5 +7,6 @@
|
||||
- `check-local-links.py`:仓库内 Markdown 相对链接与锚点检查脚本。
|
||||
- `check-markdown-details.py`:仓库内 Markdown `<details>/<summary>` 折叠块结构检查脚本。
|
||||
- `check-doc-structure.py`:`docs/` 线性 README 的主章节顺序、重复锚点与细粒度目录入口检查脚本。
|
||||
- `check-directory-docs.py`:仓库自有目录 `README.md` / `AGENTS.md` 覆盖检查脚本。
|
||||
- `check-metadata.py`:`metadata/taxonomy.yml` 与 `metadata/redirects.yml` 路径和锚点检查脚本。
|
||||
- `check-ai-citation.py`:`llms.txt`、`assets/ai-citation/llms-full.txt` 与 AI 引用语料路径和锚点检查脚本。
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Check required repository-owned directories have README.md and AGENTS.md."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
REQUIRED_DIRS = [
|
||||
Path("assets"),
|
||||
Path("assets/ai-citation"),
|
||||
Path("assets/datasets"),
|
||||
Path("assets/images"),
|
||||
Path("assets/templates"),
|
||||
Path("docs"),
|
||||
Path("docs/concepts"),
|
||||
Path("docs/getting-started"),
|
||||
Path("docs/philosophy"),
|
||||
Path("docs/references"),
|
||||
Path("docs/research"),
|
||||
Path("metadata"),
|
||||
Path("prompts"),
|
||||
Path("scripts"),
|
||||
Path("skills"),
|
||||
Path("skills/auto-skill"),
|
||||
Path("tools"),
|
||||
Path("tools/chat-vault"),
|
||||
Path("tools/config"),
|
||||
Path("tools/config/.codex"),
|
||||
Path("tools/external"),
|
||||
Path("tools/prompts-library"),
|
||||
]
|
||||
GENERATED_OR_VENDOR_DIRS = [
|
||||
Path("node_modules"),
|
||||
]
|
||||
|
||||
|
||||
def main() -> int:
|
||||
errors: list[str] = []
|
||||
|
||||
for rel_dir in REQUIRED_DIRS:
|
||||
directory = ROOT / rel_dir
|
||||
if not directory.is_dir():
|
||||
errors.append(f"{rel_dir}: required directory is missing")
|
||||
continue
|
||||
for filename in ("README.md", "AGENTS.md"):
|
||||
if not (directory / filename).is_file():
|
||||
errors.append(f"{rel_dir}/{filename}: missing required directory document")
|
||||
|
||||
for rel_dir in GENERATED_OR_VENDOR_DIRS:
|
||||
directory = ROOT / rel_dir
|
||||
if directory.exists() and not (ROOT / ".gitignore").read_text(encoding="utf-8").count(str(rel_dir)):
|
||||
errors.append(f"{rel_dir}: generated directory exists but is not ignored")
|
||||
|
||||
if errors:
|
||||
print("DIRECTORY_DOC_ERRORS")
|
||||
for error in errors:
|
||||
print(error)
|
||||
print(f"TOTAL={len(errors)}")
|
||||
return 1
|
||||
|
||||
print(f"OK directory README/AGENTS pairs checked: {len(REQUIRED_DIRS)} directories")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
Reference in New Issue
Block a user