confvis reads confidence reports in JSON or YAML format. This document describes the schema.
{
"title": "string (required)",
"score": "integer (0-100, auto-calculated if omitted)",
"threshold": "integer (required, 0-100)",
"description": "string (optional)",
"thresholds": {
"greenAbove": "integer (optional, 0-100, default 75)",
"yellowAbove": "integer (optional, 0-100, default 50)"
},
"factors": [
{
"name": "string (required)",
"score": "integer (required, 0-100)",
"weight": "integer (required)",
"description": "string (optional)",
"url": "string (optional)"
}
],
"version": "string (optional)",
"generatedAt": "string (optional, ISO 8601 timestamp)",
"source": "string (optional)",
"passLabel": "string (optional, default 'PASS')",
"failLabel": "string (optional, default 'FAIL')"
}| Field | Type | Required | Description |
|---|---|---|---|
title |
string | Yes | Report title, displayed in dashboard header |
score |
integer | No* | Overall confidence score (0-100). Auto-calculated from factors if omitted |
threshold |
integer | Yes | Minimum passing score. Score >= threshold = PASS |
description |
string | No | Detailed report description |
thresholds |
object | No | Custom color thresholds (see below) |
factors |
array | No | Contributing factors breakdown |
version |
string | No | Report version identifier |
generatedAt |
string | No | ISO 8601 timestamp when report was generated |
source |
string | No | Origin of the report (e.g., "ci-pipeline", "manual") |
passLabel |
string | No | Custom label for passing status (default: "PASS") |
failLabel |
string | No | Custom label for failing status (default: "FAIL") |
*Score is auto-calculated as a weighted average if omitted and factors are present.
| Field | Type | Default | Description |
|---|---|---|---|
greenAbove |
integer | 75 | Minimum score for green (success) color |
yellowAbove |
integer | 50 | Minimum score for yellow (warning) color |
Note: greenAbove must be >= yellowAbove. Scores below yellowAbove display in red.
| Field | Type | Required | Description |
|---|---|---|---|
name |
string | Yes | Factor name (e.g., "Test Coverage") |
score |
integer | Yes | Factor score (0-100) |
weight |
integer | Yes | Relative weight in calculations |
threshold |
integer | No | Minimum acceptable score for this factor (0-100). When set, confvis gauge fails if factor score is below this threshold |
description |
string | No | Explanation of this factor |
url |
string | No | Link to detailed report (clickable in dashboard and markdown output) |
{
"title": "Build Status",
"score": 80,
"threshold": 70
}{
"title": "Code Quality Report",
"score": 85,
"threshold": 75,
"description": "Overall code quality assessment for the project.",
"factors": [
{
"name": "Test Coverage",
"score": 92,
"weight": 30,
"description": "Percentage of code covered by tests"
},
{
"name": "Code Complexity",
"score": 78,
"weight": 25,
"description": "Cyclomatic complexity within acceptable range"
},
{
"name": "Documentation",
"score": 88,
"weight": 20,
"description": "API documentation completeness"
},
{
"name": "Security Scan",
"score": 80,
"weight": 25,
"description": "No critical vulnerabilities detected"
}
]
}When score is omitted but factors are present, the score is automatically
calculated as a weighted average:
{
"title": "Auto-Calculated Report",
"threshold": 75,
"factors": [
{"name": "Test Coverage", "score": 80, "weight": 50},
{"name": "Lint Score", "score": 60, "weight": 50}
]
}This calculates to: (80×50 + 60×50) / 100 = 70
{
"title": "High Standards Report",
"score": 85,
"threshold": 80,
"thresholds": {
"greenAbove": 90,
"yellowAbove": 70
}
}With these thresholds, score 85 displays in yellow (warning) instead of green.
{
"title": "CI Pipeline Report",
"score": 92,
"threshold": 80,
"version": "1.2.2",
"generatedAt": "2024-01-15T10:30:00Z",
"source": "github-actions"
}Metadata fields are included in JSON output format (--format json).
{
"title": "Security Audit",
"score": 95,
"threshold": 90,
"passLabel": "COMPLIANT",
"failLabel": "NON-COMPLIANT"
}Custom labels replace the default "PASS"/"FAIL" text in the gauge.
{
"title": "Code Quality",
"score": 88,
"threshold": 75,
"factors": [
{
"name": "Test Coverage",
"score": 92,
"weight": 50,
"description": "Unit and integration test coverage",
"url": "https://codecov.io/gh/org/repo"
},
{
"name": "Static Analysis",
"score": 84,
"weight": 50,
"description": "SonarQube quality gate results",
"url": "https://sonarcloud.io/project/overview?id=org_repo"
}
]
}Factor URLs can link to detailed reports or external tools.
{
"title": "Quality Gates",
"threshold": 75,
"factors": [
{
"name": "Test Coverage",
"score": 85,
"weight": 40,
"threshold": 80,
"description": "Must maintain 80% coverage"
},
{
"name": "Security Scan",
"score": 95,
"weight": 35,
"threshold": 90,
"description": "Security requires 90% minimum"
},
{
"name": "Documentation",
"score": 70,
"weight": 25,
"description": "No threshold - informational only"
}
]
}Per-factor thresholds allow you to enforce minimum scores on individual factors, independent of the aggregate score. The build fails if any factor's score drops below its threshold, even if the overall score passes.
Thresholds can also be set via CLI (--factor-threshold "Coverage:80") or config
file (gauge.factor_thresholds). CLI takes precedence over config, which takes
precedence over the factor's own threshold field.
All examples above can be written in YAML. confvis auto-detects the format based on file extension (.yaml or .yml) or content.
title: Build Status
score: 80
threshold: 70title: Code Quality Report
score: 85
threshold: 75
description: Overall code quality assessment for the project.
factors:
- name: Test Coverage
score: 92
weight: 30
description: Percentage of code covered by tests
- name: Code Complexity
score: 78
weight: 25
description: Cyclomatic complexity within acceptable range
- name: Documentation
score: 88
weight: 20
description: API documentation completeness
- name: Security Scan
score: 80
weight: 25
description: No critical vulnerabilities detectedtitle: High Standards Report
score: 85
threshold: 80
thresholds:
greenAbove: 90
yellowAbove: 70title: Quality Gates
threshold: 75
factors:
- name: Test Coverage
score: 85
weight: 40
threshold: 80
description: Must maintain 80% coverage
- name: Security Scan
score: 95
weight: 35
threshold: 90
description: Security requires 90% minimum
- name: Documentation
score: 70
weight: 25
description: No threshold - informational onlyThe gauge uses color coding based on score. Default thresholds:
| Score Range | Color | Meaning |
|---|---|---|
| 75-100 | Green | Good |
| 50-74 | Yellow | Warning |
| 0-49 | Red | Critical |
You can customize these thresholds in the JSON or via CLI flags (--green-above, --yellow-above).
The pass/fail indicator is based solely on score >= threshold (separate from color thresholds).
scoremust be between 0 and 100thresholdmust be between 0 and 100titlecannot be empty- Factor
namecannot be empty - Factor
scoremust be between 0 and 100 - Factor
weightmust be between 0 and 100 - Factor
threshold(if specified) must be between 0 and 100 thresholds.greenAbovemust be between 0 and 100thresholds.yellowAbovemust be between 0 and 100thresholds.greenAbovemust be >=thresholds.yellowAbove
Invalid input or missing required fields will cause confvis to exit with an error.
A machine-readable JSON Schema is available at schema.json for editor autocompletion and CI validation.
# Install ajv-cli
npm install -g ajv-cli
# Validate a confidence report
npx ajv validate -s docs/schema.json -d confidence.json
# Validate with verbose output
npx ajv validate -s docs/schema.json -d confidence.json --verboseAdd to your .vscode/settings.json for autocompletion and validation:
{
"json.schemas": [
{
"fileMatch": ["**/confidence.json", "**/*-confidence.json"],
"url": "./docs/schema.json"
}
]
}const Ajv = require('ajv');
const schema = require('./docs/schema.json');
const ajv = new Ajv({ allErrors: true });
const validate = ajv.compile(schema);
const report = JSON.parse(fs.readFileSync('confidence.json'));
if (!validate(report)) {
console.error(validate.errors);
}