#!/usr/bin/env python3 """研发流水线 — 角色模型对照表生成脚本(通用模板) 读取自定义的 roles.yaml 配置文件,输出角色模型对照表。 用户需根据实际环境修改 references/roles.yaml 中的模型配置。 用法: python scripts/show_roles.py """ import yaml import os import sys from pathlib import Path def load_roles(): """加载 roles.yaml""" script_dir = Path(__file__).parent.parent / "references" roles_path = script_dir / "roles.yaml" if not roles_path.exists(): print(f"❌ 未找到 roles.yaml: {roles_path}") print("请复制 references/roles.example.yaml 为 references/roles.yaml 并修改配置") sys.exit(1) with open(roles_path) as f: return yaml.safe_load(f) def main(): roles_config = load_roles() roles = roles_config.get("roles", []) print("=" * 80) print("研发流水线 — 角色模型对照表") print("=" * 80) print("\n## 当前角色分配\n") print(f"{'角色':<12} {'代号':<8} {'阶段':<20} {'模型':<25}") print("-" * 70) for role in roles: stages = ", ".join(role.get("stages", [])) print(f"{role.get('emoji', '')} {role['name']:<10} {role['code']:<8} {stages:<20} {role['model']:<25}") # 一致性检查 print(f"\n## 一致性检查\n") print("✅ 请手动检查 roles.yaml 中的模型配置是否与您的 API 平台一致。") if __name__ == "__main__": main()