CLI reference

norcube cms validate

Check a site's CMS schema and content the way the editor does

Not verified yet

Reads the site checkout at path (default: the current directory) and reports what the Norcube CMS editor would: schema files that do not load or contradict themselves, content that breaks a field's rules, and links, images and references that point at nothing. Nothing is sent anywhere; the command needs no sign-in.

Three groups of checks run, selectable with --only:

schema   .norcube/cms/ loads: YAML, $ref, field types and knobs, select
         options, bounds, regexes, visibleIf paths, storages, preview
content  every content file against its collection: required, value
         shapes, array item kinds and bounds, regex, length, uniqueness,
         custom validators, out-of-schema keys
links    the site as a whole: two files at one URL, links no page
         produces, missing images and files, dangling references

Each finding names the file, the field path inside it, a severity and a rule id (schema.unresolved_ref, content.required, links.missing_asset…). Rule ids are stable; match on them in scripts.

The exit code follows --fail-on: with "error" (the default) the command exits 1 when any finding is an error, with "warning" when any finding exists, with "none" it always exits 0 and only reports. A path that is not a CMS site exits 3.

Usage

norcube cms validate [path] [flags]

Examples

norcube cms validate
norcube cms validate ./site --fail-on warning
norcube cms validate --only schema
# In CI, keep the report as an artifact
norcube cms validate -o json > cms-validate.json
norcube cms validate -o json --query "findings[?rule=='links.missing_asset'].file"

Flags

FlagDefaultDescription
--collectionCheck the content and links of one collection only, by its key
--fail-onerrorExit 1 on findings of this severity or worse: warning, error or none
--onlyRun only these checks: schema, content, links (repeatable or comma-separated; default all)

Every command also takes the global flags: --profile, --org, -o, --query, --debug and more.

See also

  • norcube cms: Check a Norcube CMS site's schema and content from its repository

On this page