Content Gate
1 min read
opencx content gate validates your local content files and compares them against the remote to detect drift. It combines local validation (content check) with a remote diff in a single command.
Usage
bash
opencx content gate
Requires authentication via OPENCX_API_KEY.
How It Differs from Check
content check | content gate | |
|---|---|---|
| Local validation | Yes | Yes |
| Remote drift detection | No | Yes |
| Requires auth | No | Yes |
| Use case | Local dev, quick validation | CI pipelines, pre-deploy gates |
content check validates file structure, frontmatter, and naming conventions locally. content gate does the same validation, then fetches the remote state and compares it to detect any differences.
Exit Codes
| Code | Meaning |
|---|---|
| 0 | Content is valid and in sync |
| 1 | Validation failed or content is out of sync |
JSON Output
Use --json for machine-readable output.
bash
opencx content gate --json
Output schema:
json
{
"valid": true,
"synced": true,
"check": {
"valid": true,
"errors": [],
"stats": {
"categories": 3,
"articles": 12
}
},
"diff": {
"hasChanges": false
}
}
When validation fails, synced is false and diff is null:
json
{
"valid": false,
"synced": false,
"check": {
"valid": false,
"errors": [
{ "file": "docs/getting-started/intro.md", "message": "Missing required field: title" }
]
},
"diff": null
}
When to Use Gate vs Check
- Use
content checkduring local development for quick feedback. - Use
content gatein CI pipelines to ensure content is both valid and in sync before deploying. - Use
content checkin pull request workflows where you only need validation without remote comparison.