radar badge
Generate dynamic SVG badges for your README showing debt score, gate status, violations, and architecture health.
radar badge
The badge command generates markdown snippets for dynamic SVG badges that display your project's health metrics. Badges update automatically after each scan.
Usage
radar badge --owner <owner> --repo <repo> [options]
Options
| Flag | Description | Default |
|---|---|---|
--owner <owner> | Repository owner (GitHub org or user) | required |
--repo <repo> | Repository name | required |
--api-url <url> | Radar API base URL | https://radar-api.example.com |
Example
$ radar badge --owner acme-corp --repo backend-api
Add these badges to your README.md:




Copy and paste into your README.md
Available Metrics
Architecture Health (metric=health)
Shows a health score from 0 to 100 (calculated as 100 - debtScore).
| Score | Color | Badge |
|---|---|---|
| 80-100 | Green | architecture health | 92/100 |
| 50-79 | Orange | architecture health | 67/100 |
| 0-49 | Red | architecture health | 23/100 |
Gate Status (metric=gate)
Shows whether the latest scan passed or failed the merge gate.
| Status | Color | Badge |
|---|---|---|
| Passing | Green | radar | passing |
| Failing | Red | radar | failing |
Violations (metric=violations)
Shows the total violation count from the latest scan.
| Count | Color | Badge |
|---|---|---|
| 0 | Green | violations | 0 |
| 1-5 | Orange | violations | 3 |
| 6+ | Red | violations | 12 |
Debt Score (metric=score)
Shows the raw debt score.
| Score | Color | Badge |
|---|---|---|
| 0 | Green | debt score | 0 |
| 1-15 | Orange | debt score | 8 |
| 16+ | Red | debt score | 38 |
Badge Styles
Append &style= to the badge URL to change the appearance:
flat (default)

Standard shields.io-style badge with a subtle gradient.
flat-square

Same as flat but with square corners (no border radius).
for-the-badge

Larger badge with uppercase text and taller height. Good for prominent placement.
Embedding in README
Add all four badges to the top of your README.md:
# My Project




Or use a table for horizontal layout:
| Health | Gate | Violations | Debt |
|--------|------|------------|------|
|  |  |  |  |
Self-Hosted API
If you run a self-hosted Radar API, point badges to your instance:
radar badge --owner acme-corp --repo backend-api --api-url https://radar.internal.acme.com
XSS Protection
All badge values are XML-escaped before rendering into SVG. The escapeXml function sanitizes &, <, >, ", and ' characters to prevent SVG injection attacks. Badge content is never rendered as HTML.
Caching
Badge responses include Cache-Control: no-cache, no-store, must-revalidate headers to ensure GitHub and GitLab always fetch the latest data. If you see stale badges, append a cache-busting query parameter:
