Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:0sec labs 0 Report Formatters

From Leeroopedia
Knowledge Sources
Domains Source_Code_Review, Reporting, Formatting
Last Updated 2026-10-29 00:00 GMT

Overview

Concrete tool for formatting security review reports in terminal, JSON, Markdown, HTML, SARIF, and PDF formats, provided by the 0security CLI formatters module.

Description

The formatter registry in packages/cli/src/formatters/index.ts provides formatReviewReport, formatAuditReport, formatReport, and generatePdfReport functions. Each takes a ScanReport from the agent loop and produces formatted output in the selected format (--format terminal|json|md|html|sarif|pdf). SARIF output follows the OASIS SARIF v2.1.0 specification for CI/CD integration.

Usage

Import these when you need to format scan results for display, CI/CD integration, or archival. They are Step 6 of the source code security review workflow.

Code Reference

Source Location

  • Repository: 0security
  • File: packages/cli/src/formatters/index.ts (formatter registry)

Signature

export function formatReviewReport(report: ScanReport, opts?: FormatOpts): string;
export function formatAuditReport(report: ScanReport, opts?: FormatOpts): string;
export function formatReport(report: ScanReport, format: OutputFormat, opts?: FormatOpts): string;
export function generatePdfReport(report: ScanReport, outputPath: string): Promise<void>;

type OutputFormat = "terminal" | "json" | "md" | "html" | "sarif" | "pdf";

Import

import { formatReport, generatePdfReport } from "./formatters/index.js";

I/O Contract

Inputs

Name Type Required Description
report ScanReport Yes /// Scan report from the agent loop
format OutputFormat Yes (formatReport) /// Output format
outputPath string Yes (generatePdfReport) /// PDF file path

Outputs

Name Type Description
return Promise<void> /// Formatted report string (or PDF file written)

Usage Examples

Via CLI

# Terminal output (default)
0 review ./repo --format terminal

# SARIF for CI/CD
0 review ./repo --format sarif > results.sarif

# PDF report
0 review ./repo --format pdf

Programmatic

import { formatReport } from "./formatters/index.js";

const jsonOutput = formatReport(scanReport, "json");
const sarifOutput = formatReport(scanReport, "sarif");
console.log(jsonOutput);

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment