CLI

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

FlagDescriptionDefault
--owner <owner>Repository owner (GitHub org or user)required
--repo <repo>Repository namerequired
--api-url <url>Radar API base URLhttps://radar-api.example.com

Example

$ radar badge --owner acme-corp --repo backend-api

Add these badges to your README.md:

![Architecture Health](https://radar-api.example.com/badge/acme-corp/backend-api?metric=health)
![Radar Gate](https://radar-api.example.com/badge/acme-corp/backend-api?metric=gate)
![Violations](https://radar-api.example.com/badge/acme-corp/backend-api?metric=violations)
![Debt Score](https://radar-api.example.com/badge/acme-corp/backend-api?metric=score)

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).

ScoreColorBadge
80-100Greenarchitecture health | 92/100
50-79Orangearchitecture health | 67/100
0-49Redarchitecture health | 23/100

Gate Status (metric=gate)

Shows whether the latest scan passed or failed the merge gate.

StatusColorBadge
PassingGreenradar | passing
FailingRedradar | failing

Violations (metric=violations)

Shows the total violation count from the latest scan.

CountColorBadge
0Greenviolations | 0
1-5Orangeviolations | 3
6+Redviolations | 12

Debt Score (metric=score)

Shows the raw debt score.

ScoreColorBadge
0Greendebt score | 0
1-15Orangedebt score | 8
16+Reddebt score | 38

Badge Styles

Append &style= to the badge URL to change the appearance:

flat (default)

![Health](https://radar-api.example.com/badge/acme-corp/backend-api?metric=health&style=flat)

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

flat-square

![Health](https://radar-api.example.com/badge/acme-corp/backend-api?metric=health&style=flat-square)

Same as flat but with square corners (no border radius).

for-the-badge

![Health](https://radar-api.example.com/badge/acme-corp/backend-api?metric=health&style=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

![Architecture Health](https://radar-api.example.com/badge/acme-corp/backend-api?metric=health)
![Gate Status](https://radar-api.example.com/badge/acme-corp/backend-api?metric=gate)
![Violations](https://radar-api.example.com/badge/acme-corp/backend-api?metric=violations)
![Debt Score](https://radar-api.example.com/badge/acme-corp/backend-api?metric=score)

Or use a table for horizontal layout:

| Health | Gate | Violations | Debt |
|--------|------|------------|------|
| ![Health](https://radar-api.example.com/badge/acme-corp/backend-api?metric=health) | ![Gate](https://radar-api.example.com/badge/acme-corp/backend-api?metric=gate) | ![Violations](https://radar-api.example.com/badge/acme-corp/backend-api?metric=violations) | ![Score](https://radar-api.example.com/badge/acme-corp/backend-api?metric=score) |

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:

![Health](https://radar-api.example.com/badge/acme-corp/backend-api?metric=health&cb=1)
Technical Debt Radar Documentation