Component registry
The component registry packages ascii.rest capabilities as named, installable units for external component tools. It lets a developer discover a piece or library feature through a JSON index, then copy the needed source into a project instead of taking the whole npm package.
Registry purpose
The registry is the bridge between the ASCII art library and tools that install source components. The registry entries are served as JSON under /r/, while the ASCII art library remains the source of the pieces and shared capabilities.
The main consumers are:
- shadcn: reads the registry schema and installs entries by URL or registered name.
npx ascii.rest add: reads the same entries and installs them without shadcn.- People and agents: use the registry index to discover available names and their relationships.
References: site/…/registry.ts• L1-16 site/…/registry.json.ts• L1-7 site/…/[name].json.ts• L1-12 site/…/copy.md• L14-16
Registry entry model
Each registry entry describes one capability and the source files that provide it. It also names other entries that must be installed first, so a request for one feature can produce a complete local set of files.
Capability groups
The registry groups the library into a small set of product-facing capabilities. A piece entry supplies one artwork. Core, banner, SVG, and kit entries supply shared library features. The React entries expose <Ascii> and <Banner> as copyable components.
| Entry group | Capability | Typical result |
|---|---|---|
core | Piece contract and mounting | Shared support for local pieces |
banner | Text converted to block-letter art | A reusable text-art capability |
svg | Piece or banner converted to animated SVG | Art for SVG-capable surfaces |
kit | Tools for making new ASCII art | A local creative coding kit |
ascii | React and Next.js piece display | A local <Ascii> component |
ascii-banner | React and Next.js text display | A local <Banner> component |
| Piece names | One catalog artwork | A local file for that piece |
all | The complete registry set | Every supported capability and piece |
References: site/…/registry.ts• L18-30 site/…/registry.ts• L68-115 site/…/copy.md• L190-205
Dependency graph
Registry dependencies describe capability relationships rather than npm package installation. For example, a React piece display needs the core piece contract, while a banner component needs the display component and the banner capability. The installer follows these links and installs dependencies before the requested entry.
flowchart TD
Request[Requested registry item] --> Entry[Item JSON]
Entry --> Dependencies[Registry dependencies]
Dependencies --> Core[core]
Dependencies --> Capability[Shared capability]
Entry --> Files[Source files]
Core --> Local[Complete local component set]
Capability --> Local
Files --> Local
The all entry is a discovery and bulk-install path. It points to every other entry instead of carrying source files of its own.
References: site/…/registry.ts• L54-63 site/…/registry.ts• L68-115 src/cli.ts• L83-117 site/…/copy.md• L118-126
Discovery and installation flow
The registry exposes one index and one item document per name. External tooling starts with the index or a known item URL, follows registry dependencies, and then places the returned source in the project's component area.
When a developer requests an item, the flow is:
- The tool resolves a name such as
donutto /r/donut.json. - The item document identifies its files and registry dependencies.
- Dependencies are fetched once and handled before the requested item.
- The tool validates file targets and external package names.
- The source is copied into the local ASCII component area.
The copied files are intentionally local. They can be changed by the project and do not change when the registry changes. This makes the registry an installation source, not a runtime service.
References: site/…/[name].json.ts• L7-12 src/cli.ts• L83-164 site/…/copy.md• L118-135 site/…/copy.md• L209-238
Registry boundaries
The registry covers source that can stand on its own inside a project. It does not replace the full npm package, so package features that depend on the package's runtime entry points remain outside this copy-based path.
The registry supports:
- individual pieces from the ASCII art catalog;
- shared source for mounting, banners, SVG output, and the creative kit;
- React and Next.js display components;
- an aggregate entry for bulk installation.
The npm package remains the right boundary for the web component, Astro adapters, and terminal APIs. Those surfaces rely on package-level exports rather than registry entries.
References: site/…/registry.ts• L32-39 site/…/registry.ts• L82-103 site/…/copy.md• L41-55 package.json• L18-60
Change checklist
When these files or sections are changed, remember to consider these:
- A new or renamed piece must remain visible through the catalog data used by the registry's piece mapping, or it will not receive an entry.
- A shared capability change must keep its registry dependency links aligned with the imports that copied files use.
- A React registry component change must keep its React package dependency and its links to shared capabilities accurate.
- A registry schema or endpoint change must remain compatible with both the shadcn item format and the CLI item reader.
- A change to the registry base URL must keep generated dependency URLs and CLI registry overrides consistent.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| An item name does not exist | The installer stops before copying that request | Use the registry index or the catalog's exact slug |
| A dependency link is missing or wrong | The copied feature lacks source that its imports need | Update the entry's registry dependency set with its capability links |
| An external item contains an unsafe path or non-text content | The CLI refuses the whole add operation before writing | Validate every item and file target before installation |
| A React entry omits its React dependency | The copied component can fail to install or build | Keep the entry's package dependency declaration aligned with its imports |
| A copied file is overwritten after local edits | Local changes can be lost | Review the diff before using overwrite behavior |
Key files
| File | Why to read it |
|---|---|
| site/…/registry.ts | Defines the item model, capability entries, dependency graph, and registry index |
| site/…/registry.json.ts | Exposes the discovery index consumed by registry tooling |
| site/…/[name].json.ts | Exposes each installable item and its source files |
| src/cli.ts | Shows how the standalone installer resolves dependencies, validates input, and writes files |
| registry/ascii.tsx | Shows the React piece-display capability packaged for copying |
| registry/ascii-banner.tsx | Shows the React banner capability and its relation to the display component |
| site/…/copy.md | Describes the user-facing install choices, dependency behavior, and local-copy boundary |