@webpieces/rules-config 0.4.822 → 0.4.824
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/home-config-keys.d.ts +0 -6
- package/src/home-config-keys.js +2 -8
- package/src/home-config-keys.js.map +1 -1
- package/src/home-config-retired-keys.js +2 -0
- package/src/home-config-retired-keys.js.map +1 -1
- package/src/home-config.d.ts +2 -5
- package/src/home-config.js +5 -21
- package/src/home-config.js.map +1 -1
- package/src/index.d.ts +2 -2
- package/src/index.js +8 -9
- package/src/index.js.map +1 -1
- package/src/pr-gate-config.d.ts +9 -4
- package/src/pr-gate-config.js +20 -8
- package/src/pr-gate-config.js.map +1 -1
- package/src/pr-gate-section-validators.d.ts +1 -0
- package/src/pr-gate-section-validators.js +24 -1
- package/src/pr-gate-section-validators.js.map +1 -1
- package/src/review-json-data.d.ts +3 -2
- package/src/review-json-data.js +10 -9
- package/src/review-json-data.js.map +1 -1
- package/src/review-json.d.ts +6 -3
- package/src/review-json.js +58 -59
- package/src/review-json.js.map +1 -1
- package/src/reviewer-instructions.d.ts +5 -0
- package/src/reviewer-instructions.js +15 -0
- package/src/reviewer-instructions.js.map +1 -1
- package/src/validate-config.js +1 -0
- package/src/validate-config.js.map +1 -1
- package/templates/webpieces-pr-gate.yml +33 -33
- package/templates/webpieces.buildlog.md +3 -1
- package/templates/webpieces.ci-gate-setup.md +8 -7
- package/templates/webpieces.git-workflow.md +9 -0
- package/templates/webpieces.review-checklists.md +6 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# Webpieces PR gate — the SERVER-SIDE half of the gate.
|
|
2
2
|
#
|
|
3
|
-
# WHY: locally, pr-creation-or-push-guard blocks `gh pr create` / manual `git push
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
#
|
|
7
|
-
# the
|
|
3
|
+
# WHY: locally, pr-creation-or-push-guard blocks `gh pr create` / manual `git push`. The automated
|
|
4
|
+
# wp-finish-upsert-pr flow and the interactive, human-only wp-human-post-pr escape hatch both write
|
|
5
|
+
# HMAC(prGate.gateSalt, HEAD_sha) into the PR body. This required check recomputes it from the committed
|
|
6
|
+
# salt and PR head sha. A PR opened outside either supported path carries no valid token and fails here;
|
|
7
|
+
# the visible PR body says whether automated review/build ran or a human explicitly bypassed it.
|
|
8
8
|
#
|
|
9
9
|
# TO ENABLE (client repo):
|
|
10
10
|
# 1. Copy this file to .github/workflows/webpieces-pr-gate.yml and commit it.
|
|
@@ -30,33 +30,33 @@
|
|
|
30
30
|
|
|
31
31
|
name: Webpieces PR Gate
|
|
32
32
|
on:
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
33
|
+
pull_request:
|
|
34
|
+
# `synchronize` is the primary trigger and catches an unhooked teammate pushing over a gated PR. The
|
|
35
|
+
# gated flow pushes exactly ONCE per cycle (from wp-finish-upsert-pr, after the PR body is written),
|
|
36
|
+
# so the synchronize run always reads the correct token.
|
|
37
|
+
#
|
|
38
|
+
# `edited` is the BODY-TAMPER guard: the token lives in the PR body, so an edit that strips it must
|
|
39
|
+
# re-run this check rather than leave a stale green. Keep it. Note it fires on wp-finish's body write,
|
|
40
|
+
# a beat BEFORE that push — so its run can briefly resolve the OLD head sha and go red. Harmless: that
|
|
41
|
+
# red is keyed to a sha that is no longer the PR head, and branch protection evaluates the current
|
|
42
|
+
# head, where the synchronize run lands green.
|
|
43
|
+
types: [opened, edited, synchronize, reopened]
|
|
44
44
|
permissions:
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
contents: read
|
|
46
|
+
pull-requests: read
|
|
47
47
|
jobs:
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
48
|
+
webpieces-pr-gate:
|
|
49
|
+
runs-on: ubuntu-latest
|
|
50
|
+
steps:
|
|
51
|
+
- uses: actions/checkout@v4
|
|
52
|
+
- uses: pnpm/action-setup@v4
|
|
53
|
+
- uses: actions/setup-node@v4
|
|
54
|
+
with:
|
|
55
|
+
node-version: 20
|
|
56
|
+
cache: pnpm
|
|
57
|
+
- run: pnpm install --frozen-lockfile
|
|
58
|
+
- name: Verify webpieces gate token
|
|
59
|
+
env:
|
|
60
|
+
GH_TOKEN: ${{ github.token }}
|
|
61
|
+
WP_PR_NUMBER: ${{ github.event.pull_request.number }}
|
|
62
|
+
run: pnpm wp-check-pr
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
# Where the build's output is — read the printed path, never a remembered one
|
|
2
2
|
|
|
3
3
|
`pnpm wp-build` and the PR gate's build stages send the build's **entire** stdout and stderr to a FILE.
|
|
4
|
-
Your terminal gets a heartbeat and a summary; it never gets the build output.
|
|
4
|
+
Your terminal gets a heartbeat and a summary; it normally never gets the build output. The deliberate
|
|
5
|
+
exception is a human answering Y to the build prompt in `wp-human-post-pr`: that interactive command
|
|
6
|
+
follows the same durable `build.log` live until `wp-build` completes. So every later question about a
|
|
5
7
|
build ("what failed", "did the tests run", "what was that warning") is answered by reading a file — never
|
|
6
8
|
by running the build again.
|
|
7
9
|
|
|
@@ -6,13 +6,14 @@ work that could not act on them anyway: step 3 needs a repo admin.
|
|
|
6
6
|
|
|
7
7
|
## What this is for
|
|
8
8
|
|
|
9
|
-
Locally, `pr-creation-or-push-guard` blocks `gh pr create` and manual `git push
|
|
10
|
-
`wp-finish-upsert-pr
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
Locally, `pr-creation-or-push-guard` blocks direct `gh pr create` and manual `git push`. Hooked
|
|
10
|
+
developers have two supported posters: the normal automated `wp-finish-upsert-pr`, and the interactive
|
|
11
|
+
human-only `wp-human-post-pr` escape hatch, whose body visibly says review was skipped and whether its
|
|
12
|
+
optional local `wp-build` ran or validation was deferred to cloud CI.
|
|
13
|
+
|
|
14
|
+
Both supported paths write the same `HMAC(gateSalt, HEAD_sha)` into the PR body, and the workflow
|
|
15
|
+
recomputes it from the committed salt and PR head sha. The token proves a supported path minted it;
|
|
16
|
+
the visible PR body distinguishes automated-gate success from explicit human attestation.
|
|
16
17
|
|
|
17
18
|
## The three steps
|
|
18
19
|
|
|
@@ -32,6 +32,15 @@ verified, and stage ③ re-runs the build ONLY if HEAD moved since — three sta
|
|
|
32
32
|
All three stages are required and none may be skipped: stage ③ refuses to post a PR unless stage ② has
|
|
33
33
|
run on this branch AND summary.json exists.
|
|
34
34
|
|
|
35
|
+
### Separate human-only escape hatch
|
|
36
|
+
|
|
37
|
+
`pnpm wp-human-post-pr` is not stage ④ and is never an AI cure. A human who has personally inspected the
|
|
38
|
+
work may run it interactively and answer its attestation. It requires a clean feature branch, a freshly
|
|
39
|
+
fetched `origin/main`, an exact pure-main fork point, and valid `summary.json`; it then creates or updates
|
|
40
|
+
offers to run `pnpm wp-build` locally while following `build.log` live, or defer validation to cloud CI, then posts
|
|
41
|
+
the PR with one push and a visible warning that automated reviewers were skipped and whether the local build ran. It never
|
|
42
|
+
updates a stale branch and never merges the PR. AI must not run it for a human or answer `human`.
|
|
43
|
+
|
|
35
44
|
### Emergency `/hotfix/` branches
|
|
36
45
|
|
|
37
46
|
An exact, case-sensitive `/hotfix/` path segment selects the auditable emergency profile. Its flow is:
|
|
@@ -10,6 +10,7 @@ reviewed by the ONE reviewer agent — `webpieces-reviewer` unless you override
|
|
|
10
10
|
```jsonc
|
|
11
11
|
"commands": { "pr-gate": {
|
|
12
12
|
"reviewerAgents": 1, // REQUIRED — 0 disables reviews; see below
|
|
13
|
+
"maxReviewerRounds": 2, // REQUIRED — complete global review rounds; see below
|
|
13
14
|
"checklists": [
|
|
14
15
|
{ "id": "db-migrations",
|
|
15
16
|
"doc": ".claude/review/db-migrations.md",
|
|
@@ -27,6 +28,11 @@ reviewed by the ONE reviewer agent — `webpieces-reviewer` unless you override
|
|
|
27
28
|
|
|
28
29
|
## `overrideReviewerAgent`, `reviewerAgentName` and `reviewerAgents` — who reviews, and how many of them
|
|
29
30
|
|
|
31
|
+
`maxReviewerRounds` is a separate required positive integer. It caps complete global reviewer cycles for
|
|
32
|
+
one PR review state. `1` buys the initial full review only; `2` buys that review plus one focused review of
|
|
33
|
+
the author's remediation delta. Re-running stage ② while a round is still active resumes that round and
|
|
34
|
+
does not consume another. The key remains explicit when `reviewerAgents` is `0`, though it is inactive.
|
|
35
|
+
|
|
30
36
|
- **The reviewer agent** is the `subagent_type` every reviewer is spawned as. By default — write nothing —
|
|
31
37
|
it is `webpieces-reviewer`, a generic, checklist-agnostic reviewer that webpieces owns:
|
|
32
38
|
`wp-install-ai-hooks` and `pnpm wp-upgrade-shim` write it to `.claude/agents/webpieces-reviewer.md`, and a
|