@windyroad/risk-scorer 0.2.1 → 0.3.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@windyroad/risk-scorer",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "description": "Pipeline risk scoring, commit/push gates, and secret leak detection",
5
5
  "bin": {
6
6
  "windyroad-risk-scorer": "./bin/install.mjs"
@@ -0,0 +1,92 @@
1
+ ---
2
+ name: wr-risk-scorer:assess-release
3
+ description: On-demand release risk assessment. Scores commit, push, and release risk for the current unpushed changes. Delegates to wr-risk-scorer:pipeline and satisfies the commit gate for the current session.
4
+ allowed-tools: Read, Glob, Grep, Bash, AskUserQuestion, Skill
5
+ ---
6
+
7
+ # Release Risk Assessment Skill
8
+
9
+ Run a pipeline risk assessment on demand — outside a hook gate trigger. Scores commit, push, and release risk layers for the current unpushed changes and satisfies the gate for the current session.
10
+
11
+ This skill is **read-only**. It does not commit, push, or modify files. The bypass marker is written automatically by the `PostToolUse:Agent` hook (`risk-score-mark.sh`) after the subagent completes — the skill never writes to `$TMPDIR/claude-risk-*` directly.
12
+
13
+ ## When to use
14
+
15
+ - Before committing: confirm the risk score before running `git commit`
16
+ - Pre-flight release check: get a release readiness score before deciding to ship
17
+ - On-demand: any time you want a risk score without triggering a gate event
18
+
19
+ ## Steps
20
+
21
+ ### 1. Parse arguments
22
+
23
+ Read `$ARGUMENTS` for an explicit release scope (e.g., "release v1.3.0", "commits since last tag", "changeset X"). If a scope is provided, use it. If empty, proceed to auto-detection.
24
+
25
+ ### 2. Auto-detect context
26
+
27
+ Run the following to establish the assessment scope:
28
+
29
+ ```bash
30
+ # Unpushed commits
31
+ git log origin/$(git rev-parse --abbrev-ref HEAD)..HEAD --oneline 2>/dev/null || git log HEAD --oneline -10
32
+
33
+ # Staged diff
34
+ git diff --cached --stat
35
+
36
+ # Changesets directory (if present)
37
+ ls .changeset/*.md 2>/dev/null | head -20
38
+ ```
39
+
40
+ Summarise what you find:
41
+ - Number of unpushed commits and their subjects
42
+ - Files staged for commit (if any)
43
+ - Changesets queued for release (if any)
44
+
45
+ ### 3. Resolve ambiguity
46
+
47
+ If the scope is genuinely ambiguous (e.g., no unpushed commits but the user said "assess the release"), use `AskUserQuestion` to ask:
48
+
49
+ > "I don't see any unpushed commits. What scope should I assess?
50
+ > (a) All commits since the last git tag
51
+ > (b) Only the currently staged diff
52
+ > (c) A specific range — please specify
53
+ > (d) Cancel"
54
+
55
+ Do not ask if there is an obvious unpushed commit queue.
56
+
57
+ ### 4. Construct the assessment prompt
58
+
59
+ Build a self-contained prompt for the pipeline subagent that includes:
60
+ - The git log summary (unpushed commits with subjects)
61
+ - The staged diff summary (file names and line counts)
62
+ - The changeset list (if any)
63
+ - Any explicit scope the user provided
64
+
65
+ ### 5. Delegate to wr-risk-scorer:pipeline
66
+
67
+ Invoke the pipeline subagent via the `Skill` tool:
68
+
69
+ ```
70
+ subagent_type: wr-risk-scorer:pipeline
71
+ prompt: <constructed assessment prompt from step 4>
72
+ ```
73
+
74
+ Wait for the subagent to complete. The subagent will output a structured `RISK_SCORES:` block. The `PostToolUse:Agent` hook (`risk-score-mark.sh`) reads that output and writes the bypass marker files automatically.
75
+
76
+ **Do not write to `$TMPDIR/claude-risk-*` yourself.** The hook is the only correct mechanism.
77
+
78
+ ### 6. Present results
79
+
80
+ Present the full risk report to the user. Highlight:
81
+ - The three risk scores (commit / push / release) and their labels
82
+ - Any risks above appetite (score ≥ 5 per RISK-POLICY.md)
83
+ - Whether the gate is now pre-satisfied for the current session (i.e., a subsequent `git commit` will reuse the bypass marker without re-triggering the scorer)
84
+
85
+ If any score is above appetite, use `AskUserQuestion` to ask whether the user wants to:
86
+ - (a) Proceed anyway (bypass)
87
+ - (b) Remediate the identified risks first
88
+ - (c) Cancel
89
+
90
+ Do not make the decision unilaterally — per ADR-013 Rule 1, all above-appetite risk decisions are the user's.
91
+
92
+ $ARGUMENTS
@@ -0,0 +1,61 @@
1
+ ---
2
+ name: wr-risk-scorer:assess-wip
3
+ description: On-demand WIP risk nudge. Scores the current uncommitted diff for pipeline risk. Use during development to catch high-risk changes before committing.
4
+ allowed-tools: Read, Glob, Grep, Bash, AskUserQuestion, Skill
5
+ ---
6
+
7
+ # WIP Risk Assessment Skill
8
+
9
+ Run a WIP (work-in-progress) risk assessment on demand. Scores the current uncommitted diff — staged and unstaged — for pipeline risk. Use during development to get early feedback before committing.
10
+
11
+ This skill is **read-only**. It does not commit, push, or modify files.
12
+
13
+ Unlike `assess-release`, this skill does not pre-satisfy the commit gate. WIP assessment is a development nudge; the pipeline gate is satisfied only by a full `wr-risk-scorer:pipeline` assessment (via `assess-release` or a commit attempt).
14
+
15
+ ## When to use
16
+
17
+ - After a significant edit: check whether the change is introducing high pipeline risk
18
+ - Before `git add`: confirm the uncommitted diff is within appetite
19
+ - Exploratory: understand the risk profile of a branch mid-development
20
+
21
+ ## Steps
22
+
23
+ ### 1. Auto-detect context
24
+
25
+ Run the following to capture the current WIP state:
26
+
27
+ ```bash
28
+ # All uncommitted changes (staged + unstaged, non-binary)
29
+ git diff HEAD --stat
30
+
31
+ # Summary of what's changed
32
+ git status --short
33
+ ```
34
+
35
+ If `git diff HEAD` is empty (clean working tree), report "No uncommitted changes detected" and exit. Do not invoke the subagent with an empty scope.
36
+
37
+ ### 2. Construct the assessment prompt
38
+
39
+ Build a self-contained prompt for the wip subagent that includes:
40
+ - The edited file path(s) (from `git diff HEAD --name-only`)
41
+ - A summary of what changed (stat output)
42
+
43
+ ### 3. Delegate to wr-risk-scorer:wip
44
+
45
+ Invoke the wip subagent via the `Skill` tool:
46
+
47
+ ```
48
+ subagent_type: wr-risk-scorer:wip
49
+ prompt: <constructed assessment prompt from step 2>
50
+ ```
51
+
52
+ Wait for the subagent to complete.
53
+
54
+ ### 4. Present results
55
+
56
+ Present the WIP risk nudge to the user. The wip subagent provides guidance and recommendations, not a formal gate score. Highlight:
57
+ - The highest-risk files or change patterns identified
58
+ - Any recommendations to reduce risk before committing
59
+ - Whether a full pipeline assessment (`assess-release`) is recommended before committing
60
+
61
+ $ARGUMENTS