Skip to main content

Visual risk exposure of PRs powered by ai-patch-verifier outputs.

Project description

⭐ diff-risk-dashboard — APV → Risk Summary (Python CLI)

A lean, production-grade Python CLI that ingests ai-patch-verifier (APV) JSON and outputs a clear risk summary in JSON or Markdown.

Manual


CI / build CodeQL Analysis Release License: MIT


Repo layout

.
├── examples/
│   └── sample_apv.json           # APV sample for demos/tests
├── src/diff_risk_dashboard/
│   ├── __main__.py               # module entry
│   ├── cli.py                    # CLI
│   ├── core.py                   # summarization logic
│   └── report.py                 # Markdown generator
├── tests/                        # pytest
└── .github/workflows/            # CI + CodeQL + Release Drafter

🚀 Quick Start

# 1) Clone
git clone https://github.com/CoderDeltaLAN/diff-risk-dashboard.git
cd diff-risk-dashboard

# 2) Install (isolated venv recommended)
python -m venv .venv && source .venv/bin/activate
python -m pip install -U pip
python -m pip install .

# 3) Use the CLI
# Table-like Markdown to file
diff-risk examples/sample_apv.json -f md -o report.md
# JSON to stdout
diff-risk examples/sample_apv.json -f json

CLI usage

diff-risk -h
usage: diff-risk [-h] [-f {md,json}] [-o OUTPUT] input

Diff Risk Dashboard (APV JSON -> summary)

positional arguments:
  input                 Path to ai-patch-verifier JSON

options:
  -h, --help            show this help message and exit
  -f {md,json}, --format {md,json}
                        Output format
  -o OUTPUT, --output OUTPUT
                        Output file; '-' = stdout

Note: Inline JSON strings and wrapper commands (drt, drb, drj, drmd) are not supported in this version. Provide a file path as input.


📦 Expected input (APV-like JSON)

  • Input: JSON with APV-style findings (e.g., objects including a predicted_risk of low|medium|high).
  • The summarizer normalizes case and computes:
    • total
    • by_severity (CRITICAL|HIGH|MEDIUM|LOW|INFO plus lowercase aliases)
    • worst
    • risk_level (red|yellow|green)

Example output (-f json):

{
  "total": 3,
  "by_severity": {
    "critical": 0,
    "high": 1,
    "medium": 1,
    "low": 1,
    "info": 0,
    "CRITICAL": 0,
    "HIGH": 1,
    "MEDIUM": 1,
    "LOW": 1,
    "INFO": 0
  },
  "worst": "HIGH",
  "risk_level": "red"
}

🧪 Local Developer Workflow

# Dev requirements
python -m pip install --upgrade pip
pip install poetry

# Install deps
poetry install --no-interaction

# Local gates
poetry run ruff check .
poetry run black --check .
PYTHONPATH=src poetry run pytest -q
poetry run mypy src

🔧 CI (GitHub Actions)

  • Matrix Python 3.11 / 3.12 aligned with local gates.
  • CodeQL and Release Drafter active.
  • Protected main with required checks and squash merges.

Typical job steps:

- run: python -m pip install --upgrade pip
- run: pip install poetry
- run: poetry install --no-interaction
- run: poetry run ruff check .
- run: poetry run black --check .
- env:
    PYTHONPATH: src
  run: poetry run pytest -q
- run: poetry run mypy src

# Example CLI use in CI
- run: poetry run python -m pip install .
- run: diff-risk examples/sample_apv.json -f md -o report.md

🔒 Security

  • No shell customization required.
  • Keep sensitive data out of public PRs.
  • CodeQL is enabled.

🙌 Contributing

  • Small, atomic PRs using Conventional Commits.
  • Keep gates green before requesting review.
  • Use auto-merge when checks pass.

👤 Author

CoderDeltaLAN (Yosvel)
GitHub: https://github.com/CoderDeltaLAN


💚 Donations & Sponsorship

Support open-source: your donations keep projects clean, secure, and evolving for the global community. Donate


📄 License

Released under the MIT License. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

diff_risk_dashboard-0.4.35.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

diff_risk_dashboard-0.4.35-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file diff_risk_dashboard-0.4.35.tar.gz.

File metadata

  • Download URL: diff_risk_dashboard-0.4.35.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for diff_risk_dashboard-0.4.35.tar.gz
Algorithm Hash digest
SHA256 8a58d4e4e3365ba8ac6f6df28ce2407f06cde35d69f715e632fe8dc60ac774c6
MD5 c6640ee73a231c8d1d196b760806d2f8
BLAKE2b-256 96da4d372618cb362b4fe3b575464236a34015d2c7f39efad7477f19c8b048c7

See more details on using hashes here.

Provenance

The following attestation bundles were made for diff_risk_dashboard-0.4.35.tar.gz:

Publisher: publish-pypi.yml on CoderDeltaLAN/diff-risk-dashboard

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file diff_risk_dashboard-0.4.35-py3-none-any.whl.

File metadata

File hashes

Hashes for diff_risk_dashboard-0.4.35-py3-none-any.whl
Algorithm Hash digest
SHA256 17837c62f407358abe14ea046694339dfc0f9e5a2ff93917c454379fba54cf55
MD5 24d3006f1f3e082ff3a3622e0aa010c3
BLAKE2b-256 432cadb3c05251ba2dd74666263c82c2c01ea0bebcc16bab1aa2db831c5039e9

See more details on using hashes here.

Provenance

The following attestation bundles were made for diff_risk_dashboard-0.4.35-py3-none-any.whl:

Publisher: publish-pypi.yml on CoderDeltaLAN/diff-risk-dashboard

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page