CLI Basics
CLI Basics

Validate, scaffold, format, and preview IOModel projects from the terminal.

The iomodel CLI is the command-line entry point for working with a Git-project. It validates the model, scaffolds objects and docs, normalizes YAML, and previews the project locally.

Install

Use it without installing, or install globally:

# one-off
npx @iomodel/cli validate

# global
npm i -g @iomodel/cli

Common commands

CommandPurpose
iomodel validate [scope]Validate the model (whole project or a scope)
iomodel lintStyle checks (naming, orphans, missing descriptions)
iomodel new object <id>Scaffold an object
iomodel new doc <slug>Scaffold a spec page
iomodel formatNormalize model YAML
iomodel previewServe a local preview of the project
iomodel watchRe-validate on file changes
iomodel init [path]Bootstrap IOModel in a folder

Validate

iomodel validate                 # whole project
iomodel validate apps.api        # a single object scope
iomodel validate --json          # machine-readable output
iomodel validate --watch         # re-run on changes
Exit codeMeaning
0No errors (warnings allowed)
1Validation errors
2Fatal error (broken YAML, no project)

JSON for tools and AI

--json emits structured diagnostics (code, file, line, fix suggestions) — the same shape the editor and AI use. Ideal for scripts and CI.

Scaffold

iomodel new object collections.apps.payments \
  --type container --container-type app --title "Payments Service"

iomodel new doc architecture/overview \
  --group architecture --title "Architecture Overview"

Format and preview

iomodel format            # normalize YAML
iomodel format --check    # fail if formatting is needed (CI)

Run iomodel validate before committing, or use iomodel watch while editing so problems surface immediately. See CI Validation to enforce it in pull requests.

Last updated on