Skip to content

Add JSON output and headless mode for dashboard integration #16

Description

@jeremyfelt

Summary

Add machine-readable output formats and headless operation mode to support dashboard integration and CI/CD pipelines.

Use Cases

  • Dashboard showing visual regression status across projects
  • CI/CD pipeline integration with pass/fail results
  • Automated reporting and notifications
  • Integration with external monitoring systems

Tasks

  • Add --json flag for machine-readable output
  • Implement --silent/--headless mode (no browser opening)
  • Add proper exit codes (0 = no differences, 1 = differences found, 2 = error)
  • Create structured output format for comparison results
  • Support webhook notifications for changes
  • Add summary statistics (total comparisons, differences found, etc.)

JSON Output Format

{
  "timestamp": "2024-01-01T12:00:00Z",
  "property": "homepage",
  "status": "differences_found",
  "summary": {
    "total_comparisons": 6,
    "differences_found": 2,
    "max_difference_percentage": 1.5
  },
  "results": [
    {
      "url": "http://localhost:3000",
      "viewport": "desktop",
      "difference_percentage": 1.5,
      "html_changes": true,
      "diff_image_path": "./compares/homepage-home-desktop-diff.png"
    }
  ]
}

Exit Codes

  • 0: Success, no visual differences
  • 1: Success, but visual differences found
  • 2: Error (missing files, invalid config, etc.)

CLI Flags

  • --json: Output results in JSON format
  • --silent: Don't open browser reports
  • --webhook: POST results to webhook URL
  • --threshold: Override difference threshold for pass/fail

Acceptance Criteria

  • JSON output contains all necessary information for dashboards
  • Exit codes properly indicate success/failure states
  • Silent mode works without opening browsers
  • Webhook integration functions correctly
  • Backward compatibility maintained for interactive usage

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions