Usage
Description
Validate a registry source without building it. This command performs comprehensive validation checks on the registry manifest (registry.jsonc or registry.json) including schema validation, file existence checks, circular dependency detection, and duplicate target detection. Intended for registry authors who want to verify their registry before building or deploying.
Unlike ocx build --dry-run, this command focuses exclusively on validation and provides detailed error reporting without attempting to generate output files.
Arguments
| Argument | Required | Description |
|---|---|---|
path | No | Registry source directory (default: current directory) |
Flags
| Flag | Shorthand | Default | Description |
|---|---|---|---|
--cwd <path> | Current directory | Working directory | |
--json | false | Output as JSON (both success and failure) | |
--quiet | -q | false | Suppress all output (including errors) |
--no-duplicate-targets | Skip duplicate target validation |
Examples
Validate Registry in Current Directory
Validate from a Specific Directory
CI/CD Integration
ocx validate uses distinct exit codes so CI can tell validation failures apart from runtime/tool failures:
0— registry is valid78— configuration or validation failed (CONFIG_ERRORorVALIDATION_FAILED)- other non-zero codes — runtime/tool failures (for example missing manifest/source directory, I/O, or internal errors)
files/ are validation failures and return 78.
Example shell gate:
Skip Duplicate Target Validation
JSON Output for Scripting
Quiet Mode
0 for valid, 78 for configuration/validation failures—including missing referenced files under files/—and other non-zero for runtime/tool failures).
Note: When using --json and --quiet together, JSON output takes precedence.
Output
Success
Validation Failure
Human-readable output:Runtime / Tool Failure (JSON)
Runtime failures (for example missing manifest file, I/O failures, or internal errors) use the standard failure envelope with non-validation error codes:Validation Checks
The validate command performs the following checks:- Schema Validation — Validates the manifest structure and required fields
- File Existence — Ensures all referenced files exist in the source directory
- Circular Dependencies — Detects circular dependencies between components
- Duplicate Targets — Identifies components that write to the same target paths
Source Structure
The validate command expects a manifest file in the source directory (registry.jsonc preferred, registry.json also supported):
Errors
| Error | Cause | Solution |
|---|---|---|
| Schema validation failed | Invalid manifest structure (registry.jsonc or registry.json) | Check error messages for specific schema violations |
| File not found | Referenced file missing from source | Ensure all files in manifest exist in files/ directory |
| Circular dependency detected | Components depend on each other | Review component dependencies and remove cycles |
| Duplicate target paths | Multiple components write to same path | Update target paths to be unique |
See Also
- ocx build — Build a registry from source (includes validation).
- Creating Registries — Full guide for registry authors.
- Registry Protocol — Technical specification for registry HTTP APIs.
- CLI Reference — All commands.