@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.
@@ -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`, so wp-finish-upsert-pr
4
- # is the sole PR opener FOR HOOKED developers. The gap is UNHOOKED teammates who push + open a PR in the
5
- # GitHub web UI — nothing local stops them. This required check closes that gap: wp-finish-upsert-pr writes
6
- # HMAC(prGate.gateSalt, HEAD_sha) into the PR body, and this job recomputes it from the committed salt and
7
- # the PR head sha. A PR opened outside the gated flow carries no valid token and fails here.
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
- 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]
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
- contents: read
46
- pull-requests: read
45
+ contents: read
46
+ pull-requests: read
47
47
  jobs:
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
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. So every question about a
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`, so
10
- `wp-finish-upsert-pr` is the only way a PR gets opened — **for hooked developers**. The gap is an
11
- UNHOOKED teammate who pushes and opens a PR in the GitHub web UI. Nothing local can stop that.
12
-
13
- This CI check closes it: `wp-finish-upsert-pr` writes `HMAC(gateSalt, HEAD_sha)` into the PR body, and
14
- the workflow recomputes it from the committed salt and the PR head sha. A PR opened outside the gated
15
- flow carries no valid token and fails the check.
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