@windyroad/risk-scorer 0.19.10 → 0.19.11
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.
|
@@ -8,6 +8,7 @@ import { fileURLToPath } from "node:url";
|
|
|
8
8
|
import { CLOSE_TOOLS, SPAWN_TOOLS, WAIT_TOOLS, response } from "./lib/codex-completion-input.mjs";
|
|
9
9
|
|
|
10
10
|
const hookDir = dirname(fileURLToPath(import.meta.url));
|
|
11
|
+
const markedPipelineRoots = new Set();
|
|
11
12
|
const riskAgentRoles = new Set([
|
|
12
13
|
"wr-risk-scorer:pipeline",
|
|
13
14
|
"wr-risk-scorer:plan",
|
|
@@ -291,6 +292,7 @@ function markTarget(input, target, output) {
|
|
|
291
292
|
renameSync(claim.claim, claim.done);
|
|
292
293
|
rmSync(state, { force: true });
|
|
293
294
|
rmSync(transportRegistrationPath(input.session_id, role, normalizeTarget(target)), { force: true });
|
|
295
|
+
if (assessment) markedPipelineRoots.add(assessment.root);
|
|
294
296
|
} else {
|
|
295
297
|
rmSync(claim.claim, { force: true });
|
|
296
298
|
process.exitCode = 1;
|
|
@@ -556,3 +558,9 @@ try {
|
|
|
556
558
|
diagnoseSubagentStop(input, "rejected", "transport-error");
|
|
557
559
|
process.exitCode = 0;
|
|
558
560
|
}
|
|
561
|
+
|
|
562
|
+
if (markedPipelineRoots.size && !process.argv.includes("--subagent-stop") && !process.argv.includes("--consume-pending")) {
|
|
563
|
+
const prefixes = [...markedPipelineRoots].map((root) => `cd '${root.replaceAll("'", "'\\''")}' &&`);
|
|
564
|
+
console.log(JSON.stringify({ hookSpecificOutput: { hookEventName: "PostToolUse",
|
|
565
|
+
additionalContext: `Risk score recorded. Begin the next governed commit, push, release, or changeset command with ${prefixes.join(" or ")} inside the shell command; set the tool workdir to the same checkout. Codex may hide a nested workdir from checkout-binding hooks.` } }));
|
|
566
|
+
}
|
|
@@ -112,7 +112,11 @@ fi
|
|
|
112
112
|
|
|
113
113
|
# Gate check: existence, TTL, drift, threshold
|
|
114
114
|
if ! check_risk_gate "$SESSION_ID" "commit"; then
|
|
115
|
-
|
|
115
|
+
if [[ "$RISK_GATE_REASON" == *"checkout binding does not match"* ]]; then
|
|
116
|
+
risk_gate_deny "Commit blocked: ${RISK_GATE_REASON}"
|
|
117
|
+
else
|
|
118
|
+
risk_gate_deny "Commit blocked: ${RISK_GATE_REASON} To proceed: (1) stage files with git add, (2) delegate to wr-risk-scorer:pipeline (subagent_type: 'wr-risk-scorer:pipeline') to assess cumulative pipeline risk. If the commit is risk-neutral or risk-reducing, the scorer will create a bypass marker."
|
|
119
|
+
fi
|
|
116
120
|
exit 0
|
|
117
121
|
fi
|
|
118
122
|
|
package/package.json
CHANGED