Table of Contents
- Validation Scripts
- auto_detect_platform.php
- check_changelog.php
- check_dolibarr_module.php
- check_enterprise_readiness.php
- check_joomla_manifest.php
- check_language_structure.php
- check_license_headers.php
- check_no_secrets.php
- check_paths.php
- check_php_syntax.php
- check_repo_health.php
- check_structure.php
- check_tabs.php
- check_version_consistency.php
- check_xml_wellformed.php
- scan_drift.php
- check_composer_deps.php
← Home
Validation Scripts
Scripts in api/validate/ check a repository or project for standards compliance.
All scripts extend CliFramework and support --help, --dry-run, --verbose,
--quiet, and --json unless noted otherwise.
The typical invocation pattern is:
php api/validate/<script>.php --path /path/to/repo [OPTIONS]
Run all validations at once via:
php api/validate/check_repo_health.php --path .
auto_detect_platform.php
Auto-detects the repository platform (Joomla, Dolibarr, Node.js, etc.) and validates its structure against the detected schema.
php api/validate/auto_detect_platform.php --path .
php api/validate/auto_detect_platform.php --repo-path /path/to/repo --schema-dir api/definitions/
| Option | Description |
|---|---|
--repo-path |
Repository path (default: .) |
--schema-dir |
Directory containing schema .tf definition files |
--output-dir |
Directory to write detection report |
check_changelog.php
Validates CHANGELOG.md structure: presence of ## [Unreleased] section,
semantic version headings, and Keep-a-Changelog format.
php api/validate/check_changelog.php --path .
check_dolibarr_module.php
Validates the directory structure of a Dolibarr ERP module: required files, descriptor, language keys, and SQL install scripts.
php api/validate/check_dolibarr_module.php --path /path/to/module
check_enterprise_readiness.php
Comprehensive enterprise-readiness check: copyright headers, PSR-12 markers, strict types, forbidden functions, and documentation completeness.
php api/validate/check_enterprise_readiness.php --path .
php api/validate/check_enterprise_readiness.php --path . --strict
| Option | Description |
|---|---|
--strict |
Fail on warnings as well as errors |
check_joomla_manifest.php
Validates the Joomla XML manifest (*.xml): required elements, version format,
namespace declarations, and file list accuracy.
php api/validate/check_joomla_manifest.php --path /path/to/extension
check_language_structure.php
Validates Joomla/Dolibarr language .ini files: KEY=value format, no BOM,
consistent line endings, and no duplicate keys.
php api/validate/check_language_structure.php --path /path/to/extension
check_license_headers.php
Advisory check: ensures source files contain a valid SPDX-License-Identifier comment. Reports files that are missing headers without blocking.
php api/validate/check_license_headers.php --path .
check_no_secrets.php
Advisory check: scans committed files for patterns that resemble secrets (API keys, passwords, private keys). Uses heuristic regex patterns.
php api/validate/check_no_secrets.php --path .
check_paths.php
Advisory check: ensures all path strings in source files use forward slashes
(/) rather than backslashes for cross-platform compatibility.
php api/validate/check_paths.php --path .
check_php_syntax.php
Runs php -l against every tracked .php file and reports syntax errors.
php api/validate/check_php_syntax.php --path .
check_repo_health.php
Master health-check script: aggregates results from multiple validators and produces a score (0–100). Optionally creates a GitHub issue with the report.
# Basic health check
php api/validate/check_repo_health.php --path .
# With JSON output
php api/validate/check_repo_health.php --path . --json
# Fail below threshold (default 70)
php api/validate/check_repo_health.php --path . --threshold 80
# Create a GitHub issue with results
php api/validate/check_repo_health.php --path . --create-issue --repo owner/repo
| Option | Default | Description |
|---|---|---|
--threshold <n> |
70 |
Minimum passing score (0–100) |
--json |
off | Machine-readable output |
--create-issue |
off | Post results as a GitHub issue |
--repo <owner/repo> |
— | Repository for issue creation |
check_structure.php
Validates that required directories and files exist in the repository root.
php api/validate/check_structure.php --path .
check_tabs.php
Checks that no literal tab characters exist in source files (files that should
use spaces per .editorconfig). Note: PHP and Markdown files are expected to
use tabs — this check targets YAML files.
php api/validate/check_tabs.php --path .
check_version_consistency.php
Compares version numbers across README.md, CHANGELOG.md, composer.json,
and FILE INFORMATION headers to detect drift.
php api/validate/check_version_consistency.php
php api/validate/check_version_consistency.php --verbose
check_xml_wellformed.php
Validates all tracked .xml files are well-formed (parse without errors).
php api/validate/check_xml_wellformed.php --path .
scan_drift.php
Scans multiple repositories in a GitHub organization for divergence from moko-platform templates. Can create GitHub issues in drifted repos.
php api/validate/scan_drift.php --org MokoConsulting
php api/validate/scan_drift.php --org MokoConsulting --type dolibarr --json
php api/validate/scan_drift.php --org MokoConsulting --create-issues --threshold 20
| Option | Description |
|---|---|
--org <name> |
GitHub organization to scan |
--repos <list> |
Comma-separated list of specific repos |
--type <type> |
Filter by project type |
--create-issues |
Open drift issues in affected repos |
--threshold <n> |
Minimum drift % to flag (default: 10) |
--json |
Machine-readable output |
check_composer_deps.php
Validates composer.json across all governed repos: checks the enterprise
dependency (mokoconsulting-tech/enterprise) is present and pinned to the
correct version branch, detects stale dev-main references, and verifies
composer.lock exists.
php api/validate/check_composer_deps.php --repo MokoCRM
php api/validate/check_composer_deps.php --all
php api/validate/check_composer_deps.php --all --json
| Option | Description |
|---|---|
--repo <name> |
Check a single repository |
--all |
Check all governed repos |
--json |
Machine-readable JSON output |
--org <name> |
GitHub organization (default: MokoConsulting) |
Repo: moko-platform · moko-platform wiki
| Field | Value |
|---|---|
| Minimum Version | 04.07.00 |
| Platform | all |
| Applies To | All repositories |
| Revision | Date | Author | Description |
|---|---|---|---|
| 1.0 | 2026-05-08 | Moko Consulting | Initial version |