ontoref-code/domains/schema.ncl
2026-07-10 01:44:59 +01:00

49 lines
2.1 KiB
Text

# domains/schema.ncl — contract for ontoref domain extension manifests.
#
# A domain is a self-contained extension loaded by ontoref when the project's
# repo_kind matches one of the domain's declared repo_kinds.
# Domains live in $ONTOREF_ROOT/domains/{id}/ and provide:
# - commands.nu → CLI commands dispatched by the bash wrapper
# - domain.ncl → this contract: declared commands, pages, requirements
# - repo_kinds.txt → plain-text list of matching repo_kind values (bash-readable)
let domain_command_type = {
id | String, # e.g. "cfp list", "career skills --tier"
description | String,
usage | String | default = "",
examples | Array String | default = [],
} in
let domain_page_type = {
id | String, # "cfp", "career"
route | String, # "/personal/cfp"
title | String,
template | String, # filename stem in domain's pages/ dir
nav_label | String | default = "",
} in
let domain_type = {
id | String,
name | String,
repo_kinds | Array String, # must match values in manifest.ncl RepoKind enum
description | String | default = "",
commands | Array domain_command_type | default = [],
pages | Array domain_page_type | default = [],
# .ontoref/ontology/*.ncl stems that must exist for commands to work
required_extensions | Array String | default = [],
commands_script | String | default = "commands.nu",
short_alias | String | default = "",
# For domains whose NCL schemas live in an external project (not ontoref itself).
# The command must print the project root path to stdout — resolved via the
# global project registry. Consumers import as:
# import "rustelo/domains/rustelo/ontology/schema.ncl"
# where the prefix is the path returned by schema_cmd.
# Empty string means the domain's schemas are co-located in ontoref's domains/ dir.
schema_cmd | String | default = "",
} in
{
DomainCommand = domain_command_type,
DomainPage = domain_page_type,
Domain = domain_type,
}