---
title: Building and Testing
description: Verify source behavior and the generated registry installation contract
---

Run these checks from the repository root with dependencies installed:

```bash
bun demo:check
bun template:check
bun run --cwd packages/registry test:types
bun run --cwd packages/registry test:unit
bun run --cwd packages/registry build
bun run --cwd packages/registry test:installation
```

## Check the distributed item

Source tests verify implementation behavior. Install the generated JSON into an independent ChatJS app to also check file targets, dependencies, and registration. For a tool published at a test endpoint:

```bash
npx chat-js@alpha add https://example.com/r/word-count.json
```

Replace the example URL with the built item's endpoint. Run the receiving app's type checks and environment validation, then exercise the installed item. For gateways, create an app with the selected gateway and send a real message.

## What each check proves

| Check | Detects |
| --- | --- |
| Source type checks and unit tests | Invalid contracts and incorrect implementation behavior |
| Registry build | Invalid registry definitions and missing source files |
| Installation into an independent app | Missing dependencies, incorrect targets, and registration problems |
| Receiving app type checks | Incompatible imports and types in the actual composition |
| Runtime request | Credential, provider, and runtime integration failures |

Type checks cannot verify remote credentials or guarantee every combination of third-party source works. Test the composition you distribute and exercise its external integrations. See [Authoring and Publishing](./authoring) for the build's source ownership boundaries.

## Verify demo and scaffold composition

`bun demo:check` checks full formatted source, including types, comments, descriptors and generated registrations, against the canonical demo installation. Turbo caches successful checks using registry, CLI planner, gateway and demo source inputs. CI runs this check with affected unit tests.

`bun run --cwd packages/cli test:gateways` installs packaged CLI output into independent apps. It covers omitted and installed optional features, adding all five integrations together, repeated sync, exclusive provider replacement, and preservation of modified source and UI ordering. Run these generated-app checks after changing installation targets or composition. They complement the registry's component captures and the demo's runtime tests.

Use [Registry Validation](./validation) for dependency ownership, metadata-derived combinations and whole-project parity.
