Skip to content

Add status-badge generator (SVG + shields.io endpoint) #265

Description

@cursor

Summary

Add a status-badge generator: an SVG badge (total debt and/or trend arrow) teams can embed in a README, plus a shields.io-compatible JSON endpoint artifact.

Motivation

A visible badge is a cheap, high-impact adoption driver — it keeps maintainability debt in front of contributors on the repo landing page. DebtLens already produces all the numbers; it just needs a small badge reporter.

Proposed behavior

  • debtlens scan --format badge (or debtlens badge) writes:
    • debtlens-badge.svg — a self-contained SVG showing e.g. "debt: 142" with severity-based color, and (when history data exists) a trend arrow.
    • debtlens-badge.json — a shields.io endpoint schema ({ schemaVersion, label, message, color }) so users can render via https://img.shields.io/endpoint?url=....
  • Color thresholds configurable (green/yellow/red by total or by high-severity count).

Implementation surface

  • New src/reporters/badgeReporter.ts (pure string SVG + JSON; no new dependency).
  • Wire format/command into src/cli/commands/scan.ts (or a tiny src/cli/commands/badge.ts) and src/reporters/index.ts.
  • Optional trend arrow reads .debtlens/history.jsonl if the history feature is present.
  • Tests: SVG/JSON snapshot, color thresholds, shields endpoint schema validity.

Acceptance criteria

  • Emits a valid self-contained SVG and a shields.io endpoint JSON.
  • Color reflects configurable severity thresholds.
  • Docs (README badge instructions) + CHANGELOG updated.
  • npm run test:all passes.

Difficulty: small.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions