> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ancha.io/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> These docs describe the Ancha CLI, npm package @ancha-labs/cli version 0.1.4, and the hosted workspace at app.ancha.io. Coding agents should start at https://docs.ancha.io/coding-agents. Run the CLI as `ancha` after `npm install -g @ancha-labs/cli`, or as `npx -y @ancha-labs/cli@0.1.4` without installing. Pass --json for machine-readable output, or set ANCHA_JSON=1. Every command ends with a `next:` line naming the next command. Exit codes: 0 pass, 1 a check failed or a comparison regressed, 2 usage, config or authentication error, 3 infrastructure error, 4 unimplemented endpoint with --strict.

# ancha schema

> Print the JSON Schema of ancha.yaml, scene files and the CLI's JSON outputs, for editor validation and for harnesses that parse Ancha's output.

`ancha schema` prints JSON Schema (draft 2020-12) for every file you write for Ancha and every JSON output you parse from it.

```bash theme={null}
ancha schema [options] [kind]
```

| Argument | Description |
| - | - |
| `kind` | One of: ancha, scene, run\_started, run\_finished, explain, world\_up, check, error (default: all) |

| Kind | Describes |
| - | - |
| `ancha` | `ancha.yaml`. See [ancha.yaml](https://docs.ancha.io/reference/ancha-yaml.md). |
| `scene` | Scene files, the same schema `ancha scene schema` prints. See [Test file](https://docs.ancha.io/reference/test-file.md). |
| `run_started` | The first NDJSON event of `ancha run --json`. |
| `run_finished` | The last event of `ancha run --json`, `ancha wait --json` and `ancha logs --follow --json`, with the run summary. |
| `explain` | The output of `ancha explain --json`. |
| `world_up` | The output of `ancha world up --json`. |
| `check` | The output of `ancha check --json`. |
| `error` | The `{"error": {...}}` object every command prints when it fails with `--json`. |

## Examples

```bash theme={null}
ancha schema scene > scene.schema.json      # for your editor's YAML language server
ancha schema run_finished                   # what a harness parses after a run
ancha schema --json                         # every kind in one object
```

The output is always JSON, with or without `--json`. With a kind it prints `{"version": 1, "kind": "run_finished", "schema": {...}}`; without, `{"version": 1, "kinds": [...], "schemas": {...}}`. `version` changes only when a shape changes incompatibly. Adding a field keeps it.

## Exit codes

`0`. An unknown kind exits `2`:

```text Output theme={null}
error[USAGE]: unknown schema: nope
hint: available: ancha, scene, run_started, run_finished, explain, world_up, check, error
```


## Related topics

- [ancha.yaml](https://docs.ancha.io/reference/ancha-yaml.md)
- [ancha run](https://docs.ancha.io/cli/run.md)
- [Test file (scene.yaml)](https://docs.ancha.io/reference/test-file.md)
- [CLI overview](https://docs.ancha.io/cli/overview.md)
- [Errors and exit codes](https://docs.ancha.io/reference/errors.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.