@bookedsolid/rea 0.30.0 → 0.31.0
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/.husky/prepare-commit-msg +20 -1
- package/dist/cli/audit-specialists.d.ts +106 -24
- package/dist/cli/audit-specialists.js +239 -64
- package/dist/cli/delegation-advisory.d.ts +161 -0
- package/dist/cli/delegation-advisory.js +433 -0
- package/dist/cli/doctor.d.ts +110 -39
- package/dist/cli/doctor.js +333 -98
- package/dist/cli/hook.d.ts +6 -0
- package/dist/cli/hook.js +13 -0
- package/dist/cli/index.js +1 -1
- package/dist/cli/install/settings-merge.js +25 -0
- package/dist/cli/roster.d.ts +119 -0
- package/dist/cli/roster.js +141 -0
- package/dist/config/settings-schema.d.ts +13 -1
- package/dist/config/settings-schema.js +13 -2
- package/dist/policy/loader.d.ts +24 -1
- package/dist/policy/loader.js +61 -1
- package/dist/policy/profiles.d.ts +23 -0
- package/dist/policy/profiles.js +16 -0
- package/dist/policy/types.d.ts +61 -0
- package/hooks/delegation-advisory.sh +162 -0
- package/package.json +1 -1
- package/profiles/bst-internal-no-codex.yaml +12 -0
- package/profiles/bst-internal.yaml +13 -0
- package/profiles/client-engagement.yaml +11 -0
- package/profiles/lit-wc.yaml +10 -0
- package/profiles/minimal.yaml +11 -0
- package/profiles/open-source-no-codex.yaml +11 -0
- package/profiles/open-source.yaml +11 -0
- package/templates/prepare-commit-msg.husky.sh +20 -1
package/dist/cli/doctor.d.ts
CHANGED
|
@@ -109,56 +109,127 @@ export declare function checksFromProbeState(state: CodexProbeState): CheckResul
|
|
|
109
109
|
* `.claude/settings.json` under PreToolUse with matcher `Agent|Skill`
|
|
110
110
|
* AND that the hook file exists at the expected dogfood path.
|
|
111
111
|
*
|
|
112
|
-
* Status posture
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
* `defaultDesiredHooks()`
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
112
|
+
* Status posture:
|
|
113
|
+
*
|
|
114
|
+
* 0.29.0 shipped this check as `warn` (advisory) — the
|
|
115
|
+
* `defaultDesiredHooks()` entry was new, and existing consumer
|
|
116
|
+
* installs (plus this repo's own dogfood, locked from agent-driven
|
|
117
|
+
* edits by `settings-protection.sh`) wouldn't have the matcher
|
|
118
|
+
* registered until the operator ran `rea upgrade`. The comments
|
|
119
|
+
* promised promotion to `fail` "in 0.30.0".
|
|
120
|
+
*
|
|
121
|
+
* **0.31.0 makes good on that promise.** The 0.29.0 → 0.30.x consumer
|
|
122
|
+
* cycles have propagated; the `Agent|Skill` matcher has been in
|
|
123
|
+
* `defaultDesiredHooks()` for multiple minors. A consumer install
|
|
124
|
+
* that still lacks the registration is a real governance gap (the
|
|
125
|
+
* delegation telemetry — and now the 0.31.0 nudge — silently does
|
|
126
|
+
* nothing), so the check is `fail`. The detail message still names
|
|
127
|
+
* the exact `rea upgrade` fix.
|
|
128
128
|
*
|
|
129
129
|
* Hook-file presence is verified separately by `checkHooksInstalled`
|
|
130
|
-
* via `EXPECTED_HOOKS` — that path
|
|
131
|
-
* because file presence is part of the install manifest and doesn't
|
|
132
|
-
* suffer the same template-propagation lag.
|
|
130
|
+
* via `EXPECTED_HOOKS` — that path was always hard-`fail`.
|
|
133
131
|
*/
|
|
134
132
|
export declare function checkDelegationHookRegistered(baseDir: string): CheckResult;
|
|
133
|
+
/**
|
|
134
|
+
* 0.31.0 — verify the delegation-advisory hook is registered in
|
|
135
|
+
* `.claude/settings.json` under PostToolUse with matcher
|
|
136
|
+
* `Bash|Edit|Write|MultiEdit|NotebookEdit`, that a
|
|
137
|
+
* `delegation-advisory.sh` command is present in that group, AND that
|
|
138
|
+
* the `.claude/hooks/delegation-advisory.sh` file actually exists.
|
|
139
|
+
*
|
|
140
|
+
* Status posture: `warn` (advisory) for 0.31.0. This is a brand-new
|
|
141
|
+
* `defaultDesiredHooks()` entry — the exact same upgrade-lag situation
|
|
142
|
+
* `checkDelegationHookRegistered` faced in 0.29.0. Existing consumer
|
|
143
|
+
* installs (and this repo's own dogfood, locked from agent-driven
|
|
144
|
+
* edits by `settings-protection.sh`) won't have the PostToolUse group
|
|
145
|
+
* until the operator runs `rea upgrade`. Holding at `warn` for one
|
|
146
|
+
* release cycle keeps `rea doctor` green during propagation; a future
|
|
147
|
+
* minor promotes it to `fail` once consumer installs have caught up —
|
|
148
|
+
* the same ratchet `checkDelegationHookRegistered` just completed.
|
|
149
|
+
*
|
|
150
|
+
* The hook is ALSO advisory at runtime (it never blocks a tool call,
|
|
151
|
+
* and `policy.delegation_advisory` defaults to disabled), so a missing
|
|
152
|
+
* registration is a lower-stakes gap than a missing security gate —
|
|
153
|
+
* `warn` is proportionate even setting the upgrade-lag aside.
|
|
154
|
+
*
|
|
155
|
+
* # Why this check verifies file presence AND executability (round-2/3 P2)
|
|
156
|
+
*
|
|
157
|
+
* `delegation-advisory.sh` is deliberately NOT in `EXPECTED_HOOKS` for
|
|
158
|
+
* 0.31.0 (staged rollout — see the `EXPECTED_HOOKS` comment). That
|
|
159
|
+
* leaves THIS function as the only 0.31.0 doctor signal covering the
|
|
160
|
+
* new hook, so it must check the file too:
|
|
161
|
+
*
|
|
162
|
+
* - File MISSING — a settings.json that references
|
|
163
|
+
* `delegation-advisory.sh` while the actual script is absent (a
|
|
164
|
+
* partial `rea upgrade`, manual drift) would otherwise report
|
|
165
|
+
* `pass`, and every matching PostToolUse dispatch would shell out
|
|
166
|
+
* to a nonexistent path.
|
|
167
|
+
* - File present but NOT EXECUTABLE — a script copied without its
|
|
168
|
+
* mode bits (a manual `cp`, an archive extracted without `+x`
|
|
169
|
+
* preservation) cannot be launched by Claude Code from
|
|
170
|
+
* `settings.json` at all. `checkHooksInstalled` performs this exact
|
|
171
|
+
* `0o111` check for every `EXPECTED_HOOKS` entry; because
|
|
172
|
+
* `delegation-advisory.sh` is held out of that list, the parity
|
|
173
|
+
* check has to live here.
|
|
174
|
+
*
|
|
175
|
+
* Both failures are held at the same `warn` tier as the registration
|
|
176
|
+
* failures: consistent posture for 0.31.0, and they promote to `fail`
|
|
177
|
+
* alongside them — at which point `delegation-advisory.sh` also joins
|
|
178
|
+
* `EXPECTED_HOOKS` and gets the hard-`fail` `checkHooksInstalled`
|
|
179
|
+
* coverage (presence + executability) the other hooks have.
|
|
180
|
+
*/
|
|
181
|
+
export declare function checkDelegationAdvisoryHookRegistered(baseDir: string): CheckResult;
|
|
135
182
|
/**
|
|
136
183
|
* 0.29.0 — synthetic round-trip of the delegation-signal audit path.
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
* (same path the shell hook hits) and asserts:
|
|
184
|
+
* 0.31.0 — drives the REAL `.claude/hooks/delegation-capture.sh` shell
|
|
185
|
+
* hook, not just the `rea hook delegation-signal` CLI underneath it.
|
|
140
186
|
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
187
|
+
* Feeds a synthetic Claude Code PreToolUse hook payload to the shell
|
|
188
|
+
* hook (the exact entry point Claude Code's `Agent|Skill` matcher
|
|
189
|
+
* invokes in production) and asserts:
|
|
190
|
+
*
|
|
191
|
+
* - The shell hook exited 0.
|
|
192
|
+
* - A new `rea.delegation_signal` record landed on disk — the smoke
|
|
193
|
+
* check POLLS for it, because `delegation-capture.sh` backgrounds
|
|
194
|
+
* + disowns the CLI (`& disown`) so the shell hook returns before
|
|
195
|
+
* the audit append completes.
|
|
143
196
|
* - The record's metadata contains the probe tag (so we don't
|
|
144
197
|
* mistakenly attribute an existing record to our run).
|
|
198
|
+
* - The recorded `invocation_description_sha256` matches the
|
|
199
|
+
* expected hash of the probe description.
|
|
145
200
|
* - Chain integrity holds (recomputed hash == stored hash).
|
|
146
201
|
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
-
*
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
*
|
|
202
|
+
* # Why drive the shell hook, not the CLI directly
|
|
203
|
+
*
|
|
204
|
+
* 0.29.0's version spawned `rea hook delegation-signal` directly. That
|
|
205
|
+
* exercised the CLI's stdin parsing / hashing / redaction / process-
|
|
206
|
+
* lifecycle — but NOT the shell shim's own logic: the 2-tier sandboxed
|
|
207
|
+
* CLI resolution, the realpath sandbox check, the `& disown`
|
|
208
|
+
* backgrounding. A regression in the shim (a botched resolution order,
|
|
209
|
+
* a sandbox check that rejects the legitimate dogfood CLI, a
|
|
210
|
+
* backgrounding bug that drops the signal) would pass 0.29.0's smoke
|
|
211
|
+
* check while breaking production. 0.31.0 closes that gap: the smoke
|
|
212
|
+
* check now invokes `bash .claude/hooks/delegation-capture.sh` and
|
|
213
|
+
* the CLI is reached only through the shim.
|
|
214
|
+
*
|
|
215
|
+
* # Prerequisites and graceful degradation
|
|
216
|
+
*
|
|
217
|
+
* The check needs THREE things and degrades to `warn` (not `fail`)
|
|
218
|
+
* when any is absent — a missing prerequisite is an environment gap,
|
|
219
|
+
* not a wiring regression:
|
|
220
|
+
*
|
|
221
|
+
* - `bash` on PATH.
|
|
222
|
+
* - `.claude/hooks/delegation-capture.sh` present (the consumer
|
|
223
|
+
* install path; absent before `rea init` / `rea upgrade`).
|
|
224
|
+
* - A sandboxed rea CLI the shim can resolve — either
|
|
225
|
+
* `<baseDir>/node_modules/@bookedsolid/rea/dist/cli/index.js` OR
|
|
226
|
+
* `<baseDir>/dist/cli/index.js` (the rea-repo dogfood). Without
|
|
227
|
+
* one the shim silently drops the signal by design, so the smoke
|
|
228
|
+
* check would time out waiting for a record that will never land.
|
|
229
|
+
*
|
|
230
|
+
* Gated behind `--smoke` so a casual `rea doctor` doesn't write probe
|
|
231
|
+
* records on every invocation. Operators run `rea doctor --smoke`
|
|
232
|
+
* after install / upgrade to confirm the pipeline is wired end-to-end.
|
|
162
233
|
*/
|
|
163
234
|
export declare function checkDelegationRoundTrip(baseDir: string): Promise<CheckResult>;
|
|
164
235
|
/**
|