# CLI

> The envy command-line tool validates Envy documents in CI, prints the event and data contract, outlines screens, writes handoff files and prints the JSON Schema.

Source: https://envyui.com/docs/cli

`tools/envy.mjs` is a single Node.js file. It ships in every AI handoff package, so agents and CI can use it without the editor.

```sh
$ node tools/envy.mjs validate ui/my_ui.envy.json
0 error(s), 0 warning(s) — 24 screens, 180 components, 6098 layers
```

## Commands

| Command | Does |
|---|---|
| `envy validate <file> [--json]` | Checks references and contracts. Exits with 1 on errors, so it can gate CI |
| `envy describe <file> [--screen "Name"]` | Markdown outline of screens: text, bindings, actions |
| `envy contract <file>` | Events, data paths, screens and animations as JSON |
| `envy prompt <file> [--engine godot\|web]` | A prompt for an AI coding assistant |
| `envy handoff <file> <out-dir>` | Writes AGENTS.md, SCREENS.md, contract.json and code stubs |
| `envy schema` | The JSON Schema of the document format |

## In CI

```yaml
- run: node tools/envy.mjs validate ui/my_ui.envy.json
```

A failing check stops the build before a broken UI reaches players.

## What validate checks

Missing children, parents, components, assets, tokens, screens and animations; invalid colors; empty or unsafe event names; focus targets that aren't buttons or sit on another screen; component properties with the wrong type or a missing target; translation keys that are invalid, missing or unused; and data paths with no sample value.
