♻️ refactor(playbook): streamline agents and refresh tsl docs

This commit is contained in:
csh
2026-01-10 16:55:44 +08:00
parent b529012c59
commit 5822a8736d
88 changed files with 103561 additions and 130104 deletions
+106 -8
View File
@@ -321,39 +321,137 @@ jobs:
fi
echo "========================================"
echo "🔍 检查代理规则一致性"
echo "🔍 检查代理规则一致性(三层架构)"
echo "========================================"
cd "$REPO_DIR"
# 检查 .agents/ 和 docs/ 中的规则是否一致
# 检查 .agents/ 三层架构完整性
python3 << 'EOF'
import sys
from pathlib import Path
errors = []
warnings = []
# 检查各语言的 .agents/ 目录
print("检查 Layer 1: .agents/ (极简铁律)")
print("────────────────────────────────────────")
# 检查各语言的 .agents/ 目录(只需 index.md
agents_base = Path(".agents")
# 检查 .agents/index.md
agents_index = agents_base / "index.md"
if not agents_index.exists():
errors.append(f"❌ 缺少文件: {agents_index}")
elif agents_index.stat().st_size == 0:
errors.append(f"❌ 文件为空: {agents_index}")
else:
print(f"✅ {agents_index}")
for lang_dir in ["tsl", "cpp", "python"]:
agents_lang = agents_base / lang_dir
if not agents_lang.exists():
errors.append(f"❌ 缺少目录: {agents_lang}")
continue
# 只检查 index.md(≤50 行)
index_file = agents_lang / "index.md"
if not index_file.exists():
errors.append(f"❌ 缺少文件: {index_file}")
elif index_file.stat().st_size == 0:
errors.append(f"❌ 文件为空: {index_file}")
else:
# 检查规模(≤50 行)
line_count = len(index_file.read_text(encoding='utf-8').splitlines())
if line_count > 50:
warnings.append(f"⚠️ {index_file}: {line_count} 行 (目标: ≤50)")
else:
print(f"✅ {index_file} ({line_count} 行)")
# 检查是否有残留的旧文件
old_files = ["auth.md", "code_quality.md", "performance.md", "testing.md"]
for old_file in old_files:
old_path = agents_lang / old_file
if old_path.exists():
warnings.append(f"⚠️ 残留旧文件: {old_path} (应删除)")
print("")
print("检查 Layer 2: codex/skills/ (按需加载)")
print("────────────────────────────────────────")
# 检查关键 skills
skills_base = Path("codex/skills")
required_skills = [
("tsl-guide", ["SKILL.md", "references/primer.md", "references/advanced.md"]),
("performance-optimization", ["SKILL.md"]),
("testing-workflow", ["SKILL.md"]),
]
for skill_name, required_files in required_skills:
skill_dir = skills_base / skill_name
if not skill_dir.exists():
errors.append(f"❌ 缺少 skill: {skill_dir}")
continue
# 检查必须存在的文件
required_files = ["index.md", "auth.md", "code_quality.md"]
for req_file in required_files:
file_path = agents_lang / req_file
file_path = skill_dir / req_file
if not file_path.exists():
errors.append(f"❌ 缺少文件: {file_path}")
elif file_path.stat().st_size == 0:
errors.append(f"❌ 文件为空: {file_path}")
else:
print(f"✅ {file_path}")
print("")
print("检查 Layer 3: docs/ (权威文档)")
print("────────────────────────────────────────")
# 检查关键文档路径
docs_paths = [
"docs/tsl/syntax_book/index.md",
"docs/tsl/code_style.md",
"docs/tsl/naming.md",
"docs/cpp/code_style.md",
"docs/python/style_guide.md",
]
for doc_path in docs_paths:
path = Path(doc_path)
if not path.exists():
errors.append(f"❌ 缺少文档: {doc_path}")
else:
print(f"✅ {doc_path}")
print("")
print("检查架构文档")
print("────────────────────────────────────────")
# 检查新增的架构文档
arch_docs = ["AGENTS.md", "SKILLS.md", "README.md"]
for doc in arch_docs:
path = Path(doc)
if not path.exists():
errors.append(f"❌ 缺少文档: {doc}")
else:
print(f"✅ {doc}")
print("")
print("────────────────────────────────────────")
if warnings:
print("\n⚠️ 警告:")
for warning in warnings:
print(f" {warning}")
print("")
if errors:
print("\n".join(errors))
print("\n❌ 发现错误:")
for error in errors:
print(f" {error}")
sys.exit(1)
else:
print("✅ 代理规则一致性检查通过")
print("✅ 三层架构完整性检查通过")
EOF
if [ $? -ne 0 ]; then