validate
Validate all ModernizeSpec files in a project against their JSON Schemas.
npx modernizespec validate [options]What It Does
Section titled “What It Does”- Locates
.agents/modernization/manifest.json - Reads the
filessection to discover all spec files - Validates each file against its corresponding JSON Schema
- Reports errors with file path, field path, and error message
Options
Section titled “Options”| Flag | Description | Default |
|---|---|---|
--dir <path> | Project directory | Current directory |
--strict | Fail on warnings (not just errors) | Errors only |
--json | Output errors as JSON | Human-readable |
--file <name> | Validate a specific file only | All files |
Examples
Section titled “Examples”Validate All Files
Section titled “Validate All Files”npx modernizespec validateStrict Mode (For CI)
Section titled “Strict Mode (For CI)”npx modernizespec validate --strictValidate Single File
Section titled “Validate Single File”npx modernizespec validate --file domains.jsonJSON Output (For Tooling)
Section titled “JSON Output (For Tooling)”npx modernizespec validate --jsonOutput
Section titled “Output”Human-Readable (Default)
Section titled “Human-Readable (Default)”Validating ModernizeSpec files...
manifest.json ✓ valid domains.json ✗ 2 errors - contexts[0].coupling.internal: must be <= 1 - contexts[1].type: must be "core", "supporting", or "generic" complexity.json ✓ valid extraction-plan.json ✓ valid parity-tests.json ⚠ 1 warning - acceptance.parity_threshold: value 2.0 is unusually high (expected 0-1 range) migration-state.json ✓ valid
Result: 2 errors, 1 warningJSON Output
Section titled “JSON Output”{ "valid": false, "errors": [ { "file": "domains.json", "path": "contexts[0].coupling.internal", "message": "must be <= 1", "severity": "error" } ], "warnings": [ { "file": "parity-tests.json", "path": "acceptance.parity_threshold", "message": "value 2.0 is unusually high (expected 0-1 range)", "severity": "warning" } ]}Exit Codes
Section titled “Exit Codes”| Code | Meaning |
|---|---|
0 | All files valid (no errors; warnings present only if --strict not set) |
1 | Validation errors found |
2 | Spec files not found |
CI Integration
Section titled “CI Integration”# GitHub Actions- name: Validate ModernizeSpec run: npx modernizespec validate --strict
# GitLab CIvalidate-spec: script: npx modernizespec validate --strictSee Also
Section titled “See Also”- JSON Schemas — Schema design and principles
- Schema Validator — Interactive browser-based validation