Registry format

A registry is a folder of JSON files that the CLI installs blocks from. The Engine defines the format and publishes a JSON Schema for each file, so anyone can host a registry, and any tool can read or check one.

The files

A registry is served from disk or over HTTP:

  • registry.json, the index: every item, without file contents.
  • <name>.json, one item with its files.
  • agents.json and llms.txt, what agents need to know about each definition.

The Engine's is at /r/ for the latest release and /r/v/<version>/ for each release.

An item

{
  "$schema": "https://uiuxengine.com/schema/v2/registry-item.json",
  "itemFormat": 2,
  "kind": "block",
  "name": "empty-state",
  "id": "engine.empty-state",
  "version": "0.1.0",
  "title": "Empty State",
  "description": "Says that a view has nothing to show yet, and offers the action that fills it.",
  "engine": "^0.4.0",
  "license": "MIT",
  "access": "free",
  "hash": "501888c0…",
  "dependencies": ["@uiuxengine/core", "@uiuxengine/react", "@uiuxengine/tokens", "react"],
  "requires": [],
  "icons": ["inbox"],
  "definition": {
    "contract": "empty-state.contract.ts",
    "design": "empty-state.design.ts"
  },
  "files": [{ "path": "empty-state.contract.ts", "content": "…" }]
}
Field What it is
$schema The item's JSON Schema. Optional, for editors and validators.
itemFormat The format of the file.
kind What the item installs. Always block for now.
name The item's folder name, in kebab-case.
id The definition's full id, namespace.name.
version The item's version.
engine The Engine versions the item was made and checked for.
license The license of the files.
access free or pro. Information for registries; it changes nothing in the files.
hash The SHA-256 of the installable content.
dependencies The npm packages the files import. The CLI lists the missing ones; it installs none.
requires Other items, by name, to install first.
icons The UI/UX Icons ids the design uses.
definition The files, among files, that export the contract and the design.
files The files, each with a path relative to the item's folder and its content.

add writes each file to <blocks>/<name>/<path>, which is src/blocks/empty-state/empty-state.tsx with the default settings. A path is plain: letters, digits, ., _ and - in segments separated by /, at most 200 characters, with no segment that starts with a dot. No two files may share a path, compared without case.

The index, registry.json, has a name, an optional homepage and items: each item as in its own file, without $schema and without file contents.

Three version numbers

  • itemFormat is the format of the file. It goes up when a reader of the previous format would misread the new one, and each format has its own schema URL, /schema/v<itemFormat>/. The CLI reads one format and names both when an item is in another.
  • version is the item's. It goes up when the content changes, and so the hash. Within a format, two items with the same name and version have the same hash.
  • engine is the range of Engine versions the item works with: ^x.y.z, or comparators (>=, >, <=, <, =) separated by spaces. Declare only versions the item has been run with. add and upgrade refuse an item whose range doesn't include the project's Engine.

The content hash

The hash covers what a project installs: kind, name, id, version, license, dependencies, requires, icons, definition and files. It leaves out $schema, itemFormat, title, description, engine and access, so a registry can correct a description, widen a range or change access without a new version.

To compute it:

  1. Take an object with the covered fields. Sort dependencies, requires and icons, and sort files by path, each by UTF-16 code unit. Keep only path and content in each file.
  2. Serialize it as JSON with keys sorted by UTF-16 code unit at every level, no whitespace, and strings escaped as JavaScript's JSON.stringify escapes them.
  3. Hash the UTF-8 bytes with SHA-256 and write the digest as lowercase hex.

For this item:

{
  "kind": "block",
  "name": "notice",
  "id": "acme.notice",
  "version": "1.0.0",
  "license": "MIT",
  "dependencies": ["react", "@uiuxengine/react"],
  "requires": [],
  "icons": ["info"],
  "definition": { "contract": "notice.contract.ts", "design": "notice.design.ts" },
  "files": [
    { "path": "notice.tsx", "content": "export const Notice = () => null;\n" },
    { "path": "notice.contract.ts", "content": "export const contract = {};\n" },
    { "path": "notice.design.ts", "content": "export const design = {};\n" }
  ]
}

the serialized string is:

{"definition":{"contract":"notice.contract.ts","design":"notice.design.ts"},"dependencies":["@uiuxengine/react","react"],"files":[{"content":"export const contract = {};\n","path":"notice.contract.ts"},{"content":"export const design = {};\n","path":"notice.design.ts"},{"content":"export const Notice = () => null;\n","path":"notice.tsx"}],"icons":["info"],"id":"acme.notice","kind":"block","license":"MIT","name":"notice","requires":[],"version":"1.0.0"}

and the hash is 9622017af78ed67046cd06438f40b33a0f053b5ec84a6ff9dfb900f46d741de9.

The lockfile records the hash of each installed item, and the MCP server reports an upgrade when the registry's hash differs from it.

Validation

The CLI checks every item and index before it uses any of it, because a registry may be anyone's. It checks in two layers:

  • Structure: the fields, their types and values, the patterns of names, ids, packages, icons and paths, and that lists have no duplicates. The JSON Schemas check the same rules, so a schema-valid item passes this layer.
  • Meaning: what a schema can't express. engine parses as a range, no two files share a destination, definition names files the item ships, and the hash matches the content.

Before add writes a file, it also checks that the destination is inside the item's folder.

JSON Schemas

The schemas are JSON Schema 2020-12 and work with any validator for it:

A schema never changes once released. A new format gets a new folder, and the old ones stay.

A block is source code your app runs. Install blocks only from registries you trust, as you would npm packages.