Protect PR merges with scoped quality gates

Pull requests need a deterministic way to show changed areas, required checks, missing-test signals, and CLI-core risk before review. This adds a path-based policy gate, local impact reporting, PR triage labels/comments, and reusable check scripts so reviewers can evaluate blast radius without trusting contributor claims.

Constraint: CLI core should remain effectively frozen unless a maintainer explicitly overrides it.
Constraint: Default PR checks must be safe for external forks and avoid live model/provider calls.
Rejected: Run live provider tests on every PR | secrets, cost, network, and vendor instability would make the gate noisy and unsafe.
Rejected: Use Dosu as the merge gate | AI review is useful for risk explanation, but deterministic Actions must own blocking checks.
Confidence: high
Scope-risk: moderate
Directive: Keep real model/provider smoke tests in maintainer-controlled workflows; do not make them required for untrusted PRs.
Tested: bun run check:impact
Tested: bun run check:policy
Tested: ruby YAML parse for PR workflows
Tested: git diff --check
Tested: bun run check:native
Tested: npm run docs:build
Tested: bun run scripts/pr/run-server-tests.ts
Tested: bun run check:adapters
Tested: bun run check:desktop
Not-tested: GitHub-hosted pull_request_target label/comment execution before opening this PR
This commit is contained in:
程序员阿江(Relakkes)
2026-05-02 11:01:07 +08:00
parent c13fa75c3b
commit fdf5fe2653
9 changed files with 1204 additions and 0 deletions
+8
View File
@@ -9,6 +9,14 @@
"scripts": {
"claude-haha": "bun run ./bin/claude-haha",
"start": "bun run ./bin/claude-haha",
"check:pr": "bun run scripts/pr/check-pr.ts",
"check:impact": "bun run scripts/pr/impact-report.ts",
"check:policy": "bun test scripts/pr/change-policy.test.ts",
"check:server": "bun run scripts/pr/run-server-tests.ts",
"check:desktop": "cd desktop && bun run lint && bun run test -- --run && bun run build",
"check:adapters": "cd adapters && bun test",
"check:native": "cd desktop && bun run build:sidecars && cd src-tauri && cargo check",
"check:docs": "npm ci && npm run docs:build",
"docs:dev": "vitepress dev docs",
"docs:build": "vitepress build docs",
"docs:preview": "vitepress preview docs"