| file_type | documentation | ||||||
|---|---|---|---|---|---|---|---|
| name | Validation Scripts & Tests | ||||||
| description | Comprehensive validation scripts and tests for frontmatter, JSON, YAML, and branch naming in LightSpeedWP .github repository ensuring schema compliance and governance | ||||||
| version | 1.1.0 | ||||||
| last_updated | 2026-08-30 | ||||||
| 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 ../../.schemas/.
---
config:
theme: default
look: handDrawn
layout: elk
accTitle: Validation System Flow
accDescr: Flowchart showing file discovery through log output with configuration, schema, and pattern inputs
---
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,color:#0f172a
style F fill:#f3e5f5,color:#0f172a
style G fill:#e8f5e8,color:#0f172a
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 validation__tests__/validate-branch-names.test.js— Jest test suite for branch name validation (38 allowed types, forbidden prefix rejection, format validation)validate-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# Validate required portable source folders without modifying files
npm run validate:structure# Check whether JSON files would be formatted
node validate-json.js --format-only --read-only
# Validate syntax only (strict, read-only mode)
node validate-json.js --validate-only --strict --read-only
# Format all JSON files
npm run format:json
# Format active schema files
npm run format:json:schemas
# Validate against a schema
node validate-json.js --glob "data/**/*.json" --schema "schema/my-doc.schema.json" --spec draft2020 --validate-only --read-only# Validate the main .coderabbit.yml file
node validate-coderabbit-yml.cjsnode update-coderabbit-schema.cjsAll schema files are stored in ../../.schemas/.
Default configuration for frontmatter validation is in validate-frontmatter.js.
See the schema files in ../../.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
../../.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
Built by 🧱 LightSpeedWP with ☕, 🚀, and open-source spirit! Contributors
Built by 🧱 LightSpeedWP with ☕, 🚀, and open-source spirit! Contributors
Built by 🧱 LightSpeedWP with ☕, 🚀, and open-source spirit! Contributors
Built by 🧱 LightSpeedWP with ☕, 🚀, and open-source spirit! Contributors
Built by 🧱 LightSpeedWP with ☕, 🚀, and open-source spirit! Contributors
Built by 🧱 LightSpeedWP with ☕, 🚀, and open-source spirit! Contributors
Built by 🧱 LightSpeedWP with ☕, 🚀, and open-source spirit! Contributors
Built by 🧱 LightSpeedWP with ☕, 🚀, and open-source spirit! Contributors
Built by 🧱 LightSpeedWP with ☕, 🚀, and open-source spirit! Contributors
Built by 🧱 LightSpeedWP with ☕, 🚀, and open-source spirit! Contributors
Built by 🧱 LightSpeedWP with ☕, 🚀, and open-source spirit! Contributors
Built by 🧱 LightSpeedWP with ☕, 🚀, and open-source spirit! Contributors
Built by 🧱 LightSpeedWP with ☕, 🚀, and open-source spirit! Contributors
Built by 🧱 LightSpeedWP with ☕, 🚀, and open-source spirit! Contributors
Built by 🧱 LightSpeedWP with ☕, 🚀, and open-source spirit! Contributors
Built by 🧱 LightSpeedWP with ☕, 🚀, and open-source spirit! Contributors