Skip to content

Manifest schema

This page is the authoritative reference for matrix.json, mirrored from validateManifestForMxCli in projects/matrix-3/packages/mx-cli/src/utils/manifestValidator.ts.

Run mx validate --json to see the validator's output for any package.

Top-level fields

PathRequiredTypeDiagnostic code
nameyesnon-empty stringMXPKG_NAME_INVALID
versionyesnon-empty stringMXPKG_VERSION_INVALID
descriptionnostring
classnostring
namespacenostring
runtimeyes (object)see belowMXPKG_RUNTIME_INVALID
rootno (object)see below
webappno (object)see below
httpno (object)see below
consumesno (array)see below
exportsno (array of strings)
componentsyes (array, may be empty)see belowMXPKG_COMPONENTS_NOT_ARRAY
permissionsyes (object)see belowMXPKG_PERMISSIONS_*
installno (object)see belowMXPKG_INSTALL_*
configno (object)conventional only

runtime

PathRequiredType
runtime.languageyesnon-empty string
runtime.entryyesnon-empty string
runtime.browserEntrynostring
runtime.bootstrapEntrynostring
runtime.environmentsnostring[] (advisory)
runtime.executionClassCompatibilitynostring[] (advisory)

A missing or empty runtime.language/runtime.entry triggers MXPKG_RUNTIME_INVALID: runtime.language and runtime.entry are required.

permissions

PathRequiredType / allowed values
permissions.fsPolicyyesone of none, matrix-only, project-readonly, project-readwrite, global-readonly (MXPKG_PERMISSIONS_FSPOLICY_INVALID)
permissions.hostApinoone of none, same-origin (MXPKG_PERMISSIONS_HOSTAPI_INVALID)
permissions.networknoboolean (MXPKG_PERMISSIONS_BOOLEAN_INVALID)
permissions.subprocessnoboolean (same code)
permissions.envnoboolean (same code)

components[]

Validator at manifestValidator.ts:158-244.

PathRequiredType / allowed valuesDiagnostic code
components[].typeyesnon-empty stringMXPKG_COMPONENT_TYPE_INVALID
components[].exportnonon-empty string when presentMXPKG_COMPONENT_EXPORT_INVALID
components[].mountnonon-empty string when presentMXPKG_COMPONENT_MOUNT_INVALID
components[].autoStartnobooleanMXPKG_COMPONENT_AUTOSTART_INVALID
components[].propsnoobjectMXPKG_COMPONENT_PROPS_INVALID
components[].fsPolicynosame enum as permissions.fsPolicyMXPKG_COMPONENT_FSPOLICY_INVALID
components[].surfaceno (advisory)string (headless/browser by convention)
components[].descriptionno (advisory)string
components[].acceptsno (advisory)string[]
components[].emitsno (advisory)string[]

A non-array components triggers MXPKG_COMPONENTS_NOT_ARRAY. A non-object element triggers MXPKG_COMPONENT_NOT_OBJECT for that index.

webapp

Read by packages/mx-cli/src/utils/webapp-manifest.ts. Not enforced by the CLI validator, but consumed by mx run --serve and the discovery extractor.

PathType / convention
webapp.distDirstring, relative to package root
webapp.entrystring, file inside distDir (e.g. index.html)
webapp.appNamestring slug (URL component)
webapp.displayNamestring
webapp.iconstring
webapp.navOrdernumber
webapp.descriptionstring
webapp.shellsstring[] (platform, edge)
webapp.basestring (relative is the supported value today)

http

Read by system-gateway-http. Not enforced by the CLI validator.

json
"http": {
  "routes": [{
    "export": "MyHttpSurface",
    "prefixes": ["/api/foo/", "/api/bar/"]
  }]
}

consumes

Advisory list of service contracts the package depends on. Each entry has contract (string), required (boolean), bindingKey (string).

install

PathTypeDiagnostic code
installobjectMXPKG_INSTALL_INVALID if not an object
install.<phase>objectMXPKG_INSTALL_HOOK_INVALID if not an object
install.<phase>.scriptnon-empty stringMXPKG_INSTALL_HOOK_SCRIPT_INVALID
install.<phase>.descriptionoptional string

Phases: validate, migrate, seed, verify. Run in that order during mx install.

root (alternative to components[])

Convention used by packages that have one primary actor:

json
"root": {
  "type": "SystemRootActor",
  "export": "SystemRootActor",
  "mount": "system",
  "surface": "headless",
  "description": "...",
  "accepts": ["system.status", "system.children"]
}

mx publish's preflight requires the package declare at least one of: root, non-empty components[], webapp, or matrix.service.json factory. The validator checks all four together at publish time (packages/mx-cli/src/commands/publish.ts:62-83).

See also

Source: projects/matrix-3/packages/mx-cli/src/utils/manifestValidator.ts is the authoritative validator; packages/mx-cli/src/commands/validate.ts is its CLI face.