Skip to content

Add JSON output format for CI/CD pipeline integration #3

@UrRhb

Description

@UrRhb

Description

burn0 currently outputs cost data in a human-readable format to the terminal. It would be great to have a --json flag for npx burn0 report that outputs structured JSON, making it easy to integrate with CI/CD pipelines, dashboards, or custom tooling.

Expected behavior

npx burn0 report --json

Should output something like:

{
  "total": 4.32,
  "calls": 47,
  "services": {
    "openai": { "cost": 3.80, "calls": 35 },
    "anthropic": { "cost": 0.52, "calls": 12 }
  },
  "period": "today"
}

Implementation hints

  • The report command likely lives in src/ — find the current report formatter
    • Add a --json CLI flag that switches the output formatter
      • Reuse existing cost aggregation logic, just serialize as JSON instead of formatted text
        • Add a test that verifies JSON output is valid and contains expected fields

This is a good first issue because

  • Clear input/output specification
    • Doesn't require understanding the core cost-tracking internals
      • Great way to learn the CLI architecture

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions