Files
superpowers-zh/.github/workflows/audit.yml
AI不止语 98ce004193 chore(ci): 加 audit 脚本 + workflow 自动检测上游漂移 (#31)
防回归基建:把本轮全量质量审计的 4 类检查打包成可重复运行的脚本,
每次 PR 自动跑,发现漂移立刻拦下。

scripts/audit.sh:
1. 静态校验:JSON parse、SKILL.md frontmatter、symlink、hook 可执行性
2. Installer 功能:17 款工具装 / 重装(幂等)/ 卸载全跑一遍
3. 上游对齐:hooks 4 文件 + brainstorm scripts 3 文件 + 14 翻译 skill
   结构层级(H1-H4 标题数)+ code-reviewer.md self-contained 版结构
4. 交叉引用:README → docs/ 链接、skill 间 superpowers:xxx 引用、
   装完后 .claude/skills/using-superpowers/SKILL.md 路径解析

支持 --quick(跳过 installer)和 --no-upstream(跳过对齐)两个开关。

.github/workflows/audit.yml:
- 触发:PR + push to main + 手动 dispatch
- 步骤:checkout(fetch-depth 0)+ setup node 20 + 加 upstream remote
  + fetch upstream main 浅克隆 + 跑 audit.sh
- FAIL > 0 → 整个 workflow 失败,PR 被卡

设计原则:
- 这次"4 个 P0 缺陷漂"事件(hooks-cursor + brainstorm + code-reviewer 引用 +
  code-reviewer.md 整合)如果当时有这个 audit 在 CI 跑,PR 阶段就会被拦下
- 用 H 数对齐而不是行数 diff 来判断结构漂移(避免翻译造成的假阳性)
- WARN(不阻塞)vs FAIL(阻塞)分级:主动扩写算 WARN,
  结构性落后上游算 FAIL

本地烟测:
- main 分支跑:92 PASS / 2 WARN / 8 FAIL(捕获到所有已知漂移)
- chore/sync-upstream-p0-drift(PR #30)跑:97 PASS / 2 WARN / 0 FAIL(PR 修复后全绿)

后续:PR #28 + #30 merge 后,main 上 FAIL 应归零(WARN 只剩 executing-plans
主动扩写一项)。
2026-05-12 18:13:12 +08:00

30 lines
610 B
YAML

name: Audit
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
audit:
name: 上游对齐 + 交叉引用 + Installer 功能 全量审计
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Add upstream remote
run: |
git remote add upstream https://github.com/obra/superpowers.git
git fetch upstream main --depth=50
- name: Run audit
run: bash scripts/audit.sh