validate
validate a profile file against its schema.
usage
npx declared-md validate [file]
if no file is given, the command looks for whoami.md, whois.md, or whatis.md in the current directory (in that order).
examples
validate a file in the current directory:
npx declared-md validate
validate a specific file:
npx declared-md validate ./whoami.md
npx declared-md validate ./path/to/whois.md
output
valid file
valid whoami.md
invalid file
invalid whoami.md
x handle: must be 2-39 characters, lowercase letters, numbers, and hyphens only
x links.site: must be a valid HTTPS URL (must start with https://)
x status: must be one of: open-to-work, working, building, learning, unavailable
3 errors found.
each error shows the field path and the rule that failed.
exit codes
| code | meaning |
|---|---|
0 | file is valid |
1 | file is invalid (schema errors) |
2 | CLI error (file not found, parse error, etc.) |
use exit codes in scripts:
npx declared-md validate ./whoami.md && echo "ready to publish"
what is validated
the validator checks:
- the file is valid UTF-8
- the frontmatter parses as valid YAML
- all required fields are present:
declared,kind,name,handle - the
declaredvalue matches a known spec version - the
kindvalue matches the filename - the
handlematches^[a-z0-9-]{2,39}$ - the total file size is at most 50 KB
- all URLs in
linksusehttps://(ormailto:for theemailkey) - per-standard rules (e.g.
statusenum values,links.reporequired for whatis)
see the spec for the full list of rules per standard.