@webpieces/rules-config 0.4.630 → 0.4.632

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webpieces/rules-config",
3
- "version": "0.4.630",
3
+ "version": "0.4.632",
4
4
  "description": "Shared webpieces.config.json loader. Single source of truth for validation rule configuration consumed by @webpieces/ai-hook-rules, @webpieces/code-rules, and @webpieces/nx-webpieces-rules.",
5
5
  "type": "commonjs",
6
6
  "main": "./src/index.js",
@@ -10,15 +10,21 @@ reading this, one of the faults below fired and named this file.
10
10
 
11
11
  ## The faults
12
12
 
13
- | code | fault | detected by | enforced in |
14
- |---|---|---|---|
15
- | `D` | version drift root package.json pin != installed version | sh, before the bin runs | sh |
16
- | `X` | guard bin missing (fresh clone / new worktree / package removed) | sh, before the bin runs | sh |
17
- | `U` | guard bin missing AND @webpieces/ai-hook-rules is not declared in package.json | sh, before the bin runs | sh |
18
- | `K` | guard bin present but CRASHED (exit code not 0 or 2 — corrupt node_modules) | sh, before the bin runs | sh |
19
- | `S` | a webpieces-managed hook file, the .claude/settings.json registration or its managed env entry does not match this release | the guard bin | JS |
20
- | `C` | webpieces.config.json missing | the guard bin | JS |
21
- | `Y` | a loaded rule has no webpieces.config.json key | the guard bin | JS |
13
+ THE JOIN KEYS ARE `guard`, `fault=` and `row=`. Every L0 deny opens
14
+ `[<guard>] (layer=L0 fault=<code> row=3, …)`, and every audit line — from BOTH halves of L0, the
15
+ `sh` shim and the guard bin carries `layer=L0 row=<n> fault=<code>`. So one grep lands you in
16
+ the deny, the log line and the row below. The guard names come from `L0_FAULT_NAMES` and the row
17
+ numbers from `L0_ROW_*`, both spelled in exactly one place (`core/l0-fault-codes.ts`).
18
+
19
+ | code | guard | fault | detected by | enforced in |
20
+ |---|---|---|---|---|
21
+ | `D` | `version-drift` | version drift root package.json pin != installed version | sh, before the bin runs | sh |
22
+ | `X` | `guard-bin-missing` | guard bin missing (fresh clone / new worktree / package removed) | sh, before the bin runs | sh |
23
+ | `U` | `guard-pkg-undeclared` | guard bin missing AND @webpieces/ai-hook-rules is not declared in package.json | sh, before the bin runs | sh |
24
+ | `K` | `guard-bin-crashed` | guard bin present but CRASHED (exit code not 0 or 2 — corrupt node_modules) | sh, before the bin runs | sh |
25
+ | `S` | `managed-hook-surface` | a webpieces-managed hook file, the .claude/settings.json registration or its managed env entry does not match this release | the guard bin | JS |
26
+ | `C` | `config-missing` | webpieces.config.json missing | the guard bin | JS |
27
+ | `Y` | `config-out-of-sync` | a loaded rule has no webpieces.config.json key | the guard bin | JS |
22
28
 
23
29
  First match wins. `D`/`X`/`U`/`K` are decided in POSIX `sh` inside the committed shim, BEFORE the
24
30
  guard bin runs — a stale, missing or broken validator cannot be trusted to validate itself.
@@ -32,7 +38,7 @@ the option you pick EXACTLY as written and run nothing else on that line.
32
38
  ### `D` — version drift — root package.json pin != installed version
33
39
 
34
40
  - **Option 1 (preferred)**: `pnpm install` ← pick this when node_modules is OLDER than the pin, OR you are on a feature branch and want YOUR branch pin (usually the case) — it always clears the drift
