| file_type | documentation | |||||
|---|---|---|---|---|---|---|
| name | Frontmatter Validation | |||||
| description | Comprehensive frontmatter validation scripts for LightSpeedWP .github repository ensuring schema compliance and consistency | |||||
| version | 1.0.0 | |||||
| last_updated | 2025-12-04 | |||||
| owners |
|
|||||
| tags |
|
|||||
| apply_to |
|
This directory contains all validation scripts and tests for JSON, YAML, and Markdown frontmatter used throughout the LightSpeedWP .github repository. All validation logic has been consolidated here from previous locations (including scripts/coderabbit-validation/).
The validation system provides automated checking of:
- YAML frontmatter in Markdown files (schema and field validation)
- JSON files (linting, formatting, schema validation)
- YAML configuration files (including
.coderabbit.yml)
All schema files are stored in .github/schemas/.
graph TD
A[File Discovery] --> B[Frontmatter Extraction]
B --> C[Schema Validation]
C --> D[LightSpeed Rules Check]
D --> E[Reference Validation]
E --> F[Report Generation]
F --> G[Log Output]
H[Configuration] --> A
I[Schema File] --> C
J[File Patterns] --> A
style A fill:#e1f5fe
style F fill:#f3e5f5
style G fill:#e8f5e8
validate-frontmatter.js— Validates Markdown frontmatter for all .md files in the repo against the canonical schemavalidate-json.js— Comprehensive JSON linting and validation tool (Prettier, JSONLint, Ajv schema validation)validate-coderabbit-yml.cjs— Validates.coderabbit.ymlfor YAML syntax and required fields, using the latest CodeRabbit schemaupdate-coderabbit-schema.cjs— Downloads and updates the latest CodeRabbit schema for offline validation
__tests__/validate-frontmatter.test.js— Test suite for frontmatter validationvalidate-coderabbit-yml.test.js— Jest test suite for the CodeRabbit YAML validator
- Validates frontmatter against
frontmatter.schema.json - Validates JSON files against schemas (Ajv)
- Validates
.coderabbit.ymlagainst the latest CodeRabbit schema
- Detects file types and applies type-specific validation rules
- Enforces required fields for frontmatter and config files
- Suggests optional but recommended fields for consistency
- Verifies that the deprecated
referencesfrontmatter field is not present and that any needed links live inline in the document body
- Color-coded console output, detailed logs, and summary statistics
# Run validation with default settings
node validate-frontmatter.js# Format all JSON files (read-only check)
node validate-json.js --format-only --read-only
# Validate syntax only (strict mode)
node validate-json.js --validate-only --strict
# Validate against a schema
node validate-json.js --glob "data/**/*.json" --schema "schema/my-doc.schema.json" --spec draft2020# Validate the main .coderabbit.yml file
node validate-coderabbit-yml.cjsnode update-coderabbit-schema.cjsAll schema files are stored in .github/schemas/.
Default configuration for frontmatter validation is in validate-frontmatter.js.
See the schema files in .github/schemas/ for required and recommended fields for each file type.
See script output and logs for validation results, errors, and warnings.
- Automated testing: All validation scripts are run as part of CI/CD pipeline
- Pre-commit hooks: Validate configs and docs before commit
- Logging: Results are logged to
../../logs/validation/
# Install dependencies
npm install
# Run all tests
npm test
# Run tests with coverage
npm run test:coverage
# Watch mode for development
npm run test:watch- Update or add schema in
.github/schemas/ - Add or update validation script in this folder
- Add or update test cases
- Update this README
All validation scripts provide robust error handling and log errors to the console and log files.
- ajv: JSON Schema validation
- ajv-formats: Additional format validators
- js-yaml: YAML parsing and processing
- glob: File pattern matching
- jest: Testing framework (dev dependency)
- Frontmatter Schema
- CodeRabbit Schema
- Tagging Conventions
- Mermaid Diagrams
- YAML Documentation
- Test Coverage Reports
Built by 🧱 LightSpeedWP with ☕, 🚀, and open-source spirit! Contributors