Blocks and the CLI
A block is a composition, such as the Empty State, that comes as source: a contract, a design and a React file that the CLI copies into your project. Once installed, the files are yours to edit, and the CLI upgrades them later without overwriting your edits.
Components come from npm and stay identical to their definition and their Figma component. Blocks are meant to be changed, so they're copied instead.
Install a block
npm install --save-dev @uiuxengine/cli
npx @uiuxengine/cli add empty-stateadd writes the block's files to src/blocks/empty-state/ and records each file's hash in engine.lock.json. Commit both.
It reads the registry released with your Engine version, https://uiuxengine.com/r/v/<version>/, where the version is the @uiuxengine/core your project has. A released registry never changes, so the same version always installs the same files.
Before writing anything, add checks the block's format and the Engine versions it supports, and refuses a block that's installed already or files that exist with other content. It installs no npm packages; it lists the ones the block imports that your project lacks.
Generate the CSS and manifest
npx @uiuxengine/cli generategenerate writes src/engine/engine.css and src/engine/engine.manifest.json from the Engine, your installed blocks as their files define them now, and your own definitions. Import the CSS next to the Engine's:
import "@uiuxengine/react/styles.css";
import "./engine/engine.css";Run generate after you change a block's contract or design. generate --check writes nothing and fails if the files are out of date, which is useful in CI.
Use it
import { Button } from "@uiuxengine/react";
import { IconInbox } from "@uiuxicons/react/icons/inbox";
import { IconPlus } from "@uiuxicons/react/icons/plus";
import { EmptyState } from "./blocks/empty-state/empty-state.tsx";
<EmptyState
title="No reports yet"
description="Reports you create appear here."
icon={IconInbox}
action={<Button variant="primary" label="Create report" leadingIcon={IconPlus} />}
/>;The Empty State page shows its props, slots and a live spec.
Edit it
What you change decides where to change it:
- Behavior, wiring and copy: edit the React file freely.
- Structure and styling, such as a new part, a spacing or a color: edit the contract or design, then run
generate. React, the CSS, Figma and agents all follow the definition.
Upgrade it
After you update the Engine's packages, bring the block to the version made for the new Engine:
npx @uiuxengine/cli upgrade empty-stateupgrade compares each file in three states: the hash in the lockfile, the file now and the new version.
| You edited it | The new version changed it | Result |
|---|---|---|
| no | yes | updated |
| yes | no | kept: your edit stays |
| yes | yes | conflict: left alone, unless --overwrite <file> |
| no | removed it | removed |
| yes | removed it | kept, and no longer tracked |
It exits with an error while conflicts remain. Merge the new version into your file by hand, or take it with --overwrite <file>.
Configure it
Every setting is optional. Put them in engine.config.ts at the project root:
import { defineConfig } from "@uiuxengine/cli";
export default defineConfig({
blocks: "src/blocks", // where add puts blocks
output: "src/engine", // where generate writes
registry: "https://example.com/r", // another registry, for add and upgrade
});--registry <dir|url> on a command overrides the config, and --cwd <dir> runs it on another project.
Registries
A registry is a folder of JSON files that the CLI installs blocks from, served from disk or over HTTP. Anyone can host one: the registry format and its JSON Schemas are public.
registry.json, the index of every block.<name>.json, one block with its files.agents.jsonandllms.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. To install from another, set registry in engine.config.ts or pass --registry.
Security
A block is source code your app runs. Install blocks only from registries you trust, as you would npm packages.
Before it writes anything, the CLI checks each item: its format and fields, that its hash matches its content, and that every file stays inside the block's folder. It installs no npm packages.