11# ⭐ diff-risk-dashboard — APV → Risk Summary (Python CLI)
2- [ ![ Donate - PayPal] ( https://img.shields.io/badge/Donate-PayPal-0070ba?logo=paypal&logoColor=white )] ( https://www.paypal.com/donate/?hosted_button_id=YVENCBNCZWVPW )
3- [ ![ Repo views] ( https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2FCoderDeltaLAN%2Fdiff-risk-dashboard&count_bg=%230070BA&title_bg=%23000000&icon=github.svg&icon_color=%23FFFFFF&title=views&edge_flat=true )] ( https://hits.seeyoufarm.com )
4-
52
6- A lean, production-grade ** Python CLI** that ingests ** ai-patch-verifier (APV)** JSON and outputs a clear ** risk summary** in ** JSON** or ** Markdown** .
3+ A lean, production-grade ** Python CLI** that ingests ** ai-patch-verifier (APV)** JSON and outputs a clear ** risk summary** as ** Markdown** or ** JSON** .
4+ Designed for clean CI; use the JSON output to enforce your own merge gates in workflows.
75
86<div align =" center " >
97
@@ -15,6 +13,9 @@ A lean, production-grade **Python CLI** that ingests **ai-patch-verifier (APV)**
1513[ ![ CodeQL Analysis] ( https://github.com/CoderDeltaLAN/diff-risk-dashboard/actions/workflows/codeql.yml/badge.svg?branch=main )] ( https://github.com/CoderDeltaLAN/diff-risk-dashboard/actions/workflows/codeql.yml )
1614[ ![ Release] ( https://img.shields.io/github/v/release/CoderDeltaLAN/diff-risk-dashboard?display_name=tag )] ( https://github.com/CoderDeltaLAN/diff-risk-dashboard/releases )
1715[ ![ License: MIT] ( https://img.shields.io/badge/License-MIT-blue.svg )] ( LICENSE )
16+ [ ![ GHCR] ( https://img.shields.io/badge/container-ghcr.io-blue )] ( ../../pkgs/container/diff-risk-dashboard )
17+ [ ![ Repo views] ( https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2FCoderDeltaLAN%2Fdiff-risk-dashboard&count_bg=%230070BA&title_bg=%23000000&icon=github.svg&icon_color=%23FFFFFF&title=views&edge_flat=true )] ( https://hits.seeyoufarm.com )
18+ [ ![ Donate - PayPal] ( https://img.shields.io/badge/Donate-PayPal-0070ba?logo=paypal&logoColor=white )] ( https://www.paypal.com/donate/?hosted_button_id=YVENCBNCZWVPW )
1819
1920</div >
2021
@@ -36,110 +37,101 @@ A lean, production-grade **Python CLI** that ingests **ai-patch-verifier (APV)**
3637
3738---
3839
39- ## 🚀 Quick Start
40+ ## 🚀 Quick Start (end users)
41+
42+ <!-- diff-risk:usage:start -->
43+
44+ ### Usage (file path input)
45+
46+ > Input ** must be a file path** to an APV JSON. Inline JSON is not supported.
47+
48+ ``` bash
49+ # JSON output to file
50+ diff-risk examples/sample_apv.json -f json -o out.json
51+
52+ # Markdown output to file
53+ diff-risk examples/sample_apv.json -f md -o report.md
54+
55+ # Send to stdout
56+ diff-risk examples/sample_apv.json -f json -o -
57+ diff-risk examples/sample_apv.json -f md -o -
58+ ```
59+
60+ <!-- diff-risk:usage:end -->
61+
62+ ### Install & run locally
4063
4164``` bash
4265# 1) Clone
4366git clone https://github.com/CoderDeltaLAN/diff-risk-dashboard.git
4467cd diff-risk-dashboard
4568
46- # 2) Install (isolated venv recommended)
47- python -m venv .venv && source .venv/bin/activate
48- python -m pip install -U pip
69+ # 2) Install as package
70+ python -m pip install --upgrade pip
4971python -m pip install .
5072
5173# 3) Use the CLI
52- # Table-like Markdown to file
5374diff-risk examples/sample_apv.json -f md -o report.md
54- # JSON to stdout
55- diff-risk examples/sample_apv.json -f json
5675```
5776
5877### CLI usage
5978
60- ``` bash
61- diff-risk -h
62- ```
63-
64- ```
79+ ``` text
6580usage: diff-risk [-h] [-f {md,json}] [-o OUTPUT] input
6681
67- Diff Risk Dashboard (APV JSON -> summary)
68-
6982positional arguments:
70- input Path to ai-patch-verifier JSON
83+ input Path to ai-patch-verifier JSON file
7184
7285options:
73- -h, --help show this help message and exit
86+ -h, --help Show help and exit
7487 -f {md,json}, --format {md,json}
7588 Output format
7689 -o OUTPUT, --output OUTPUT
7790 Output file; '-' = stdout
7891```
7992
80- > ** Note:** Inline JSON strings and wrapper commands (` drt ` , ` drb ` , ` drj ` , ` drmd ` ) are not supported in this version. Provide a file path as ` input ` .
81-
82- ---
83-
84- ## 📦 Expected input (APV-like JSON)
85-
86- - Input: JSON with APV-style findings (e.g., objects including a ` predicted_risk ` of ` low|medium|high ` ).
87- - The summarizer normalizes case and computes:
88- - ` total `
89- - ` by_severity ` (` CRITICAL|HIGH|MEDIUM|LOW|INFO ` plus lowercase aliases)
90- - ` worst `
91- - ` risk_level ` (` red|yellow|green ` )
92-
93- Example output (` -f json ` ):
93+ #### Example JSON output
9494
9595``` json
9696{
9797 "total" : 3 ,
9898 "by_severity" : {
99- "critical" : 0 ,
10099 "high" : 1 ,
101100 "medium" : 1 ,
102- "low" : 1 ,
103- "info" : 0 ,
104- "CRITICAL" : 0 ,
105- "HIGH" : 1 ,
106- "MEDIUM" : 1 ,
107- "LOW" : 1 ,
108- "INFO" : 0
109- },
110- "worst" : " HIGH" ,
111- "risk_level" : " red"
101+ "low" : 1
102+ }
112103}
113104```
114105
115106---
116107
117- ## 🧪 Local Developer Workflow
108+ ## 🧪 Local Developer Workflow (mirrors CI)
118109
119110``` bash
120- # Dev requirements
121111python -m pip install --upgrade pip
122112pip install poetry
123113
124- # Install deps
114+ # Dependencies
125115poetry install --no-interaction
126116
127117# Local gates
128118poetry run ruff check .
129119poetry run black --check .
130120PYTHONPATH=src poetry run pytest -q
131- poetry run mypy src
121+ # optional:
122+ # poetry run mypy src
132123```
133124
134125---
135126
136127## 🔧 CI (GitHub Actions)
137128
138129- Matrix ** Python 3.11 / 3.12** aligned with local gates.
139- - ** CodeQL** and ** Release Drafter** active.
140- - Protected ` main ` with required checks and squash merges.
130+ - ** CodeQL** on PRs and ` main ` .
131+ - ** Release Drafter** for changelog.
132+ - Branch protection + linear history via squash.
141133
142- Typical job steps:
134+ Typical Python job steps:
143135
144136``` yaml
145137- run : python -m pip install --upgrade pip
@@ -150,28 +142,40 @@ Typical job steps:
150142- env :
151143 PYTHONPATH : src
152144 run : poetry run pytest -q
153- - run : poetry run mypy src
154-
155- # Example CLI use in CI
145+ # Example CLI usage in CI:
156146- run : poetry run python -m pip install .
157147- run : diff-risk examples/sample_apv.json -f md -o report.md
158148` ` `
159149
160150---
161151
152+ ## 🗺 When to Use This Project
153+
154+ - You need a **clear, portable risk summary** from **APV** JSON.
155+ - You want **Markdown/JSON** outputs for PRs, audits, or dashboards.
156+
157+ ---
158+
159+ ## 🧩 Customization
160+
161+ - Produce your own APV JSON and pass the file path as ` input`.
162+ - Choose output format with `--format {md,json}` and write to a file with `--output`.
163+
164+ ---
165+
162166# # 🔒 Security
163167
164- - No shell customization required.
165- - Keep sensitive data out of public PRs.
166- - CodeQL is enabled.
168+ - No shell changes required; pure Python CLI .
169+ - Keep sensitive APV JSON private (avoid public PRs) .
170+ - CodeQL enabled in CI .
167171
168172---
169173
170174# # 🙌 Contributing
171175
172176- Small, atomic PRs using **Conventional Commits**.
173- - Keep gates green before requesting review.
174- - Use auto-merge when checks pass.
177+ - Keep all gates green before asking for review.
178+ - Enable auto-merge once checks pass.
175179
176180---
177181
@@ -192,3 +196,5 @@ Support open-source: your donations keep projects clean, secure, and evolving fo
192196# # 📄 License
193197
194198Released under the **MIT License**. See [LICENSE](LICENSE).
199+
200+ ---
0 commit comments