From 9fa270bb09e8c351605729c40c18940cdf038e0b Mon Sep 17 00:00:00 2001 From: randypanding <66171646+randypanding@users.noreply.github.com> Date: Tue, 18 Aug 2026 10:05:23 +0000 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=BB=84=E7=BB=87=E5=9C=B0=E5=9B=BE=20?= =?UTF-8?q?REPOS.yaml=EF=BC=88=E7=BB=93=E6=9E=84=E5=B1=82=E5=AF=BC?= =?UTF-8?q?=E8=88=AA=EF=BC=89+=20drift-check=20=C2=A77=20=E4=BB=93?= =?UTF-8?q?=E7=94=B3=E6=8A=A5=E6=A0=A1=E9=AA=8C=EF=BC=88GM-4=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- governance/GOVERNANCE.yaml | 6 ++++ governance/REPOS.yaml | 65 ++++++++++++++++++++++++++++++++++++++ governance/drift-check.sh | 23 ++++++++++++++ profile/README.md | 14 +++++--- 4 files changed, 103 insertions(+), 5 deletions(-) create mode 100644 governance/REPOS.yaml diff --git a/governance/GOVERNANCE.yaml b/governance/GOVERNANCE.yaml index b9bd7aa..6c526e3 100644 --- a/governance/GOVERNANCE.yaml +++ b/governance/GOVERNANCE.yaml @@ -125,6 +125,11 @@ domains: intent: "政策文件机器可判定(本目录);agent 按需读取,不常驻上下文" strength: advisory files: [policy/languages.yaml, policy/testing.yaml] + - id: GM-4 + intent: "组织地图 REPOS.yaml 声明全部仓(层级/角色/可见性/状态):结构层导航的唯一入口;线上未申报仓=漂移;active 仓存在性与 visibility 周检;新仓初始化后必须申报入图(见 flows.new_repo)" + strength: enforced + files: [REPOS.yaml] + verify: {method: drift-check, part: section-7, frequency: weekly} context_governance: measures: @@ -175,6 +180,7 @@ flows: steps: - {cmd: "gh repo create / --template /template-service --public --clone"} - {cmd: "bash new-repo-init.sh ", effects: [BP-4, RL-1, AG-4]} + - {pr: "申报入 governance/REPOS.yaml(name/layer/visibility/role/status:active)", policy: GM-4} - {pr: "首PR:按 policy/languages.yaml 选型 + dep-cruise 边界规则 + 模块 AGENTS.md"} rewrite_project: # 如 Go 重写 rules: diff --git a/governance/REPOS.yaml b/governance/REPOS.yaml new file mode 100644 index 0000000..128bac7 --- /dev/null +++ b/governance/REPOS.yaml @@ -0,0 +1,65 @@ +version: 1 +org: Cloudbird-Software +# ============================================================================ +# 组织地图(repo registry)—— 一文件看清治理版图 +# 目的: 结构层导航(人/AI 不必逐仓打开即知全貌)+ 漂移检测锚点。 +# 替代 submodule 方案:无指针过期、无 recursive clone 问题。 +# 规则(GM-4): +# - 线上存在的仓必须在下方申报;未申报 = drift(drift-check §7b) +# - status: active 的仓必须存在且 visibility 一致(drift-check §7a) +# - status: planned = 尚未建仓(不参与检测);exempt = 申报但不治理 +# - 新仓初始化后必须申报入图(flows.new_repo step 4) +# ============================================================================ +layers: + L0: 标准与治理(intent:GOVERNANCE / 标准 schema / 工作流实现) + L1: 注册条目(声明:agent / skill / tool / team / 模型别名 / ADR) + L2: 实现(代码:框架、工具、业务项目) + L3: 数据(不进 git:事件流 / 轨迹 / 团队运行态) + +repos: + - name: .github + layer: L0 + visibility: public + status: active + role: 治理总仓——GOVERNANCE/rulesets/expected-state/policies/agent 标准 schema/初始化与漂移脚本 + key_paths: [governance/, standards/agent/, scripts/] + + - name: CI-Workflows + layer: L0 + visibility: public + status: active + role: 可复用工作流仓——全部项目仓 gate 的唯一实现,业务仓引用 @v1 + key_paths: [.github/workflows/] + + - name: agent-registry + layer: L1 + visibility: private + status: active + role: 注册层——agent/skill/tool/team 声明 + 模型注册表(models.yaml) + ADR;AR-2 状态门禁校验器 + key_paths: [registry/, decisions/, scripts/validate.py] + policies: [agent_runtime] + + - name: template-service + layer: L2 + visibility: public + status: active + role: 项目模板仓——新仓由此派生,自动继承 gate/护栏/AGENTS.md 骨架 + key_paths: [AGENTS.md, .github/workflows/ci.yml, docs/ARCHITECTURE.md] + + - name: openjiuwen + layer: L2 + visibility: private + status: planned + role: 编排框架私有仓(推入/维护)——多智能体运行时 + LLM Gateway 部署配置(deploy/llm-gateway) + + - name: agent-tools + layer: L2 + visibility: private + status: planned + role: 自研工具实现仓——被 tool 声明的 implementation 字段引用 + + - name: AI_Web_School + layer: L2 + visibility: public + status: exempt + role: 历史产品仓——申报在册但豁免治理基线(repo_baseline.exclude_repos) diff --git a/governance/drift-check.sh b/governance/drift-check.sh index ab22816..882593c 100755 --- a/governance/drift-check.sh +++ b/governance/drift-check.sh @@ -113,6 +113,29 @@ else drift "github app '$(jq -r .github_app.name "$EXPECTED")' 不存在或 id 不符" fi +# ---------- 7. 组织地图(REPOS.yaml):存在性 / visibility / 未申报仓 ---------- +if python3 -c 'import yaml' 2>/dev/null; then + REPO_MAP=$(python3 -c 'import yaml,json,sys;print(json.dumps(yaml.safe_load(open(sys.argv[1]))))' "$DIR/REPOS.yaml") + # 7a. active 仓:必须存在且 visibility 一致 + while IFS=$'\t' read -r r want_vis; do + [[ -n "$r" ]] || continue + RR=$(api "https://api.github.com/repos/$ORG/$r") + if [[ "$(jq -r 'if .message then .message else "" end' <<<"$RR")" == "Not Found" ]]; then + drift "REPOS.yaml 申报的 active 仓 '$r' 不存在"; continue + fi + got_vis=$(jq -r 'if .private then "private" else "public" end' <<<"$RR") + [[ "$got_vis" == "$want_vis" ]] || drift "repo '$r' visibility=$got_vis 期望=$want_vis" + ok "REPOS map '$r'" + done < <(jq -r '.repos[] | select(.status=="active") | "\(.name)\t\(.visibility)"' <<<"$REPO_MAP") + # 7b. 线上仓必须在图中申报(任何 status 均可,未申报即漂移) + for r in $REPOS; do + jq -e --arg r "$r" '[.repos[].name] | index($r) != null' <<<"$REPO_MAP" >/dev/null \ + || drift "线上仓 '$r' 未在 governance/REPOS.yaml 申报(补申报,或标 exempt 注明原因)" + done +else + echo "SKIP REPOS.yaml 校验(环境缺 python3+pyyaml;GitHub runner 自带)" +fi + echo "----------------------------------------" if [[ $DRIFTS -gt 0 ]]; then echo "结果: $DRIFTS 项漂移。修复: bash governance/apply.sh 或手动改回" diff --git a/profile/README.md b/profile/README.md index bbe1db8..67e2538 100644 --- a/profile/README.md +++ b/profile/README.md @@ -12,8 +12,12 @@ ## 仓库 -| 仓库 | 用途 | -|---|---| -| [CI-Workflows](https://github.com/Cloudbird-Software/CI-Workflows) | 可复用工作流(唯一真相源) | -| [template-service](https://github.com/Cloudbird-Software/template-service) | 新项目模板 | -| [AI_Web_School](https://github.com/Cloudbird-Software/AI_Web_School) | 产品仓库 | +组织地图(结构层导航的唯一真源):[governance/REPOS.yaml](../governance/REPOS.yaml) + +| 仓库 | 层 | 用途 | +|---|---|---| +| [.github](https://github.com/Cloudbird-Software/.github) | L0 | 治理总仓:GOVERNANCE / 标准 schema / 漂移检测 | +| [CI-Workflows](https://github.com/Cloudbird-Software/CI-Workflows) | L0 | 可复用工作流(唯一真相源) | +| [agent-registry](https://github.com/Cloudbird-Software/agent-registry) | L1 | agent/skill/tool/team 声明 + 模型注册表 + ADR(私有) | +| [template-service](https://github.com/Cloudbird-Software/template-service) | L2 | 新项目模板 | +| [AI_Web_School](https://github.com/Cloudbird-Software/AI_Web_School) | L2 | 产品仓库 |