Phi
Registry
@dicehub/phiv1.0.0-beta.1

Overview

Phi discovers public exports from each component and block barrel. The current registry contains258 components and 1 block across47 source groups.

Entries include their granular import path, source file, component type, source group, and compound component parts. Search indexes provide deterministic lookup by name, group, and type.

Runtime API

Import typed metadata from the published registry entrypoint.

import {
  componentRegistry,
  getRegistryComponent,
  registryComponentNames,
  type RegistryComponentName,
} from "@dicehub/phi/registry";

const button = getRegistryComponent("Button");
const chart: RegistryComponentName = "TimeseriesChart";

JSON Export

The same generated data is published as JSON for build tools, agents, and non-TypeScript consumers.

import registry from "@dicehub/phi/registry/component-registry.json" with { type: "json" };

@dicehub/phi/ai/component-registry.json resolves to the same file.

Registry Contract

interface RegistryComponent {
  name: string;
  type: "component" | "block";
  group: string;
  importPath: string;
  sourceFile: string;
  description: string;
  parts?: readonly string[];
}

schemaVersion versions the registry format independently from the package version. Consumers should reject unsupported schema versions before processing entries.

Block Templates

Blocks come in two forms. Compiled blocks such as DeleteResource are regular package exports listed in components with type "block". Block templatessuch as Page Header and Resource List are installable source: the Phi CLI copies their files into the consumer codebase from manifests under templates/blocks/.

Installable templates live in the optional top-level blockTemplates record. A registry without blockTemplates — or with an empty record — has no installable blocks. The record is independent from components and its search indexes, which keep describing package exports only.

interface RegistryBlockTemplate {
  name: string;
  type: "block";
  delivery: "copy";
  group: string;
  description: string;
  entryFile: string;
  files: readonly { source: string; target: string }[];
  dependencies: readonly string[];
}

getRegistryBlockTemplate and registryBlockTemplateNames mirror the component lookup helpers.

Generation

Regenerate metadata whenever a public component barrel changes.

pnpm --filter @dicehub/phi codegen:registry

Package builds regenerate the registry. Typechecking runs a drift check, and package validation verifies the runtime and JSON exports against representative components, charts, compound parts, and blocks.