@windyroad/risk-scorer 0.19.1 → 0.19.2

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.
@@ -310,5 +310,5 @@
310
310
  }
311
311
  },
312
312
  "name": "wr-risk-scorer",
313
- "version": "0.19.1"
313
+ "version": "0.19.2"
314
314
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wr-risk-scorer",
3
- "version": "0.19.1",
3
+ "version": "0.19.2",
4
4
  "description": "Pipeline risk scoring, commit/push gates, and secret leak detection",
5
5
  "author": {
6
6
  "name": "Windy Road Technology",
@@ -138,6 +138,24 @@ _gh_api_has_body() {
138
138
  printf '%s' "$1" | grep -qE '(^|[[:space:]])(--field|--raw-field|--input|-f|-F)([[:space:]]|=)'
139
139
  }
140
140
 
141
+ # P537: return success only when at least one matched command segment can
142
+ # publish. Every publish segment must opt into a true dry run before the
143
+ # external-comms review can be skipped; mixed commands therefore fail closed.
144
+ _npm_publish_has_real_invocation() {
145
+ local segment
146
+ while IFS= read -r segment; do
147
+ if printf '%s' "$segment" | grep -qE '^\s*npm publish(\s|$)'; then
148
+ if ! printf '%s' "$segment" | grep -qE '(^|[[:space:]])--dry-run(=true)?($|[[:space:]])' \
149
+ || printf '%s' "$segment" | grep -qE '(^|[[:space:]])(--dry-run=false|--no-dry-run)($|[[:space:]])'; then
150
+ return 0
151
+ fi
152
+ fi
153
+ done <<EOF
154
+ $(printf '%s' "$1" | tr ';&|' '\n\n\n')
155
+ EOF
156
+ return 1
157
+ }
158
+
141
159
  # ---------- Surface detection ----------
142
160
  SURFACE=""
143
161
  DRAFT=""
@@ -180,7 +198,11 @@ except Exception:
180
198
  exit 0
181
199
  fi
182
200
  elif echo "$COMMAND" | grep -qE '(^|;|&&|\|\|)\s*npm publish(\s|$)'; then
183
- SURFACE="npm-publish"
201
+ if _npm_publish_has_real_invocation "$COMMAND"; then
202
+ SURFACE="npm-publish"
203
+ else
204
+ exit 0
205
+ fi
184
206
  elif echo "$COMMAND" | grep -qE '(^|;|&&|\|\|)\s*git commit(\s|$)'; then
185
207
  # P082 Phase 1: gate `git commit -m / --message / HEREDOC` so commit
186
208
  # message bodies are reviewed by the voice-tone + risk evaluators
@@ -431,7 +453,7 @@ fi
431
453
  # (sha256(DRAFT + '\n' + SURFACE)). Single fire per gate cycle.
432
454
  VERDICT_PREFIX="${EXTERNAL_COMMS_VERDICT_PREFIX:-EXTERNAL_COMMS_${EXTERNAL_COMMS_EVALUATOR_ID^^}}"
433
455
  if [ -n "${CODEX_THREAD_ID:-}" ]; then
434
- COMPLETION_GUIDANCE='On Codex, wait for the reviewer to finish, then close that completed agent once before retrying; the PostToolUse compatibility hook consumes the completed close response and persists its structured verdict, with no transcript parsing or nested codex exec.'
456
+ COMPLETION_GUIDANCE='On Codex, the calling agent waits for the reviewer to finish, then invokes `interrupt_agent` once on that completed target before retrying; the PostToolUse compatibility hook consumes the completed response and persists its structured verdict, with no transcript parsing or nested codex exec.'
435
457
  else
436
458
  COMPLETION_GUIDANCE='On Claude Code, dispatch the reviewer SYNCHRONOUSLY (run_in_background: false): a background-launched reviewer does not fire its PostToolUse mark hook, so the marker never persists and this gate re-blocks (P402).'
437
459
  fi
@@ -40,7 +40,7 @@ check_risk_gate() {
40
40
  if [ ! -f "$SCORE_FILE" ]; then
41
41
  RISK_GATE_CATEGORY="missing"
42
42
  if [ -n "${CODEX_THREAD_ID:-}" ]; then
43
- RISK_GATE_REASON="No ${ACTION} risk score found. Delegate to the native Codex agent wr-risk-scorer:pipeline to assess cumulative pipeline risk, wait for it to finish, then close that completed agent once before retrying. The PostToolUse compatibility hook consumes the completed close response and persists its structured verdict; no transcript parsing or nested codex exec is required."
43
+ RISK_GATE_REASON="No ${ACTION} risk score found. Delegate to the native Codex agent wr-risk-scorer:pipeline to assess cumulative pipeline risk, wait for it to finish, then invoke interrupt_agent once on that completed target before retrying. The PostToolUse compatibility hook consumes the completed response and persists its structured verdict; no transcript parsing or nested codex exec is required."
44
44
  else
45
45
  RISK_GATE_REASON="No ${ACTION} risk score found. Delegate to wr-risk-scorer:pipeline (subagent_type: 'wr-risk-scorer:pipeline') to assess cumulative pipeline risk. Dispatch the scorer SYNCHRONOUSLY (run_in_background: false): a background-launched scorer does not fire its PostToolUse:Agent mark hook, so no marker persists and this gate re-blocks despite a within-appetite score (P402)."
46
46
  fi
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@windyroad/risk-scorer",
3
- "version": "0.19.1",
3
+ "version": "0.19.2",
4
4
  "description": "Pipeline risk scoring, commit/push gates, and secret leak detection",
5
5
  "scripts": {
6
6
  "prepack": "node scripts/sync-codex-skills.mjs --pack",
@@ -24,7 +24,7 @@ const restoreMode = process.argv.includes("--restore-pack");
24
24
 
25
25
  const preamble = `<!-- Generated from packages/risk-scorer/skills/*/SKILL.md by packages/risk-scorer/scripts/sync-codex-skills.mjs during npm pack. Do not edit packaged output directly. -->
26
26
 
27
- > Codex runtime note: use \`request_user_input\` only in Plan Mode where this skill needs structured user input. Outside Plan Mode, ask one concise direct question only when no safe assumption exists. If a step refers to Claude-style agent dispatch or \`subagent_type\`, use a native Codex subagent workflow and spawn the matching installed \`wr-risk-scorer:<mode>\` custom agent. Wait for it to finish, then close that completed agent once so the PostToolUse compatibility hook can persist its structured verdict. Do not parse transcripts or launch nested \`codex exec\`. Do not substitute the built-in \`default\` agent when a hook consumes the subagent identity; restart Codex if the installed agent is not yet visible.
27
+ > Codex runtime note: use \`request_user_input\` only in Plan Mode where this skill needs structured user input. Outside Plan Mode, ask one concise direct question only when no safe assumption exists. If a step refers to Claude-style agent dispatch or \`subagent_type\`, use a native Codex subagent workflow and spawn the matching installed \`wr-risk-scorer:<mode>\` custom agent. Wait for it to finish, then invoke \`interrupt_agent\` once on that completed target so the PostToolUse compatibility hook can persist its structured verdict. Do not parse transcripts or launch nested \`codex exec\`. Do not substitute the built-in \`default\` agent when a hook consumes the subagent identity; restart Codex if the installed agent is not yet visible.
28
28
 
29
29
  `;
30
30
 
@@ -6,7 +6,7 @@ allowed-tools: Read, Glob, Grep, Bash, request_user_input, Skill
6
6
 
7
7
  <!-- Generated from packages/risk-scorer/skills/*/SKILL.md by packages/risk-scorer/scripts/sync-codex-skills.mjs during npm pack. Do not edit packaged output directly. -->
8
8
 
9
- > Codex runtime note: use `request_user_input` only in Plan Mode where this skill needs structured user input. Outside Plan Mode, ask one concise direct question only when no safe assumption exists. If a step refers to Claude-style agent dispatch or `subagent_type`, use a native Codex subagent workflow and spawn the matching installed `wr-risk-scorer:<mode>` custom agent. Wait for it to finish, then close that completed agent once so the PostToolUse compatibility hook can persist its structured verdict. Do not parse transcripts or launch nested `codex exec`. Do not substitute the built-in `default` agent when a hook consumes the subagent identity; restart Codex if the installed agent is not yet visible.
9
+ > Codex runtime note: use `request_user_input` only in Plan Mode where this skill needs structured user input. Outside Plan Mode, ask one concise direct question only when no safe assumption exists. If a step refers to Claude-style agent dispatch or `subagent_type`, use a native Codex subagent workflow and spawn the matching installed `wr-risk-scorer:<mode>` custom agent. Wait for it to finish, then invoke `interrupt_agent` once on that completed target so the PostToolUse compatibility hook can persist its structured verdict. Do not parse transcripts or launch nested `codex exec`. Do not substitute the built-in `default` agent when a hook consumes the subagent identity; restart Codex if the installed agent is not yet visible.
10
10
 
11
11
 
12
12
  # External-Comms Risk Assessment Skill
@@ -6,7 +6,7 @@ allowed-tools: Read, Glob, Grep, Bash, request_user_input, Skill
6
6
 
7
7
  <!-- Generated from packages/risk-scorer/skills/*/SKILL.md by packages/risk-scorer/scripts/sync-codex-skills.mjs during npm pack. Do not edit packaged output directly. -->
8
8
 
9
- > Codex runtime note: use `request_user_input` only in Plan Mode where this skill needs structured user input. Outside Plan Mode, ask one concise direct question only when no safe assumption exists. If a step refers to Claude-style agent dispatch or `subagent_type`, use a native Codex subagent workflow and spawn the matching installed `wr-risk-scorer:<mode>` custom agent. Wait for it to finish, then close that completed agent once so the PostToolUse compatibility hook can persist its structured verdict. Do not parse transcripts or launch nested `codex exec`. Do not substitute the built-in `default` agent when a hook consumes the subagent identity; restart Codex if the installed agent is not yet visible.
9
+ > Codex runtime note: use `request_user_input` only in Plan Mode where this skill needs structured user input. Outside Plan Mode, ask one concise direct question only when no safe assumption exists. If a step refers to Claude-style agent dispatch or `subagent_type`, use a native Codex subagent workflow and spawn the matching installed `wr-risk-scorer:<mode>` custom agent. Wait for it to finish, then invoke `interrupt_agent` once on that completed target so the PostToolUse compatibility hook can persist its structured verdict. Do not parse transcripts or launch nested `codex exec`. Do not substitute the built-in `default` agent when a hook consumes the subagent identity; restart Codex if the installed agent is not yet visible.
10
10
 
11
11
 
12
12
  # Inbound-Report Risk Assessment Skill
@@ -6,7 +6,7 @@ allowed-tools: Read, Glob, Grep, Bash, request_user_input, Skill
6
6
 
7
7
  <!-- Generated from packages/risk-scorer/skills/*/SKILL.md by packages/risk-scorer/scripts/sync-codex-skills.mjs during npm pack. Do not edit packaged output directly. -->
8
8
 
9
- > Codex runtime note: use `request_user_input` only in Plan Mode where this skill needs structured user input. Outside Plan Mode, ask one concise direct question only when no safe assumption exists. If a step refers to Claude-style agent dispatch or `subagent_type`, use a native Codex subagent workflow and spawn the matching installed `wr-risk-scorer:<mode>` custom agent. Wait for it to finish, then close that completed agent once so the PostToolUse compatibility hook can persist its structured verdict. Do not parse transcripts or launch nested `codex exec`. Do not substitute the built-in `default` agent when a hook consumes the subagent identity; restart Codex if the installed agent is not yet visible.
9
+ > Codex runtime note: use `request_user_input` only in Plan Mode where this skill needs structured user input. Outside Plan Mode, ask one concise direct question only when no safe assumption exists. If a step refers to Claude-style agent dispatch or `subagent_type`, use a native Codex subagent workflow and spawn the matching installed `wr-risk-scorer:<mode>` custom agent. Wait for it to finish, then invoke `interrupt_agent` once on that completed target so the PostToolUse compatibility hook can persist its structured verdict. Do not parse transcripts or launch nested `codex exec`. Do not substitute the built-in `default` agent when a hook consumes the subagent identity; restart Codex if the installed agent is not yet visible.
10
10
 
11
11
 
12
12
  # Release Risk Assessment Skill
@@ -6,7 +6,7 @@ allowed-tools: Read, Glob, Grep, Bash, request_user_input, Skill
6
6
 
7
7
  <!-- Generated from packages/risk-scorer/skills/*/SKILL.md by packages/risk-scorer/scripts/sync-codex-skills.mjs during npm pack. Do not edit packaged output directly. -->
8
8
 
9
- > Codex runtime note: use `request_user_input` only in Plan Mode where this skill needs structured user input. Outside Plan Mode, ask one concise direct question only when no safe assumption exists. If a step refers to Claude-style agent dispatch or `subagent_type`, use a native Codex subagent workflow and spawn the matching installed `wr-risk-scorer:<mode>` custom agent. Wait for it to finish, then close that completed agent once so the PostToolUse compatibility hook can persist its structured verdict. Do not parse transcripts or launch nested `codex exec`. Do not substitute the built-in `default` agent when a hook consumes the subagent identity; restart Codex if the installed agent is not yet visible.
9
+ > Codex runtime note: use `request_user_input` only in Plan Mode where this skill needs structured user input. Outside Plan Mode, ask one concise direct question only when no safe assumption exists. If a step refers to Claude-style agent dispatch or `subagent_type`, use a native Codex subagent workflow and spawn the matching installed `wr-risk-scorer:<mode>` custom agent. Wait for it to finish, then invoke `interrupt_agent` once on that completed target so the PostToolUse compatibility hook can persist its structured verdict. Do not parse transcripts or launch nested `codex exec`. Do not substitute the built-in `default` agent when a hook consumes the subagent identity; restart Codex if the installed agent is not yet visible.
10
10
 
11
11
 
12
12
  # WIP Risk Assessment Skill
@@ -7,7 +7,7 @@ maturity: proposed
7
7
 
8
8
  <!-- Generated from packages/risk-scorer/skills/*/SKILL.md by packages/risk-scorer/scripts/sync-codex-skills.mjs during npm pack. Do not edit packaged output directly. -->
9
9
 
10
- > Codex runtime note: use `request_user_input` only in Plan Mode where this skill needs structured user input. Outside Plan Mode, ask one concise direct question only when no safe assumption exists. If a step refers to Claude-style agent dispatch or `subagent_type`, use a native Codex subagent workflow and spawn the matching installed `wr-risk-scorer:<mode>` custom agent. Wait for it to finish, then close that completed agent once so the PostToolUse compatibility hook can persist its structured verdict. Do not parse transcripts or launch nested `codex exec`. Do not substitute the built-in `default` agent when a hook consumes the subagent identity; restart Codex if the installed agent is not yet visible.
10
+ > Codex runtime note: use `request_user_input` only in Plan Mode where this skill needs structured user input. Outside Plan Mode, ask one concise direct question only when no safe assumption exists. If a step refers to Claude-style agent dispatch or `subagent_type`, use a native Codex subagent workflow and spawn the matching installed `wr-risk-scorer:<mode>` custom agent. Wait for it to finish, then invoke `interrupt_agent` once on that completed target so the PostToolUse compatibility hook can persist its structured verdict. Do not parse transcripts or launch nested `codex exec`. Do not substitute the built-in `default` agent when a hook consumes the subagent identity; restart Codex if the installed agent is not yet visible.
11
11
 
12
12
 
13
13
  # Risk Catalog Bootstrap
@@ -6,7 +6,7 @@ allowed-tools: Read, Write, Edit, Bash, Glob, Grep, request_user_input
6
6
 
7
7
  <!-- Generated from packages/risk-scorer/skills/*/SKILL.md by packages/risk-scorer/scripts/sync-codex-skills.mjs during npm pack. Do not edit packaged output directly. -->
8
8
 
9
- > Codex runtime note: use `request_user_input` only in Plan Mode where this skill needs structured user input. Outside Plan Mode, ask one concise direct question only when no safe assumption exists. If a step refers to Claude-style agent dispatch or `subagent_type`, use a native Codex subagent workflow and spawn the matching installed `wr-risk-scorer:<mode>` custom agent. Wait for it to finish, then close that completed agent once so the PostToolUse compatibility hook can persist its structured verdict. Do not parse transcripts or launch nested `codex exec`. Do not substitute the built-in `default` agent when a hook consumes the subagent identity; restart Codex if the installed agent is not yet visible.
9
+ > Codex runtime note: use `request_user_input` only in Plan Mode where this skill needs structured user input. Outside Plan Mode, ask one concise direct question only when no safe assumption exists. If a step refers to Claude-style agent dispatch or `subagent_type`, use a native Codex subagent workflow and spawn the matching installed `wr-risk-scorer:<mode>` custom agent. Wait for it to finish, then invoke `interrupt_agent` once on that completed target so the PostToolUse compatibility hook can persist its structured verdict. Do not parse transcripts or launch nested `codex exec`. Do not substitute the built-in `default` agent when a hook consumes the subagent identity; restart Codex if the installed agent is not yet visible.
10
10
 
11
11
 
12
12
  # Risk Register Entry Generator
@@ -6,7 +6,7 @@ allowed-tools: Read, Glob, Grep, Bash, Agent
6
6
 
7
7
  <!-- Generated from packages/risk-scorer/skills/*/SKILL.md by packages/risk-scorer/scripts/sync-codex-skills.mjs during npm pack. Do not edit packaged output directly. -->
8
8
 
9
- > Codex runtime note: use `request_user_input` only in Plan Mode where this skill needs structured user input. Outside Plan Mode, ask one concise direct question only when no safe assumption exists. If a step refers to Claude-style agent dispatch or `subagent_type`, use a native Codex subagent workflow and spawn the matching installed `wr-risk-scorer:<mode>` custom agent. Wait for it to finish, then close that completed agent once so the PostToolUse compatibility hook can persist its structured verdict. Do not parse transcripts or launch nested `codex exec`. Do not substitute the built-in `default` agent when a hook consumes the subagent identity; restart Codex if the installed agent is not yet visible.
9
+ > Codex runtime note: use `request_user_input` only in Plan Mode where this skill needs structured user input. Outside Plan Mode, ask one concise direct question only when no safe assumption exists. If a step refers to Claude-style agent dispatch or `subagent_type`, use a native Codex subagent workflow and spawn the matching installed `wr-risk-scorer:<mode>` custom agent. Wait for it to finish, then invoke `interrupt_agent` once on that completed target so the PostToolUse compatibility hook can persist its structured verdict. Do not parse transcripts or launch nested `codex exec`. Do not substitute the built-in `default` agent when a hook consumes the subagent identity; restart Codex if the installed agent is not yet visible.
10
10
 
11
11
 
12
12
  # External-Comms Leak Review Skill (Wrapper)
@@ -6,7 +6,7 @@ allowed-tools: Read, Glob, Bash, Agent
6
6
 
7
7
  <!-- Generated from packages/risk-scorer/skills/*/SKILL.md by packages/risk-scorer/scripts/sync-codex-skills.mjs during npm pack. Do not edit packaged output directly. -->
8
8
 
9
- > Codex runtime note: use `request_user_input` only in Plan Mode where this skill needs structured user input. Outside Plan Mode, ask one concise direct question only when no safe assumption exists. If a step refers to Claude-style agent dispatch or `subagent_type`, use a native Codex subagent workflow and spawn the matching installed `wr-risk-scorer:<mode>` custom agent. Wait for it to finish, then close that completed agent once so the PostToolUse compatibility hook can persist its structured verdict. Do not parse transcripts or launch nested `codex exec`. Do not substitute the built-in `default` agent when a hook consumes the subagent identity; restart Codex if the installed agent is not yet visible.
9
+ > Codex runtime note: use `request_user_input` only in Plan Mode where this skill needs structured user input. Outside Plan Mode, ask one concise direct question only when no safe assumption exists. If a step refers to Claude-style agent dispatch or `subagent_type`, use a native Codex subagent workflow and spawn the matching installed `wr-risk-scorer:<mode>` custom agent. Wait for it to finish, then invoke `interrupt_agent` once on that completed target so the PostToolUse compatibility hook can persist its structured verdict. Do not parse transcripts or launch nested `codex exec`. Do not substitute the built-in `default` agent when a hook consumes the subagent identity; restart Codex if the installed agent is not yet visible.
10
10
 
11
11
 
12
12
  # Pipeline Scoring Skill (Wrapper)
@@ -32,10 +32,9 @@ On Codex, when the Agent tool is exposed as `spawn_agent`, pass
32
32
  explicit agent type on a full-history fork; omitting the type on retry also
33
33
  prevents the completion bridge from binding the returned verdict. `$ARGUMENTS`
34
34
  is already self-contained, so no forked conversation context is required.
35
- After the Codex agent reports completion, close that completed agent exactly
36
- once so the compatibility hook receives the structured result. When Codex
37
- exposes completed-agent close as `interrupt_agent`, invoke it once on the
38
- completed target; do not relaunch or inspect a transcript.
35
+ After the Codex agent reports completion, invoke `interrupt_agent` exactly once
36
+ on that completed target so the compatibility hook receives the structured
37
+ result. Do not relaunch or inspect a transcript.
39
38
 
40
39
  ```
41
40
  subagent_type: wr-risk-scorer:pipeline
@@ -6,7 +6,7 @@ allowed-tools: Read, Write, Edit, Bash, Glob, Grep, request_user_input, Agent
6
6
 
7
7
  <!-- Generated from packages/risk-scorer/skills/*/SKILL.md by packages/risk-scorer/scripts/sync-codex-skills.mjs during npm pack. Do not edit packaged output directly. -->
8
8
 
9
- > Codex runtime note: use `request_user_input` only in Plan Mode where this skill needs structured user input. Outside Plan Mode, ask one concise direct question only when no safe assumption exists. If a step refers to Claude-style agent dispatch or `subagent_type`, use a native Codex subagent workflow and spawn the matching installed `wr-risk-scorer:<mode>` custom agent. Wait for it to finish, then close that completed agent once so the PostToolUse compatibility hook can persist its structured verdict. Do not parse transcripts or launch nested `codex exec`. Do not substitute the built-in `default` agent when a hook consumes the subagent identity; restart Codex if the installed agent is not yet visible.
9
+ > Codex runtime note: use `request_user_input` only in Plan Mode where this skill needs structured user input. Outside Plan Mode, ask one concise direct question only when no safe assumption exists. If a step refers to Claude-style agent dispatch or `subagent_type`, use a native Codex subagent workflow and spawn the matching installed `wr-risk-scorer:<mode>` custom agent. Wait for it to finish, then invoke `interrupt_agent` once on that completed target so the PostToolUse compatibility hook can persist its structured verdict. Do not parse transcripts or launch nested `codex exec`. Do not substitute the built-in `default` agent when a hook consumes the subagent identity; restart Codex if the installed agent is not yet visible.
10
10
 
11
11
 
12
12
  # Risk Policy Generator
@@ -6,7 +6,7 @@ allowed-tools: Read, Glob, Bash, Agent
6
6
 
7
7
  <!-- Generated from packages/risk-scorer/skills/*/SKILL.md by packages/risk-scorer/scripts/sync-codex-skills.mjs during npm pack. Do not edit packaged output directly. -->
8
8
 
9
- > Codex runtime note: use `request_user_input` only in Plan Mode where this skill needs structured user input. Outside Plan Mode, ask one concise direct question only when no safe assumption exists. If a step refers to Claude-style agent dispatch or `subagent_type`, use a native Codex subagent workflow and spawn the matching installed `wr-risk-scorer:<mode>` custom agent. Wait for it to finish, then close that completed agent once so the PostToolUse compatibility hook can persist its structured verdict. Do not parse transcripts or launch nested `codex exec`. Do not substitute the built-in `default` agent when a hook consumes the subagent identity; restart Codex if the installed agent is not yet visible.
9
+ > Codex runtime note: use `request_user_input` only in Plan Mode where this skill needs structured user input. Outside Plan Mode, ask one concise direct question only when no safe assumption exists. If a step refers to Claude-style agent dispatch or `subagent_type`, use a native Codex subagent workflow and spawn the matching installed `wr-risk-scorer:<mode>` custom agent. Wait for it to finish, then invoke `interrupt_agent` once on that completed target so the PostToolUse compatibility hook can persist its structured verdict. Do not parse transcripts or launch nested `codex exec`. Do not substitute the built-in `default` agent when a hook consumes the subagent identity; restart Codex if the installed agent is not yet visible.
10
10
 
11
11
 
12
12
  # WIP Scoring Skill (Wrapper)