chore(repo): 移植 PR-First 提交流程门禁(脚本 + Gitea PR 模板)

对齐 novavis AGENTS.md §27,逐项按本仓实测改写,不照抄不存在的命令:
- scripts/check-pr-checklist.sh:三种模式(模板结构 / 单 PR 文件 / --pr-dir 扫描)
  与退出码 0/1/2 保持同源;模板根改为按脚本自身位置解析并保留 AGENT_PROJECT_DIR
  覆写;修上游 --pr-dir 的参数解析缺陷(for arg in "$@" 内 shift 不消费值,
  目录会被再当成 PR 文件),改 while+shift
- .gitea/PULL_REQUEST_TEMPLATE.md:30 项 checklist 全部换成本仓真实门禁命令
  (type-check / lint / test:unit / test:coverage 阈值 / Playwright / visual /
  check:contrast / check:headings / lighthouse / test:security:headers),并补
  CMS 字段-需重跑 seed 声明、:3000 旧预览不作数、暗黑 token、动效 180–280ms、
  品牌红触达、数字 basis 口径等本仓专有约束
- 文档同源:docs/development/quality-gates.md 新增「提交与 PR 流程」权威副本
  (AGENTS.md 被 .gitignore 排除,不可依赖)、CLAUDE.md 补 Submission Flow 节

门禁自检:脚本 bash -n 通过;11 个用例覆盖三模式 + 缺节/缺文件/子项不足/非 PR
文件/未知选項/--quiet 等负路径,均带正控制以防「匹配零的假绿」。
This commit is contained in:
2026-09-20 10:38:23 +08:00
parent 3ed3afd819
commit 43d1a7af38
4 changed files with 251 additions and 0 deletions
+5
View File
@@ -202,6 +202,11 @@ The project builds to `dist/` (configured via `distDir` in `next.config.mjs`). I
### Commit Convention
Uses Conventional Commits with commitlint (`@commitlint/config-conventional`). Husky + lint-staged enforces linting on pre-commit.
### Submission Flow (PR-First)
`dev`/`main` are only reached via feature branch + PR: sync `origin/dev` → rebase → push → PR gate → merge by **Rebase** (linear history, no merge commit).
`bash scripts/check-pr-checklist.sh <pr-description-file>` must pass before opening a PR — it verifies `.gitea/PULL_REQUEST_TEMPLATE.md` has the three required sections (全链路检查 / 测试分层检查 / 质量门禁) with ≥20 checklist items, and that every item in the PR body is checked (mark irrelevant ones as `N/A<reason>`).
Rebase rewrites hashes: an already-pushed branch may only be updated with `--force-with-lease`. Always rebase onto `origin/dev`, never a possibly-stale local `dev`.
### Component Versioning History
The project has gone through multiple design iterations. Older component versions:
- `components/detail-v2/` — previous iteration (deleted per git status, migration to `detail/` completed)