35
- - **Option 2**: `git pull` ← pick this when node_modules is NEWER than the pin AND you are on main — the PIN is the stale side, so pull first and install second; a bare install would downgrade you
41
+ - **Option 2**: `git checkout main && git pull origin main` ← pick this when node_modules is NEWER than the pin AND you are on main — the PIN is the stale side, so sync first and install second; a bare install would downgrade you
36
42
 
37
43
  ### `X` — guard bin missing (fresh clone / new worktree / package removed)
38
44
 
@@ -70,13 +76,17 @@ L0 has NO genuine second dimension. Every branch reduces to one question:
70
76
  | 2 | any | yes | PASS or ALLOW (see the entry) |
71
77
  | 3 | any | no | BLOCK — **only the message varies by fault** |
72
78
 
79
+ Row 3 is the only row that blocks, so every L0 deny cites it — `row=3` in the
80
+ deny header, `row=3` on the audit line, and this row here. Same numbers as L1 uses for
81
+ its own rows (see `L1_ROWS`), and for the same reason: a row number is IDENTITY, so it is never reused.
82
+
73
83
  The tool is not a dimension either: "any Read" is an allowlist ENTRY, not a tool check.
74
84
 
75
85
  ## The allowlist
76
86
 
77
87
  ONE list, consulted identically by every fault. A cure that cannot help a given fault also
78
88
  cannot hurt it, and gating each entry on a fault is what produced four real defects (a stale
79
- shim that denied `pnpm install` and `git pull`; faults that denied every Read; a config fault
89
+ shim that denied `pnpm install` and every git sync; faults that denied every Read; a config fault
80
90
  that denied `rm -rf node_modules && pnpm install` while allowing a bare `pnpm install`).
81
91
 
82
92
  | # | allowed | outcome |
@@ -85,13 +95,14 @@ that denied `rm -rf node_modules && pnpm install` while allowing a bare `pnpm in
85
95
  | 2 | a Write/Edit whose target is webpieces.config.json | PASS |
86
96
  | 3 | pnpm|npm install | ALLOW |
87
97
  | 4 | rm -rf node_modules && pnpm install - the cure for a CORRUPT node_modules | ALLOW |
88
- | 5 | git pull / git fetch - merge is NOT on the list | ALLOW |
89
- | 6 | pnpm exec wp-upgrade-shim | ALLOW |
90
- | 7 | cp node_modules/@webpieces/ai-hook-rules/templates/ai-hook.sh .claude/webpieces/ai-hook.sh | ALLOW |
91
- | 8 | pnpm wp-prune-unknown-config | ALLOW |
92
- | 9 | pnpm exec wp-install-ai-hooks (flags allowed, e.g. --target=project) | ALLOW |
93
- | 10 | pnpm add -D @webpieces/ai-hook-rules (an @version and extra flags allowed) | ALLOW |
94
- | 11 | read-only orientation: pwd, git status/log/diff/show/branch/rev-parse, git worktree list | ALLOW |
98
+ | 5 | git fetch - a bare git pull and git merge are NOT on the list | ALLOW |
99
+ | 6 | git checkout main && git pull origin main | ALLOW |
100
+ | 7 | pnpm exec wp-upgrade-shim | ALLOW |
101
+ | 8 | cp node_modules/@webpieces/ai-hook-rules/templates/ai-hook.sh .claude/webpieces/ai-hook.sh | ALLOW |
102
+ | 9 | pnpm wp-prune-unknown-config | ALLOW |
103
+ | 10 | pnpm exec wp-install-ai-hooks (flags allowed, e.g. --target=project) | ALLOW |
104
+ | 11 | pnpm add -D @webpieces/ai-hook-rules (an @version and extra flags allowed) | ALLOW |
105
+ | 12 | read-only orientation: pwd, git status/log/diff/show/branch/rev-parse, git worktree list | ALLOW |
95
106
 
96
107
  - **PASS** — L0 has no objection; the call falls THROUGH so the downstream guards still judge it.
97
108
  - **ALLOW** — terminal; bypasses everything, because a cure must stay reachable even when a