JSON Schema
abtree publishes a JSON Schema for tree YAML files so editors and validators verify a tree before it ever touches the CLI.
Sources
- CLI —
abtree docs schemaprints the schema to stdout. Byte-identical to the committed file. - Repository —
tree.schema.jsononmain. - Release — every GitHub release ships
tree.schema.jsonas an asset. - Stable URL —
https://abtree.sh/schemas/tree.schema.json.
Configure editor integration
Add a YAML language-server comment at the top of every tree file:
# yaml-language-server: $schema=https://abtree.sh/schemas/tree.schema.json
name: my-tree
version: 1.0.0
tree:
type: action
name: Greet
steps:
- instruct: say helloVS Code with the Red Hat YAML extension, Neovim with yaml-language-server, and any other LSP client that speaks the same protocol then surfaces completions, type tooltips, and inline error highlights as you author the tree.
The $schema keyword as a top-level YAML field is also accepted by the parser if you prefer to embed it inline rather than as a comment.
CI validation
The repository test suite parses every bundled tree under trees/ through TreeFileSchema to catch malformed trees. A separate CI job regenerates tree.schema.json from the zod source on every push and fails the build if the committed file has drifted — contributors run bun run schema whenever they touch the zod schema in src/schemas.ts.
Source of truth
The schema is generated from src/schemas.ts via src/schemas.ts:buildJsonSchema(), the single function called by both scripts/generate-schema.ts (build time) and cmdDocsSchema (runtime). The committed tree.schema.json is the build output, kept fresh by CI.
Next
- Discover trees — browse the published behaviour-tree packages you can install and run.
- Authoring trees — the field reference the schema enforces.
- Writing trees — tutorial walkthrough that builds the bundled
hello-worldtree from scratch.