coderifts 4.2.0 → 4.2.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.2.1
4
+
5
+ ### Added
6
+
7
+ - **`claude-hook` exit-0 proof block (S4).** On a governed write that is
8
+ ALLOW / CONTINUE_WITH_MONITORING (sink wired), stderr prints a compact
9
+ 3–5 line AUTHORIZED block: `decision` + `execution_action` + `decision_id`
10
+ + receipt fingerprint prefix + the boundary sentence
11
+ `authorized; execution/commit not proven by this hook`. Reuses the
12
+ `renderFinalAnswerProof` wording class. **Never stdout.** Non-governed
13
+ paths (docs-only skip, identical content) stay silent. JSONL
14
+ `hook_continue` gains additive `proof: { decision_id, fp_prefix }`.
15
+ Exit codes unchanged.
16
+
3
17
  ## 4.1.1
4
18
 
5
19
  ### Fixed
package/dist/cli.js CHANGED
@@ -3007,7 +3007,7 @@ var require_package = __commonJS({
3007
3007
  "package.json"(exports2, module2) {
3008
3008
  module2.exports = {
3009
3009
  name: "coderifts",
3010
- version: "4.2.0",
3010
+ version: "4.2.1",
3011
3011
  description: "Detect breaking API changes from the command line. Works locally or with the CodeRifts cloud API.",
3012
3012
  author: "CodeRifts <hello@coderifts.com>",
3013
3013
  license: "MIT",
@@ -101401,6 +101401,27 @@ var require_claude_hook = __commonJS({
101401
101401
  const fp = dr.fingerprint || d.fingerprint || d.verdict_fingerprint || d.input_fingerprint;
101402
101402
  return typeof fp === "string" && fp.length > 0 ? fp : void 0;
101403
101403
  }
101404
+ function fingerprintPrefix(fp) {
101405
+ if (typeof fp !== "string" || fp.length === 0) return void 0;
101406
+ const colon = fp.indexOf(":");
101407
+ if (colon > 0 && colon < fp.length - 1) {
101408
+ const scheme = fp.slice(0, colon + 1);
101409
+ const rest = fp.slice(colon + 1);
101410
+ return scheme + rest.slice(0, 12) + (rest.length > 12 ? "\u2026" : "");
101411
+ }
101412
+ return fp.length > 16 ? `${fp.slice(0, 16)}\u2026` : fp;
101413
+ }
101414
+ function renderAllowProofBlock({ decision, executionAction, decisionId, fingerprint } = {}) {
101415
+ const decPart = decision ? ` decision=${decision}` : "";
101416
+ const eaPart = executionAction ? ` execution_action=${executionAction}` : "";
101417
+ const idPart = decisionId ? ` decision_id=${decisionId}` : "";
101418
+ const lines = [`CodeRifts claude-hook: AUTHORIZED${decPart}${eaPart}${idPart}`];
101419
+ const pref = fingerprintPrefix(fingerprint);
101420
+ if (pref) lines.push(`- receipt: ${pref}`);
101421
+ lines.push("- Interpretation: authorized at verify time for the bound scope only \u2014 see Limits.");
101422
+ lines.push("- authorized; execution/commit not proven by this hook");
101423
+ return lines.join("\n");
101424
+ }
101404
101425
  function hookSessionId(env) {
101405
101426
  const fromEnv = env && env.CODERIFTS_SESSION_ID && String(env.CODERIFTS_SESSION_ID).trim();
101406
101427
  if (fromEnv) return fromEnv;
@@ -101696,7 +101717,17 @@ var require_claude_hook = __commonJS({
101696
101717
  } else if (r.exitCode === 0 && r.site && advisory && !strict) {
101697
101718
  logEv({ type: "hook_advisory_passthrough", exit: 0, decision: r.decision || null, ...extra, cause: r.site });
101698
101719
  } else {
101699
- logEv({ type: "hook_continue", exit: 0, ...extra, cause: r.reason });
101720
+ const proof = r.reason === "allow" ? {
101721
+ decision_id: r.decisionId != null ? r.decisionId : extra.decisionId || null,
101722
+ fp_prefix: fingerprintPrefix(r.fingerprint) || null
101723
+ } : void 0;
101724
+ logEv({
101725
+ type: "hook_continue",
101726
+ exit: 0,
101727
+ ...extra,
101728
+ cause: r.reason,
101729
+ ...proof ? { proof } : {}
101730
+ });
101700
101731
  }
101701
101732
  return r;
101702
101733
  };
@@ -101866,20 +101897,34 @@ var require_claude_hook = __commonJS({
101866
101897
  decisionId: mapped.decisionId
101867
101898
  });
101868
101899
  }
101900
+ errLog(renderAllowProofBlock({
101901
+ decision: mapped.decision,
101902
+ executionAction: mapped.executionAction,
101903
+ decisionId: mapped.decisionId,
101904
+ fingerprint
101905
+ }));
101869
101906
  return emitTerminal({
101870
101907
  exitCode: 0,
101871
101908
  reason: "allow",
101872
101909
  severity: mapped.severity === "WARN" ? "MONITOR" : mapped.severity,
101873
101910
  decision: mapped.decision,
101874
- decisionId: mapped.decisionId
101911
+ decisionId: mapped.decisionId,
101912
+ fingerprint
101875
101913
  });
101876
101914
  }
101915
+ errLog(renderAllowProofBlock({
101916
+ decision: mapped.decision,
101917
+ executionAction: mapped.executionAction,
101918
+ decisionId: mapped.decisionId,
101919
+ fingerprint
101920
+ }));
101877
101921
  return emitTerminal({
101878
101922
  exitCode: 0,
101879
101923
  reason: "allow",
101880
101924
  severity: "ALLOW",
101881
101925
  decision: mapped.decision,
101882
- decisionId: mapped.decisionId
101926
+ decisionId: mapped.decisionId,
101927
+ fingerprint
101883
101928
  });
101884
101929
  }
101885
101930
  module2.exports = {
@@ -101903,6 +101948,8 @@ var require_claude_hook = __commonJS({
101903
101948
  USAGE,
101904
101949
  appendGuardEventLog,
101905
101950
  extractFingerprint,
101951
+ fingerprintPrefix,
101952
+ renderAllowProofBlock,
101906
101953
  HOOK_TRIGGER_SOURCE
101907
101954
  };
101908
101955
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coderifts",
3
- "version": "4.2.0",
3
+ "version": "4.2.1",
4
4
  "description": "Detect breaking API changes from the command line. Works locally or with the CodeRifts cloud API.",
5
5
  "author": "CodeRifts <hello@coderifts.com>",
6
6
  "license": "MIT",