@bookedsolid/rea 0.38.0 → 0.38.1

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.
@@ -317,42 +317,60 @@ shim_run() {
317
317
  # (instead of double-emitting sandbox + cli-missing).
318
318
  local sandbox_result=""
319
319
  local sandbox_failed=0
320
+ local node_missing=0
320
321
  if [ "${#REA_ARGV[@]}" -gt 0 ]; then
321
322
  if ! command -v node >/dev/null 2>&1; then
322
- if [ "$SHIM_FAIL_OPEN" -eq 1 ]; then
323
- exit 0
324
- fi
325
- # Blocking-tier: node missing means we cannot sandbox-validate the
326
- # CLI refuse with the dedicated banner.
327
- shim_emit_node_missing_banner
328
- exit 2
329
- fi
330
- sandbox_result=$(shim_sandbox_check "$RESOLVED_CLI_PATH" "$proj" "$SHIM_ENFORCE_CLI_SHAPE")
331
- if [ "$sandbox_result" != "ok" ]; then
332
- sandbox_failed=1
333
- if [ "$SHIM_FAIL_OPEN" -eq 1 ]; then
334
- shim_emit_sandbox_skip_banner "$sandbox_result"
335
- exit 0
336
- fi
337
- # Blocking-tier: clear REA_ARGV so Tier-1 policy reads (in
338
- # shim_policy_short_circuit) degrade to Tier 2 / Tier 3 instead
339
- # of invoking the untrusted CLI.
323
+ # 0.38.1 round-2 P2 fix: pre-fix this branch exited 0/2 IMMEDIATELY
324
+ # without ever calling shim_policy_short_circuit, so a blocking-
325
+ # tier shim whose policy said "disabled" still refused when node
326
+ # was absent (which contradicts the pre-port body's no-op-on-
327
+ # disabled posture). Clear REA_ARGV here so Tier 1 (rea CLI)
328
+ # can't fire — the policy reader degrades to Tier 2 (python3) /
329
+ # Tier 3 (awk), neither of which needs node. Track node-missing
330
+ # separately so the CLI-required branch below can emit the right
331
+ # banner if the policy did NOT short-circuit us out.
332
+ node_missing=1
340
333
  REA_ARGV=()
334
+ else
335
+ sandbox_result=$(shim_sandbox_check "$RESOLVED_CLI_PATH" "$proj" "$SHIM_ENFORCE_CLI_SHAPE")
336
+ if [ "$sandbox_result" != "ok" ]; then
337
+ sandbox_failed=1
338
+ if [ "$SHIM_FAIL_OPEN" -eq 1 ]; then
339
+ shim_emit_sandbox_skip_banner "$sandbox_result"
340
+ exit 0
341
+ fi
342
+ # Blocking-tier: clear REA_ARGV so Tier-1 policy reads (in
343
+ # shim_policy_short_circuit) degrade to Tier 2 / Tier 3 instead
344
+ # of invoking the untrusted CLI.
345
+ REA_ARGV=()
346
+ fi
341
347
  fi
342
348
  fi
343
349
 
344
- # 6. Policy short-circuit. Runs BEFORE the CLI-missing branch so a
345
- # shim whose policy says "disabled" exits 0 cleanly even when the
346
- # CLI is unbuilt (matches the pre-port body's no-op-on-disabled
347
- # posture). The policy reader's 4-tier ladder produces correct
348
- # answers even when REA_ARGV is empty (falls back to Tier 2
349
- # python3 / Tier 3 awk).
350
+ # 6. Policy short-circuit. Runs BEFORE the CLI-missing / node-missing
351
+ # banners so a shim whose policy says "disabled" exits 0 cleanly
352
+ # even when the CLI is unbuilt OR node is absent (matches the
353
+ # pre-port body's no-op-on-disabled posture). The policy reader's
354
+ # 4-tier ladder produces correct answers when REA_ARGV is empty:
355
+ # falls back to Tier 2 python3 if available, or Tier 3 awk
356
+ # (block-form only) otherwise.
350
357
  if declare -F shim_policy_short_circuit >/dev/null 2>&1; then
351
358
  if shim_policy_short_circuit; then
352
359
  exit 0
353
360
  fi
354
361
  fi
355
362
 
363
+ # 6b. node-missing fail branch — only fires if shim_policy_short_circuit
364
+ # did NOT exit us out above. Emits the dedicated node-missing
365
+ # banner for blocking-tier; advisory-tier exits 0 silently.
366
+ if [ "$node_missing" -eq 1 ]; then
367
+ if [ "$SHIM_FAIL_OPEN" -eq 1 ]; then
368
+ exit 0
369
+ fi
370
+ shim_emit_node_missing_banner
371
+ exit 2
372
+ fi
373
+
356
374
  # 7. CLI-required branch. If REA_ARGV is empty either (a) the CLI
357
375
  # wasn't installed/built, OR (b) the sandbox check failed and we
358
376
  # cleared it above. Distinguish.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bookedsolid/rea",
3
- "version": "0.38.0",
3
+ "version": "0.38.1",
4
4
  "description": "Agentic governance layer for Claude Code — policy enforcement, hook-based safety gates, audit logging, and Codex-integrated adversarial review for AI-assisted projects",
5
5
  "license": "MIT",
6
6
  "author": "Booked Solid Technology <oss@bookedsolid.tech> (https://bookedsolid.tech)",
@@ -317,42 +317,60 @@ shim_run() {
317
317
  # (instead of double-emitting sandbox + cli-missing).
318
318
  local sandbox_result=""
319
319
  local sandbox_failed=0
320
+ local node_missing=0
320
321
  if [ "${#REA_ARGV[@]}" -gt 0 ]; then
321
322
  if ! command -v node >/dev/null 2>&1; then
322
- if [ "$SHIM_FAIL_OPEN" -eq 1 ]; then
323
- exit 0
324
- fi
325
- # Blocking-tier: node missing means we cannot sandbox-validate the
326
- # CLI refuse with the dedicated banner.
327
- shim_emit_node_missing_banner
328
- exit 2
329
- fi
330
- sandbox_result=$(shim_sandbox_check "$RESOLVED_CLI_PATH" "$proj" "$SHIM_ENFORCE_CLI_SHAPE")
331
- if [ "$sandbox_result" != "ok" ]; then
332
- sandbox_failed=1
333
- if [ "$SHIM_FAIL_OPEN" -eq 1 ]; then
334
- shim_emit_sandbox_skip_banner "$sandbox_result"
335
- exit 0
336
- fi
337
- # Blocking-tier: clear REA_ARGV so Tier-1 policy reads (in
338
- # shim_policy_short_circuit) degrade to Tier 2 / Tier 3 instead
339
- # of invoking the untrusted CLI.
323
+ # 0.38.1 round-2 P2 fix: pre-fix this branch exited 0/2 IMMEDIATELY
324
+ # without ever calling shim_policy_short_circuit, so a blocking-
325
+ # tier shim whose policy said "disabled" still refused when node
326
+ # was absent (which contradicts the pre-port body's no-op-on-
327
+ # disabled posture). Clear REA_ARGV here so Tier 1 (rea CLI)
328
+ # can't fire — the policy reader degrades to Tier 2 (python3) /
329
+ # Tier 3 (awk), neither of which needs node. Track node-missing
330
+ # separately so the CLI-required branch below can emit the right
331
+ # banner if the policy did NOT short-circuit us out.
332
+ node_missing=1
340
333
  REA_ARGV=()
334
+ else
335
+ sandbox_result=$(shim_sandbox_check "$RESOLVED_CLI_PATH" "$proj" "$SHIM_ENFORCE_CLI_SHAPE")
336
+ if [ "$sandbox_result" != "ok" ]; then
337
+ sandbox_failed=1
338
+ if [ "$SHIM_FAIL_OPEN" -eq 1 ]; then
339
+ shim_emit_sandbox_skip_banner "$sandbox_result"
340
+ exit 0
341
+ fi
342
+ # Blocking-tier: clear REA_ARGV so Tier-1 policy reads (in
343
+ # shim_policy_short_circuit) degrade to Tier 2 / Tier 3 instead
344
+ # of invoking the untrusted CLI.
345
+ REA_ARGV=()
346
+ fi
341
347
  fi
342
348
  fi
343
349
 
344
- # 6. Policy short-circuit. Runs BEFORE the CLI-missing branch so a
345
- # shim whose policy says "disabled" exits 0 cleanly even when the
346
- # CLI is unbuilt (matches the pre-port body's no-op-on-disabled
347
- # posture). The policy reader's 4-tier ladder produces correct
348
- # answers even when REA_ARGV is empty (falls back to Tier 2
349
- # python3 / Tier 3 awk).
350
+ # 6. Policy short-circuit. Runs BEFORE the CLI-missing / node-missing
351
+ # banners so a shim whose policy says "disabled" exits 0 cleanly
352
+ # even when the CLI is unbuilt OR node is absent (matches the
353
+ # pre-port body's no-op-on-disabled posture). The policy reader's
354
+ # 4-tier ladder produces correct answers when REA_ARGV is empty:
355
+ # falls back to Tier 2 python3 if available, or Tier 3 awk
356
+ # (block-form only) otherwise.
350
357
  if declare -F shim_policy_short_circuit >/dev/null 2>&1; then
351
358
  if shim_policy_short_circuit; then
352
359
  exit 0
353
360
  fi
354
361
  fi
355
362
 
363
+ # 6b. node-missing fail branch — only fires if shim_policy_short_circuit
364
+ # did NOT exit us out above. Emits the dedicated node-missing
365
+ # banner for blocking-tier; advisory-tier exits 0 silently.
366
+ if [ "$node_missing" -eq 1 ]; then
367
+ if [ "$SHIM_FAIL_OPEN" -eq 1 ]; then
368
+ exit 0
369
+ fi
370
+ shim_emit_node_missing_banner
371
+ exit 2
372
+ fi
373
+
356
374
  # 7. CLI-required branch. If REA_ARGV is empty either (a) the CLI
357
375
  # wasn't installed/built, OR (b) the sandbox check failed and we
358
376
  # cleared it above. Distinguish.